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

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

Re: [avr-gcc-list] foo++, subi vs inc?


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] foo++, subi vs inc?
Date: Wed, 12 Nov 2008 21:35:43 +0100 (MET)

Sparr <address@hidden> wrote:

> Why does "foo++;" compile to "subi Rd,lo8(-(1))" instead of "inc
> Rd"?

As I already wrote you on avrfreaks.net, the use of fixed registers is
such a minor issue that nobody bothered to special-case peephole
optimizations for it in AVR-GCC.

If you want an optimal ISR, *and* you already do know which assembly
code to use for that, then just go ahead, and write your entire
charlieplexing ISR in assembly.  This is for sure the most optimal
method just in this case.

The global register variables inside the C code could still prove
useful in that case anyway (provided you compile all your C
compilation units with consistent declarations about them), since that
way, you can ask the compiler to effectively treat these registers as
reserved locations, and not use them.  Of course, you always have to
be careful with library functions in that case, unless you recompile
the library with the same set of global register declarations.

-- 
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]