diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-01-12 00:24:25 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-01-12 00:24:25 +0000 |
commit | 2d6d2426208c0a37c98225316297de9706586a96 (patch) | |
tree | 684fcad77ee721ed4f11fd55f48d8e58e435ac59 /gcc/function.c | |
parent | 152bf2248a1165487104e9b9fb5aba0276606b1a (diff) | |
download | ppe42-gcc-2d6d2426208c0a37c98225316297de9706586a96.tar.gz ppe42-gcc-2d6d2426208c0a37c98225316297de9706586a96.zip |
* function.c (purge_addressof_1): If the note accesses a mem+addressof
in a wider mode than any replacement, adjust the cached replacement.
Cache trivial substitutions as well.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24629 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/gcc/function.c b/gcc/function.c index c152193e9bb..87a923b18fa 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -2899,11 +2899,36 @@ purge_addressof_1 (loc, insn, force, store) for (tem = purge_addressof_replacements; tem != NULL_RTX; tem = XEXP (XEXP (tem, 1), 1)) - if (rtx_equal_p (x, XEXP (tem, 0))) - { - *loc = XEXP (XEXP (tem, 1), 0); - return; - } + { + rtx y = XEXP (tem, 0); + if (GET_CODE (y) == MEM + && rtx_equal_p (XEXP (x, 0), XEXP (y, 0))) + { + /* It can happen that the note may speak of things in + a wider (or just different) mode than the code did. + This is especially true of REG_RETVAL. */ + + rtx z = XEXP (XEXP (tem, 1), 0); + if (GET_MODE (x) != GET_MODE (y)) + { + if (GET_CODE (z) == SUBREG && SUBREG_WORD (z) == 0) + z = SUBREG_REG (z); + + /* ??? If we'd gotten into any of the really complex + cases below, I'm not sure we can do a proper + replacement. Might we be able to delete the + note in some cases? */ + if (GET_MODE_SIZE (GET_MODE (x)) + < GET_MODE_SIZE (GET_MODE (y))) + abort (); + + z = gen_lowpart (GET_MODE (x), z); + } + + *loc = z; + return; + } + } /* There should always be such a replacement. */ abort (); @@ -2991,7 +3016,15 @@ purge_addressof_1 (loc, insn, force, store) } } else if (validate_change (insn, loc, sub, 0)) - goto restart; + { + /* Remember the replacement so that the same one can be done + on the REG_NOTES. */ + purge_addressof_replacements + = gen_rtx_EXPR_LIST (VOIDmode, x, + gen_rtx_EXPR_LIST (VOIDmode, sub, + purge_addressof_replacements)); + goto restart; + } give_up:; /* else give up and put it into the stack */ } |