[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Automatic inline vs size
From: |
Ben Jackson |
Subject: |
[avr-gcc-list] Automatic inline vs size |
Date: |
Sat, 17 Mar 2007 10:17:41 -0700 |
User-agent: |
Mutt/1.5.6i |
On Sat, Mar 17, 2007 at 01:01:26PM -0400, address@hidden wrote:
>
> A big portion of the increase was due to the way
> it was inlining stuff.
That's why when I'm working with the AVR I use macros that nail it
down:
#define NOINLINE __attribute__ ((__noinline__))
#define YESINLINE inline __attribute__ ((__always_inline__))
GCC is often wrong when it guesses, because I will do things like inline
a giant init function because I just want the code to go into main, while
I keep it in a separate function for readability. Then I will take some
one liner out and put it in a function so I can call it from many places
and reduce the size of the code. GCC needs strong encouragement to do
what I want!
The worst cases are always interrupt handlers, where I will usually try
to avoid having any function calls in order to keep the register saves
to a minimum. If it decides not to inline, things bloat fast.
--
Ben Jackson AD7GD
<address@hidden>
http://www.ben.com/
- [avr-gcc-list] Automatic inline vs size,
Ben Jackson <=