summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMFrameLowering.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2011-10-01 02:03:18 +0000
committerChad Rosier <mcrosier@apple.com>2011-10-01 02:03:18 +0000
commit21360a4949b92dd45df822f97fc796d1081f57f8 (patch)
tree13df119f576e6d8c288b2363758b5fc3d2500fd1 /llvm/lib/Target/ARM/ARMFrameLowering.cpp
parentd74713b18c02a924c144910b275681cb7591923d (diff)
downloadbcm5719-llvm-21360a4949b92dd45df822f97fc796d1081f57f8.tar.gz
bcm5719-llvm-21360a4949b92dd45df822f97fc796d1081f57f8.zip
Attempt to fix dynamic stack realignment for thumb1 functions. It is in fact
useful if an optimization assumes the stack has been realigned. Credit to Eli for his assistance. rdar://10043857 llvm-svn: 140924
Diffstat (limited to 'llvm/lib/Target/ARM/ARMFrameLowering.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMFrameLowering.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMFrameLowering.cpp b/llvm/lib/Target/ARM/ARMFrameLowering.cpp
index 2d1de6fe8e9..4bac6c5fa95 100644
--- a/llvm/lib/Target/ARM/ARMFrameLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMFrameLowering.cpp
@@ -881,10 +881,12 @@ ARMFrameLowering::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
// for sure what the stack size will be, but for this, an estimate is good
// enough. If there anything changes it, it'll be a spill, which implies
// we've used all the registers and so R4 is already used, so not marking
- // it here will be OK.
+ // it here will be OK. Also spill R4 if Thumb1 function requires stack
+ // realignment.
// FIXME: It will be better just to find spare register here.
unsigned StackSize = estimateStackSize(MF);
- if (MFI->hasVarSizedObjects() || StackSize > 508)
+ if (MFI->hasVarSizedObjects() || RegInfo->needsStackRealignment(MF) ||
+ StackSize > 508)
MF.getRegInfo().setPhysRegUsed(ARM::R4);
}
OpenPOWER on IntegriCloud