tree.def (POLYNOMIAL_CHREC): Remove CHREC_VARIABLE tree operand.

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
This commit is contained in:
Richard Biener 2017-10-11 13:18:46 +00:00 committed by Richard Biener
parent 6358a676c3
commit d2ec027749
7 changed files with 23 additions and 12 deletions

View 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 ...

View 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

View 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. */

View 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;

View 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;

View 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. */

View 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. */