[Top][All Lists]

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

[avr-gcc-list] RE: inline control

From: larry barello
Subject: [avr-gcc-list] RE: inline control
Date: Mon, 16 Feb 2009 09:28:59 -0800

I explicitly inline code with the following attribute 

#define _INLINE_ static inline __attribute__((always_inline))

For my medium size project (lots of menus/graphics/various sensors and serial 
port devices)

1) -no-inline-small-function    - 69034
2) --param inline-call-cost=2   - 68964
3) -fno-inline                  - 68816
4) -finline-limit=10            - 68810
5) #2 & #4                      - 68754 
6) -finline-limit=3             - 68754 (same results for 1,2 and 3)

Since I am generally not too concerned about overall speed I prefer small size 
and explicit _INLINE_ where I deem appropriate... Usually the speed I am 
worried about is how long it takes to download another version while debugging 

Anyway, thanks for the pointers and I am glad I spent 20 minutes trying them 


-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Ruud Vlaming
Sent: Monday, February 16, 2009 6:40 AM
To: address@hidden
Subject: Re: [avr-gcc-list] Code optimistaion in AVR Tiny13

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:

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


AVR-GCC-list mailing list

reply via email to

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