> -----Original Message-----
> From: 
> [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]
> org] On Behalf Of Sparr
> Sent: Tuesday, November 11, 2008 5:53 PM
> To: [email protected]
> Subject: Re: [avr-gcc-list] foo++, subi vs inc?
> 
> On Tue, Nov 11, 2008 at 7:00 PM, Weddington, Eric
> <[EMAIL PROTECTED]> wrote:
> > What is the type of foo?
> 
> register unsigned char foo asm("r5");
> 
> On Tue, Nov 11, 2008 at 7:03 PM, Gre7g Luterman 
> <[EMAIL PROTECTED]> wrote:
> > Does it really matter which instruction the compiler chooses? Both
> > constructs consume the same amount of memory and execution time.
> >
> > I understand your concern that potentially more time and 
> memory could be
> > used if the compiler resisted the use of inc and the 
> register was below R16,
> > but unless you've seen evidence of it doing this... Is it 
> an issue or just
> > an idle curiousity?
> > Gre7g
> 
> It is an issue.  See above for the declaration of foo.  If r5 was used
> instead of copying to r21 it would save two instructions, which is not
> as trivial as it sounds since I am doing it inside a timer interrupt
> and my current goal is to shrink the code as much as possible.  I know
> I will eventually have to do optimizations in asm, but for now I'd
> like my C code to be compiled optimally.

If you want your C code to be compiled optimally, then don't reserve a specific 
register for a global variable. But then again, the AVR backend hasn't been 
tuned to generate optimal code either.

The issue could be very well in the AVR target machine description. You'll have 
to bite the bullet and go look at the code.


_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to