This function:

void __vector_7 (void) __attribute__ ((signal,used, externally_visible)) ; 

void __vector_7 (void)
{
 timerCounter++;
 (*(volatile uint8_t *)(0x89)) = 0;
 (*(volatile uint8_t *)(0x88)) = 0;
 (*(volatile uint8_t *)(0x7C)) = 0;
}

yields the code:

__vector_7: 
        push __zero_reg__ 
        push r0 
        in r0,__SREG__ 
        push r0 
        clr __zero_reg__ 
        push r24 
        push r25 
/* prologue: Signal */ 
/* frame size = 0 */ 
        lds r24,timerCounter 
        lds r25,(timerCounter)+1 
        adiw r24,1 
        sts (timerCounter)+1,r25 
        sts timerCounter,r24 
        sts 137,__zero_reg__ 
        sts 136,__zero_reg__ 
        sts 124,__zero_reg__ 
/* epilogue start */ 
        pop r25 
        pop r24 
        pop r0 
        out __SREG__,r0 
        pop r0 
        pop __zero_reg__ 
        reti 

Note that r0 is not clobbered by the function body so the save/restore of this
register is unnecessary.  Also note that, in this case, the usage of
__zero_reg__ could be replaced with one of r24 or r25, avoiding the need to
save and restore r1 as well.


-- 
           Summary: [avr] excessive prologue/epilogue for interrupt handler
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pb at gcc dot gnu dot org
GCC target triplet: avr-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41077

Reply via email to