Corrected a bug in SparcRegInfo.cpp - to add inserted instructions before a return

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@969 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ruchira Sasanka 2001-10-23 21:40:39 +00:00
parent f7434f0e1d
commit 88dedc1544
2 changed files with 16 additions and 17 deletions

View File

@ -66,7 +66,7 @@ class SparcIntRegOrder{
};
// max # of colors reg coloring can allocate
static unsigned int const NumOfAvailRegs = g0;
static unsigned int const NumOfAvailRegs = i6;
static unsigned int const StartOfNonVolatileRegs = l0;
static unsigned int const StartOfAllRegs = o0;

View File

@ -621,8 +621,7 @@ void UltraSparcRegInfo::suggestReg4RetValue(const MachineInstr *const RetMI,
assert( (UltraSparcInfo->getInstrInfo()).isReturn( RetMI->getOpCode() ) );
suggestReg4RetAddr(RetMI, LRI);
suggestReg4RetAddr(RetMI, LRI);
// if there is an implicit ref, that has to be the ret value
if( RetMI->getNumImplicitRefs() > 0 ) {
@ -681,37 +680,37 @@ void UltraSparcRegInfo::colorRetValue(const MachineInstr *const RetMI,
unsigned RegClassID = getRegClassIDOfValue(RetVal);
unsigned RegType = getRegType( RetVal );
unsigned UniRetReg = InvalidRegNum;
unsigned CorrectCol;
if(RegClassID == IntRegClassID)
UniRetReg = getUnifiedRegNum( RegClassID, SparcIntRegOrder::i0 );
CorrectCol = SparcIntRegOrder::i0;
else if(RegClassID == FloatRegClassID)
UniRetReg = getUnifiedRegNum( RegClassID, SparcFloatRegOrder::f0);
CorrectCol = SparcFloatRegOrder::f0;
else
assert( 0 && "Unknown RegClass");
// if the LR received the suggested color, NOTHING to do
if( LR->hasSuggestedColor() && LR->hasColor() )
if( LR->getSuggestedColor() == LR->getColor() )
return;
if( LR->getColor() == CorrectCol )
return;
unsigned UniRetReg = getUnifiedRegNum( RegClassID, CorrectCol );
if( LR->hasColor() ) {
// We are here because the LR was allocted a regiter, but NOT
// the correct register.
// We are here because the LR was allocted a regiter
// It may be the suggested register or not
// copy the LR of retun value to i0 or f0
unsigned UniLRReg =getUnifiedRegNum( RegClassID, LR->getColor());
if(RegClassID == IntRegClassID)
UniRetReg = getUnifiedRegNum( RegClassID, SparcIntRegOrder::i0);
else if(RegClassID == FloatRegClassID)
UniRetReg = getUnifiedRegNum( RegClassID, SparcFloatRegOrder::f0);
AdMI = cpReg2RegMI( UniLRReg, UniRetReg, RegType);
RetAI->InstrnsBefore.push_back( AdMI );
}
else
assert(0 && "TODO: Copy the return value from stack\n");