edu.umd.cs.findbugs.ba

Interface DataflowAnalysis<Fact>

public interface DataflowAnalysis<Fact>

A dataflow analysis to be used with the Dataflow class.

Author: David Hovemeyer

See Also: Dataflow

Method Summary
voidcopy(Fact source, Fact dest)
Copy dataflow facts.
FactcreateFact()
Create empty (uninitialized) dataflow facts for one program point.
voidedgeTransfer(Edge edge, Fact fact)
Edge transfer function.
voidfinishIteration()
Called after finishing an iteration of analysis.
BlockOrdergetBlockOrder(CFG cfg)
Return the BlockOrder specifying the order in which BasicBlocks should be visited in the main dataflow loop.
intgetLastUpdateTimestamp(Fact fact)
FactgetResultFact(BasicBlock block)
Get the result fact for given basic block.
FactgetStartFact(BasicBlock block)
Get the start fact for given basic block.
voidinitEntryFact(Fact result)
Initialize the "entry" fact for the graph.
voidinitResultFact(Fact result)
Initialize result fact for block.
booleanisForwards()
Returns true if the analysis is forwards, false if backwards.
booleanisTop(Fact fact)
Is the given fact the top value.
voidmakeFactTop(Fact fact)
Make given fact the top value.
voidmeetInto(Fact fact, Edge edge, Fact result)
Meet a dataflow fact associated with an incoming edge into another fact.
booleansame(Fact fact1, Fact fact2)
Are given dataflow facts the same?
voidsetLastUpdateTimestamp(Fact fact, int timestamp)
voidstartIteration()
Called before beginning an iteration of analysis.
voidtransfer(BasicBlock basicBlock, InstructionHandle end, Fact start, Fact result)
Transfer function for the analysis.

Method Detail

copy

public void copy(Fact source, Fact dest)
Copy dataflow facts.

createFact

public Fact createFact()
Create empty (uninitialized) dataflow facts for one program point. A valid value will be copied into it before it is used.

edgeTransfer

public void edgeTransfer(Edge edge, Fact fact)
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 Edge fact a dataflow fact

Throws: DataflowAnalysisException

finishIteration

public void finishIteration()
Called after finishing an iteration of analysis.

getBlockOrder

public BlockOrder getBlockOrder(CFG cfg)
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

getLastUpdateTimestamp

public int getLastUpdateTimestamp(Fact fact)

getResultFact

public Fact getResultFact(BasicBlock block)
Get the result fact for given basic block.

Parameters: block the basic block

getStartFact

public Fact getStartFact(BasicBlock block)
Get the start fact for given basic block.

Parameters: block the basic block

initEntryFact

public void initEntryFact(Fact result)
Initialize the "entry" fact for the graph.

initResultFact

public void initResultFact(Fact result)
Initialize result fact for block. The start facts for a block are initialized as the meet of the "logical" predecessor's result facts. Note that a "logical predecessor" is actually a CFG successor if the analysis is backwards.

isForwards

public boolean isForwards()
Returns true if the analysis is forwards, false if backwards.

isTop

public boolean isTop(Fact fact)
Is the given fact the top value.

makeFactTop

public void makeFactTop(Fact fact)
Make given fact the top value.

meetInto

public void meetInto(Fact fact, Edge edge, Fact result)
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 predecessor result the result fact

same

public boolean same(Fact fact1, Fact fact2)
Are given dataflow facts the same?

setLastUpdateTimestamp

public void setLastUpdateTimestamp(Fact fact, int timestamp)

startIteration

public void startIteration()
Called before beginning an iteration of analysis. Each iteration visits every basic block in the CFG.

transfer

public void transfer(BasicBlock basicBlock, InstructionHandle end, Fact start, Fact result)
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 block end if nonnull, stop before considering this instruction; otherwise, consider all of the instructions in the basic block start 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

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.