summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-09-08 17:22:12 +0000
committerJim Grosbach <grosbach@apple.com>2010-09-08 17:22:12 +0000
commit7dfca6fb51787903be9539949e2637a52a592f78 (patch)
tree8a81f96dc7a0b67e9d8a82bdfefbd0455cd55308 /llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
parent53aa5e31e10a345fd9ccf20d19ddbf1006d2c799 (diff)
downloadbcm5719-llvm-7dfca6fb51787903be9539949e2637a52a592f78.tar.gz
bcm5719-llvm-7dfca6fb51787903be9539949e2637a52a592f78.zip
Be more careful about when to do dynamic stack realignment. Since we have an
option to disable base pointer usage, pay attention to it when deciding if we can realign (if no base pointer and VLAs, we can't). llvm-svn: 113366
Diffstat (limited to 'llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp b/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
index b153b68eb9b..7b4086875cc 100644
--- a/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
@@ -667,8 +667,14 @@ bool ARMBaseRegisterInfo::hasBasePointer(const MachineFunction &MF) const {
}
bool ARMBaseRegisterInfo::canRealignStack(const MachineFunction &MF) const {
+ const MachineFrameInfo *MFI = MF.getFrameInfo();
const ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
- return (RealignStack && !AFI->isThumb1OnlyFunction());
+ // We can't realign the stack if:
+ // 1. Dynamic stack realignment is explicitly disabled,
+ // 2. This is a Thumb1 function (it's not useful, so we don't bother), or
+ // 3. There are VLAs in the function and the base pointer is disabled.
+ return (RealignStack && !AFI->isThumb1OnlyFunction() &&
+ (!MFI->hasVarSizedObjects() || EnableBasePointer));
}
bool ARMBaseRegisterInfo::
@@ -1890,7 +1896,8 @@ emitPrologue(MachineFunction &MF) const {
AFI->setGPRCalleeSavedArea2Size(GPRCS2Size);
AFI->setDPRCalleeSavedAreaSize(DPRCSSize);
- // If we need dynamic stack realignment, do it here.
+ // If we need dynamic stack realignment, do it here. Be paranoid and make
+ // sure if we also have VLAs, we have a base pointer for frame access.
if (needsStackRealignment(MF)) {
unsigned MaxAlign = MFI->getMaxAlignment();
assert (!AFI->isThumb1OnlyFunction());
OpenPOWER on IntegriCloud