+2009-12-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * 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 <bje@au.ibm.com>
* lto-streamer-in.c (lto_get_builtin_tree): fclass can only be a
(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)
[(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")])
\f
;; Compare insns are next. Note that the RS/6000 has two types of compares,
;; signed & unsigned, and one type of branch.
@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}
@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