mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-02 13:21:43 +00:00
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
This commit is contained in:
parent
76927d7586
commit
d07b7ec772
@ -10636,6 +10636,7 @@ const char *X86TargetLowering::getTargetNodeName(unsigned Opcode) const {
|
|||||||
case X86ISD::VAARG_64: return "X86ISD::VAARG_64";
|
case X86ISD::VAARG_64: return "X86ISD::VAARG_64";
|
||||||
case X86ISD::WIN_ALLOCA: return "X86ISD::WIN_ALLOCA";
|
case X86ISD::WIN_ALLOCA: return "X86ISD::WIN_ALLOCA";
|
||||||
case X86ISD::MEMBARRIER: return "X86ISD::MEMBARRIER";
|
case X86ISD::MEMBARRIER: return "X86ISD::MEMBARRIER";
|
||||||
|
case X86ISD::SEG_ALLOCA: return "X86ISD::SEG_ALLOCA";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,6 +286,11 @@ namespace llvm {
|
|||||||
// WIN_ALLOCA - Windows's _chkstk call to do stack probing.
|
// WIN_ALLOCA - Windows's _chkstk call to do stack probing.
|
||||||
WIN_ALLOCA,
|
WIN_ALLOCA,
|
||||||
|
|
||||||
|
// SEG_ALLOCA - For allocating variable amounts of stack space when using
|
||||||
|
// segmented stacks. Check if the current stacklet has enough space, and
|
||||||
|
// defects to heap allocation if not.
|
||||||
|
SEG_ALLOCA,
|
||||||
|
|
||||||
// Memory barrier
|
// Memory barrier
|
||||||
MEMBARRIER,
|
MEMBARRIER,
|
||||||
MFENCE,
|
MFENCE,
|
||||||
|
@ -106,6 +106,26 @@ let Defs = [EAX, ESP, EFLAGS], Uses = [ESP] in
|
|||||||
def WIN_ALLOCA : I<0, Pseudo, (outs), (ins),
|
def WIN_ALLOCA : I<0, Pseudo, (outs), (ins),
|
||||||
"# dynamic stack allocation",
|
"# dynamic stack allocation",
|
||||||
[(X86WinAlloca)]>;
|
[(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]>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,6 +97,8 @@ def SDT_X86TLSADDR : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
|
|||||||
|
|
||||||
def SDT_X86TLSCALL : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
|
def SDT_X86TLSCALL : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
|
||||||
|
|
||||||
|
def SDT_X86SEG_ALLOCA : SDTypeProfile<1, 1, [SDTCisVT<0, iPTR>, SDTCisVT<1, iPTR>]>;
|
||||||
|
|
||||||
def SDT_X86EHRET : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
|
def SDT_X86EHRET : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
|
||||||
|
|
||||||
def SDT_X86TCRET : SDTypeProfile<0, 2, [SDTCisPtrTy<0>, SDTCisVT<1, i32>]>;
|
def SDT_X86TCRET : SDTypeProfile<0, 2, [SDTCisPtrTy<0>, SDTCisVT<1, i32>]>;
|
||||||
@ -228,6 +230,9 @@ def X86mul_imm : SDNode<"X86ISD::MUL_IMM", SDTIntBinOp>;
|
|||||||
def X86WinAlloca : SDNode<"X86ISD::WIN_ALLOCA", SDTX86Void,
|
def X86WinAlloca : SDNode<"X86ISD::WIN_ALLOCA", SDTX86Void,
|
||||||
[SDNPHasChain, SDNPInGlue, SDNPOutGlue]>;
|
[SDNPHasChain, SDNPInGlue, SDNPOutGlue]>;
|
||||||
|
|
||||||
|
def X86SegAlloca : SDNode<"X86ISD::SEG_ALLOCA", SDT_X86SEG_ALLOCA,
|
||||||
|
[SDNPHasChain]>;
|
||||||
|
|
||||||
def X86TLSCall : SDNode<"X86ISD::TLSCALL", SDT_X86TLSCALL,
|
def X86TLSCall : SDNode<"X86ISD::TLSCALL", SDT_X86TLSCALL,
|
||||||
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
|
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user