Provide option for enabling-disabling stack realignment

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50156 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov 2008-04-23 18:17:11 +00:00
parent 35410a493b
commit cfcd20e7be

View File

@ -29,6 +29,7 @@
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
@ -38,6 +39,10 @@
#include "llvm/ADT/STLExtras.h"
using namespace llvm;
static cl::opt<bool>
RealignStack("realign-stack", cl::init(true),
cl::desc("Realign stack if needed"));
X86RegisterInfo::X86RegisterInfo(X86TargetMachine &tm,
const TargetInstrInfo &tii)
: X86GenRegisterInfo(X86::ADJCALLSTACKDOWN, X86::ADJCALLSTACKUP),
@ -269,8 +274,9 @@ bool X86RegisterInfo::needsStackRealignment(const MachineFunction &MF) const {
// FIXME: Currently we don't support stack realignment for functions with
// variable-sized allocas
return (MFI->getMaxAlignment() > StackAlign &&
!MFI->hasVarSizedObjects());
return (RealignStack &&
(MFI->getMaxAlignment() > StackAlign &&
!MFI->hasVarSizedObjects()));
}
bool X86RegisterInfo::hasReservedCallFrame(MachineFunction &MF) const {