This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 06/50] combine.c:unmentioned_reg_p


gcc/
	* combine.c: Include rtl-iter.h.
	(unmentioned_reg_p_1): Delete.
	(unmentioned_reg_p): Use FOR_EACH_SUBRTX rather than for_each_rtx.
	Don't handle null rtxes.

Index: gcc/combine.c
===================================================================
--- gcc/combine.c	2014-08-03 11:25:10.479959788 +0100
+++ gcc/combine.c	2014-08-03 11:25:21.711070825 +0100
@@ -106,6 +106,7 @@ Software Foundation; either version 3, o
 #include "obstack.h"
 #include "statistics.h"
 #include "params.h"
+#include "rtl-iter.h"
 
 /* Number of attempts to combine instructions in this function.  */
 
@@ -467,7 +468,6 @@ static void distribute_notes (rtx, rtx,
 static void distribute_links (struct insn_link *);
 static void mark_used_regs_combine (rtx);
 static void record_promoted_value (rtx, rtx);
-static int unmentioned_reg_p_1 (rtx *, void *);
 static bool unmentioned_reg_p (rtx, rtx);
 static int record_truncated_value (rtx *, void *);
 static void record_truncated_values (rtx *, void *);
@@ -13835,23 +13835,6 @@ distribute_links (struct insn_link *link
     }
 }
 
-/* Subroutine of unmentioned_reg_p and callback from for_each_rtx.
-   Check whether the expression pointer to by LOC is a register or
-   memory, and if so return 1 if it isn't mentioned in the rtx EXPR.
-   Otherwise return zero.  */
-
-static int
-unmentioned_reg_p_1 (rtx *loc, void *expr)
-{
-  rtx x = *loc;
-
-  if (x != NULL_RTX
-      && (REG_P (x) || MEM_P (x))
-      && ! reg_mentioned_p (x, (rtx) expr))
-    return 1;
-  return 0;
-}
-
 /* Check for any register or memory mentioned in EQUIV that is not
    mentioned in EXPR.  This is used to restrict EQUIV to "specializations"
    of EXPR where some registers may have been replaced by constants.  */
@@ -13859,7 +13842,15 @@ unmentioned_reg_p_1 (rtx *loc, void *exp
 static bool
 unmentioned_reg_p (rtx equiv, rtx expr)
 {
-  return for_each_rtx (&equiv, unmentioned_reg_p_1, expr);
+  subrtx_iterator::array_type array;
+  FOR_EACH_SUBRTX (iter, array, equiv, NONCONST)
+    {
+      const_rtx x = *iter;
+      if ((REG_P (x) || MEM_P (x))
+	  && !reg_mentioned_p (x, expr))
+	return true;
+    }
+  return false;
 }
 
 DEBUG_FUNCTION void


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]