mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user