diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2009-10-22 22:30:27 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2009-10-22 22:30:27 +0000 |
commit | 4fb296d9f0522b25a7c02329e1786f2f90b06fd7 (patch) | |
tree | f8b945989ef9a3176d159c0e8477139fd73772a5 /gcc | |
parent | bd7960b1e4ce9d64b2631d0b644eb8bf83845005 (diff) | |
download | gcc-4fb296d9f0522b25a7c02329e1786f2f90b06fd7.tar.gz |
simplify-rtx.c (simplify_replace_fn_rtx): Add a fallback case for rtxes that aren't handled specially.
gcc/
* simplify-rtx.c (simplify_replace_fn_rtx): Add a fallback case
for rtxes that aren't handled specially.
From-SVN: r153476
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/simplify-rtx.c | 45 |
2 files changed, 47 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 18460ea5396..b48375b5718 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2009-10-22 Richard Sandiford <rdsandiford@googlemail.com> + * simplify-rtx.c (simplify_replace_fn_rtx): Add a fallback case + for rtxes that aren't handled specially. + +2009-10-22 Richard Sandiford <rdsandiford@googlemail.com> + * rtl.h (shallow_copy_rtvec): Declare. * rtl.c (shallow_copy_rtvec): New function. * cselib.c (cselib_subst_to_values): Use it. Only modify an diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index f0c4d11e942..926615ec86f 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -363,7 +363,10 @@ simplify_replace_fn_rtx (rtx x, const_rtx old_rtx, enum rtx_code code = GET_CODE (x); enum machine_mode mode = GET_MODE (x); enum machine_mode op_mode; - rtx op0, op1, op2; + const char *fmt; + rtx op0, op1, op2, newx, op; + rtvec vec, newvec; + int i, j; /* If X is OLD_RTX, return FN (X, DATA), with a null FN. Otherwise, if this is an expression, try to build a new expression, substituting @@ -420,7 +423,6 @@ simplify_replace_fn_rtx (rtx x, const_rtx old_rtx, return simplify_gen_ternary (code, mode, op_mode, op0, op1, op2); case RTX_EXTRA: - /* The only case we try to handle is a SUBREG. */ if (code == SUBREG) { op0 = simplify_replace_fn_rtx (SUBREG_REG (x), old_rtx, fn, data); @@ -459,7 +461,44 @@ simplify_replace_fn_rtx (rtx x, const_rtx old_rtx, default: break; } - return x; + + newx = x; + fmt = GET_RTX_FORMAT (code); + for (i = 0; fmt[i]; i++) + switch (fmt[i]) + { + case 'E': + vec = XVEC (x, i); + newvec = XVEC (newx, i); + for (j = 0; j < GET_NUM_ELEM (vec); j++) + { + op = simplify_replace_fn_rtx (RTVEC_ELT (vec, j), + old_rtx, fn, data); + if (op != RTVEC_ELT (vec, j)) + { + if (newvec == vec) + { + newvec = shallow_copy_rtvec (vec); + if (x == newx) + newx = shallow_copy_rtx (x); + XVEC (newx, i) = newvec; + } + RTVEC_ELT (newvec, j) = op; + } + } + break; + + case 'e': + op = simplify_replace_fn_rtx (XEXP (x, i), old_rtx, fn, data); + if (op != XEXP (x, i)) + { + if (x == newx) + newx = shallow_copy_rtx (x); + XEXP (newx, i) = op; + } + break; + } + return newx; } /* Replace all occurrences of OLD_RTX in X with NEW_RTX and try to simplify the |