Package edu.umd.cs.findbugs.ba
Interface DataflowAnalysis<Fact>
- All Known Implementing Classes:
AbstractDataflowAnalysis
,AbstractDominatorsAnalysis
,BackwardDataflowAnalysis
,BackwardTypeQualifierDataflowAnalysis
,BasicAbstractDataflowAnalysis
,BlockTypeAnalysis
,CallListAnalysis
,ConstantAnalysis
,DominatorsAnalysis
,FieldSetAnalysis
,ForwardDataflowAnalysis
,ForwardTypeQualifierDataflowAnalysis
,FrameDataflowAnalysis
,IsNullValueAnalysis
,LiveLocalStoreAnalysis
,LoadAnalysis
,LockAnalysis
,NonExceptionDominatorsAnalysis
,NonExceptionPostDominatorsAnalysis
,NonImplicitExceptionDominatorsAnalysis
,NonImplicitExceptionPostDominatorsAnalysis
,ObligationAnalysis
,PostDominatorsAnalysis
,ResourceValueAnalysis
,ReturnPathAnalysis
,ReturnPathTypeAnalysis
,StackDepthAnalysis
,StoreAnalysis
,TypeAnalysis
,TypeQualifierDataflowAnalysis
,UnconditionalValueDerefAnalysis
,ValueNumberAnalysis
public interface DataflowAnalysis<Fact>
A dataflow analysis to be used with the
Dataflow
class.
In order to avoid duplicating functionality (such as caching of start and
result facts), most analyses should extend the
BasicAbstractDataflowAnalysis
or AbstractDataflowAnalysis
classes rather than directly implementing this interface.
- Author:
- David Hovemeyer
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Copy dataflow facts.Create empty (uninitialized) dataflow facts for one program point.void
edgeTransfer
(Edge edge, Fact fact) Edge transfer function.factToString
(Fact fact) Return a String representation of given Fact.void
Called after finishing an iteration of analysis.getBlockOrder
(CFG cfg) Return the BlockOrder specifying the order in which BasicBlocks should be visited in the main dataflow loop.getFactAfterLocation
(Location location) Get the dataflow fact representing the point just after given Location.getFactAtLocation
(Location location) Get dataflow fact at (just before) given Location.getFactOnEdge
(Edge edge) Get the fact that is true on the given control edge.int
getLastUpdateTimestamp
(Fact fact) getResultFact
(BasicBlock block) Get the result fact for given basic block.getStartFact
(BasicBlock block) Get the start fact for given basic block.void
initEntryFact
(Fact result) Initialize the "entry" fact for the graph.boolean
Returns true if the analysis is forwards, false if backwards.boolean
Is the given fact the top value.void
makeFactTop
(Fact fact) Make given fact the top value.void
Meet a dataflow fact associated with an incoming edge into another fact.boolean
Are given dataflow facts the same?void
setLastUpdateTimestamp
(Fact fact, int timestamp) void
Called before beginning an iteration of analysis.void
transfer
(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle end, Fact start, Fact result) Transfer function for the analysis.
-
Method Details
-
createFact
Fact createFact()Create empty (uninitialized) dataflow facts for one program point. A valid value will be copied into it before it is used. -
getStartFact
Get the start fact for given basic block.- Parameters:
block
- the basic block
-
getResultFact
Get the result fact for given basic block.- Parameters:
block
- the basic block
-
getFactAtLocation
Get dataflow fact at (just before) given Location. Note "before" is meant in the logical sense, so for backward analyses, before means after the location in the control flow sense.- Parameters:
location
- the Location- Returns:
- the dataflow value at given Location
- Throws:
DataflowAnalysisException
-
getFactAfterLocation
Get the dataflow fact representing the point just after given Location. Note "after" is meant in the logical sense, so for backward analyses, after means before the location in the control flow sense.- Parameters:
location
- the Location- Returns:
- the dataflow value after given Location
- Throws:
DataflowAnalysisException
-
getFactOnEdge
Get the fact that is true on the given control edge.- Parameters:
edge
- the edge- Returns:
- the fact that is true on the edge
- Throws:
DataflowAnalysisException
-
copy
Copy dataflow facts. -
initEntryFact
Initialize the "entry" fact for the graph.- Throws:
DataflowAnalysisException
-
makeFactTop
Make given fact the top value. -
isTop
Is the given fact the top value. -
isForwards
boolean isForwards()Returns true if the analysis is forwards, false if backwards. -
getBlockOrder
Return the BlockOrder specifying the order in which BasicBlocks should be visited in the main dataflow loop.- Parameters:
cfg
- the CFG upon which we're performing dataflow analysis
-
same
Are given dataflow facts the same? -
transfer
void transfer(BasicBlock basicBlock, @CheckForNull org.apache.bcel.generic.InstructionHandle end, Fact start, Fact result) throws DataflowAnalysisException Transfer 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
-
edgeTransfer
Edge transfer function. Modify the given fact that is true on the (logical) edge source to modify it so that it is true at the (logical) edge target.A do-nothing implementation is legal, and appropriate for analyses where branches are not significant.
- Parameters:
edge
- the Edgefact
- a dataflow fact- Throws:
DataflowAnalysisException
-
meetInto
Meet 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
-
startIteration
void startIteration()Called before beginning an iteration of analysis. Each iteration visits every basic block in the CFG. -
finishIteration
void finishIteration()Called after finishing an iteration of analysis. -
getLastUpdateTimestamp
-
setLastUpdateTimestamp
-
factToString
Return a String representation of given Fact. For debugging purposes.- Parameters:
fact
- a dataflow fact- Returns:
- String representation of the fact
-