Java Reference
In-Depth Information
FIGURE 6.10 Phi functions solve the SSA merge problem.
Another place where Phi functions are needed are in loop headers. Recall that, a loop
header is a basic block having at least one incoming backward branch and at least two
predecessors, as is illustrated in Figure 6.11.
FIGURE 6.11 Phi functions in loop headers.
Unfortunately, a changed variable flowing in from a backward branch is known only
after the block has been fully processed. For this reason, at loop headers, we conservatively
define Phi functions for all variables and then remove redundant Phi functions later. In the
first instance, w 2 can be defined as a Phi function with operands w 1 and w 2 :
w 2 = [ w 1 w 2 ]
Then, when w is later incremented, the second operand may be overwritten by the new w 3 .
w 2 = [ w 1 w 3 ]
 
Search WWH ::




Custom Search