Compiler User GuidePreface Overview of the Compiler Getting Started with the Compiler Compiler Features Compiler Coding Practices Compiler Diagnostic Messages Using the Inline and Embedded Assemblers of the AR Compiler support for inline assembly language Inline assembler support in the compiler Restrictions on inline assembler support in the co Inline assembly language syntax with the __asm key Inline assembly language syntax with the asm keywo Inline assembler rules for compiler keywords __asm Restrictions on inline assembly operations in C an Inline assembler register restrictions in C and C+ Inline assembler processor mode restrictions in C Inline assembler Thumb instruction set restriction Inline assembler Vector Floating-Point (VFP) restr Inline assembler instruction restrictions in C and Miscellaneous inline assembler restrictions in C a Inline assembler and register access in C and C++ Inline assembler and the # constant expression spe Inline assembler and instruction expansion in C an Expansion of inline assembler instructions that us Expansion of inline assembler load and store instr Inline assembler effect on processor condition fla Inline assembler expression operands in C and C++ Inline assembler register list operands in C and C Inline assembler intermediate operands in C and C+ Inline assembler function calls and branches in C Inline assembler branches and labels in C and C++ Inline assembler and virtual registers Embedded assembler support in the compiler Embedded assembler syntax in C and C++ Effect of compiler ARM and Thumb states on embedde Restrictions on embedded assembly language functio Compiler generation of embedded assembly language Access to C and C++ compile-time constant expressi Differences between expressions in embedded assemb Manual overload resolution in embedded assembler __offsetof_base keyword for related base classes i Compiler-supported keywords for calling class memb __mcall_is_virtual(D, f) __mcall_is_in_vbase(D, f) __mcall_offsetof_vbase(D, f) __mcall_this_offset(D, f) __vcall_offsetof_vfunc(D, f) Calling nonstatic member functions in embedded ass Calling a nonvirtual member function Calling a virtual member function Accessing sp (r13), lr (r14), and pc (r15) Differences in compiler support for inline and emb Compiler Command-line Options Language Extensions Compiler-specific Features C and C++ Implementation Details What is Semihosting? Via File Syntax Summary Table of GNU Language Extensions Standard C Implementation Definition Standard C++ Implementation Definition C and C++ Compiler Implementation Limits
Inline assembler expression operands in C and C++ code
6.20 Inline assembler expression operands in C and C++ code
Function arguments, C or C++ variables, and other C or C++ expressions can be specified as register operands in an inline assembly language instruction.
The type of an expression used in place of an ARM integer register must be either an integral type (that is,
When an operand is used as a destination, the expression must be a modifiable lvalue if used as an operand where the register is modified. For example, a destination register or a base register with a base-register update.
For an instruction containing more than one expression operand, the order that expression operands are evaluated is unspecified.
An expression operand of a conditional instruction is only evaluated if the conditions for the instruction are met.
A C or C++ expression that is used as an inline assembly code operand might result in the instruction being expanded into several instructions. This happens if the value of the expression does not meet the constraints set out for the instruction operands in the ARM Architecture Reference Manual.
If an expression used as an operand creates a temporary that requires destruction, then the destruction occurs after the inline assembly instruction is executed. This is analogous to the C++ rules for destruction of temporaries.
A simple expression operand is one of the following:
Any expression containing one of the following is not a simple expression operand:
of your data.