Hi,

On Wed, 10 Jul 2013, David Given wrote:

> Michael Matz wrote:
> [...]
> > As you didn't adjust any cost I would guess the high value comes from the 
> > default implementation of address_cost, which simply uses arithmetic cost, 
> > and the MULT in there is quite expensive by default.
> > 
> > See TARGET_ADDRESS_COST in several ports.
> 
> Oddly, TARGET_ADDRESS_COST is never being called for my port,

Bah, it's only used from some call sites (fwprop, postreload and 
loop-invariant), not generally to adjust the cost of (MEM addr) based on 
address_cost (addr).  That might be a sensible change in itself I guess.

> After having done a bunch of reading up on how costing works, and
> deciphering the rather cryptic other ports, my understanding is:
> 
> Costing is based entirely on analysis of the RTL, and is completely
> irrelevant of what insns are selected.
> 
> Therefore if my backend wants to support certain optimised addressing 
> modes, I need to insert code into my TARGET_RTX_COSTS hook that looks 
> for mem constructions which can be represented by such addressing modes,

(or for when outer_code is MEM)
 
> and encourages the compiler to select them by giving them a low cost. I 
> don't get any assistance from the patterns in the .md file.
> 
> Have I got that right?

With the current state of affairs, yes.


Ciao,
Michael.

Reply via email to