[35/50] regcprop.c:cprop_find_used_regs
diff mbox

Message ID 87r40x7j03.fsf@googlemail.com
State New
Headers show

Commit Message

Richard Sandiford Aug. 3, 2014, 2:19 p.m. UTC
gcc/
	* regcprop.c (cprop_find_used_regs_1): Delete.
	(cprop_find_used_regs): Use FOR_EACH_SUBRTX instead of for_each_rtx.

Comments

Jeff Law Aug. 5, 2014, 9:17 p.m. UTC | #1
On 08/03/14 08:19, Richard Sandiford wrote:
> gcc/
> 	* regcprop.c (cprop_find_used_regs_1): Delete.
> 	(cprop_find_used_regs): Use FOR_EACH_SUBRTX instead of for_each_rtx.
OK.
jeff

Patch
diff mbox

Index: gcc/regcprop.c
===================================================================
--- gcc/regcprop.c	2014-08-03 11:25:29.603148851 +0100
+++ gcc/regcprop.c	2014-08-03 11:25:29.878151570 +0100
@@ -702,33 +702,28 @@  apply_debug_insn_changes (struct value_d
   apply_change_group ();
 }
 
-/* Called via for_each_rtx, for all used registers in a real
-   insn apply DEBUG_INSN changes that change registers to the
-   used register.  */
-
-static int
-cprop_find_used_regs_1 (rtx *loc, void *data)
-{
-  if (REG_P (*loc))
-    {
-      struct value_data *vd = (struct value_data *) data;
-      if (vd->e[REGNO (*loc)].debug_insn_changes)
-	{
-	  apply_debug_insn_changes (vd, REGNO (*loc));
-	  free_debug_insn_changes (vd, REGNO (*loc));
-	}
-    }
-  return 0;
-}
-
 /* Called via note_uses, for all used registers in a real insn
    apply DEBUG_INSN changes that change registers to the used
    registers.  */
 
 static void
-cprop_find_used_regs (rtx *loc, void *vd)
+cprop_find_used_regs (rtx *loc, void *data)
 {
-  for_each_rtx (loc, cprop_find_used_regs_1, vd);
+  struct value_data *const vd = (struct value_data *) data;
+  subrtx_iterator::array_type array;
+  FOR_EACH_SUBRTX (iter, array, *loc, NONCONST)
+    {
+      const_rtx x = *iter;
+      if (REG_P (x))
+	{
+	  unsigned int regno = REGNO (x);
+	  if (vd->e[regno].debug_insn_changes)
+	    {
+	      apply_debug_insn_changes (vd, regno);
+	      free_debug_insn_changes (vd, regno);
+	    }
+	}
+    }
 }
 
 /* Perform the forward copy propagation on basic block BB.  */