Simple refactorings to prepare for lazy global emission

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10546 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-12-20 02:45:16 +00:00
parent 2828970819
commit 3ddc05bdde

View File

@ -21,9 +21,10 @@
namespace llvm { namespace llvm {
union GenericValue;
class Constant; class Constant;
class Function; class Function;
union GenericValue; class GlobalVariable;
class GlobalValue; class GlobalValue;
class Module; class Module;
class ModuleProvider; class ModuleProvider;
@ -60,8 +61,8 @@ public:
static ExecutionEngine *create(ModuleProvider *MP, bool ForceInterpreter); static ExecutionEngine *create(ModuleProvider *MP, bool ForceInterpreter);
void addGlobalMapping(const Function *F, void *Addr) { void addGlobalMapping(const GlobalValue *GV, void *Addr) {
void *&CurVal = GlobalAddress[(const GlobalValue*)F]; void *&CurVal = GlobalAddress[GV];
assert(CurVal == 0 && "GlobalMapping already established!"); assert(CurVal == 0 && "GlobalMapping already established!");
CurVal = Addr; CurVal = Addr;
} }
@ -107,6 +108,12 @@ public:
protected: protected:
void emitGlobals(); 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 getConstantValue(const Constant *C);
GenericValue LoadValueFromMemory(GenericValue *Ptr, const Type *Ty); GenericValue LoadValueFromMemory(GenericValue *Ptr, const Type *Ty);
}; };