diff options
author | mshawcroft <mshawcroft@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-23 12:38:37 +0000 |
---|---|---|
committer | mshawcroft <mshawcroft@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-23 12:38:37 +0000 |
commit | a45f86dfc0d8b05d32b7fb323f41019609dbe6c9 (patch) | |
tree | c7bf6e14f4e2ff61a272c74cfad6cdad819769da /gcc/config/aarch64 | |
parent | b0e7ddf0629ceecd2b7b3f99883117732c16b9bc (diff) | |
download | gcc-a45f86dfc0d8b05d32b7fb323f41019609dbe6c9.tar.gz |
[AArch64] Enable shrink wrapping.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215508 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/aarch64')
-rw-r--r-- | gcc/config/aarch64/aarch64-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.c | 20 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.md | 13 |
3 files changed, 34 insertions, 0 deletions
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 367253b0d78..e32ef645b68 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -213,6 +213,7 @@ bool aarch64_simd_valid_immediate (rtx, enum machine_mode, bool, struct simd_immediate_info *); bool aarch64_symbolic_address_p (rtx); bool aarch64_uimm12_shift (HOST_WIDE_INT); +bool aarch64_use_return_insn_p (void); const char *aarch64_output_casesi (rtx *); const char *aarch64_rewrite_selected_cpu (const char *name); diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 15c7be697d3..348308109a9 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -2340,6 +2340,26 @@ aarch64_expand_prologue (void) } } +/* Return TRUE if we can use a simple_return insn. + + This function checks whether the callee saved stack is empty, which + means no restore actions are need. The pro_and_epilogue will use + this to check whether shrink-wrapping opt is feasible. */ + +bool +aarch64_use_return_insn_p (void) +{ + if (!reload_completed) + return false; + + if (crtl->profile) + return false; + + aarch64_layout_frame (); + + return cfun->machine->frame.frame_size == 0; +} + /* Generate the epilogue instructions for returning from a function. */ void aarch64_expand_epilogue (bool for_sibcall) diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index f15a516bb05..74b554ec4df 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -360,6 +360,19 @@ [(set_attr "type" "branch")] ) +(define_expand "return" + [(simple_return)] + "aarch64_use_return_insn_p ()" + "" +) + +(define_insn "simple_return" + [(simple_return)] + "" + "ret" + [(set_attr "type" "branch")] +) + (define_insn "eh_return" [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")] UNSPECV_EH_RETURN)] |