diff options
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r-- | lib/ExecutionEngine/JIT/JIT.cpp | 10 | ||||
-rw-r--r-- | lib/ExecutionEngine/MCJIT/MCJIT.cpp | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index 2836218d4a..b271618a5f 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -26,6 +26,7 @@ #include "llvm/IR/Function.h" #include "llvm/IR/GlobalVariable.h" #include "llvm/IR/Instructions.h" +#include "llvm/IR/Module.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/DynamicLibrary.h" #include "llvm/Support/ErrorHandling.h" @@ -151,7 +152,8 @@ JIT::JIT(Module *M, TargetMachine &tm, TargetJITInfo &tji, // Add target data MutexGuard locked(lock); FunctionPassManager &PM = jitstate->getPM(locked); - PM.add(new DataLayoutPass(*TM.getDataLayout())); + M->setDataLayout(TM.getDataLayout()); + PM.add(new DataLayoutPass(M)); // Turn the machine code intermediate representation into bytes in memory that // may be executed. @@ -183,7 +185,8 @@ void JIT::addModule(Module *M) { jitstate = new JITState(M); FunctionPassManager &PM = jitstate->getPM(locked); - PM.add(new DataLayoutPass(*TM.getDataLayout())); + M->setDataLayout(TM.getDataLayout()); + PM.add(new DataLayoutPass(M)); // Turn the machine code intermediate representation into bytes in memory // that may be executed. @@ -214,7 +217,8 @@ bool JIT::removeModule(Module *M) { jitstate = new JITState(Modules[0]); FunctionPassManager &PM = jitstate->getPM(locked); - PM.add(new DataLayoutPass(*TM.getDataLayout())); + M->setDataLayout(TM.getDataLayout()); + PM.add(new DataLayoutPass(M)); // Turn the machine code intermediate representation into bytes in memory // that may be executed. diff --git a/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/lib/ExecutionEngine/MCJIT/MCJIT.cpp index ad11a839f0..a0dfbef51f 100644 --- a/lib/ExecutionEngine/MCJIT/MCJIT.cpp +++ b/lib/ExecutionEngine/MCJIT/MCJIT.cpp @@ -142,7 +142,8 @@ ObjectBufferStream* MCJIT::emitObject(Module *M) { PassManager PM; - PM.add(new DataLayoutPass(*TM->getDataLayout())); + M->setDataLayout(TM->getDataLayout()); + PM.add(new DataLayoutPass(M)); // The RuntimeDyld will take ownership of this shortly OwningPtr<ObjectBufferStream> CompiledObject(new ObjectBufferStream()); |