Package soot.toolkits.graph
Class MHGDominatorsFinder<N>
- java.lang.Object
-
- soot.toolkits.graph.MHGDominatorsFinder<N>
-
- All Implemented Interfaces:
DominatorsFinder<N>
- Direct Known Subclasses:
MHGPostDominatorsFinder
public class MHGDominatorsFinder<N> extends Object implements DominatorsFinder<N>
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 useBitSets instead ofHashSets, as the most expensive operation in this algorithm used to be cloning of the fullSet, which is very cheap forBitSets.- Author:
- Navindra Umanee, Eric Bodden
-
-
Field Summary
Fields Modifier and Type Field Description protected DirectedGraph<N>graphprotected Set<N>headsprotected Map<Integer,N>indexToNodeprotected intlastIndexprotected Map<N,BitSet>nodeToFlowSetprotected Map<N,Integer>nodeToIndex
-
Constructor Summary
Constructors Constructor Description MHGDominatorsFinder(DirectedGraph<N> graph)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoAnalysis()List<N>getDominators(N node)Returns a list of dominators for the given node in the graph.protected BitSetgetDominatorsBitSet(N node)DirectedGraph<N>getGraph()Returns the graph to which the analysis pertains.NgetImmediateDominator(N node)Returns the immediate dominator of node or null if the node has no immediate dominator.protected intindexOf(N o)protected intindexOfAssert(N o)booleanisDominatedBy(N node, N dominator)True if "node" is dominated by "dominator" in the graph.booleanisDominatedByAll(N node, Collection<N> dominators)True if "node" is dominated by all nodes in "dominators" in the graph.
-
-
-
Constructor Detail
-
MHGDominatorsFinder
public MHGDominatorsFinder(DirectedGraph<N> graph)
-
-
Method Detail
-
doAnalysis
protected void doAnalysis()
-
indexOfAssert
protected int indexOfAssert(N o)
-
indexOf
protected int indexOf(N o)
-
getGraph
public DirectedGraph<N> getGraph()
Description copied from interface:DominatorsFinderReturns the graph to which the analysis pertains.- Specified by:
getGraphin interfaceDominatorsFinder<N>
-
getDominators
public List<N> getDominators(N node)
Description copied from interface:DominatorsFinderReturns a list of dominators for the given node in the graph.- Specified by:
getDominatorsin interfaceDominatorsFinder<N>
-
getImmediateDominator
public N getImmediateDominator(N node)
Description copied from interface:DominatorsFinderReturns the immediate dominator of node or null if the node has no immediate dominator.- Specified by:
getImmediateDominatorin interfaceDominatorsFinder<N>
-
isDominatedBy
public boolean isDominatedBy(N node, N dominator)
Description copied from interface:DominatorsFinderTrue if "node" is dominated by "dominator" in the graph.- Specified by:
isDominatedByin interfaceDominatorsFinder<N>
-
isDominatedByAll
public boolean isDominatedByAll(N node, Collection<N> dominators)
Description copied from interface:DominatorsFinderTrue if "node" is dominated by all nodes in "dominators" in the graph.- Specified by:
isDominatedByAllin interfaceDominatorsFinder<N>
-
-