diff options
| author | Akira Hatanaka <ahatanaka@apple.com> | 2015-09-11 18:54:38 +0000 |
|---|---|---|
| committer | Akira Hatanaka <ahatanaka@apple.com> | 2015-09-11 18:54:38 +0000 |
| commit | bc497c93f5182757dc220b7bea5bd9801a47138b (patch) | |
| tree | e5f99720b31fc40c71de9456539f24225bfeb543 /llvm/lib/CodeGen | |
| parent | 660195a7925bf42b556239deda2883326a0f376b (diff) | |
| download | bcm5719-llvm-bc497c93f5182757dc220b7bea5bd9801a47138b.tar.gz bcm5719-llvm-bc497c93f5182757dc220b7bea5bd9801a47138b.zip | |
Use function attribute "stackrealign" to decide whether stack
realignment should be forced.
With this commit, we can now force stack realignment when doing LTO and
do so on a per-function basis. Also, add a new cl::opt option
"stackrealign" to CommandFlags.h which is used to force stack
realignment via llc's command line.
Out-of-tree projects currently using -force-align-stack to force stack
realignment should make changes to attach the attribute to the functions
in the IR.
Differential Revision: http://reviews.llvm.org/D11814
llvm-svn: 247450
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/TargetRegisterInfo.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/TargetRegisterInfo.cpp b/llvm/lib/CodeGen/TargetRegisterInfo.cpp index 12e9e8cf1b6..2532eaf2ca0 100644 --- a/llvm/lib/CodeGen/TargetRegisterInfo.cpp +++ b/llvm/lib/CodeGen/TargetRegisterInfo.cpp @@ -24,14 +24,6 @@ #define DEBUG_TYPE "target-reg-info" -namespace llvm { -cl::opt<bool> - ForceStackAlign("force-align-stack", - cl::desc("Force align the stack to the minimum alignment" - " needed for the function."), - cl::init(false), cl::Hidden); -} // end namespace llvm - using namespace llvm; TargetRegisterInfo::TargetRegisterInfo(const TargetRegisterInfoDesc *ID, @@ -321,7 +313,7 @@ bool TargetRegisterInfo::needsStackRealignment( unsigned StackAlign = TFI->getStackAlignment(); bool requiresRealignment = ((MFI->getMaxAlignment() > StackAlign) || F->hasFnAttribute(Attribute::StackAlignment)); - if (ForceStackAlign || requiresRealignment) { + if (MF.getFunction()->hasFnAttribute("stackrealign") || requiresRealignment) { if (canRealignStack(MF)) return true; DEBUG(dbgs() << "Can't realign function's stack: " << F->getName() << "\n"); |

