From: J"orn Rennecke Date: Tue, 22 Apr 2003 11:41:58 +0000 (+0000) Subject: function.c (purge_addressof_1): In (mem (addressof (reg))) case for reg notes... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=277b3b18b38538046fe1c76a6f8eb27216517dbd;p=platform%2Fupstream%2Fgcc.git function.c (purge_addressof_1): In (mem (addressof (reg))) case for reg notes... * function.c (purge_addressof_1): In (mem (addressof (reg))) case for reg notes, if there are no substitutions, just use a SUBREG. From-SVN: r65934 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6ffa22..9965b90 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-04-22 J"orn Rennecke + + * function.c (purge_addressof_1): In (mem (addressof (reg))) case + for reg notes, if there are no substitutions, just use a SUBREG. + 2003-04-21 Mark Mitchell * Makefile.in (calls.o): Depend on except.h. diff --git a/gcc/function.c b/gcc/function.c index b75a07e..de10f73 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -3147,6 +3147,36 @@ purge_addressof_1 (loc, insn, force, store, may_postpone, ht) return true; } + /* When we are processing the REG_NOTES of the last instruction + of a libcall, there will be typically no replacements + for that insn; the replacements happened before, piecemeal + fashion. OTOH we are not interested in the details of + this for the REG_EQUAL note, we want to know the big picture, + which can be succinctly described with a simple SUBREG. + Note that removing the REG_EQUAL note is not an option + on the last insn of a libcall, so we must do a replacement. */ + if (! purge_addressof_replacements + && ! purge_bitfield_addressof_replacements) + { + /* In compile/990107-1.c:7 compiled at -O1 -m1 for sh-elf, + we got + (mem:DI (addressof:SI (reg/v:DF 160) 159 0x401c8510) + [0 S8 A32]), which can be expressed with a simple + same-size subreg */ + if ((GET_MODE_SIZE (GET_MODE (x)) + == GET_MODE_SIZE (GET_MODE (sub))) + /* Again, invalid pointer casts (as in + compile/990203-1.c) can require paradoxical + subregs. */ + || (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD + && (GET_MODE_SIZE (GET_MODE (x)) + > GET_MODE_SIZE (GET_MODE (sub))))) + { + *loc = gen_rtx_SUBREG (GET_MODE (x), sub, 0); + return true; + } + /* ??? Are there other cases we should handle? */ + } /* Sometimes we may not be able to find the replacement. For example when the original insn was a MEM in a wider mode, and the note is part of a sign extension of a narrowed