[MIPS] RFA: Use new rtl iterators in mips_need_noat_wrapper_p
diff mbox

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

Commit Message

Richard Sandiford Oct. 25, 2014, 9:41 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 mips64-elf.  OK to install?

Thanks,
Richard


gcc/
	* config/mips/mips.c (mips_at_reg_p): Delete.
	(mips_need_noat_wrapper_p): Use FOR_EACH_SUBRTX.

Comments

Matthew Fortune Oct. 25, 2014, 8:57 p.m. UTC | #1
> gcc/
> 	* config/mips/mips.c (mips_at_reg_p): Delete.
> 	(mips_need_noat_wrapper_p): Use FOR_EACH_SUBRTX.

OK. That should be the last one to cover all changes to use
new rtl iterators for MIPS.

Thanks for splitting this up per change it made it easy to read
through.

Matthew

Patch
diff mbox

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	2014-10-25 09:51:21.912852052 +0100
+++ gcc/config/mips/mips.c	2014-10-25 09:51:22.291855430 +0100
@@ -17528,26 +17528,20 @@  mips_epilogue_uses (unsigned int regno)
   return false;
 }
 
-/* A for_each_rtx callback.  Stop the search if *X is an AT register.  */
-
-static int
-mips_at_reg_p (rtx *x, void *data ATTRIBUTE_UNUSED)
-{
-  return REG_P (*x) && REGNO (*x) == AT_REGNUM;
-}
-
 /* Return true if INSN needs to be wrapped in ".set noat".
    INSN has NOPERANDS operands, stored in OPVEC.  */
 
 static bool
 mips_need_noat_wrapper_p (rtx_insn *insn, rtx *opvec, int noperands)
 {
-  int i;
-
   if (recog_memoized (insn) >= 0)
-    for (i = 0; i < noperands; i++)
-      if (for_each_rtx (&opvec[i], mips_at_reg_p, NULL))
-	return true;
+    {
+      subrtx_iterator::array_type array;
+      for (int i = 0; i < noperands; i++)
+	FOR_EACH_SUBRTX (iter, array, opvec[i], NONCONST)
+	  if (REG_P (*iter) && REGNO (*iter) == AT_REGNUM)
+	    return true;
+    }
   return false;
 }