avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] Can pgmspace.h __LPM_xxx__ macros become inlinefn's?


From: Theodore A. Roth
Subject: Re: [avr-libc-dev] Can pgmspace.h __LPM_xxx__ macros become inlinefn's?
Date: Fri, 1 Oct 2004 07:34:48 -0700 (PDT)

On Fri, 1 Oct 2004, Bill Somerville wrote:

> > I don't see anywhere that using static is not recommended. Do you have a
> > reference for that?
>
> The penultimate para of the gcc man page "5.34 An Inline Function is As
> Fast As a Macro" seemed to imply this, but after comments from Geoffrey
> Wossum and some tests it seems that static __inline__ or extern
> __inline__ are the only options in header files otherwise multiple
> definitions occur.
>
> Unfortunately this has become academic as I cannot get the inline fn's
> to generate the same code as the macros, also the inline versions
> sometimes are bigger. This seems to be an optimiser problem where the
> register choices made around inlined fn's are not as smart as they might
> be. I suspect this is a quite obscure gcc bug/feature. The gcc man page
> says that inlines may generate different code from macros (both larger
> and smaller).
>
> Since I haven't found an example that generates smaller code, I suspect
> that a community of embedded programmers are not going to be happy with
> this change!

<snip>

>
> In the inline version the second LPM result does an unnecessary register
> shuffle that the macro version avoids. Note that the first LPM is OK so
> the compiler can get it right sometimes.

Does changing "__asm__" to "__asm__ __volatile__" affect your results?

---
Ted Roth
PGP Key ID: 0x18F846E9
Jabber ID: address@hidden




reply via email to

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