aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>1993-08-15 18:16:56 -0600
committerJeff Law <law@gcc.gnu.org>1993-08-15 18:16:56 -0600
commite572bad3c657f4133cd91426e7bc52e4a9f199dd (patch)
tree649f4c27bb06a04754eaa75058955721ec10b86b /gcc
parent4724b3dea0b8f73223bf5bf45b0ff019c70fccd8 (diff)
downloadgcc-e572bad3c657f4133cd91426e7bc52e4a9f199dd.zip
gcc-e572bad3c657f4133cd91426e7bc52e4a9f199dd.tar.gz
gcc-e572bad3c657f4133cd91426e7bc52e4a9f199dd.tar.bz2
reorg.c (find_end_label): If a suitable RETURN insn exists at the end of the current function...
* reorg.c (find_end_label): If a suitable RETURN insn exists at the end of the current function, place a label in front of it for the end_of_function_label. From-SVN: r5162
Diffstat (limited to 'gcc')
-rw-r--r--gcc/reorg.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 12fe836..9806216 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -738,8 +738,26 @@ find_end_label ()
|| GET_CODE (PATTERN (insn)) == CLOBBER)))
insn = PREV_INSN (insn);
- if (GET_CODE (insn) == CODE_LABEL)
- end_of_function_label = insn;
+ /* When a target threads its epilogue we might already have a
+ suitable return insn. If so put a label before it for the
+ end_of_function_label. */
+ if (GET_CODE (insn) == BARRIER
+ && GET_CODE (PREV_INSN (insn)) == JUMP_INSN
+ && GET_CODE (PATTERN (PREV_INSN (insn))) == RETURN)
+ {
+ rtx temp = PREV_INSN (PREV_INSN (insn));
+ end_of_function_label = gen_label_rtx ();
+ LABEL_NUSES (end_of_function_label) = 0;
+
+ /* Put the label before an USE insns that may proceed the RETURN insn. */
+ while (GET_CODE (temp) == USE)
+ temp = PREV_INSN (temp);
+
+ emit_label_after (end_of_function_label, temp);
+ }
+
+ else if (GET_CODE (insn) == CODE_LABEL)
+ end_of_function_label = insn;
else
{
/* Otherwise, make a new label and emit a RETURN and BARRIER,