aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/JIT/JIT.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-08-16 01:24:12 +0000
committerChris Lattner <sabre@nondot.org>2006-08-16 01:24:12 +0000
commitfe854034677f59baca1e38075e71f6efca247a03 (patch)
treefb271b47b99ed66ee0ac9f890b9d7bcfddc02aed /lib/ExecutionEngine/JIT/JIT.cpp
parent2e6baf626d2096eade89e5305bc09e369a761516 (diff)
initial changes to support JIT'ing from multiple module providers, implicitly
linking the program on the fly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29721 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT/JIT.cpp')
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index f241240af9..3995141ead 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -263,8 +263,19 @@ void *JIT::getPointerToFunction(Function *F) {
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()