2002-02-03 07:52:04 +00:00
|
|
|
//===-- SparcRegInfo.cpp - Sparc Target Register Information --------------===//
|
|
|
|
//
|
|
|
|
// This file contains implementation of Sparc specific helper methods
|
|
|
|
// used for register allocation.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2001-09-15 00:30:44 +00:00
|
|
|
#include "SparcInternals.h"
|
2002-02-04 05:59:25 +00:00
|
|
|
#include "SparcRegClassInfo.h"
|
2002-10-28 00:28:31 +00:00
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2002-12-28 20:21:29 +00:00
|
|
|
#include "llvm/CodeGen/MachineFunctionInfo.h"
|
2002-05-19 15:25:51 +00:00
|
|
|
#include "llvm/CodeGen/InstrSelection.h"
|
2003-01-15 17:47:49 +00:00
|
|
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
2003-06-01 02:48:23 +00:00
|
|
|
#include "llvm/CodeGen/MachineCodeForInstruction.h"
|
2002-05-19 15:25:51 +00:00
|
|
|
#include "llvm/CodeGen/MachineInstrAnnot.h"
|
2003-07-29 19:53:21 +00:00
|
|
|
#include "llvm/CodeGen/LiveRangeInfo.h"
|
2002-02-04 05:59:25 +00:00
|
|
|
#include "llvm/iTerminators.h"
|
|
|
|
#include "llvm/iOther.h"
|
2002-04-09 19:08:28 +00:00
|
|
|
#include "llvm/Function.h"
|
2002-01-07 19:20:28 +00:00
|
|
|
#include "llvm/DerivedTypes.h"
|
2001-09-14 03:47:57 +00:00
|
|
|
|
2003-01-14 23:05:08 +00:00
|
|
|
enum {
|
|
|
|
BadRegClass = ~0
|
|
|
|
};
|
|
|
|
|
2002-02-04 05:59:25 +00:00
|
|
|
UltraSparcRegInfo::UltraSparcRegInfo(const UltraSparc &tgt)
|
2003-05-31 07:32:01 +00:00
|
|
|
: TargetRegInfo(tgt), NumOfIntArgRegs(6), NumOfFloatArgRegs(32)
|
|
|
|
{
|
2002-02-04 05:59:25 +00:00
|
|
|
MachineRegClassArr.push_back(new SparcIntRegClass(IntRegClassID));
|
|
|
|
MachineRegClassArr.push_back(new SparcFloatRegClass(FloatRegClassID));
|
|
|
|
MachineRegClassArr.push_back(new SparcIntCCRegClass(IntCCRegClassID));
|
|
|
|
MachineRegClassArr.push_back(new SparcFloatCCRegClass(FloatCCRegClassID));
|
2003-05-27 00:02:22 +00:00
|
|
|
MachineRegClassArr.push_back(new SparcSpecialRegClass(SpecialRegClassID));
|
2002-07-08 23:23:12 +00:00
|
|
|
|
2002-08-12 21:25:05 +00:00
|
|
|
assert(SparcFloatRegClass::StartOfNonVolatileRegs == 32 &&
|
2002-02-04 05:59:25 +00:00
|
|
|
"32 Float regs are used for float arg passing");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-18 03:12:16 +00:00
|
|
|
// getZeroRegNum - returns the register that contains always zero.
|
|
|
|
// this is the unified register number
|
2002-02-04 05:59:25 +00:00
|
|
|
//
|
2002-03-18 03:12:16 +00:00
|
|
|
int UltraSparcRegInfo::getZeroRegNum() const {
|
2002-08-12 21:25:05 +00:00
|
|
|
return getUnifiedRegNum(UltraSparcRegInfo::IntRegClassID,
|
|
|
|
SparcIntRegClass::g0);
|
2002-03-18 03:12:16 +00:00
|
|
|
}
|
2002-02-04 05:59:25 +00:00
|
|
|
|
|
|
|
// getCallAddressReg - returns the reg used for pushing the address when a
|
|
|
|
// method is called. This can be used for other purposes between calls
|
|
|
|
//
|
|
|
|
unsigned UltraSparcRegInfo::getCallAddressReg() const {
|
2002-08-12 21:25:05 +00:00
|
|
|
return getUnifiedRegNum(UltraSparcRegInfo::IntRegClassID,
|
|
|
|
SparcIntRegClass::o7);
|
2002-02-04 05:59:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the register containing the return address.
|
|
|
|
// It should be made sure that this register contains the return
|
|
|
|
// value when a return instruction is reached.
|
|
|
|
//
|
|
|
|
unsigned UltraSparcRegInfo::getReturnAddressReg() const {
|
2002-08-12 21:25:05 +00:00
|
|
|
return getUnifiedRegNum(UltraSparcRegInfo::IntRegClassID,
|
|
|
|
SparcIntRegClass::i7);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Register get name implementations...
|
|
|
|
|
|
|
|
// Int register names in same order as enum in class SparcIntRegClass
|
|
|
|
static const char * const IntRegNames[] = {
|
|
|
|
"o0", "o1", "o2", "o3", "o4", "o5", "o7",
|
|
|
|
"l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
|
|
|
|
"i0", "i1", "i2", "i3", "i4", "i5",
|
|
|
|
"i6", "i7",
|
|
|
|
"g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
|
|
|
|
"o6"
|
|
|
|
};
|
|
|
|
|
2003-05-27 00:02:22 +00:00
|
|
|
const char * const SparcIntRegClass::getRegName(unsigned reg) const {
|
2002-08-12 21:25:05 +00:00
|
|
|
assert(reg < NumOfAllRegs);
|
|
|
|
return IntRegNames[reg];
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char * const FloatRegNames[] = {
|
|
|
|
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9",
|
|
|
|
"f10", "f11", "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19",
|
|
|
|
"f20", "f21", "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29",
|
|
|
|
"f30", "f31", "f32", "f33", "f34", "f35", "f36", "f37", "f38", "f39",
|
|
|
|
"f40", "f41", "f42", "f43", "f44", "f45", "f46", "f47", "f48", "f49",
|
|
|
|
"f50", "f51", "f52", "f53", "f54", "f55", "f56", "f57", "f58", "f59",
|
|
|
|
"f60", "f61", "f62", "f63"
|
|
|
|
};
|
|
|
|
|
2003-05-27 00:02:22 +00:00
|
|
|
const char * const SparcFloatRegClass::getRegName(unsigned reg) const {
|
2002-08-12 21:25:05 +00:00
|
|
|
assert (reg < NumOfAllRegs);
|
|
|
|
return FloatRegNames[reg];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const char * const IntCCRegNames[] = {
|
2003-07-06 20:13:59 +00:00
|
|
|
"xcc", "icc", "ccr"
|
2002-08-12 21:25:05 +00:00
|
|
|
};
|
|
|
|
|
2003-05-27 00:02:22 +00:00
|
|
|
const char * const SparcIntCCRegClass::getRegName(unsigned reg) const {
|
2003-07-06 20:13:59 +00:00
|
|
|
assert(reg < 3);
|
2002-08-12 21:25:05 +00:00
|
|
|
return IntCCRegNames[reg];
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char * const FloatCCRegNames[] = {
|
|
|
|
"fcc0", "fcc1", "fcc2", "fcc3"
|
|
|
|
};
|
|
|
|
|
2003-05-27 00:02:22 +00:00
|
|
|
const char * const SparcFloatCCRegClass::getRegName(unsigned reg) const {
|
|
|
|
assert (reg < 5);
|
2002-08-12 21:25:05 +00:00
|
|
|
return FloatCCRegNames[reg];
|
2002-02-04 05:59:25 +00:00
|
|
|
}
|
|
|
|
|
2003-05-27 00:02:22 +00:00
|
|
|
static const char * const SpecialRegNames[] = {
|
|
|
|
"fsr"
|
|
|
|
};
|
|
|
|
|
|
|
|
const char * const SparcSpecialRegClass::getRegName(unsigned reg) const {
|
|
|
|
assert (reg < 1);
|
|
|
|
return SpecialRegNames[reg];
|
2002-02-04 05:59:25 +00:00
|
|
|
}
|
|
|
|
|
2002-03-18 03:12:16 +00:00
|
|
|
// Get unified reg number for frame pointer
|
2002-02-04 05:59:25 +00:00
|
|
|
unsigned UltraSparcRegInfo::getFramePointer() const {
|
2002-08-12 21:25:05 +00:00
|
|
|
return getUnifiedRegNum(UltraSparcRegInfo::IntRegClassID,
|
|
|
|
SparcIntRegClass::i6);
|
2002-02-04 05:59:25 +00:00
|
|
|
}
|
|
|
|
|
2002-03-18 03:12:16 +00:00
|
|
|
// Get unified reg number for stack pointer
|
2002-02-04 05:59:25 +00:00
|
|
|
unsigned UltraSparcRegInfo::getStackPointer() const {
|
2002-08-12 21:25:05 +00:00
|
|
|
return getUnifiedRegNum(UltraSparcRegInfo::IntRegClassID,
|
|
|
|
SparcIntRegClass::o6);
|
2002-02-04 05:59:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-25 04:42:21 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Finds whether a call is an indirect call
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
isVarArgsFunction(const Type *funcType) {
|
|
|
|
return cast<FunctionType>(cast<PointerType>(funcType)
|
|
|
|
->getElementType())->isVarArg();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
isVarArgsCall(const MachineInstr *CallMI) {
|
|
|
|
Value* callee = CallMI->getOperand(0).getVRegValue();
|
|
|
|
// const Type* funcType = isa<Function>(callee)? callee->getType()
|
|
|
|
// : cast<PointerType>(callee->getType())->getElementType();
|
|
|
|
const Type* funcType = callee->getType();
|
|
|
|
return isVarArgsFunction(funcType);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-05-31 07:32:01 +00:00
|
|
|
// Get the register number for the specified argument #argNo,
|
2002-04-25 04:42:21 +00:00
|
|
|
//
|
|
|
|
// Return value:
|
2003-05-31 07:32:01 +00:00
|
|
|
// getInvalidRegNum(), if there is no int register available for the arg.
|
|
|
|
// regNum, otherwise (this is NOT the unified reg. num).
|
|
|
|
// regClassId is set to the register class ID.
|
2002-04-25 04:42:21 +00:00
|
|
|
//
|
2003-05-31 07:32:01 +00:00
|
|
|
int
|
2002-04-25 04:42:21 +00:00
|
|
|
UltraSparcRegInfo::regNumForIntArg(bool inCallee, bool isVarArgsCall,
|
2003-05-31 07:32:01 +00:00
|
|
|
unsigned argNo, unsigned& regClassId) const
|
2002-04-25 04:42:21 +00:00
|
|
|
{
|
2002-05-19 15:25:51 +00:00
|
|
|
regClassId = IntRegClassID;
|
2002-04-25 04:42:21 +00:00
|
|
|
if (argNo >= NumOfIntArgRegs)
|
2003-05-31 07:32:01 +00:00
|
|
|
return getInvalidRegNum();
|
2002-05-19 15:25:51 +00:00
|
|
|
else
|
2002-08-12 21:25:05 +00:00
|
|
|
return argNo + (inCallee? SparcIntRegClass::i0 : SparcIntRegClass::o0);
|
2002-04-25 04:42:21 +00:00
|
|
|
}
|
|
|
|
|
2003-05-31 07:32:01 +00:00
|
|
|
// Get the register number for the specified FP argument #argNo,
|
2002-04-25 04:42:21 +00:00
|
|
|
// Use INT regs for FP args if this is a varargs call.
|
|
|
|
//
|
|
|
|
// Return value:
|
2003-05-31 07:32:01 +00:00
|
|
|
// getInvalidRegNum(), if there is no int register available for the arg.
|
|
|
|
// regNum, otherwise (this is NOT the unified reg. num).
|
|
|
|
// regClassId is set to the register class ID.
|
2002-04-25 04:42:21 +00:00
|
|
|
//
|
2003-05-31 07:32:01 +00:00
|
|
|
int
|
2002-04-25 04:42:21 +00:00
|
|
|
UltraSparcRegInfo::regNumForFPArg(unsigned regType,
|
|
|
|
bool inCallee, bool isVarArgsCall,
|
2003-05-31 07:32:01 +00:00
|
|
|
unsigned argNo, unsigned& regClassId) const
|
2002-04-25 04:42:21 +00:00
|
|
|
{
|
2002-05-19 15:25:51 +00:00
|
|
|
if (isVarArgsCall)
|
2003-05-31 07:32:01 +00:00
|
|
|
return regNumForIntArg(inCallee, isVarArgsCall, argNo, regClassId);
|
2002-05-19 15:25:51 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
regClassId = FloatRegClassID;
|
|
|
|
if (regType == FPSingleRegType)
|
|
|
|
return (argNo*2+1 >= NumOfFloatArgRegs)?
|
2003-05-31 07:32:01 +00:00
|
|
|
getInvalidRegNum() : SparcFloatRegClass::f0 + (argNo * 2 + 1);
|
2002-05-19 15:25:51 +00:00
|
|
|
else if (regType == FPDoubleRegType)
|
|
|
|
return (argNo*2 >= NumOfFloatArgRegs)?
|
2003-05-31 07:32:01 +00:00
|
|
|
getInvalidRegNum() : SparcFloatRegClass::f0 + (argNo * 2);
|
2002-05-19 15:25:51 +00:00
|
|
|
else
|
|
|
|
assert(0 && "Illegal FP register type");
|
2002-07-25 06:08:32 +00:00
|
|
|
return 0;
|
2002-05-19 15:25:51 +00:00
|
|
|
}
|
2002-03-31 19:04:50 +00:00
|
|
|
}
|
|
|
|
|
2002-01-07 19:20:28 +00:00
|
|
|
|
2001-10-21 16:43:41 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2002-01-07 19:20:28 +00:00
|
|
|
// Finds the return address of a call sparc specific call instruction
|
2001-10-21 16:43:41 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2002-07-08 23:23:12 +00:00
|
|
|
// The following 4 methods are used to find the RegType (SparcInternals.h)
|
2002-05-19 15:25:51 +00:00
|
|
|
// of a LiveRange, a Value, and for a given register unified reg number.
|
2002-02-04 05:59:25 +00:00
|
|
|
//
|
2003-05-27 00:02:22 +00:00
|
|
|
int UltraSparcRegInfo::getRegTypeForClassAndType(unsigned regClassID,
|
|
|
|
const Type* type) const
|
|
|
|
{
|
2002-05-19 15:25:51 +00:00
|
|
|
switch (regClassID) {
|
2003-05-27 00:02:22 +00:00
|
|
|
case IntRegClassID: return IntRegType;
|
|
|
|
case FloatRegClassID:
|
|
|
|
if (type == Type::FloatTy) return FPSingleRegType;
|
|
|
|
else if (type == Type::DoubleTy) return FPDoubleRegType;
|
|
|
|
assert(0 && "Unknown type in FloatRegClass"); return 0;
|
|
|
|
case IntCCRegClassID: return IntCCRegType;
|
|
|
|
case FloatCCRegClassID: return FloatCCRegType;
|
|
|
|
case SpecialRegClassID: return SpecialRegType;
|
2002-05-19 15:25:51 +00:00
|
|
|
default: assert( 0 && "Unknown reg class ID"); return 0;
|
2001-10-21 16:43:41 +00:00
|
|
|
}
|
2002-02-04 05:59:25 +00:00
|
|
|
}
|
2001-10-21 16:43:41 +00:00
|
|
|
|
2003-07-25 21:12:15 +00:00
|
|
|
int UltraSparcRegInfo::getRegTypeForDataType(const Type* type) const
|
2003-05-27 00:02:22 +00:00
|
|
|
{
|
|
|
|
return getRegTypeForClassAndType(getRegClassIDOfType(type), type);
|
2002-02-04 05:59:25 +00:00
|
|
|
}
|
2001-10-21 16:43:41 +00:00
|
|
|
|
2003-07-25 21:12:15 +00:00
|
|
|
int UltraSparcRegInfo::getRegTypeForLR(const LiveRange *LR) const
|
2003-05-27 00:02:22 +00:00
|
|
|
{
|
|
|
|
return getRegTypeForClassAndType(LR->getRegClassID(), LR->getType());
|
|
|
|
}
|
2003-01-15 21:14:32 +00:00
|
|
|
|
2003-05-27 00:02:22 +00:00
|
|
|
int UltraSparcRegInfo::getRegType(int unifiedRegNum) const
|
|
|
|
{
|
2002-07-08 23:23:12 +00:00
|
|
|
if (unifiedRegNum < 32)
|
2002-02-04 05:59:25 +00:00
|
|
|
return IntRegType;
|
2002-07-08 23:23:12 +00:00
|
|
|
else if (unifiedRegNum < (32 + 32))
|
2002-02-04 05:59:25 +00:00
|
|
|
return FPSingleRegType;
|
2002-07-08 23:23:12 +00:00
|
|
|
else if (unifiedRegNum < (64 + 32))
|
2002-02-04 05:59:25 +00:00
|
|
|
return FPDoubleRegType;
|
2002-07-08 23:23:12 +00:00
|
|
|
else if (unifiedRegNum < (64+32+4))
|
2002-02-04 05:59:25 +00:00
|
|
|
return FloatCCRegType;
|
2002-07-08 23:23:12 +00:00
|
|
|
else if (unifiedRegNum < (64+32+4+2))
|
2002-02-04 05:59:25 +00:00
|
|
|
return IntCCRegType;
|
|
|
|
else
|
2002-07-08 23:23:12 +00:00
|
|
|
assert(0 && "Invalid unified register number in getRegType");
|
2002-02-24 23:02:40 +00:00
|
|
|
return 0;
|
2001-10-21 16:43:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-08 23:23:12 +00:00
|
|
|
// To find the register class used for a specified Type
|
|
|
|
//
|
|
|
|
unsigned UltraSparcRegInfo::getRegClassIDOfType(const Type *type,
|
2002-07-25 06:08:32 +00:00
|
|
|
bool isCCReg) const {
|
2002-07-08 23:23:12 +00:00
|
|
|
Type::PrimitiveID ty = type->getPrimitiveID();
|
|
|
|
unsigned res;
|
|
|
|
|
|
|
|
// FIXME: Comparing types like this isn't very safe...
|
|
|
|
if ((ty && ty <= Type::LongTyID) || (ty == Type::LabelTyID) ||
|
|
|
|
(ty == Type::FunctionTyID) || (ty == Type::PointerTyID) )
|
|
|
|
res = IntRegClassID; // sparc int reg (ty=0: void)
|
|
|
|
else if (ty <= Type::DoubleTyID)
|
|
|
|
res = FloatRegClassID; // sparc float reg class
|
|
|
|
else {
|
|
|
|
//std::cerr << "TypeID: " << ty << "\n";
|
|
|
|
assert(0 && "Cannot resolve register class for type");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-01-15 21:14:32 +00:00
|
|
|
if (isCCReg)
|
|
|
|
return res + 2; // corresponding condition code register
|
2002-07-08 23:23:12 +00:00
|
|
|
else
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned UltraSparcRegInfo::getRegClassIDOfRegType(int regType) const {
|
|
|
|
switch(regType) {
|
|
|
|
case IntRegType: return IntRegClassID;
|
|
|
|
case FPSingleRegType:
|
|
|
|
case FPDoubleRegType: return FloatRegClassID;
|
|
|
|
case IntCCRegType: return IntCCRegClassID;
|
|
|
|
case FloatCCRegType: return FloatCCRegClassID;
|
|
|
|
default:
|
|
|
|
assert(0 && "Invalid register type in getRegClassIDOfRegType");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-01-07 19:20:28 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Suggests a register for the ret address in the RET machine instruction.
|
|
|
|
// We always suggest %i7 by convention.
|
|
|
|
//---------------------------------------------------------------------------
|
2002-07-08 23:23:12 +00:00
|
|
|
void UltraSparcRegInfo::suggestReg4RetAddr(MachineInstr *RetMI,
|
2001-10-15 16:25:28 +00:00
|
|
|
LiveRangeInfo& LRI) const {
|
2001-09-30 23:16:47 +00:00
|
|
|
|
2002-07-08 23:23:12 +00:00
|
|
|
assert(target.getInstrInfo().isReturn(RetMI->getOpCode()));
|
2001-10-22 13:41:12 +00:00
|
|
|
|
2002-07-08 23:23:12 +00:00
|
|
|
// return address is always mapped to i7 so set it immediately
|
|
|
|
RetMI->SetRegForOperand(0, getUnifiedRegNum(IntRegClassID,
|
2002-08-12 21:25:05 +00:00
|
|
|
SparcIntRegClass::i7));
|
2001-10-22 13:41:12 +00:00
|
|
|
|
2002-01-07 19:20:28 +00:00
|
|
|
// Possible Optimization:
|
2001-10-16 01:23:19 +00:00
|
|
|
// Instead of setting the color, we can suggest one. In that case,
|
2001-10-15 16:25:28 +00:00
|
|
|
// we have to test later whether it received the suggested color.
|
|
|
|
// In that case, a LR has to be created at the start of method.
|
|
|
|
// It has to be done as follows (remove the setRegVal above):
|
2001-09-30 23:16:47 +00:00
|
|
|
|
2002-07-08 23:23:12 +00:00
|
|
|
// MachineOperand & MO = RetMI->getOperand(0);
|
2002-01-07 19:20:28 +00:00
|
|
|
// const Value *RetAddrVal = MO.getVRegValue();
|
|
|
|
// assert( RetAddrVal && "LR for ret address must be created at start");
|
|
|
|
// LiveRange * RetAddrLR = LRI.getLiveRangeForValue( RetAddrVal);
|
|
|
|
// RetAddrLR->setSuggestedColor(getUnifiedRegNum( IntRegClassID,
|
2002-07-08 23:23:12 +00:00
|
|
|
// SparcIntRegOrdr::i7) );
|
2001-09-30 23:16:47 +00:00
|
|
|
}
|
2001-09-14 03:47:57 +00:00
|
|
|
|
|
|
|
|
2001-09-18 22:52:44 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2002-01-07 19:20:28 +00:00
|
|
|
// Suggests a register for the ret address in the JMPL/CALL machine instr.
|
|
|
|
// Sparc ABI dictates that %o7 be used for this purpose.
|
2001-09-18 22:52:44 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2002-09-28 16:59:05 +00:00
|
|
|
void
|
|
|
|
UltraSparcRegInfo::suggestReg4CallAddr(MachineInstr * CallMI,
|
|
|
|
LiveRangeInfo& LRI) const
|
|
|
|
{
|
2002-05-19 15:25:51 +00:00
|
|
|
CallArgsDescriptor* argDesc = CallArgsDescriptor::get(CallMI);
|
|
|
|
const Value *RetAddrVal = argDesc->getReturnAddrReg();
|
2002-09-28 16:59:05 +00:00
|
|
|
assert(RetAddrVal && "INTERNAL ERROR: Return address value is required");
|
2001-09-30 23:16:47 +00:00
|
|
|
|
2002-09-28 16:59:05 +00:00
|
|
|
// A LR must already exist for the return address.
|
|
|
|
LiveRange *RetAddrLR = LRI.getLiveRangeForValue(RetAddrVal);
|
|
|
|
assert(RetAddrLR && "INTERNAL ERROR: No LR for return address of call!");
|
|
|
|
|
2003-01-15 21:14:32 +00:00
|
|
|
unsigned RegClassID = RetAddrLR->getRegClassID();
|
2002-09-28 16:59:05 +00:00
|
|
|
RetAddrLR->setColor(getUnifiedRegNum(IntRegClassID, SparcIntRegClass::o7));
|
|
|
|
}
|
2001-10-15 16:25:28 +00:00
|
|
|
|
|
|
|
|
2001-09-30 23:16:47 +00:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// This method will suggest colors to incoming args to a method.
|
2002-01-07 19:20:28 +00:00
|
|
|
// According to the Sparc ABI, the first 6 incoming args are in
|
|
|
|
// %i0 - %i5 (if they are integer) OR in %f0 - %f31 (if they are float).
|
2001-09-30 23:16:47 +00:00
|
|
|
// If the arg is passed on stack due to the lack of regs, NOTHING will be
|
2002-01-07 19:20:28 +00:00
|
|
|
// done - it will be colored (or spilled) as a normal live range.
|
2001-09-30 23:16:47 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2002-04-08 22:03:57 +00:00
|
|
|
void UltraSparcRegInfo::suggestRegs4MethodArgs(const Function *Meth,
|
2001-09-30 23:16:47 +00:00
|
|
|
LiveRangeInfo& LRI) const
|
2001-09-18 22:52:44 +00:00
|
|
|
{
|
2003-07-25 21:12:15 +00:00
|
|
|
// Check if this is a varArgs function. needed for choosing regs.
|
2002-04-25 04:42:21 +00:00
|
|
|
bool isVarArgs = isVarArgsFunction(Meth->getType());
|
|
|
|
|
2003-07-25 21:12:15 +00:00
|
|
|
// Count the arguments, *ignoring* whether they are int or FP args.
|
|
|
|
// Use this common arg numbering to pick the right int or fp register.
|
|
|
|
unsigned argNo=0;
|
2002-06-25 16:13:21 +00:00
|
|
|
for(Function::const_aiterator I = Meth->abegin(), E = Meth->aend();
|
|
|
|
I != E; ++I, ++argNo) {
|
|
|
|
LiveRange *LR = LRI.getLiveRangeForValue(I);
|
|
|
|
assert(LR && "No live range found for method arg");
|
|
|
|
|
2003-07-25 21:12:15 +00:00
|
|
|
unsigned regType = getRegTypeForLR(LR);
|
|
|
|
unsigned regClassIDOfArgReg = BadRegClass; // for chosen reg (unused)
|
2002-06-25 16:13:21 +00:00
|
|
|
|
|
|
|
int regNum = (regType == IntRegType)
|
2003-07-25 21:12:15 +00:00
|
|
|
? regNumForIntArg(/*inCallee*/ true, isVarArgs, argNo, regClassIDOfArgReg)
|
|
|
|
: regNumForFPArg(regType, /*inCallee*/ true, isVarArgs, argNo,
|
|
|
|
regClassIDOfArgReg);
|
2002-06-25 16:13:21 +00:00
|
|
|
|
2003-07-25 21:12:15 +00:00
|
|
|
if (regNum != getInvalidRegNum())
|
2002-06-25 16:13:21 +00:00
|
|
|
LR->setSuggestedColor(regNum);
|
|
|
|
}
|
2001-09-30 23:16:47 +00:00
|
|
|
}
|
2001-09-14 03:47:57 +00:00
|
|
|
|
2002-01-07 19:20:28 +00:00
|
|
|
|
2001-09-30 23:16:47 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2002-01-07 19:20:28 +00:00
|
|
|
// This method is called after graph coloring to move incoming args to
|
|
|
|
// the correct hardware registers if they did not receive the correct
|
|
|
|
// (suggested) color through graph coloring.
|
2001-09-30 23:16:47 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2002-04-08 22:03:57 +00:00
|
|
|
void UltraSparcRegInfo::colorMethodArgs(const Function *Meth,
|
2003-07-29 19:53:21 +00:00
|
|
|
LiveRangeInfo &LRI,
|
|
|
|
std::vector<MachineInstr*>& InstrnsBefore,
|
|
|
|
std::vector<MachineInstr*>& InstrnsAfter) const {
|
2001-09-18 22:52:44 +00:00
|
|
|
|
2002-04-25 04:42:21 +00:00
|
|
|
// check if this is a varArgs function. needed for choosing regs.
|
|
|
|
bool isVarArgs = isVarArgsFunction(Meth->getType());
|
2001-09-30 23:16:47 +00:00
|
|
|
MachineInstr *AdMI;
|
2001-09-18 22:52:44 +00:00
|
|
|
|
2001-09-30 23:16:47 +00:00
|
|
|
// for each argument
|
2002-06-25 16:13:21 +00:00
|
|
|
// for each argument. count INT and FP arguments separately.
|
|
|
|
unsigned argNo=0, intArgNo=0, fpArgNo=0;
|
|
|
|
for(Function::const_aiterator I = Meth->abegin(), E = Meth->aend();
|
|
|
|
I != E; ++I, ++argNo) {
|
2001-09-30 23:16:47 +00:00
|
|
|
// get the LR of arg
|
2002-06-25 16:13:21 +00:00
|
|
|
LiveRange *LR = LRI.getLiveRangeForValue(I);
|
2001-09-30 23:16:47 +00:00
|
|
|
assert( LR && "No live range found for method arg");
|
|
|
|
|
2003-07-25 21:12:15 +00:00
|
|
|
unsigned regType = getRegTypeForLR(LR);
|
2003-01-15 21:14:32 +00:00
|
|
|
unsigned RegClassID = LR->getRegClassID();
|
2002-04-25 04:42:21 +00:00
|
|
|
|
2002-01-07 19:20:28 +00:00
|
|
|
// Find whether this argument is coming in a register (if not, on stack)
|
2002-04-25 04:42:21 +00:00
|
|
|
// Also find the correct register the argument must use (UniArgReg)
|
2002-01-07 19:20:28 +00:00
|
|
|
//
|
2001-09-30 23:16:47 +00:00
|
|
|
bool isArgInReg = false;
|
2003-05-31 07:32:01 +00:00
|
|
|
unsigned UniArgReg = getInvalidRegNum(); // reg that LR MUST be colored with
|
2003-01-14 23:05:08 +00:00
|
|
|
unsigned regClassIDOfArgReg = BadRegClass; // reg class of chosen reg
|
2002-04-25 04:42:21 +00:00
|
|
|
|
|
|
|
int regNum = (regType == IntRegType)
|
2002-05-19 15:25:51 +00:00
|
|
|
? regNumForIntArg(/*inCallee*/ true, isVarArgs,
|
2003-05-31 07:32:01 +00:00
|
|
|
argNo, regClassIDOfArgReg)
|
2002-05-19 15:25:51 +00:00
|
|
|
: regNumForFPArg(regType, /*inCallee*/ true, isVarArgs,
|
2003-05-31 07:32:01 +00:00
|
|
|
argNo, regClassIDOfArgReg);
|
2002-04-25 04:42:21 +00:00
|
|
|
|
2003-05-31 07:32:01 +00:00
|
|
|
if(regNum != getInvalidRegNum()) {
|
2001-09-30 23:16:47 +00:00
|
|
|
isArgInReg = true;
|
2002-04-25 04:42:21 +00:00
|
|
|
UniArgReg = getUnifiedRegNum( regClassIDOfArgReg, regNum);
|
2001-09-30 23:16:47 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 19:42:11 +00:00
|
|
|
if( ! LR->isMarkedForSpill() ) { // if this arg received a register
|
2001-09-30 23:16:47 +00:00
|
|
|
|
2001-10-24 15:56:58 +00:00
|
|
|
unsigned UniLRReg = getUnifiedRegNum( RegClassID, LR->getColor() );
|
|
|
|
|
|
|
|
// if LR received the correct color, nothing to do
|
2002-01-07 19:20:28 +00:00
|
|
|
//
|
2001-10-24 15:56:58 +00:00
|
|
|
if( UniLRReg == UniArgReg )
|
|
|
|
continue;
|
|
|
|
|
2002-01-07 19:20:28 +00:00
|
|
|
// We are here because the LR did not receive the suggested
|
|
|
|
// but LR received another register.
|
|
|
|
// Now we have to copy the %i reg (or stack pos of arg)
|
|
|
|
// to the register the LR was colored with.
|
2001-10-24 15:56:58 +00:00
|
|
|
|
2002-01-07 19:20:28 +00:00
|
|
|
// if the arg is coming in UniArgReg register, it MUST go into
|
2001-10-24 15:56:58 +00:00
|
|
|
// the UniLRReg register
|
2002-01-07 19:20:28 +00:00
|
|
|
//
|
2002-04-25 04:42:21 +00:00
|
|
|
if( isArgInReg ) {
|
|
|
|
if( regClassIDOfArgReg != RegClassID ) {
|
2002-05-19 15:25:51 +00:00
|
|
|
assert(0 && "This could should work but it is not tested yet");
|
2002-04-25 04:42:21 +00:00
|
|
|
|
|
|
|
// It is a variable argument call: the float reg must go in a %o reg.
|
|
|
|
// We have to move an int reg to a float reg via memory.
|
|
|
|
//
|
|
|
|
assert(isVarArgs &&
|
|
|
|
RegClassID == FloatRegClassID &&
|
|
|
|
regClassIDOfArgReg == IntRegClassID &&
|
|
|
|
"This should only be an Int register for an FP argument");
|
|
|
|
|
2002-12-28 20:21:29 +00:00
|
|
|
int TmpOff = MachineFunction::get(Meth).getInfo()->pushTempValue(
|
2002-04-25 04:42:21 +00:00
|
|
|
getSpilledRegSize(regType));
|
2003-07-29 19:53:21 +00:00
|
|
|
cpReg2MemMI(InstrnsBefore,
|
2002-07-08 23:23:12 +00:00
|
|
|
UniArgReg, getFramePointer(), TmpOff, IntRegType);
|
2002-04-25 04:42:21 +00:00
|
|
|
|
2003-07-29 19:53:21 +00:00
|
|
|
cpMem2RegMI(InstrnsBefore,
|
2002-07-08 23:23:12 +00:00
|
|
|
getFramePointer(), TmpOff, UniLRReg, regType);
|
2002-04-25 04:42:21 +00:00
|
|
|
}
|
|
|
|
else {
|
2003-07-29 19:53:21 +00:00
|
|
|
cpReg2RegMI(InstrnsBefore, UniArgReg, UniLRReg, regType);
|
2002-04-25 04:42:21 +00:00
|
|
|
}
|
|
|
|
}
|
2001-10-28 18:15:12 +00:00
|
|
|
else {
|
2001-09-18 22:52:44 +00:00
|
|
|
|
2001-10-28 18:15:12 +00:00
|
|
|
// Now the arg is coming on stack. Since the LR recieved a register,
|
|
|
|
// we just have to load the arg on stack into that register
|
2002-01-07 19:20:28 +00:00
|
|
|
//
|
2002-12-28 20:21:29 +00:00
|
|
|
const TargetFrameInfo& frameInfo = target.getFrameInfo();
|
2001-11-08 04:56:41 +00:00
|
|
|
int offsetFromFP =
|
2002-10-28 00:28:31 +00:00
|
|
|
frameInfo.getIncomingArgOffset(MachineFunction::get(Meth),
|
2002-04-25 04:42:21 +00:00
|
|
|
argNo);
|
2003-05-31 07:32:01 +00:00
|
|
|
|
|
|
|
// float arguments on stack are right justified so adjust the offset!
|
|
|
|
// int arguments are also right justified but they are always loaded as
|
|
|
|
// a full double-word so the offset does not need to be adjusted.
|
|
|
|
if (regType == FPSingleRegType) {
|
|
|
|
unsigned argSize = target.getTargetData().getTypeSize(LR->getType());
|
|
|
|
unsigned slotSize = frameInfo.getSizeOfEachArgOnStack();
|
|
|
|
assert(argSize <= slotSize && "Insufficient slot size!");
|
|
|
|
offsetFromFP += slotSize - argSize;
|
|
|
|
}
|
|
|
|
|
2003-07-29 19:53:21 +00:00
|
|
|
cpMem2RegMI(InstrnsBefore,
|
2002-07-08 23:23:12 +00:00
|
|
|
getFramePointer(), offsetFromFP, UniLRReg, regType);
|
2001-10-28 18:15:12 +00:00
|
|
|
}
|
2001-09-30 23:16:47 +00:00
|
|
|
|
2001-10-28 18:15:12 +00:00
|
|
|
} // if LR received a color
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
// Now, the LR did not receive a color. But it has a stack offset for
|
|
|
|
// spilling.
|
|
|
|
// So, if the arg is coming in UniArgReg register, we can just move
|
|
|
|
// that on to the stack pos of LR
|
|
|
|
|
|
|
|
if( isArgInReg ) {
|
2002-04-25 04:42:21 +00:00
|
|
|
|
|
|
|
if( regClassIDOfArgReg != RegClassID ) {
|
|
|
|
assert(0 &&
|
|
|
|
"FP arguments to a varargs function should be explicitly "
|
|
|
|
"copied to/from int registers by instruction selection!");
|
|
|
|
|
|
|
|
// It must be a float arg for a variable argument call, which
|
|
|
|
// must come in a %o reg. Move the int reg to the stack.
|
|
|
|
//
|
|
|
|
assert(isVarArgs && regClassIDOfArgReg == IntRegClassID &&
|
|
|
|
"This should only be an Int register for an FP argument");
|
|
|
|
|
2003-07-29 19:53:21 +00:00
|
|
|
cpReg2MemMI(InstrnsBefore, UniArgReg,
|
2002-07-08 23:23:12 +00:00
|
|
|
getFramePointer(), LR->getSpillOffFromFP(), IntRegType);
|
2002-04-25 04:42:21 +00:00
|
|
|
}
|
|
|
|
else {
|
2003-07-29 19:53:21 +00:00
|
|
|
cpReg2MemMI(InstrnsBefore, UniArgReg,
|
2002-07-08 23:23:12 +00:00
|
|
|
getFramePointer(), LR->getSpillOffFromFP(), regType);
|
2002-04-25 04:42:21 +00:00
|
|
|
}
|
2001-10-28 18:15:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
// Now the arg is coming on stack. Since the LR did NOT
|
|
|
|
// recieved a register as well, it is allocated a stack position. We
|
2002-04-25 04:42:21 +00:00
|
|
|
// can simply change the stack position of the LR. We can do this,
|
2001-10-28 18:15:12 +00:00
|
|
|
// since this method is called before any other method that makes
|
|
|
|
// uses of the stack pos of the LR (e.g., updateMachineInstr)
|
2003-05-31 07:32:01 +00:00
|
|
|
//
|
2002-12-28 20:21:29 +00:00
|
|
|
const TargetFrameInfo& frameInfo = target.getFrameInfo();
|
2001-11-08 04:56:41 +00:00
|
|
|
int offsetFromFP =
|
2002-10-28 00:28:31 +00:00
|
|
|
frameInfo.getIncomingArgOffset(MachineFunction::get(Meth),
|
2002-04-25 04:42:21 +00:00
|
|
|
argNo);
|
2003-05-31 07:32:01 +00:00
|
|
|
|
|
|
|
// FP arguments on stack are right justified so adjust offset!
|
|
|
|
// int arguments are also right justified but they are always loaded as
|
|
|
|
// a full double-word so the offset does not need to be adjusted.
|
|
|
|
if (regType == FPSingleRegType) {
|
|
|
|
unsigned argSize = target.getTargetData().getTypeSize(LR->getType());
|
|
|
|
unsigned slotSize = frameInfo.getSizeOfEachArgOnStack();
|
|
|
|
assert(argSize <= slotSize && "Insufficient slot size!");
|
|
|
|
offsetFromFP += slotSize - argSize;
|
|
|
|
}
|
2001-11-08 04:56:41 +00:00
|
|
|
|
|
|
|
LR->modifySpillOffFromFP( offsetFromFP );
|
2001-10-28 18:15:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2001-09-14 03:47:57 +00:00
|
|
|
|
2001-09-30 23:16:47 +00:00
|
|
|
} // for each incoming argument
|
2001-09-14 03:47:57 +00:00
|
|
|
|
2001-09-30 23:16:47 +00:00
|
|
|
}
|
2001-09-14 03:47:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2001-09-30 23:16:47 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// This method is called before graph coloring to suggest colors to the
|
|
|
|
// outgoing call args and the return value of the call.
|
|
|
|
//---------------------------------------------------------------------------
|
2002-07-08 23:23:12 +00:00
|
|
|
void UltraSparcRegInfo::suggestRegs4CallArgs(MachineInstr *CallMI,
|
2002-09-28 16:59:05 +00:00
|
|
|
LiveRangeInfo& LRI) const {
|
2002-10-13 00:05:30 +00:00
|
|
|
assert ( (target.getInstrInfo()).isCall(CallMI->getOpCode()) );
|
2001-10-15 16:25:28 +00:00
|
|
|
|
2002-05-19 15:25:51 +00:00
|
|
|
CallArgsDescriptor* argDesc = CallArgsDescriptor::get(CallMI);
|
2002-04-25 04:42:21 +00:00
|
|
|
|
2002-09-28 16:59:05 +00:00
|
|
|
suggestReg4CallAddr(CallMI, LRI);
|
2001-09-14 03:47:57 +00:00
|
|
|
|
2002-09-28 16:59:05 +00:00
|
|
|
// First color the return value of the call instruction, if any.
|
|
|
|
// The return value will be in %o0 if the value is an integer type,
|
|
|
|
// or in %f0 if the value is a float type.
|
|
|
|
//
|
|
|
|
if (const Value *RetVal = argDesc->getReturnValue()) {
|
|
|
|
LiveRange *RetValLR = LRI.getLiveRangeForValue(RetVal);
|
|
|
|
assert(RetValLR && "No LR for return Value of call!");
|
2001-09-18 22:52:44 +00:00
|
|
|
|
2003-01-15 21:14:32 +00:00
|
|
|
unsigned RegClassID = RetValLR->getRegClassID();
|
2001-09-30 23:16:47 +00:00
|
|
|
|
2001-10-21 16:43:41 +00:00
|
|
|
// now suggest a register depending on the register class of ret arg
|
|
|
|
if( RegClassID == IntRegClassID )
|
2002-08-12 21:25:05 +00:00
|
|
|
RetValLR->setSuggestedColor(SparcIntRegClass::o0);
|
2001-10-21 16:43:41 +00:00
|
|
|
else if (RegClassID == FloatRegClassID )
|
2002-08-12 21:25:05 +00:00
|
|
|
RetValLR->setSuggestedColor(SparcFloatRegClass::f0 );
|
2001-10-21 16:43:41 +00:00
|
|
|
else assert( 0 && "Unknown reg class for return value of call\n");
|
2001-10-15 16:25:28 +00:00
|
|
|
}
|
2001-09-30 23:16:47 +00:00
|
|
|
|
|
|
|
// Now suggest colors for arguments (operands) of the call instruction.
|
|
|
|
// Colors are suggested only if the arg number is smaller than the
|
|
|
|
// the number of registers allocated for argument passing.
|
2001-10-21 16:43:41 +00:00
|
|
|
// Now, go thru call args - implicit operands of the call MI
|
2001-09-30 23:16:47 +00:00
|
|
|
|
2002-05-19 15:25:51 +00:00
|
|
|
unsigned NumOfCallArgs = argDesc->getNumArgs();
|
2001-09-30 23:16:47 +00:00
|
|
|
|
2002-04-25 04:42:21 +00:00
|
|
|
for(unsigned argNo=0, i=0, intArgNo=0, fpArgNo=0;
|
|
|
|
i < NumOfCallArgs; ++i, ++argNo) {
|
2001-10-15 16:25:28 +00:00
|
|
|
|
2002-05-19 15:25:51 +00:00
|
|
|
const Value *CallArg = argDesc->getArgInfo(i).getArgVal();
|
2001-09-30 23:16:47 +00:00
|
|
|
|
|
|
|
// get the LR of call operand (parameter)
|
2001-10-15 16:25:28 +00:00
|
|
|
LiveRange *const LR = LRI.getLiveRangeForValue(CallArg);
|
2003-05-31 07:32:01 +00:00
|
|
|
if (!LR)
|
|
|
|
continue; // no live ranges for constants and labels
|
2002-09-28 16:59:05 +00:00
|
|
|
|
2003-07-25 21:12:15 +00:00
|
|
|
unsigned regType = getRegTypeForLR(LR);
|
2003-05-31 07:32:01 +00:00
|
|
|
unsigned regClassIDOfArgReg = BadRegClass; // chosen reg class (unused)
|
2002-09-28 16:59:05 +00:00
|
|
|
|
2002-04-25 04:42:21 +00:00
|
|
|
// Choose a register for this arg depending on whether it is
|
2002-05-19 15:25:51 +00:00
|
|
|
// an INT or FP value. Here we ignore whether or not it is a
|
|
|
|
// varargs calls, because FP arguments will be explicitly copied
|
|
|
|
// to an integer Value and handled under (argCopy != NULL) below.
|
2002-04-25 04:42:21 +00:00
|
|
|
int regNum = (regType == IntRegType)
|
2002-05-19 15:25:51 +00:00
|
|
|
? regNumForIntArg(/*inCallee*/ false, /*isVarArgs*/ false,
|
2003-05-31 07:32:01 +00:00
|
|
|
argNo, regClassIDOfArgReg)
|
2002-05-19 15:25:51 +00:00
|
|
|
: regNumForFPArg(regType, /*inCallee*/ false, /*isVarArgs*/ false,
|
2003-05-31 07:32:01 +00:00
|
|
|
argNo, regClassIDOfArgReg);
|
2001-09-30 23:16:47 +00:00
|
|
|
|
2002-04-25 04:42:21 +00:00
|
|
|
// If a register could be allocated, use it.
|
|
|
|
// If not, do NOTHING as this will be colored as a normal value.
|
2003-05-31 07:32:01 +00:00
|
|
|
if(regNum != getInvalidRegNum())
|
2002-04-25 04:42:21 +00:00
|
|
|
LR->setSuggestedColor(regNum);
|
2001-09-30 23:16:47 +00:00
|
|
|
} // for all call arguments
|
|
|
|
}
|
2001-09-18 22:52:44 +00:00
|
|
|
|
|
|
|
|
2001-09-30 23:16:47 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2003-06-01 02:48:23 +00:00
|
|
|
// this method is called for an LLVM return instruction to identify which
|
2001-09-30 23:16:47 +00:00
|
|
|
// values will be returned from this method and to suggest colors.
|
|
|
|
//---------------------------------------------------------------------------
|
2002-07-08 23:23:12 +00:00
|
|
|
void UltraSparcRegInfo::suggestReg4RetValue(MachineInstr *RetMI,
|
2003-07-29 19:53:21 +00:00
|
|
|
LiveRangeInfo& LRI) const {
|
2001-09-30 23:16:47 +00:00
|
|
|
|
2002-10-13 00:05:30 +00:00
|
|
|
assert( (target.getInstrInfo()).isReturn( RetMI->getOpCode() ) );
|
2001-09-30 23:16:47 +00:00
|
|
|
|
2002-07-08 23:23:12 +00:00
|
|
|
suggestReg4RetAddr(RetMI, LRI);
|
2001-09-30 23:16:47 +00:00
|
|
|
|
2003-05-31 07:32:01 +00:00
|
|
|
// To find the return value (if any), we can get the LLVM return instr.
|
|
|
|
// from the return address register, which is the first operand
|
|
|
|
Value* tmpI = RetMI->getOperand(0).getVRegValue();
|
|
|
|
ReturnInst* retI=cast<ReturnInst>(cast<TmpInstruction>(tmpI)->getOperand(0));
|
|
|
|
if (const Value *RetVal = retI->getReturnValue())
|
|
|
|
if (LiveRange *const LR = LRI.getLiveRangeForValue(RetVal))
|
|
|
|
LR->setSuggestedColor(LR->getRegClassID() == IntRegClassID
|
|
|
|
? (unsigned) SparcIntRegClass::i0
|
|
|
|
: (unsigned) SparcFloatRegClass::f0);
|
2001-09-18 22:52:44 +00:00
|
|
|
}
|
2001-09-14 03:47:57 +00:00
|
|
|
|
2002-07-08 23:23:12 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Check if a specified register type needs a scratch register to be
|
|
|
|
// copied to/from memory. If it does, the reg. type that must be used
|
|
|
|
// for scratch registers is returned in scratchRegType.
|
|
|
|
//
|
|
|
|
// Only the int CC register needs such a scratch register.
|
|
|
|
// The FP CC registers can (and must) be copied directly to/from memory.
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
bool
|
|
|
|
UltraSparcRegInfo::regTypeNeedsScratchReg(int RegType,
|
|
|
|
int& scratchRegType) const
|
|
|
|
{
|
|
|
|
if (RegType == IntCCRegType)
|
|
|
|
{
|
|
|
|
scratchRegType = IntRegType;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2001-09-14 03:47:57 +00:00
|
|
|
|
2001-09-30 23:16:47 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Copy from a register to register. Register number must be the unified
|
2002-07-08 23:23:12 +00:00
|
|
|
// register number.
|
2001-09-30 23:16:47 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2002-05-19 15:25:51 +00:00
|
|
|
void
|
2003-05-21 17:59:06 +00:00
|
|
|
UltraSparcRegInfo::cpReg2RegMI(std::vector<MachineInstr*>& mvec,
|
2002-07-08 23:23:12 +00:00
|
|
|
unsigned SrcReg,
|
2002-05-19 15:25:51 +00:00
|
|
|
unsigned DestReg,
|
2002-07-08 23:23:12 +00:00
|
|
|
int RegType) const {
|
2003-06-06 09:52:23 +00:00
|
|
|
assert( ((int)SrcReg != getInvalidRegNum()) &&
|
|
|
|
((int)DestReg != getInvalidRegNum()) &&
|
2001-09-30 23:16:47 +00:00
|
|
|
"Invalid Register");
|
|
|
|
|
|
|
|
MachineInstr * MI = NULL;
|
2002-05-19 15:25:51 +00:00
|
|
|
|
2001-09-30 23:16:47 +00:00
|
|
|
switch( RegType ) {
|
|
|
|
|
2001-10-18 22:38:52 +00:00
|
|
|
case IntCCRegType:
|
2003-05-20 20:32:24 +00:00
|
|
|
if (getRegType(DestReg) == IntRegType) {
|
|
|
|
// copy intCC reg to int reg
|
2003-07-10 19:42:11 +00:00
|
|
|
MI = (BuildMI(V9::RDCCR, 2)
|
|
|
|
.addMReg(getUnifiedRegNum(UltraSparcRegInfo::IntCCRegClassID,
|
|
|
|
SparcIntCCRegClass::ccr))
|
|
|
|
.addMReg(DestReg,MOTy::Def));
|
2003-05-20 20:32:24 +00:00
|
|
|
} else {
|
|
|
|
// copy int reg to intCC reg
|
|
|
|
assert(getRegType(SrcReg) == IntRegType
|
|
|
|
&& "Can only copy CC reg to/from integer reg");
|
2003-07-10 19:42:11 +00:00
|
|
|
MI = (BuildMI(V9::WRCCRr, 3)
|
|
|
|
.addMReg(SrcReg)
|
|
|
|
.addMReg(SparcIntRegClass::g0)
|
|
|
|
.addMReg(getUnifiedRegNum(UltraSparcRegInfo::IntCCRegClassID,
|
|
|
|
SparcIntCCRegClass::ccr), MOTy::Def));
|
2003-05-20 20:32:24 +00:00
|
|
|
}
|
2002-07-08 23:23:12 +00:00
|
|
|
break;
|
|
|
|
|
2001-10-18 22:38:52 +00:00
|
|
|
case FloatCCRegType:
|
2002-07-08 23:23:12 +00:00
|
|
|
assert(0 && "Cannot copy FPCC register to any other register");
|
2002-05-19 15:25:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IntRegType:
|
2003-05-27 22:40:34 +00:00
|
|
|
MI = BuildMI(V9::ADDr, 3).addMReg(SrcReg).addMReg(getZeroRegNum())
|
2003-05-20 20:32:24 +00:00
|
|
|
.addMReg(DestReg, MOTy::Def);
|
2001-09-30 23:16:47 +00:00
|
|
|
break;
|
2002-05-19 15:25:51 +00:00
|
|
|
|
2001-09-30 23:16:47 +00:00
|
|
|
case FPSingleRegType:
|
2003-05-20 20:32:24 +00:00
|
|
|
MI = BuildMI(V9::FMOVS, 2).addMReg(SrcReg).addMReg(DestReg, MOTy::Def);
|
2001-09-30 23:16:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FPDoubleRegType:
|
2003-05-20 20:32:24 +00:00
|
|
|
MI = BuildMI(V9::FMOVD, 2).addMReg(SrcReg).addMReg(DestReg, MOTy::Def);
|
2001-09-30 23:16:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2002-05-19 15:25:51 +00:00
|
|
|
assert(0 && "Unknown RegType");
|
2002-07-08 23:23:12 +00:00
|
|
|
break;
|
2001-09-18 22:52:44 +00:00
|
|
|
}
|
2002-05-19 15:25:51 +00:00
|
|
|
|
|
|
|
if (MI)
|
|
|
|
mvec.push_back(MI);
|
2001-09-30 23:16:47 +00:00
|
|
|
}
|
|
|
|
|
2001-10-16 01:23:19 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2001-10-24 22:05:34 +00:00
|
|
|
// Copy from a register to memory (i.e., Store). Register number must
|
|
|
|
// be the unified register number
|
2001-10-16 01:23:19 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2002-05-19 15:25:51 +00:00
|
|
|
void
|
2003-05-21 17:59:06 +00:00
|
|
|
UltraSparcRegInfo::cpReg2MemMI(std::vector<MachineInstr*>& mvec,
|
2002-07-08 23:23:12 +00:00
|
|
|
unsigned SrcReg,
|
2003-07-29 19:53:21 +00:00
|
|
|
unsigned PtrReg,
|
2002-05-19 15:25:51 +00:00
|
|
|
int Offset, int RegType,
|
2002-07-25 06:08:32 +00:00
|
|
|
int scratchReg) const {
|
2001-10-16 01:23:19 +00:00
|
|
|
MachineInstr * MI = NULL;
|
2003-07-29 19:53:21 +00:00
|
|
|
int OffReg = -1;
|
|
|
|
|
|
|
|
// If the Offset will not fit in the signed-immediate field, find an
|
|
|
|
// unused register to hold the offset value. This takes advantage of
|
|
|
|
// the fact that all the opcodes used below have the same size immed. field.
|
|
|
|
// Use the register allocator, PRA, to find an unused reg. at this MI.
|
|
|
|
//
|
|
|
|
if (RegType != IntCCRegType) // does not use offset below
|
|
|
|
if (! target.getInstrInfo().constantFitsInImmedField(V9::LDXi, Offset)) {
|
|
|
|
#ifdef CAN_FIND_FREE_REGISTER_TRANSPARENTLY
|
|
|
|
RegClass* RC = PRA.getRegClassByID(this->getRegClassIDOfRegType(RegType));
|
|
|
|
OffReg = PRA.getUnusedUniRegAtMI(RC, RegType, MInst, LVSetBef);
|
|
|
|
#else
|
|
|
|
// Default to using register g2 for holding large offsets
|
|
|
|
OffReg = getUnifiedRegNum(UltraSparcRegInfo::IntRegClassID,
|
|
|
|
SparcIntRegClass::g4);
|
|
|
|
#endif
|
|
|
|
assert(OffReg >= 0 && "FIXME: cpReg2MemMI cannot find an unused reg.");
|
|
|
|
mvec.push_back(BuildMI(V9::SETSW, 2).addZImm(Offset).addReg(OffReg));
|
|
|
|
}
|
|
|
|
|
2003-01-15 17:47:49 +00:00
|
|
|
switch (RegType) {
|
2001-10-16 01:23:19 +00:00
|
|
|
case IntRegType:
|
2003-07-29 19:53:21 +00:00
|
|
|
if (target.getInstrInfo().constantFitsInImmedField(V9::STXi, Offset))
|
|
|
|
MI = BuildMI(V9::STXi,3).addMReg(SrcReg).addMReg(PtrReg).addSImm(Offset);
|
|
|
|
else
|
|
|
|
MI = BuildMI(V9::STXr,3).addMReg(SrcReg).addMReg(PtrReg).addMReg(OffReg);
|
2001-10-16 01:23:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FPSingleRegType:
|
2003-07-29 19:53:21 +00:00
|
|
|
if (target.getInstrInfo().constantFitsInImmedField(V9::STFi, Offset))
|
|
|
|
MI = BuildMI(V9::STFi, 3).addMReg(SrcReg).addMReg(PtrReg).addSImm(Offset);
|
|
|
|
else
|
|
|
|
MI = BuildMI(V9::STFr, 3).addMReg(SrcReg).addMReg(PtrReg).addMReg(OffReg);
|
2001-10-16 01:23:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FPDoubleRegType:
|
2003-07-29 19:53:21 +00:00
|
|
|
if (target.getInstrInfo().constantFitsInImmedField(V9::STDFi, Offset))
|
|
|
|
MI = BuildMI(V9::STDFi,3).addMReg(SrcReg).addMReg(PtrReg).addSImm(Offset);
|
|
|
|
else
|
|
|
|
MI = BuildMI(V9::STDFr,3).addMReg(SrcReg).addMReg(PtrReg).addSImm(OffReg);
|
2001-10-16 01:23:19 +00:00
|
|
|
break;
|
|
|
|
|
2001-11-03 19:59:59 +00:00
|
|
|
case IntCCRegType:
|
2002-07-08 23:23:12 +00:00
|
|
|
assert(scratchReg >= 0 && "Need scratch reg to store %ccr to memory");
|
2002-08-12 21:25:05 +00:00
|
|
|
assert(getRegType(scratchReg) ==IntRegType && "Invalid scratch reg");
|
2003-07-10 19:42:11 +00:00
|
|
|
MI = (BuildMI(V9::RDCCR, 2)
|
|
|
|
.addMReg(getUnifiedRegNum(UltraSparcRegInfo::IntCCRegClassID,
|
|
|
|
SparcIntCCRegClass::ccr))
|
2003-07-06 20:13:59 +00:00
|
|
|
.addMReg(scratchReg, MOTy::Def));
|
2002-07-08 23:23:12 +00:00
|
|
|
mvec.push_back(MI);
|
|
|
|
|
2003-07-29 19:53:21 +00:00
|
|
|
cpReg2MemMI(mvec, scratchReg, PtrReg, Offset, IntRegType);
|
2003-01-15 17:47:49 +00:00
|
|
|
return;
|
2003-07-29 19:53:21 +00:00
|
|
|
|
2003-05-27 00:02:22 +00:00
|
|
|
case FloatCCRegType: {
|
2003-07-29 19:53:21 +00:00
|
|
|
unsigned fsrReg = getUnifiedRegNum(UltraSparcRegInfo::SpecialRegClassID,
|
2003-05-27 00:02:22 +00:00
|
|
|
SparcSpecialRegClass::fsr);
|
2003-07-29 19:53:21 +00:00
|
|
|
if (target.getInstrInfo().constantFitsInImmedField(V9::STXFSRi, Offset))
|
|
|
|
MI=BuildMI(V9::STXFSRi,3).addMReg(fsrReg).addMReg(PtrReg).addSImm(Offset);
|
|
|
|
else
|
|
|
|
MI=BuildMI(V9::STXFSRr,3).addMReg(fsrReg).addMReg(PtrReg).addMReg(OffReg);
|
2002-07-08 23:23:12 +00:00
|
|
|
break;
|
2003-05-27 00:02:22 +00:00
|
|
|
}
|
2001-10-16 01:23:19 +00:00
|
|
|
default:
|
2002-05-19 15:25:51 +00:00
|
|
|
assert(0 && "Unknown RegType in cpReg2MemMI");
|
2001-10-16 01:23:19 +00:00
|
|
|
}
|
2003-01-15 17:47:49 +00:00
|
|
|
mvec.push_back(MI);
|
2001-10-16 01:23:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
2001-10-24 22:05:34 +00:00
|
|
|
// Copy from memory to a reg (i.e., Load) Register number must be the unified
|
2001-10-16 01:23:19 +00:00
|
|
|
// register number
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2002-05-19 15:25:51 +00:00
|
|
|
void
|
2003-05-21 17:59:06 +00:00
|
|
|
UltraSparcRegInfo::cpMem2RegMI(std::vector<MachineInstr*>& mvec,
|
2003-07-29 19:53:21 +00:00
|
|
|
unsigned PtrReg,
|
2002-05-19 15:25:51 +00:00
|
|
|
int Offset,
|
|
|
|
unsigned DestReg,
|
|
|
|
int RegType,
|
2002-07-25 06:08:32 +00:00
|
|
|
int scratchReg) const {
|
2001-10-16 01:23:19 +00:00
|
|
|
MachineInstr * MI = NULL;
|
2003-07-29 19:53:21 +00:00
|
|
|
int OffReg = -1;
|
|
|
|
|
|
|
|
// If the Offset will not fit in the signed-immediate field, find an
|
|
|
|
// unused register to hold the offset value. This takes advantage of
|
|
|
|
// the fact that all the opcodes used below have the same size immed. field.
|
|
|
|
// Use the register allocator, PRA, to find an unused reg. at this MI.
|
|
|
|
//
|
|
|
|
if (RegType != IntCCRegType) // does not use offset below
|
|
|
|
if (! target.getInstrInfo().constantFitsInImmedField(V9::LDXi, Offset)) {
|
|
|
|
#ifdef CAN_FIND_FREE_REGISTER_TRANSPARENTLY
|
|
|
|
RegClass* RC = PRA.getRegClassByID(this->getRegClassIDOfRegType(RegType));
|
|
|
|
OffReg = PRA.getUnusedUniRegAtMI(RC, RegType, MInst, LVSetBef);
|
|
|
|
#else
|
|
|
|
// Default to using register g2 for holding large offsets
|
|
|
|
OffReg = getUnifiedRegNum(UltraSparcRegInfo::IntRegClassID,
|
|
|
|
SparcIntRegClass::g4);
|
|
|
|
#endif
|
|
|
|
assert(OffReg >= 0 && "FIXME: cpReg2MemMI cannot find an unused reg.");
|
|
|
|
mvec.push_back(BuildMI(V9::SETSW, 2).addZImm(Offset).addReg(OffReg));
|
|
|
|
}
|
|
|
|
|
2002-02-04 05:59:25 +00:00
|
|
|
switch (RegType) {
|
2001-10-16 01:23:19 +00:00
|
|
|
case IntRegType:
|
2003-07-29 19:53:21 +00:00
|
|
|
if (target.getInstrInfo().constantFitsInImmedField(V9::LDXi, Offset))
|
|
|
|
MI = BuildMI(V9::LDXi, 3).addMReg(PtrReg).addSImm(Offset).addMReg(DestReg,
|
|
|
|
MOTy::Def);
|
|
|
|
else
|
|
|
|
MI = BuildMI(V9::LDXr, 3).addMReg(PtrReg).addMReg(OffReg).addMReg(DestReg,
|
|
|
|
MOTy::Def);
|
2001-10-16 01:23:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FPSingleRegType:
|
2003-07-29 19:53:21 +00:00
|
|
|
if (target.getInstrInfo().constantFitsInImmedField(V9::LDFi, Offset))
|
|
|
|
MI = BuildMI(V9::LDFi, 3).addMReg(PtrReg).addSImm(Offset).addMReg(DestReg,
|
|
|
|
MOTy::Def);
|
|
|
|
else
|
|
|
|
MI = BuildMI(V9::LDFr, 3).addMReg(PtrReg).addMReg(OffReg).addMReg(DestReg,
|
|
|
|
MOTy::Def);
|
2001-10-16 01:23:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FPDoubleRegType:
|
2003-07-29 19:53:21 +00:00
|
|
|
if (target.getInstrInfo().constantFitsInImmedField(V9::LDDFi, Offset))
|
|
|
|
MI= BuildMI(V9::LDDFi, 3).addMReg(PtrReg).addSImm(Offset).addMReg(DestReg,
|
|
|
|
MOTy::Def);
|
|
|
|
else
|
|
|
|
MI= BuildMI(V9::LDDFr, 3).addMReg(PtrReg).addMReg(OffReg).addMReg(DestReg,
|
|
|
|
MOTy::Def);
|
2001-10-16 01:23:19 +00:00
|
|
|
break;
|
|
|
|
|
2001-11-03 19:59:59 +00:00
|
|
|
case IntCCRegType:
|
2002-07-08 23:23:12 +00:00
|
|
|
assert(scratchReg >= 0 && "Need scratch reg to load %ccr from memory");
|
2002-08-12 21:25:05 +00:00
|
|
|
assert(getRegType(scratchReg) ==IntRegType && "Invalid scratch reg");
|
2003-07-29 19:53:21 +00:00
|
|
|
cpMem2RegMI(mvec, PtrReg, Offset, scratchReg, IntRegType);
|
2003-07-10 19:42:11 +00:00
|
|
|
MI = (BuildMI(V9::WRCCRr, 3)
|
|
|
|
.addMReg(scratchReg)
|
|
|
|
.addMReg(SparcIntRegClass::g0)
|
|
|
|
.addMReg(getUnifiedRegNum(UltraSparcRegInfo::IntCCRegClassID,
|
|
|
|
SparcIntCCRegClass::ccr), MOTy::Def));
|
2002-07-08 23:23:12 +00:00
|
|
|
break;
|
|
|
|
|
2003-05-27 00:02:22 +00:00
|
|
|
case FloatCCRegType: {
|
|
|
|
unsigned fsrRegNum = getUnifiedRegNum(UltraSparcRegInfo::SpecialRegClassID,
|
|
|
|
SparcSpecialRegClass::fsr);
|
2003-07-29 19:53:21 +00:00
|
|
|
if (target.getInstrInfo().constantFitsInImmedField(V9::LDXFSRi, Offset))
|
|
|
|
MI = BuildMI(V9::LDXFSRi, 3).addMReg(PtrReg).addSImm(Offset)
|
|
|
|
.addMReg(fsrRegNum, MOTy::UseAndDef);
|
|
|
|
else
|
|
|
|
MI = BuildMI(V9::LDXFSRr, 3).addMReg(PtrReg).addMReg(OffReg)
|
|
|
|
.addMReg(fsrRegNum, MOTy::UseAndDef);
|
2002-07-08 23:23:12 +00:00
|
|
|
break;
|
2003-05-27 00:02:22 +00:00
|
|
|
}
|
2001-10-16 01:23:19 +00:00
|
|
|
default:
|
2001-11-10 21:20:43 +00:00
|
|
|
assert(0 && "Unknown RegType in cpMem2RegMI");
|
2001-10-16 01:23:19 +00:00
|
|
|
}
|
2003-01-15 17:47:49 +00:00
|
|
|
mvec.push_back(MI);
|
2001-10-16 01:23:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-12 14:45:33 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Generate a copy instruction to copy a value to another. Temporarily
|
|
|
|
// used by PhiElimination code.
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2002-05-19 15:25:51 +00:00
|
|
|
void
|
2003-01-15 17:47:49 +00:00
|
|
|
UltraSparcRegInfo::cpValue2Value(Value *Src, Value *Dest,
|
2003-05-21 17:59:06 +00:00
|
|
|
std::vector<MachineInstr*>& mvec) const {
|
2003-07-25 21:12:15 +00:00
|
|
|
int RegType = getRegTypeForDataType(Src->getType());
|
2001-11-03 17:13:27 +00:00
|
|
|
MachineInstr * MI = NULL;
|
|
|
|
|
2001-11-12 14:45:33 +00:00
|
|
|
switch( RegType ) {
|
|
|
|
case IntRegType:
|
2003-05-27 22:40:34 +00:00
|
|
|
MI = BuildMI(V9::ADDr, 3).addReg(Src).addMReg(getZeroRegNum())
|
2003-05-20 20:32:24 +00:00
|
|
|
.addRegDef(Dest);
|
2001-11-12 14:45:33 +00:00
|
|
|
break;
|
|
|
|
case FPSingleRegType:
|
2003-05-20 20:32:24 +00:00
|
|
|
MI = BuildMI(V9::FMOVS, 2).addReg(Src).addRegDef(Dest);
|
2001-11-12 14:45:33 +00:00
|
|
|
break;
|
|
|
|
case FPDoubleRegType:
|
2003-05-20 20:32:24 +00:00
|
|
|
MI = BuildMI(V9::FMOVD, 2).addReg(Src).addRegDef(Dest);
|
2001-11-12 14:45:33 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(0 && "Unknow RegType in CpValu2Value");
|
|
|
|
}
|
|
|
|
|
2002-10-28 20:10:56 +00:00
|
|
|
mvec.push_back(MI);
|
2001-11-03 17:13:27 +00:00
|
|
|
}
|
2001-10-16 01:23:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2001-09-18 22:52:44 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Print the register assigned to a LR
|
|
|
|
//---------------------------------------------------------------------------
|
2001-09-14 20:31:39 +00:00
|
|
|
|
2003-05-27 00:02:22 +00:00
|
|
|
void UltraSparcRegInfo::printReg(const LiveRange *LR) const {
|
2003-01-15 21:14:32 +00:00
|
|
|
unsigned RegClassID = LR->getRegClassID();
|
2003-05-21 17:59:06 +00:00
|
|
|
std::cerr << " *Node " << (LR->getUserIGNode())->getIndex();
|
2001-09-18 22:52:44 +00:00
|
|
|
|
2002-02-04 05:59:25 +00:00
|
|
|
if (!LR->hasColor()) {
|
2003-05-21 17:59:06 +00:00
|
|
|
std::cerr << " - could not find a color\n";
|
2001-09-18 22:52:44 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if a color is found
|
2001-09-14 20:31:39 +00:00
|
|
|
|
2003-05-21 17:59:06 +00:00
|
|
|
std::cerr << " colored with color "<< LR->getColor();
|
2001-09-14 20:31:39 +00:00
|
|
|
|
2003-05-27 00:02:22 +00:00
|
|
|
unsigned uRegName = getUnifiedRegNum(RegClassID, LR->getColor());
|
|
|
|
|
|
|
|
std::cerr << "[";
|
|
|
|
std::cerr<< getUnifiedRegName(uRegName);
|
|
|
|
if (RegClassID == FloatRegClassID && LR->getType() == Type::DoubleTy)
|
|
|
|
std::cerr << "+" << getUnifiedRegName(uRegName+1);
|
|
|
|
std::cerr << "]\n";
|
2001-09-18 22:52:44 +00:00
|
|
|
}
|