[llvm] r356123 - [RISCV][NFC] Rename callee saved regs 'CSR' to CSR_ILP32_LP64 and minor RISCVRegisterInfo refactoring
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 01:28:48 PDT 2019
Author: asb
Date: Thu Mar 14 01:28:48 2019
New Revision: 356123
URL: http://llvm.org/viewvc/llvm-project?rev=356123&view=rev
Log:
[RISCV][NFC] Rename callee saved regs 'CSR' to CSR_ILP32_LP64 and minor RISCVRegisterInfo refactoring
The CSR renaming further prepares the way for an upcoming patch adding support for more
RISC-V ABIs.
Modify RISCVRegisterInfo::getCalleeSavedRegs and
RISCVRegisterInfo::getReservedRegs to do MF->getSubtarget<RISCVSubtarget>()
once rather than multiple times.
Modified:
llvm/trunk/lib/Target/RISCV/RISCVCallingConv.td
llvm/trunk/lib/Target/RISCV/RISCVRegisterInfo.cpp
Modified: llvm/trunk/lib/Target/RISCV/RISCVCallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/RISCV/RISCVCallingConv.td?rev=356123&r1=356122&r2=356123&view=diff
==============================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVCallingConv.td (original)
+++ llvm/trunk/lib/Target/RISCV/RISCVCallingConv.td Thu Mar 14 01:28:48 2019
@@ -13,7 +13,8 @@
// The RISC-V calling convention is handled with custom code in
// RISCVISelLowering.cpp (CC_RISCV).
-def CSR : CalleeSavedRegs<(add X1, X3, X4, X8, X9, (sequence "X%u", 18, 27))>;
+def CSR_ILP32_LP64
+ : CalleeSavedRegs<(add X1, X3, X4, X8, X9, (sequence "X%u", 18, 27))>;
// Needed for implementation of RISCVRegisterInfo::getNoPreservedMask()
def CSR_NoRegs : CalleeSavedRegs<(add)>;
Modified: llvm/trunk/lib/Target/RISCV/RISCVRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/RISCV/RISCVRegisterInfo.cpp?rev=356123&r1=356122&r2=356123&view=diff
==============================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/RISCV/RISCVRegisterInfo.cpp Thu Mar 14 01:28:48 2019
@@ -32,14 +32,15 @@ RISCVRegisterInfo::RISCVRegisterInfo(uns
const MCPhysReg *
RISCVRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
+ auto &Subtarget = MF->getSubtarget<RISCVSubtarget>();
if (MF->getFunction().hasFnAttribute("interrupt")) {
- if (MF->getSubtarget<RISCVSubtarget>().hasStdExtD())
+ if (Subtarget.hasStdExtD())
return CSR_XLEN_F64_Interrupt_SaveList;
- if (MF->getSubtarget<RISCVSubtarget>().hasStdExtF())
+ if (Subtarget..hasStdExtF())
return CSR_XLEN_F32_Interrupt_SaveList;
return CSR_Interrupt_SaveList;
}
- return CSR_SaveList;
+ return CSR_ILP32_LP64_SaveList;
}
BitVector RISCVRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
@@ -118,12 +119,13 @@ unsigned RISCVRegisterInfo::getFrameRegi
const uint32_t *
RISCVRegisterInfo::getCallPreservedMask(const MachineFunction & MF,
CallingConv::ID /*CC*/) const {
+ auto &Subtarget = MF->getSubtarget<RISCVSubtarget>();
if (MF.getFunction().hasFnAttribute("interrupt")) {
- if (MF.getSubtarget<RISCVSubtarget>().hasStdExtD())
+ if (Subtarget.hasStdExtD())
return CSR_XLEN_F64_Interrupt_RegMask;
- if (MF.getSubtarget<RISCVSubtarget>().hasStdExtF())
+ if (Subtarget.hasStdExtF())
return CSR_XLEN_F32_Interrupt_RegMask;
return CSR_Interrupt_RegMask;
}
- return CSR_RegMask;
+ return CSR_ILP32_LP64_RegMask;
}
More information about the llvm-commits
mailing list