diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-31 02:39:06 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-31 02:39:06 +0000 |
commit | e44bcf8349bbf0d971e568e5db34891f29da8145 (patch) | |
tree | f5f7bca2b7de0bb641f9c2b63b097c8c122238d6 /gcc/tree-chrec.c | |
parent | 7ed7512f3cd7e2a1251a6356719d1886b88030ac (diff) | |
download | gcc-e44bcf8349bbf0d971e568e5db34891f29da8145.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150299 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-chrec.c')
-rw-r--r-- | gcc/tree-chrec.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index caf7428dc4e..33d9f18c099 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; + } +} + |