com.ibm.wala.demandpa.flowgraph
Class AbstractDemandFlowGraph

java.lang.Object
  extended by com.ibm.wala.util.graph.AbstractGraph<T>
      extended by com.ibm.wala.util.graph.AbstractNumberedGraph<T>
          extended by com.ibm.wala.util.graph.labeled.AbstractNumberedLabeledGraph<T,U>
              extended by com.ibm.wala.util.graph.labeled.SlowSparseNumberedLabeledGraph<java.lang.Object,IFlowLabel>
                  extended by com.ibm.wala.demandpa.flowgraph.AbstractFlowGraph
                      extended by com.ibm.wala.demandpa.flowgraph.AbstractDemandFlowGraph
All Implemented Interfaces:
IFlowGraph, EdgeManager<java.lang.Object>, Graph<java.lang.Object>, LabeledEdgeManager<java.lang.Object,IFlowLabel>, LabeledGraph<java.lang.Object,IFlowLabel>, NodeManager<java.lang.Object>, NumberedEdgeManager<java.lang.Object>, NumberedGraph<java.lang.Object>, NumberedNodeManager<java.lang.Object>, java.lang.Iterable<java.lang.Object>
Direct Known Subclasses:
DemandPointerFlowGraph, DemandValueFlowGraph

public abstract class AbstractDemandFlowGraph
extends AbstractFlowGraph

A graph representing program flow, constructed method-by-method on demand


Nested Class Summary
protected static interface AbstractDemandFlowGraph.FlowStatementVisitor
           
 
Field Summary
 
Fields inherited from class com.ibm.wala.demandpa.flowgraph.AbstractFlowGraph
callDefs, callParams, cg, cha, heapModel, mam, params, returns
 
Constructor Summary
AbstractDemandFlowGraph(CallGraph cg, HeapModel heapModel, MemoryAccessMap mam, IClassHierarchy cha)
           
 
Method Summary
protected  void addBlockInstructionConstraints(CGNode node, ControlFlowGraph<SSAInstruction,ISSABasicBlock> cfg, ISSABasicBlock b, AbstractDemandFlowGraph.FlowStatementVisitor v)
          Add constraints for a particular basic block.
protected  void addNodeInstructionConstraints(CGNode node, IR ir, DefUse du)
          Add pointer flow constraints based on instructions in a given node
protected abstract  void addNodesForParameters(CGNode node, IR ir)
           
 void addSubgraphForNode(CGNode node)
          add representation of flow for a node, if not already present
 java.util.Iterator<PointerKeyAndCallSite> getParamPreds(LocalPointerKey pk)
           
 java.util.Iterator<PointerKeyAndCallSite> getParamSuccs(LocalPointerKey pk)
           
 java.util.Set<CGNode> getPossibleTargets(CGNode node, CallSiteReference site, LocalPointerKey actualPk)
          get the callees that should be considered at a particular call site
 java.util.Set<CallerSiteContext> getPotentialCallers(PointerKey formalPk)
           
 java.util.Iterator<PointerKeyAndCallSite> getReturnPreds(LocalPointerKey pk)
           
 java.util.Iterator<PointerKeyAndCallSite> getReturnSuccs(LocalPointerKey pk)
           
 boolean hasSubgraphForNode(CGNode node)
           
protected abstract  AbstractDemandFlowGraph.FlowStatementVisitor makeVisitor(CGNode node)
           
protected  void unconditionallyAddConstraintsFromNode(CGNode node, IR ir)
           
 
Methods inherited from class com.ibm.wala.demandpa.flowgraph.AbstractFlowGraph
addExceptionDefConstraints, addNodeConstantConstraints, addNodePassthruExceptionConstraints, addNodesForInvocations, convertPointerKeyToHeapModel, getArrayReads, getInstrReturningTo, getInstrsPassingParam, getReadsOfInstanceField, getReadsOfStaticField, getWritesToInstanceField, getWritesToStaticField, isParam, visitPreds, visitSuccs
 
Methods inherited from class com.ibm.wala.util.graph.labeled.SlowSparseNumberedLabeledGraph
copyInto, duplicate, getEdgeManager, getNodeManager
 
