diff options
author | xguo <xguo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-30 08:11:30 +0000 |
---|---|---|
committer | xguo <xguo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-30 08:11:30 +0000 |
commit | 0686440e2329897c3290940d119b4b7c219179bf (patch) | |
tree | 7d5df32b06814b7ade77dd32dec02366031c6158 /gcc/config/arm/arm.c | |
parent | cf94bbe6e0dcd866d07eed4da6f5b48313cb2a36 (diff) | |
download | gcc-0686440e2329897c3290940d119b4b7c219179bf.tar.gz |
gcc/ChangeLog:
2013-05-30 Bernd Schmidt <bernds@codesourcery.com>
Zhenqiang Chen <zhenqiang.chen@linaro.org>
* config/arm/arm-protos.h: Add and update function protos.
* config/arm/arm.c (use_simple_return_p): New added.
(thumb2_expand_return): Check simple_return flag.
* config/arm/arm.md: Add simple_return and conditional simple_return.
* config/arm/iterators.md: Add iterator for return and simple_return.
gcc/testsuite/ChangeLog:
2013-05-30 Zhenqiang Chen <zhenqiang.chen@linaro.org>
* gcc.dg/shrink-wrap-alloca.c: New added.
* gcc.dg/shrink-wrap-pretend.c: New added.
* gcc.dg/shrink-wrap-sibcall.c: New added.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199439 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/arm/arm.c')
-rw-r--r-- | gcc/config/arm/arm.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index ac41d93ae1e..55a512349cc 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -2169,6 +2169,14 @@ arm_option_override (void) global_options.x_param_values, global_options_set.x_param_values); + /* Disable shrink-wrap when optimizing function for size, since it tends to + generate additional returns. */ + if (optimize_function_for_size_p (cfun) && TARGET_THUMB2) + flag_shrink_wrap = false; + /* TBD: Dwarf info for apcs frame is not handled yet. */ + if (TARGET_APCS_FRAME) + flag_shrink_wrap = false; + /* Register global variables with the garbage collector. */ arm_add_gc_roots (); } @@ -2518,6 +2526,18 @@ use_return_insn (int iscond, rtx sibling) return 1; } +/* Return TRUE if we should try to use a simple_return insn, i.e. perform + shrink-wrapping if possible. This is the case if we need to emit a + prologue, which we can test by looking at the offsets. */ +bool +use_simple_return_p (void) +{ + arm_stack_offsets *offsets; + + offsets = arm_get_frame_offsets (); + return offsets->outgoing_args != 0; +} + /* Return TRUE if int I is a valid immediate ARM constant. */ int @@ -24035,7 +24055,7 @@ thumb1_expand_prologue (void) all we really need to check here is if single register is to be returned, or multiple register return. */ void -thumb2_expand_return (void) +thumb2_expand_return (bool simple_return) { int i, num_regs; unsigned long saved_regs_mask; @@ -24048,7 +24068,7 @@ thumb2_expand_return (void) if (saved_regs_mask & (1 << i)) num_regs++; - if (saved_regs_mask) + if (!simple_return && saved_regs_mask) { if (num_regs == 1) { |