|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsoot.toolkits.graph.MHGDominatorsFinder
public class MHGDominatorsFinder
Calculate dominators for basic blocks.
Uses the algorithm contained in Dragon book, pg. 670-1.
D(n0) := { n0 } for n in N - { n0 } do D(n) := N; while changes to any D(n) occur do for n in N - {n0} do D(n) := {n} U (intersect of D(p) over all predecessors p of n)2007/07/03 - updated to use
BitSet
s instead of HashSet
s, as the most expensive
operation in this algorithm used to be cloning of the fullSet, which is very cheap
for BitSet
s.
Field Summary | |
---|---|
protected BitSet |
fullSet
|
protected DirectedGraph |
graph
|
protected List |
heads
|
protected Map<Integer,Object> |
indexToNode
|
protected int |
lastIndex
|
protected Map<Object,BitSet> |
nodeToFlowSet
|
protected Map<Object,Integer> |
nodeToIndex
|
Constructor Summary | |
---|---|
MHGDominatorsFinder(DirectedGraph graph)
|
Method Summary | |
---|---|
protected void |
doAnalysis()
|
List |
getDominators(Object node)
Returns a list of dominators for the given node in the graph. |
DirectedGraph |
getGraph()
Returns the graph to which the analysis pertains. |
Object |
getImmediateDominator(Object node)
Returns the immediate dominator of node or null if the node has no immediate dominator. |
protected int |
indexOf(Object o)
|
boolean |
isDominatedBy(Object node,
Object dominator)
True if "node" is dominated by "dominator" in the graph. |
boolean |
isDominatedByAll(Object node,
Collection dominators)
True if "node" is dominated by all nodes in "dominators" in the graph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DirectedGraph graph
protected BitSet fullSet
protected List heads
protected Map<Object,BitSet> nodeToFlowSet
protected Map<Object,Integer> nodeToIndex
protected Map<Integer,Object> indexToNode
protected int lastIndex
Constructor Detail |
---|
public MHGDominatorsFinder(DirectedGraph graph)
Method Detail |
---|
protected void doAnalysis()
protected int indexOf(Object o)
public DirectedGraph getGraph()
DominatorsFinder
getGraph
in interface DominatorsFinder
public List getDominators(Object node)
DominatorsFinder
getDominators
in interface DominatorsFinder
public Object getImmediateDominator(Object node)
DominatorsFinder
getImmediateDominator
in interface DominatorsFinder
public boolean isDominatedBy(Object node, Object dominator)
DominatorsFinder
isDominatedBy
in interface DominatorsFinder
public boolean isDominatedByAll(Object node, Collection dominators)
DominatorsFinder
isDominatedByAll
in interface DominatorsFinder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |