diff options
author | Sebastian Pop <sebastian.pop@amd.com> | 2010-09-30 21:18:48 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2010-09-30 21:18:48 +0000 |
commit | dbc080794aabcca6a57c535632ce0a14d366361d (patch) | |
tree | 1665b7b3e7a93a3a2f2bfc17d8be7e7de82bdbed /gcc/tree-scalar-evolution.c | |
parent | 492e5456785bd2e22f7eca788589f5334780a36c (diff) | |
download | gcc-dbc080794aabcca6a57c535632ce0a14d366361d.zip gcc-dbc080794aabcca6a57c535632ce0a14d366361d.tar.gz gcc-dbc080794aabcca6a57c535632ce0a14d366361d.tar.bz2 |
Also handle ARRAY_REFs in instantiate_scev_r.
2010-08-20 Sebastian Pop <sebastian.pop@amd.com>
* tree-scalar-evolution.c (instantiate_array_ref): New.
(instantiate_scev_r): Also handle ARRAY_REFs.
From-SVN: r164790
Diffstat (limited to 'gcc/tree-scalar-evolution.c')
-rw-r--r-- | gcc/tree-scalar-evolution.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index a7e165a..8a5797e 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -2337,6 +2337,41 @@ 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. + "CHREC" is an array reference 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_array_ref (basic_block instantiate_below, + struct loop *evolution_loop, tree chrec, + bool fold_conversions, htab_t cache, int size_expr) +{ + tree res; + tree index = TREE_OPERAND (chrec, 1); + tree op1 = instantiate_scev_r (instantiate_below, evolution_loop, index, + fold_conversions, cache, size_expr); + + if (op1 == chrec_dont_know) + return chrec_dont_know; + + if (chrec && op1 == index) + return chrec; + + res = unshare_expr (chrec); + TREE_OPERAND (res, 1) = op1; + return res; +} + +/* Analyze all the parameters of the chrec, between INSTANTIATE_BELOW + and EVOLUTION_LOOP, that were left under a symbolic form. + "CHREC" that stands for a convert expression "(TYPE) OP" is to be instantiated. @@ -2613,6 +2648,10 @@ instantiate_scev_r (basic_block instantiate_below, case SCEV_KNOWN: return chrec_known; + case ARRAY_REF: + return instantiate_array_ref (instantiate_below, evolution_loop, chrec, + fold_conversions, cache, size_expr); + default: break; } |