summaryrefslogtreecommitdiff
path: root/gcc/jump.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2001-05-19 21:16:51 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2001-05-19 21:16:51 +0000
commite89849bde3f946e477d959de786f978fadda6f2e (patch)
tree1d5170578c33c4c738aeb9f23af417efbc24492a /gcc/jump.c
parent780eeb661a4e32da17fca56979aaaa59d22ff862 (diff)
downloadgcc-e89849bde3f946e477d959de786f978fadda6f2e.tar.gz
* jump.c (jump_optimize_1): Tidy.
(mark_jump_label): When changing the label in a LABEL_REF, change update any REG_EQUAL notes as well. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42318 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/jump.c')
-rw-r--r--gcc/jump.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/gcc/jump.c b/gcc/jump.c
index 3af808b8c07..d171cbae39d 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -236,14 +236,13 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan,
if (GET_CODE (XEXP (insn, 0)) == CODE_LABEL)
LABEL_NUSES (XEXP (insn, 0))++;
- if (! mark_labels_only)
- delete_barrier_successors (f);
-
/* Quit now if we just wanted to rebuild the JUMP_LABEL and REG_LABEL
notes and recompute LABEL_NUSES. */
if (mark_labels_only)
goto end;
+ delete_barrier_successors (f);
+
last_insn = delete_unreferenced_labels (f);
if (noop_moves)
@@ -2498,7 +2497,6 @@ mark_jump_label (x, insn, cross_jump, in_mem)
{
rtx label = XEXP (x, 0);
rtx olabel = label;
- rtx note;
rtx next;
/* Ignore remaining references to unreachable labels that
@@ -2545,11 +2543,34 @@ mark_jump_label (x, insn, cross_jump, in_mem)
if (GET_CODE (insn) == JUMP_INSN)
JUMP_LABEL (insn) = label;
- /* If we've changed OLABEL and we had a REG_LABEL note
- for it, update it as well. */
- else if (label != olabel
- && (note = find_reg_note (insn, REG_LABEL, olabel)) != 0)
- XEXP (note, 0) = label;
+ /* If we've changed the label, update notes accordingly. */
+ else if (label != olabel)
+ {
+ rtx note;
+
+ /* We may have a REG_LABEL note to indicate that this
+ instruction uses the label. */
+ note = find_reg_note (insn, REG_LABEL, olabel);
+ if (note)
+ XEXP (note, 0) = label;
+
+ /* We may also have a REG_EQUAL note to indicate that
+ a register is being set to the address of the
+ label. We cannot use find_reg_note as above
+ because the REG_EQUAL note will use a LABEL_REF,
+ not the actual CODE_LABEL. */
+ for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
+ if (REG_NOTE_KIND (note) == REG_EQUAL)
+ {
+ if (GET_CODE (XEXP (note, 0)) == LABEL_REF
+ && XEXP (XEXP (note, 0), 0) == olabel)
+ XEXP (XEXP (note, 0), 0) = label;
+ /* There is only one REG_EQUAL note per
+ instruction, so we are done at this
+ point. */
+ break;
+ }
+ }
/* Otherwise, add a REG_LABEL note for LABEL unless there already
is one. */