Encouraging indirect addressing mode
Ian Lance Taylor
iant@google.com
Mon Nov 6 22:42:00 GMT 2006
Luke.Powell@bjservices.com writes:
> Here I've used a macro to keep track of the farthest place reached in the
> code. As you can see, I've even tried to set it up in such a way that it
> will use a register to access the value. However, I don't get that result,
> as I guess that is optimized out. Instead each comparison uses the full
> address of the array, creating two more words for the read and for the
> write. I'd prefer a sequence to read something like:
>
> movel #main_line, %a0 /* only once, at the start of the function */
> moveq #(LINE-1), %d0
> cmpl %a0@, %d0
> blt skip
> moveb #LINE, %d0
> movel %d0,%a0@
> skip: ...
>
> I haven't seen any options that encourage more use of indirect addressing.
> Are there any that I have missed? If not, I assume I will need to work
> with the machine description. I've downloaded the gcc internals book, but
> it's a lot of material and it's hard to figure out where to start. Can
> anybody point me in the right direction?
The first thing to try is to use TARGET_ADDRESS_COST to make the cost
of register indirect smaller than the cost of an absolute address
reference, at least when optimize_space is true.
m68k.c doesn't seem to have a definition of TARGET_ADDRESS_COST, so
you will have to add one.
You should also take a look at TARGET_RTX_COSTS.
Ian
More information about the Gcc
mailing list