[spu] RFA: Use new rtl iterators in ea_symbol_ref_p
diff mbox

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

Commit Message

Richard Sandiford Oct. 25, 2014, 8:57 a.m. UTC
Make spu.c use FOR_EACH_SUBRTX instead of for_each_rtx, as 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 spu-elf.  OK to install?

Thanks,
Richard


gcc/
	* config/spu/spu.c: Include rtl-iter.h
	(ea_symbol_ref): Replace with...
	(ea_symbol_ref_p): ...this new function.
	(spu_legitimate_address_p): Update call accordingly.
	(spu_legitimate_constant_p): Likewise.  Use FOR_EACH_SUBRTX.

Patch
diff mbox

Index: gcc/config/spu/spu.c
===================================================================
--- gcc/config/spu/spu.c	2014-10-25 09:48:53.108538042 +0100
+++ gcc/config/spu/spu.c	2014-10-25 09:51:14.796788623 +0100
@@ -69,6 +69,7 @@ 
 #include "dumpfile.h"
 #include "cfgloop.h"
 #include "builtins.h"
+#include "rtl-iter.h"
 
 /* Builtin types, data and prototypes. */
 
@@ -3466,10 +3467,9 @@  exp2_immediate_p (rtx op, enum machine_m
 
 /* Return true if X is a SYMBOL_REF to an __ea qualified variable.  */
 
-static int
-ea_symbol_ref (rtx *px, void *data ATTRIBUTE_UNUSED)
+static bool
+ea_symbol_ref_p (const_rtx x)
 {
-  rtx x = *px;
   tree decl;
 
   if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS)
@@ -3496,13 +3496,15 @@  ea_symbol_ref (rtx *px, void *data ATTRI
 bool
 spu_legitimate_constant_p (enum machine_mode mode, rtx x)
 {
+  subrtx_iterator::array_type array;
   if (GET_CODE (x) == HIGH)
     x = XEXP (x, 0);
 
   /* Reject any __ea qualified reference.  These can't appear in
      instructions but must be forced to the constant pool.  */
-  if (for_each_rtx (&x, ea_symbol_ref, 0))
-    return 0;
+  FOR_EACH_SUBRTX (iter, array, x, ALL)
+    if (ea_symbol_ref_p (*iter))
+      return 0;
 
   /* V4SI with all identical symbols is valid. */
   if (!flag_pic
@@ -3548,7 +3550,7 @@  spu_legitimate_address_p (enum machine_m
     case CONST:
       /* Keep __ea references until reload so that spu_expand_mov can see them
 	 in MEMs.  */
-      if (ea_symbol_ref (&x, 0))
+      if (ea_symbol_ref_p (x))
 	return !reload_in_progress && !reload_completed;
       return !TARGET_LARGE_MEM;