V - the abstract value type to be tracked by the analysisS - the store type used in the analysisT - the transfer function type that is used to approximate runtime behaviorpublic class BackwardAnalysisImpl<V extends AbstractValue<V>,S extends Store<S>,T extends BackwardTransferFunction<V,S>> extends AbstractAnalysis<V,S,T> implements BackwardAnalysis<V,S,T>
AbstractAnalysis.WorklistAnalysis.BeforeOrAfter, Analysis.Direction| Modifier and Type | Field and Description |
|---|---|
protected IdentityHashMap<ExceptionBlock,S> |
exceptionStores
Exception store of an exception block, propagated by exceptional successors of its exception
block, and merged with the normal
TransferResult. |
protected IdentityHashMap<Block,S> |
outStores
Out stores after every basic block (assumed to be 'no information' if not present).
|
protected S |
storeAtEntry
The store right before the entry block.
|
cfg, currentInput, currentNode, currentTree, direction, finalLocalValues, inputs, isRunning, nodeValues, transferFunction, worklist| Constructor and Description |
|---|
BackwardAnalysisImpl()
Construct an object that can perform a org.checkerframework.dataflow backward analysis over a
control flow graph.
|
BackwardAnalysisImpl(T transferFunction)
Construct an object that can perform a org.checkerframework.dataflow backward analysis over a
control flow graph given a transfer function.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addStoreAfter(Block pred,
@Nullable Node node,
S s,
boolean addBlockToWorklist)
Add a store after the basic block
pred by merging with the existing stores for that
location. |
S |
getEntryStore()
Get the output store at the entry block of a given control flow graph.
|
@Nullable TransferInput<V,S> |
getInput(Block b)
Get the transfer input of a given
Block b. |
protected S |
getStoreAfter(Block b)
Returns the store corresponding to the location right after the basic block
b. |
protected void |
initFields(ControlFlowGraph cfg)
Initialize fields of this object based on a given control flow graph.
|
protected void |
initInitialInputs()
Initialize the transfer inputs of every basic block before performing the analysis.
|
void |
performAnalysis(ControlFlowGraph cfg)
Perform the actual analysis.
|
void |
performAnalysisBlock(Block b)
Perform the actual analysis on one block.
|
protected void |
propagateStoresTo(Block pred,
@Nullable Node node,
TransferInput<V,S> currentInput,
Store.FlowRule flowRule,
boolean addToWorklistAgain)
Propagate the stores in
currentInput to the next block in the direction of analysis,
according to the flowRule. |
S |
runAnalysisFor(Node node,
Analysis.BeforeOrAfter preOrPost,
TransferInput<V,S> blockTransferInput,
IdentityHashMap<Node,V> nodeValues,
Map<TransferInput<V,S>,IdentityHashMap<Node,TransferResult<V,S>>> analysisCaches)
Runs the analysis again within the block of
node and returns the store at the
location of node. |
addToWorklist, callTransferFunction, getContainingClass, getContainingMethod, getCurrentTree, getDirection, getExceptionalExitStore, getNodesForTree, getNodeValues, getRegularExitStore, getResult, getTransferFunction, getValue, getValue, init, isIgnoredExceptionType, isRunning, readFromStore, setCurrentNode, setCurrentTree, updateNodeValuesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDirection, getExceptionalExitStore, getRegularExitStore, getResult, getTransferFunction, getValue, getValue, isRunningprotected final IdentityHashMap<Block,S extends Store<S>> outStores
protected final IdentityHashMap<ExceptionBlock,S extends Store<S>> exceptionStores
TransferResult.public BackwardAnalysisImpl()
org.checkerframework.framework.flow.CFAbstractAnalysis.public BackwardAnalysisImpl(T transferFunction)
transferFunction - the transfer functionpublic void performAnalysis(ControlFlowGraph cfg)
AnalysisperformAnalysis in interface Analysis<V extends AbstractValue<V>,S extends Store<S>,T extends BackwardTransferFunction<V,S>>cfg - the control flow graphpublic void performAnalysisBlock(Block b)
AnalysisperformAnalysisBlock in interface Analysis<V extends AbstractValue<V>,S extends Store<S>,T extends BackwardTransferFunction<V,S>>b - the block to analyzepublic @Nullable TransferInput<V,S> getInput(Block b)
AnalysisBlock b.public S getEntryStore()
BackwardAnalysisgetEntryStore in interface BackwardAnalysis<V extends AbstractValue<V>,S extends Store<S>,T extends BackwardTransferFunction<V,S>>protected void initFields(ControlFlowGraph cfg)
AbstractAnalysisinitFields in class AbstractAnalysis<V extends AbstractValue<V>,S extends Store<S>,T extends BackwardTransferFunction<V,S>>cfg - a given control flow graph@RequiresNonNull(value="cfg") protected void initInitialInputs()
AbstractAnalysisinitInitialInputs in class AbstractAnalysis<V extends AbstractValue<V>,S extends Store<S>,T extends BackwardTransferFunction<V,S>>protected void propagateStoresTo(Block pred, @Nullable Node node, TransferInput<V,S> currentInput, Store.FlowRule flowRule, boolean addToWorklistAgain)
AbstractAnalysiscurrentInput to the next block in the direction of analysis,
according to the flowRule.propagateStoresTo in class AbstractAnalysis<V extends AbstractValue<V>,S extends Store<S>,T extends BackwardTransferFunction<V,S>>pred - the target block to propagate the stores tonode - the node of the target blockcurrentInput - the current transfer inputflowRule - the flow rule being usedaddToWorklistAgain - whether the block should be added to AbstractAnalysis.worklist againprotected void addStoreAfter(Block pred, @Nullable Node node, S s, boolean addBlockToWorklist)
pred by merging with the existing stores for that
location.pred - the basic blocknode - the node of the basic block bs - the store being addedaddBlockToWorklist - whether the basic block b should be added back to Worklistprotected S getStoreAfter(Block b)
b.b - the given blockpublic S runAnalysisFor(@FindDistinct Node node, Analysis.BeforeOrAfter preOrPost, TransferInput<V,S> blockTransferInput, IdentityHashMap<Node,V> nodeValues, Map<TransferInput<V,S>,IdentityHashMap<Node,TransferResult<V,S>>> analysisCaches)
Analysisnode and returns the store at the
location of node. If before is true, then the store immediately before the
Node node is returned. Otherwise, the store immediately after node is
returned. If analysisCaches is not null, this method uses a cache. analysisCaches is a map of a block of node to the cached analysis result. If the cache for
transferInput is not in analysisCaches, this method creates new cache and
stores it in analysisCaches. The cache is a map of nodes to the analysis results of
the nodes.runAnalysisFor in interface Analysis<V extends AbstractValue<V>,S extends Store<S>,T extends BackwardTransferFunction<V,S>>node - the node to analyzepreOrPost - which store to return: the store immediately before node or the
store after nodeblockTransferInput - the transfer input of the block of this nodenodeValues - abstract values of nodesanalysisCaches - caches of analysis resultsnode (depends on the value of before) after
running the analysis