aboutsummaryrefslogtreecommitdiff
path: root/gcc/explow.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2009-11-10 20:45:25 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-11-10 20:45:25 +0000
commitc35af30f163df37759db9355695028678e6570f6 (patch)
treec3c5f7e26211053f186e7a889a1713c799a96f25 /gcc/explow.c
parent35230a7895e65ec3a2fdb48600ef39983b1605b4 (diff)
downloadgcc-c35af30f163df37759db9355695028678e6570f6.zip
gcc-c35af30f163df37759db9355695028678e6570f6.tar.gz
gcc-c35af30f163df37759db9355695028678e6570f6.tar.bz2
re PR target/10127 (-fstack-check let's program crash)
PR target/10127 PR ada/20548 * expr.h (anti_adjust_stack_and_probe): Declare. * explow.c (anti_adjust_stack_and_probe): Make global, add ADJUST_BACK parameter and rewrite head comment. (allocate_dynamic_stack_space): Adjust call to above function. * function.c (expand_function_end): Handle STACK_CHECK_MOVING_SP. * tree.h (dwarf2out_args_size): Delete. * dwarf2out.c (dwarf2out_args_size): Make static and move around. (dwarf2out_args_size_adjust): Delete prototype and move around. (dwarf2out_frame_debug_expr): Do not record arg size adjustments for ACCUMULATE_OUTGOING_ARGS targets. From-SVN: r154079
Diffstat (limited to 'gcc/explow.c')
-rw-r--r--gcc/explow.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/gcc/explow.c b/gcc/explow.c
index a887849..4d1d24e 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -43,7 +43,6 @@ along with GCC; see the file COPYING3. If not see
static rtx break_out_memory_refs (rtx);
static void emit_stack_probe (rtx);
-static void anti_adjust_stack_and_probe (rtx);
/* Truncate and perhaps sign-extend C as appropriate for MODE. */
@@ -1308,7 +1307,7 @@ allocate_dynamic_stack_space (rtx size, rtx target, int known_align)
}
if (flag_stack_check && STACK_CHECK_MOVING_SP)
- anti_adjust_stack_and_probe (size);
+ anti_adjust_stack_and_probe (size, false);
else
anti_adjust_stack (size);
@@ -1545,13 +1544,17 @@ probe_stack_range (HOST_WIDE_INT first, rtx size)
}
}
-/* Adjust the stack by SIZE bytes while probing it. Note that we skip the
- probe for the first interval + a small dope of 4 words and instead probe
- that many bytes past the specified size to maintain a protection area. */
+/* Adjust the stack pointer by minus SIZE (an rtx for a number of bytes)
+ while probing it. This pushes when SIZE is positive. SIZE need not
+ be constant. If ADJUST_BACK is true, adjust back the stack pointer
+ by plus SIZE at the end. */
-static void
-anti_adjust_stack_and_probe (rtx size)
+void
+anti_adjust_stack_and_probe (rtx size, bool adjust_back)
{
+ /* We skip the probe for the first interval + a small dope of 4 words and
+ probe that many bytes past the specified size to maintain a protection
+ area at the botton of the stack. */
const int dope = 4 * UNITS_PER_WORD;
/* First ensure SIZE is Pmode. */
@@ -1660,8 +1663,11 @@ anti_adjust_stack_and_probe (rtx size)
}
}
- /* Adjust back to account for the additional first interval. */
- adjust_stack (GEN_INT (PROBE_INTERVAL + dope));
+ /* Adjust back and account for the additional first interval. */
+ if (adjust_back)
+ adjust_stack (plus_constant (size, PROBE_INTERVAL + dope));
+ else
+ adjust_stack (GEN_INT (PROBE_INTERVAL + dope));
}
/* Return an rtx representing the register or memory location