diff options
author | Jim Grosbach <grosbach@apple.com> | 2011-04-04 23:04:39 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2011-04-04 23:04:39 +0000 |
commit | 2dcef0505f286b20adb5a4c08bca86e322717993 (patch) | |
tree | 1190d55740b59641874d00e39891c1bbf39426b9 /llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp | |
parent | f87b3739cc6d58823d06c1c48a8ea312159f53ce (diff) | |
download | bcm5719-llvm-2dcef0505f286b20adb5a4c08bca86e322717993.tar.gz bcm5719-llvm-2dcef0505f286b20adb5a4c08bca86e322717993.zip |
Layer the memory manager between the JIT and the runtime Dyld.
The JITMemory manager references LLVM IR constructs directly, while the
runtime Dyld works at a lower level and can handle objects which may not
originate from LLVM IR. Introduce a new layer for the memory manager to
handle the interface between them. For the MCJIT, this layer will be almost
entirely simply a call-through w/ translation between the IR objects and
symbol names.
llvm-svn: 128851
Diffstat (limited to 'llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp index 2e3c9310fb2..148e0d91b48 100644 --- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp +++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "MCJIT.h" +#include "MCJITMemoryManager.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" #include "llvm/ExecutionEngine/GenericValue.h" @@ -57,7 +58,8 @@ ExecutionEngine *MCJIT::createJIT(Module *M, // If the target supports JIT code generation, create the JIT. if (TargetJITInfo *TJ = TM->getJITInfo()) - return new MCJIT(M, TM, *TJ, JMM, OptLevel, GVsWithCode); + return new MCJIT(M, TM, *TJ, new MCJITMemoryManager(JMM), OptLevel, + GVsWithCode); if (ErrorStr) *ErrorStr = "target does not support JIT code generation"; @@ -65,9 +67,9 @@ ExecutionEngine *MCJIT::createJIT(Module *M, } MCJIT::MCJIT(Module *m, TargetMachine *tm, TargetJITInfo &tji, - JITMemoryManager *JMM, CodeGenOpt::Level OptLevel, + RTDyldMemoryManager *MM, CodeGenOpt::Level OptLevel, bool AllocateGVsWithCode) - : ExecutionEngine(m), TM(tm), M(m), OS(Buffer), Dyld(JMM) { + : ExecutionEngine(m), TM(tm), MemMgr(MM), M(m), OS(Buffer), Dyld(MM) { PM.add(new TargetData(*TM->getTargetData())); @@ -94,6 +96,7 @@ MCJIT::MCJIT(Module *m, TargetMachine *tm, TargetJITInfo &tji, } MCJIT::~MCJIT() { + delete MemMgr; } void *MCJIT::getPointerToBasicBlock(BasicBlock *BB) { @@ -110,7 +113,7 @@ void *MCJIT::getPointerToFunction(Function *F) { } Twine Name = TM->getMCAsmInfo()->getGlobalPrefix() + F->getName(); - return Dyld.getSymbolAddress(Name.str()); + return (void*)Dyld.getSymbolAddress(Name.str()); } void *MCJIT::recompileAndRelinkFunction(Function *F) { |