Please identify each problem as shown here, with a two-letter code prefixing the exercise number.
CA11.1c, that is, Exercise 11.1 (part c only) in Chapter 11 of Concrete Abstractions, which appears on page 344. There is no need to allocate register names. You may want to test out your code in SLIME.
CA11.3, that is, Exercise 11.3 in Chapter 11 of Concrete Abstractions, which appears on page 347. You may want to test out your code in SLIME.
CA11.17, that is, Exercise 11.17 in Chapter 11 of Concrete Abstractions, which appears on page 372.
For part (a) two opcodes can be eliminated; show how to rewrite each instruction using one of the eliminated opcodes in terms of a non-eliminated opcode.
For part (b) all but one opcode can be eliminated. To argue an
individual opcode can be eliminated,
give specific code fragments showing how an instruction using it can be rewritten in terms
of any uneliminated opcodes. For example, assuming we have an
otherwise unused register tmp at our disposal, we can start by
eliminating sne, since
sne s, a, b
can be replaced by the sequence of instructions:
seq s, a, b li tmp, 1 sub s, tmp, s
or with the sequence of instructions:
sub, s, a, b li tmp, done-label jeqz s, tmp li s, 1 done-label:
Remember, that the instruction you are replacing
could appear anywhere in a larger program, so (for example) your
proposed replacement should not halt. (See how few auxiliary
registers like tmp you can get away with.)
CA11.18, that is, Exercise 11.18 in Chapter 11 of Concrete Abstractions, which appears on page 373. You may want to test out your code in SLIME. Don't rely on SLIME's initialization of registers to 0; the SLIM architectural specification does not provide any guarantees regarding initial register values.