mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
Added support for both call/jmpl instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@930 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -87,7 +87,6 @@ protected:
|
|||||||
|
|
||||||
MachineRegClassArrayType MachineRegClassArr;
|
MachineRegClassArrayType MachineRegClassArr;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
@@ -171,6 +170,7 @@ public:
|
|||||||
|
|
||||||
virtual int getRegType(const LiveRange *const LR) const=0;
|
virtual int getRegType(const LiveRange *const LR) const=0;
|
||||||
|
|
||||||
|
virtual const Value * getCallInstRetVal(const MachineInstr *CallMI) const=0;
|
||||||
|
|
||||||
inline virtual unsigned getFramePointer() const=0;
|
inline virtual unsigned getFramePointer() const=0;
|
||||||
|
|
||||||
|
@@ -149,7 +149,7 @@ void PhyRegAlloc::setCallInterferences(const MachineInstr *MInst,
|
|||||||
const LiveVarSet *const LVSetAft )
|
const LiveVarSet *const LVSetAft )
|
||||||
{
|
{
|
||||||
// Now find the LR of the return value of the call
|
// Now find the LR of the return value of the call
|
||||||
// The last *implicit operand* is the return value of a call
|
|
||||||
|
|
||||||
// We do this because, we look at the LV set *after* the instruction
|
// We do this because, we look at the LV set *after* the instruction
|
||||||
// to determine, which LRs must be saved across calls. The return value
|
// to determine, which LRs must be saved across calls. The return value
|
||||||
@@ -158,19 +158,13 @@ void PhyRegAlloc::setCallInterferences(const MachineInstr *MInst,
|
|||||||
|
|
||||||
LiveRange *RetValLR = NULL;
|
LiveRange *RetValLR = NULL;
|
||||||
|
|
||||||
unsigned NumOfImpRefs = MInst->getNumImplicitRefs();
|
const Value *RetVal = MRI.getCallInstRetVal( MInst );
|
||||||
if( NumOfImpRefs > 0 ) {
|
|
||||||
|
|
||||||
if( MInst->implicitRefIsDefined(NumOfImpRefs-1) ) {
|
if( RetVal ) {
|
||||||
|
|
||||||
const Value *RetVal = MInst->getImplicitRef(NumOfImpRefs-1);
|
|
||||||
RetValLR = LRI.getLiveRangeForValue( RetVal );
|
RetValLR = LRI.getLiveRangeForValue( RetVal );
|
||||||
assert( RetValLR && "No LR for RetValue of call");
|
assert( RetValLR && "No LR for RetValue of call");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if( DEBUG_RA)
|
if( DEBUG_RA)
|
||||||
cout << "\n For call inst: " << *MInst;
|
cout << "\n For call inst: " << *MInst;
|
||||||
|
|
||||||
@@ -356,12 +350,11 @@ void PhyRegAlloc::insertCallerSavingCode(const MachineInstr *MInst,
|
|||||||
// to determine, which LRs must be saved across calls. The return value
|
// to determine, which LRs must be saved across calls. The return value
|
||||||
// of the call is live in this set - but we must not save/restore it.
|
// of the call is live in this set - but we must not save/restore it.
|
||||||
|
|
||||||
unsigned NumOfImpRefs = MInst->getNumImplicitRefs();
|
|
||||||
if( NumOfImpRefs > 0 ) {
|
|
||||||
|
|
||||||
if( MInst->implicitRefIsDefined(NumOfImpRefs-1) ) {
|
const Value *RetVal = MRI.getCallInstRetVal( MInst );
|
||||||
|
|
||||||
|
if( RetVal ) {
|
||||||
|
|
||||||
const Value *RetVal = MInst->getImplicitRef(NumOfImpRefs-1);
|
|
||||||
LiveRange *RetValLR = LRI.getLiveRangeForValue( RetVal );
|
LiveRange *RetValLR = LRI.getLiveRangeForValue( RetVal );
|
||||||
assert( RetValLR && "No LR for RetValue of call");
|
assert( RetValLR && "No LR for RetValue of call");
|
||||||
|
|
||||||
@@ -370,8 +363,6 @@ void PhyRegAlloc::insertCallerSavingCode(const MachineInstr *MInst,
|
|||||||
RetValLR->getColor() ) );
|
RetValLR->getColor() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const LiveVarSet *LVSetAft = LVI->getLiveVarSetAfterMInst(MInst, BB);
|
const LiveVarSet *LVSetAft = LVI->getLiveVarSetAfterMInst(MInst, BB);
|
||||||
|
|
||||||
|
@@ -149,7 +149,7 @@ void PhyRegAlloc::setCallInterferences(const MachineInstr *MInst,
|
|||||||
const LiveVarSet *const LVSetAft )
|
const LiveVarSet *const LVSetAft )
|
||||||
{
|
{
|
||||||
// Now find the LR of the return value of the call
|
// Now find the LR of the return value of the call
|
||||||
// The last *implicit operand* is the return value of a call
|
|
||||||
|
|
||||||
// We do this because, we look at the LV set *after* the instruction
|
// We do this because, we look at the LV set *after* the instruction
|
||||||
// to determine, which LRs must be saved across calls. The return value
|
// to determine, which LRs must be saved across calls. The return value
|
||||||
@@ -158,19 +158,13 @@ void PhyRegAlloc::setCallInterferences(const MachineInstr *MInst,
|
|||||||
|
|
||||||
LiveRange *RetValLR = NULL;
|
LiveRange *RetValLR = NULL;
|
||||||
|
|
||||||
unsigned NumOfImpRefs = MInst->getNumImplicitRefs();
|
const Value *RetVal = MRI.getCallInstRetVal( MInst );
|
||||||
if( NumOfImpRefs > 0 ) {
|
|
||||||
|
|
||||||
if( MInst->implicitRefIsDefined(NumOfImpRefs-1) ) {
|
if( RetVal ) {
|
||||||
|
|
||||||
const Value *RetVal = MInst->getImplicitRef(NumOfImpRefs-1);
|
|
||||||
RetValLR = LRI.getLiveRangeForValue( RetVal );
|
RetValLR = LRI.getLiveRangeForValue( RetVal );
|
||||||
assert( RetValLR && "No LR for RetValue of call");
|
assert( RetValLR && "No LR for RetValue of call");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if( DEBUG_RA)
|
if( DEBUG_RA)
|
||||||
cout << "\n For call inst: " << *MInst;
|
cout << "\n For call inst: " << *MInst;
|
||||||
|
|
||||||
@@ -356,12 +350,11 @@ void PhyRegAlloc::insertCallerSavingCode(const MachineInstr *MInst,
|
|||||||
// to determine, which LRs must be saved across calls. The return value
|
// to determine, which LRs must be saved across calls. The return value
|
||||||
// of the call is live in this set - but we must not save/restore it.
|
// of the call is live in this set - but we must not save/restore it.
|
||||||
|
|
||||||
unsigned NumOfImpRefs = MInst->getNumImplicitRefs();
|
|
||||||
if( NumOfImpRefs > 0 ) {
|
|
||||||
|
|
||||||
if( MInst->implicitRefIsDefined(NumOfImpRefs-1) ) {
|
const Value *RetVal = MRI.getCallInstRetVal( MInst );
|
||||||
|
|
||||||
|
if( RetVal ) {
|
||||||
|
|
||||||
const Value *RetVal = MInst->getImplicitRef(NumOfImpRefs-1);
|
|
||||||
LiveRange *RetValLR = LRI.getLiveRangeForValue( RetVal );
|
LiveRange *RetValLR = LRI.getLiveRangeForValue( RetVal );
|
||||||
assert( RetValLR && "No LR for RetValue of call");
|
assert( RetValLR && "No LR for RetValue of call");
|
||||||
|
|
||||||
@@ -370,8 +363,6 @@ void PhyRegAlloc::insertCallerSavingCode(const MachineInstr *MInst,
|
|||||||
RetValLR->getColor() ) );
|
RetValLR->getColor() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const LiveVarSet *LVSetAft = LVI->getLiveVarSetAfterMInst(MInst, BB);
|
const LiveVarSet *LVSetAft = LVI->getLiveVarSetAfterMInst(MInst, BB);
|
||||||
|
|
||||||
|
@@ -171,7 +171,8 @@ class UltraSparcRegInfo : public MachineRegInfo
|
|||||||
void suggestReg4RetAddr(const MachineInstr * RetMI,
|
void suggestReg4RetAddr(const MachineInstr * RetMI,
|
||||||
LiveRangeInfo& LRI) const;
|
LiveRangeInfo& LRI) const;
|
||||||
|
|
||||||
void suggestReg4CallAddr(const MachineInstr * CallMI) const;
|
void suggestReg4CallAddr(const MachineInstr * CallMI, LiveRangeInfo& LRI,
|
||||||
|
vector<RegClass *> RCList) const;
|
||||||
|
|
||||||
|
|
||||||
Value *getValue4ReturnAddr( const MachineInstr * MInst ) const ;
|
Value *getValue4ReturnAddr( const MachineInstr * MInst ) const ;
|
||||||
@@ -235,6 +236,9 @@ class UltraSparcRegInfo : public MachineRegInfo
|
|||||||
MachineInstr * cpValue2RegMI(Value * Val, const unsigned DestReg,
|
MachineInstr * cpValue2RegMI(Value * Val, const unsigned DestReg,
|
||||||
const int RegType) const;
|
const int RegType) const;
|
||||||
|
|
||||||
|
const Value *getCallInstRetAddr(const MachineInstr *CallMI) const;
|
||||||
|
const unsigned getCallInstNumArgs(const MachineInstr *CallMI) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -361,6 +365,8 @@ class UltraSparcRegInfo : public MachineRegInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Value * getCallInstRetVal(const MachineInstr *CallMI) const;
|
||||||
|
|
||||||
MachineInstr * cpReg2RegMI(const unsigned SrcReg, const unsigned DestReg,
|
MachineInstr * cpReg2RegMI(const unsigned SrcReg, const unsigned DestReg,
|
||||||
const int RegType) const;
|
const int RegType) const;
|
||||||
|
|
||||||
|
@@ -16,6 +16,123 @@
|
|||||||
// UltraSparcRegInfo
|
// UltraSparcRegInfo
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Finds the return value of a call instruction
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const Value *
|
||||||
|
UltraSparcRegInfo::getCallInstRetVal(const MachineInstr *CallMI) const{
|
||||||
|
|
||||||
|
unsigned OpCode = CallMI->getOpCode();
|
||||||
|
unsigned NumOfImpRefs = CallMI->getNumImplicitRefs();
|
||||||
|
|
||||||
|
if( OpCode == CALL ) {
|
||||||
|
|
||||||
|
// The one before the last implicit operand is the return value of
|
||||||
|
// a CALL instr
|
||||||
|
if( NumOfImpRefs > 1 )
|
||||||
|
if( CallMI->implicitRefIsDefined(NumOfImpRefs-2) )
|
||||||
|
return CallMI->getImplicitRef(NumOfImpRefs-2);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if( OpCode == JMPL) {
|
||||||
|
|
||||||
|
// The last implicit operand is the return value of a JMPL in
|
||||||
|
if( NumOfImpRefs > 0 )
|
||||||
|
if( CallMI->implicitRefIsDefined(NumOfImpRefs-1) )
|
||||||
|
return CallMI->getImplicitRef(NumOfImpRefs-1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
assert(0 && "OpCode must be CALL/JMPL for a call instr");
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Finds the return address of a call instruction
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const Value *
|
||||||
|
UltraSparcRegInfo::getCallInstRetAddr(const MachineInstr *CallMI)const {
|
||||||
|
|
||||||
|
unsigned OpCode = CallMI->getOpCode();
|
||||||
|
|
||||||
|
if( OpCode == CALL) {
|
||||||
|
|
||||||
|
unsigned NumOfImpRefs = CallMI->getNumImplicitRefs();
|
||||||
|
|
||||||
|
assert( NumOfImpRefs && "CALL instr must have at least on ImpRef");
|
||||||
|
// The last implicit operand is the return address of a CALL instr
|
||||||
|
return CallMI->getImplicitRef(NumOfImpRefs-1);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if( OpCode == JMPL ) {
|
||||||
|
|
||||||
|
MachineOperand & MO = ( MachineOperand &) CallMI->getOperand(2);
|
||||||
|
return MO.getVRegValue();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
assert(0 && "OpCode must be CALL/JMPL for a call instr");
|
||||||
|
|
||||||
|
assert(0 && "There must be a return addr for a call instr");
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Finds the # of actaul arguments of the call instruction
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const unsigned
|
||||||
|
UltraSparcRegInfo::getCallInstNumArgs(const MachineInstr *CallMI) const {
|
||||||
|
|
||||||
|
unsigned OpCode = CallMI->getOpCode();
|
||||||
|
unsigned NumOfImpRefs = CallMI->getNumImplicitRefs();
|
||||||
|
int NumArgs = -1;
|
||||||
|
|
||||||
|
if( OpCode == CALL ) {
|
||||||
|
|
||||||
|
switch( NumOfImpRefs ) {
|
||||||
|
|
||||||
|
case 0: assert(0 && "A CALL inst must have at least one ImpRef (RetAddr)");
|
||||||
|
|
||||||
|
case 1: NumArgs = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // two or more implicit refs
|
||||||
|
if( CallMI->implicitRefIsDefined(NumOfImpRefs-2) )
|
||||||
|
NumArgs = NumOfImpRefs - 2; // i.e., NumOfImpRef-2 is the ret val
|
||||||
|
else
|
||||||
|
NumArgs = NumOfImpRefs - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if( OpCode == JMPL ) {
|
||||||
|
|
||||||
|
// The last implicit operand is the return value of a JMPL instr
|
||||||
|
if( NumOfImpRefs > 0 ) {
|
||||||
|
if( CallMI->implicitRefIsDefined(NumOfImpRefs-1) )
|
||||||
|
NumArgs = NumOfImpRefs - 1; // i.e., NumOfImpRef-1 is the ret val
|
||||||
|
else
|
||||||
|
NumArgs = NumOfImpRefs;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
NumArgs = NumOfImpRefs;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
assert(0 && "OpCode must be CALL/JMPL for a call instr");
|
||||||
|
|
||||||
|
assert( (NumArgs != -1) && "Internal error in getCallInstNumArgs" );
|
||||||
|
return (unsigned) NumArgs;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Suggests a register for the ret address in the RET machine instruction
|
// Suggests a register for the ret address in the RET machine instruction
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -27,6 +144,10 @@ void UltraSparcRegInfo::suggestReg4RetAddr(const MachineInstr * RetMI,
|
|||||||
|
|
||||||
MO.setRegForValue( getUnifiedRegNum( IntRegClassID, SparcIntRegOrder::i7) );
|
MO.setRegForValue( getUnifiedRegNum( IntRegClassID, SparcIntRegOrder::i7) );
|
||||||
|
|
||||||
|
// ***TODO: If the JMPL can be also used as a return instruction,
|
||||||
|
// change the assertion. The return address register of JMPL will still
|
||||||
|
// be Operand(0)
|
||||||
|
|
||||||
|
|
||||||
// TODO (Optimize):
|
// TODO (Optimize):
|
||||||
// Instead of setting the color, we can suggest one. In that case,
|
// Instead of setting the color, we can suggest one. In that case,
|
||||||
@@ -51,9 +172,25 @@ void UltraSparcRegInfo::suggestReg4RetAddr(const MachineInstr * RetMI,
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Suggests a register for the ret address in the JMPL/CALL machine instr
|
// Suggests a register for the ret address in the JMPL/CALL machine instr
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void UltraSparcRegInfo::suggestReg4CallAddr(const MachineInstr * CallMI) const
|
void UltraSparcRegInfo::suggestReg4CallAddr(const MachineInstr * CallMI,
|
||||||
{
|
LiveRangeInfo& LRI,
|
||||||
|
vector<RegClass *> RCList) const {
|
||||||
|
|
||||||
|
|
||||||
|
const Value *RetAddrVal = getCallInstRetAddr( CallMI );
|
||||||
|
|
||||||
|
// RetAddrVal cannot be NULL (asserted in getCallInstRetAddr)
|
||||||
|
// create a new LR for the return address and color it
|
||||||
|
|
||||||
|
LiveRange * RetAddrLR = new LiveRange();
|
||||||
|
RetAddrLR->add( RetAddrVal );
|
||||||
|
unsigned RegClassID = getRegClassIDOfValue( RetAddrVal );
|
||||||
|
RetAddrLR->setRegClass( RCList[RegClassID] );
|
||||||
|
RetAddrLR->setColor(getUnifiedRegNum(IntRegClassID,SparcIntRegOrder::o7));
|
||||||
|
LRI.addLRToMap( RetAddrVal, RetAddrLR);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
assert( (CallMI->getNumOperands() == 3) && "JMPL must have 3 operands");
|
assert( (CallMI->getNumOperands() == 3) && "JMPL must have 3 operands");
|
||||||
|
|
||||||
// directly set color since the LR of ret address (if there were one)
|
// directly set color since the LR of ret address (if there were one)
|
||||||
@@ -61,6 +198,9 @@ void UltraSparcRegInfo::suggestReg4CallAddr(const MachineInstr * CallMI) const
|
|||||||
|
|
||||||
MachineOperand & MO = ( MachineOperand &) CallMI->getOperand(2);
|
MachineOperand & MO = ( MachineOperand &) CallMI->getOperand(2);
|
||||||
MO.setRegForValue( getUnifiedRegNum( IntRegClassID,SparcIntRegOrder::o7) );
|
MO.setRegForValue( getUnifiedRegNum( IntRegClassID,SparcIntRegOrder::o7) );
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -220,7 +360,7 @@ void UltraSparcRegInfo::suggestRegs4CallArgs(const MachineInstr *const CallMI,
|
|||||||
|
|
||||||
assert ( (UltraSparcInfo->getInstrInfo()).isCall(CallMI->getOpCode()) );
|
assert ( (UltraSparcInfo->getInstrInfo()).isCall(CallMI->getOpCode()) );
|
||||||
|
|
||||||
suggestReg4CallAddr(CallMI);
|
suggestReg4CallAddr(CallMI, LRI, RCList);
|
||||||
|
|
||||||
|
|
||||||
// First color the return value of the call instruction. The return value
|
// First color the return value of the call instruction. The return value
|
||||||
@@ -233,15 +373,11 @@ void UltraSparcRegInfo::suggestRegs4CallArgs(const MachineInstr *const CallMI,
|
|||||||
// if type is not void, create a new live range and set its
|
// if type is not void, create a new live range and set its
|
||||||
// register class and add to LRI
|
// register class and add to LRI
|
||||||
|
|
||||||
unsigned NumOfImpRefs = CallMI->getNumImplicitRefs();
|
|
||||||
unsigned NumOfCallArgs = NumOfImpRefs; // assume all implicits are args
|
|
||||||
|
|
||||||
if( NumOfImpRefs > 0 ) {
|
const Value *RetVal = getCallInstRetVal( CallMI );
|
||||||
|
|
||||||
// The last implicit operand is the return value of a call
|
|
||||||
if( CallMI->implicitRefIsDefined(NumOfImpRefs-1) ) {
|
|
||||||
|
|
||||||
const Value *RetVal = CallMI->getImplicitRef(NumOfImpRefs-1);
|
if( RetVal ) {
|
||||||
|
|
||||||
assert( (! LRI.getLiveRangeForValue( RetVal ) ) &&
|
assert( (! LRI.getLiveRangeForValue( RetVal ) ) &&
|
||||||
"LR for ret Value of call already definded!");
|
"LR for ret Value of call already definded!");
|
||||||
@@ -263,19 +399,16 @@ void UltraSparcRegInfo::suggestRegs4CallArgs(const MachineInstr *const CallMI,
|
|||||||
RetValLR->setSuggestedColor(SparcFloatRegOrder::f0 );
|
RetValLR->setSuggestedColor(SparcFloatRegOrder::f0 );
|
||||||
else assert( 0 && "Unknown reg class for return value of call\n");
|
else assert( 0 && "Unknown reg class for return value of call\n");
|
||||||
|
|
||||||
// the last imp ref is the def, so one less arg
|
|
||||||
NumOfCallArgs--;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now suggest colors for arguments (operands) of the call instruction.
|
// Now suggest colors for arguments (operands) of the call instruction.
|
||||||
// Colors are suggested only if the arg number is smaller than the
|
// Colors are suggested only if the arg number is smaller than the
|
||||||
// the number of registers allocated for argument passing.
|
// the number of registers allocated for argument passing.
|
||||||
|
// Now, go thru call args - implicit operands of the call MI
|
||||||
|
|
||||||
|
unsigned NumOfCallArgs = getCallInstNumArgs( CallMI );
|
||||||
|
|
||||||
// go thru call args - implicit operands of the call MI
|
|
||||||
for(unsigned argNo=0, i=0; i < NumOfCallArgs; ++i, ++argNo ) {
|
for(unsigned argNo=0, i=0; i < NumOfCallArgs; ++i, ++argNo ) {
|
||||||
|
|
||||||
const Value *CallArg = CallMI->getImplicitRef(i);
|
const Value *CallArg = CallMI->getImplicitRef(i);
|
||||||
@@ -331,7 +464,6 @@ void UltraSparcRegInfo::colorCallArgs(const MachineInstr *const CallMI,
|
|||||||
LiveRangeInfo& LRI,
|
LiveRangeInfo& LRI,
|
||||||
AddedInstrns *const CallAI) const {
|
AddedInstrns *const CallAI) const {
|
||||||
|
|
||||||
|
|
||||||
assert ( (UltraSparcInfo->getInstrInfo()).isCall(CallMI->getOpCode()) );
|
assert ( (UltraSparcInfo->getInstrInfo()).isCall(CallMI->getOpCode()) );
|
||||||
|
|
||||||
// First color the return value of the call.
|
// First color the return value of the call.
|
||||||
@@ -340,19 +472,10 @@ void UltraSparcRegInfo::colorCallArgs(const MachineInstr *const CallMI,
|
|||||||
|
|
||||||
MachineInstr *AdMI;
|
MachineInstr *AdMI;
|
||||||
|
|
||||||
unsigned NumOfImpRefs = CallMI->getNumImplicitRefs();
|
const Value *RetVal = getCallInstRetVal( CallMI );
|
||||||
unsigned NumOfCallArgs = NumOfImpRefs; // assume all implicits are args
|
|
||||||
|
|
||||||
if( NumOfImpRefs > 0 ) {
|
if( RetVal ) {
|
||||||
|
|
||||||
// The last implicit operand is the return value of a call
|
|
||||||
if( CallMI->implicitRefIsDefined(NumOfImpRefs-1) ) {
|
|
||||||
|
|
||||||
// one less call arg since last implicit ref is the return value
|
|
||||||
NumOfCallArgs--;
|
|
||||||
|
|
||||||
// find the return value and its LR
|
|
||||||
const Value *RetVal = CallMI->getImplicitRef(NumOfImpRefs-1);
|
|
||||||
LiveRange * RetValLR = LRI.getLiveRangeForValue( RetVal );
|
LiveRange * RetValLR = LRI.getLiveRangeForValue( RetVal );
|
||||||
|
|
||||||
if( !RetValLR ) {
|
if( !RetValLR ) {
|
||||||
@@ -407,12 +530,10 @@ void UltraSparcRegInfo::colorCallArgs(const MachineInstr *const CallMI,
|
|||||||
|
|
||||||
} // if there a return value
|
} // if there a return value
|
||||||
|
|
||||||
} // if there is an implicit arg for a return value
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Now color all args of the call instruction
|
// Now color all args of the call instruction
|
||||||
|
|
||||||
|
unsigned NumOfCallArgs = getCallInstNumArgs( CallMI );
|
||||||
|
|
||||||
for(unsigned argNo=0, i=0; i < NumOfCallArgs; ++i, ++argNo ) {
|
for(unsigned argNo=0, i=0; i < NumOfCallArgs; ++i, ++argNo ) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user