harpoon.Analysis.DataFlow
Class Solver
java.lang.Object
harpoon.Analysis.DataFlow.Solver
public class Solver
- extends Object
Solver
contains static methods to find the fixed point
of a set of data-flow equations. It is a generalization of the
QuadSolver
and InstrSolver
that is
intended for general usage on any Intermediate Representation that
is amicable to data-flow analysis.
- Version:
- $Id: Solver.java,v 1.3 2004/02/08 01:51:05 cananian Exp $
- Author:
- Felix S. Klock II <pnkfelix@mit.edu>
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
worklistSolve
public static void worklistSolve(Iterator blocks,
DataFlowBasicBlockVisitor v)
- Performs dataflow analysis on a set of
BasicBlock
s. Finds the maximum fixed point for
the data-flow equations defined by v
.
FSK: it seems to me that the blocks
are added to
a stack and then popped off for visitation, which means
that if you want to visit the blocks in say Reverse
Postorder, then blocks
must iterate over
them in *Normal* Postorder. This seems viciously
unintuitive... perhaps the Solver interface should be
revised to offer more control over the traversal... (on
the other hand, the current implementation doesn't seem
to be performing that shabbily to me, so perhaps is
better to leave well enough alone...)
requires:
- The elements of
blocks
are
BasicBlock
s.
-
v
can safely visit the elements of
blocks
.
modifies: v
, blocks
effects:
Sends v
into the elements of
blocks
and the 'successors' of the elements
of blocks
(where 'successors' is defined by
v
's addSuccessors() method).
On each visitation, performs v
's transfer
function on each BasicBlock
in turn,
tracking for when no change occurs to the 'successors',
at which point analysis is complete.
This method guarantees that all of the
BasicBlock
s. in blocks
will be
visited by v
at least once.
forwardRPOSolve
public static void forwardRPOSolve(BasicBlock root,
DataFlowBasicBlockVisitor v)