Rip JIT specific stuff out of TargetMachine, as per PR176
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10542 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index c5a70ea..dc9f7a1 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -80,19 +80,20 @@
// Allocate a target...
TargetMachine *Target = TargetMachineAllocator(*MP->getModule());
assert(Target && "Could not allocate target machine!");
-
- // Create the virtual machine object...
- return new VM(MP, Target);
+
+ // If the target supports JIT code generation, return a new JIT now.
+ if (TargetJITInfo *TJ = Target->getJITInfo())
+ return new VM(MP, *Target, *TJ);
+ return 0;
}
-VM::VM(ModuleProvider *MP, TargetMachine *tm) : ExecutionEngine(MP), TM(*tm),
- PM(MP)
-{
+VM::VM(ModuleProvider *MP, TargetMachine &tm, TargetJITInfo &tji)
+ : ExecutionEngine(MP), TM(tm), TJI(tji), PM(MP) {
setTargetData(TM.getTargetData());
// Initialize MCE
MCE = createEmitter(*this);
-
+
setupPassManager();
emitGlobals();