From: Richard Henderson Date: Tue, 12 Jan 1999 00:24:25 +0000 (-0800) Subject: function.c (purge_addressof_1): If the note accesses a mem+addressof in a wider mode... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fbdfe39cf2e796a57d0370bc1d841ff439948d48;p=gcc.git function.c (purge_addressof_1): If the note accesses a mem+addressof in a wider mode than any replacement... * 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. From-SVN: r24629 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e9463238076..9eb38ff4081 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Tue Jan 12 00:23:31 1999 Richard Henderson + + * 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. + Tue Jan 12 00:06:00 1999 Richard Henderson * Makefile.in (OBJECTS): Add sbitmap.o. 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 */ }