aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAlloc/RegClass.h
diff options
context:
space:
mode:
authorRuchira Sasanka <sasanka@students.uiuc.edu>2002-01-07 19:16:26 +0000
committerRuchira Sasanka <sasanka@students.uiuc.edu>2002-01-07 19:16:26 +0000
commit42bd177eae30b6bdef578b6efb21e6c609aa5204 (patch)
treef113d735eac3bf8c2be56e02c17761224714eacb /lib/CodeGen/RegAlloc/RegClass.h
parent977fa8df93ac03b89ef07c94fa12ed7aec11f41c (diff)
Added comments, destructors where necessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1491 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAlloc/RegClass.h')
-rw-r--r--lib/CodeGen/RegAlloc/RegClass.h53
1 files changed, 33 insertions, 20 deletions
diff --git a/lib/CodeGen/RegAlloc/RegClass.h b/lib/CodeGen/RegAlloc/RegClass.h
index 3fb448a5cd..d6cbaf892b 100644
--- a/lib/CodeGen/RegAlloc/RegClass.h
+++ b/lib/CodeGen/RegAlloc/RegClass.h
@@ -3,17 +3,6 @@
Date: Aug 20, 01
Purpose: Contains machine independent methods for register coloring.
- This is the class that contains all data structures and common algos
- for coloring a particular register class (e.g., int class, fp class).
- This class is hardware independent. This class accepts a hardware
- dependent description of machine registers (MachineRegInfo class) to
- get hardware specific info and color and indidual IG node.
-
- This class contains the InterferenceGraph (IG).
- Also it contains an IGNode stack that can be used for coloring.
- The class provides some easy access methods to the IG methods, since these
- methods are called thru a register class.
-
*/
#ifndef REG_CLASS_H
@@ -28,6 +17,23 @@
typedef vector<unsigned int> ReservedColorListType;
+//-----------------------------------------------------------------------------
+// Class RegClass
+//
+// Implements a machine independant register class.
+//
+// This is the class that contains all data structures and common algos
+// for coloring a particular register class (e.g., int class, fp class).
+// This class is hardware independent. This class accepts a hardware
+// dependent description of machine registers (MachineRegInfo class) to
+// get hardware specific info and to color an individual IG node.
+//
+// This class contains the InterferenceGraph (IG).
+// Also it contains an IGNode stack that can be used for coloring.
+// The class provides some easy access methods to the IG methods, since these
+// methods are called thru a register class.
+//
+//-----------------------------------------------------------------------------
class RegClass
{
@@ -42,28 +48,37 @@ class RegClass
// buildInterferenceGraph
stack <IGNode *> IGNodeStack; // the stack used for coloring
- // for passing registered that are pre-allocated (e.g., %g's)
const ReservedColorListType *const ReservedColorList;
-
+ //
+ // for passing registers that are pre-allocated and cannot be used by the
+ // register allocator for this method.
+
+ bool *IsColorUsedArr;
+ //
// An array used for coloring each node. This array must be of size
// MRC->getNumOfAllRegs(). Allocated once in the constructor
// for efficiency.
- bool *IsColorUsedArr;
- //------------ private methods ------------------
+ //--------------------------- private methods ------------------------------
void pushAllIGNodes();
+
bool pushUnconstrainedIGNodes();
+
IGNode * getIGNodeWithMinSpillCost();
+
void colorIGNode(IGNode *const Node);
+
public:
RegClass(const Method *const M,
const MachineRegClassInfo *const MRC,
const ReservedColorListType *const RCL = NULL);
+ ~RegClass() { delete[] IsColorUsedArr; };
+
inline void createInterferenceGraph()
{ IG.createGraph(); }
@@ -71,19 +86,17 @@ class RegClass
inline const unsigned getID() const { return RegClassID; }
- void colorAllRegs(); // main method called for coloring regs
+ // main method called for coloring regs
+ //
+ void colorAllRegs();
inline unsigned getNumOfAvailRegs() const
{ return MRC->getNumOfAvailRegs(); }
- ~RegClass() { delete[] IsColorUsedArr; };
-
-
// --- following methods are provided to access the IG contained within this
// ---- RegClass easilly.
-
inline void addLRToIG(LiveRange *const LR)
{ IG.addLRToIG(LR); }