Contents
Page-10
Prev
Next
Page+10
Index
Eliminating Unused Equations
The opportunistic algorithm, computing whatever can be computed
from the available values, may generate some equations that are valid
but not needed for finding the desired value.
Optimizing compilers use two notions, available and busy.
- A value is available at a point p if it has been
assigned a value above the point p in a program, e.g. as an
argument of a subroutine or as the left-hand-side of an assignment
statement.
- A value that is the left-hand-side of an assignment statement
is busy or live if it will be used at a later point in
the program.
We can eliminate equations whose lhs is not busy by proceeding
backwards through the code:
- Initially, the desired value is busy.
- For each equation, if the lhs of the equation is a member of the
busy list, keep the equation, and add its rhs variables to the busy list.
Otherwise, the equation can be discarded.