Content deleted Content added
No edit summary |
No edit summary |
||
Line 5:
It is a "backwards way" analysis. The analysis is done in a backwards order, and the dataflow [[confluence operator]] is [[set union]].
{| class="floatright"
|<
The set of live variables at line L3 is {<code>b</code>, <code>c</code>} because both are used in the addition, and thereby the call to <code>f</code> and assignment to <code>a</code>. But the set of live variables at line L1 is▼
only {<code>b</code>} since variable <code>c</code> is updated in L2. The value of variable <code>a</code> is never used. Note that <code>f</code> may be stateful, so the never-live assignment to <code>a</code> can be eliminated, but there is insufficient information to rule on the entirety of <code>L3</code>.▼
L1: b := 3;
L2: c := 5;
Line 19 ⟶ 12:
goto L1;
</code>
|}
▲The set of live variables at line L3 is {<code>b</code>, <code>c</code>} because both are used in the addition, and thereby the call to <code>f</code> and assignment to <code>a</code>. But the set of live variables at line L1 is
▲only {<code>b</code>} since variable <code>c</code> is updated in L2. The value of variable <code>a</code> is never used. Note that <code>f</code> may be stateful, so the never-live assignment to <code>a</code> can be eliminated, but there is insufficient information to rule on the entirety of <code>L3</code>.
</td>
The dataflow equations used for a given basic block ''s'' and exiting block ''f'' in live variable analysis are the following:
|