summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2016-05-13 19:16:14 +0000
committerTim Northover <tnorthover@apple.com>2016-05-13 19:16:14 +0000
commitf8b0a7af52f8c4ec6b4ddcfe3a6fa75098c9507c (patch)
tree2219a9d046854c8652752a7a5734652c31b13ebf /llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
parent0f791f44c72bc5b52dfb31bcf6b6fe4f411d5fd2 (diff)
downloadbcm5719-llvm-f8b0a7af52f8c4ec6b4ddcfe3a6fa75098c9507c.tar.gz
bcm5719-llvm-f8b0a7af52f8c4ec6b4ddcfe3a6fa75098c9507c.zip
ARM: use callee-saved list in the order they're actually saved.
When setting the frame pointer, the offset from SP is calculated based on the stack slot it gets allocated, but this slot is in turn based on the order of the CSR list so that list should match the order we actually save the registers in. Mostly it did, but in the edge-case of MachO AAPCS targets it was wrong. llvm-svn: 269459
Diffstat (limited to 'llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp b/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
index a93da9e98da..a873b2b26a4 100644
--- a/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
@@ -60,8 +60,11 @@ static unsigned getFramePointerReg(const ARMSubtarget &STI) {
const MCPhysReg*
ARMBaseRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
const ARMSubtarget &STI = MF->getSubtarget<ARMSubtarget>();
+ bool UseSplitPush = STI.splitFramePushPop();
const MCPhysReg *RegList =
- STI.isTargetDarwin() ? CSR_iOS_SaveList : CSR_AAPCS_SaveList;
+ STI.isTargetDarwin()
+ ? CSR_iOS_SaveList
+ : (UseSplitPush ? CSR_AAPCS_SplitPush_SaveList : CSR_AAPCS_SaveList);
const Function *F = MF->getFunction();
if (F->getCallingConv() == CallingConv::GHC) {
@@ -72,7 +75,7 @@ ARMBaseRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
if (STI.isMClass()) {
// M-class CPUs have hardware which saves the registers needed to allow a
// function conforming to the AAPCS to function as a handler.
- return CSR_AAPCS_SaveList;
+ return UseSplitPush ? CSR_AAPCS_SplitPush_SaveList : CSR_AAPCS_SaveList;
} else if (F->getFnAttribute("interrupt").getValueAsString() == "FIQ") {
// Fast interrupt mode gives the handler a private copy of R8-R14, so less
// need to be saved to restore user-mode state.
OpenPOWER on IntegriCloud