aboutsummaryrefslogtreecommitdiffstats
path: root/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
commit52490411259ccc34b8c59f3532e78442a46fffd7 (patch)
tree5f5869382a763dcf72f2d4e10a5d21d14f2159b5 /lib/Target/ARM/ARMFrameLowering.cpp
parentb2ab2fa524f3f90376639037bd81924483cca0af (diff)
downloadexternal_llvm-52490411259ccc34b8c59f3532e78442a46fffd7.zip
external_llvm-52490411259ccc34b8c59f3532e78442a46fffd7.tar.gz
external_llvm-52490411259ccc34b8c59f3532e78442a46fffd7.tar.bz2
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140924 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);
}