From 507d0069fa46a93942923e13401657bd6657f09c Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 14 Dec 2009 10:12:43 +0000 Subject: [PATCH] tm.texi (STACK_CHECK_PROTECT): Document alternate default. * doc/tm.texi (STACK_CHECK_PROTECT): Document alternate default. * doc/md.texi (check_stack): Clarify. (probe_stack): Likewise. * config/rs6000/rs6000.md (UNSPEC_PROBE_STACK): New constant. (probe_stack): New insn. From-SVN: r155209 --- gcc/ChangeLog | 8 ++++++++ gcc/config/rs6000/rs6000.md | 8 ++++++++ gcc/doc/md.texi | 23 +++++++++++------------ gcc/doc/tm.texi | 8 +++++--- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7e975565b50..207095cc2ba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2009-12-14 Eric Botcazou + + * doc/tm.texi (STACK_CHECK_PROTECT): Document alternate default. + * doc/md.texi (check_stack): Clarify. + (probe_stack): Likewise. + * config/rs6000/rs6000.md (UNSPEC_PROBE_STACK): New constant. + (probe_stack): New insn. + 2009-12-14 Ben Elliston * lto-streamer-in.c (lto_get_builtin_tree): fclass can only be a diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 5b69f7043ac..5e959db7ebc 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -55,6 +55,7 @@ (define_constants [(UNSPEC_FRSP 0) ; frsp for POWER machines + (UNSPEC_PROBE_STACK 4) ; probe stack memory reference (UNSPEC_TIE 5) ; tie stack contents and stack pointer (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC (UNSPEC_TOC 7) ; address of the TOC (more-or-less) @@ -12549,6 +12550,13 @@ [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)] "" "") + +(define_insn "probe_stack" + [(unspec [(match_operand 0 "memory_operand" "=m")] UNSPEC_PROBE_STACK)] + "" + "{st%U0%X0|stw%U0%X0} 0,%0" + [(set_attr "type" "store") + (set_attr "length" "4")]) ;; Compare insns are next. Note that the RS/6000 has two types of compares, ;; signed & unsigned, and one type of branch. diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 2974dcfb20c..5a92a809fc6 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -5035,21 +5035,20 @@ operations in addition to updating the stack pointer. @cindex @code{check_stack} instruction pattern @item @samp{check_stack} -If stack checking cannot be done on your system by probing the stack with -a load or store instruction (@pxref{Stack Checking}), define this pattern -to perform the needed check and signal an error if the stack has overflowed. -The single operand is the address in the stack furthest from the current -stack pointer that you need to validate. Normally, on machines where this -pattern is needed, you would obtain the stack limit from a global or -thread-specific variable or register. +If stack checking (@pxref{Stack Checking}) cannot be done on your system by +probing the stack, define this pattern to perform the needed check and signal +an error if the stack has overflowed. The single operand is the address in +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} instruction pattern @item @samp{probe_stack} -If stack checking can be done on your system by probing the stack but doing -it with a load or store instruction is not optimal (@pxref{Stack Checking}), -define this pattern to do the probing differently and signal an error if -the stack has overflowed. The single operand is the memory location in the -stack that needs to be probed. +If stack checking (@pxref{Stack Checking}) can be done on your system by +probing the stack but doing it with a ``store zero'' instruction is not valid +or optimal, define this pattern to do the probing differently and signal an +error if the stack has overflowed. The single operand is the memory reference +in the stack that needs to be probed. @cindex @code{nonlocal_goto} instruction pattern @item @samp{nonlocal_goto} diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 9a9d493976b..6a2991777cf 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -3574,9 +3574,11 @@ default value of this macro is zero. @end defmac @defmac STACK_CHECK_PROTECT -The number of bytes of stack needed to recover from a stack overflow, -for languages where such a recovery is supported. The default value of -75 words should be adequate for most machines. +The number of bytes of stack needed to recover from a stack overflow, for +languages where such a recovery is supported. The default value of 75 words +with the @code{setjmp}/@code{longjmp}-based exception handling mechanism and +8192 bytes with other exception handling mechanisms should be adequate for +most machines. @end defmac The following macros are relevant only if neither STACK_CHECK_BUILTIN