Added code so that colorIGNode does not unnecessarily reserve unusable
authorRuchira Sasanka <sasanka@students.uiuc.edu>
Fri, 19 Oct 2001 21:41:16 +0000 (21:41 +0000)
committerRuchira Sasanka <sasanka@students.uiuc.edu>
Fri, 19 Oct 2001 21:41:16 +0000 (21:41 +0000)
Suggested colors for neighbors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@921 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SparcV9/SparcV9RegClassInfo.cpp
lib/Target/SparcV9/SparcV9RegInfo.cpp

index 02b67a1715840ad8c82d6e7421bffa27c7f8aa88..f79dd5817bbf8343fb6b2208b0f5ac9ec23015ac 100644 (file)
@@ -31,9 +31,13 @@ void SparcIntRegClass::colorIGNode(IGNode * Node, bool IsColorUsedArr[]) const
     if( NeighLR->hasColor() )                        // if has a color
       IsColorUsedArr[ NeighLR->getColor() ] = true; // record that color
 
-    else if( NeighLR->hasSuggestedColor() )        // or has a suggest col   
-      IsColorUsedArr[ NeighLR->getSuggestedColor() ] = true; 
-    
+    else if( NeighLR->hasSuggestedColor() ) {
+
+       // if the neighbout can use the suggested color 
+       if( NeighLR-> isSuggestedColorUsable() ) 
+         IsColorUsedArr[ NeighLR->getSuggestedColor() ] = true; 
+    }    
+
   }
 
   if( DEBUG_RA ) {
@@ -49,7 +53,7 @@ void SparcIntRegClass::colorIGNode(IGNode * Node, bool IsColorUsedArr[]) const
 
     if( ! IsColorUsedArr[ SugCol ] ) {
 
-      if(! (isRegVolatile( SugCol ) &&  LR->isCallInterference()) ) {
+      if( LR->isSuggestedColorUsable()  ) {
 
        // if the suggested color is volatile, we should use it only if
        // there are no call interferences. Otherwise, it will get spilled.
@@ -205,9 +209,16 @@ void SparcFloatRegClass::colorIGNode(IGNode * Node,bool IsColorUsedArr[]) const
          IsColorUsedArr[ (NeighLR->getColor()) + 1 ] = true;  
       }
       else if( NeighLR->hasSuggestedColor() )   {   // if neigh has sugg color
-       IsColorUsedArr[ NeighLR->getSuggestedColor() ] = true;
-       if( NeighLR->getTypeID() == Type::DoubleTyID )
-         IsColorUsedArr[ (NeighLR->getSuggestedColor()) + 1 ] = true;  
+
+       if( NeighLR-> isSuggestedColorUsable() ) {
+
+         // if the neighbout can use the suggested color 
+         
+         IsColorUsedArr[ NeighLR->getSuggestedColor() ] = true;
+         if( NeighLR->getTypeID() == Type::DoubleTyID )
+           IsColorUsedArr[ (NeighLR->getSuggestedColor()) + 1 ] = true;  
+       }
+
       }
 
   }
index 60f4203c38cfff3042ce0437571f8050d88cd329..3622510de8fbcaeefe971fa772e64663d621c530 100644 (file)
@@ -61,7 +61,6 @@ void UltraSparcRegInfo::suggestReg4CallAddr(const MachineInstr * CallMI) const
 
   MachineOperand & MO  = ( MachineOperand &) CallMI->getOperand(2);
   MO.setRegForValue( getUnifiedRegNum( IntRegClassID,SparcIntRegOrder::o7) );
-
 }