Live-variable analysis: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 45:
The in-state of a block is the set of variables that are live at the start of the block. Its out-state is the set of variables that are live at the end of it. The out-state is the union of the in-states of the block's successors. The transfer function of a statement is applied by making the variables that are written dead, then making the variables that are read live.
 
{|
<table>
|
<tr><td>
// in: {}
b1: a = 3;
Line 65:
return b * d + c;
// out:{}
|}
</td>
</tr>
</table>
 
The in-state of b3 only contains ''b'' and ''d'', since ''c'' has been written. The out-state of b1 is the union of the in-states of b2 and b3. The definition of ''c'' in b2 can be removed, since ''c'' is not live immediately after the statement.