|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--EDU.purdue.cs.bloat.util.Graph | +--EDU.purdue.cs.bloat.cfg.FlowGraph
FlowGraph constructs and represents a Control Flow Graph (CFG) used for analyzing a method. It consists of the basic blocks of a method.
MethodEditor
,
Block
Field Summary | |
static boolean |
DB_GRAPHS
|
static boolean |
DEBUG
|
static int |
PEEL_ALL_LOOPS
|
static int |
PEEL_LOOPS_LEVEL
|
static int |
PEEL_NO_LOOPS
|
static boolean |
PRINT_GRAPH
|
Fields inherited from class EDU.purdue.cs.bloat.util.Graph |
edgeModCount,
nodeModCount,
removingEdge,
removingNode,
revRootEdgeModCount,
rootEdgeModCount |
Constructor Summary | |
FlowGraph(MethodEditor method)
Constructor. |
Method Summary | |
void |
addEdge(GraphNode src,
GraphNode dst)
Adds an edge between two nodes in this graph. |
int |
blockType(Block block)
Returns the type of a given block. |
java.util.List |
catchBlocks()
Returns theBlocks in this CFG that begin exception handlers. |
void |
commit()
Commit changes back to the method editor. |
java.util.Collection |
domChildren(Block block)
Returns the blocks that a given block dominates. |
java.util.Collection |
domFrontier(Block block)
Returns the dominance frontier of a given block. |
Block |
domParent(Block block)
Returns the Block that dominates a given block. |
java.util.Collection |
handlers()
Returns all of the Handler objects in this CFG. |
java.util.Map |
handlersMap()
Returns A Map mapping the first block in an exception handler to its Handler object. |
Block |
init()
Returns the initialization block. |
void |
initialize()
Sets up the control flow graph. |
java.util.Collection |
iteratedDomFrontier(java.util.Collection blocks)
Returns the iterated dominance frontiers for several basic blocks. |
java.util.Collection |
iteratedPdomFrontier(java.util.Collection blocks)
Returns the iterated postdominance frontier for several basic blocks. |
Subroutine |
labelSub(Label label)
Returns the Subroutine whose entry block is labeled by a given Label. |
int |
loopDepth(Block block)
Returns the depth of the loop in which a block is contained. |
Block |
loopHeader(Block block)
Returns the loop header of the loop containing a given block. |
int |
loopLevel(Block block)
Returns the level of the loop containing a given block. |
Graph |
loopTree()
Returns the loop tree for the method modeled by this flow graph. |
int |
maxLoopDepth()
Returns the maximum loop depth (also the maximum loop height) in the control flow graph. |
MethodEditor |
method()
Returns the method editor for the method modeled by this graph. |
Block |
newBlock()
Returns a new Block with the next available Label. |
java.util.Collection |
pdomChildren(Block block)
Returns the postdominator children of a given block. |
java.util.Collection |
pdomFrontier(Block block)
Returns the postdominance frontier of a given block. |
Block |
pdomParent(Block block)
Returns the postdominator parent of a given block. |
java.util.List |
postOrder()
Returns the blocks in the flow graph sorted in post-order. |
java.util.List |
preOrder()
Returns the blocks in the flow graph sorted in pre-order. |
void |
print()
|
void |
print(java.io.PrintStream out)
|
void |
print(java.io.PrintWriter out)
Prints the graph. |
void |
printGraph()
|
void |
printGraph(java.io.PrintStream out)
Creates a graphical description of the CFG in the dot language. |
void |
printGraph(java.io.PrintWriter out)
|
void |
printGraph(java.io.PrintWriter out,
java.lang.String name)
|
void |
removeEdge(GraphNode v,
GraphNode w)
Removes an edge from the graph and performs the necessary cleanup. |
void |
removeNode(java.lang.Object key)
Removes a node (a Block) from the graph. |
void |
removeSub(Subroutine sub)
Removes a subroutine from this method. |
java.util.Collection |
reverseRoots()
|
java.util.Collection |
roots()
|
Block |
sink()
Returns the sink block. |
Block |
source()
Returns the "Enter" block of this CFG. |
java.util.Collection |
subroutines()
Returns all of the Subroutines in the method modeled by this FlowGraph. |
java.lang.String |
toString()
Returns a brief textual description of this FlowGraph, namely the name of the method it represents. |
java.util.List |
trace()
Returns the basic blocks contained in this CFG in trace order. |
void |
visit(TreeVisitor visitor)
|
void |
visitChildren(TreeVisitor visitor)
Visit each node (block) in this CFG in pre-order. |
Methods inherited from class EDU.purdue.cs.bloat.util.Graph |
addNode,
getNode,
hasEdge,
hasNode,
isAncestorToDescendent,
keySet,
nodes,
postOrderIndex,
preds,
preOrderIndex,
removeUnreachable,
size,
succs |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int PEEL_NO_LOOPS
public static final int PEEL_ALL_LOOPS
public static int PEEL_LOOPS_LEVEL
public static boolean DEBUG
public static boolean DB_GRAPHS
public static boolean PRINT_GRAPH
Constructor Detail |
public FlowGraph(MethodEditor method)
method
- The method to create the CFG for.Method Detail |
public int maxLoopDepth()
public void initialize()
public Graph loopTree()
public void removeSub(Subroutine sub)
sub
- The subroutine to remove.public void addEdge(GraphNode src, GraphNode dst)
src
- Node at which the edge originates.dst
- Node at which the edge terminates.public void removeEdge(GraphNode v, GraphNode w)
v
- Node at which edge to be removed originates.w
- Node at which edge to be removed terminates.public Block newBlock()
public Subroutine labelSub(Label label)
public java.util.Collection subroutines()
public void print(java.io.PrintStream out)
public void print(java.io.PrintWriter out)
out
- The writer to which to print.public void printGraph()
public void print()
public void printGraph(java.io.PrintStream out)
http://www.research.att.com/sw/tools/graphviz/
public void printGraph(java.io.PrintWriter out)
public void printGraph(java.io.PrintWriter out, java.lang.String name)
public void visitChildren(TreeVisitor visitor)
public void visit(TreeVisitor visitor)
public MethodEditor method()
public java.util.List trace()
The trace does not contain the source and the sink blocks.
public void commit()
public Block source()
public Block init()
public Block sink()
public java.util.Collection iteratedDomFrontier(java.util.Collection blocks)
Block#domFrontier
public java.util.Collection iteratedPdomFrontier(java.util.Collection blocks)
Block#pdomFrontier
public java.util.Collection roots()
public java.util.Collection reverseRoots()
roots()
public void removeNode(java.lang.Object key)
key
- Block to removepublic java.util.Map handlersMap()
Handler
public java.util.Collection handlers()
public java.util.List catchBlocks()
public java.util.Collection domChildren(Block block)
public Block domParent(Block block)
public int blockType(Block block)
public int loopDepth(Block block)
block
- A block whose depth we are interested in.loopLevel(EDU.purdue.cs.bloat.cfg.Block)
public int loopLevel(Block block)
procedure() { // Depth 0, Level 2 (max possible) while() { // Depth 1, Level 1 while() { // Depth 2, Level 0 } } while() { // Depth 1, Level 0 } }
block
- A block whose loop level we want to know. This block must
be contained in a loop.public Block loopHeader(Block block)
public java.util.List preOrder()
public java.util.List postOrder()
public java.util.Collection pdomChildren(Block block)
Block#pdomChildren
public Block pdomParent(Block block)
Block#pdomParent
public java.util.Collection domFrontier(Block block)
Block#domFrontier
public java.util.Collection pdomFrontier(Block block)
Block#pdomFrontier
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |