forked from OSchip/llvm-project
Changes for migrating to using register mask operands.
llvm-svn: 151847
This commit is contained in:
parent
28a7a1198b
commit
5350c24509
|
@ -145,13 +145,6 @@ def BGTZ64 : CBranchZero<0x07, 0, "bgtz", setgt, CPU64Regs>;
|
|||
def BLEZ64 : CBranchZero<0x07, 0, "blez", setle, CPU64Regs>;
|
||||
def BLTZ64 : CBranchZero<0x01, 0, "bltz", setlt, CPU64Regs>;
|
||||
|
||||
// NOTE: These registers are N64's temporary registers. N32 has a different
|
||||
// set of temporary registers.
|
||||
let Defs = [AT_64, V0_64, V1_64, A0_64, A1_64, A2_64, A3_64, T0_64, T1_64,
|
||||
T2_64, T3_64, T4_64, T5_64, T6_64, T7_64, T8_64, T9_64, K0_64,
|
||||
K1_64, D0_64, D1_64, D2_64, D3_64, D4_64, D5_64, D6_64, D7_64,
|
||||
D8_64, D9_64, D10_64, D11_64, D12_64, D13_64, D14_64, D15_64,
|
||||
D16_64, D17_64, D18_64, D19_64, D20_64, D21_64, D22_64, D23_64] in
|
||||
def JALR64 : JumpLinkReg<0x00, 0x09, "jalr", CPU64Regs>;
|
||||
|
||||
/// Multiply and Divide Instructions.
|
||||
|
|
|
@ -160,3 +160,20 @@ def RetCC_Mips : CallingConv<[
|
|||
CCIfSubtarget<"isABI_N64()", CCDelegateTo<RetCC_MipsN>>,
|
||||
CCDelegateTo<RetCC_MipsO32>
|
||||
]>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Callee-saved register lists.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def CSR_SingleFloatOnly : CalleeSavedRegs<(add (sequence "F%u", 31, 20), RA, FP,
|
||||
(sequence "S%u", 7, 0))>;
|
||||
|
||||
def CSR_O32 : CalleeSavedRegs<(add (sequence "D%u", 15, 10), RA, FP,
|
||||
(sequence "S%u", 7, 0))>;
|
||||
|
||||
def CSR_N32 : CalleeSavedRegs<(add D31_64, D29_64, D27_64, D25_64, D24_64,
|
||||
D23_64, D22_64, D21_64, RA_64, FP_64, GP_64,
|
||||
(sequence "S%u_64", 7, 0))>;
|
||||
|
||||
def CSR_N64 : CalleeSavedRegs<(add (sequence "D%u_64", 31, 24), RA_64, FP_64,
|
||||
GP_64, (sequence "S%u_64", 7, 0))>;
|
||||
|
|
|
@ -2455,6 +2455,12 @@ MipsTargetLowering::LowerCall(SDValue InChain, SDValue Callee,
|
|||
Ops.push_back(DAG.getRegister(RegsToPass[i].first,
|
||||
RegsToPass[i].second.getValueType()));
|
||||
|
||||
// Add a register mask operand representing the call-preserved registers.
|
||||
const TargetRegisterInfo *TRI = getTargetMachine().getRegisterInfo();
|
||||
const uint32_t *Mask = TRI->getCallPreservedMask(CallConv);
|
||||
assert(Mask && "Missing call preserved mask for calling convention");
|
||||
Ops.push_back(DAG.getRegisterMask(Mask));
|
||||
|
||||
if (InFlag.getNode())
|
||||
Ops.push_back(InFlag);
|
||||
|
||||
|
|
|
@ -886,14 +886,10 @@ def BGTZ : CBranchZero<0x07, 0, "bgtz", setgt, CPURegs>;
|
|||
def BLEZ : CBranchZero<0x06, 0, "blez", setle, CPURegs>;
|
||||
def BLTZ : CBranchZero<0x01, 0, "bltz", setlt, CPURegs>;
|
||||
|
||||
// All calls clobber the non-callee saved registers...
|
||||
let Defs = [AT, V0, V1, A0, A1, A2, A3, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9,
|
||||
K0, K1, GP, D0, D1, D2, D3, D4, D5, D6, D7, D8, D9] in {
|
||||
def JAL : JumpLink<0x03, "jal">;
|
||||
def JALR : JumpLinkReg<0x00, 0x09, "jalr", CPURegs>;
|
||||
def BGEZAL : BranchLink<"bgezal", 0x11, CPURegs>;
|
||||
def BLTZAL : BranchLink<"bltzal", 0x10, CPURegs>;
|
||||
}
|
||||
def JAL : JumpLink<0x03, "jal">;
|
||||
def JALR : JumpLinkReg<0x00, 0x09, "jalr", CPURegs>;
|
||||
def BGEZAL : BranchLink<"bgezal", 0x11, CPURegs>;
|
||||
def BLTZAL : BranchLink<"bltzal", 0x10, CPURegs>;
|
||||
|
||||
let isReturn=1, isTerminator=1, hasDelaySlot=1,
|
||||
isBarrier=1, hasCtrlDep=1, rd=0, rt=0, shamt=0 in
|
||||
|
|
|
@ -56,45 +56,29 @@ unsigned MipsRegisterInfo::getPICCallReg() { return Mips::T9; }
|
|||
const unsigned* MipsRegisterInfo::
|
||||
getCalleeSavedRegs(const MachineFunction *MF) const
|
||||
{
|
||||
// Mips callee-save register range is $16-$23, $f20-$f30
|
||||
static const unsigned SingleFloatOnlyCalleeSavedRegs[] = {
|
||||
Mips::F31, Mips::F30, Mips::F29, Mips::F28, Mips::F27, Mips::F26,
|
||||
Mips::F25, Mips::F24, Mips::F23, Mips::F22, Mips::F21, Mips::F20,
|
||||
Mips::RA, Mips::FP, Mips::S7, Mips::S6, Mips::S5, Mips::S4,
|
||||
Mips::S3, Mips::S2, Mips::S1, Mips::S0, 0
|
||||
};
|
||||
|
||||
static const unsigned Mips32CalleeSavedRegs[] = {
|
||||
Mips::D15, Mips::D14, Mips::D13, Mips::D12, Mips::D11, Mips::D10,
|
||||
Mips::RA, Mips::FP, Mips::S7, Mips::S6, Mips::S5, Mips::S4,
|
||||
Mips::S3, Mips::S2, Mips::S1, Mips::S0, 0
|
||||
};
|
||||
|
||||
static const unsigned N32CalleeSavedRegs[] = {
|
||||
Mips::D31_64, Mips::D29_64, Mips::D27_64, Mips::D25_64, Mips::D23_64,
|
||||
Mips::D21_64,
|
||||
Mips::RA_64, Mips::FP_64, Mips::GP_64, Mips::S7_64, Mips::S6_64,
|
||||
Mips::S5_64, Mips::S4_64, Mips::S3_64, Mips::S2_64, Mips::S1_64,
|
||||
Mips::S0_64, 0
|
||||
};
|
||||
|
||||
static const unsigned N64CalleeSavedRegs[] = {
|
||||
Mips::D31_64, Mips::D30_64, Mips::D29_64, Mips::D28_64, Mips::D27_64,
|
||||
Mips::D26_64, Mips::D25_64, Mips::D24_64,
|
||||
Mips::RA_64, Mips::FP_64, Mips::GP_64, Mips::S7_64, Mips::S6_64,
|
||||
Mips::S5_64, Mips::S4_64, Mips::S3_64, Mips::S2_64, Mips::S1_64,
|
||||
Mips::S0_64, 0
|
||||
};
|
||||
|
||||
if (Subtarget.isSingleFloat())
|
||||
return SingleFloatOnlyCalleeSavedRegs;
|
||||
return CSR_SingleFloatOnly_SaveList;
|
||||
else if (!Subtarget.hasMips64())
|
||||
return Mips32CalleeSavedRegs;
|
||||
return CSR_O32_SaveList;
|
||||
else if (Subtarget.isABI_N32())
|
||||
return N32CalleeSavedRegs;
|
||||
return CSR_N32_SaveList;
|
||||
|
||||
assert(Subtarget.isABI_N64());
|
||||
return CSR_N64_SaveList;
|
||||
}
|
||||
|
||||
const uint32_t*
|
||||
MipsRegisterInfo::getCallPreservedMask(CallingConv::ID) const
|
||||
{
|
||||
if (Subtarget.isSingleFloat())
|
||||
return CSR_SingleFloatOnly_RegMask;
|
||||
else if (!Subtarget.hasMips64())
|
||||
return CSR_O32_RegMask;
|
||||
else if (Subtarget.isABI_N32())
|
||||
return CSR_N32_RegMask;
|
||||
|
||||
assert(Subtarget.isABI_N64());
|
||||
return N64CalleeSavedRegs;
|
||||
return CSR_N64_RegMask;
|
||||
}
|
||||
|
||||
BitVector MipsRegisterInfo::
|
||||
|
|
|
@ -43,6 +43,7 @@ struct MipsRegisterInfo : public MipsGenRegisterInfo {
|
|||
|
||||
/// Code Generation virtual methods...
|
||||
const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
|
||||
const uint32_t *getCallPreservedMask(CallingConv::ID) const;
|
||||
|
||||
BitVector getReservedRegs(const MachineFunction &MF) const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue