Language Implementation
7-53
7
the compiler treats the body of an asm function as text. The compiler
parses the text for symbolic names (parameters, local temporaries, and
labels). However, the compiler does not recognize function calls, memory
references, or explicit register usage within the
asm function text.
asm Statements
You can use an asm statement to pass an assembler instruction through the
compiler, and you can specify the instruction's operands using C
expressions. Typically,
asm is used to gain access to machine instructions
that have no corresponding C paradigm.
asm statements are somewhat similar to function calls; both use parameter
mechanisms to help describe the statements' inputs. In
asm statements,
however, an extensive mechanism is also provided for describing the
asm's effects; the compiler can then assume that an asm has no effects or
inputs that are not explicitly stated. In contrast, a function call is assumed
to read or write all program variables unless proven otherwise. No such
assumption is made for asm statements.
NOTE. The compiler assumes that the inserted assembly instructions can
only be executed immediately after the statement that precedes them, and
that after the inserted assembly instructions have been executed, program
execution resumes at the statement immediately following them.
Syntax Examples
The following brief syntax examples are provided here for reference when
studying the detailed grammar below. The effects and components of
each specific example are discussed in detail in the Examples section
below.