diff options
author | Dan Gohman <gohman@apple.com> | 2008-05-05 00:28:39 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-05-05 00:28:39 +0000 |
commit | a779a9899a5e23bd5198973f4709d66cb4bc2e64 (patch) | |
tree | f42654f8d9d6b2d0310b31500cedd1a0f93e05bb /lib/CodeGen/AsmPrinter.cpp | |
parent | 6625eff8ec38095e9dab31294a86555a489e56a4 (diff) |
Add AsmPrinter support for emitting a directive to declare that
the code being generated does not require an executable stack.
Also, add target-specific code to make use of this on Linux
on x86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50634 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 65b8c436f7..9c4e789251 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -192,6 +192,13 @@ bool AsmPrinter::doFinalization(Module &M) { E = CMM->begin(); I != E; ) (*--I)->finishAssembly(O, *this, *TAI); + // If we don't have any trampolines, then we don't require stack memory + // to be executable. Some targets have a directive to declare this. + Function* InitTrampolineIntrinsic = M.getFunction("llvm.init.trampoline"); + if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->use_empty()) + if (TAI->getNonexecutableStackDirective()) + O << TAI->getNonexecutableStackDirective() << "\n"; + delete Mang; Mang = 0; return false; } |