public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [alpha] RFA: Use new rtl iterators in split_small_symbolic_operand
@ 2014-10-25 10:14 Richard Sandiford
  2014-10-27 15:10 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2014-10-25 10:14 UTC (permalink / raw)
  To: gcc-patches; +Cc: rth

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [alpha] RFA: Use new rtl iterators in split_small_symbolic_operand
  2014-10-25 10:14 [alpha] RFA: Use new rtl iterators in split_small_symbolic_operand Richard Sandiford
@ 2014-10-27 15:10 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2014-10-27 15:10 UTC (permalink / raw)
  To: gcc-patches, rdsandiford

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~

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-27 15:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-25 10:14 [alpha] RFA: Use new rtl iterators in split_small_symbolic_operand Richard Sandiford
2014-10-27 15:10 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).