[LLVMdev] JIT with MC - structure

Olivier Meurant meurant.olivier at gmail.com
Thu Sep 30 09:52:58 PDT 2010


Hi LLVM folks,

Attached with this email, you will find a patch not directly applicable (it
doesn't compile like this) which (try to) enhance the structure of a
possible JIT with the MC framework.

Basically :
- MCJIT :
  - Main class implementing ExecutionEngine interface
  - owns and creates :
    - a MemoryManager (will be a reuse of the JITMemoryManager mechanism)
    - a MCJITStreamer
    - a PassManager for scheduling of an AsmPrinter (MCLowering) using the
streamer

- MCJITStreamer
  - owns and creates :
    - a MCAssember
    - a MCJITObjectWriter
    - a mem_raw_ostream
  - knows :
    - the MCJIT : to give it to the object writer (for mapping)
    - the MemoryManager : to give it to the object writer (for memory
claiming)

- MCJITObjectWriter
  - knows :
    - the MCJIT : for mapping GlobalVariable <-> native address
    - the MemoryManager : for claiming memory

- mem_raw_ostream
  - The ostream interface to write data in memory
  - Currently using a MemoryBlock but will probably be changed for matching
JITMemoryManager structure


Another point of interest is how the current mappings are implemented in the
ExecutionEngine.

When applying fixups in the ObjectWriter, we get a symbol name from a
MCSymbol. With the current mappings the Writer is forced to know the Module,
to search for Global named like the MCSymbol. This global is then used to
retrieve a native address.

It will be probably more efficient to use a direct mapping StringRef <->
native address. We can keep an overloaded method for GlobalVariable <->
native address, if this is necessary for compatibility or easiness of use.

What do you think ?

Olivier.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100930/6872dd26/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mc_jit_structure.diff
Type: text/x-patch
Size: 21760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100930/6872dd26/attachment.bin>


More information about the llvm-dev mailing list