This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: rtl indexed addressing mode question
On Mon, 2002-11-11 at 14:48, Peter Barada wrote:
> >ps:My new macro loks like this.
> > else if (LEGITIMATE_INDEXED_ADDRESS_P (X)) \
> > { \
> > rtx reg = gen_reg_rtx (Pmode); \
> > emit_insn (gen_addsi3 (reg, force_operand(XEXP (X,0), 0), \
> > force_operand(XEXP (X,1),0))); \
> > (X) = gen_rtx_PLUS (Pmode, reg, GEN_INT (0)); \
> > goto WIN; \
> > } \
>
> This doesn't look quite right.
>
> If given:
>
> (mem:QI (plus:SI (reg:SI 50) (reg:SI 51)) 0)
>
> Youd clause will convert it into:
>
> (set (reg:SI 52) (plus:SI (reg:SI 50) (reg:SI 51)))
> (mem:QI (plus:SI (reg:SI 50) (const_int 0)) 0)
>
> where the addition of zero will get optimized away by the optimizer.
> Rather than go through all the extra work, Try the suggested version
Strictly speaking, the only addressing mode that my machine supports is
base-offset addressing. i.e. LD RD, RA,c <=> RD <- MEM(RA+c). And
register indirect mode is a special case of this ( LD RD, RA, 0).The
second rtl expression above (mem) translates to such instruction. So I
dont understand why is this extra work. (I have only started to climb
the steep ramp of gcc porting, so pardon me if I am being silly over
here). Also register indirect is implemented using the base-offset
mode.
Thanx
Spundun.
> above and see what happens...
>
> Hope this helps...
>
> --
> Peter Barada Peter.Barada@motorola.com
> Wizard 781-852-2768 (direct)
> WaveMark Solutions(wholly owned by Motorola) 781-270-0193 (fax)