avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] __builtin_constant_p for inline func args with -Os


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] __builtin_constant_p for inline func args with -Os
Date: Sun, 8 Nov 2009 21:39:02 +0100 (MET)

Paul Stoffregen <address@hidden> wrote:

> Indeed it works great with -O2.  But with -Os, __builtin_constant_p
> never returns 1.

It appears to me GCC simply thinks inlining the function would not be
feasible with -Os -- well, partially at least.  If you declare your
function as

static inline void __attribute__((always_inline))
digitalWrite(uint8_t pin, uint8_t val)

(thus overriding GCC's heuristics about inlining), it yields your
desired result:

main:
/* prologue: function */
/* frame size = 0 */
        sbi 43-32,2
        lds r24,num
        ldi r22,lo8(1)
        call _digitalWrite
        sbi 43-32,2
..L2:
        rjmp .L2

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

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