Class AbstractDominatorsAnalysis
java.lang.Object
edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis<BitSet>
edu.umd.cs.findbugs.ba.AbstractDominatorsAnalysis
- All Implemented Interfaces:
DataflowAnalysis<BitSet>
- Direct Known Subclasses:
DominatorsAnalysis, PostDominatorsAnalysis
A dataflow analysis to compute dominator relationships between basic blocks.
Use the BasicAbstractDataflowAnalysis.getResultFact(BasicBlock) method to get the dominator set for a given
basic block. The dominator sets are represented using the
BitSet class, with the individual bits corresponding to the
IDs of basic blocks.
Subclasses extend this class to compute either dominators or postdominators.
An EdgeChooser may be specified to select which edges to take into account. For example, exception edges could be ignored.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDominatorsAnalysis(CFG cfg, boolean ignoreExceptionEdges) Constructor.protectedAbstractDominatorsAnalysis(CFG cfg, EdgeChooser edgeChooser) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidCopy dataflow facts.Create empty (uninitialized) dataflow facts for one program point.getAllDominatedBy(BasicBlock dominator) Get a bitset containing the unique IDs of all blocks in CFG dominated (or postdominated, depending on how the analysis was done) by given block.getAllDominatorsOf(BasicBlock block) Get a bitset containing the unique IDs of all blocks which dominate (or postdominate) the given block.voidinitEntryFact(BitSet result) Initialize the "entry" fact for the graph.booleanIs the given fact the top value.voidmakeFactTop(BitSet fact) Make given fact the top value.voidMeet a dataflow fact associated with an incoming edge into another fact.booleanAre given dataflow facts the same?voidtransfer(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle end, BitSet start, BitSet result) Transfer function for the analysis.Methods inherited from class BasicAbstractDataflowAnalysis
edgeTransfer, factToString, finishIteration, getFactAfterLocation, getFactAtLocation, getFactOnEdge, getLastUpdateTimestamp, getResultFact, getStartFact, resultFactIterator, setLastUpdateTimestamp, startIterationMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DataflowAnalysis
getBlockOrder, isForwards
-
Field Details
-
cfg
-
edgeChooser
-
-
Constructor Details
-
AbstractDominatorsAnalysis
Constructor.- Parameters:
cfg- the CFG to compute dominator relationships forignoreExceptionEdges- true if exception edges should be ignored
-
AbstractDominatorsAnalysis
Constructor.- Parameters:
cfg- the CFG to compute dominator relationships foredgeChooser- EdgeChooser to choose which Edges to consider significant
-
-
Method Details
-
createFact
Description copied from interface:DataflowAnalysisCreate empty (uninitialized) dataflow facts for one program point. A valid value will be copied into it before it is used. -
copy
Description copied from interface:DataflowAnalysisCopy dataflow facts. -
initEntryFact
Description copied from interface:DataflowAnalysisInitialize the "entry" fact for the graph. -
isTop
Description copied from interface:DataflowAnalysisIs the given fact the top value. -
makeFactTop
Description copied from interface:DataflowAnalysisMake given fact the top value. -
same
Description copied from interface:DataflowAnalysisAre given dataflow facts the same? -
transfer
public void transfer(BasicBlock basicBlock, @CheckForNull org.apache.bcel.generic.InstructionHandle end, BitSet start, BitSet result) throws DataflowAnalysisException Description copied from interface:DataflowAnalysisTransfer function for the analysis. Taking dataflow facts at start (which might be either the entry or exit of the block, depending on whether the analysis is forwards or backwards), modify result to be the facts at the other end of the block.- Parameters:
basicBlock- the basic blockend- if nonnull, stop before considering this instruction; otherwise, consider all of the instructions in the basic blockstart- dataflow facts at beginning of block (if forward analysis) or end of block (if backwards analysis)result- resulting dataflow facts at other end of block- Throws:
DataflowAnalysisException
-
meetInto
Description copied from interface:DataflowAnalysisMeet a dataflow fact associated with an incoming edge into another fact. This is used to determine the start fact for a basic block.- Parameters:
fact- the predecessor fact (incoming edge)edge- the edge from the predecessorresult- the result fact- Throws:
DataflowAnalysisException
-
getAllDominatorsOf
Get a bitset containing the unique IDs of all blocks which dominate (or postdominate) the given block.- Parameters:
block- a BasicBlock- Returns:
- BitSet of the unique IDs of all blocks that dominate (or postdominate) the BasicBlock
-
getAllDominatedBy
Get a bitset containing the unique IDs of all blocks in CFG dominated (or postdominated, depending on how the analysis was done) by given block.- Parameters:
dominator- we want to get all blocks dominated (or postdominated) by this block- Returns:
- BitSet of the ids of all blocks dominated by the given block
-