Chapter 9: Code generation

Algorithm to compute next use information

. Suppose we are scanning i : X := Y op Z       in backward scan

- attach to i, information in symbol table about X, Y, Z

- set X to not live and no next use in symbol table

- set Y and Z to be live and next use in i in symbol table

As an application, we consider the assignment of storage for temporary names. Suppose we reach three-address statement i: x := y op z in our backward scan. We then do the following:

1. Attach to statement i the information currently found in the symbol table regarding the next use and live ness of x, y and z.

2. In the symbol table, set x to "not live" and "no next use".

3. In the symbol table, set y and z to "live" and the next uses of y and z to i. Note that the order of steps (2) and (3) may not be interchanged because x may be y or z.

If three-address statement i is of the form x := y or x := op y, the steps are the same as above, ignoring z.