4

Is there a machanism to convert native machine code to llvm bytecode? If not, please give some idea how to implement it.

Thanks!

flypig
  • 43
  • 6
  • I highly doubt that *any* given machine code could be converted to LLVM bytecode. Perhaps some specific sequences could be converted, but writing a converter that would work on any input is likely impossible. (Or would require emulation of the target CPU inside the VM, which would of course defeat the purpose...) – cdhowie Dec 27 '10 at 03:23
  • I have similar question : [Translation of machinecode into LLVM IR (disassembly / reassembly of X86_64. X86. ARM into LLVM bitcode)](http://stackoverflow.com/questions/6981810/translation-of-machinecode-into-llvm-ir-disassembly-reassembly-of-x86-64-x86) - you might be interested. – Grzegorz Wierzowiecki Aug 30 '11 at 20:02

1 Answers1

7

Libcpu was designed to convert machine code of various architectures to LLVM IR to facilitate writing emulators.

Franck Jeannin
  • 6,107
  • 3
  • 21
  • 33
Peter S. Housel
  • 2,651
  • 1
  • 22
  • 25