summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-02-04 05:59:25 +0000
committerChris Lattner <sabre@nondot.org>2002-02-04 05:59:25 +0000
commit5216cc55f7ece102bab5084511e8a6e7d7351c9d (patch)
tree3173c495a1fba9cc0274483a84199401adbac15a /llvm/lib/Target/Sparc/SparcRegClassInfo.cpp
parentc797387363245e4eb024f89a3cb774c004497720 (diff)
downloadbcm5719-llvm-5216cc55f7ece102bab5084511e8a6e7d7351c9d.tar.gz
bcm5719-llvm-5216cc55f7ece102bab5084511e8a6e7d7351c9d.zip
* Minor cleanups
* Reduce number of #includes * Remove blatently misleading qualifiers (how do you have an inlined pure virtual function?) * Remove unnecesary & ignored qualifiers (const int argument vs int argument) * SparcInternals.h now no longer #includes RegClass.h or SparcRegClassInfo.h * Pull inlined functions out of .h file if they are virtual and interfere with dependencies llvm-svn: 1677
Diffstat (limited to 'llvm/lib/Target/Sparc/SparcRegClassInfo.cpp')
-rw-r--r--llvm/lib/Target/Sparc/SparcRegClassInfo.cpp90
1 files changed, 27 insertions, 63 deletions
diff --git a/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp b/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp
index 709a8f4c7fe..5e02aaf9211 100644
--- a/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp
+++ b/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp
@@ -1,4 +1,4 @@
-#include "SparcInternals.h"
+#include "SparcRegClassInfo.h"
#include "llvm/CodeGen/IGNode.h"
#include "llvm/Target/Sparc.h"
#include <iostream>
@@ -17,23 +17,22 @@ using std::cerr;
// If both above fail, spill.
//
//-----------------------------------------------------------------------------
-void SparcIntRegClass::colorIGNode(IGNode * Node, bool IsColorUsedArr[]) const
-{
- LiveRange * LR = Node->getParentLR();
+void SparcIntRegClass::colorIGNode(IGNode * Node, bool IsColorUsedArr[]) const {
+ LiveRange *LR = Node->getParentLR();
unsigned NumNeighbors = Node->getNumOfNeighbors(); // total # of neighbors
- for(unsigned n=0; n < NumNeighbors; n++) { // for each neigh
+ for (unsigned n=0; n < NumNeighbors; n++) { // for each neigh
IGNode *NeighIGNode = Node->getAdjIGNode(n);
LiveRange *NeighLR = NeighIGNode->getParentLR();
- if( NeighLR->hasColor() ) // if has a color
- IsColorUsedArr[ NeighLR->getColor() ] = true; // record that color
+ if(NeighLR->hasColor()) // if has a color
+ IsColorUsedArr[NeighLR->getColor()] = true; // record that color
- else if( NeighLR->hasSuggestedColor() ) {
+ else if (NeighLR->hasSuggestedColor()) {
- // if the neighbout can use the suggested color
- if( NeighLR-> isSuggestedColorUsable() )
- IsColorUsedArr[ NeighLR->getSuggestedColor() ] = true;
+ // if the neighbout can use the suggested color
+ if(NeighLR->isSuggestedColorUsable())
+ IsColorUsedArr[NeighLR->getSuggestedColor()] = true;
}
}
@@ -108,7 +107,7 @@ void SparcIntRegClass::colorIGNode(IGNode * Node, bool IsColorUsedArr[]) const
if( ! IsColorUsedArr[ c ] ) { ColorFound = true; break; }
}
- if( ColorFound) {
+ if (ColorFound) {
LR->setColor(c);
// get the live range corresponding to live var
// since LR span across calls, must save across calls
@@ -122,13 +121,8 @@ void SparcIntRegClass::colorIGNode(IGNode * Node, bool IsColorUsedArr[]) const
// If we couldn't find a color regardless of call interference - i.e., we
// don't have either a volatile or non-volatile color left
//
- if( !ColorFound )
+ if (!ColorFound)
LR->markForSpill(); // no color found - must spill
-
-
- if( DEBUG_RA)
- UltraSparcRegInfo::printReg( LR );
-
}
@@ -213,10 +207,8 @@ void SparcFloatRegClass::colorIGNode(IGNode * Node,bool IsColorUsedArr[]) const
if( ColorFound >= 0 ) { // if we could find a color
LR->setColor(ColorFound);
- if( DEBUG_RA) UltraSparcRegInfo::printReg( LR );
return;
- }
- else {
+ } else {
// if we didn't find a color becuase the LR was single precision or
// all f32-f63 range is filled, we try to allocate a register from
@@ -241,7 +233,6 @@ void SparcFloatRegClass::colorIGNode(IGNode * Node,bool IsColorUsedArr[]) const
if( ColorFound >= 0 ) { // if we could find a color
LR->setColor(ColorFound);
- if( DEBUG_RA) UltraSparcRegInfo::printReg( LR );
return;
}
else if( isCallInterf ) {
@@ -260,63 +251,36 @@ void SparcFloatRegClass::colorIGNode(IGNode * Node,bool IsColorUsedArr[]) const
if( ColorFound >= 0 ) {
LR->setColor(ColorFound); // first color found in preffered order
LR->markForSaveAcrossCalls();
- if( DEBUG_RA) UltraSparcRegInfo::printReg( LR );
- return;
+ } else {
+ // we are here because no color could be found
+ LR->markForSpill(); // no color found - must spill
}
-
-
- // we are here because no color could be found
-
- LR->markForSpill(); // no color found - must spill
- if( DEBUG_RA) UltraSparcRegInfo::printReg( LR );
-
}
-
//-----------------------------------------------------------------------------
// Helper method for coloring a node of Float Reg class.
// Finds the first available color in the range [Start,End] depending on the
// type of the Node (i.e., float/double)
//-----------------------------------------------------------------------------
-int SparcFloatRegClass::findFloatColor(const LiveRange *const LR,
- unsigned Start,
- unsigned End,
- bool IsColorUsedArr[] ) const {
+int SparcFloatRegClass::findFloatColor(const LiveRange *LR,
+ unsigned Start, unsigned End,
+ bool IsColorUsedArr[] ) const {
bool ColorFound = false;
unsigned c;
- if( LR->getTypeID() == Type::DoubleTyID ) {
-
+ if (LR->getTypeID() == Type::DoubleTyID) {
// find first unused color for a double
- for( c=Start; c < End ;c+= 2){
- if( ! IsColorUsedArr[ c ] && ! IsColorUsedArr[ c+1 ])
- { ColorFound=true; break; }
- }
-
+ for (c=Start; c < End ; c+= 2)
+ if (!IsColorUsedArr[c] && !IsColorUsedArr[c+1])
+ return c;
} else {
-
// find first unused color for a single
- for( c=Start; c < End; c++) {
- if( ! IsColorUsedArr[ c ] ) { ColorFound=true; break; }
- }
+ for (c = Start; c < End; c++)
+ if (!IsColorUsedArr[c])
+ return c;
}
- if( ColorFound ) return c;
- else return -1;
+ return -1;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
OpenPOWER on IntegriCloud