diff options
author | Jeff Law <law@redhat.com> | 2017-09-19 23:05:12 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2017-09-19 23:05:12 -0600 |
commit | 8c1dd97000d801abc8c9119304be6bf30c5316c0 (patch) | |
tree | 64eab318b17653e4aec6415328b0b93032cd88c6 /gcc/config | |
parent | ee8f15c69e324cdb1fa553ac14f760f799c425e2 (diff) | |
download | gcc-8c1dd97000d801abc8c9119304be6bf30c5316c0.zip gcc-8c1dd97000d801abc8c9119304be6bf30c5316c0.tar.gz gcc-8c1dd97000d801abc8c9119304be6bf30c5316c0.tar.bz2 |
explow.c: Include "params.h".
2017-09-18 Jeff Law <law@redhat.com>
* explow.c: Include "params.h".
(anti_adjust_stack_and_probe_stack_clash): New function.
(get_stack_check_protect): Likewise.
(compute_stack_clash_protection_loop_data): Likewise.
(emit_stack_clash_protection_loop_start): Likewise.
(emit_stack_clash_protection_loop_end): Likewise.
(allocate_dynamic_stack_space): Use get_stack_check_protect.
Use anti_adjust_stack_and_probe_stack_clash.
* explow.h (compute_stack_clash_protection_loop_data): Prototype.
(emit_stack_clash_protection_loop_start): Likewise.
(emit_stack_clash_protection_loop_end): Likewise.
* rtl.h (get_stack_check_protect): Prototype.
* target.def (stack_clash_protection_final_dynamic_probe): New hook.
* targhooks.c (default_stack_clash_protection_final_dynamic_probe): New.
* targhooks.h (default_stack_clash_protection_final_dynamic_probe):
Prototype.
* doc/tm.texi.in (TARGET_STACK_CLASH_PROTECTION_FINAL_DYNAMIC_PROBE):
Add @hook.
* doc/tm.texi: Rebuilt.
* config/aarch64/aarch64.c (aarch64_expand_prologue): Use
get_stack_check_protect.
* config/alpha/alpha.c (alpha_expand_prologue): Likewise.
* config/arm/arm.c (arm_expand_prologue): Likewise.
(arm_frame_pointer_required): Likewise.
* config/i386/i386.c (ix86_expand_prologue): Likewise.
* config/ia64/ia64.c (ia64_expand_prologue): Likewise.
* config/mips/mips.c (mips_expand_prologue): Likewise.
* config/powerpcspe/powerpcspe.c (rs6000_emit_prologue): Likewise.
* config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise.
* config/sparc/sparc.c (sparc_expand_prologue): Likewise.
(sparc_flat_expand_prologue): Likewise.
* gcc.dg/stack-check-3.c: New test.
From-SVN: r252995
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/aarch64/aarch64.c | 10 | ||||
-rw-r--r-- | gcc/config/alpha/alpha.c | 2 | ||||
-rw-r--r-- | gcc/config/arm/arm.c | 10 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 14 | ||||
-rw-r--r-- | gcc/config/ia64/ia64.c | 13 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 8 | ||||
-rw-r--r-- | gcc/config/powerpcspe/powerpcspe.c | 8 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 8 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.c | 16 |
9 files changed, 47 insertions, 42 deletions
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 1c14008..5e26cb7 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -3666,12 +3666,14 @@ aarch64_expand_prologue (void) { if (crtl->is_leaf && !cfun->calls_alloca) { - if (frame_size > PROBE_INTERVAL && frame_size > STACK_CHECK_PROTECT) - aarch64_emit_probe_stack_range (STACK_CHECK_PROTECT, - frame_size - STACK_CHECK_PROTECT); + if (frame_size > PROBE_INTERVAL + && frame_size > get_stack_check_protect ()) + aarch64_emit_probe_stack_range (get_stack_check_protect (), + (frame_size + - get_stack_check_protect ())); } else if (frame_size > 0) - aarch64_emit_probe_stack_range (STACK_CHECK_PROTECT, frame_size); + aarch64_emit_probe_stack_range (get_stack_check_protect (), frame_size); } aarch64_sub_sp (IP0_REGNUM, initial_adjust, true); diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index e0f458c..a4e8b2b 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -7761,7 +7761,7 @@ alpha_expand_prologue (void) probed_size = frame_size; if (flag_stack_check) - probed_size += STACK_CHECK_PROTECT; + probed_size += get_stack_check_protect (); if (probed_size <= 32768) { diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index bc802ad..679e838 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -21693,13 +21693,13 @@ arm_expand_prologue (void) if (crtl->is_leaf && !cfun->calls_alloca) { - if (size > PROBE_INTERVAL && size > STACK_CHECK_PROTECT) - arm_emit_probe_stack_range (STACK_CHECK_PROTECT, - size - STACK_CHECK_PROTECT, + if (size > PROBE_INTERVAL && size > get_stack_check_protect ()) + arm_emit_probe_stack_range (get_stack_check_protect (), + size - get_stack_check_protect (), regno, live_regs_mask); } else if (size > 0) - arm_emit_probe_stack_range (STACK_CHECK_PROTECT, size, + arm_emit_probe_stack_range (get_stack_check_protect (), size, regno, live_regs_mask); } @@ -27886,7 +27886,7 @@ arm_frame_pointer_required (void) { /* We don't have the final size of the frame so adjust. */ size += 32 * UNITS_PER_WORD; - if (size > PROBE_INTERVAL && size > STACK_CHECK_PROTECT) + if (size > PROBE_INTERVAL && size > get_stack_check_protect ()) return true; } else diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 1c765fb..05b0520 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -14871,7 +14871,7 @@ ix86_expand_prologue (void) HOST_WIDE_INT size = allocate; if (TARGET_64BIT && size >= HOST_WIDE_INT_C (0x80000000)) - size = 0x80000000 - STACK_CHECK_PROTECT - 1; + size = 0x80000000 - get_stack_check_protect () - 1; if (TARGET_STACK_PROBE) { @@ -14881,18 +14881,20 @@ ix86_expand_prologue (void) ix86_emit_probe_stack_range (0, size); } else - ix86_emit_probe_stack_range (0, size + STACK_CHECK_PROTECT); + ix86_emit_probe_stack_range (0, + size + get_stack_check_protect ()); } else { if (crtl->is_leaf && !cfun->calls_alloca) { - if (size > PROBE_INTERVAL && size > STACK_CHECK_PROTECT) - ix86_emit_probe_stack_range (STACK_CHECK_PROTECT, - size - STACK_CHECK_PROTECT); + if (size > PROBE_INTERVAL + && size > get_stack_check_protect ()) + ix86_emit_probe_stack_range (get_stack_check_protect (), + size - get_stack_check_protect ()); } else - ix86_emit_probe_stack_range (STACK_CHECK_PROTECT, size); + ix86_emit_probe_stack_range (get_stack_check_protect (), size); } } } diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index b4d6359..00ef215 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -3502,15 +3502,16 @@ ia64_expand_prologue (void) if (crtl->is_leaf && !cfun->calls_alloca) { - if (size > PROBE_INTERVAL && size > STACK_CHECK_PROTECT) - ia64_emit_probe_stack_range (STACK_CHECK_PROTECT, - size - STACK_CHECK_PROTECT, + if (size > PROBE_INTERVAL && size > get_stack_check_protect ()) + ia64_emit_probe_stack_range (get_stack_check_protect (), + size - get_stack_check_protect (), bs_size); - else if (size + bs_size > STACK_CHECK_PROTECT) - ia64_emit_probe_stack_range (STACK_CHECK_PROTECT, 0, bs_size); + else if (size + bs_size > get_stack_check_protect ()) + ia64_emit_probe_stack_range (get_stack_check_protect (), + 0, bs_size); } else if (size + bs_size > 0) - ia64_emit_probe_stack_range (STACK_CHECK_PROTECT, size, bs_size); + ia64_emit_probe_stack_range (get_stack_check_protect (), size, bs_size); } if (dump_file) diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 7eaff14..67cee0b 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -12084,12 +12084,12 @@ mips_expand_prologue (void) { if (crtl->is_leaf && !cfun->calls_alloca) { - if (size > PROBE_INTERVAL && size > STACK_CHECK_PROTECT) - mips_emit_probe_stack_range (STACK_CHECK_PROTECT, - size - STACK_CHECK_PROTECT); + if (size > PROBE_INTERVAL && size > get_stack_check_protect ()) + mips_emit_probe_stack_range (get_stack_check_protect (), + size - get_stack_check_protect ()); } else if (size > 0) - mips_emit_probe_stack_range (STACK_CHECK_PROTECT, size); + mips_emit_probe_stack_range (get_stack_check_protect (), size); } /* Save the registers. Allocate up to MIPS_MAX_FIRST_STACK_STEP diff --git a/gcc/config/powerpcspe/powerpcspe.c b/gcc/config/powerpcspe/powerpcspe.c index 11664ee..a956729 100644 --- a/gcc/config/powerpcspe/powerpcspe.c +++ b/gcc/config/powerpcspe/powerpcspe.c @@ -29693,12 +29693,12 @@ rs6000_emit_prologue (void) if (crtl->is_leaf && !cfun->calls_alloca) { - if (size > PROBE_INTERVAL && size > STACK_CHECK_PROTECT) - rs6000_emit_probe_stack_range (STACK_CHECK_PROTECT, - size - STACK_CHECK_PROTECT); + if (size > PROBE_INTERVAL && size > get_stack_check_protect ()) + rs6000_emit_probe_stack_range (get_stack_check_protect (), + size - get_stack_check_protect ()); } else if (size > 0) - rs6000_emit_probe_stack_range (STACK_CHECK_PROTECT, size); + rs6000_emit_probe_stack_range (get_stack_check_protect (), size); } if (TARGET_FIX_AND_CONTINUE) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 1978634..e5ef638 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -26765,12 +26765,12 @@ rs6000_emit_prologue (void) if (crtl->is_leaf && !cfun->calls_alloca) { - if (size > PROBE_INTERVAL && size > STACK_CHECK_PROTECT) - rs6000_emit_probe_stack_range (STACK_CHECK_PROTECT, - size - STACK_CHECK_PROTECT); + if (size > PROBE_INTERVAL && size > get_stack_check_protect ()) + rs6000_emit_probe_stack_range (get_stack_check_protect (), + size - get_stack_check_protect ()); } else if (size > 0) - rs6000_emit_probe_stack_range (STACK_CHECK_PROTECT, size); + rs6000_emit_probe_stack_range (get_stack_check_protect (), size); } if (TARGET_FIX_AND_CONTINUE) diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 749a7f8..906bd75 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -5738,12 +5738,12 @@ sparc_expand_prologue (void) { if (crtl->is_leaf && !cfun->calls_alloca) { - if (size > PROBE_INTERVAL && size > STACK_CHECK_PROTECT) - sparc_emit_probe_stack_range (STACK_CHECK_PROTECT, - size - STACK_CHECK_PROTECT); + if (size > PROBE_INTERVAL && size > get_stack_check_protect ()) + sparc_emit_probe_stack_range (get_stack_check_protect (), + size - get_stack_check_protect ()); } else if (size > 0) - sparc_emit_probe_stack_range (STACK_CHECK_PROTECT, size); + sparc_emit_probe_stack_range (get_stack_check_protect (), size); } if (size == 0) @@ -5849,12 +5849,12 @@ sparc_flat_expand_prologue (void) { if (crtl->is_leaf && !cfun->calls_alloca) { - if (size > PROBE_INTERVAL && size > STACK_CHECK_PROTECT) - sparc_emit_probe_stack_range (STACK_CHECK_PROTECT, - size - STACK_CHECK_PROTECT); + if (size > PROBE_INTERVAL && size > get_stack_check_protect ()) + sparc_emit_probe_stack_range (get_stack_check_protect (), + size - get_stack_check_protect ()); } else if (size > 0) - sparc_emit_probe_stack_range (STACK_CHECK_PROTECT, size); + sparc_emit_probe_stack_range (get_stack_check_protect (), size); } if (sparc_save_local_in_regs_p) |