|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcetus.analysis.DFAGraph
cetus.analysis.CFGraph
public class CFGraph
CFGraph supports creation of statmenet-level control flow graphs.
The DFANode class is used to represent each node in the graph.
The nodes in a CFGraph object contain information gathered from
their corresponding Cetus IR and these data can be accessed with the
DFANode.getData(String) method.
Following key:data pairs are added to each node by default after calling
the constructor of CFGraph.
| Field Summary | |
|---|---|
protected java.util.Stack<java.util.List> |
break_link
|
protected java.util.Stack<java.util.List> |
continue_link
|
protected java.util.Map<Label,java.util.List> |
goto_link
|
protected Traversable |
root_node
|
protected java.lang.Class |
super_node
|
protected java.util.Stack<java.util.List> |
switch_link
|
| Fields inherited from class cetus.analysis.DFAGraph |
|---|
nodes |
| Constructor Summary | |
|---|---|
CFGraph(Traversable t)
Constructs a CFGraph object with the given traversable object. |
|
CFGraph(Traversable t,
java.lang.Class supernode)
Constructs a CFGraph object with the given traversable object and the IR type whose sub graph is pruned. |
|
| Method Summary | |
|---|---|
protected DFAGraph |
buildAnnotationStatement(AnnotationStatement stmt)
|
protected DFANode |
buildBreak(Statement stmt)
|
protected DFANode |
buildCase(Statement stmt)
|
protected DFAGraph |
buildCompound(CompoundStatement stmt)
|
protected DFANode |
buildContinue(Statement stmt)
|
protected DFAGraph |
buildDeclarationStatement(DeclarationStatement stmt)
|
protected DFAGraph |
buildDoLoop(DoLoop stmt)
|
protected DFAGraph |
buildForLoop(ForLoop stmt)
|
protected DFANode |
buildGoto(GotoStatement stmt)
|
protected DFAGraph |
buildGraph(Traversable t)
Builds a control flow graph for a traversable object. |
protected DFAGraph |
buildIf(IfStatement stmt)
|
protected DFANode |
buildLabel(Label label)
|
protected DFAGraph |
buildProcedure(Procedure proc)
|
protected DFAGraph |
buildSwitch(SwitchStatement stmt)
|
protected DFAGraph |
buildWhile(WhileLoop stmt)
|
protected static void |
expandAssignment(CompoundStatement stmts,
AssignmentExpression e)
|
protected static void |
expandConditional(CompoundStatement stmts,
ConditionalExpression e)
|
protected static void |
expandExpression(CompoundStatement stmts,
Traversable t)
|
protected static DFAGraph |
expandExpression(DFANode node)
|
protected static void |
expandUnary(CompoundStatement stmts,
UnaryExpression e)
|
static java.lang.Object |
getIR(DFANode node)
Returns the corresponding IR object for the specified node. |
protected static java.util.List |
getSafeEvaluation(Traversable t)
|
protected static boolean |
isJump(DFANode node)
|
protected static boolean |
isUnsafeExpansion(Traversable t)
|
void |
normalize()
Normalizes the graph so that each node does not have an assignment expression as a sub expression of another expression. |
protected void |
reduce()
|
protected boolean |
removable_node(DFANode node)
|
protected static void |
removeRedundancy(CompoundStatement stmts)
|
java.lang.String |
toDot()
Converts the graph to a string in dot format to be used with GraphViz. |
| Methods inherited from class cetus.analysis.DFAGraph |
|---|
absorb, addEdge, addNode, getEntryNodes, getExitNodes, getFirst, getLast, getNode, getNode, getNodeWith, getSCC, isEmpty, isReachable, iterator, removeEdge, removeNode, removeNodes, size, toDot, topologicalSort, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Stack<java.util.List> break_link
protected java.util.Stack<java.util.List> continue_link
protected java.util.Stack<java.util.List> switch_link
protected java.util.Map<Label,java.util.List> goto_link
protected java.lang.Class super_node
protected Traversable root_node
| Constructor Detail |
|---|
public CFGraph(Traversable t)
t - the traversable object.
public CFGraph(Traversable t,
java.lang.Class supernode)
t - the traversable object.supernode - IR type that is pruned.| Method Detail |
|---|
public java.lang.String toDot()
DFAGraph.toDot(String,int) for more flexible formatting.
DFAGraph.toDot(String,int)public static java.lang.Object getIR(DFANode node)
node - the node in the graph.
public void normalize()
protected DFAGraph buildGraph(Traversable t)
protected static boolean isJump(DFANode node)
protected DFAGraph buildProcedure(Procedure proc)
protected DFAGraph buildAnnotationStatement(AnnotationStatement stmt)
protected DFAGraph buildDeclarationStatement(DeclarationStatement stmt)
protected DFANode buildBreak(Statement stmt)
protected DFANode buildCase(Statement stmt)
protected DFANode buildContinue(Statement stmt)
protected DFANode buildGoto(GotoStatement stmt)
protected DFANode buildLabel(Label label)
protected DFAGraph buildCompound(CompoundStatement stmt)
protected DFAGraph buildDoLoop(DoLoop stmt)
protected DFAGraph buildForLoop(ForLoop stmt)
protected DFAGraph buildIf(IfStatement stmt)
protected DFAGraph buildSwitch(SwitchStatement stmt)
protected DFAGraph buildWhile(WhileLoop stmt)
protected boolean removable_node(DFANode node)
protected void reduce()
protected static boolean isUnsafeExpansion(Traversable t)
protected static java.util.List getSafeEvaluation(Traversable t)
protected static DFAGraph expandExpression(DFANode node)
protected static void expandAssignment(CompoundStatement stmts,
AssignmentExpression e)
protected static void expandConditional(CompoundStatement stmts,
ConditionalExpression e)
protected static void expandUnary(CompoundStatement stmts,
UnaryExpression e)
protected static void removeRedundancy(CompoundStatement stmts)
protected static void expandExpression(CompoundStatement stmts,
Traversable t)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||