diff options
author | Chris Lattner <sabre@nondot.org> | 2003-12-20 03:36:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-12-20 03:36:47 +0000 |
commit | c07ed1387503d25c0b93fcf617f69329d73fc589 (patch) | |
tree | 0e4f7ecf9cc5a7b3e891af61bda90a5ee3a4853e /lib/ExecutionEngine/JIT/JITEmitter.cpp | |
parent | 1514b5b334c72e1e190fe1ce2bce7bf7d8a91c1a (diff) |
Implement PR135, lazy emission of global variables
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10549 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT/JITEmitter.cpp')
-rw-r--r-- | lib/ExecutionEngine/JIT/JITEmitter.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp index 50b3610e51..8da50919fd 100644 --- a/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -248,7 +248,11 @@ void Emitter::emitWord(unsigned W) { uint64_t Emitter::getGlobalValueAddress(GlobalValue *V) { // Try looking up the function to see if it is already compiled, if not return // 0. - return (intptr_t)TheJIT->getPointerToGlobalIfAvailable(V); + if (isa<Function>(V)) + return (intptr_t)TheJIT->getPointerToGlobalIfAvailable(V); + else { + return (intptr_t)TheJIT->getOrEmitGlobalVariable(cast<GlobalVariable>(V)); + } } uint64_t Emitter::getGlobalValueAddress(const std::string &Name) { return (intptr_t)TheJIT->getPointerToNamedFunction(Name); |