Re: Can be gcc portable to architecture without indexed addressing mode?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 1, 2012 at 4:57 AM, Tim Rye <timjrye@xxxxxxxxx> wrote:
>
> I too am porting GCC (working on 4.7.1) to a new architecture which
> has no indexed addressing mode. I cannot seem to stop GCC from
> generating RTL such as (mem:XX (plus:XX (reg:XX ...) (const_int XX))).
> This is clearly invalid for a machine with no indexed addressing mode.

You should not be seeing such addresses if your legitimate_address_p
target hook rejects them.

> I have tried defining the following macros as I think they need to be
> defined, but it doesn't seem to work:
>
> #define BASE_REG_CLASS WRITEABLE_REGS
> #define MODE_BASE_REG_REG_CLASS(MODE) NO_REGS
> #define INDEX_REG_CLASS NO_REGS
> #ifdef REG_OK_STRICT
> #define REGNO_OK_FOR_BASE_P(NUM) mytarget_regno_ok_for_base_p(NUM,1)
> #else
> #define REGNO_OK_FOR_BASE_P(NUM) mytarget_regno_ok_for_base_p(NUM,0)
> #endif
> #define REGNO_MODE_OK_FOR_REG_BASE_P(NUM, MODE) 0
> #define REGNO_OK_FOR_INDEX_P(NUM) 0
>
> Are these definitions correct for the situation I describe? And if so,
> what else would I need to define to stop GCC using indexed addressing?
> Or, if they are not correct, could you describe what I need to do
> instead?
>
> My TARGET_LEGITIMATE_ADDRESS_P hook returns false when the code of the
> operand is PLUS.

That all looks fine.

I know it is possible to write a port for a target without indexed
addressing, because I've done it myself.  Obviously the generated code
is not very good.  I don't recall any particular magic involved.  The
reload pass should be able to cope by reloading the offset into a
register and adding it in.  It may help to play with
LEGITIMIZE_RELOAD_ADDRESS, but I don't think it is required.

I think you are going to have to start debugging what the compiler is
doing.  In particular, look at the dumps for the passes after reload.
Does the invalid address somehow survive reload, or does it somehow
get introduce afterward?

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux