[llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp PhyRegAlloc.h

Brian Gaeke gaeke at cs.uiuc.edu
Fri Oct 24 16:23:01 PDT 2003


Changes in directory llvm/lib/CodeGen/RegAlloc:

PhyRegAlloc.cpp updated: 1.123 -> 1.124
PhyRegAlloc.h updated: 1.59 -> 1.60

---
Log message:

Publicize the type of FnAllocState.
Prototype option to save state in a global instead of as a Constant in
 the Module. (Turned off, for now, with the on/off switch welded in the off
 position. You get the idea.)


---
Diffs of the changes:  (+15 -2)

Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.123 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.124
--- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.123	Thu Oct 23 15:32:55 2003
+++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp	Fri Oct 24 16:21:58 2003
@@ -48,6 +48,12 @@
 
 RegAllocDebugLevel_t DEBUG_RA;
 
+/// The reoptimizer wants to be able to grovel through the register
+/// allocator's state after it has done its job. This is a hack.
+///
+PhyRegAlloc::SavedStateMapTy ExportedFnAllocState;
+const bool SaveStateToModule = false;
+
 static cl::opt<RegAllocDebugLevel_t, true>
 DRA_opt("dregalloc", cl::Hidden, cl::location(DEBUG_RA),
         cl::desc("enable register allocation debugging information"),
@@ -1183,6 +1189,11 @@
 bool PhyRegAlloc::doFinalization (Module &M) { 
   if (!SaveRegAllocState)
     return false; // Nothing to do here, unless we're saving state.
+
+  if (!SaveStateToModule) {
+    ExportedFnAllocState = FnAllocState;
+    return false;
+  }
 
   // Convert FnAllocState to a single Constant array and add it
   // to the Module.


Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h
diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h:1.59 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h:1.60
--- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h:1.59	Thu Oct 23 15:32:02 2003
+++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h	Fri Oct 24 16:21:58 2003
@@ -85,11 +85,11 @@
   AddedInstrns AddedInstrAtEntry;       // to store instrns added at entry
   const LoopInfo *LoopDepthCalc;        // to calculate loop depths 
 
-  std::map<const Function *, std::vector<AllocInfo> > FnAllocState;
-
   PhyRegAlloc(const PhyRegAlloc&);     // DO NOT IMPLEMENT
   void operator=(const PhyRegAlloc&);  // DO NOT IMPLEMENT
 public:
+  typedef std::map<const Function *, std::vector<AllocInfo> > SavedStateMapTy;
+
   inline PhyRegAlloc (const TargetMachine &TM_) :
     TM (TM_), MRI (TM.getRegInfo ()),
     NumOfRegClasses (MRI.getNumOfRegClasses ()) { }
@@ -113,6 +113,8 @@
   inline RegClass *getRegClassByID(unsigned id) { return RegClassList[id]; }
 
 private:
+  SavedStateMapTy FnAllocState;
+
   void addInterference(const Value *Def, const ValueSet *LVSet, 
 		       bool isCallInst);
   bool markAllocatedRegs(MachineInstr* MInst);





More information about the llvm-commits mailing list