[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Re: Code optimistaion in AVR Tiny13

From: David Brown
Subject: [avr-gcc-list] Re: Code optimistaion in AVR Tiny13
Date: Mon, 16 Feb 2009 22:30:50 +0100
User-agent: Thunderbird (Windows/20081209)

Ruud Vlaming wrote:
On Monday 16 February 2009 15:11, Robert von Knobloch wrote:

On inspection I find that the compiler has 'in-lined' at least 3
function calls that I had written as a function to achieve compactness.
Is there any way I can stop this, or is this a bug?

There has been some discussions about this before. After trying many
different optimization settings i concluded that
--param inline-call-cost=2 is -overall- the best setting for small projects. However, if you need to minimize just one app, further reduction might be possible. For example with things like: -fno-inline-small-functions -fno-split-wide-types -fno-tree-scev-cprop
Also, you can prohibit the compiler to inline on a function by function basis.

Just to be sure you have no dead code around, include:
  -ffunction-sections -Wl,--gc-sections -Wl,--relax

An alternative to using -ffunction-sections is simply not to write extra functions - that should be easy enough for a small program!

One note about inlining - you should not disable all inlining, just limit automatic inlining of small functions (as you've done here). Automatic inlining of functions that are only used once is always a win in time and space.

Another important point in getting code as small as possible is to use -combine and -fwhole-program - it can significantly improve code, especially for functions that are called only once but live in different modules.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]