REG_LABEL_TARGET.
* reorg.c (fill_slots_from_thread): Correct last change to use
NULL_RTX, not NULL. Outside of REG_NOTES loop, increase and
decrease LABEL_NUSES for JUMP_LABEL (trial), not XEXP (note, 0).
* jump.c (mark_jump_label_1): Add comment for last change
regarding JUMP_LABEL setting.
* gcse.c (add_label_notes): Remove conditional that the label is
mentioned in insn before adding regnote.
* sched-rgn.c (is_cfg_nonregular): Don't return 1 for a
single_set insn only feeding a label to a jump through a
register that dies there.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130398
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-11-24 Hans-Peter Nilsson <hp@axis.com>
+
+ * rtlanal.c (label_is_jump_target_p): Return true for a matching
+ REG_LABEL_TARGET.
+ * reorg.c (fill_slots_from_thread): Correct last change to use
+ NULL_RTX, not NULL. Outside of REG_NOTES loop, increase and
+ decrease LABEL_NUSES for JUMP_LABEL (trial), not XEXP (note, 0).
+ * jump.c (mark_jump_label_1): Add comment for last change
+ regarding JUMP_LABEL setting.
+ * gcse.c (add_label_notes): Remove conditional that the label is
+ mentioned in insn before adding regnote.
+ * sched-rgn.c (is_cfg_nonregular): Don't return 1 for a
+ single_set insn only feeding a label to a jump through a
+ register that dies there.
+
2007-11-23 Dirk Mueller <dmueller@suse.de>
Richard Guenther <rguenther@suse.de>
We no longer ignore such label references (see LABEL_REF handling in
mark_jump_label for additional information). */
- if (reg_mentioned_p (XEXP (x, 0), insn))
- {
- /* There's no reason for current users to emit jump-insns
- with such a LABEL_REF, so we don't have to handle
- REG_LABEL_TARGET notes. */
- gcc_assert (!JUMP_P (insn));
- REG_NOTES (insn)
- = gen_rtx_INSN_LIST (REG_LABEL_OPERAND, XEXP (x, 0),
- REG_NOTES (insn));
- if (LABEL_P (XEXP (x, 0)))
- LABEL_NUSES (XEXP (x, 0))++;
- }
+ /* There's no reason for current users to emit jump-insns with
+ such a LABEL_REF, so we don't have to handle REG_LABEL_TARGET
+ notes. */
+ gcc_assert (!JUMP_P (insn));
+ REG_NOTES (insn)
+ = gen_rtx_INSN_LIST (REG_LABEL_OPERAND, XEXP (x, 0),
+ REG_NOTES (insn));
+ if (LABEL_P (XEXP (x, 0)))
+ LABEL_NUSES (XEXP (x, 0))++;
+
return;
}
if (insn)
{
if (is_target
+ /* Do not change a previous setting of JUMP_LABEL. If the
+ JUMP_LABEL slot is occupied by a different label,
+ create a note for this label. */
&& (JUMP_LABEL (insn) == NULL || JUMP_LABEL (insn) == label))
JUMP_LABEL (insn) = label;
else
temporarily increment the use count on any referenced
label lest it be deleted by delete_related_insns. */
for (note = REG_NOTES (trial);
- note != NULL;
+ note != NULL_RTX;
note = XEXP (note, 1))
if (REG_NOTE_KIND (note) == REG_LABEL_OPERAND
|| REG_NOTE_KIND (note) == REG_LABEL_TARGET)
== REG_LABEL_OPERAND);
}
if (JUMP_P (trial) && JUMP_LABEL (trial))
- LABEL_NUSES (XEXP (note, 0))++;
+ LABEL_NUSES (JUMP_LABEL (trial))++;
delete_related_insns (trial);
for (note = REG_NOTES (trial);
- note != NULL;
+ note != NULL_RTX;
note = XEXP (note, 1))
if (REG_NOTE_KIND (note) == REG_LABEL_OPERAND
|| REG_NOTE_KIND (note) == REG_LABEL_TARGET)
== REG_LABEL_OPERAND);
}
if (JUMP_P (trial) && JUMP_LABEL (trial))
- LABEL_NUSES (XEXP (note, 0))--;
+ LABEL_NUSES (JUMP_LABEL (trial))--;
}
else
new_thread = next_active_insn (trial);
return true;
}
+ if (find_reg_note (jump_insn, REG_LABEL_TARGET, label))
+ return true;
+
return false;
}
FOR_EACH_BB (b)
FOR_BB_INSNS (b, insn)
{
- /* Check for labels referred to but (at least not directly) as
- jump targets. */
- if (INSN_P (insn)
- && find_reg_note (insn, REG_LABEL_OPERAND, NULL_RTX))
- return 1;
+ rtx note, next, set, dest;
/* If this function has a computed jump, then we consider the cfg
not well structured. */
if (JUMP_P (insn) && computed_jump_p (insn))
return 1;
+
+ if (!INSN_P (insn))
+ continue;
+
+ note = find_reg_note (insn, REG_LABEL_OPERAND, NULL_RTX);
+ if (note == NULL_RTX)
+ continue;
+
+ /* For that label not to be seen as a referred-to label, this
+ must be a single-set which is feeding a jump *only*. This
+ could be a conditional jump with the label split off for
+ machine-specific reasons or a casesi/tablejump. */
+ next = next_nonnote_insn (insn);
+ if (next == NULL_RTX
+ || !JUMP_P (next)
+ || (JUMP_LABEL (next) != XEXP (note, 0)
+ && find_reg_note (next, REG_LABEL_TARGET,
+ XEXP (note, 0)) == NULL_RTX)
+ || BLOCK_FOR_INSN (insn) != BLOCK_FOR_INSN (next))
+ return 1;
+
+ set = single_set (insn);
+ if (set == NULL_RTX)
+ return 1;
+
+ dest = SET_DEST (set);
+ if (!REG_P (dest) || !dead_or_set_p (next, dest))
+ return 1;
}
/* Unreachable loops with more than one basic block are detected