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

Thanks,
Richard


gcc/
        * config/m68k/m68k.c (m68k_tls_reference_p_1): Delete.
        (m68k_tls_reference_p): Use FOR_EACH_SUBRTX_VAR.

Index: gcc/config/m68k/m68k.c
===================================================================
--- gcc/config/m68k/m68k.c      2014-10-25 09:51:16.781806316 +0100
+++ gcc/config/m68k/m68k.c      2014-10-25 09:51:17.194809998 +0100
@@ -2671,22 +2671,6 @@ m68k_tls_symbol_p (rtx x)
   return SYMBOL_REF_TLS_MODEL (x) != 0;
 }
 
-/* Helper for m68k_tls_referenced_p.  */
-
-static int
-m68k_tls_reference_p_1 (rtx *x_ptr, void *data ATTRIBUTE_UNUSED)
-{
-  /* Note: this is not the same as m68k_tls_symbol_p.  */
-  if (GET_CODE (*x_ptr) == SYMBOL_REF)
-    return SYMBOL_REF_TLS_MODEL (*x_ptr) != 0 ? 1 : 0;
-
-  /* Don't recurse into legitimate TLS references.  */
-  if (m68k_tls_reference_p (*x_ptr, true))
-    return -1;
-
-  return 0;
-}
-
 /* If !LEGITIMATE_P, return true if X is a TLS symbol reference,
    though illegitimate one.
    If LEGITIMATE_P, return true if X is a legitimate TLS symbol reference.  */
@@ -2698,7 +2682,22 @@ m68k_tls_reference_p (rtx x, bool legiti
     return false;
 
   if (!legitimate_p)
-    return for_each_rtx (&x, m68k_tls_reference_p_1, NULL) == 1 ? true : false;
+    {
+      subrtx_var_iterator::array_type array;
+      FOR_EACH_SUBRTX_VAR (iter, array, x, ALL)
+       {
+         rtx x = *iter;
+
+         /* Note: this is not the same as m68k_tls_symbol_p.  */
+         if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) != 0)
+           return true;
+
+         /* Don't recurse into legitimate TLS references.  */
+         if (m68k_tls_reference_p (x, true))
+           iter.skip_subrtxes ();
+       }
+      return false;
+    }
   else
     {
       enum m68k_reloc reloc = RELOC_GOT;

Reply via email to