[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Using X and Z register in global variables
From: |
Björn Haase |
Subject: |
[avr-gcc-list] Using X and Z register in global variables |
Date: |
Sun, 4 Sep 2005 00:58:37 +0200 |
User-agent: |
KMail/1.7.1 |
Joerg Wunsch wrote:
>Tomdean wrote:
>>I want to force the use of X and Z with global variables. These two
>>variables are ONLY used to handle a ring buffer. I need to minimize
>>the code size.
>>
>>register uint8_t *HEAD asm ("r30"); /* Z */
>>register uint8_t *TAIL asm ("r28"); /* X */
>
>> I want to force the use of X and Z with global variables.
>
>You can effectively only use r2 through r15 for global variables.
You will run into problems even for the higher register numbers of r2 through
r15 in case that you are calling a function with many parameters. IMO gcc
will not change it's parameter passing policy due to global variables so that
the higher register numbers (i.e. r8 through r15) may be clobbered in certain
circumstances. r2 to r7 in contrast should be safe.
Using X and Z for global variables will make it very likely impossible for gcc
to satisfy the register constraints imposed by the large majority of
real-world programs.
Yours,
Björn
- [avr-gcc-list] Using X and Z register in global variables,
Björn Haase <=