+bool ARMBaseRegisterInfo::
+needsStackRealignment(const MachineFunction &MF) const {
+ // Only do this for ARM if explicitly enabled
+ // FIXME: Once it's passing all the tests, enable by default
+ if (!ARMDynamicStackAlign)
+ return false;
+
+ const MachineFrameInfo *MFI = MF.getFrameInfo();
+ const ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
+ unsigned StackAlign = MF.getTarget().getFrameInfo()->getStackAlignment();
+ return (RealignStack &&
+ !AFI->isThumb1OnlyFunction() &&
+ (MFI->getMaxAlignment() > StackAlign) &&
+ !MFI->hasVarSizedObjects());
+
+}
+