tree.def (POLYNOMIAL_CHREC): Remove CHREC_VARIABLE tree operand.
authorRichard Biener <rguenther@suse.de>
Wed, 11 Oct 2017 13:18:46 +0000 (13:18 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 11 Oct 2017 13:18:46 +0000 (13:18 +0000)
2017-10-11  Richard Biener  <rguenther@suse.de>

* tree.def (POLYNOMIAL_CHREC): Remove CHREC_VARIABLE tree operand.
* tree-core.h (tree_base): Add chrec_var union member.
* tree.h (CHREC_VAR): Remove.
(CHREC_LEFT, CHREC_RIGHT, CHREC_VARIABLE): Adjust.
* tree-chrec.h (build_polynomial_chrec): Adjust.
* tree-chrec.c (reset_evolution_in_loop): Use build_polynomial_chrec.
* tree-pretty-print.c (dump_generic_node): Use CHREC_VARIABLE.

From-SVN: r253643

gcc/ChangeLog
gcc/tree-chrec.c
gcc/tree-chrec.h
gcc/tree-core.h
gcc/tree-pretty-print.c
gcc/tree.def
gcc/tree.h

index d30aa3adf2d7a1b4be3ef070570a91ffc1a16a5e..91e16cf61e172a7ac5aca3208141eb51ab544e4d 100644 (file)
@@ -1,3 +1,13 @@
+2017-10-11  Richard Biener  <rguenther@suse.de>
+
+       * tree.def (POLYNOMIAL_CHREC): Remove CHREC_VARIABLE tree operand.
+       * tree-core.h (tree_base): Add chrec_var union member.
+       * tree.h (CHREC_VAR): Remove.
+       (CHREC_LEFT, CHREC_RIGHT, CHREC_VARIABLE): Adjust.
+       * tree-chrec.h (build_polynomial_chrec): Adjust.
+       * tree-chrec.c (reset_evolution_in_loop): Use build_polynomial_chrec.
+       * tree-pretty-print.c (dump_generic_node): Use CHREC_VARIABLE.
+
 2017-10-11  Marc Glisse  <marc.glisse@inria.fr>
 
        * fold-const.c (fold_binary_loc) [X +- Y CMP X]: Move ...
index 3867072566e84e1cd0f644fae7f00cae35d826fd..beddf108104bb9d1d9e46e7589cdcddc0796dccf 100644 (file)
@@ -872,8 +872,7 @@ reset_evolution_in_loop (unsigned loop_num,
                                           new_evol);
       tree right = reset_evolution_in_loop (loop_num, CHREC_RIGHT (chrec),
                                            new_evol);
-      return build3 (POLYNOMIAL_CHREC, TREE_TYPE (left),
-                    CHREC_VAR (chrec), left, right);
+      return build_polynomial_chrec (CHREC_VARIABLE (chrec), left, right);
     }
 
   while (TREE_CODE (chrec) == POLYNOMIAL_CHREC
index 4a8a3734d7952534192217c21b34d50340e8c53c..4838bae89aa1ba9b317eeb9bd61230b5e7c3c42f 100644 (file)
@@ -157,8 +157,9 @@ build_polynomial_chrec (unsigned loop_num,
   if (chrec_zerop (right))
     return left;
 
-  return build3 (POLYNOMIAL_CHREC, TREE_TYPE (left),
-                build_int_cst (NULL_TREE, loop_num), left, right);
+  tree chrec = build2 (POLYNOMIAL_CHREC, TREE_TYPE (left), left, right);
+  CHREC_VARIABLE (chrec) = loop_num;
+  return chrec;
 }
 
 /* Determines whether the expression CHREC is a constant.  */
index b34080e25754b4d00d1a4c3f3967d3d0be5e4562..09be62390751559eedbacdb94df5738df5ec2717 100644 (file)
@@ -981,6 +981,9 @@ struct GTY(()) tree_base {
     /* SSA version number.  This field is only used with SSA_NAME.  */
     unsigned int version;
 
+    /* CHREC_VARIABLE.  This field is only used with POLYNOMIAL_CHREC.  */
+    unsigned int chrec_var;
+
     /* Internal function code.  */
     enum internal_fn ifn;
 
index 4e7bb5fbdbc6d4f64239aec31a8c9ed9523f106f..9a5eab5b2e1c88a46ec620332f997fe622619ed5 100644 (file)
@@ -2819,8 +2819,7 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
       dump_generic_node (pp, CHREC_LEFT (node), spc, flags, false);
       pp_string (pp, ", +, ");
       dump_generic_node (pp, CHREC_RIGHT (node), spc, flags, false);
-      pp_string (pp, "}_");
-      dump_generic_node (pp, CHREC_VAR (node), spc, flags, false);
+      pp_printf (pp, "}_%u", CHREC_VARIABLE (node));
       is_stmt = false;
       break;
 
index 9f80c4d41f5f481f0c8539146aaf1289fa0a9b17..3d2bd95d666545c18a8ec0cd26ecb91807070f10 100644 (file)
@@ -982,8 +982,8 @@ DEFTREECODE (SCEV_KNOWN, "scev_known", tcc_expression, 0)
 DEFTREECODE (SCEV_NOT_KNOWN, "scev_not_known", tcc_expression, 0)
 
 /* Polynomial chains of recurrences.
-   Under the form: cr = {CHREC_LEFT (cr), +, CHREC_RIGHT (cr)}.  */
-DEFTREECODE (POLYNOMIAL_CHREC, "polynomial_chrec", tcc_expression, 3)
+   cr = {CHREC_LEFT (cr), +, CHREC_RIGHT (cr)}_CHREC_VARIABLE (cr).  */
+DEFTREECODE (POLYNOMIAL_CHREC, "polynomial_chrec", tcc_expression, 2)
 
 /* Used to chain children of container statements together.
    Use the interface in tree-iterator.h to access this node.  */
index 7c2d2e7eb021867ea2d230ce1e066cb09ff69f7b..9507c3bef51b103c8e3be5785acbcb31ab6261b0 100644 (file)
@@ -1241,10 +1241,9 @@ extern void protected_set_expr_location (tree, location_t);
 #define COND_EXPR_ELSE(NODE)   (TREE_OPERAND (COND_EXPR_CHECK (NODE), 2))
 
 /* Accessors for the chains of recurrences.  */
-#define CHREC_VAR(NODE)           TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 0)
-#define CHREC_LEFT(NODE)          TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 1)
-#define CHREC_RIGHT(NODE)         TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 2)
-#define CHREC_VARIABLE(NODE)      TREE_INT_CST_LOW (CHREC_VAR (NODE))
+#define CHREC_LEFT(NODE)          TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 0)
+#define CHREC_RIGHT(NODE)         TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 1)
+#define CHREC_VARIABLE(NODE)      POLYNOMIAL_CHREC_CHECK (NODE)->base.u.chrec_var
 
 /* LABEL_EXPR accessor. This gives access to the label associated with
    the given label expression.  */