[44/50] var-tracking.c:rtx_debug_expr_p
diff mbox

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

Commit Message

Richard Sandiford Aug. 3, 2014, 2:35 p.m. UTC
gcc/
	* var-tracking.c: Include rtl-iter.h.
	(rtx_debug_expr_p): Turn from being a for_each_rtx callback
	to being a function that examines each subrtx itself.
	(use_type): Update accordingly.

Comments

Jeff Law Aug. 5, 2014, 9:20 p.m. UTC | #1
On 08/03/14 08:35, Richard Sandiford wrote:
> gcc/
> 	* var-tracking.c: Include rtl-iter.h.
> 	(rtx_debug_expr_p): Turn from being a for_each_rtx callback
> 	to being a function that examines each subrtx itself.
> 	(use_type): Update accordingly.
OK.
jeff

Patch
diff mbox

Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c	2014-08-03 11:23:46.439128910 +0100
+++ gcc/var-tracking.c	2014-08-03 11:25:32.493177423 +0100
@@ -119,6 +119,7 @@ 
 #include "recog.h"
 #include "tm_p.h"
 #include "alias.h"
+#include "rtl-iter.h"
 
 /* var-tracking.c assumes that tree code with the same value as VALUE rtx code
    has no chance to appear in REG_EXPR/MEM_EXPRs and isn't a decl.
@@ -5366,16 +5367,16 @@  replace_expr_with_values (rtx loc)
     return cselib_subst_to_values (loc, VOIDmode);
 }
 
-/* Return true if *X is a DEBUG_EXPR.  Usable as an argument to
-   for_each_rtx to tell whether there are any DEBUG_EXPRs within
-   RTX.  */
+/* Return true if X contains a DEBUG_EXPR.  */
 
-static int
-rtx_debug_expr_p (rtx *x, void *data ATTRIBUTE_UNUSED)
+static bool
+rtx_debug_expr_p (const_rtx x)
 {
-  rtx loc = *x;
-
-  return GET_CODE (loc) == DEBUG_EXPR;
+  subrtx_iterator::array_type array;
+  FOR_EACH_SUBRTX (iter, array, x, ALL)
+    if (GET_CODE (*iter) == DEBUG_EXPR)
+      return true;
+  return false;
 }
 
 /* Determine what kind of micro operation to choose for a USE.  Return
@@ -5465,7 +5466,7 @@  use_type (rtx loc, struct count_use_info
 		  DEBUG_EXPRs (only happens in the presence of debug
 		  insns).  */
 	       && (!MAY_HAVE_DEBUG_INSNS
-		   || !for_each_rtx (&XEXP (loc, 0), rtx_debug_expr_p, NULL)))
+		   || !rtx_debug_expr_p (XEXP (loc, 0))))
 	return MO_USE;
       else
 	return MO_CLOBBER;