diff options
author | bernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-14 11:15:09 +0000 |
---|---|---|
committer | bernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-14 11:15:09 +0000 |
commit | 3ffda02672473b72ff439aba90b967c24948e3ab (patch) | |
tree | 52faa3c37c7199fe3e605fc04951b77c4e697c13 | |
parent | ddb05a5a0b18e0895d6b21b541a317b37eeb1b96 (diff) | |
download | ppe42-gcc-3ffda02672473b72ff439aba90b967c24948e3ab.tar.gz ppe42-gcc-3ffda02672473b72ff439aba90b967c24948e3ab.zip |
* config/mips/mips.c (mips_expand_epilogue): Generate a
simple_return only if the return address is in r31.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178847 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 20 |
2 files changed, 20 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 74b187a8eff..7de4c651ecb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-09-14 Bernd Schmidt <bernds@codesourcery.com> + + * config/mips/mips.c (mips_expand_epilogue): Generate a + simple_return only if the return address is in r31. + 2011-09-13 Bernd Schmidt <bernds@codesourcery.com> * cfgcleanup.c (try_head_merge_bb): If get_condition returns diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 0c3b184bcb2..22cb60b6b11 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -10521,7 +10521,7 @@ mips_expand_epilogue (bool sibcall_p) } else { - unsigned int regno; + rtx pat; /* When generating MIPS16 code, the normal mips_for_each_saved_gpr_and_fpr path will restore the return @@ -10529,11 +10529,21 @@ mips_expand_epilogue (bool sibcall_p) if (TARGET_MIPS16 && !GENERATE_MIPS16E_SAVE_RESTORE && BITSET_P (frame->mask, RETURN_ADDR_REGNUM)) - regno = GP_REG_FIRST + 7; + { + /* simple_returns cannot rely on values that are only available + on paths through the epilogue (because return paths that do + not pass through the epilogue may nevertheless reuse a + simple_return that occurs at the end of the epilogue). + Use a normal return here instead. */ + rtx reg = gen_rtx_REG (Pmode, GP_REG_FIRST + 7); + pat = gen_return_internal (reg); + } else - regno = RETURN_ADDR_REGNUM; - emit_jump_insn (gen_simple_return_internal (gen_rtx_REG (Pmode, - regno))); + { + rtx reg = gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM); + pat = gen_simple_return_internal (reg); + } + emit_jump_insn (pat); } } |