[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Register usage in assembler code
From: |
Bruce D. Lightner |
Subject: |
Re: [avr-gcc-list] Register usage in assembler code |
Date: |
Tue, 12 Mar 2002 10:09:55 -0800 |
Dale,
> I thought I could lay my hands on the docs that deal with register usage
> in assembler code that is called from a C program, but I can't.
>
> Would someone point me in the right direction, please? I'm sure this
> exists, but for the life of me...
>
> Thanks,
>
> Dale Seaburg
Here's what I use as a reference...
--------------------------------------------------------------------------
AVR gcc register usage:
Parameters* Param 1 Param 2 Param 3 Param 4
f(p8) R25
f(p8,p8,p8,p8) R25 R24 R23 R22
f(p16,p16) R25:R24° R23:R22
f(p16,p16,p16) R25:R24 R23:R22 R21:R20
f(p32,p32) R25:R24:R23:R22° R21:R20:R19:R18
f(p32,p32,p32) R25:R24:R23:R22 R21:R20:R19:R18 R17:R16:R15:R14
f(p8,p16,p32) R25 R24:R23 R22:R21:R20:R19
return value
p8 R25:R24°°
p16 R25:R24
p32 R25:R24:R23:R22
° MSB left, LSB right (r25 - lower, r24 - higher, and so on)
°° R25 is cleared
R0 scratch
R1 0 (assumed to always contain zero!!!)
R2 preserved by caller
R3 preserved by caller
R4 preserved by caller
R5 preserved by caller
R6 preserved by caller
R7 preserved by caller
R8 preserved by caller
R9 preserved by caller
R10 preserved by caller
R11 preserved by caller
R12 preserved by caller
R13 preserved by caller
R14 preserved by caller
R15 preserved by caller
R16 preserved by caller
R17 preserved by caller
R18 passed parameter / scratch
R19 passed parameter / scratch
R20 passed parameter / scratch
R21 passed parameter / scratch
R22 passed parameter / scratch
R23 passed parameter / scratch
R24 passed parameter / scratch
R25 passed parameter / scratch
R26 scratch
R27 scratch
R28 preserved by caller
R29 preserved by caller
R30 scratch
R31 scratch
--------------------------------------------------------------------------
I don't know where I got this originally!
Best regards,
Bruce
--
Bruce D. Lightner
La Jolla, California
Email: address@hidden
URL: http://www.lightner.net/lightner/bruce/
avr-gcc-list at http://avr1.org