soot.shimple.internal.analysis
Class DominatorTree

java.lang.Object
  |
  +--soot.shimple.internal.analysis.DominatorTree

public class DominatorTree
extends java.lang.Object
implements DirectedGraph

Dominator tree that implements the Soot DirectedGraph interface amongst other conveniences.

DominatorTree invokes DominatorsFinder to identify the list of dominators for each node, and then proceeds to build a tree.


Constructor Summary
DominatorTree(BlockGraph graph)
           
DominatorTree(BlockGraph graph, boolean constructFrontier)
           
 
Method Summary
 void buildFrontier()
           
 void buildTree()
          Add all the necessary links between nodes to form a meaningful tree structure.
 DominatorNode fetchNode(Block block)
          Clever convenience method to make sure we don't create more than one DominatorNode for a given block.
protected  DominatorNode fetchParent(Block block)
          Has most of the intelligence necessary to build the tree.
 BlockGraph getGraph()
           
 java.util.List getHeads()
          Returns a list of entry points for this graph.
 java.util.List getPredsOf(java.lang.Object node)
          Returns a list of predecessors for the given node in the graph.
 java.util.List getSuccsOf(java.lang.Object node)
          Returns a list of successors for the given node in the graph.
 java.util.List getTails()
          Returns a list of exit points for this graph.
 java.util.Iterator iterator()
          Returns an iterator for the nodes in this graph.
 int size()
          Returns the node count for this graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DominatorTree

public DominatorTree(BlockGraph graph)

DominatorTree

public DominatorTree(BlockGraph graph,
                     boolean constructFrontier)
Method Detail

getGraph

public BlockGraph getGraph()

getHeads

public java.util.List getHeads()
Description copied from interface: DirectedGraph
Returns a list of entry points for this graph.
Specified by:
getHeads in interface DirectedGraph

getTails

public java.util.List getTails()
Description copied from interface: DirectedGraph
Returns a list of exit points for this graph.
Specified by:
getTails in interface DirectedGraph

getPredsOf

public java.util.List getPredsOf(java.lang.Object node)
Description copied from interface: DirectedGraph
Returns a list of predecessors for the given node in the graph.
Specified by:
getPredsOf in interface DirectedGraph

getSuccsOf

public java.util.List getSuccsOf(java.lang.Object node)
Description copied from interface: DirectedGraph
Returns a list of successors for the given node in the graph.
Specified by:
getSuccsOf in interface DirectedGraph

iterator

public java.util.Iterator iterator()
Description copied from interface: DirectedGraph
Returns an iterator for the nodes in this graph. No specific ordering of the nodes is guaranteed.
Specified by:
iterator in interface DirectedGraph

size

public int size()
Description copied from interface: DirectedGraph
Returns the node count for this graph.
Specified by:
size in interface DirectedGraph

buildTree

public void buildTree()
Add all the necessary links between nodes to form a meaningful tree structure.

fetchNode

public DominatorNode fetchNode(Block block)
Clever convenience method to make sure we don't create more than one DominatorNode for a given block.

Warning: Because fetchNode creates a new Node, if necessary, it is not 100% suitable for outside public use. We need it anyway, hence the interface is not protected.


fetchParent

protected DominatorNode fetchParent(Block block)
Has most of the intelligence necessary to build the tree.

In fact, it's not that smart and can be improved. In short, we try to identify the most dominated dominator :-) and deduce that that dominator is our parent.


buildFrontier

public void buildFrontier()