[alpha] RFA: Use new rtl iterators in split_small_symbolic_operand
diff mbox

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

Commit Message

Richard Sandiford Oct. 25, 2014, 10:13 a.m. UTC
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.

Comments

Richard Henderson Oct. 27, 2014, 3:07 p.m. UTC | #1
On 10/25/2014 03:13 AM, Richard Sandiford wrote:
> gcc/
> 	* config/alpha/alpha.c: Include rtl-iter.h.
> 	(split_small_symbolic_operand_1): Delete.
> 	(split_small_symbolic_operand): Use FOR_EACH_SUBRTX_PTR.

Ok.


r~

Patch
diff mbox

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;
 }