[AArch64] RFA: Use new rtl iterators in arm_cannot_copy_insn
diff mbox

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

Commit Message

Richard Sandiford Nov. 5, 2014, 11:53 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 aarch64-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
	* config/aarch64/aarch64.c: Include rtl-iter.h.
	(aarch64_tls_operand_p_1): Delete.
	(aarch64_tls_operand_p): Use FOR_EACH_SUBRTX.

Comments

Richard Earnshaw Nov. 7, 2014, 12:25 p.m. UTC | #1
On 05/11/14 11:53, 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 aarch64-linux-gnu.  OK to install?
> 
> Thanks,
> Richard
> 
> 
> gcc/
> 	* config/aarch64/aarch64.c: Include rtl-iter.h.
> 	(aarch64_tls_operand_p_1): Delete.
> 	(aarch64_tls_operand_p): Use FOR_EACH_SUBRTX.
> 

OK.

R.

> Index: gcc/config/aarch64/aarch64.c
> ===================================================================
> --- gcc/config/aarch64/aarch64.c	2014-11-02 19:59:26.977231633 +0000
> +++ gcc/config/aarch64/aarch64.c	2014-11-05 11:48:59.982095520 +0000
> @@ -2791,28 +2791,23 @@ aarch64_output_mi_thunk (FILE *file, tre
>    reload_completed = 0;
>  }
>  
> -static int
> -aarch64_tls_operand_p_1 (rtx *x, void *data ATTRIBUTE_UNUSED)
> -{
> -  if (GET_CODE (*x) == SYMBOL_REF)
> -    return SYMBOL_REF_TLS_MODEL (*x) != 0;
> -
> -  /* Don't recurse into UNSPEC_TLS looking for TLS symbols; these are
> -     TLS offsets, not real symbol references.  */
> -  if (GET_CODE (*x) == UNSPEC
> -      && XINT (*x, 1) == UNSPEC_TLS)
> -    return -1;
> -
> -  return 0;
> -}
> -
>  static bool
>  aarch64_tls_referenced_p (rtx x)
>  {
>    if (!TARGET_HAVE_TLS)
>      return false;
> -
> -  return for_each_rtx (&x, aarch64_tls_operand_p_1, NULL);
> +  subrtx_iterator::array_type array;
> +  FOR_EACH_SUBRTX (iter, array, x, ALL)
> +    {
> +      const_rtx x = *iter;
> +      if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) != 0)
> +	return true;
> +      /* Don't recurse into UNSPEC_TLS looking for TLS symbols; these are
> +	 TLS offsets, not real symbol references.  */
> +      if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_TLS)
> +	iter.skip_subrtxes ();
> +    }
> +  return false;
>  }
>  
>  
>

Patch
diff mbox

Index: gcc/config/aarch64/aarch64.c
===================================================================
--- gcc/config/aarch64/aarch64.c	2014-11-02 19:59:26.977231633 +0000
+++ gcc/config/aarch64/aarch64.c	2014-11-05 11:48:59.982095520 +0000
@@ -2791,28 +2791,23 @@  aarch64_output_mi_thunk (FILE *file, tre
   reload_completed = 0;
 }
 
-static int
-aarch64_tls_operand_p_1 (rtx *x, void *data ATTRIBUTE_UNUSED)
-{
-  if (GET_CODE (*x) == SYMBOL_REF)
-    return SYMBOL_REF_TLS_MODEL (*x) != 0;
-
-  /* Don't recurse into UNSPEC_TLS looking for TLS symbols; these are
-     TLS offsets, not real symbol references.  */
-  if (GET_CODE (*x) == UNSPEC
-      && XINT (*x, 1) == UNSPEC_TLS)
-    return -1;
-
-  return 0;
-}
-
 static bool
 aarch64_tls_referenced_p (rtx x)
 {
   if (!TARGET_HAVE_TLS)
     return false;
-
-  return for_each_rtx (&x, aarch64_tls_operand_p_1, NULL);
+  subrtx_iterator::array_type array;
+  FOR_EACH_SUBRTX (iter, array, x, ALL)
+    {
+      const_rtx x = *iter;
+      if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) != 0)
+	return true;
+      /* Don't recurse into UNSPEC_TLS looking for TLS symbols; these are
+	 TLS offsets, not real symbol references.  */
+      if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_TLS)
+	iter.skip_subrtxes ();
+    }
+  return false;
 }