Commit 7b84aac0 by Eric Botcazou Committed by Eric Botcazou

md.texi (Standard Names): Document probe_stack_address.

	* doc/md.texi (Standard Names): Document probe_stack_address.
	* explow.c (emit_stack_probe): Handle probe_stack_address.
	* config/ia64/ia64.md (UNSPECV_PROBE_STACK_ADDRESS): New constant.
	(UNSPECV_PROBE_STACK_RANGE): Likewise.
	(probe_stack_address): New insn.
	(probe_stack_range): Likewise.
	* config/ia64/ia64.c: Include common/common-target.h.
	(ia64_compute_frame_size): Mark r2 and r3 as used if static stack
	checking is enabled.
	(ia64_emit_probe_stack_range): New function.
	(output_probe_stack_range): Likewise.
	(ia64_expand_prologue): Invoke ia64_emit_probe_stack_range if static
	builtin stack checking is enabled.
	(rtx_needs_barrier) <UNSPEC_VOLATILE>: Handle UNSPECV_PROBE_STACK_RANGE
	and UNSPECV_PROBE_STACK_ADDRESS.
	(unknown_for_bundling_p): New predicate.
	(group_barrier_needed): Use important_for_bundling_p.
	(ia64_dfa_new_cycle): Use unknown_for_bundling_p.
	(issue_nops_and_insn): Likewise.
	(bundling): Likewise.
	(final_emit_insn_group_barriers): Likewise.
	* config/ia64/ia64-protos.h (output_probe_stack_range): Declare.
	* config/ia64/hpux.h (STACK_CHECK_STATIC_BUILTIN): Define.
	(STACK_CHECK_PROTECT): Likewise.
	* config/ia64/linux.h (STACK_CHECK_STATIC_BUILTIN): Likewise.

Co-Authored-By: Tristan Gingold <gingold@adacore.com>

From-SVN: r187383
parent f1016df4
2012-05-10 Eric Botcazou <ebotcazou@adacore.com>
Tristan Gingold <gingold@adacore.com>
* doc/md.texi (Standard Names): Document probe_stack_address.
* explow.c (emit_stack_probe): Handle probe_stack_address.
* config/ia64/ia64.md (UNSPECV_PROBE_STACK_ADDRESS): New constant.
(UNSPECV_PROBE_STACK_RANGE): Likewise.
(probe_stack_address): New insn.
(probe_stack_range): Likewise.
* config/ia64/ia64.c: Include common/common-target.h.
(ia64_compute_frame_size): Mark r2 and r3 as used if static stack
checking is enabled.
(ia64_emit_probe_stack_range): New function.
(output_probe_stack_range): Likewise.
(ia64_expand_prologue): Invoke ia64_emit_probe_stack_range if static
builtin stack checking is enabled.
(rtx_needs_barrier) <UNSPEC_VOLATILE>: Handle UNSPECV_PROBE_STACK_RANGE
and UNSPECV_PROBE_STACK_ADDRESS.
(unknown_for_bundling_p): New predicate.
(group_barrier_needed): Use important_for_bundling_p.
(ia64_dfa_new_cycle): Use unknown_for_bundling_p.
(issue_nops_and_insn): Likewise.
(bundling): Likewise.
(final_emit_insn_group_barriers): Likewise.
* config/ia64/ia64-protos.h (output_probe_stack_range): Declare.
* config/ia64/hpux.h (STACK_CHECK_STATIC_BUILTIN): Define.
(STACK_CHECK_PROTECT): Likewise.
* config/ia64/linux.h (STACK_CHECK_STATIC_BUILTIN): Likewise.
2012-05-10 Jan Hubicka <jh@suse.cz>
* ipa-inline.c (update_all_callee_keys): Remove.
......
......@@ -228,3 +228,10 @@ do { \
#define TARGET_ASM_FUNCTION_SECTION ia64_hpux_function_section
#define TARGET_POSIX_IO
/* Define this to be nonzero if static stack checking is supported. */
#define STACK_CHECK_STATIC_BUILTIN 1
/* Minimum amount of stack required to recover from an anticipated stack
overflow detection. */
#define STACK_CHECK_PROTECT (24 * 1024)
......@@ -61,6 +61,7 @@ extern int ia64_hard_regno_rename_ok (int, int);
extern enum reg_class ia64_secondary_reload_class (enum reg_class,
enum machine_mode, rtx);
extern const char *get_bundle_name (int);
extern const char *output_probe_stack_range (rtx, rtx);
extern void ia64_expand_vec_perm_even_odd (rtx, rtx, rtx, int);
extern bool ia64_expand_vec_perm_const (rtx op[4]);
......
......@@ -105,6 +105,8 @@
UNSPECV_PSAC_NORMAL
UNSPECV_SETJMP_RECEIVER
UNSPECV_GOTO_RECEIVER
UNSPECV_PROBE_STACK_ADDRESS
UNSPECV_PROBE_STACK_RANGE
])
(include "predicates.md")
......@@ -5182,6 +5184,26 @@
"mov %0 = ip"
[(set_attr "itanium_class" "frbr")])
;;
;; Stack checking
(define_insn "probe_stack_address"
[(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
UNSPECV_PROBE_STACK_ADDRESS)]
""
"probe.w.fault %0, 0"
[(set_attr "itanium_class" "chk_s_i")])
(define_insn "probe_stack_range"
[(set (match_operand:DI 0 "register_operand" "=r")
(unspec_volatile:DI [(match_operand:DI 1 "register_operand" "0")
(match_operand:DI 2 "register_operand" "r")]
UNSPECV_PROBE_STACK_RANGE))]
""
"* return output_probe_stack_range (operands[0], operands[2]);"
[(set_attr "itanium_class" "unknown")
(set_attr "predicable" "no")])
;; Vector operations
(include "vect.md")
;; Atomic operations
......
......@@ -86,3 +86,6 @@ do { \
#undef TARGET_INIT_LIBFUNCS
#define TARGET_INIT_LIBFUNCS ia64_soft_fp_init_libfuncs
/* Define this to be nonzero if static stack checking is supported. */
#define STACK_CHECK_STATIC_BUILTIN 1
......@@ -5614,6 +5614,13 @@ the stack farthest from the current stack pointer that you need to validate.
Normally, on platforms where this pattern is needed, you would obtain the
stack limit from a global or thread-specific variable or register.
@cindex @code{probe_stack_address} instruction pattern
@item @samp{probe_stack_address}
If stack checking (@pxref{Stack Checking}) can be done on your system by
probing the stack but without the need to actually access it, define this
pattern and signal an error if the stack has overflowed. The single operand
is the memory address in the stack that needs to be probed.
@cindex @code{probe_stack} instruction pattern
@item @samp{probe_stack}
If stack checking (@pxref{Stack Checking}) can be done on your system by
......
......@@ -1525,6 +1525,12 @@ set_stack_check_libfunc (const char *libfunc_name)
void
emit_stack_probe (rtx address)
{
#ifdef HAVE_probe_stack_address
if (HAVE_probe_stack_address)
emit_insn (gen_probe_stack_address (address));
else
#endif
{
rtx memref = gen_rtx_MEM (word_mode, address);
MEM_VOLATILE_P (memref) = 1;
......@@ -1536,6 +1542,7 @@ emit_stack_probe (rtx address)
else
#endif
emit_move_insn (memref, const0_rtx);
}
}
/* Probe a range of stack addresses from FIRST to FIRST+SIZE, inclusive.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment