|
|
The table below shows the (assembly) code that the compiler
would generate with two different uses of SPL.
It uses the following introductory code (along with the above definition):
f() { register int i;
code... | matches... | generates... |
---|---|---|
SPL(i); | % reg | spl %r8 |
| ||
SPL(3); | % con | movw &3,%r0 |
spl %r0 |
The first use of SPL has a register variable as its argument (assuming that i actually gets allocated to a register). This argument has a storage mode that matches reg, the storage mode in the first pattern. Therefore the compiler expands the first code body. Note that newpri, the formal parameter in the definition, has been replaced in the expanded code by the compiler's idea of the assembly time name for the variable i, namely %r8. Similarly, the second use of SPL has a constant as its argument, which leads to the compiler's choosing the second pattern. Here again newpri has been replaced by the assembly time form for the constant, &3.