Strict conventions associate specific registers with specific operations in the C/C++ environment. If you plan to interface an assembly language routine to a C/C++ program, you must understand and follow these register conventions.The register conventions dictate how the compiler uses registers and how values are preserved across function calls.
Section 2.3.1 shows the types of registers affected by these conventions.Section 2.3.1
summarizes how the compiler uses registers and whether their values are preserved across calls. For information about how values are preserved across calls, see
Section 2.3.1.Table 6.7. How Register Types Are Affected by the Conventions
Register Type
Description
Argument registerPasses arguments during a function callReturn registerHolds the return value from a function callExpression registerHolds a valueArgument pointerUsed as a base value from which a function's parameters (incoming arguments) are accessedStack pointerHolds the address of the top of the software stackLink registerContains the return address of a function callProgram counterContains the current address of code being executed Table 6.8. Register Usage
R0A1Argument register, return register, expression registerParentR1A2Argument register, return register, expression registerParentR2A3Argument register, expression registerParentR3A4Argument register, expression registerParentR4V1Expression registerChildR5V2Expression registerChildR6V3Expression registerChildR7V4, APExpression register, argument pointerChildR8V5Expression registerChildR9V6Expression registerChildR10V7Expression registerChildR11V8Expression registerChildR12V9, 1PExpression register, instruction pointerParentR13SPStack pointerChild[b]R14LRLink register, expression registerChildR15PCProgram counterN/ACPSR Current program status registerChildSPSR Saved program status registerChild[a]
The parent function refers to the function making the function call. The child function refers to the function being called.[b]
The SP is preserved by the convention that everything pushed on the stack is popped off before returning. Table 6.9. VFP Register Usage