This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ARM r12 usage


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]