diff options
author | Chris Lattner <sabre@nondot.org> | 2006-08-16 01:24:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-08-16 01:24:12 +0000 |
commit | 0621caef44e97026fb42a03be1d259c9041eee01 (patch) | |
tree | 32112126e647e629a953d5308ec761d69dc56e6b /llvm/lib/ExecutionEngine/JIT/JIT.cpp | |
parent | 9ed9ddeae41cb88d46d1030c2a7a5b644d4d0a5f (diff) | |
download | bcm5719-llvm-0621caef44e97026fb42a03be1d259c9041eee01.tar.gz bcm5719-llvm-0621caef44e97026fb42a03be1d259c9041eee01.zip |
initial changes to support JIT'ing from multiple module providers, implicitly
linking the program on the fly.
llvm-svn: 29721
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/JIT.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JIT.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp index f241240af94..3995141eade 100644 --- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp +++ b/llvm/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() |