gcc compile for code size

Andrew Haley aph@redhat.com
Sun Nov 11 21:32:00 GMT 2012


On 11/11/2012 09:08 PM, Jeff Law wrote:
> On 11/11/2012 02:01 PM, Andrew Haley wrote:
>> On 11/11/2012 07:59 PM, Xin Tong wrote:
>>>> No.  GCC does all optimizations *except* those known to increase
>>>> program size.  This usually works pretty well, but isn't perfect.
>>>>
>>> so as to how the instructions are selected. compiling for code size
>>> does not have an effect ?
>>
>> Please don't top-post on this list.
>>
>> Any target could, in principle, select instructions based on size
>> and -OS, but I don't know any that do.
> Many ports look at at -Os and change their instruction selections, 
> alignment requests, etc.
> 
> grep for "optimize_size" in the machine descriptions...

Oops, sorry.  While "I don't know" was true, it wasn't very helpful.
I do now!

Andrew.




More information about the Gcc-help mailing list