Calculating instruction costs
David Given
dg@cowlark.com
Wed Jul 10 16:26:00 GMT 2013
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, but yes,
my not having implemented any costing appears to be fundamentally the issue.
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, 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?
--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "USER'S MANUAL VERSION 1.0: The information presented in this
│ publication has been carefully for reliability." --- anonymous
│ computer hardware manual
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20130710/49cdde56/attachment.sig>
More information about the Gcc
mailing list