aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorRuchira Sasanka <sasanka@students.uiuc.edu>2001-11-06 15:25:38 +0000
committerRuchira Sasanka <sasanka@students.uiuc.edu>2001-11-06 15:25:38 +0000
commitd1565abd688daeff10f9398bd04df837b3d467ed (patch)
tree98b2d66c99b8156cec43a1a5d389a307a588a05d /lib/CodeGen
parent54bc6b31660f7b8743399f2fa9e3ef4a2458bdde (diff)
downloadexternal_llvm-d1565abd688daeff10f9398bd04df837b3d467ed.zip
external_llvm-d1565abd688daeff10f9398bd04df837b3d467ed.tar.gz
external_llvm-d1565abd688daeff10f9398bd04df837b3d467ed.tar.bz2
Fixed bug - added code in pushUnconstrainedIGNodes() to check whether a node
is already pushed to stack by a previous call to the same method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1154 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/RegAlloc/RegClass.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/CodeGen/RegAlloc/RegClass.cpp b/lib/CodeGen/RegAlloc/RegClass.cpp
index cb33b9e..1219147 100644
--- a/lib/CodeGen/RegAlloc/RegClass.cpp
+++ b/lib/CodeGen/RegAlloc/RegClass.cpp
@@ -21,7 +21,7 @@ RegClass::RegClass(const Method *const M,
void RegClass::colorAllRegs()
{
- if(DEBUG_RA) cout << "Coloring IGs ..." << endl;
+ if(DEBUG_RA) cout << "Coloring IG of reg class " << RegClassID << " ...\n";
//preColorIGNodes(); // pre-color IGNodes
pushAllIGNodes(); // push all IG Nodes
@@ -47,7 +47,7 @@ void RegClass::colorAllRegs()
void RegClass::pushAllIGNodes()
{
bool NeedMoreSpills;
- IGNode *IGNodeSpill;
+
IG.setCurDegreeOfIGNodes(); // calculate degree of IGNodes
@@ -71,8 +71,8 @@ void RegClass::pushAllIGNodes()
do{
//get node with min spill cost
- IGNodeSpill = getIGNodeWithMinSpillCost();
-
+ IGNode *IGNodeSpill = getIGNodeWithMinSpillCost();
+
// push that node on to stack
IGNodeStack.push( IGNodeSpill );
@@ -89,7 +89,11 @@ void RegClass::pushAllIGNodes()
-
+//--------------------------------------------------------------------------
+// This method goes thru all IG nodes in the IGNodeList of an IG of a
+// register class and push any unconstrained IG node left (that is not
+// already pushed)
+//--------------------------------------------------------------------------
bool RegClass::pushUnconstrainedIGNodes()
{
@@ -103,9 +107,14 @@ bool RegClass::pushUnconstrainedIGNodes()
// get IGNode i from IGNodeList
IGNode *IGNode = IG.getIGNodeList()[i];
- if( ! IGNode ) // can be null due to merging
- continue;
-
+ if( !IGNode ) // can be null due to merging
+ continue;
+
+ // if already pushed on stack, continue. This can happen since this
+ // method can be called repeatedly until all constrained nodes are
+ // pushed
+ if( IGNode->isOnStack() )
+ continue;
// if the degree of IGNode is lower
if( (unsigned) IGNode->getCurDegree() < MRC->getNumOfAvailRegs() ) {
IGNodeStack.push( IGNode ); // push IGNode on to the stack