RFC patch: invariant addresses too cheap

Richard Sandiford rdsandiford@googlemail.com
Sat Oct 31 10:05:00 GMT 2009


[catching up on backlog]

Paolo Bonzini <bonzini@gnu.org> writes:
>> As of using a magic number there,
>> another option would be to have a new target macro specifying
>> CHEAP_ADDRESS_COST or sth like that...
>
> That would be premature.  The optimization was introduced specifically
> for x86, any other target probably does not care (surely not the RISC
> ones that always have COSTS_N_INSNS(1) for the address_cost).

I don't understand why it would be premature.  As Michael says,
some ports don't a COSTS_N_INSNS-based value, and MIPS is one
of those.  As it happens, in the MIPS costs, 1 is "cheap" and
2+ is "expensive".  So either I need to hack MIPS so that
2 is cheap and 3+ is "expensive", or we need some better way
of determining this.

I don't think sticking an x86-specific magic number in the
middle of generic code is acceptable, regardless of how big
the comment above it is. ;)

Richard



More information about the Gcc-patches mailing list