* rtlanal.c (remove_reg_equal_equiv_notes): New function.
* combine.c (adjust_for_new_dest): Use it.
* postreload.c (reload_combine): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122178
138bc75d-0d04-0410-961f-
82ee72b054a4
2007-02-20 Steven Bosscher <steven@gcc.gnu.org>
2007-02-20 Steven Bosscher <steven@gcc.gnu.org>
+ * rtl.h (remove_reg_equal_equiv_notes): New prototype.
+ * rtlanal.c (remove_reg_equal_equiv_notes): New function.
+ * combine.c (adjust_for_new_dest): Use it.
+ * postreload.c (reload_combine): Likewise.
+
+2007-02-20 Steven Bosscher <steven@gcc.gnu.org>
+
* rtlanal.c (find_reg_equal_equiv_note): Do not find REG_EQ*
notes on an insn with multiple sets, even if single_set returns
non-NULL for that insn.
* rtlanal.c (find_reg_equal_equiv_note): Do not find REG_EQ*
notes on an insn with multiple sets, even if single_set returns
non-NULL for that insn.
static void
adjust_for_new_dest (rtx insn)
{
static void
adjust_for_new_dest (rtx insn)
{
/* For notes, be conservative and simply remove them. */
/* For notes, be conservative and simply remove them. */
- loc = ®_NOTES (insn);
- while (*loc)
- {
- enum reg_note kind = REG_NOTE_KIND (*loc);
- if (kind == REG_EQUAL || kind == REG_EQUIV)
- *loc = XEXP (*loc, 1);
- else
- loc = &XEXP (*loc, 1);
- }
+ remove_reg_equal_equiv_notes (insn);
/* The new insn will have a destination that was previously the destination
of an insn just above it. Call distribute_links to make a LOG_LINK from
/* The new insn will have a destination that was previously the destination
of an insn just above it. Call distribute_links to make a LOG_LINK from
if (apply_change_group ())
{
if (apply_change_group ())
{
/* Delete the reg-reg addition. */
delete_insn (insn);
if (reg_state[regno].offset != const0_rtx)
/* Previous REG_EQUIV / REG_EQUAL notes for PREV
are now invalid. */
/* Delete the reg-reg addition. */
delete_insn (insn);
if (reg_state[regno].offset != const0_rtx)
/* Previous REG_EQUIV / REG_EQUAL notes for PREV
are now invalid. */
- for (np = ®_NOTES (prev); *np;)
- {
- if (REG_NOTE_KIND (*np) == REG_EQUAL
- || REG_NOTE_KIND (*np) == REG_EQUIV)
- *np = XEXP (*np, 1);
- else
- np = &XEXP (*np, 1);
- }
+ remove_reg_equal_equiv_notes (prev);
reg_state[regno].use_index = RELOAD_COMBINE_MAX_USES;
reg_state[REGNO (const_reg)].store_ruid
reg_state[regno].use_index = RELOAD_COMBINE_MAX_USES;
reg_state[REGNO (const_reg)].store_ruid
extern int find_regno_fusage (rtx, enum rtx_code, unsigned int);
extern int pure_call_p (rtx);
extern void remove_note (rtx, rtx);
extern int find_regno_fusage (rtx, enum rtx_code, unsigned int);
extern int pure_call_p (rtx);
extern void remove_note (rtx, rtx);
+extern void remove_reg_equal_equiv_notes (rtx);
extern int side_effects_p (rtx);
extern int volatile_refs_p (rtx);
extern int volatile_insn_p (rtx);
extern int side_effects_p (rtx);
extern int volatile_refs_p (rtx);
extern int volatile_insn_p (rtx);
+/* Remove REG_EQUAL and/or REG_EQUIV notes if INSN has such notes. */
+
+void
+remove_reg_equal_equiv_notes (rtx insn)
+{
+ rtx *loc;
+
+ loc = ®_NOTES (insn);
+ while (*loc)
+ {
+ enum reg_note kind = REG_NOTE_KIND (*loc);
+ if (kind == REG_EQUAL || kind == REG_EQUIV)
+ *loc = XEXP (*loc, 1);
+ else
+ loc = &XEXP (*loc, 1);
+ }
+}
+
/* Search LISTP (an EXPR_LIST) for an entry whose first operand is NODE and
return 1 if it is found. A simple equality test is used to determine if
NODE matches. */
/* Search LISTP (an EXPR_LIST) for an entry whose first operand is NODE and
return 1 if it is found. A simple equality test is used to determine if
NODE matches. */