Removed class RegStackOffsets and used class MachineCodeForMethod
[oota-llvm.git] / lib / Target / SparcV9 / RegAlloc / PhyRegAlloc.h
index 57cd96589f35de977aaf0c0aa57c21f0849cf5be..79bae3c1a93ef51f7f2c871b9b4d591312dff0a9 100644 (file)
@@ -62,73 +62,6 @@ typedef hash_map<const MachineInstr *, AddedInstrns *> AddedInstrMapType;
 
 
 
-//----------------------------------------------------------------------------
-// Class RegStackOffsets:
-// This class is responsible for managing stack frame of the method for
-// register allocation.
-//
-//----------------------------------------------------------------------------
-
-class RegStackOffsets {
-
- private:
-  int curSpilledVarOff;                 // cur pos of spilled LRs
-  int curNewTmpPosOffset;               // cur pos of tmp values on stack
-  bool isTmpRegionUsable;               // can we call getNewTmpPosOffFromFP
-
-  const int SizeOfStackItem;            // size of an item on stack
-  const int StackSpillStartFromFP;      // start position of spill region
-  int StartOfTmpRegion;                 // start of the tmp var region
-
- public:
-
-  // constructor  
-
-  RegStackOffsets(int SEnSize=8, int StartSpill=176 ) : 
-    SizeOfStackItem(SEnSize),  StackSpillStartFromFP(StartSpill) {
-
-    curSpilledVarOff = StartSpill;   
-    isTmpRegionUsable = false;
-  };
-
-
-  int getNewSpillOffFromFP() { 
-    int tmp =  curSpilledVarOff;     
-    curSpilledVarOff += SizeOfStackItem;
-    return tmp;   // **TODO: Is sending un-incremented value correct?
-  };
-
-
-  // The following method must be called only after allocating space
-  // for spilled LRs and calling setEndOfSpillRegion()
-  int getNewTmpPosOffFromFP() { 
-    assert( isTmpRegionUsable && "Spill region still open");
-    int tmp = curNewTmpPosOffset;
-    curNewTmpPosOffset += SizeOfStackItem;
-    return tmp; //**TODO: Is sending un-incremented val correct?
-  };
-
-
-  // This method is called when we have allocated space for all spilled
-  // LRs. The tmp region can be used only after a call to this method.
-
-  void setEndOfSpillRegion() {
-    assert(( ! isTmpRegionUsable) && "setEndOfSpillRegion called again");
-    isTmpRegionUsable = true;
-    StartOfTmpRegion = curSpilledVarOff; 
-  }
-  
-
-  // called when temporary values allocated on stack are no longer needed
-  void resetTmpPos() { 
-    curNewTmpPosOffset = StartOfTmpRegion;
-  }
-
-};
-
-
-
 //----------------------------------------------------------------------------
 // class PhyRegAlloc:
 // Main class the register allocator. Call allocateRegisters() to allocate
@@ -136,12 +69,13 @@ class RegStackOffsets {
 //----------------------------------------------------------------------------
 
 
-class PhyRegAlloc
+class PhyRegAlloc: public NonCopyable
 {
 
   vector<RegClass *> RegClassList  ;    // vector of register classes
-  const Method *const Meth;             // name of the method we work on
   const TargetMachine &TM;              // target machine
+  const Method* Meth;                   // name of the method we work on
+  MachineCodeForMethod& mcInfo;         // descriptor for method's native code
   MethodLiveVarInfo *const LVI;         // LV information for this method 
                                         // (already computed for BBs) 
   LiveRangeInfo LRI;                    // LR info  (will be computed)
@@ -154,8 +88,6 @@ class PhyRegAlloc
   
   AddedInstrMapType AddedInstrMap;      // to store instrns added in this phase
 
-  RegStackOffsets StackOffsets;
-
   //vector<const MachineInstr *> PhiInstList;   // a list of all phi instrs
 
   //------- private methods ---------------------------------------------------
@@ -178,10 +110,6 @@ class PhyRegAlloc
   void markUnusableSugColors();
   void allocateStackSpace4SpilledLRs();
 
-  RegStackOffsets & getStackOffsets() {
-    return  StackOffsets;
-  }
-
 
   inline void constructLiveRanges() 
     { LRI.constructLiveRanges(); }      
@@ -212,7 +140,7 @@ class PhyRegAlloc
 
  public:
 
-  PhyRegAlloc(const Method *const M, const TargetMachine& TM, 
+  PhyRegAlloc(Method *const M, const TargetMachine& TM, 
              MethodLiveVarInfo *const Lvi);
 
   void allocateRegisters();             // main method called for allocatin