gcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Aug 2014 06:24:57 +0000 (06:24 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Aug 2014 06:24:57 +0000 (06:24 +0000)
* var-tracking.c (non_suitable_const): Turn from being a for_each_rtx
callback to being a function that examines each subrtx itself.
Remove handling of null rtxes.
(add_uses): Update accordingly.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214662 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/var-tracking.c

index 4ca3224..9c7a149 100644 (file)
@@ -1,5 +1,12 @@
 2014-08-28  Richard Sandiford  <rdsandiford@googlemail.com>
 
+       * var-tracking.c (non_suitable_const): Turn from being a for_each_rtx
+       callback to being a function that examines each subrtx itself.
+       Remove handling of null rtxes.
+       (add_uses): Update accordingly.
+
+2014-08-28  Richard Sandiford  <rdsandiford@googlemail.com>
+
        * 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.
index 1cd2276..da83e49 100644 (file)
@@ -5523,27 +5523,32 @@ preserve_value (cselib_val *val)
    any rtxes not suitable for CONST use not replaced by VALUEs
    are discovered.  */
 
-static int
-non_suitable_const (rtx *x, void *data ATTRIBUTE_UNUSED)
+static bool
+non_suitable_const (const_rtx x)
 {
-  if (*x == NULL_RTX)
-    return 0;
-
-  switch (GET_CODE (*x))
+  subrtx_iterator::array_type array;
+  FOR_EACH_SUBRTX (iter, array, x, ALL)
     {
-    case REG:
-    case DEBUG_EXPR:
-    case PC:
-    case SCRATCH:
-    case CC0:
-    case ASM_INPUT:
-    case ASM_OPERANDS:
-      return 1;
-    case MEM:
-      return !MEM_READONLY_P (*x);
-    default:
-      return 0;
+      const_rtx x = *iter;
+      switch (GET_CODE (x))
+       {
+       case REG:
+       case DEBUG_EXPR:
+       case PC:
+       case SCRATCH:
+       case CC0:
+       case ASM_INPUT:
+       case ASM_OPERANDS:
+         return true;
+       case MEM:
+         if (!MEM_READONLY_P (x))
+           return true;
+         break;
+       default:
+         break;
+       }
     }
+  return false;
 }
 
 /* Add uses (register and memory references) LOC which will be tracked
@@ -5589,8 +5594,7 @@ add_uses (rtx *ploc, void *data)
            }
 
          if (CONSTANT_P (vloc)
-             && (GET_CODE (vloc) != CONST
-                 || for_each_rtx (&vloc, non_suitable_const, NULL)))
+             && (GET_CODE (vloc) != CONST || non_suitable_const (vloc)))
            /* For constants don't look up any value.  */;
          else if (!VAR_LOC_UNKNOWN_P (vloc) && !unsuitable_loc (vloc)
                   && (val = find_use_val (vloc, GET_MODE (oloc), cui)))