This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: how to specify instruction size for optimization
- From: Ian Lance Taylor <iant at google dot com>
- To: cirrus75 <cirrus75 at uol dot com dot br>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 15 Jan 2010 12:41:42 -0800
- Subject: Re: how to specify instruction size for optimization
- References: <4b50c6ce4240b_35232ff2e70296@weasel11.tmail>
cirrus75 <cirrus75@uol.com.br> writes:
> I could not understand exactly how to specify instruction size to gcc (so it can really optimize the code size when -Os is used).
>
> I would like to inform gcc that if some registers are used for certain operations, the instruction will be smaller. For example, an add which destination register is register 4 has lowest size if compared to all "add" forms.
>
> What is the easiest way to give this information to gcc ? I took a long look at the internals documentation and other ports but I'm not sure.
You should add a "length" attribute to all your insns.
However, the real way that gcc decides which insns to use is based on
TARGET_RTX_COSTS. You can change what that returns based on the
optimization mode.
Ian