diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2013-11-06 10:55:13 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2013-11-06 10:55:13 +0000 |
commit | 0dca9cd86cfd8221fb282b3fd858196065c10712 (patch) | |
tree | 22d0f3f446a2947d5bd7b23b793e89adfcf55670 /gcc/config/i386/i386.c | |
parent | f054ff5b7c6afa260a9a3d07e8b59649dcf978f7 (diff) | |
download | gcc-0dca9cd86cfd8221fb282b3fd858196065c10712.zip gcc-0dca9cd86cfd8221fb282b3fd858196065c10712.tar.gz gcc-0dca9cd86cfd8221fb282b3fd858196065c10712.tar.bz2 |
i386.c (ix86_expand_prologue): Optimize stack checking for leaf functions without dynamic stack allocation.
* config/i386/i386.c (ix86_expand_prologue): Optimize stack checking for
leaf functions without dynamic stack allocation.
* config/ia64/ia64.c (ia64_emit_probe_stack_range): Adjust.
(ia64_expand_prologue): Likewise.
* config/mips/mips.c (mips_expand_prologue): Likewise.
* config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise.
* config/sparc/sparc.c (sparc_expand_prologue): Likewise.
(sparc_flat_expand_prologue): Likewise.
From-SVN: r204450
Diffstat (limited to 'gcc/config/i386/i386.c')
-rw-r--r-- | gcc/config/i386/i386.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 1192332..0680dea 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -10657,8 +10657,12 @@ ix86_expand_prologue (void) if (STACK_CHECK_MOVING_SP) { - ix86_adjust_stack_and_probe (allocate); - allocate = 0; + if (!(crtl->is_leaf && !cfun->calls_alloca + && allocate <= PROBE_INTERVAL)) + { + ix86_adjust_stack_and_probe (allocate); + allocate = 0; + } } else { @@ -10668,9 +10672,26 @@ ix86_expand_prologue (void) size = 0x80000000 - STACK_CHECK_PROTECT - 1; if (TARGET_STACK_PROBE) - ix86_emit_probe_stack_range (0, size + STACK_CHECK_PROTECT); + { + if (crtl->is_leaf && !cfun->calls_alloca) + { + if (size > PROBE_INTERVAL) + ix86_emit_probe_stack_range (0, size); + } + else + ix86_emit_probe_stack_range (0, size + STACK_CHECK_PROTECT); + } else - ix86_emit_probe_stack_range (STACK_CHECK_PROTECT, size); + { + 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); + } + else + ix86_emit_probe_stack_range (STACK_CHECK_PROTECT, size); + } } } |