5.8.2 Irp Directive
The .irp symbol,
value1
[, ..., valuen]
...
.endr
directive evaluates a sequence of statements assigning different values
to symbol
. The sequence of statements starts at the
.irp
directive, and is terminated by a .endr
directive. For each value,
symbol
is set to
value
, and the sequence of statements is assembled. If
no value is listed, the sequence of statements is assembled once, with symbol
set to the null string. To refer to symbol
within the sequence of statements, use \symbol
.
For example, assembling:
.irp reg,0,1,2,3
lw $a\reg, 1032+\reg($sp)
.endr
is equivalent to
assembling:lw $a0,1032+0($sp)
lw $a1,1032+1($sp)
lw $a2,1032+2($sp)
lw $a3,1032+3($sp)