|Non-Confidential||PDF version||ARM DUI0472J|
|Home > Using the Inline and Embedded Assemblers of the ARM Compiler > 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,
long long, or a pointer type. No sign extension is performed
short types. You must perform
sign extension explicitly for these types. The compiler might add code to evaluate these
expressions and allocate them to registers.
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:
A variable value.
The address of a variable.
The dereferencing of a pointer variable.
A compile-time constant.
Any expression containing one of the following is not a simple expression operand:
An implicit function call, such as for division, or explicit function call.
The construction of a C++ temporary.
An arithmetic or logical operation.