2014-08-18 David Malcolm <dmalcolm@redhat.com>
+ * rtl.h (for_each_rtx_in_insn): New function.
+ * rtlanal.c (for_each_rtx_in_insn): Likewise.
+
+2014-08-18 David Malcolm <dmalcolm@redhat.com>
+
* coretypes.h (class rtx_insn): Add forward declaration.
* rtl.h: Include is-a.h.
typedef int (*rtx_function) (rtx *, void *);
extern int for_each_rtx (rtx *, rtx_function, void *);
+extern int for_each_rtx_in_insn (rtx_insn **, rtx_function, void *);
/* Callback for for_each_inc_dec, to process the autoinc operation OP
within MEM that sets DEST to SRC + SRCOFF, or SRC if SRCOFF is
return for_each_rtx_1 (*x, i, f, data);
}
+/* Like "for_each_rtx", but for calling on an rtx_insn **. */
+
+int
+for_each_rtx_in_insn (rtx_insn **insn, rtx_function f, void *data)
+{
+ rtx insn_as_rtx = *insn;
+ int result;
+
+ result = for_each_rtx (&insn_as_rtx, f, data);
+
+ if (insn_as_rtx != *insn)
+ *insn = safe_as_a <rtx_insn *> (insn_as_rtx);
+
+ return result;
+}
+
\f
/* Data structure that holds the internal state communicated between