[43/50] store-motion.c:extract_mentioned_regs
diff mbox

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

Commit Message

Richard Sandiford Aug. 3, 2014, 2:34 p.m. UTC
gcc/
	* store-motion.c: Include rtl-iter.h.
	(extract_mentioned_regs_1): Delete.
	(extract_mentioned_regs): Use FOR_EACH_SUBRTX_VAR rather than
	for_each_rtx to iterate over subrtxes.

Comments

Jeff Law Aug. 5, 2014, 9:20 p.m. UTC | #1
On 08/03/14 08:34, Richard Sandiford wrote:
> gcc/
> 	* store-motion.c: Include rtl-iter.h.
> 	(extract_mentioned_regs_1): Delete.
> 	(extract_mentioned_regs): Use FOR_EACH_SUBRTX_VAR rather than
> 	for_each_rtx to iterate over subrtxes.
OK.
jeff

Patch
diff mbox

Index: gcc/store-motion.c
===================================================================
--- gcc/store-motion.c	2014-08-03 11:12:52.402662718 +0100
+++ gcc/store-motion.c	2014-08-03 11:25:32.215174675 +0100
@@ -42,6 +42,7 @@  Software Foundation; either version 3, o
 #include "hash-table.h"
 #include "df.h"
 #include "dbgcnt.h"
+#include "rtl-iter.h"
 
 /* This pass implements downward store motion.
    As of May 1, 2009, the pass is not enabled by default on any target,
@@ -278,19 +279,6 @@  store_ops_ok (const_rtx x, int *regs_set
   return true;
 }
 
-/* Helper for extract_mentioned_regs.  */
-
-static int
-extract_mentioned_regs_1 (rtx *loc, void *data)
-{
-  rtx *mentioned_regs_p = (rtx *) data;
-
-  if (REG_P (*loc))
-    *mentioned_regs_p = alloc_EXPR_LIST (0, *loc, *mentioned_regs_p);
-
-  return 0;
-}
-
 /* Returns a list of registers mentioned in X.
    FIXME: A regset would be prettier and less expensive.  */
 
@@ -298,7 +286,13 @@  extract_mentioned_regs_1 (rtx *loc, void
 extract_mentioned_regs (rtx x)
 {
   rtx mentioned_regs = NULL;
-  for_each_rtx (&x, extract_mentioned_regs_1, &mentioned_regs);
+  subrtx_var_iterator::array_type array;
+  FOR_EACH_SUBRTX_VAR (iter, array, x, NONCONST)
+    {
+      rtx x = *iter;
+      if (REG_P (x))
+	mentioned_regs = alloc_EXPR_LIST (0, x, mentioned_regs);
+    }
   return mentioned_regs;
 }