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

Chris Lattner lattner at cs.uiuc.edu
Tue Aug 15 18:24:31 PDT 2006



Changes in directory llvm/lib/ExecutionEngine/JIT:

JIT.cpp updated: 1.72 -> 1.73
JITEmitter.cpp updated: 1.110 -> 1.111
---
Log message:

initial changes to support JIT'ing from multiple module providers, implicitly
linking the program on the fly.


---
Diffs of the changes:  (+13 -3)

 JIT.cpp        |   13 ++++++++++++-
 JITEmitter.cpp |    3 +--
 2 files changed, 13 insertions(+), 3 deletions(-)


Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.72 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.73
--- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.72	Sat Jul 22 11:59:38 2006
+++ llvm/lib/ExecutionEngine/JIT/JIT.cpp	Tue Aug 15 20:24:12 2006
@@ -263,8 +263,19 @@
   if (void *Addr = getPointerToGlobalIfAvailable(F))
     return Addr;   // Check if function already code gen'd
 
-  // Make sure we read in the function if it exists in this Module
+  // Make sure we read in the function if it exists in this Module.
   if (F->hasNotBeenReadFromBytecode()) {
+    // Determine the module provider this function is provided by.
+    Module *M = F->getParent();
+    ModuleProvider *MP = 0;
+    for (unsigned i = 0, e = Modules.size(); i != e; ++i) {
+      if (Modules[i]->getModule() == M) {
+        MP = Modules[i];
+        break;
+      }
+    }
+    assert(MP && "Function isn't in a module we know about!");
+    
     std::string ErrorMsg;
     if (MP->materializeFunction(F, &ErrorMsg)) {
       std::cerr << "Error reading function '" << F->getName()


Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.110 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.111
--- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.110	Thu Jul 27 13:19:24 2006
+++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp	Tue Aug 15 20:24:12 2006
@@ -972,8 +972,7 @@
 // resolve their addresses at runtime, and this is the way to do it.
 extern "C" {
   void *getPointerToNamedFunction(const char *Name) {
-    Module &M = TheJIT->getModule();
-    if (Function *F = M.getNamedFunction(Name))
+    if (Function *F = TheJIT->FindFunctionNamed(Name))
       return TheJIT->getPointerToFunction(F);
     return TheJIT->getPointerToNamedFunction(Name);
   }






More information about the llvm-commits mailing list