Fix reload ICE with define-split
Roman Zippel
zippel@linux-m68k.org
Fri Feb 23 18:46:00 GMT 2007
Hi,
On Fri, 23 Feb 2007, Nathan Sidwell wrote:
> After discussing this with Richard Sandiford, we agreed that the place to fix
> this was in the middle end, and not in m68k specific code. To that end, this
> patch adds an update_reg_inc_notes_between function and calls it after
> splitting an instruction.
I have a similiar patch, which I think is a bit better. try_split()
already tries to recreate notes, so the patch below adds the hook for
REG_INC notes there.
bye, Roman
* emit-rtl.c (find_auto_inc): New.
(try_split): recreate REG_INC notes.
Index: gcc-4.1/gcc/emit-rtl.c
===================================================================
--- gcc-4.1.orig/gcc/emit-rtl.c
+++ gcc-4.1/gcc/emit-rtl.c
@@ -3103,6 +3103,34 @@ prev_cc0_setter (rtx insn)
}
#endif
+#ifdef AUTO_INC_DEC
+static int
+find_auto_inc (rtx *xp, void *data)
+{
+ rtx x = *xp;
+ rtx reg = data;
+
+ if (GET_RTX_CLASS (GET_CODE (x)) != RTX_AUTOINC)
+ return 0;
+
+ switch (GET_CODE (x)) {
+ case PRE_DEC:
+ case PRE_INC:
+ case POST_DEC:
+ case POST_INC:
+ case PRE_MODIFY:
+ case POST_MODIFY:
+ if (rtx_equal_p (reg, XEXP (x, 0)))
+ return 1;
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ return -1;
+}
+#endif
+
/* Increment the label uses for all labels present in rtx. */
static void
@@ -3268,6 +3296,18 @@ try_split (rtx pat, rtx trial, int last)
}
break;
+#ifdef AUTO_INC_DEC
+ case REG_INC:
+ for (insn = insn_last; insn; insn = PREV_INSN (insn))
+ {
+ rtx reg = XEXP (note, 0);
+ if (for_each_rtx (&PATTERN (insn), find_auto_inc, reg) > 0)
+ REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_INC, reg,
+ REG_NOTES (insn));
+ }
+ break;
+#endif
+
default:
break;
}
More information about the Gcc-patches
mailing list