summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-08-30 19:39:58 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-08-30 19:39:58 +0000
commit76927d758657b3a511c73467ec5a7288795c1513 (patch)
treedb44df7735985e459f5d1cd47bd84dfba4d9f079 /lib/CodeGen/PrologEpilogInserter.cpp
parent0f9827cd9417c7385c92fa4a0d8d8b4242b3729d (diff)
downloadllvm-76927d758657b3a511c73467ec5a7288795c1513.tar.gz
llvm-76927d758657b3a511c73467ec5a7288795c1513.tar.bz2
llvm-76927d758657b3a511c73467ec5a7288795c1513.tar.xz
Emit segmented-stack specific code into function prologues for
X86. Modify the pass added in the previous patch to call this new code. This new prologues generated will call a libgcc routine (__morestack) to allocate more stack space from the heap when required Patch by Sanjoy Das. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138812 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--lib/CodeGen/PrologEpilogInserter.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp
index 7e5d804f91..ec5fe25704 100644
--- a/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/lib/CodeGen/PrologEpilogInserter.cpp
@@ -29,6 +29,7 @@
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetInstrInfo.h"
@@ -699,6 +700,13 @@ void PEI::insertPrologEpilogCode(MachineFunction &Fn) {
if (!I->empty() && I->back().getDesc().isReturn())
TFI.emitEpilogue(Fn, *I);
}
+
+ // Emit additional code that is required support segmented stacks, if we've
+ // been asked for it. This, when linked with a runtime with support for
+ // segmented stacks (libgcc is one), will result allocating stack space in
+ // small chunks instead of one large contiguous block.
+ if (EnableSegmentedStacks)
+ TFI.adjustForSegmentedStacks(Fn);
}
/// replaceFrameIndices - Replace all MO_FrameIndex operands with physical