summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorJeff Cohen <jeffc@jolt-lang.org>2006-02-07 05:11:57 +0000
committerJeff Cohen <jeffc@jolt-lang.org>2006-02-07 05:11:57 +0000
commit69e849014c0d17f97a5c22069a587e852e626395 (patch)
tree55ae47446a824203442b890cd0560e817833d954 /llvm/lib/ExecutionEngine
parentc89a2a1a83e0aab2d5144543e355876d7ea828c7 (diff)
downloadbcm5719-llvm-69e849014c0d17f97a5c22069a587e852e626395.tar.gz
bcm5719-llvm-69e849014c0d17f97a5c22069a587e852e626395.zip
Teach the interpreter to handle global variables that are added to a module after
interpretation has begun. The JIT already handles this situation correctly, and the interpreter can already handle new functions being added. llvm-svn: 26030
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 53587bff5a0..95610e65b60 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -171,7 +171,16 @@ void *ExecutionEngine::getPointerToGlobal(const GlobalValue *GV) {
return getPointerToFunction(F);
MutexGuard locked(lock);
- assert(state.getGlobalAddressMap(locked)[GV] && "Global hasn't had an address allocated yet?");
+ void *p = state.getGlobalAddressMap(locked)[GV];
+ if (p)
+ return p;
+
+ // Global variable might have been added since interpreter started.
+ if (GlobalVariable *GVar =
+ const_cast<GlobalVariable *>(dyn_cast<GlobalVariable>(GV)))
+ EmitGlobalVariable(GVar);
+ else
+ assert("Global hasn't had an address allocated yet!");
return state.getGlobalAddressMap(locked)[GV];
}
OpenPOWER on IntegriCloud