+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
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. */
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
case UNSPEC_DTPOFF:
break;
- case UNSPEC_STACK_CHECK:
- gcc_assert (flag_split_stack);
- break;
-
default:
/* Invalid address unspec. */
return false;
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);
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;
}
UNSPEC_SET_RIP
UNSPEC_SET_GOT_OFFSET
UNSPEC_MEMORY_BLOCKAGE
- UNSPEC_STACK_CHECK
UNSPEC_PROBE_STACK
;; TLS support
[(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;
})