[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp VM.cpp VM.h

Misha Brukman brukman at cs.uiuc.edu
Tue Oct 14 16:38:09 PDT 2003


Changes in directory llvm/lib/ExecutionEngine/JIT:

JIT.cpp updated: 1.18 -> 1.19
VM.cpp updated: 1.7 -> 1.8
VM.h updated: 1.13 -> 1.14

---
Log message:

Enabling incremental bytecode loading in the JIT:
* The VM is now constructed with a ModuleProvider


---
Diffs of the changes:  (+15 -7)

Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.18 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.19
--- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.18	Fri Sep  5 14:39:22 2003
+++ llvm/lib/ExecutionEngine/JIT/JIT.cpp	Tue Oct 14 16:37:41 2003
@@ -45,7 +45,7 @@
 /// create - Create an return a new JIT compiler if there is one available
 /// for the current target.  Otherwise, return null.
 ///
-ExecutionEngine *VM::create(Module *M) {
+ExecutionEngine *VM::create(ModuleProvider *MP) {
   TargetMachine* (*TargetMachineAllocator)(const Module &) = 0;
 
   // Allow a command-line switch to override what *should* be the default target
@@ -71,14 +71,16 @@
   }
 
   // Allocate a target...
-  TargetMachine *Target = TargetMachineAllocator(*M);
+  TargetMachine *Target = TargetMachineAllocator(*(MP->getModule()));
   assert(Target && "Could not allocate target machine!");
   
   // Create the virtual machine object...
-  return new VM(M, Target);
+  return new VM(MP, Target);
 }
 
-VM::VM(Module *M, TargetMachine *tm) : ExecutionEngine(M), TM(*tm) {
+VM::VM(ModuleProvider *MP, TargetMachine *tm) : ExecutionEngine(MP), TM(*tm),
+  PM(MP)
+{
   setTargetData(TM.getTargetData());
 
   // Initialize MCE
@@ -94,7 +96,10 @@
     // Specialize LLVM code for this target machine and then
     // run basic dataflow optimizations on LLVM code.
     PM.add(createPreSelectionPass(TM));
-    PM.run(*M);
+    // We cannot utilize function-at-a-time loading here because PreSelection
+    // is a ModulePass.
+    MP->materializeModule();
+    PM.run(*(MP->getModule()));
   }
 #endif
 


Index: llvm/lib/ExecutionEngine/JIT/VM.cpp
diff -u llvm/lib/ExecutionEngine/JIT/VM.cpp:1.7 llvm/lib/ExecutionEngine/JIT/VM.cpp:1.8
--- llvm/lib/ExecutionEngine/JIT/VM.cpp:1.7	Wed Aug 13 13:16:34 2003
+++ llvm/lib/ExecutionEngine/JIT/VM.cpp	Tue Oct 14 16:37:41 2003
@@ -43,6 +43,9 @@
   void *&Addr = GlobalAddress[F];   // Function already code gen'd
   if (Addr) return Addr;
 
+  // Make sure we read in the function if it exists in this Module
+  MP->materializeFunction(F);
+
   if (F->isExternal())
     return Addr = getPointerToNamedFunction(F->getName());
 


Index: llvm/lib/ExecutionEngine/JIT/VM.h
diff -u llvm/lib/ExecutionEngine/JIT/VM.h:1.13 llvm/lib/ExecutionEngine/JIT/VM.h:1.14
--- llvm/lib/ExecutionEngine/JIT/VM.h:1.13	Fri Sep  5 14:39:22 2003
+++ llvm/lib/ExecutionEngine/JIT/VM.h	Tue Oct 14 16:37:41 2003
@@ -23,13 +23,13 @@
   MachineCodeEmitter *MCE; // MCE object
 
 public:
-  VM(Module *M, TargetMachine *tm);
+  VM(ModuleProvider *MP, TargetMachine *tm);
   ~VM();
 
   /// create - Create an return a new JIT compiler if there is one available
   /// for the current target.  Otherwise, return null.
   ///
-  static ExecutionEngine *create(Module *M);
+  static ExecutionEngine *create(ModuleProvider *MP);
 
   /// run - Start execution with the specified function and arguments.
   ///





More information about the llvm-commits mailing list