[Top][All Lists]

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

[avr-gcc-list] Global variables and space efficient programming again

From: Robert Rozman
Subject: [avr-gcc-list] Global variables and space efficient programming again
Date: Tue, 27 Mar 2001 16:20:26 +0200


a little while ago I posted message concerning usage of main variables
in avr-gcc programs and code space efficient programming.

I have a program that uses quite some global variables (30-40). I
discovered that every access to this variable takes assembly
instructions (sts, std if I remember right) that results in quite
inefficient use of code space.

Then I forced variables into struct and define global pointer to this
struct and declare it as a r28,r29 register variable (this registers
were obviously reserved from other usage). I saved a lot of code space
(600 bytes in 8000 bytes) but it still seems that leaving this choice to
compiler would be better than forcing him to stay away from those
registers. If I do this, then avr-gcc is filling those registers at each
access, so all profit is lost .

Denis replied that obviously optimizer in avr-gcc is in some way broken.

I'd still like some advices from those, that have somehow solved this
problem, and maybe what are chances to fix this problem in avr-gcc.

Thanks in advance,

Robert Rozman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]