This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] TARGET_MEM_REF
On Tue, 2005-03-08 at 22:05 +0100, Zdenek Dvorak wrote:
> Hello,
>
> > On Sat, Mar 05, 2005 at 10:38:11AM +0100, Zdenek Dvorak wrote:
> > > + @item TARGET_MEM_REF
> > > + These nodes represent memory accesses whose address directly map to
> > > + an addressing mode of the target architecture. The first argument
> > > + is @code{TMR_SYMBOL} and must be a @code{VAR_DECL} of an object with
> > > + a fixed address. The second argument is @code{TMR_BASE} and the
> > > + third one is @code{TMR_INDEX}. The fourth argument is
> > > + @code{TMR_STEP} and must be an @code{INTEGER_CST}. The fifth
> > > + argument is @code{TMR_OFFSET} and must be an @code{INTEGER_CST}.
> > > + Any of the arguments may be NULL if the appropriate component
> > > + does not appear in the address. Address of the @code{TARGET_MEM_REF}
> > > + is determined in the following way.
> > > +
> > > + @smallexample
> > > + &TMR_SYMBOL + TMR_BASE + TMR_INDEX * TMR_STEP + TMR_OFFSET
> > > + @end smallexample
> >
> > Would you like to explain what these names are for? In
> > particular, why are SYMBOL and BASE different?
>
> symbol must be an object with fixed address. The rtl MEM produced
> for full TARGET_MEM_REF with all components is
>
> ((plus (plus (mult INDEX STEP)
> BASE)
> (const (plus (symbol_ref SYMBOL) OFFSET))))
>
> > While I might could see how such a construct could be
> > useful, I wonder how it integrates with COMPONENT_REFs
> > and ARRAY_REFs.
>
> It does not (i.e., COMPONENT_REF will never be argument of
> TARGET_MEM_REF and vice versa). They just coexist. In future, I would
> like to convert all memory references to TARGET_MEM_REF before expansion
> to rtl (in order to be able to take advantage of SSA form for addressing
> mode selection), but we are quite far from that. Or do you ask for
> something different?
Right, i think he was thinking of what i've done with ARRAY_MEM_REF,
which is exactly like ARRAY_REF (minus the extra lower bound argument),
but for pointers.