diff mbox

[alpha] RFA: Use new rtl iterators in alpha_find_lo_sum_using_gp

Message ID 877fzov4js.fsf@googlemail.com
State New
Headers show

Commit Message

Richard Sandiford Oct. 25, 2014, 10:15 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 (alpha_find_lo_sum_using_gp): Return
	a bool.
	* config/alpha/alpha.c (find_lo_sum_using_gp): Delete.
	(alpha_find_lo_sum_using_gp): Use FOR_EACH_SUBRTX.  Return a bool.

Comments

Richard Henderson Oct. 27, 2014, 3:05 p.m. UTC | #1
On 10/25/2014 03:15 AM, Richard Sandiford 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 alpha-linux-gnu.  OK to install?
> 
> Thanks,
> Richard
> 
> 
> gcc/
> 	* config/alpha/alpha-protos.h (alpha_find_lo_sum_using_gp): Return
> 	a bool.
> 	* config/alpha/alpha.c (find_lo_sum_using_gp): Delete.
> 	(alpha_find_lo_sum_using_gp): Use FOR_EACH_SUBRTX.  Return a bool.

Ok.


r~
diff mbox

Patch

Index: gcc/config/alpha/alpha-protos.h
===================================================================
--- gcc/config/alpha/alpha-protos.h	2014-10-25 09:40:37.813515264 +0100
+++ gcc/config/alpha/alpha-protos.h	2014-10-25 09:51:29.781922193 +0100
@@ -75,7 +75,7 @@  extern rtx function_value (const_tree, c
 extern void alpha_start_function (FILE *, const char *, tree);
 extern void alpha_end_function (FILE *, const char *, tree);
 
-extern int alpha_find_lo_sum_using_gp (rtx);
+extern bool alpha_find_lo_sum_using_gp (rtx);
 
 #ifdef REAL_VALUE_TYPE
 extern int check_float_value (enum machine_mode, REAL_VALUE_TYPE *, int);
Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c	2014-10-25 09:51:29.394918743 +0100
+++ gcc/config/alpha/alpha.c	2014-10-25 09:51:29.783922210 +0100
@@ -7554,16 +7554,17 @@  vms_output_aligned_decl_common(FILE *fil
 
 #endif
 
-static int
-find_lo_sum_using_gp (rtx *px, void *data ATTRIBUTE_UNUSED)
-{
-  return GET_CODE (*px) == LO_SUM && XEXP (*px, 0) == pic_offset_table_rtx;
-}
-
-int
+bool
 alpha_find_lo_sum_using_gp (rtx insn)
 {
-  return for_each_rtx (&PATTERN (insn), find_lo_sum_using_gp, NULL) > 0;
+  subrtx_iterator::array_type array;
+  FOR_EACH_SUBRTX (iter, array, PATTERN (insn), NONCONST)
+    {
+      const_rtx x = *iter;
+      if (GET_CODE (x) == LO_SUM && XEXP (x, 0) == pic_offset_table_rtx)
+	return true;
+    }
+  return false;
 }
 
 static int