Non-Confidential | ![]() | ARM DUI0472J | ||
| ||||
Home > Using the Inline and Embedded Assemblers of the ARM Compiler > Inline assembler register restrictions in C and C++ code |
Registers such as r0-r3
, sp
, lr
, and the NZCV flags in the CPSR
must be used with caution.
If C or C++ expressions are used, these might be used as temporary registers and NZCV flags might be corrupted by the compiler when evaluating the expression.
The pc
, lr
, and sp
registers cannot be
explicitly read or modified using inline assembly code because there is no direct access to
any physical registers. However, you can use the intrinsics __current_pc
,
__current_sp
, and __return_address
to read these
registers.