Homework # 5
due November 7

Strongly Live Variable Analysis

Do Exercise 2.4 on page 133, defining a modification of live variable analysis: Strongly Live Variable Analysis (SLVA). SLVA requires that you initialize the set of strongly live variables at the end of the program. When we implement SLVA in Homework #6, we will use the program output variables for this purpose. For this Homework, assume the existence of a special ``return'' variable r to initialize the SLVA set. In all places other than the end of the program/statement, r should be treated the same as any other variable.

Here are some examples of SLVA:

Here's how you should do Exercise 2.4:



In particular, you may assume isolated exits.

Errors

The book's Live Variable Analysis (p. 47-50) requires isolated exits.

In Homework #3, several students initialized reaching definitions with the empty set (rather than with the set ). Then whenever a use of a variable was found without any reaching definition, the definition was inferred. So, for example in the following code

y = 1;
x = y + z
The analysis would infer a reaching definition of for the use of z. This result is correct. Nevertheless, this approach does not work in general:

Several students, when implementing reaching definitions analysis, did not iterate to a fixed point and instead just ran the loop twice. The textbook does say that GEN-KILL analyses only require the loop to be analyzed twice, but there are some pitfalls which is why it was required to do fixed-point iteration.

Programming

Implement two additional worklists that make use of reverse postorder ordering:

Optional: Measure which technique is more efficient.

Submission

As with all homeworks, please turn in your homework on paper at the beginning of lecture.

About this document



John Boyland 2006-10-31