| |||
| Home > Using the Inline and Embedded Assemblers of the ARM Compiler > Restrictions on embedded assembly language functions in C and C++ code | |||
The following restrictions apply to embedded assembly language functions:
After preprocessing, __asm functions
can only contain assembly code, with the exception of the following
embedded assembler builtins:
__cpp(expr)
__offsetof_base(D, B)
__mcall_is_virtual(D, f)
__mcall_is_in_vbase(D, f)
__mcall_offsetof_base(D, f)
__mcall_this_offset(D, f)
__vcall_offsetof_vfunc(D, f)
No return instructions are generated by the compiler
for an __asm function. If you want to return
from an __asm function, you must include the
return instructions, in assembly code, in the body of the function.
This makes it possible to fall through to the next function,
because the embedded assembler guarantees to emit the __asm functions
in the order you define them. However, inlined and template functions
behave differently. Do not assume that code execution falls out
of an inline or template function into another embedded assembly
function.
__asm functions do not change
the ARM Architecture Procedure Call Standard (AAPCS) rules
that apply. This means that all calls between an __asm function
and a normal C or C++ function must adhere to the AAPCS, even though
there are no restrictions on the assembly code that an __asm function
can use (for example, change state).