summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-10-22 02:50:12 +0000
committerChris Lattner <sabre@nondot.org>2007-10-22 02:50:12 +0000
commitfd6f3257b86b46e76b5a965d70ec1df43a960d18 (patch)
treebbcc379d49ece947f7c012a59cc50349615a5f70 /llvm/lib
parentbf5e958ba09b139e74e242747eb2fc0fe1b539ed (diff)
downloadbcm5719-llvm-fd6f3257b86b46e76b5a965d70ec1df43a960d18.tar.gz
bcm5719-llvm-fd6f3257b86b46e76b5a965d70ec1df43a960d18.zip
add a mechanism for the JIT to invoke a function to lazily create functions as they are referenced.
llvm-svn: 43210
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp4
-rw-r--r--llvm/lib/ExecutionEngine/JIT/Intercept.cpp5
2 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 2129dd5019d..d89a9bb4ac7 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -33,13 +33,13 @@ STATISTIC(NumGlobals , "Number of global vars initialized");
ExecutionEngine::EECtorFn ExecutionEngine::JITCtor = 0;
ExecutionEngine::EECtorFn ExecutionEngine::InterpCtor = 0;
-ExecutionEngine::ExecutionEngine(ModuleProvider *P) {
+ExecutionEngine::ExecutionEngine(ModuleProvider *P) : LazyFunctionCreator(0) {
LazyCompilationDisabled = false;
Modules.push_back(P);
assert(P && "ModuleProvider is null?");
}
-ExecutionEngine::ExecutionEngine(Module *M) {
+ExecutionEngine::ExecutionEngine(Module *M) : LazyFunctionCreator(0) {
LazyCompilationDisabled = false;
assert(M && "Module is null?");
Modules.push_back(new ExistingModuleProvider(M));
diff --git a/llvm/lib/ExecutionEngine/JIT/Intercept.cpp b/llvm/lib/ExecutionEngine/JIT/Intercept.cpp
index 61035c25359..318d6067d6c 100644
--- a/llvm/lib/ExecutionEngine/JIT/Intercept.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/Intercept.cpp
@@ -101,6 +101,11 @@ void *JIT::getPointerToNamedFunction(const std::string &Name) {
Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(NameStr+1);
if (Ptr) return Ptr;
}
+
+ /// If a LazyFunctionCreator is installed, use it to get/create the function.
+ if (LazyFunctionCreator)
+ if (void *RP = LazyFunctionCreator(Name))
+ return RP;
cerr << "ERROR: Program used external function '" << Name
<< "' which could not be resolved!\n";
OpenPOWER on IntegriCloud