i960 Processor Compiler User's Guide
7-72
7
The following restrictions apply to asm parameter lists:
• An
asm function cannot be a stdarg function; that is, an asm
parameter list cannot contain an ellipsis (. . .).
• Each declaration in an
asm parameter list must include an identifier.
• The data type of any
asm parameter cannot be larger than 16 bytes.
• The data type of an
asm function return value cannot be larger than 16
bytes.
An
asm function can contain zero or more expansion cases, each of which
starts on a new line and consists of a control line (starting with
%) followed
by a template. A control line can contain zero or more controls and can be
continued to the next line with a backslash immediately before the newline
character. A control can be any of the following:
• a parameter-declaration list to specify return values or
asm parameter
classes.
• the
call or error keyword to cause an action other than asm
in-lining.
• a
label declaration to declare a label local to the asm function.
• the
use or spillall keyword to preserve registers and variables.
• the
pure keyword to indicate that the asm function has no side effects.
An
asm parameter declaration in a control line specifies the classes for any
parameters or return value. The keyword
return is a special parameter
identifier, denoting the return value and specifying its class. A control line
can also contain declarations for local temporary variables.
The
template
can be any text. The compiler performs some
preprocessing on the template text, but the assembly-language syntax
checking is done by the assembler.
Template Selection
When the compiler encounters a call to an
asm function, the compiler
selects a template for expansion by comparing the call context with each
control line in the function definition. The call context includes:
• the category (value, data type, and location) of each argument in the
call.
• a boolean that shows whether the function uses the returned value.