summaryrefslogtreecommitdiff
path: root/gcc/config/s390/s390.c
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-30 13:53:10 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-30 13:53:10 +0000
commitb437383e2ff84fdc6eca55e52f9928b784ff2206 (patch)
tree5d882f52e9f05f24e25574be825ca4c24ef599b5 /gcc/config/s390/s390.c
parent72aa8cd5b7c2809765e7c1619278e9c82f615417 (diff)
downloadgcc-b437383e2ff84fdc6eca55e52f9928b784ff2206.tar.gz
2010-03-30 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* config/s390/s390.c (s390_emit_prologue): Omit issuing a dynamic stack check if the mask would be zero. 2010-03-30 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> * gcc.target/s390/stackcheck1.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157825 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/s390/s390.c')
-rw-r--r--gcc/config/s390/s390.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 2f82f661308..c2cf3d4a828 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -7802,16 +7802,35 @@ s390_emit_prologue (void)
}
else
{
- HOST_WIDE_INT stack_check_mask = ((s390_stack_size - 1)
- & ~(stack_guard - 1));
- rtx t = gen_rtx_AND (Pmode, stack_pointer_rtx,
- GEN_INT (stack_check_mask));
- if (TARGET_64BIT)
- emit_insn (gen_ctrapdi4 (gen_rtx_EQ (VOIDmode, t, const0_rtx),
- t, const0_rtx, const0_rtx));
+ /* stack_guard has to be smaller than s390_stack_size.
+ Otherwise we would emit an AND with zero which would
+ not match the test under mask pattern. */
+ if (stack_guard >= s390_stack_size)
+ {
+ warning (0, "frame size of function %qs is "
+ HOST_WIDE_INT_PRINT_DEC
+ " bytes which is more than half the stack size. "
+ "The dynamic check would not be reliable. "
+ "No check emitted for this function.",
+ current_function_name(),
+ cfun_frame_layout.frame_size);
+ }
else
- emit_insn (gen_ctrapsi4 (gen_rtx_EQ (VOIDmode, t, const0_rtx),
- t, const0_rtx, const0_rtx));
+ {
+ HOST_WIDE_INT stack_check_mask = ((s390_stack_size - 1)
+ & ~(stack_guard - 1));
+
+ rtx t = gen_rtx_AND (Pmode, stack_pointer_rtx,
+ GEN_INT (stack_check_mask));
+ if (TARGET_64BIT)
+ emit_insn (gen_ctrapdi4 (gen_rtx_EQ (VOIDmode,
+ t, const0_rtx),
+ t, const0_rtx, const0_rtx));
+ else
+ emit_insn (gen_ctrapsi4 (gen_rtx_EQ (VOIDmode,
+ t, const0_rtx),
+ t, const0_rtx, const0_rtx));
+ }
}
}