This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[alpha] RFA: Use new rtl iterators in split_small_symbolic_operand


This is part of a series to remove uses of for_each_rtx from the ports.

Tested by making sure there were no code changes for gcc.dg, gcc.c-torture
and g++.dg for alpha-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
	* config/alpha/alpha.c: Include rtl-iter.h.
	(split_small_symbolic_operand_1): Delete.
	(split_small_symbolic_operand): Use FOR_EACH_SUBRTX_PTR.

Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c	2014-10-25 09:40:37.907516019 +0100
+++ gcc/config/alpha/alpha.c	2014-10-25 09:51:29.006915284 +0100
@@ -80,6 +80,7 @@ the Free Software Foundation; either ver
 #include "opts.h"
 #include "params.h"
 #include "builtins.h"
+#include "rtl-iter.h"
 
 /* Specify which cpu to schedule for.  */
 enum processor_type alpha_tune;
@@ -1236,30 +1237,24 @@ some_small_symbolic_operand_int (rtx *px
   return small_symbolic_operand (x, Pmode) != 0;
 }
 
-static int
-split_small_symbolic_operand_1 (rtx *px, void *data ATTRIBUTE_UNUSED)
-{
-  rtx x = *px;
-
-  /* Don't re-split.  */
-  if (GET_CODE (x) == LO_SUM)
-    return -1;
-
-  if (small_symbolic_operand (x, Pmode))
-    {
-      x = gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, x);
-      *px = x;
-      return -1;
-    }
-
-  return 0;
-}
-
 rtx
 split_small_symbolic_operand (rtx x)
 {
   x = copy_insn (x);
-  for_each_rtx (&x, split_small_symbolic_operand_1, NULL);
+  subrtx_ptr_iterator::array_type array;
+  FOR_EACH_SUBRTX_PTR (iter, array, &x, ALL)
+    {
+      rtx *ptr = *iter;
+      rtx x = *ptr;
+      /* Don't re-split.  */
+      if (GET_CODE (x) == LO_SUM)
+	iter.skip_subrtxes ();
+      else if (small_symbolic_operand (x, Pmode))
+	{
+	  *ptr = gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, x);
+	  iter.skip_subrtxes ();
+	}
+    }
   return x;
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]