|
SandMark version 2.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--EDU.purdue.cs.bloat.util.Graph | +--sandmark.obfuscate.boolsplitter.dcfg.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
Nested Class Summary | |
(package private) class |
FlowGraph.LoopNode
A LoopNode is a node in the loop tree. |
Nested classes inherited from class EDU.purdue.cs.bloat.util.Graph |
|
Field Summary | |
java.lang.String[] |
bool_types
|
(package private) java.util.List |
catchBlocks
|
static boolean |
DB_GRAPHS
|
static boolean |
DEBUG
|
(package private) int |
domEdgeModCount
|
(package private) int |
file
|
(package private) java.util.Map |
handlers
|
(package private) Block |
iniBlock
|
(package private) int |
loopEdgeModCount
|
(package private) EDU.purdue.cs.bloat.util.Graph |
loopTree
|
(package private) int |
maxLoopDepth
|
(package private) EDU.purdue.cs.bloat.editor.MethodEditor |
method
|
(package private) int |
next
|
static int |
PEEL_ALL_LOOPS
|
static int |
PEEL_LOOPS_LEVEL
|
static int |
PEEL_NO_LOOPS
|
static boolean |
PRINT_GRAPH
|
(package private) Block |
snkBlock
|
(package private) Block |
srcBlock
|
(package private) java.util.Map |
subroutines
|
(package private) java.util.Vector |
topo_order
|
(package private) java.util.List |
trace
|
Fields inherited from class EDU.purdue.cs.bloat.util.Graph |
edgeModCount, nodeModCount, removingEdge, removingNode, revRootEdgeModCount, rootEdgeModCount |
Constructor Summary | |
FlowGraph(EDU.purdue.cs.bloat.editor.MethodEditor method)
Constructor. |
Method Summary | |
void |
addEdge(EDU.purdue.cs.bloat.util.GraphNode src,
EDU.purdue.cs.bloat.util.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. |
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. |
void |
genTopoOrder(Block block)
|
java.util.Vector |
getTopoOrder()
|
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(EDU.purdue.cs.bloat.editor.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. |
EDU.purdue.cs.bloat.util.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. |
EDU.purdue.cs.bloat.editor.MethodEditor |
method()
Returns the method editor for the method modeled by this graph. |
Block |
newBlock()
Returns a new Block with the next available Label. |
(package private) Block |
newBlock(EDU.purdue.cs.bloat.editor.Label label)
Creates a new Block starting with the specified 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(EDU.purdue.cs.bloat.util.GraphNode v,
EDU.purdue.cs.bloat.util.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()
|
(package private) void |
setSubEntry(Subroutine sub,
Block entry)
Set the entry in the mapping between subroutine entry Blocks and the Subroutines that they begin. |
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
EDU.purdue.cs.bloat.editor.MethodEditor method
java.util.Map subroutines
java.util.List catchBlocks
java.util.Map handlers
Block srcBlock
Block snkBlock
Block iniBlock
java.util.List trace
EDU.purdue.cs.bloat.util.Graph loopTree
int domEdgeModCount
int loopEdgeModCount
int maxLoopDepth
java.util.Vector topo_order
public java.lang.String[] bool_types
int file
int next
Constructor Detail |
public FlowGraph(EDU.purdue.cs.bloat.editor.MethodEditor method)
method
- The method to create the CFG for.Method Detail |
public int maxLoopDepth()
public void initialize()
public EDU.purdue.cs.bloat.util.Graph loopTree()
public void removeSub(Subroutine sub)
sub
- The subroutine to remove.public void addEdge(EDU.purdue.cs.bloat.util.GraphNode src, EDU.purdue.cs.bloat.util.GraphNode dst)
addEdge
in class EDU.purdue.cs.bloat.util.Graph
src
- Node at which the edge originates.dst
- Node at which the edge terminates.public void removeEdge(EDU.purdue.cs.bloat.util.GraphNode v, EDU.purdue.cs.bloat.util.GraphNode w)
removeEdge
in class EDU.purdue.cs.bloat.util.Graph
v
- Node at which edge to be removed originates.w
- Node at which edge to be removed terminates.public Block newBlock()
Block newBlock(EDU.purdue.cs.bloat.editor.Label label)
label
- The new Block's Labelpublic Subroutine labelSub(EDU.purdue.cs.bloat.editor.Label label)
void setSubEntry(Subroutine sub, Block entry)
sub
- The subroutine whose entry block is being set.entry
- The subroutine's entry Block.Subroutine.setEntry(sandmark.obfuscate.boolsplitter.dcfg.Block)
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 EDU.purdue.cs.bloat.editor.MethodEditor method()
public void genTopoOrder(Block block)
public java.util.Vector getTopoOrder()
public java.util.List trace()
The trace does not contain the source and the sink blocks.
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()
roots
in class EDU.purdue.cs.bloat.util.Graph
public java.util.Collection reverseRoots()
reverseRoots
in class EDU.purdue.cs.bloat.util.Graph
roots()
public void removeNode(java.lang.Object key)
removeNode
in class EDU.purdue.cs.bloat.util.Graph
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(sandmark.obfuscate.boolsplitter.dcfg.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()
preOrder
in class EDU.purdue.cs.bloat.util.Graph
public java.util.List postOrder()
postOrder
in class EDU.purdue.cs.bloat.util.Graph
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()
toString
in class EDU.purdue.cs.bloat.util.Graph
|
SandMark version 2.0 Mon Jun 17 12:30:47 MST 2002 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |