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

Message ID 8738acv4he.fsf@googlemail.com
State New
Headers show

Commit Message

Richard Sandiford Oct. 25, 2014, 10:16 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-protos.h (some_small_symbolic_operand_int):
	Take an rtx and return a bool.
	* config/alpha/alpha.c (some_small_symbolic_operand_int): Likewise.
	Use FOR_EACH_SUBRTX_VAR.
	* config/alpha/predicates.md (some_small_symbolic_operand): Update
	accordingly.

Comments

Richard Henderson Oct. 27, 2014, 3:04 p.m. UTC | #1
On 10/25/2014 03:16 AM, Richard Sandiford wrote:
> gcc/
> 	* config/alpha/alpha-protos.h (some_small_symbolic_operand_int):
> 	Take an rtx and return a bool.
> 	* config/alpha/alpha.c (some_small_symbolic_operand_int): Likewise.
> 	Use FOR_EACH_SUBRTX_VAR.
> 	* config/alpha/predicates.md (some_small_symbolic_operand): Update
> 	accordingly.

Ok.


r~

Patch
diff mbox

Index: gcc/config/alpha/alpha-protos.h
===================================================================
--- gcc/config/alpha/alpha-protos.h	2014-10-25 09:51:29.781922193 +0100
+++ gcc/config/alpha/alpha-protos.h	2014-10-25 09:51:30.191925847 +0100
@@ -112,6 +112,6 @@  extern HOST_WIDE_INT alpha_vms_initial_e
 
 extern rtx unicosmk_add_call_info_word (rtx);
 
-extern int some_small_symbolic_operand_int (rtx *, void *);
+extern bool some_small_symbolic_operand_int (rtx);
 extern int tls_symbolic_operand_1 (rtx, int, int);
 extern rtx resolve_reload_operand (rtx);
Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c	2014-10-25 09:51:29.783922210 +0100
+++ gcc/config/alpha/alpha.c	2014-10-25 09:51:30.192925856 +0100
@@ -1225,16 +1225,20 @@  alpha_function_ok_for_sibcall (tree decl
   return decl_has_samegp (decl);
 }
 
-int
-some_small_symbolic_operand_int (rtx *px, void *data ATTRIBUTE_UNUSED)
+bool
+some_small_symbolic_operand_int (rtx x)
 {
-  rtx x = *px;
-
-  /* Don't re-split.  */
-  if (GET_CODE (x) == LO_SUM)
-    return -1;
-
-  return small_symbolic_operand (x, Pmode) != 0;
+  subrtx_var_iterator::array_type array;
+  FOR_EACH_SUBRTX_VAR (iter, array, x, ALL)
+    {
+      rtx x = *iter;
+      /* Don't re-split.  */
+      if (GET_CODE (x) == LO_SUM)
+	iter.skip_subrtxes ();
+      else if (small_symbolic_operand (x, Pmode))
+	return true;
+    }
+  return false;
 }
 
 rtx
Index: gcc/config/alpha/predicates.md
===================================================================
--- gcc/config/alpha/predicates.md	2014-10-25 09:40:37.750514758 +0100
+++ gcc/config/alpha/predicates.md	2014-10-25 09:51:30.193925865 +0100
@@ -638,7 +638,7 @@  (define_predicate "some_small_symbolic_o
   /* Avoid search unless necessary.  */
   if (!TARGET_EXPLICIT_RELOCS || !reload_completed)
     return false;
-  return for_each_rtx (&op, some_small_symbolic_operand_int, NULL);
+  return some_small_symbolic_operand_int (op);
 })
 
 ;; Accept a register, or a memory if BWX is enabled.