From dc997d94707a95df0a276dc7515d10f746569ea7 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 20 Dec 2003 02:45:16 +0000 Subject: [PATCH] Simple refactorings to prepare for lazy global emission llvm-svn: 10546 --- llvm/include/llvm/ExecutionEngine/ExecutionEngine.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/llvm/include/llvm/ExecutionEngine/ExecutionEngine.h b/llvm/include/llvm/ExecutionEngine/ExecutionEngine.h index f049197e52ae..573e5f1d9ab5 100644 --- a/llvm/include/llvm/ExecutionEngine/ExecutionEngine.h +++ b/llvm/include/llvm/ExecutionEngine/ExecutionEngine.h @@ -21,9 +21,10 @@ namespace llvm { +union GenericValue; class Constant; class Function; -union GenericValue; +class GlobalVariable; class GlobalValue; class Module; class ModuleProvider; @@ -60,8 +61,8 @@ public: static ExecutionEngine *create(ModuleProvider *MP, bool ForceInterpreter); - void addGlobalMapping(const Function *F, void *Addr) { - void *&CurVal = GlobalAddress[(const GlobalValue*)F]; + void addGlobalMapping(const GlobalValue *GV, void *Addr) { + void *&CurVal = GlobalAddress[GV]; assert(CurVal == 0 && "GlobalMapping already established!"); CurVal = Addr; } @@ -107,6 +108,12 @@ public: 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); + GenericValue getConstantValue(const Constant *C); GenericValue LoadValueFromMemory(GenericValue *Ptr, const Type *Ty); };