









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Richard Johnson
Keshav Pingali
l
Problem Description
l
Solution to the Problem
l
Definitions and Terms
l
Outline of Algorithm
l
Examples
l
Conclusion
The disadvantages are: l
Information is propagated throughout the control flow graph.
l
When the vector at some point in the program is updated,the entire control flow graph below that point (or above it inbackward analysis) may be re-analysized.
l
Many optimizations benefit from analysis performed instages, but this is difficult to do in the standard approach.
Two solutions: l
Def-use chains
l
Static Single Assignment (SSA)
l
A def-use chain for a variable x is an edge pair
e
1
, e
2
such
that:
F
the source of
e
1
defines
x
F
the destination of
e
2
uses
x
and
F
there is a control flow path from
e
1
to
e
2
with no
assignment to
x
l
An SSA edge for variable x corresponds to an edge pair (
e
1
, e
2
such that:
F
there exists a definition of x that reaches
e
1
F
there exists a use of x reachable from
e
2
F
there is no assignment to x on any control flow path from e
1
to
e
2
and
F
e
1
dominates
e
2
The size problem can be overcome by using a “factored”representation of def-use chains called
static single
assignment
(SSA) form, which has the worst-case asymptotic
size
. SSA uses a
φ
function to combine def-use
edges having the same destination to reduce the size issue.The problem with the SSA form is it cannot be used forbackward analysis.
The Dependence Flow Graph (DFG) is a representation of theprogram dependences which generalizes def-use chains andstatic single assignment (SSA) form. The DFG for a programcan be constructed in
time. The algorithm itself can be
used to construct a program’s control dependence graph in O
time and its SSA representation in
time, which
are improvements over existing algorithms.Unlike def-use chains, which go directly from definitions touses, a DFG edge for a variable x can bypass a region of thecontrol flow graph only if this region is a single-entry single-exitregion that does not contain an assignment to x, since such aregion has neither data nor control information that is ofinterest to the program analysis.
l
A DFG edge for variable x corresponds to an edge pair (
e
1
, e
2
such that:
1 there exists a definition of x that reaches
e
1
2 there exists a use of x reachable from
e
2
3 there is no assignment to x on any control flow path from
e
1
to
e
2
e
1
dominates
e
2
e
2
postdominates
e
1
and
6 every cycle containing
e
1
also contains
e
2
and vise versa
Conditions 1 through 4 are the same as in the SSArepresentation. In the DFG, the merge operator plays the samerole as
φ
functions do in SSA form. Conditions 4 through 6
formally specify that the region of the control flow graphbetween
e
1
and
e
2
must be a single-entry single-exit region.
i f
( p )
then
z
x
z +2;
} else {
z
x
z +1;
y
x ;
(a) all-pathsThe first use of
z
can be replaced by
, and the second use of
z
by
. The right hand sides of the two definitions of
x
can now
be simplified to the constant
, and the final use of
x
can be
replaced by
This approach achieved: l
Speeded up the program analysis and optimization that isbased on the use of the dependence flow graph
l
Derived a fast algorithm for constructing a DFG which canalso be used to construct a factored control dependencegraph.
l
Avoids inefficiencies by:
1 Propagating information for a variable x only where
needed, bypassing single-entry single-exit regions of thegraph that contain on definition of x
2 Performing work proportional to the number of variable
references at each assignment statement