diff options
author | Sebastian Pop <sebastian.pop@amd.com> | 2009-11-25 04:29:12 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2009-11-25 04:29:12 +0000 |
commit | 9c382ce91b28348d8b93de761064216538161894 (patch) | |
tree | e1a87640a15227a27c0393a6c8951e9ac3edf136 | |
parent | 15fda3174a0269637454efc231e541edc1794b24 (diff) | |
download | gcc-9c382ce91b28348d8b93de761064216538161894.zip gcc-9c382ce91b28348d8b93de761064216538161894.tar.gz gcc-9c382ce91b28348d8b93de761064216538161894.tar.bz2 |
tree-scalar-evolution.c (instantiate_scev_convert): New.
2009-09-01 Sebastian Pop <sebastian.pop@amd.com>
* tree-scalar-evolution.c (instantiate_scev_convert): New.
(instantiate_scev_1): Move code in instantiate_scev_convert.
From-SVN: r154534
-rw-r--r-- | gcc/ChangeLog.graphite | 5 | ||||
-rw-r--r-- | gcc/tree-scalar-evolution.c | 76 |
2 files changed, 56 insertions, 25 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 12ea5ca..144236b 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,5 +1,10 @@ 2009-09-01 Sebastian Pop <sebastian.pop@amd.com> + * tree-scalar-evolution.c (instantiate_scev_convert): New. + (instantiate_scev_1): Move code in instantiate_scev_convert. + +2009-09-01 Sebastian Pop <sebastian.pop@amd.com> + * tree-scalar-evolution.c (instantiate_scev_binary): New. (instantiate_scev_1): Move code in instantiate_scev_binary. diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 219ef5c..3a50f1e 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -2252,7 +2252,53 @@ instantiate_scev_binary (basic_block instantiate_below, } /* Analyze all the parameters of the chrec, between INSTANTIATE_BELOW - and EVOLUTION_LOOP, that were left under a symbolic form. + and EVOLUTION_LOOP, that were left under a symbolic form. + + "CHREC" that stands for a convert expression "(TYPE) OP" is to be + instantiated. + + CACHE is the cache of already instantiated values. + + FOLD_CONVERSIONS should be set to true when the conversions that + may wrap in signed/pointer type are folded, as long as the value of + the chrec is preserved. + + SIZE_EXPR is used for computing the size of the expression to be + instantiated, and to stop if it exceeds some limit. */ + +static tree +instantiate_scev_convert (basic_block instantiate_below, + struct loop *evolution_loop, tree chrec, + tree type, tree op, + bool fold_conversions, htab_t cache, int size_expr) +{ + tree op0 = instantiate_scev_1 (instantiate_below, evolution_loop, op, + fold_conversions, cache, size_expr); + + if (op0 == chrec_dont_know) + return chrec_dont_know; + + if (fold_conversions) + { + tree tmp = chrec_convert_aggressive (type, op0); + if (tmp) + return tmp; + } + + if (chrec && op0 == op) + return chrec; + + /* If we used chrec_convert_aggressive, we can no longer assume that + signed chrecs do not overflow, as chrec_convert does, so avoid + calling it in that case. */ + if (fold_conversions) + return fold_convert (type, op0); + + return chrec_convert (type, op0, NULL); +} + +/* Analyze all the parameters of the chrec, between INSTANTIATE_BELOW + and EVOLUTION_LOOP, that were left under a symbolic form. CHREC is the scalar evolution to instantiate. @@ -2264,7 +2310,7 @@ instantiate_scev_binary (basic_block instantiate_below, SIZE_EXPR is used for computing the size of the expression to be instantiated, and to stop if it exceeds some limit. */ - + static tree instantiate_scev_1 (basic_block instantiate_below, struct loop *evolution_loop, tree chrec, @@ -2316,29 +2362,9 @@ instantiate_scev_1 (basic_block instantiate_below, fold_conversions, cache, size_expr); CASE_CONVERT: - op0 = instantiate_scev_1 (instantiate_below, evolution_loop, - TREE_OPERAND (chrec, 0), - fold_conversions, cache, size_expr); - if (op0 == chrec_dont_know) - return chrec_dont_know; - - if (fold_conversions) - { - tree tmp = chrec_convert_aggressive (TREE_TYPE (chrec), op0); - if (tmp) - return tmp; - } - - if (op0 == TREE_OPERAND (chrec, 0)) - return chrec; - - /* If we used chrec_convert_aggressive, we can no longer assume that - signed chrecs do not overflow, as chrec_convert does, so avoid - calling it in that case. */ - if (fold_conversions) - return fold_convert (TREE_TYPE (chrec), op0); - - return chrec_convert (TREE_TYPE (chrec), op0, NULL); + return instantiate_scev_convert (instantiate_below, evolution_loop, chrec, + TREE_TYPE (chrec), TREE_OPERAND (chrec, 0), + fold_conversions, cache, size_expr); case BIT_NOT_EXPR: /* Handle ~X as -1 - X. */ |