CS2112: Exercises + Answers from $21 Building a Compiler: generating the output

* A common way of optimising a for statement is to keep the value of the control variable in a register throughout the loop. What restrictions does the ANSI C standard impose on the control variable to make this possible? Is this possible in C, and if so, how would you implement it?

?

* Investigate ways in which spare data registers could be allocated to frequently used operands. A simple technique might perform a static analysis of the parse tree to find which operands occur most frequently. A better technique might attempt to identify frequently executed parts of the program and concentrate on those.

?

<top of 2nd column>