[LLVMdev] llvm-qemu. (Was: Newbie)
asl at math.spbu.ru
Sun Apr 6 09:10:55 PDT 2008
> One of the things I noticed in the last message on llvm-qemu was that
> you were compiling with output from qemu with llvm-gcc? Is this correct?
No. QEMU itself has some sort of IR. However, this IR is exposed only
indirectly (mostly at *build* time of QEMU).
The procedure of QEMU's binary code translation is the following:
1. BB is disassembled and converted to QEMU IR (instructions of that IR
are called "ops")
2. Chunks of pre-built binary code needed to execute "ops" are concatenated.
3. Some patching of resulting mega-chunk is performed (to resolve memory
4. The chunk is executed.
The chunks of code, which in fact execute ops are produced at qemu build
time, where C code for ops is emitted, compiled with gcc and
corresponded binary code is then extracted and saved (and that's why all
requirements of gcc version, etc).
llvm-qemu approach was to compile these chunks with llvm-gcc instead of
gcc, thus producing LLVM IR and keeping them in some Module. At binary
translation time Function's for ops are extracted from that Module,
linked together, resulted LLVM IR is optimized and then pushed into JIT.
Hope this is at least understandable :)
WBR, Anton Korobeynikov
More information about the llvm-dev