Methods inherited from class com.ibm.wala.util.graph.labeled.AbstractNumberedLabeledGraph
addEdge, getDefaultLabel, getEdgeLabels, getPredLabels, getPredNodeCount, getPredNodeNumbers, getPredNodes, getSuccLabels, getSuccNodeCount, getSuccNodeNumbers, getSuccNodes, hasEdge, removeEdge
 
Methods inherited from class com.ibm.wala.util.graph.AbstractNumberedGraph
getMaxNumber, getNode, getNumber, getPredNodeNumbers, getSuccNodeNumbers, iterateNodes
 
Methods inherited from class com.ibm.wala.util.graph.AbstractGraph
addEdge, addNode, containsNode, getNumberOfNodes, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, iterator, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeNodeAndEdges, removeOutgoingEdges, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.wala.util.graph.Graph
removeNodeAndEdges
 
Methods inherited from interface com.ibm.wala.util.graph.NodeManager
addNode, containsNode, getNumberOfNodes, iterator, removeNode
 
Methods inherited from interface com.ibm.wala.util.graph.EdgeManager
addEdge, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdges
 
Methods inherited from interface com.ibm.wala.util.graph.labeled.LabeledEdgeManager
addEdge, getDefaultLabel, getEdgeLabels, getPredLabels, getPredNodeCount, getPredNodes, getSuccLabels, getSuccNodeCount, getSuccNodes, hasEdge, removeEdge
 
Methods inherited from interface com.ibm.wala.util.graph.EdgeManager
addEdge, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdges
 

Constructor Detail

AbstractDemandFlowGraph

public AbstractDemandFlowGraph(CallGraph cg,
                               HeapModel heapModel,
                               MemoryAccessMap mam,
                               IClassHierarchy cha)
Method Detail

addSubgraphForNode

public void addSubgraphForNode(CGNode node)
                        throws java.lang.IllegalArgumentException
Description copied from interface: IFlowGraph
add representation of flow for a node, if not already present

Throws:
java.lang.IllegalArgumentException - if node == null

hasSubgraphForNode

public boolean hasSubgraphForNode(CGNode node)

getParamSuccs

public java.util.Iterator<PointerKeyAndCallSite> getParamSuccs(LocalPointerKey pk)

getParamPreds

public java.util.Iterator<PointerKeyAndCallSite> getParamPreds(LocalPointerKey pk)

getReturnSuccs

public java.util.Iterator<PointerKeyAndCallSite> getReturnSuccs(LocalPointerKey pk)

getReturnPreds

public java.util.Iterator<PointerKeyAndCallSite> getReturnPreds(LocalPointerKey pk)

addNodesForParameters

protected abstract void addNodesForParameters(CGNode node,
                                              IR ir)

unconditionallyAddConstraintsFromNode

protected void unconditionallyAddConstraintsFromNode(CGNode node,
                                                     IR ir)

addNodeInstructionConstraints

protected void addNodeInstructionConstraints(CGNode node,
                                             IR ir,
                                             DefUse du)
Add pointer flow constraints based on instructions in a given node


addBlockInstructionConstraints

protected void addBlockInstructionConstraints(CGNode node,
                                              ControlFlowGraph<SSAInstruction,ISSABasicBlock> cfg,
                                              ISSABasicBlock b,
                                              AbstractDemandFlowGraph.FlowStatementVisitor v)
Add constraints for a particular basic block.


makeVisitor

protected abstract AbstractDemandFlowGraph.FlowStatementVisitor makeVisitor(CGNode node)

getPotentialCallers

public java.util.Set<CallerSiteContext> getPotentialCallers(PointerKey formalPk)
Parameters:
formalPk - a PointerKey representing either a formal parameter or return value
Returns:
the CallerSiteContexts representing pointer callers of formalPk's method

getPossibleTargets

public java.util.Set<CGNode> getPossibleTargets(CGNode node,
                                                CallSiteReference site,
                                                LocalPointerKey actualPk)
Description copied from interface: IFlowGraph
get the callees that should be considered at a particular call site

Parameters:
node - the caller
site - the call site
actualPk - a LocalPointerKey corresponding to the actual parameter or return value of interest. This may be used to filter out certain callees.
Returns:
the callees of interest