X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Ftree-chrec.h;h=7f240c6c739e62b6feebdcb9b8603dd0def1ab70;hb=9636921b6f9c9162ae3aeb278b588b6ee37a3842;hp=c908ec5c66b49417c1dc7f9cb516da44831414b1;hpb=ecc3a7ab76907cdb1a31fdb6502f4022b0cefe79;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h index c908ec5c66b..7f240c6c739 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,28 @@ 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 +233,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 */