Program Structure
Operands and Completers
is required. Relocatable expressions are meaningful when the base register is %r0, or when the base register contains the left part of a
LDIL | L%glob,%r1 | ;set up %r1 for STW |
STW | %r9,R%glob(%r1) |
|
Immediate operands provide data for the machine language instruction directly from the bits of the instruction word itself. A few instructions that use immediate operands are shown below:
ADDIL | L%var,%dp |
LDIL | L%print,%r1 |
ADDI | 4,%r3,%r5 |
SUBI | 0x1C0,%r14,%ret0 |
Completers are special flags that modify an instruction's behavior. They are written in the opcode field, separated from the instruction mnemonic by a comma. The most common type of completer is a condition test.
Many instructions can conditionally trap or nullify the following instruction, depending on the result of their normal operation. For example, notice the completers in the sequence below:
ADD,NSV | %r1,%r2,%r3 |
BL,N | handle_oflo,%r0 |
OR | %r3,%r4,%r5 |
The ,NSV in the ADD instruction nullifies the BL instruction if no overflow occurs in the addition operation, and execution proceeds with the OR instruction. If overflow does occur, the BL instruction is executed, but the ,N completer on the BL specifies that the OR instruction in its delay slot should not be executed.
Each class of machine instructions defines the set of completers that can be used.
These are described in the
36 | Chapter 2 |