mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-08 13:00:50 +00:00
Convert PowerPC to register mask operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152122 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e6f1355c38
commit
e46137f498
@ -130,3 +130,34 @@ def CC_PPC_SVR4_ByVal : CallingConv<[
|
||||
CCCustom<"CC_PPC_SVR4_Custom_Dummy">
|
||||
]>;
|
||||
|
||||
def CSR_Darwin32 : CalleeSavedRegs<(add R13, R14, R15, R16, R17, R18, R19, R20,
|
||||
R21, R22, R23, R24, R25, R26, R27, R28,
|
||||
R29, R30, R31, F14, F15, F16, F17, F18,
|
||||
F19, F20, F21, F22, F23, F24, F25, F26,
|
||||
F27, F28, F29, F30, F31, CR2, CR3, CR4,
|
||||
V20, V21, V22, V23, V24, V25, V26, V27,
|
||||
V28, V29, V30, V31)>;
|
||||
|
||||
def CSR_SVR432 : CalleeSavedRegs<(add R14, R15, R16, R17, R18, R19, R20, VRSAVE,
|
||||
R21, R22, R23, R24, R25, R26, R27, R28,
|
||||
R29, R30, R31, F14, F15, F16, F17, F18,
|
||||
F19, F20, F21, F22, F23, F24, F25, F26,
|
||||
F27, F28, F29, F30, F31, CR2, CR3, CR4,
|
||||
V20, V21, V22, V23, V24, V25, V26, V27,
|
||||
V28, V29, V30, V31)>;
|
||||
|
||||
def CSR_Darwin64 : CalleeSavedRegs<(add X13, X14, X15, X16, X17, X18, X19, X20,
|
||||
X21, X22, X23, X24, X25, X26, X27, X28,
|
||||
X29, X30, X31, F14, F15, F16, F17, F18,
|
||||
F19, F20, F21, F22, F23, F24, F25, F26,
|
||||
F27, F28, F29, F30, F31, CR2, CR3, CR4,
|
||||
V20, V21, V22, V23, V24, V25, V26, V27,
|
||||
V28, V29, V30, V31)>;
|
||||
|
||||
def CSR_SVR464 : CalleeSavedRegs<(add X14, X15, X16, X17, X18, X19, X20, VRSAVE,
|
||||
X21, X22, X23, X24, X25, X26, X27, X28,
|
||||
X29, X30, X31, F14, F15, F16, F17, F18,
|
||||
F19, F20, F21, F22, F23, F24, F25, F26,
|
||||
F27, F28, F29, F30, F31, CR2, CR3, CR4,
|
||||
V20, V21, V22, V23, V24, V25, V26, V27,
|
||||
V28, V29, V30, V31)>;
|
||||
|
@ -2769,6 +2769,12 @@ PPCTargetLowering::FinishCall(CallingConv::ID CallConv, DebugLoc dl,
|
||||
(CallConv == CallingConv::Fast &&
|
||||
getTargetMachine().Options.GuaranteedTailCallOpt) ? NumBytes : 0;
|
||||
|
||||
// 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);
|
||||
|
||||
|
@ -64,13 +64,7 @@ let Defs = [LR8] in
|
||||
PPC970_Unit_BRU;
|
||||
|
||||
// Darwin ABI Calls.
|
||||
let isCall = 1, PPC970_Unit = 7,
|
||||
// All calls clobber the PPC64 non-callee saved registers.
|
||||
Defs = [X0,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,
|
||||
F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,
|
||||
V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19,
|
||||
LR8,CTR8,
|
||||
CR0,CR1,CR5,CR6,CR7,CARRY] in {
|
||||
let isCall = 1, PPC970_Unit = 7, Defs = [LR8] in {
|
||||
// Convenient aliases for call instructions
|
||||
let Uses = [RM] in {
|
||||
def BL8_Darwin : IForm<18, 0, 1,
|
||||
@ -90,13 +84,7 @@ let isCall = 1, PPC970_Unit = 7,
|
||||
|
||||
// ELF 64 ABI Calls = Darwin ABI Calls
|
||||
// Used to define BL8_ELF and BLA8_ELF
|
||||
let isCall = 1, PPC970_Unit = 7,
|
||||
// All calls clobber the PPC64 non-callee saved registers.
|
||||
Defs = [X0,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,
|
||||
F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,
|
||||
V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19,
|
||||
LR8,CTR8,
|
||||
CR0,CR1,CR5,CR6,CR7,CARRY] in {
|
||||
let isCall = 1, PPC970_Unit = 7, Defs = [LR8] in {
|
||||
// Convenient aliases for call instructions
|
||||
let Uses = [RM] in {
|
||||
def BL8_ELF : IForm<18, 0, 1,
|
||||
|
@ -438,13 +438,7 @@ let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, PPC970_Unit = 7 in {
|
||||
}
|
||||
|
||||
// Darwin ABI Calls.
|
||||
let isCall = 1, PPC970_Unit = 7,
|
||||
// All calls clobber the non-callee saved registers...
|
||||
Defs = [R0,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,
|
||||
F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,
|
||||
V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19,
|
||||
LR,CTR,
|
||||
CR0,CR1,CR5,CR6,CR7,CARRY] in {
|
||||
let isCall = 1, PPC970_Unit = 7, Defs = [LR] in {
|
||||
// Convenient aliases for call instructions
|
||||
let Uses = [RM] in {
|
||||
def BL_Darwin : IForm<18, 0, 1,
|
||||
@ -463,13 +457,7 @@ let isCall = 1, PPC970_Unit = 7,
|
||||
}
|
||||
|
||||
// SVR4 ABI Calls.
|
||||
let isCall = 1, PPC970_Unit = 7,
|
||||
// All calls clobber the non-callee saved registers...
|
||||
Defs = [R0,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,
|
||||
F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,
|
||||
V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19,
|
||||
LR,CTR,
|
||||
CR0,CR1,CR5,CR6,CR7,CARRY] in {
|
||||
let isCall = 1, PPC970_Unit = 7, Defs = [LR] in {
|
||||
// Convenient aliases for call instructions
|
||||
let Uses = [RM] in {
|
||||
def BL_SVR4 : IForm<18, 0, 1,
|
||||
|
@ -100,104 +100,20 @@ PPCRegisterInfo::getPointerRegClass(unsigned Kind) const {
|
||||
|
||||
const uint16_t*
|
||||
PPCRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
|
||||
// 32-bit Darwin calling convention.
|
||||
static const uint16_t Darwin32_CalleeSavedRegs[] = {
|
||||
PPC::R13, PPC::R14, PPC::R15,
|
||||
PPC::R16, PPC::R17, PPC::R18, PPC::R19,
|
||||
PPC::R20, PPC::R21, PPC::R22, PPC::R23,
|
||||
PPC::R24, PPC::R25, PPC::R26, PPC::R27,
|
||||
PPC::R28, PPC::R29, PPC::R30, PPC::R31,
|
||||
|
||||
PPC::F14, PPC::F15, PPC::F16, PPC::F17,
|
||||
PPC::F18, PPC::F19, PPC::F20, PPC::F21,
|
||||
PPC::F22, PPC::F23, PPC::F24, PPC::F25,
|
||||
PPC::F26, PPC::F27, PPC::F28, PPC::F29,
|
||||
PPC::F30, PPC::F31,
|
||||
|
||||
PPC::CR2, PPC::CR3, PPC::CR4,
|
||||
PPC::V20, PPC::V21, PPC::V22, PPC::V23,
|
||||
PPC::V24, PPC::V25, PPC::V26, PPC::V27,
|
||||
PPC::V28, PPC::V29, PPC::V30, PPC::V31,
|
||||
|
||||
PPC::LR, 0
|
||||
};
|
||||
|
||||
// 32-bit SVR4 calling convention.
|
||||
static const uint16_t SVR4_CalleeSavedRegs[] = {
|
||||
PPC::R14, PPC::R15,
|
||||
PPC::R16, PPC::R17, PPC::R18, PPC::R19,
|
||||
PPC::R20, PPC::R21, PPC::R22, PPC::R23,
|
||||
PPC::R24, PPC::R25, PPC::R26, PPC::R27,
|
||||
PPC::R28, PPC::R29, PPC::R30, PPC::R31,
|
||||
|
||||
PPC::F14, PPC::F15, PPC::F16, PPC::F17,
|
||||
PPC::F18, PPC::F19, PPC::F20, PPC::F21,
|
||||
PPC::F22, PPC::F23, PPC::F24, PPC::F25,
|
||||
PPC::F26, PPC::F27, PPC::F28, PPC::F29,
|
||||
PPC::F30, PPC::F31,
|
||||
|
||||
PPC::CR2, PPC::CR3, PPC::CR4,
|
||||
|
||||
PPC::VRSAVE,
|
||||
|
||||
PPC::V20, PPC::V21, PPC::V22, PPC::V23,
|
||||
PPC::V24, PPC::V25, PPC::V26, PPC::V27,
|
||||
PPC::V28, PPC::V29, PPC::V30, PPC::V31,
|
||||
|
||||
0
|
||||
};
|
||||
// 64-bit Darwin calling convention.
|
||||
static const uint16_t Darwin64_CalleeSavedRegs[] = {
|
||||
PPC::X14, PPC::X15,
|
||||
PPC::X16, PPC::X17, PPC::X18, PPC::X19,
|
||||
PPC::X20, PPC::X21, PPC::X22, PPC::X23,
|
||||
PPC::X24, PPC::X25, PPC::X26, PPC::X27,
|
||||
PPC::X28, PPC::X29, PPC::X30, PPC::X31,
|
||||
|
||||
PPC::F14, PPC::F15, PPC::F16, PPC::F17,
|
||||
PPC::F18, PPC::F19, PPC::F20, PPC::F21,
|
||||
PPC::F22, PPC::F23, PPC::F24, PPC::F25,
|
||||
PPC::F26, PPC::F27, PPC::F28, PPC::F29,
|
||||
PPC::F30, PPC::F31,
|
||||
|
||||
PPC::CR2, PPC::CR3, PPC::CR4,
|
||||
PPC::V20, PPC::V21, PPC::V22, PPC::V23,
|
||||
PPC::V24, PPC::V25, PPC::V26, PPC::V27,
|
||||
PPC::V28, PPC::V29, PPC::V30, PPC::V31,
|
||||
|
||||
PPC::LR8, 0
|
||||
};
|
||||
|
||||
// 64-bit SVR4 calling convention.
|
||||
static const uint16_t SVR4_64_CalleeSavedRegs[] = {
|
||||
PPC::X14, PPC::X15,
|
||||
PPC::X16, PPC::X17, PPC::X18, PPC::X19,
|
||||
PPC::X20, PPC::X21, PPC::X22, PPC::X23,
|
||||
PPC::X24, PPC::X25, PPC::X26, PPC::X27,
|
||||
PPC::X28, PPC::X29, PPC::X30, PPC::X31,
|
||||
|
||||
PPC::F14, PPC::F15, PPC::F16, PPC::F17,
|
||||
PPC::F18, PPC::F19, PPC::F20, PPC::F21,
|
||||
PPC::F22, PPC::F23, PPC::F24, PPC::F25,
|
||||
PPC::F26, PPC::F27, PPC::F28, PPC::F29,
|
||||
PPC::F30, PPC::F31,
|
||||
|
||||
PPC::CR2, PPC::CR3, PPC::CR4,
|
||||
|
||||
PPC::VRSAVE,
|
||||
|
||||
PPC::V20, PPC::V21, PPC::V22, PPC::V23,
|
||||
PPC::V24, PPC::V25, PPC::V26, PPC::V27,
|
||||
PPC::V28, PPC::V29, PPC::V30, PPC::V31,
|
||||
|
||||
0
|
||||
};
|
||||
|
||||
if (Subtarget.isDarwinABI())
|
||||
return Subtarget.isPPC64() ? Darwin64_CalleeSavedRegs :
|
||||
Darwin32_CalleeSavedRegs;
|
||||
return Subtarget.isPPC64() ? CSR_Darwin64_SaveList :
|
||||
CSR_Darwin32_SaveList;
|
||||
|
||||
return Subtarget.isPPC64() ? SVR4_64_CalleeSavedRegs : SVR4_CalleeSavedRegs;
|
||||
return Subtarget.isPPC64() ? CSR_SVR464_SaveList : CSR_SVR432_SaveList;
|
||||
}
|
||||
|
||||
const unsigned*
|
||||
PPCRegisterInfo::getCallPreservedMask(CallingConv::ID CC) const {
|
||||
if (Subtarget.isDarwinABI())
|
||||
return Subtarget.isPPC64() ? CSR_Darwin64_RegMask :
|
||||
CSR_Darwin32_RegMask;
|
||||
|
||||
return Subtarget.isPPC64() ? CSR_SVR464_RegMask : CSR_SVR432_RegMask;
|
||||
}
|
||||
|
||||
BitVector PPCRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
|
||||
/// Code Generation virtual methods...
|
||||
const uint16_t *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
|
||||
const unsigned *getCallPreservedMask(CallingConv::ID CC) const;
|
||||
|
||||
BitVector getReservedRegs(const MachineFunction &MF) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user