This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ARM r12 usage
- To: armcc at lycos dot com
- Subject: Re: ARM r12 usage
- From: Richard Earnshaw <rearnsha at arm dot com>
- Date: Fri, 09 Mar 2001 17:33:22 +0000
- cc: gcc at gcc dot gnu dot org, Richard dot Earnshaw at arm dot com
- Organization: ARM Ltd.
- Reply-To: Richard dot Earnshaw at arm dot com
> The Description of the ARM Procedure Call Standard in "ARM System Architecture" by Steve Furber, seems to say that r12 can be used as a scratch register within a function without preserving the callers contents.
>
> However, a few brief tests with arm-linux-gcc v2.95.2 seem to save show that the callers r12 is saved on the stack before the register is used.
>
> Which is correct ??
> Is it safe to write assembler functions which don't save r12 (and call them from C compiled with both gcc and armcc) ?? Or will things eventually all go horribly wrong if I don't save r12 ?? :-)
>
If you look more carefully you will find that r12 is first set to a copy
of the stack pointer before it is saved. This is done to simplify the
register saving process.
So both are correct.
R.