aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/X86InstrCompiler.td
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-08-30 19:43:21 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-08-30 19:43:21 +0000
commitd07b7ec77203d4dbaf426786912a700cc07f0142 (patch)
tree39d91f803cea838c0191717492055699695fb3d1 /lib/Target/X86/X86InstrCompiler.td
parent76927d758657b3a511c73467ec5a7288795c1513 (diff)
downloadexternal_llvm-d07b7ec77203d4dbaf426786912a700cc07f0142.zip
external_llvm-d07b7ec77203d4dbaf426786912a700cc07f0142.tar.gz
external_llvm-d07b7ec77203d4dbaf426786912a700cc07f0142.tar.bz2
Adds a SelectionDAG node X86SegAlloca which will be custom lowered
from DYNAMIC_STACKALLOC. Two new pseudo instructions (SEG_ALLOCA_32 and SEG_ALLOCA_64) which will match X86SegAlloca (based on word size) are also added. They will be custom emitted to inject the actual stack handling code. Patch by Sanjoy Das. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138814 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86InstrCompiler.td')
-rw-r--r--lib/Target/X86/X86InstrCompiler.td20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Target/X86/X86InstrCompiler.td b/lib/Target/X86/X86InstrCompiler.td
index 829ea27..9b39bdc 100644
--- a/lib/Target/X86/X86InstrCompiler.td
+++ b/lib/Target/X86/X86InstrCompiler.td
@@ -106,6 +106,26 @@ let Defs = [EAX, ESP, EFLAGS], Uses = [ESP] in
def WIN_ALLOCA : I<0, Pseudo, (outs), (ins),
"# dynamic stack allocation",
[(X86WinAlloca)]>;
+
+// When using segmented stacks these are lowered into instructions which first
+// check if the current stacklet has enough free memory. If it does, memory is
+// allocated by bumping the stack pointer. Otherwise memory is allocated from
+// the heap.
+
+let Defs = [EAX, ESP, EFLAGS], Uses = [ESP, EAX] in
+def SEG_ALLOCA_32 : I<0, Pseudo, (outs GR32:$dst), (ins GR32:$size),
+ "# variable sized alloca for segmented stacks",
+ [(set GR32:$dst,
+ (X86SegAlloca GR32:$size))]>,
+ Requires<[In32BitMode]>;
+
+let Defs = [RAX, RSP, EFLAGS], Uses = [RSP, RAX] in
+def SEG_ALLOCA_64 : I<0, Pseudo, (outs GR64:$dst), (ins GR64:$size),
+ "# variable sized alloca for segmented stacks",
+ [(set GR64:$dst,
+ (X86SegAlloca GR64:$size))]>,
+ Requires<[In64BitMode]>;
+
}