Java Reference
In-Depth Information
A
Entry
B
D
C
E
F
v = 1
v = 2
G
H
J
call f(v)
K
L
x = v
M
Exit
v = 3
Figure 14.43: Example flow graph for livevariables. The function f
potentially assigns
v
but does not read its value.
Consider analysis of the liveness of variable
v
in Figure 14.43. The shaded
nodes contain uses of
v
,whichmake
v live
when viewed from above such
nodes. On the other hand, the dark-circled nodes destroy the current value of
v
. Such nodes represent future behavior that makes
v
not live (i.e.,
dead
). At
the Exit node, we may assume
v
is dead since the program is over.
Figure 14.43 contains a node with a call instruction. How does this node
a
ect the liveness of
v
? For instructive purposes, we assume that
interproce-
dural analysis
reveals that the function f
potentially
assigns
v
but does not use
its value. In that case, the invoked function does not make
v
live. However,
since f does not always modify
v
, the invoked function does not make
v
dead.
This particular node therefore has
no e
ff
ect
on the liveness of
v
.
ff