1 #include "llvm/Target/Sparc.h"
2 #include "SparcInternals.h"
3 #include "llvm/Method.h"
4 #include "llvm/iTerminators.h"
5 #include "llvm/iOther.h"
6 #include "llvm/CodeGen/InstrScheduling.h"
7 #include "llvm/CodeGen/InstrSelection.h"
9 #include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
10 #include "llvm/CodeGen/PhyRegAlloc.h"
15 //---------------------------------------------------------------------------
17 //---------------------------------------------------------------------------
19 //---------------------------------------------------------------------------
20 // Suggests a register for the ret address in the RET machine instruction
21 //---------------------------------------------------------------------------
22 void UltraSparcRegInfo::suggestReg4RetAddr(const MachineInstr * RetMI,
23 LiveRangeInfo& LRI) const {
25 assert( (RetMI->getNumOperands() == 2) && "RETURN must have 2 operands");
26 MachineOperand & MO = ( MachineOperand &) RetMI->getOperand(0);
28 MO.setRegForValue( getUnifiedRegNum( IntRegClassID, SparcIntRegOrder::i7) );
32 // Instead of setting the color, we can suggest one. In that case,
33 // we have to test later whether it received the suggested color.
34 // In that case, a LR has to be created at the start of method.
35 // It has to be done as follows (remove the setRegVal above):
38 const Value *RetAddrVal = MO.getVRegValue();
40 assert( RetAddrVal && "LR for ret address must be created at start");
42 LiveRange * RetAddrLR = LRI.getLiveRangeForValue( RetAddrVal);
43 RetAddrLR->setSuggestedColor(getUnifiedRegNum( IntRegClassID,
44 SparcIntRegOrdr::i7) );
51 //---------------------------------------------------------------------------
52 // Suggests a register for the ret address in the JMPL/CALL machine instr
53 //---------------------------------------------------------------------------
54 void UltraSparcRegInfo::suggestReg4CallAddr(const MachineInstr * CallMI) const
57 assert( (CallMI->getNumOperands() == 3) && "JMPL must have 3 operands");
59 // directly set color since the LR of ret address (if there were one)
60 // will not extend after the call instr
62 MachineOperand & MO = ( MachineOperand &) CallMI->getOperand(2);
63 MO.setRegForValue( getUnifiedRegNum( IntRegClassID,SparcIntRegOrder::o7) );
69 //---------------------------------------------------------------------------
70 // This method will suggest colors to incoming args to a method.
71 // If the arg is passed on stack due to the lack of regs, NOTHING will be
72 // done - it will be colored (or spilled) as a normal value.
73 //---------------------------------------------------------------------------
75 void UltraSparcRegInfo::suggestRegs4MethodArgs(const Method *const Meth,
76 LiveRangeInfo& LRI) const
79 // get the argument list
80 const Method::ArgumentListType& ArgList = Meth->getArgumentList();
81 // get an iterator to arg list
82 Method::ArgumentListType::const_iterator ArgIt = ArgList.begin();
85 for( unsigned argNo=0; ArgIt != ArgList.end() ; ++ArgIt, ++argNo) {
88 LiveRange *const LR = LRI.getLiveRangeForValue((const Value *) *ArgIt);
89 assert( LR && "No live range found for method arg");
91 unsigned RegType = getRegType( LR );
94 // if the arg is in int class - allocate a reg for an int arg
95 if( RegType == IntRegType ) {
97 if( argNo < NumOfIntArgRegs) {
98 LR->setSuggestedColor( SparcIntRegOrder::i0 + argNo );
103 // Do NOTHING as this will be colored as a normal value.
104 if (DEBUG_RA) cerr << " Int Regr not suggested for method arg\n";
108 else if( RegType==FPSingleRegType && (argNo*2+1) < NumOfFloatArgRegs)
109 LR->setSuggestedColor( SparcFloatRegOrder::f0 + (argNo * 2 + 1) );
112 else if( RegType == FPDoubleRegType && (argNo*2) < NumOfFloatArgRegs)
113 LR->setSuggestedColor( SparcFloatRegOrder::f0 + (argNo * 2) );
120 //---------------------------------------------------------------------------
122 //---------------------------------------------------------------------------
124 void UltraSparcRegInfo::colorMethodArgs(const Method *const Meth,
126 AddedInstrns *const FirstAI) const {
128 // get the argument list
129 const Method::ArgumentListType& ArgList = Meth->getArgumentList();
130 // get an iterator to arg list
131 Method::ArgumentListType::const_iterator ArgIt = ArgList.begin();
137 for( unsigned argNo=0; ArgIt != ArgList.end() ; ++ArgIt, ++argNo) {
140 LiveRange *const LR = LRI.getLiveRangeForValue((const Value *) *ArgIt);
141 assert( LR && "No live range found for method arg");
144 // if the LR received the suggested color, NOTHING to be done
145 if( LR->hasSuggestedColor() && LR->hasColor() )
146 if( LR->getSuggestedColor() == LR->getColor() )
149 // We are here because the LR did not have a suggested
150 // color or did not receive the suggested color. Now handle
154 unsigned RegType = getRegType( LR );
155 unsigned RegClassID = (LR->getRegClass())->getID();
158 // find whether this argument is coming in a register (if not, on stack)
160 bool isArgInReg = false;
161 unsigned UniArgReg = InvalidRegNum;
163 if( (RegType== IntRegType && argNo < NumOfIntArgRegs)) {
165 UniArgReg = getUnifiedRegNum( RegClassID, SparcIntRegOrder::o0 + argNo );
167 else if(RegType == FPSingleRegType && argNo < NumOfFloatArgRegs) {
169 UniArgReg = getUnifiedRegNum( RegClassID,
170 SparcFloatRegOrder::f0 + argNo*2 + 1 ) ;
172 else if(RegType == FPDoubleRegType && argNo < NumOfFloatArgRegs) {
174 UniArgReg = getUnifiedRegNum(RegClassID, SparcFloatRegOrder::f0+argNo*2);
178 if( LR->hasColor() ) {
180 // We are here because the LR did not have a suggested
181 // color or did not receive the suggested color but LR got a register.
182 // Now we have to copy %ix reg (or stack pos of arg)
183 // to the register it was colored with.
185 unsigned UniLRReg = getUnifiedRegNum( RegClassID, LR->getColor() );
187 // if the arg is coming in a register and goes into a register
189 AdMI = cpReg2RegMI(UniArgReg, UniLRReg, RegType );
192 assert(0 && "TODO: Color an Incoming arg on stack");
194 // Now add the instruction
195 FirstAI->InstrnsBefore.push_back( AdMI );
199 else { // LR is not colored (i.e., spilled)
201 assert(0 && "TODO: Color a spilled arg ");
206 } // for each incoming argument
213 //---------------------------------------------------------------------------
214 // This method is called before graph coloring to suggest colors to the
215 // outgoing call args and the return value of the call.
216 //---------------------------------------------------------------------------
217 void UltraSparcRegInfo::suggestRegs4CallArgs(const MachineInstr *const CallMI,
219 vector<RegClass *> RCList) const {
221 assert ( (UltraSparcInfo->getInstrInfo()).isCall(CallMI->getOpCode()) );
223 suggestReg4CallAddr(CallMI);
226 // First color the return value of the call instruction. The return value
227 // will be in %o0 if the value is an integer type, or in %f0 if the
228 // value is a float type.
230 // the return value cannot have a LR in machine instruction since it is
231 // only defined by the call instruction
233 // if type is not void, create a new live range and set its
234 // register class and add to LRI
236 unsigned NumOfImpRefs = CallMI->getNumImplicitRefs();
237 unsigned NumOfCallArgs = NumOfImpRefs; // assume all implicits are args
239 if( NumOfImpRefs > 0 ) {
241 // The last implicit operand is the return value of a call
242 if( CallMI->implicitRefIsDefined(NumOfImpRefs-1) ) {
244 const Value *RetVal = CallMI->getImplicitRef(NumOfImpRefs-1);
246 assert( (! LRI.getLiveRangeForValue( RetVal ) ) &&
247 "LR for ret Value of call already definded!");
250 // create a new LR for the return value
252 LiveRange * RetValLR = new LiveRange();
253 RetValLR->add( RetVal );
254 unsigned RegClassID = getRegClassIDOfValue( RetVal );
255 RetValLR->setRegClass( RCList[RegClassID] );
256 LRI.addLRToMap( RetVal, RetValLR);
258 // now suggest a register depending on the register class of ret arg
260 if( RegClassID == IntRegClassID )
261 RetValLR->setSuggestedColor(SparcIntRegOrder::o0);
262 else if (RegClassID == FloatRegClassID )
263 RetValLR->setSuggestedColor(SparcFloatRegOrder::f0 );
264 else assert( 0 && "Unknown reg class for return value of call\n");
266 // the last imp ref is the def, so one less arg
273 // Now suggest colors for arguments (operands) of the call instruction.
274 // Colors are suggested only if the arg number is smaller than the
275 // the number of registers allocated for argument passing.
278 // go thru call args - implicit operands of the call MI
279 for(unsigned argNo=0, i=0; i < NumOfCallArgs; ++i, ++argNo ) {
281 const Value *CallArg = CallMI->getImplicitRef(i);
283 // get the LR of call operand (parameter)
284 LiveRange *const LR = LRI.getLiveRangeForValue(CallArg);
286 // not possible to have a null LR since all args (even consts)
287 // must be defined before
290 cerr << " ERROR: In call instr, no LR for arg: " ;
291 printValue(CallArg); cerr << endl;
293 assert(0 && "NO LR for call arg");
297 unsigned RegType = getRegType( LR );
299 // if the arg is in int class - allocate a reg for an int arg
300 if( RegType == IntRegType ) {
302 if( argNo < NumOfIntArgRegs)
303 LR->setSuggestedColor( SparcIntRegOrder::o0 + argNo );
306 // Do NOTHING as this will be colored as a normal value.
307 cerr << " Regr not suggested for int call arg" << endl;
310 else if( RegType == FPSingleRegType && (argNo*2 +1)< NumOfFloatArgRegs)
311 LR->setSuggestedColor( SparcFloatRegOrder::f0 + (argNo * 2 + 1) );
314 else if( RegType == FPDoubleRegType && (argNo*2) < NumOfFloatArgRegs)
315 LR->setSuggestedColor( SparcFloatRegOrder::f0 + (argNo * 2) );
318 } // for all call arguments
323 //---------------------------------------------------------------------------
324 // After graph coloring, we have call this method to see whehter the return
325 // value and the call args received the correct colors. If not, we have
326 // to instert copy instructions.
327 //---------------------------------------------------------------------------
330 void UltraSparcRegInfo::colorCallArgs(const MachineInstr *const CallMI,
332 AddedInstrns *const CallAI) const {
335 assert ( (UltraSparcInfo->getInstrInfo()).isCall(CallMI->getOpCode()) );
337 // First color the return value of the call.
338 // If there is a LR for the return value, it means this
339 // method returns a value
343 unsigned NumOfImpRefs = CallMI->getNumImplicitRefs();
344 unsigned NumOfCallArgs = NumOfImpRefs; // assume all implicits are args
346 if( NumOfImpRefs > 0 ) {
348 // The last implicit operand is the return value of a call
349 if( CallMI->implicitRefIsDefined(NumOfImpRefs-1) ) {
351 // one less call arg since last implicit ref is the return value
354 // find the return value and its LR
355 const Value *RetVal = CallMI->getImplicitRef(NumOfImpRefs-1);
356 LiveRange * RetValLR = LRI.getLiveRangeForValue( RetVal );
359 cerr << "\nNo LR for:";
360 printValue( RetVal );
362 assert( RetValLR && "ERR:No LR for non-void return value");
366 bool recvSugColor = false;
368 if( RetValLR->hasSuggestedColor() && RetValLR->hasColor() )
369 if( RetValLR->getSuggestedColor() == RetValLR->getColor())
372 // if we didn't receive the suggested color for some reason,
373 // put copy instruction
375 if( !recvSugColor ) {
377 if( RetValLR->hasColor() ) {
379 unsigned RegType = getRegType( RetValLR );
380 unsigned RegClassID = (RetValLR->getRegClass())->getID();
383 UniRetLRReg=getUnifiedRegNum(RegClassID,RetValLR->getColor());
384 unsigned UniRetReg = InvalidRegNum;
386 // find where we receive the return value depending on
389 if(RegClassID == IntRegClassID)
390 UniRetReg = getUnifiedRegNum( RegClassID, SparcIntRegOrder::o0);
391 else if(RegClassID == FloatRegClassID)
392 UniRetReg = getUnifiedRegNum( RegClassID, SparcFloatRegOrder::f0);
395 AdMI = cpReg2RegMI(UniRetReg, UniRetLRReg, RegType );
396 CallAI->InstrnsAfter.push_back( AdMI );
402 assert(0 && "LR of return value is splilled");
406 } // the LR didn't receive the suggested color
408 } // if there a return value
410 } // if there is an implicit arg for a return value
414 // Now color all args of the call instruction
417 for(unsigned argNo=0, i=0; i < NumOfCallArgs; ++i, ++argNo ) {
419 const Value *CallArg = CallMI->getImplicitRef(i);
421 // get the LR of call operand (parameter)
422 LiveRange *const LR = LRI.getLiveRangeForValue(CallArg);
424 unsigned RegType = getRegType( CallArg );
425 unsigned RegClassID = getRegClassIDOfValue( CallArg);
427 // find whether this argument is coming in a register (if not, on stack)
429 bool isArgInReg = false;
430 unsigned UniArgReg = InvalidRegNum;
432 if( (RegType== IntRegType && argNo < NumOfIntArgRegs)) {
434 UniArgReg = getUnifiedRegNum(RegClassID, SparcIntRegOrder::o0 + argNo );
436 else if(RegType == FPSingleRegType && argNo < NumOfFloatArgRegs) {
438 UniArgReg = getUnifiedRegNum(RegClassID,
439 SparcFloatRegOrder::f0 + (argNo*2 + 1) );
441 else if(RegType == FPDoubleRegType && argNo < NumOfFloatArgRegs) {
443 UniArgReg = getUnifiedRegNum(RegClassID, SparcFloatRegOrder::f0+argNo*2);
447 // not possible to have a null LR since all args (even consts)
448 // must be defined before
451 cerr << " ERROR: In call instr, no LR for arg: " ;
452 printValue(CallArg); cerr << endl;
454 assert(0 && "NO LR for call arg");
459 // if the LR received the suggested color, NOTHING to do
461 if( LR->hasSuggestedColor() && LR->hasColor() )
462 if( LR->getSuggestedColor() == LR->getColor() )
466 if( LR->hasColor() ) {
468 // We are here because though the LR is allocated a register, it
469 // was not allocated the suggested register. So, we have to copy %ix reg
470 // (or stack pos of arg) to the register it was colored with
473 unsigned UniLRReg = getUnifiedRegNum( RegClassID, LR->getColor() );
476 AdMI = cpReg2RegMI(UniLRReg, UniArgReg, RegType );
479 assert(0 && "TODO: Push an outgoing arg on stack");
481 // Now add the instruction
482 CallAI->InstrnsBefore.push_back( AdMI );
486 else { // LR is not colored (i.e., spilled)
488 assert(0 && "TODO: Copy a spilled call arg to an output reg ");
492 } // for each parameter in call instruction
496 //---------------------------------------------------------------------------
497 // This method is called for an LLVM return instruction to identify which
498 // values will be returned from this method and to suggest colors.
499 //---------------------------------------------------------------------------
500 void UltraSparcRegInfo::suggestReg4RetValue(const MachineInstr *const RetMI,
501 LiveRangeInfo& LRI) const {
503 assert( (UltraSparcInfo->getInstrInfo()).isReturn( RetMI->getOpCode() ) );
506 suggestReg4RetAddr(RetMI, LRI);
508 // if there is an implicit ref, that has to be the ret value
509 if( RetMI->getNumImplicitRefs() > 0 ) {
511 // The first implicit operand is the return value of a return instr
512 const Value *RetVal = RetMI->getImplicitRef(0);
515 LiveRange *const LR = LRI.getLiveRangeForValue( RetVal );
518 cerr << "\nNo LR for:";
519 printValue( RetVal );
521 assert( LR && "No LR for return value of non-void method");
525 unsigned RegClassID = (LR->getRegClass())->getID();
527 if( RegClassID == IntRegClassID )
528 LR->setSuggestedColor(SparcIntRegOrder::i0);
530 else if ( RegClassID == FloatRegClassID )
531 LR->setSuggestedColor(SparcFloatRegOrder::f0);
537 //---------------------------------------------------------------------------
539 //---------------------------------------------------------------------------
540 void UltraSparcRegInfo::colorRetValue(const MachineInstr *const RetMI,
542 AddedInstrns *const RetAI) const {
544 assert( (UltraSparcInfo->getInstrInfo()).isReturn( RetMI->getOpCode() ) );
546 // if there is an implicit ref, that has to be the ret value
547 if( RetMI->getNumImplicitRefs() > 0 ) {
549 // The first implicit operand is the return value of a return instr
550 const Value *RetVal = RetMI->getImplicitRef(0);
553 LiveRange *const LR = LRI.getLiveRangeForValue( RetVal );
556 cerr << "\nNo LR for:";
557 printValue( RetVal );
559 // assert( LR && "No LR for return value of non-void method");
563 unsigned RegClassID = getRegClassIDOfValue(RetVal);
564 unsigned RegType = getRegType( RetVal );
565 unsigned UniRetReg = InvalidRegNum;
567 if(RegClassID == IntRegClassID)
568 UniRetReg = getUnifiedRegNum( RegClassID, SparcIntRegOrder::i0 );
569 else if(RegClassID == FloatRegClassID)
570 UniRetReg = getUnifiedRegNum( RegClassID, SparcFloatRegOrder::f0);
574 // if the LR received the suggested color, NOTHING to do
576 if( LR->hasSuggestedColor() && LR->hasColor() )
577 if( LR->getSuggestedColor() == LR->getColor() )
580 if( LR->hasColor() ) {
582 // We are here because the LR was allocted a regiter, but NOT
583 // the correct register.
585 // copy the LR of retun value to i0 or f0
587 unsigned UniLRReg =getUnifiedRegNum( RegClassID, LR->getColor());
589 if(RegClassID == IntRegClassID)
590 UniRetReg = getUnifiedRegNum( RegClassID, SparcIntRegOrder::i0);
591 else if(RegClassID == FloatRegClassID)
592 UniRetReg = getUnifiedRegNum( RegClassID, SparcFloatRegOrder::f0);
594 AdMI = cpReg2RegMI( UniLRReg, UniRetReg, RegType);
598 assert(0 && "TODO: Copy the return value from stack\n");
600 } // if there is a return value
605 //---------------------------------------------------------------------------
606 // Copy from a register to register. Register number must be the unified
608 //---------------------------------------------------------------------------
611 MachineInstr * UltraSparcRegInfo::cpReg2RegMI(const unsigned SrcReg,
612 const unsigned DestReg,
613 const int RegType) const {
615 assert( ((int)SrcReg != InvalidRegNum) && ((int)DestReg != InvalidRegNum) &&
618 MachineInstr * MI = NULL;
625 MI = new MachineInstr(ADD, 3);
626 MI->SetMachineOperand(0, SrcReg, false);
627 MI->SetMachineOperand(1, SparcIntRegOrder::g0, false);
628 MI->SetMachineOperand(2, DestReg, true);
631 case FPSingleRegType:
632 MI = new MachineInstr(FMOVS, 2);
633 MI->SetMachineOperand(0, SrcReg, false);
634 MI->SetMachineOperand(1, DestReg, true);
637 case FPDoubleRegType:
638 MI = new MachineInstr(FMOVD, 2);
639 MI->SetMachineOperand(0, SrcReg, false);
640 MI->SetMachineOperand(1, DestReg, true);
644 assert(0 && "Unknow RegType");
651 //---------------------------------------------------------------------------
652 // Copy from a register to memory. Register number must be the unified
654 //---------------------------------------------------------------------------
657 MachineInstr * UltraSparcRegInfo::cpReg2MemMI(const unsigned SrcReg,
658 const unsigned DestPtrReg,
660 const int RegType) const {
663 MachineInstr * MI = NULL;
670 MI = new MachineInstr(STX, 3);
671 MI->SetMachineOperand(0, DestPtrReg, false);
672 MI->SetMachineOperand(1, SrcReg, false);
673 MI->SetMachineOperand(2, MachineOperand:: MO_SignExtendedImmed,
674 (int64_t) Offset, false);
677 case FPSingleRegType:
678 MI = new MachineInstr(ST, 3);
679 MI->SetMachineOperand(0, DestPtrReg, false);
680 MI->SetMachineOperand(1, SrcReg, false);
681 MI->SetMachineOperand(2, MachineOperand:: MO_SignExtendedImmed,
682 (int64_t) Offset, false);
685 case FPDoubleRegType:
686 MI = new MachineInstr(STD, 3);
687 MI->SetMachineOperand(0, DestPtrReg, false);
688 MI->SetMachineOperand(1, SrcReg, false);
689 MI->SetMachineOperand(2, MachineOperand:: MO_SignExtendedImmed,
690 (int64_t) Offset, false);
694 assert(0 && "Unknow RegType");
701 //---------------------------------------------------------------------------
702 // Copy from memory to a reg. Register number must be the unified
704 //---------------------------------------------------------------------------
707 MachineInstr * UltraSparcRegInfo::cpMem2RegMI(const unsigned SrcPtrReg,
709 const unsigned DestReg,
710 const int RegType) const {
712 MachineInstr * MI = NULL;
719 MI = new MachineInstr(LDX, 3);
720 MI->SetMachineOperand(0, SrcPtrReg, false);
721 MI->SetMachineOperand(1, MachineOperand:: MO_SignExtendedImmed,
722 (int64_t) Offset, false);
723 MI->SetMachineOperand(2, DestReg, false);
726 case FPSingleRegType:
727 MI = new MachineInstr(LD, 3);
728 MI->SetMachineOperand(0, SrcPtrReg, false);
729 MI->SetMachineOperand(1, MachineOperand:: MO_SignExtendedImmed,
730 (int64_t) Offset, false);
731 MI->SetMachineOperand(2, DestReg, false);
735 case FPDoubleRegType:
736 MI = new MachineInstr(LDD, 3);
737 MI->SetMachineOperand(0, SrcPtrReg, false);
738 MI->SetMachineOperand(1, MachineOperand:: MO_SignExtendedImmed,
739 (int64_t) Offset, false);
740 MI->SetMachineOperand(2, DestReg, false);
744 assert(0 && "Unknow RegType");
758 //---------------------------------------------------------------------------
759 // Only constant/label values are accepted.
760 // ***This code is temporary ***
761 //---------------------------------------------------------------------------
764 MachineInstr * UltraSparcRegInfo::cpValue2RegMI(Value * Val,
765 const unsigned DestReg,
766 const int RegType) const {
768 assert( ((int)DestReg != InvalidRegNum) && "Invalid Register");
774 MachineOperand::MachineOperandType MOTypeInt =
775 ChooseRegOrImmed(Val, ADD, *UltraSparcInfo, true, MReg, Imm);
778 MachineOperand::MachineOperandType MOType;
780 switch( Val->getValueType() ) {
782 case Value::ConstantVal:
783 case Value::GlobalVariableVal:
784 MOType = MachineOperand:: MO_UnextendedImmed; // TODO**** correct???
787 case Value::BasicBlockVal:
788 case Value::MethodVal:
789 MOType = MachineOperand::MO_PCRelativeDisp;
793 cerr << "Value Type: " << Val->getValueType() << endl;
794 assert(0 && "Unknown val type - Only constants/globals/labels are valid");
799 MachineInstr * MI = NULL;
804 MI = new MachineInstr(ADD);
805 MI->SetMachineOperand(0, MOType, Val, false);
806 MI->SetMachineOperand(1, SparcIntRegOrder::g0, false);
807 MI->SetMachineOperand(2, DestReg, true);
810 case FPSingleRegType:
811 assert(0 && "FP const move not yet implemented");
812 MI = new MachineInstr(FMOVS);
813 MI->SetMachineOperand(0, MachineOperand::MO_SignExtendedImmed, Val, false);
814 MI->SetMachineOperand(1, DestReg, true);
817 case FPDoubleRegType:
818 assert(0 && "FP const move not yet implemented");
819 MI = new MachineInstr(FMOVD);
820 MI->SetMachineOperand(0, MachineOperand::MO_SignExtendedImmed, Val, false);
821 MI->SetMachineOperand(1, DestReg, true);
825 assert(0 && "Unknow RegType");
837 //---------------------------------------------------------------------------
838 // Print the register assigned to a LR
839 //---------------------------------------------------------------------------
841 void UltraSparcRegInfo::printReg(const LiveRange *const LR) {
843 unsigned RegClassID = (LR->getRegClass())->getID();
845 cerr << " *Node " << (LR->getUserIGNode())->getIndex();
847 if( ! LR->hasColor() ) {
848 cerr << " - could not find a color" << endl;
852 // if a color is found
854 cerr << " colored with color "<< LR->getColor();
856 if( RegClassID == IntRegClassID ) {
858 cerr<< " [" << SparcIntRegOrder::getRegName(LR->getColor()) ;
861 else if ( RegClassID == FloatRegClassID) {
862 cerr << "[" << SparcFloatRegOrder::getRegName(LR->getColor());
863 if( LR->getTypeID() == Type::DoubleTyID )
864 cerr << "+" << SparcFloatRegOrder::getRegName(LR->getColor()+1);