This is the mail archive of the gcc@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: rtl indexed addressing mode question


>Hi, I am trying to remove the indexed addressing mode from config files,
>but cant get it right. First I tried to simply reject the mode in the
>GO_IF_LEGITIMATE_ADDRESS macro as Mike suggested. But that didnt
>work.then I tried to add conversion from indexed mode to simple
>base/offset mode in the LEGITIMIZE_ADDRESS macro, but that didnt work
>either. Heres is the macro, the last else if in it is what I added.but I
>still get the unrecognizableinstruction error. (the patter is right
>below the macro)

You still need to reject indexed addressing mode, in
GO_IF_LEGITIMATE_ADDRESS, but you also have to modify
LEGITIMIZE_ADDRESS to re-write the indexed addressing mode into
something that GO_IF_LEGITIMATE_ADDRESS *does* accept.

Your legitimize_address doesn't recognized all indexed address mode
operands and force the the sum of the register and offest into a
register.  The first clause will of your macro *does* re-write an
indexed addressing mode, but only where the offset is *larger* than
+/-0x8000. You could try modifying the first clause to rewrite *any*
indexed addressing:

#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)                      \
{ if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG      \
    && GET_CODE (XEXP (X, 1)) == CONST_INT                       \
    {                                                            \
      (X) = force_operand (gen_rtx_PLUS (Pmode, XEXP (X, 0),     \
                                    XEXP (X, 1)), 0);            \
      goto WIN;                                                  \
    }                                                            \

Which will take *any* indexed address mode and force it to become
register indirect(I'm assuming that register indirect is valid for
your target).  This change doesn't recognize register indirect plus
scaled index addressing modes though (equivalent to d8(Ax,Xi*S) in
m68k/ColdFire speak). 

Hope this helps...

-- 
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)


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