diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-20 16:05:09 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-20 16:05:09 +0000 |
commit | 8ceddf57e351c5a93a22a0e85063477f8193f825 (patch) | |
tree | 2902a57624deca0a3f73d473a68bf502bf697f42 /gcc/tree-chrec.h | |
parent | 4a01a43503180e3037ca8ac7d726d052e8de2dd8 (diff) | |
download | gcc-8ceddf57e351c5a93a22a0e85063477f8193f825.tar.gz |
2008-05-20 Jan Sjodin <jan.sjodin@amd.com>
Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/36206
* tree-scalar-evolution.c: Remove enum INSERT_SUPERLOOP_CHRECS,
FOLD_CONVERSIONS.
(instantiate_scev_1): Rename flags to fold_conversions.
Do not check for INSERT_SUPERLOOP_CHRECS, keep SSA_NAMEs defined
outeside instantiation_loop.
* tree-chrec.h (evolution_function_is_affine_in_loop): New.
(evolution_function_is_affine_or_constant_p): Removed.
* tree-data-ref.c (dr_analyze_indices): Replace resolve_mixers with
instantiate_scev.
(analyze_siv_subscript): Pass in the loop nest number.
Call evolution_function_is_affine_in_loop instead of
evolution_function_is_affine_p.
(analyze_overlapping_iterations): Pass in the loop nest number.
* tree-chrec.h (chrec_fold_op): New.
* tree-data-ref.c (initialize_matrix_A): Traverse NOP_EXPR, PLUS_EXPR, and
other trees.
* testsuite/gfortran.dg/pr36206.f: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135663 138bc75d-0d04-0410-961f-82ee72b054a4
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 c908ec5c66b..a9246929816 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 */ |