aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hayes <m.hayes@elec.canterbury.ac.nz>2000-07-30 08:29:01 +0000
committerMichael Hayes <m.hayes@gcc.gnu.org>2000-07-30 08:29:01 +0000
commitb864825e85c6c651d5a7488aa60743ec3781591f (patch)
treeb8264fb6a248d8d15bd97d377c6dbdc3c0fc9870
parentb61ba1ef516df2f7337a3af0ddcbbbe5f328cb5e (diff)
downloadgcc-b864825e85c6c651d5a7488aa60743ec3781591f.zip
gcc-b864825e85c6c651d5a7488aa60743ec3781591f.tar.gz
gcc-b864825e85c6c651d5a7488aa60743ec3781591f.tar.bz2
* config/c4x/c4x.c (c4x_rptb_insert): Make more robust.
From-SVN: r35338
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/c4x/c4x.c24
2 files changed, 23 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a38290f..f8c2082 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2000-07-30 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
-
+
+ * config/c4x/c4x.c (c4x_rptb_insert): Make more robust.
+
+2000-07-30 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
+
* config/c4x/c4x.h (ASM_FORMAT_PRIVATE_NAME): Output $ in label.
2000-07-30 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c
index 9972f47..dcc48ff 100644
--- a/gcc/config/c4x/c4x.c
+++ b/gcc/config/c4x/c4x.c
@@ -2214,6 +2214,7 @@ c4x_rptb_insert (insn)
{
rtx end_label;
rtx start_label;
+ rtx new_start_label;
rtx count_reg;
/* If the count register has not been allocated to RC, say if
@@ -2227,21 +2228,32 @@ c4x_rptb_insert (insn)
/* Extract the start label from the jump pattern (rptb_end). */
start_label = XEXP (XEXP (SET_SRC (XVECEXP (PATTERN (insn), 0, 0)), 1), 0);
- /* We'll have to update the basic blocks. */
end_label = gen_label_rtx ();
+ LABEL_NUSES (end_label)++;
emit_label_after (end_label, insn);
+ new_start_label = gen_label_rtx ();
+ LABEL_NUSES (new_start_label)++;
+
for (; insn; insn = PREV_INSN (insn))
- if (insn == start_label)
- break;
+ {
+ if (insn == start_label)
+ break;
+ if (GET_CODE (insn) == JUMP_INSN &&
+ JUMP_LABEL (insn) == start_label)
+ redirect_jump (insn, new_start_label, 0);
+ }
if (! insn)
fatal_insn ("c4x_rptb_insert: Cannot find start label", start_label);
- /* We'll have to update the basic blocks. */
+ emit_label_after (new_start_label, insn);
+
if (TARGET_RPTS && c4x_rptb_rpts_p (PREV_INSN (insn), 0))
- emit_insn_before (gen_rpts_top (start_label, end_label), insn);
+ emit_insn_after (gen_rpts_top (new_start_label, end_label), insn);
else
- emit_insn_before (gen_rptb_top (start_label, end_label), insn);
+ emit_insn_after (gen_rptb_top (new_start_label, end_label), insn);
+ if (LABEL_NUSES (start_label) == 0)
+ delete_insn (start_label);
}