gcc/
        * rtl.h (for_each_rtx_in_insn): New function.
        * rtlanal.c (for_each_rtx_in_insn): Likewise.
---
 gcc/rtl.h     |  1 +
 gcc/rtlanal.c | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/gcc/rtl.h b/gcc/rtl.h
index 0858230..3e37ed0 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2356,6 +2356,7 @@ extern int computed_jump_p (const_rtx);
 
 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
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 82cfc1bf..5e2e908 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -3011,6 +3011,22 @@ for_each_rtx (rtx *x, rtx_function f, void *data)
   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 = as_a_nullable <rtx_insn *> (insn_as_rtx);
+
+  return result;
+}
+
 
 
 /* Data structure that holds the internal state communicated between
-- 
1.8.5.3

Reply via email to