Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Differences between C compilers

2005-08-18 by David Kelly

On Aug 17, 2005, at 6:32 PM, Thomas Keller wrote:

>   On this specific issue I cannot comment, but I can say that avr- 
> gcc is
> quite inefficient in its handling of variables.  Every time the  
> compiler
> references the value of an identifier, it loads it into r24,r25 (for a
> 16 bit int), then transfers it to another register pair before
> mainpulation of the value.  Wastes execution time as well as memory
> space for unnecessary instructions.

Yes, it does that occasionally using the -O optimization. Higher  
optimizations create smaller code but I haven't cared enough to  
compare the details. Or to use the higher optimization in production  
code.

>   The only rationale I can see for this is that it substantially eases
> the job of the people writing the code generator portion of the  
> project.
>
>   I suppose, if I were really worried about it, instead of  
> complaining,
> I'd break out the source code, analyze what they have, and rewrite  
> it to
> do things correctly, and then submit it for inclusion on the project,
> eh?  *grin*

Which I agree, that "it doesn't really matter." That one can quickly  
see little inefficiencies like that with visual inspection.

My project dropped 35 bytes out of 12500 by recompiling with 3.4.4  
rather than 3.4.3. Once again haven't looked at the details but an  
easy way to make that sort of gain would be to eliminate the double  
"ret" at the end of many of my functions. I don't know why they are  
there. However its better to have an extra "ret" than be one short.

--
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.