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
This commit is contained in:
Chris Lattner
2006-08-16 01:24:12 +00:00
parent 2e6baf626d
commit fe85403467
5 changed files with 173 additions and 64 deletions
+12 -1
View File
@@ -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()