[llvm-commits] CVS: llvm/include/llvm/ExecutionEngine/ExecutionEngine.h

Chris Lattner lattner at cs.uiuc.edu
Fri Dec 19 21:37:01 PST 2003


Changes in directory llvm/include/llvm/ExecutionEngine:

ExecutionEngine.h updated: 1.21 -> 1.22

---
Log message:

Cleanups to implement PR135


---
Diffs of the changes:  (+11 -4)

Index: llvm/include/llvm/ExecutionEngine/ExecutionEngine.h
diff -u llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.21 llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.22
--- llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.21	Fri Dec 19 20:45:16 2003
+++ llvm/include/llvm/ExecutionEngine/ExecutionEngine.h	Fri Dec 19 21:35:50 2003
@@ -35,11 +35,11 @@
   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 @@
 
   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 @@
   ///
   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);





More information about the llvm-commits mailing list