This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Fix PR optimization/13424 (was: Avoid unnecesary MEM RTXes)


On Mon, Jan 26, 2004 at 10:37:38AM -0500, Jakub Jelinek wrote:
> Hi!
> 
> > Perhaps we can invent new function doing that, like
> > clear_memory_attributes, or clear_memory_alignment to do what you need?
> 
> Here is my current patch for PR 13424 (changes so that memory attributes
> are preserved in clrstr).
> There are 4 MEM operations I need to do:
> a) create new MEM rtx with identical attributes, but different XEXP (mem, 0).
>    This is I think replace_equiv_address_nv.
> b) create new MEM rts with identical XEXP (mem, 0) and most attributes
>    identical, but MEM_OFFSET increased and MEM_ALIGNED adjusted.
>    I thought adjust_automodify_address_nv would do this kind of thing,
>    unfortunately it doesn't create new MEM rtx, so if the MEM passed to
>    it have been used once already, it will be bogus.
>    Shall I copy the MEM into a new one and automodify_address_nv afterwards?

Actually, I managed to get around this by doing the change immediately
before emitting, not after:

...
          rtx mem = adjust_automodify_address_nv (dst, SImode, destreg,
                                                  offset);
          emit_insn (gen_strset (destreg, mem,
                                 gen_rtx_SUBREG (SImode, zeroreg, 0)));
          offset += 4;
...

Here the mode is always different (old is BLKmode) and thus a new copy
is always created.
But c) still needs to be solved.

> c) clear MEM_OFFSET and MEM_SIZE, set MEM_ALIGN to BITS_PER_UNIT
>    (what change_address used to do, but without changing XEXP (mem, 0))
> d) change mode of MEM, but keep the attributes.  For this I do
>    new = gen_rtx_MEM (...); MEM_COPY_ATTRIBUTES ().  Is that ok outside
>    of emit-rtl.c?

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]