Instructions¶
Instructions are syntactically distinguished into plain and structured instructions.
In addition, as a syntactic abbreviation, instructions can be written as S-expressions in folded form, to group them visually.
Labels¶
Structured control instructions can be annotated with a symbolic label identifier. They are the only symbolic identifiers that can be bound locally in an instruction sequence. The following grammar handles the corresponding update to the identifier context by composing the context with an additional label entry.
Note
The new label entry is inserted at the beginning of the label list in the identifier context. This effectively shifts all existing labels up by one, mirroring the fact that control instructions are indexed relatively not absolutely.
If a label with the same name already exists, then it is shadowed and the earlier label becomes inaccessible.
Control Instructions¶
Structured control instructions can bind an optional symbolic label identifier.
The same label identifier may optionally be repeated after the corresponding
Their block type is given as a type use, analogous to the type of functions. However, the special case of a type use that is syntactically empty or consists of only a single result is not regarded as an abbreviation for an inline function type, but is parsed directly into an optional value type.
Note
The side condition stating that the identifier context
All other control instruction are represented verbatim.
Note
The side condition stating that the identifier context
Abbreviations¶
The
Also, for backwards compatibility, the table index to
Reference Instructions¶
Parametric Instructions¶
Variable Instructions¶
Table Instructions¶
Abbreviations¶
For backwards compatibility, all table indices may be omitted from table instructions, defaulting to
Memory Instructions¶
The offset and alignment immediates to memory instructions are optional.
The offset defaults to
Numeric Instructions¶
Vector Instructions¶
Vector memory instructions have optional offset and alignment immediates, like the memory instructions.
Vector constant instructions have a mandatory shape descriptor, which determines how the following values are parsed.
Folded Instructions¶
Instructions can be written as S-expressions by grouping them into folded form. In that notation, an instruction is wrapped in parentheses and optionally includes nested folded instructions to indicate its operands.
In the case of block instructions, the folded form omits the
The set of all phrases defined by the following abbreviations recursively forms the auxiliary syntactic class
Note
For example, the instruction sequence
can be folded into
Folded instructions are solely syntactic sugar, no additional syntactic or type-based checking is implied.
Expressions¶
Expressions are written as instruction sequences.
No explicit