summaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM/ARMFrameLowering.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2011-10-18 05:28:00 +0000
committerChad Rosier <mcrosier@apple.com>2011-10-18 05:28:00 +0000
commitfe04757f5e06ab15208ac0a2ab8d7e83c62b9f0d (patch)
tree679d85c4d3576a429a1419196494da9ecb339d96 /lib/Target/ARM/ARMFrameLowering.cpp
parent895ede819f0558574fce66cc1eca80eee2deaa4e (diff)
downloadexternal_llvm-fe04757f5e06ab15208ac0a2ab8d7e83c62b9f0d.zip
external_llvm-fe04757f5e06ab15208ac0a2ab8d7e83c62b9f0d.tar.gz
external_llvm-fe04757f5e06ab15208ac0a2ab8d7e83c62b9f0d.tar.bz2
Add support for dynamic stack realignment when in thumb1 mode.
rdar://10288916 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMFrameLowering.cpp')
-rw-r--r--lib/Target/ARM/ARMFrameLowering.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Target/ARM/ARMFrameLowering.cpp b/lib/Target/ARM/ARMFrameLowering.cpp
index 2d1de6f..4bac6c5 100644
--- a/lib/Target/ARM/ARMFrameLowering.cpp
+++ b/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);
}