[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] code generation
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] code generation |
Date: |
Mon, 27 Oct 2003 16:05:13 +0100 (MET) |
As Torsten Hahn <address@hidden> wrote:
>Hi, compiling a code like this in an interrupt handler
>extern volatile uint16_t cnt;
>
>if(!cnt--) {
> asm("nop");
>}
>I think the code in lines 5, 6, 7 and 8 is a bit inefficient. Why
>storing the regs to sram and loading them back again ?
Because you declared the variable to be `volatile'. This prevents
/any and all/ optimizations on it. You got what you asked for.
> How can i help
>the compiler to do a better job there ?
Don't do that.
--
J"org Wunsch Unix support engineer
address@hidden http://www.interface-systems.de/~j/