10.
4 Data Flow Analysis of Flow Graphs
The data flow property represents the certain information regarding usefulness of the
for the purpose of optimization. These data flow properties are -
data items
1. Available expressions,
2. Reaching definitions,
3. Live variables,
4. Busy expressions.
The data flow analysis is a process of computing values of data flow properties.
In this section we will discuss some of the data flow properties in detail.
10.4.1 Data Flow Properties
basic terminologies that will
Before discussing the data flow properties consider some
be used while giving the data flow property.
A program point containing the definition is called definition point.
at which reference to a data item is made is called reference
A program point a
point.
A program point at which some evaluating expression is given is called
evaluation point.
For examnple:
Definition W:X3
point
Reference W: y X
point
Evaluation W3Z a*b
point
Flg. 10.4.1 (a) Program points
CnpNey
A v a i l a b l e ion
e x p r e s s i o
1.A v a l l a
Avaa .V+Vx+y available
is availabl at a
program point w if and
A n
ssion
e x p r e s s i
only if along all paths are
peaching t o w .
1. The expression x+y is said to be available at its evaluation point.
ression x+y is said to be available if no
2 The express
definition of any operand of
here
epression (her either x or y) followS its last evaluation
along the path. In other word,
f
her of the two operands get modified before their use.
n e i t h e r
Forexample:
4 B1
e ctdLI B2
4iB3
fea B4
Fig. 10.4.1 (b)
The expression 4* i is the available expression for
B2, Ba and B4 because this
expression is not been changed by any of the block before
appearing in B.
Advantage of available expression
The use of available expression is to eliminate common sub expressions.
2. Reaching definitions
d1:y2 B1
d2: XHy2 82
Fig. 10.4.2 (a)
A
from definition
from Dtion D reaches at point p if there is a path from D to p if there is a path
D to
re
paalong which D is not killed.
A de
Ntlon D of variable x is killed when there is a redefinition of x.
For example:
d1:y: 2B1
d2: yi y+2 B2
d3: Xy+283
Fig. 10.4.2 (b)
The definition dl is said to a reaching definition for block B2. But the definition d
is not a reaching definition in block B3, because it is killed by definition d2 in block RD
Advantage of reaching definition
Reaching definitions are used in constant and variable propagation.
3. Live variable
A variable x is live at some point p if there is a path fromp to the exit, along which
the value of x is used before it is redefined. Otherwise the variable is said to be dead at
that point
For example:
x 5 B1
B27
x is live
84 t x at block
B5 B1, B3, B4
but killed
at B6
x:=t+wB6
D 10 B7
Fig. 10.4.3 Live variables
Advantages of live variables
.
Live variables are useful in
register allocation.
.Live variables are
useful for dead code elimination.
4 B u s y e x p r e s s i o n
ression e is saidto be busy expression along some path
a
expre
along some path Pi...p; and no definition ofPi-P if and
An
e v a l u a t i o n
of e ts
exists only if
an
its evai aluation along the path.
any operand exists
before
e an expression
Pi
gets evaluated
e Busy expression
Fig. 10.4.4
Advantage of busy expression
Busy expressions are useful in performing code movement optimization.