aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1997-07-17 11:25:54 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1997-07-17 11:25:54 -0400
commit11044f6690c12aa40ed84655c9949e0e3ab16bd1 (patch)
tree0062d75cd2f60f21cfeb9d982c65395fdc4f51c0 /gcc/function.c
parentedff249168080e7c7c893f57c0c578819afcb348 (diff)
downloadgcc-11044f6690c12aa40ed84655c9949e0e3ab16bd1.zip
gcc-11044f6690c12aa40ed84655c9949e0e3ab16bd1.tar.gz
gcc-11044f6690c12aa40ed84655c9949e0e3ab16bd1.tar.bz2
(expand_function_end): If function is non-leaf and stack checking is
requested, emit needed probes. From-SVN: r14470
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/function.c b/gcc/function.c
index b2468de..582c4ca 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5494,6 +5494,26 @@ expand_function_end (filename, line, end_bindings)
emit_insns_before (seq, tail_recursion_reentry);
}
+ /* If we are doing stack checking and this function makes calls,
+ do a stack probe at the start of the function to ensure we have enough
+ space for another stack frame. */
+ if (flag_stack_check && ! STACK_CHECK_BUILTIN)
+ {
+ rtx insn, seq;
+
+ for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+ if (GET_CODE (insn) == CALL_INSN)
+ {
+ start_sequence ();
+ probe_stack_range (STACK_CHECK_PROTECT,
+ GEN_INT (STACK_CHECK_MAX_FRAME_SIZE));
+ seq = get_insns ();
+ end_sequence ();
+ emit_insns_before (seq, tail_recursion_reentry);
+ break;
+ }
+ }
+
/* Warn about unused parms if extra warnings were specified. */
if (warn_unused && extra_warnings)
{