public class SSAGraph
extends java.lang.Object
SSAGraph is a representation of the definitions found in a CFG in the following form: Each node in the graph is an expression that defines a variable (a VarExpr, PhiStmt, or a StackManipStmt). Edges in the graph point to the nodes whose expressions define the operands of the expression in the source node.
This class is used primarily get the strongly connected components of the SSA graph in support of value numbering and induction variable analysis.
Nate warns: Do not modify the CFG while using the SSA graph! The effects of such modification are undefined and will probably lead to nasty things occuring.
ValueNumbering| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
| Constructor and Description |
|---|
SSAGraph(FlowGraph cfg)
Constructor.
|
SSAGraph(FlowGraph cfg,
boolean useless)
Grumble.
|
| Modifier and Type | Method and Description |
|---|---|
FlowGraph |
cfg()
Returns the FlowGraph that this SSAGraph is built
around.
|
java.util.List |
children(Node node)
Returns the children (that is, the operands) of a given Node in the SSA
Graph.
|
java.util.Collection |
equivalences()
Returns the Sets of Nodes whose values are equivalent.
|
java.util.Set |
equivalent(Node node)
Returns a set of nodes whose value is equivalent to a given node.
|
void |
printSCCs(java.io.PrintWriter pw)
Prints a textual representation of the strongly connected components of
the SSAGraph to a PrintWriter.
|
void |
visitComponent(Node startNode,
ComponentVisitor visitor)
Visits the strongly connected component that contains a given
Node.
|
void |
visitComponents(ComponentVisitor visitor)
Calculates the strongly connected components (SCC) of the SSA graph.
|
public SSAGraph(FlowGraph cfg, boolean useless)
public SSAGraph(FlowGraph cfg)
cfg - The control flow graph to examinepublic FlowGraph cfg()
public java.util.Set equivalent(Node node)
public java.util.List children(Node node)
public java.util.Collection equivalences()
public void visitComponents(ComponentVisitor visitor)
public void visitComponent(Node startNode, ComponentVisitor visitor)
public void printSCCs(java.io.PrintWriter pw)