aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2009-07-31 02:39:06 +0000
committerSebastian Pop <spop@gcc.gnu.org>2009-07-31 02:39:06 +0000
commite7c705bbbdc98ccb45cb953582f8964cfa3de61e (patch)
treef5f7bca2b7de0bb641f9c2b63b097c8c122238d6 /gcc
parent765deab7d02db9c60b0851ce6448014548d89bfc (diff)
downloadgcc-e7c705bbbdc98ccb45cb953582f8964cfa3de61e.zip
gcc-e7c705bbbdc98ccb45cb953582f8964cfa3de61e.tar.gz
gcc-e7c705bbbdc98ccb45cb953582f8964cfa3de61e.tar.bz2
Implement evolution_function_right_is_integer_cst.
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-chrec.c30
-rw-r--r--gcc/tree-chrec.h1
3 files changed, 36 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2a06489..7bb289a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
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.
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index caf7428..33d9f18 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -1487,3 +1487,33 @@ scev_is_linear_expression (tree scev)
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;
+ }
+}
+
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
index db45eed..f21aa74 100644
--- a/gcc/tree-chrec.h
+++ b/gcc/tree-chrec.h
@@ -86,6 +86,7 @@ extern bool evolution_function_is_univariate_p (const_tree);
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. */