Statement-Level Inline Assembly

The compiler accepts functions that mix regular C/C++ statements with inline assembly. Statement-level assembly language acts as a block of assembly language that may appear anywhere that the compiler allows a regular C or C++ statement. It has this syntax:

asm { one or more instructions }

Listing 1. Example of statement-level inline assembly
void g(void)
{
  asm { add r2,r3,r4 ; }
}
Note: If you check the Inlined Assembler is Volatile checkbox in the EPPC Processor panel, functions that contain an asm block are only partially optimized. The optimizer optimizes the function, but skips any asm blocks of code. If the Inlined Assembler is Volatile checkbox is clear, the compiler also optimizes asm statements.