diff options
Diffstat (limited to 'gcc/tree-chrec.h')
-rw-r--r-- | gcc/tree-chrec.h | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h index c908ec5..a924692 100644 --- a/gcc/tree-chrec.h +++ b/gcc/tree-chrec.h @@ -168,10 +168,10 @@ evolution_function_is_constant_p (const_tree chrec) } } -/* Determine whether the given tree is an affine evolution function or not. */ +/* Determine whether CHREC is an affine evolution function in LOOPNUM. */ static inline bool -evolution_function_is_affine_p (const_tree chrec) +evolution_function_is_affine_in_loop (const_tree chrec, int loopnum) { if (chrec == NULL_TREE) return false; @@ -179,10 +179,8 @@ evolution_function_is_affine_p (const_tree chrec) switch (TREE_CODE (chrec)) { case POLYNOMIAL_CHREC: - if (evolution_function_is_invariant_p (CHREC_LEFT (chrec), - CHREC_VARIABLE (chrec)) - && evolution_function_is_invariant_p (CHREC_RIGHT (chrec), - CHREC_VARIABLE (chrec))) + if (evolution_function_is_invariant_p (CHREC_LEFT (chrec), loopnum) + && evolution_function_is_invariant_p (CHREC_RIGHT (chrec), loopnum)) return true; else return false; @@ -192,14 +190,26 @@ evolution_function_is_affine_p (const_tree chrec) } } -/* Determine whether the given tree is an affine or constant evolution - function. */ +/* Determine whether CHREC is an affine evolution function or not. */ static inline bool -evolution_function_is_affine_or_constant_p (const_tree chrec) +evolution_function_is_affine_p (const_tree chrec) { - return evolution_function_is_affine_p (chrec) - || evolution_function_is_constant_p (chrec); + if (chrec == NULL_TREE) + return false; + + switch (TREE_CODE (chrec)) + { + case POLYNOMIAL_CHREC: + if (evolution_function_is_invariant_p (CHREC_LEFT (chrec), CHREC_VARIABLE (chrec)) + && evolution_function_is_invariant_p (CHREC_RIGHT (chrec), CHREC_VARIABLE (chrec))) + return true; + else + return false; + + default: + return false; + } } /* Determines whether EXPR does not contains chrec expressions. */ @@ -221,5 +231,24 @@ chrec_type (const_tree chrec) return TREE_TYPE (chrec); } +static inline tree +chrec_fold_op (enum tree_code code, tree type, tree op0, tree op1) +{ + switch (code) + { + case PLUS_EXPR: + return chrec_fold_plus (type, op0, op1); + + case MINUS_EXPR: + return chrec_fold_minus (type, op0, op1); + + case MULT_EXPR: + return chrec_fold_multiply (type, op0, op1); + + default: + gcc_unreachable (); + } + +} #endif /* GCC_TREE_CHREC_H */ |