diff mbox

[x86] RFA: Use new rtl iterators in x86_extended_reg_mentioned_p

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

Commit Message

Richard Sandiford Oct. 25, 2014, 9:03 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 x86_64-linux-gnu, and also by a boostrap.  OK to install?

Thanks,
Richard


gcc/
	* config/i386/i386.c (extended_reg_mentioned_1): Delete.
	(x86_extended_reg_mentioned_p): Use FOR_EACH_SUBRTX.

Comments

Uros Bizjak Oct. 27, 2014, 9:34 a.m. UTC | #1
On Sat, Oct 25, 2014 at 11:03 AM, Richard Sandiford
<rdsandiford@googlemail.com> 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 x86_64-linux-gnu, and also by a boostrap.  OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
>         * config/i386/i386.c (extended_reg_mentioned_1): Delete.
>         (x86_extended_reg_mentioned_p): Use FOR_EACH_SUBRTX.

OK.

Thanks,
Uros.
diff mbox

Patch

Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	2014-10-25 09:51:15.189792126 +0100
+++ gcc/config/i386/i386.c	2014-10-25 09:51:15.606795843 +0100
@@ -39688,25 +39688,20 @@  x86_extended_QIreg_mentioned_p (rtx_insn
   return false;
 }
 
-/* Return nonzero when P points to register encoded via REX prefix.
-   Called via for_each_rtx.  */
-static int
-extended_reg_mentioned_1 (rtx *p, void *)
-{
-   unsigned int regno;
-   if (!REG_P (*p))
-     return 0;
-   regno = REGNO (*p);
-   return REX_INT_REGNO_P (regno) || REX_SSE_REGNO_P (regno);
-}
-
 /* Return true when INSN mentions register that must be encoded using REX
    prefix.  */
 bool
 x86_extended_reg_mentioned_p (rtx insn)
 {
-  return for_each_rtx (INSN_P (insn) ? &PATTERN (insn) : &insn,
-		       extended_reg_mentioned_1, NULL);
+  subrtx_iterator::array_type array;
+  FOR_EACH_SUBRTX (iter, array, INSN_P (insn) ? PATTERN (insn) : insn, NONCONST)
+    {
+      const_rtx x = *iter;
+      if (REG_P (x)
+	  && (REX_INT_REGNO_P (REGNO (x)) || REX_SSE_REGNO_P (REGNO (x))))
+	return true;
+    }
+  return false;
 }
 
 /* If profitable, negate (without causing overflow) integer constant