public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [ARC] RFA: Use new rtl iterators in arc_write_ext_corereg
@ 2014-10-25 10:02 Richard Sandiford
  2014-11-02 18:42 ` Joern Rennecke
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2014-10-25 10:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: joern.rennecke

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 arc-elf.  OK to install?

Thanks,
Richard


gcc/
	* config/arc/arc.c (write_ext_corereg_1): Delete.
	(arc_write_ext_corereg): Use FOR_EACH_SUBRTX.

Index: gcc/config/arc/arc.c
===================================================================
--- gcc/config/arc/arc.c	2014-10-25 09:51:26.279890977 +0100
+++ gcc/config/arc/arc.c	2014-10-25 09:51:26.656894338 +0100
@@ -8423,34 +8423,30 @@ arc_predicate_delay_insns (void)
   be hoisted out into a delay slot, a basic block can also be emptied this
   way, and branch and/or fall through targets be redirected.  Hence we don't
   want such writes in a delay slot.  */
-/* Called by arc_write_ext_corereg via for_each_rtx.  */
-
-static int
-write_ext_corereg_1 (rtx *xp, void *data ATTRIBUTE_UNUSED)
-{
-  rtx x = *xp;
-  rtx dest;
-
-  switch (GET_CODE (x))
-    {
-    case SET: case POST_INC: case POST_DEC: case PRE_INC: case PRE_DEC:
-      break;
-    default:
-    /* This is also fine for PRE/POST_MODIFY, because they contain a SET.  */
-      return 0;
-    }
-  dest = XEXP (x, 0);
-  if (REG_P (dest) && REGNO (dest) >= 32 && REGNO (dest) < 61)
-    return 1;
-  return 0;
-}
 
 /* Return nonzreo iff INSN writes to an extension core register.  */
 
 int
 arc_write_ext_corereg (rtx insn)
 {
-  return for_each_rtx (&PATTERN (insn), write_ext_corereg_1, 0);
+  subrtx_iterator::array_type array;
+  FOR_EACH_SUBRTX (iter, array, PATTERN (insn), NONCONST)
+    {
+      const_rtx x = *iter;
+      switch (GET_CODE (x))
+	{
+	case SET: case POST_INC: case POST_DEC: case PRE_INC: case PRE_DEC:
+	  break;
+	default:
+	  /* This is also fine for PRE/POST_MODIFY, because they
+	     contain a SET.  */
+	  continue;
+	}
+      const_rtx dest = XEXP (x, 0);
+      if (REG_P (dest) && REGNO (dest) >= 32 && REGNO (dest) < 61)
+	return 1;
+    }
+  return 0;
 }
 
 /* This is like the hook, but returns NULL when it can't / won't generate

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

* Re: [ARC] RFA: Use new rtl iterators in arc_write_ext_corereg
  2014-10-25 10:02 [ARC] RFA: Use new rtl iterators in arc_write_ext_corereg Richard Sandiford
@ 2014-11-02 18:42 ` Joern Rennecke
  0 siblings, 0 replies; 2+ messages in thread
From: Joern Rennecke @ 2014-11-02 18:42 UTC (permalink / raw)
  To: GCC Patches, Joern Rennecke, rdsandiford

On 25 October 2014 10:58, Richard Sandiford <rdsandiford@googlemail.com> wrote:
> 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 arc-elf.  OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
>         * config/arc/arc.c (write_ext_corereg_1): Delete.
>         (arc_write_ext_corereg): Use FOR_EACH_SUBRTX.

OK.

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

end of thread, other threads:[~2014-11-02 18:42 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:02 [ARC] RFA: Use new rtl iterators in arc_write_ext_corereg Richard Sandiford
2014-11-02 18:42 ` Joern Rennecke

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).