+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 ...
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
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. */
/* 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;
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;
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. */
#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. */