i386-protos.h (ix86_split_stack_boundary): New prototype.

* config/i386/i386-protos.h (ix86_split_stack_boundary): New prototype.
	* config/i386/i386.c (ix86_split_stack_boundary): New function.
	(ix86_xpand_split_stack_prologue): Call ix86_split_stack_boundary.
	(ix86_legitimate_address_p) <case UNSPEC_STACK_CHECK>: Remove.
	(i386_asm_output_addr_const_extra) <case UNSPEC_STACK_CHECK>: Ditto.
	(optput_pic_addr_const): Remove UNSPEC_STACK_CHECK handling.
	* config/i386/i386.md (unspec): Remove UNSPEC_STACK_CHECK.
	(split_stack_space_check): Call ix86_split_stack_boundary.

From-SVN: r251031
This commit is contained in:
Uros Bizjak 2017-08-10 20:27:40 +02:00 committed by Uros Bizjak
parent 8197ac2f30
commit 5e4882f90c
4 changed files with 47 additions and 45 deletions

View File

@ -1,3 +1,14 @@
2017-08-10 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386-protos.h (ix86_split_stack_boundary): New prototype.
* config/i386/i386.c (ix86_split_stack_boundary): New function.
(ix86_xpand_split_stack_prologue): Call ix86_split_stack_boundary.
(ix86_legitimate_address_p) <case UNSPEC_STACK_CHECK>: Remove.
(i386_asm_output_addr_const_extra) <case UNSPEC_STACK_CHECK>: Ditto.
(optput_pic_addr_const): Remove UNSPEC_STACK_CHECK handling.
* config/i386/i386.md (unspec): Remove UNSPEC_STACK_CHECK.
(split_stack_space_check): Call ix86_split_stack_boundary.
2017-08-10 Martin Sebor <msebor@redhat.com>
* print-tree.c (print_node): Print location using the established

View File

@ -201,6 +201,8 @@ extern void ix86_expand_truncdf_32 (rtx, rtx);
extern void ix86_expand_vecop_qihi (enum rtx_code, rtx, rtx, rtx);
extern rtx ix86_split_stack_boundary (void);
#ifdef TREE_CODE
extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int);
#endif /* TREE_CODE */

View File

@ -15785,6 +15785,28 @@ static GTY(()) rtx split_stack_fn;
static GTY(()) rtx split_stack_fn_large;
/* */
rtx
ix86_split_stack_boundary (void)
{
int offset;
addr_space_t as = DEFAULT_TLS_SEG_REG;
rtx r;
#ifdef TARGET_THREAD_SPLIT_STACK_OFFSET
offset = TARGET_THREAD_SPLIT_STACK_OFFSET;
#else
gcc_unreachable ();
#endif
r = GEN_INT (offset);
r = gen_const_mem (Pmode, r);
set_mem_addr_space (r, as);
return r;
}
/* Handle -fsplit-stack. These are the first instructions in the
function, even before the regular prologue. */
@ -15816,10 +15838,8 @@ ix86_expand_split_stack_prologue (void)
us SPLIT_STACK_AVAILABLE bytes, so if we need less than that we
can compare directly. Otherwise we need to do an addition. */
limit = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx),
UNSPEC_STACK_CHECK);
limit = gen_rtx_CONST (Pmode, limit);
limit = gen_rtx_MEM (Pmode, limit);
limit = ix86_split_stack_boundary ();
if (allocate < SPLIT_STACK_AVAILABLE)
current = stack_pointer_rtx;
else
@ -16892,10 +16912,6 @@ ix86_legitimate_address_p (machine_mode, rtx addr, bool strict)
case UNSPEC_DTPOFF:
break;
case UNSPEC_STACK_CHECK:
gcc_assert (flag_split_stack);
break;
default:
/* Invalid address unspec. */
return false;
@ -17985,17 +18001,10 @@ output_pic_addr_const (FILE *file, rtx x, int code)
putc (ASSEMBLER_DIALECT == ASM_INTEL ? ')' : ']', file);
break;
case UNSPEC:
if (XINT (x, 1) == UNSPEC_STACK_CHECK)
{
bool f = i386_asm_output_addr_const_extra (file, x);
gcc_assert (f);
break;
}
gcc_assert (XVECLEN (x, 0) == 1);
output_pic_addr_const (file, XVECEXP (x, 0, 0), code);
switch (XINT (x, 1))
case UNSPEC:
gcc_assert (XVECLEN (x, 0) == 1);
output_pic_addr_const (file, XVECEXP (x, 0, 0), code);
switch (XINT (x, 1))
{
case UNSPEC_GOT:
fputs ("@GOT", file);
@ -19691,22 +19700,6 @@ i386_asm_output_addr_const_extra (FILE *file, rtx x)
break;
#endif
case UNSPEC_STACK_CHECK:
{
int offset;
gcc_assert (flag_split_stack);
#ifdef TARGET_THREAD_SPLIT_STACK_OFFSET
offset = TARGET_THREAD_SPLIT_STACK_OFFSET;
#else
gcc_unreachable ();
#endif
fprintf (file, "%s:%d", TARGET_64BIT ? "%fs" : "%gs", offset);
}
break;
default:
return false;
}

View File

@ -86,7 +86,6 @@
UNSPEC_SET_RIP
UNSPEC_SET_GOT_OFFSET
UNSPEC_MEMORY_BLOCKAGE
UNSPEC_STACK_CHECK
UNSPEC_PROBE_STACK
;; TLS support
@ -12630,20 +12629,17 @@
[(set (pc) (if_then_else
(ltu (minus (reg SP_REG)
(match_operand 0 "register_operand"))
(unspec [(const_int 0)] UNSPEC_STACK_CHECK))
(match_dup 2))
(label_ref (match_operand 1))
(pc)))]
""
{
rtx reg, size, limit;
rtx reg = gen_reg_rtx (Pmode);
reg = gen_reg_rtx (Pmode);
size = force_reg (Pmode, operands[0]);
emit_insn (gen_sub3_insn (reg, stack_pointer_rtx, size));
limit = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx),
UNSPEC_STACK_CHECK);
limit = gen_rtx_MEM (Pmode, gen_rtx_CONST (Pmode, limit));
ix86_expand_branch (GEU, reg, limit, operands[1]);
emit_insn (gen_sub3_insn (reg, stack_pointer_rtx, operands[0]));
operands[2] = ix86_split_stack_boundary ();
ix86_expand_branch (GEU, reg, operands[2], operands[1]);
DONE;
})