2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
* tree-chrec.c (evolution_function_right_is_integer_cst): New.
* tree-chrec.h (evolution_function_right_is_integer_cst): Declared.
From-SVN: r150299
2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+ * tree-chrec.c (evolution_function_right_is_integer_cst): New.
+ * tree-chrec.h (evolution_function_right_is_integer_cst): Declared.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
* tree-chrec.c (operator_is_linear): Handle BIT_NOT_EXPR.
(scev_is_linear_expression): Return false if the evolution is not
affine multivariate.
return false;
}
}
+
+/* Determines whether the expression CHREC contains only interger consts
+ in the right parts. */
+
+bool
+evolution_function_right_is_integer_cst (const_tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ switch (TREE_CODE (chrec))
+ {
+ case INTEGER_CST:
+ return true;
+
+ case POLYNOMIAL_CHREC:
+ if (!evolution_function_right_is_integer_cst (CHREC_RIGHT (chrec)))
+ return false;
+
+ if (TREE_CODE (CHREC_LEFT (chrec)) == POLYNOMIAL_CHREC
+ && !evolution_function_right_is_integer_cst (CHREC_LEFT (chrec)))
+ return false;
+
+ return true;
+
+ default:
+ return false;
+ }
+}
+
extern unsigned nb_vars_in_chrec (tree);
extern bool evolution_function_is_invariant_p (tree, int);
extern bool scev_is_linear_expression (tree);
+extern bool evolution_function_right_is_integer_cst (const_tree);
/* Determines whether CHREC is equal to zero. */