Numerous bug fixes:
-- correct sign extensions for integer casts and for shift-by-constant
instructions generated for integer multiply
-- passing FP arguments to functions with more than 6 arguments
-- passing FP arguments to varargs functions
-- passing FP arguments to functions with no prototypes
-- incorrect stack frame size when padding a section
-- folding getelementptr operations with mixed array and struct indexes
-- use uint64_t instead of uint for constant offsets in mem operands
-- incorrect coloring for CC registers (both int and FP): interferences
were being completely ignored for int CC and were considered but no
spills were marked for fp CC!
Also some code improvements:
-- better interface to generating machine instr for common cases
(many places still need to be updated to use this interface)
-- annotations on MachineInstr to communicate information from
one codegen phase to another (now used to pass information about
CALL/JMPLCALL operands from selection to register allocation)
-- all sizes and offests in class TargetData are uint64_t instead of uint
llvm-svn: 2640
diff --git a/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp b/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp
index 6f645b1..11a8251 100644
--- a/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp
+++ b/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp
@@ -20,22 +20,6 @@
//-----------------------------------------------------------------------------
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
- IGNode *NeighIGNode = Node->getAdjIGNode(n);
- LiveRange *NeighLR = NeighIGNode->getParentLR();
-
- if(NeighLR->hasColor()) // if has a color
- IsColorUsedArr[NeighLR->getColor()] = true; // record that color
-
- else if (NeighLR->hasSuggestedColor()) {
-
- // if the neighbout can use the suggested color
- if(NeighLR->isSuggestedColorUsable())
- IsColorUsedArr[NeighLR->getSuggestedColor()] = true;
- }
- }
if( DEBUG_RA ) {
cerr << "\nColoring LR [CallInt=" << LR->isCallInterference() <<"]:";
@@ -148,38 +132,35 @@
//----------------------------------------------------------------------------
void SparcFloatRegClass::colorIGNode(IGNode * Node,bool IsColorUsedArr[]) const{
LiveRange *LR = Node->getParentLR();
- unsigned NumNeighbors = Node->getNumOfNeighbors(); // total # of neighbors
+ // Mark the second color for double-precision registers:
+ // This is UGLY and should be merged into nearly identical code
+ // in RegClass::colorIGNode that handles the first color.
+ //
+ unsigned NumNeighbors = Node->getNumOfNeighbors(); // total # of neighbors
for(unsigned n=0; n < NumNeighbors; n++) { // for each neigh
IGNode *NeighIGNode = Node->getAdjIGNode(n);
LiveRange *NeighLR = NeighIGNode->getParentLR();
+
+ if( NeighLR->hasColor() &&
+ NeighLR->getType() == Type::DoubleTy) {
+ IsColorUsedArr[ (NeighLR->getColor()) + 1 ] = true;
+
+ } else if (NeighLR->hasSuggestedColor() &&
+ NeighLR-> isSuggestedColorUsable() ) {
- if( NeighLR->hasColor() ) { // if neigh has a color
- IsColorUsedArr[ NeighLR->getColor() ] = true; // record that color
- if (NeighLR->getType() == Type::DoubleTy)
- IsColorUsedArr[ (NeighLR->getColor()) + 1 ] = true;
- }
- else if( NeighLR->hasSuggestedColor() ) { // if neigh has sugg color
-
- if( NeighLR-> isSuggestedColorUsable() ) {
-
- // if the neighbout can use the suggested color
-
+ // if the neighbour can use the suggested color
IsColorUsedArr[ NeighLR->getSuggestedColor() ] = true;
if (NeighLR->getType() == Type::DoubleTy)
IsColorUsedArr[ (NeighLR->getSuggestedColor()) + 1 ] = true;
- }
-
- }
-
+ }
}
-
// **NOTE: We don't check for call interferences in allocating suggested
// color in this class since ALL registers are volatile. If this fact
// changes, we should change the following part
//- see SparcIntRegClass::colorIGNode()
-
+ //
if( LR->hasSuggestedColor() ) {
if( ! IsColorUsedArr[ LR->getSuggestedColor() ] ) {
LR->setColor( LR->getSuggestedColor() );
@@ -244,10 +225,8 @@
IsColorUsedArr);
}
-
-
if( ColorFound >= 0 ) {
- LR->setColor(ColorFound); // first color found in preffered order
+ LR->setColor(ColorFound); // first color found in prefered order
LR->markForSaveAcrossCalls();
} else {
// we are here because no color could be found