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

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

Commit Message

Richard Sandiford Nov. 5, 2014, 11:52 a.m. UTC
Tested in the same way as the aarch-common.c patch.  OK to install?

Thanks,
Richard


gcc/
	* config/arm/arm.c (arm_note_pic_base): Delete.
	(arm_cannot_copy_insn_p): Use FOR_EACH_SUBRTX.

Comments

Richard Earnshaw Nov. 7, 2014, 12:24 p.m. UTC | #1
On 05/11/14 11:52, Richard Sandiford wrote:
> Tested in the same way as the aarch-common.c patch.  OK to install?
> 
> Thanks,
> Richard
> 
> 
> gcc/
> 	* config/arm/arm.c (arm_note_pic_base): Delete.
> 	(arm_cannot_copy_insn_p): Use FOR_EACH_SUBRTX.
> 

OK.

R.

> Index: gcc/config/arm/arm.c
> ===================================================================
> --- gcc/config/arm/arm.c	2014-11-05 11:48:55.030053470 +0000
> +++ gcc/config/arm/arm.c	2014-11-05 11:48:57.406073646 +0000
> @@ -13157,16 +13157,6 @@ tls_mentioned_p (rtx x)
>  
>  /* Must not copy any rtx that uses a pc-relative address.  */
>  
> -static int
> -arm_note_pic_base (rtx *x, void *date ATTRIBUTE_UNUSED)
> -{
> -  if (GET_CODE (*x) == UNSPEC
> -      && (XINT (*x, 1) == UNSPEC_PIC_BASE
> -	  || XINT (*x, 1) == UNSPEC_PIC_UNIFIED))
> -    return 1;
> -  return 0;
> -}
> -
>  static bool
>  arm_cannot_copy_insn_p (rtx_insn *insn)
>  {
> @@ -13175,7 +13165,16 @@ arm_cannot_copy_insn_p (rtx_insn *insn)
>    if (recog_memoized (insn) == CODE_FOR_tlscall)
>      return true;
>  
> -  return for_each_rtx (&PATTERN (insn), arm_note_pic_base, NULL);
> +  subrtx_iterator::array_type array;
> +  FOR_EACH_SUBRTX (iter, array, PATTERN (insn), ALL)
> +    {
> +      const_rtx x = *iter;
> +      if (GET_CODE (x) == UNSPEC
> +	  && (XINT (x, 1) == UNSPEC_PIC_BASE
> +	      || XINT (x, 1) == UNSPEC_PIC_UNIFIED))
> +	return true;
> +    }
> +  return false;
>  }
>  
>  enum rtx_code
>

Patch
diff mbox

Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c	2014-11-05 11:48:55.030053470 +0000
+++ gcc/config/arm/arm.c	2014-11-05 11:48:57.406073646 +0000
@@ -13157,16 +13157,6 @@  tls_mentioned_p (rtx x)
 
 /* Must not copy any rtx that uses a pc-relative address.  */
 
-static int
-arm_note_pic_base (rtx *x, void *date ATTRIBUTE_UNUSED)
-{
-  if (GET_CODE (*x) == UNSPEC
-      && (XINT (*x, 1) == UNSPEC_PIC_BASE
-	  || XINT (*x, 1) == UNSPEC_PIC_UNIFIED))
-    return 1;
-  return 0;
-}
-
 static bool
 arm_cannot_copy_insn_p (rtx_insn *insn)
 {
@@ -13175,7 +13165,16 @@  arm_cannot_copy_insn_p (rtx_insn *insn)
   if (recog_memoized (insn) == CODE_FOR_tlscall)
     return true;
 
-  return for_each_rtx (&PATTERN (insn), arm_note_pic_base, NULL);
+  subrtx_iterator::array_type array;
+  FOR_EACH_SUBRTX (iter, array, PATTERN (insn), ALL)
+    {
+      const_rtx x = *iter;
+      if (GET_CODE (x) == UNSPEC
+	  && (XINT (x, 1) == UNSPEC_PIC_BASE
+	      || XINT (x, 1) == UNSPEC_PIC_UNIFIED))
+	return true;
+    }
+  return false;
 }
 
 enum rtx_code