Significant improvement: GEP used by a load or store no longer generates
[oota-llvm.git] / lib / Target / SparcV9 / RegAlloc / RegClass.h
index fe25986f4085f030e1cb035b695ac66c0077ea66..4584a5f7a1e01c9f00285df8673337e3388fc9c0 100644 (file)
@@ -8,14 +8,12 @@
 #ifndef REG_CLASS_H
 #define REG_CLASS_H
 
-#include "llvm/CodeGen/IGNode.h"
 #include "llvm/CodeGen/InterferenceGraph.h"
-#include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/MachineRegInfo.h"
 #include <stack>
-#include <iostream>
+class MachineRegClassInfo;
 
-typedef std::vector<unsigned int> ReservedColorListType;
+typedef std::vector<unsigned> ReservedColorListType;
 
 
 //-----------------------------------------------------------------------------
@@ -35,30 +33,26 @@ typedef std::vector<unsigned int> ReservedColorListType;
 //   methods are called thru a register class.
 //
 //-----------------------------------------------------------------------------
-class RegClass
-{
-
- private:
-  const Method *const Meth;             // Method we are working on
-
+class RegClass {
+  const Function *const Meth;           // Function we are working on
   const MachineRegClassInfo *const MRC; // corresponding MRC
-
   const unsigned RegClassID;            // my int ID
 
   InterferenceGraph IG;                 // Interference graph - constructed by
                                         // buildInterferenceGraph
   std::stack<IGNode *> IGNodeStack;     // the stack used for coloring
 
-  const ReservedColorListType *const ReservedColorList;
+  // ReservedColorList - for passing registers that are pre-allocated and cannot
+  // be used by the register allocator for this function.
   //
-  // for passing registers that are pre-allocated and cannot be used by the
-  // register allocator for this method.
+  const ReservedColorListType *const ReservedColorList;
   
-  bool *IsColorUsedArr;
+  // IsColorUsedArr - An array used for coloring each node. This array must be
+  // of size MRC->getNumOfAllRegs(). Allocated once in the constructor for
+  // efficiency.
   //
-  // An array used for coloring each node. This array must be of size 
-  // MRC->getNumOfAllRegs(). Allocated once in the constructor
-  // for efficiency.
+  std::vector<bool> IsColorUsedArr;
+
 
 
   //--------------------------- private methods ------------------------------
@@ -74,14 +68,11 @@ class RegClass
 
  public:
 
-  RegClass(const Method *const M, 
-          const MachineRegClassInfo *const MRC, 
-          const ReservedColorListType *const RCL = NULL);
-
-  ~RegClass() { delete[] IsColorUsedArr; };
+  RegClass(const Function *M,
+          const MachineRegClassInfo *MRC,
+          const ReservedColorListType *RCL = 0);
 
-  inline void createInterferenceGraph() 
-    { IG.createGraph(); }
+  inline void createInterferenceGraph() { IG.createGraph(); }
 
   inline InterferenceGraph &getIG() { return IG; }
 
@@ -114,7 +105,7 @@ class RegClass
     { IG.mergeIGNodesOfLRs(LR1, LR2); }
 
 
-  inline bool * getIsColorUsedArr() { return IsColorUsedArr; }
+  inline std::vector<bool> &getIsColorUsedArr() { return IsColorUsedArr; }
 
 
   inline void printIGNodeList() const {