
Code Optimization 327
10.5.3 Iterative Live Analysis
The simplest approach to data-flow analysis is to iterate through the nodes of the graph G, applying
appropriate equations, till no changes take place. Algorithm 10.5.1 does live variable analysis.
Algorithm 10.5.1: Iterative Live Analysis
1 Input: in(b), thru(b), ∀b ∈ N;
2 Output: live(b), ∀b ∈ N;
3 foreach b ∈ N do live(b) ← in(b);
4 change ← True;
5 while change do
6 change ← False;
7 foreach b ∈ N do
8 oldlive ← live(b);
9
10 if live(b) ≠ oldlive then change ← True;
11 end
12 end
This algorithm has time complexity of O(n
2
), where n = | N |.
10.6 Super-optimizers
Although code optimization ...