Live-variable analysis: Difference between revisions

Content deleted Content added
top: redo lead again
Example: rewrite
Line 2:
 
== Example ==
Consider the following program:
 
L1: b := 3;
L2: c := 5;
L3: a := f(b * c);
 
The set of live variables atbetween linelines {{code|L3}}two and three is {<code>b</code>, <code>c</code>} because both are used in the multiplication, andon therebyline 3. But the callset toof live variables after line {{code|L1}} is only {<code>fb</code>}, andsince assignment tovariable <code>ac</code>. is Butupdated thelater, set of live variables at linein {{code|L1L2}}. The value of variable <code>a</code> is not used in this code.
 
onlyNote {<code>b</code>} since variablethat <code>cf</code> ismay updatedhave inside {{code|L2}}.effects The value of variable(printing <code>a</code>b is never used. Note that* <code>fc</code>, may be statefulperhaps), so the never-live assignment to <code>a</code> canmay be eliminated, but there is insufficient information to rulejustify on theremoving entiretyall of <code>L3</code>.
 
== Expression in terms of dataflow equations ==