summaryrefslogtreecommitdiff
path: root/include/llvm/ExecutionEngine
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-12-20 03:35:50 +0000
committerChris Lattner <sabre@nondot.org>2003-12-20 03:35:50 +0000
commit1514b5b334c72e1e190fe1ce2bce7bf7d8a91c1a (patch)
treee5c2377dedc47b54732c6e5e7e00ca7ebf10a8f0 /include/llvm/ExecutionEngine
parent24b0a18c4357de0515c542e97edb2c2eacc543f2 (diff)
downloadllvm-1514b5b334c72e1e190fe1ce2bce7bf7d8a91c1a.tar.gz
llvm-1514b5b334c72e1e190fe1ce2bce7bf7d8a91c1a.tar.bz2
llvm-1514b5b334c72e1e190fe1ce2bce7bf7d8a91c1a.tar.xz
Cleanups to implement PR135
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10548 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ExecutionEngine')
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index 573e5f1d9a..ba6a6e1cc0 100644
--- a/include/llvm/ExecutionEngine/ExecutionEngine.h
+++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -35,11 +35,11 @@ class ExecutionEngine {
Module &CurMod;
const TargetData *TD;
-protected:
- ModuleProvider *MP;
// GlobalAddress - A mapping between LLVM global values and their actualized
// version...
std::map<const GlobalValue*, void *> GlobalAddress;
+protected:
+ ModuleProvider *MP;
void setTargetData(const TargetData &td) {
TD = &td;
@@ -63,7 +63,7 @@ public:
void addGlobalMapping(const GlobalValue *GV, void *Addr) {
void *&CurVal = GlobalAddress[GV];
- assert(CurVal == 0 && "GlobalMapping already established!");
+ assert((CurVal == 0 || Addr == 0) && "GlobalMapping already established!");
CurVal = Addr;
}
@@ -106,13 +106,20 @@ public:
///
virtual void *recompileAndRelinkFunction(Function *F) = 0;
+ /// getOrEmitGlobalVariable - Return the address of the specified global
+ /// variable, possibly emitting it to memory if needed. This is used by the
+ /// Emitter.
+ virtual void *getOrEmitGlobalVariable(const GlobalVariable *GV) {
+ return getPointerToGlobal((GlobalValue*)GV);
+ }
+
protected:
void emitGlobals();
// EmitGlobalVariable - This method emits the specified global variable to the
// address specified in GlobalAddresses, or allocates new memory if it's not
// already in the map.
- void EmitGlobalVariable(GlobalVariable *GV);
+ void EmitGlobalVariable(const GlobalVariable *GV);
GenericValue getConstantValue(const Constant *C);
GenericValue LoadValueFromMemory(GenericValue *Ptr, const Type *Ty);