6.2.1. APCS register names and usage

Table 6.1 and Table 6.2 summarize the names and roles of integer and floating-point registers under the APCS.

Note

Not all ARM systems support floating-point. Refer to Chapter 11 Floating-point Support in the ARM Software Development Toolkit Reference Guide for more information.

Table 6.1. APCS registers

RegisterAPCS nameAPCS role
r0a1argument 1/scratch register/result
r1a2argument 2/scratch register/result
r2a3argument 3/scratch register/result
r3a4argument 4/scratch register/result
r4v1register variable
r5v2register variable
r6v3register variable
r7v4register variable
r8v5register variable
r9sb/v6static base/register variable
r10sl/v7stack limit/stack chunk handle/register variable
r11fp/v8frame pointer/register variable
r12ipscratch register/new -sb in inter-link-unit calls
r13splower end of the current stack frame
r14lrlink register/scratch register
r15pcprogram counter

Table 6.2. APCS floating-point registers

NameNumberAPCS Role
f00FP argument 1/FP result/FP scratch register
f11FP argument 2/FP scratch register
f22FP argument 3/FP scratch register
f33FP argument 4/FP scratch register
f44floating-point register variable
f55floating-point register variable
f66floating-point register variable
f77floating-point register variable

To summarize:

a1-a4, [f0-f3]

These are used to pass arguments to functions. a1 is also used to return integer results, and f0 to return FP results. These registers can be corrupted by a called function.

v1-v8, [f4-f7]

These are used as register variables. They must be preserved by called functions.

sb, sl, fp, ip, sp, lr, pc

These have a dedicated role in some APCS variants, though certain registers may be used for other purposes even when strictly conforming to the APCS. In some variants of the APCS some of these registers are available as additional variable registers. Refer to A more detailed look at APCS register usage for more information.

Hand coded assembly language routines that interface with C or C++ must conform to the APCS. They are not required to conform strictly. This means that any register that is not used in its APCS role by an assembly language routine (for example, fp) can be used as a working register, provided that its value on entry is restored before returning.

Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0040D
Non-Confidential