mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-24 04:45:00 +00:00
Add definitions of 64-bit register files. Add code for returning Mips64's sets of
callee-saved registers and reserved registers. llvm-svn: 140395
This commit is contained in:
parent
b89e54799d
commit
1e2b0369c6
@ -112,24 +112,71 @@ getCalleeSavedRegs(const MachineFunction *MF) const
|
||||
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;
|
||||
else
|
||||
else if (!Subtarget.hasMips64())
|
||||
return Mips32CalleeSavedRegs;
|
||||
else if (Subtarget.isABI_N32())
|
||||
return N32CalleeSavedRegs;
|
||||
|
||||
assert(Subtarget.isABI_N64());
|
||||
return N64CalleeSavedRegs;
|
||||
}
|
||||
|
||||
BitVector MipsRegisterInfo::
|
||||
getReservedRegs(const MachineFunction &MF) const {
|
||||
BitVector Reserved(getNumRegs());
|
||||
Reserved.set(Mips::ZERO);
|
||||
Reserved.set(Mips::AT);
|
||||
Reserved.set(Mips::K0);
|
||||
Reserved.set(Mips::K1);
|
||||
Reserved.set(Mips::GP);
|
||||
Reserved.set(Mips::SP);
|
||||
Reserved.set(Mips::FP);
|
||||
Reserved.set(Mips::RA);
|
||||
static const unsigned ReservedCPURegs[] = {
|
||||
Mips::ZERO, Mips::AT, Mips::K0, Mips::K1,
|
||||
Mips::GP, Mips::SP, Mips::FP, Mips::RA, 0
|
||||
};
|
||||
|
||||
static const unsigned ReservedCPU64Regs[] = {
|
||||
Mips::ZERO_64, Mips::AT_64, Mips::K0_64, Mips::K1_64,
|
||||
Mips::GP_64, Mips::SP_64, Mips::FP_64, Mips::RA_64, 0
|
||||
};
|
||||
|
||||
BitVector Reserved(getNumRegs());
|
||||
typedef TargetRegisterClass::iterator RegIter;
|
||||
|
||||
for (const unsigned *Reg = ReservedCPURegs; *Reg; ++Reg)
|
||||
Reserved.set(*Reg);
|
||||
|
||||
if (Subtarget.hasMips64()) {
|
||||
for (const unsigned *Reg = ReservedCPU64Regs; *Reg; ++Reg)
|
||||
Reserved.set(*Reg);
|
||||
|
||||
// Reserve all registers in AFGR64.
|
||||
for (RegIter Reg = Mips::AFGR64RegisterClass->begin();
|
||||
Reg != Mips::AFGR64RegisterClass->end(); ++Reg)
|
||||
Reserved.set(*Reg);
|
||||
}
|
||||
else {
|
||||
// Reserve all registers in CPU64Regs & FGR64.
|
||||
for (RegIter Reg = Mips::CPU64RegsRegisterClass->begin();
|
||||
Reg != Mips::CPU64RegsRegisterClass->end(); ++Reg)
|
||||
Reserved.set(*Reg);
|
||||
|
||||
for (RegIter Reg = Mips::FGR64RegisterClass->begin();
|
||||
Reg != Mips::FGR64RegisterClass->end(); ++Reg)
|
||||
Reserved.set(*Reg);
|
||||
}
|
||||
|
||||
return Reserved;
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ class HWR<bits<5> num, string n> : MipsReg<n> {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
let Namespace = "Mips" in {
|
||||
// FIXME: Fix DwarfRegNum.
|
||||
|
||||
// General Purpose Registers
|
||||
def ZERO : MipsGPRReg< 0, "ZERO">, DwarfRegNum<[0]>;
|
||||
@ -228,6 +229,11 @@ let Namespace = "Mips" in {
|
||||
def HI : Register<"hi">, DwarfRegNum<[64]>;
|
||||
def LO : Register<"lo">, DwarfRegNum<[65]>;
|
||||
|
||||
let SubRegIndices = [sub_32] in {
|
||||
def HI64 : RegisterWithSubRegs<"hi", [HI]>;
|
||||
def LO64 : RegisterWithSubRegs<"lo", [LO]>;
|
||||
}
|
||||
|
||||
// Status flags register
|
||||
def FCR31 : Register<"31">;
|
||||
|
||||
@ -249,6 +255,18 @@ def CPURegs : RegisterClass<"Mips", [i32], 32, (add
|
||||
// Reserved
|
||||
ZERO, AT, K0, K1, GP, SP, FP, RA)>;
|
||||
|
||||
def CPU64Regs : RegisterClass<"Mips", [i64], 64, (add
|
||||
// Return Values and Arguments
|
||||
V0_64, V1_64, A0_64, A1_64, A2_64, A3_64,
|
||||
// Not preserved across procedure calls
|
||||
T0_64, T1_64, T2_64, T3_64, T4_64, T5_64, T6_64, T7_64, T8_64, T9_64,
|
||||
// Callee save
|
||||
S0_64, S1_64, S2_64, S3_64, S4_64, S5_64, S6_64, S7_64,
|
||||
// Reserved
|
||||
ZERO_64, AT_64, K0_64, K1_64, GP_64, SP_64, FP_64, RA_64)> {
|
||||
let SubRegClasses = [(CPURegs sub_32)];
|
||||
}
|
||||
|
||||
// 64bit fp:
|
||||
// * FGR64 - 32 64-bit registers
|
||||
// * AFGR64 - 16 32-bit even registers (32-bit FP Mode)
|
||||
@ -268,11 +286,18 @@ def AFGR64 : RegisterClass<"Mips", [f64], 64, (add
|
||||
let SubRegClasses = [(FGR32 sub_fpeven, sub_fpodd)];
|
||||
}
|
||||
|
||||
def FGR64 : RegisterClass<"Mips", [f64], 64, (sequence "D%u_64", 0, 31)> {
|
||||
let SubRegClasses = [(FGR32 sub_32)];
|
||||
}
|
||||
|
||||
// Condition Register for floating point operations
|
||||
def CCR : RegisterClass<"Mips", [i32], 32, (add FCR31)>;
|
||||
|
||||
// Hi/Lo Registers
|
||||
def HILO : RegisterClass<"Mips", [i32], 32, (add HI, LO)>;
|
||||
def HILO64 : RegisterClass<"Mips", [i64], 64, (add HI64, LO64)> {
|
||||
let SubRegClasses = [(HILO sub_32)];
|
||||
}
|
||||
|
||||
// Hardware registers
|
||||
def HWRegs : RegisterClass<"Mips", [i32], 32, (add HWR29)>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user