Class PDG<T extends InstanceKey>
java.lang.Object
com.ibm.wala.ipa.slicer.PDG<T>
- All Implemented Interfaces:
EdgeManager<Statement>, Graph<Statement>, LabeledEdgeManager<Statement, Dependency>, NumberedLabeledEdgeManager<Statement, Dependency>, NumberedLabeledGraph<Statement, Dependency>, NodeManager<Statement>, NumberedEdgeManager<Statement>, NumberedGraph<Statement>, NumberedNodeManager<Statement>, Iterable<Statement>
public class PDG<T extends InstanceKey>
extends Object
implements NumberedLabeledGraph<Statement, Dependency>
Program dependence graph for a single call graph node
-
Constructor Summary
ConstructorsConstructorDescriptionPDG(CGNode node, PointerAnalysis<T> pa, Map<CGNode, OrdinalSet<PointerKey>> mod, Map<CGNode, OrdinalSet<PointerKey>> ref, Slicer.DataDependenceOptions dOptions, Slicer.ControlDependenceOptions cOptions, HeapExclusions exclusions, CallGraph cg, ModRef<T> modRef) PDG(CGNode node, PointerAnalysis<T> pa, Map<CGNode, OrdinalSet<PointerKey>> mod, Map<CGNode, OrdinalSet<PointerKey>> ref, Slicer.DataDependenceOptions dOptions, Slicer.ControlDependenceOptions cOptions, HeapExclusions exclusions, CallGraph cg, ModRef<T> modRef, boolean ignoreAllocHeapDefs) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddEdge(Statement src, Statement dst, Dependency label) adds an edge with some labelvoidadd a node to this graphstatic Map<SSAInstruction, Integer> booleanbooleanreturn the set of all PARAM_CALLER and HEAP_PARAM_CALLER statements associated with a given callreturn the set of all NORMAL_RETURN_CALLER and HEAP_RETURN_CALLER statements associated with a given call.return the set of all PARAM_CALLER, HEAP_PARAM_CALLER, and NORMAL statements (i.e., the actual call statement) associated with a given callSets the default object used as label for operations where no specific edge label is provided.Set<? extends Dependency> getEdgeLabels(Statement src, Statement dst) Returns a set of all labeled edges between node src and node dstintgetNode(int number) intintIterator<? extends Dependency> intReturn the number ofimmediate predecessornodes of nintgetPredNodeCount(Statement N, Dependency label) Return the number ofimmediate predecessornodes of this Node in the Graph on edges with some label.getPredNodeNumbers(Statement node) getPredNodeNumbers(Statement node, Dependency label) Return anIteratorover the immediate predecessor nodes of ngetPredNodes(Statement N, Dependency label) Return an Iterator over the immediate predecessor nodes of this Node in the Graph on edges with some label.Iterator<? extends Dependency> intReturn the number ofimmediate successornodes of this Node in the GraphintgetSuccNodeCount(Statement N, Dependency label) Return the number ofimmediate successornodes of this Node in the GraphgetSuccNodeNumbers(Statement node) getSuccNodeNumbers(Statement node, Dependency label) Return an Iterator over the immediate successor nodes of ngetSuccNodes(Statement N, Dependency label) Return an Iterator over the immediate successor nodes of this Node in the Graph on edges with some label.booleanbooleanhasEdge(Statement src, Statement dst, Dependency label) inthashCode()iterator()voidvoidremoveEdge(Statement src, Statement dst) voidremoveEdge(Statement src, Statement dst, Dependency label) voidremoveIncomingEdges(Statement node) voidremove a node from this graphvoidremove a node and all its incident edgesvoidremoveOutgoingEdges(Statement node) static StatementssaInstruction2Statement(CGNode node, SSAInstruction s, Map<SSAInstruction, Integer> instructionIndices, IR ir) stream()toString()Methods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface LabeledEdgeManager
getPredNodes
-
Constructor Details
-
PDG
public PDG(CGNode node, PointerAnalysis<T> pa, Map<CGNode, OrdinalSet<PointerKey>> mod, Map<CGNode, OrdinalSet<PointerKey>> ref, Slicer.DataDependenceOptions dOptions, Slicer.ControlDependenceOptions cOptions, HeapExclusions exclusions, CallGraph cg, ModRef<T> modRef) - Parameters:
mod- the set of heap locations which may be written (transitively) by this node. These are logically return values in the SDG.ref- the set of heap locations which may be read (transitively) by this node. These are logically parameters in the SDG.- Throws:
IllegalArgumentException- if node is null
-
PDG
public PDG(CGNode node, PointerAnalysis<T> pa, Map<CGNode, OrdinalSet<PointerKey>> mod, Map<CGNode, OrdinalSet<PointerKey>> ref, Slicer.DataDependenceOptions dOptions, Slicer.ControlDependenceOptions cOptions, HeapExclusions exclusions, CallGraph cg, ModRef<T> modRef, boolean ignoreAllocHeapDefs) - Parameters:
mod- the set of heap locations which may be written (transitively) by this node. These are logically return values in the SDG.ref- the set of heap locations which may be read (transitively) by this node. These are logically parameters in the SDG.- Throws:
IllegalArgumentException- if node is null
-
-
Method Details
-
getCallerParamStatements
public Set<Statement> getCallerParamStatements(SSAAbstractInvokeInstruction call) throws IllegalArgumentException return the set of all PARAM_CALLER and HEAP_PARAM_CALLER statements associated with a given call- Throws:
IllegalArgumentException
-
getCallStatements
public Set<Statement> getCallStatements(SSAAbstractInvokeInstruction call) throws IllegalArgumentException return the set of all PARAM_CALLER, HEAP_PARAM_CALLER, and NORMAL statements (i.e., the actual call statement) associated with a given call- Throws:
IllegalArgumentException
-
getCallerReturnStatements
public Set<Statement> getCallerReturnStatements(SSAAbstractInvokeInstruction call) throws IllegalArgumentException return the set of all NORMAL_RETURN_CALLER and HEAP_RETURN_CALLER statements associated with a given call.- Throws:
IllegalArgumentException
-
ssaInstruction2Statement
public static Statement ssaInstruction2Statement(CGNode node, SSAInstruction s, Map<SSAInstruction, Integer> instructionIndices, IR ir) -
computeInstructionIndices
- Returns:
- for each SSAInstruction, its instruction index in the ir instruction array
-
toString
-
getParamCalleeStatements
-
getReturnStatements
-
getCallGraphNode
-
equals
-
hashCode
-
getPredNodeCount
Description copied from interface:EdgeManagerReturn the number ofimmediate predecessornodes of n- Specified by:
getPredNodeCountin interfaceEdgeManager<T extends InstanceKey>- Returns:
- the number of immediate predecessors of n.
- Throws:
UnimplementedError
-
getPredNodes
Description copied from interface:EdgeManagerReturn anIteratorover the immediate predecessor nodes of nThis method never returns
null.- Specified by:
getPredNodesin interfaceEdgeManager<T extends InstanceKey>- Returns:
- an
Iteratorover the immediate predecessor nodes of this Node.
-
getSuccNodeCount
Description copied from interface:EdgeManagerReturn the number ofimmediate successornodes of this Node in the Graph- Specified by:
getSuccNodeCountin interfaceEdgeManager<T extends InstanceKey>- Returns:
- the number of immediate successor Nodes of this Node in the Graph.
- Throws:
UnimplementedError
-
getSuccNodes
Description copied from interface:EdgeManagerReturn an Iterator over the immediate successor nodes of nThis method never returns
null.- Specified by:
getSuccNodesin interfaceEdgeManager<T extends InstanceKey>- Returns:
- an Iterator over the immediate successor nodes of n
-
hasEdge
- Specified by:
hasEdgein interfaceEdgeManager<T extends InstanceKey>- Throws:
UnimplementedError
-
removeNodeAndEdges
Description copied from interface:Graphremove a node and all its incident edges- Specified by:
removeNodeAndEdgesin interfaceGraph<T extends InstanceKey>- Throws:
UnsupportedOperationException- if the graph implementation does not allow removal
-
addNode
Description copied from interface:NodeManageradd a node to this graph- Specified by:
addNodein interfaceNodeManager<T extends InstanceKey>
-
containsNode
- Specified by:
containsNodein interfaceNodeManager<T extends InstanceKey>- Returns:
- true iff the graph contains the specified node
-
getNumberOfNodes
public int getNumberOfNodes()- Specified by:
getNumberOfNodesin interfaceNodeManager<T extends InstanceKey>- Returns:
- the number of nodes in this graph
-
iterator
- Specified by:
iteratorin interfaceIterable<T extends InstanceKey>- Specified by:
iteratorin interfaceNodeManager<T extends InstanceKey>- Returns:
- an
Iteratorof the nodes in this graph
-
stream
- Specified by:
streamin interfaceNodeManager<T extends InstanceKey>- Returns:
- a
Streamof the nodes in this graph
-
removeNode
Description copied from interface:NodeManagerremove a node from this graph- Specified by:
removeNodein interfaceNodeManager<T extends InstanceKey>
-
addEdge
- Specified by:
addEdgein interfaceEdgeManager<T extends InstanceKey>
-
removeAllIncidentEdges
- Specified by:
removeAllIncidentEdgesin interfaceEdgeManager<T extends InstanceKey>- Throws:
UnsupportedOperationException
-
removeEdge
- Specified by:
removeEdgein interfaceEdgeManager<T extends InstanceKey>- Throws:
UnsupportedOperationException
-
removeIncomingEdges
- Specified by:
removeIncomingEdgesin interfaceEdgeManager<T extends InstanceKey>- Throws:
UnsupportedOperationException
-
removeOutgoingEdges
- Specified by:
removeOutgoingEdgesin interfaceEdgeManager<T extends InstanceKey>- Throws:
UnsupportedOperationException
-
getMaxNumber
public int getMaxNumber()- Specified by:
getMaxNumberin interfaceNumberedNodeManager<T extends InstanceKey>
-
getNode
- Specified by:
getNodein interfaceNumberedNodeManager<T extends InstanceKey>
-
getNumber
- Specified by:
getNumberin interfaceNumberedNodeManager<T extends InstanceKey>
-
iterateNodes
- Specified by:
iterateNodesin interfaceNumberedNodeManager<T extends InstanceKey>- Returns:
- iterator of nodes with the numbers in set s
-
getPredNodeNumbers
- Specified by:
getPredNodeNumbersin interfaceNumberedEdgeManager<T extends InstanceKey>- Returns:
- the numbers identifying the immediate predecessors of node
-
getSuccNodeNumbers
- Specified by:
getSuccNodeNumbersin interfaceNumberedEdgeManager<T extends InstanceKey>- Returns:
- the numbers identifying the immediate successors of node
-
getPredNodeNumbers
- Specified by:
getPredNodeNumbersin interfaceNumberedLabeledEdgeManager<Statement, Dependency>- Throws:
IllegalArgumentException
-
getSuccNodeNumbers
- Specified by:
getSuccNodeNumbersin interfaceNumberedLabeledEdgeManager<Statement, Dependency>- Throws:
IllegalArgumentException
-
getDefaultLabel
Description copied from interface:LabeledEdgeManagerSets the default object used as label for operations where no specific edge label is provided. This is due to compatibility with the EdgeManager interface- Specified by:
getDefaultLabelin interfaceLabeledEdgeManager<Statement, Dependency>
-
getPredNodes
Description copied from interface:LabeledEdgeManagerReturn an Iterator over the immediate predecessor nodes of this Node in the Graph on edges with some label.This method never returns
null.- Specified by:
getPredNodesin interfaceLabeledEdgeManager<Statement, Dependency>- Returns:
- an Iterator over the immediate predecessor nodes of this Node.
-
getPredLabels
- Specified by:
getPredLabelsin interfaceLabeledEdgeManager<Statement, Dependency>- Returns:
- the labels on edges whose destination is N
-
getPredNodeCount
Description copied from interface:LabeledEdgeManagerReturn the number ofimmediate predecessornodes of this Node in the Graph on edges with some label.- Specified by:
getPredNodeCountin interfaceLabeledEdgeManager<Statement, Dependency>- Returns:
- the number of immediate predecessor Nodes of this Node in the Graph.
-
getSuccNodes
Description copied from interface:LabeledEdgeManagerReturn an Iterator over the immediate successor nodes of this Node in the Graph on edges with some label.This method never returns
null.- Specified by:
getSuccNodesin interfaceLabeledEdgeManager<Statement, Dependency>- Returns:
- an Iterator over the immediate successor Nodes of this Node.
-
getSuccLabels
- Specified by:
getSuccLabelsin interfaceLabeledEdgeManager<Statement, Dependency>- Returns:
- the labels on edges whose source is N
-
getSuccNodeCount
Description copied from interface:LabeledEdgeManagerReturn the number ofimmediate successornodes of this Node in the Graph- Specified by:
getSuccNodeCountin interfaceLabeledEdgeManager<Statement, Dependency>- Returns:
- the number of immediate successor Nodes of this Node in the Graph.
-
addEdge
Description copied from interface:LabeledEdgeManageradds an edge with some label- Specified by:
addEdgein interfaceLabeledEdgeManager<Statement, Dependency>
-
removeEdge
public void removeEdge(Statement src, Statement dst, Dependency label) throws UnsupportedOperationException - Specified by:
removeEdgein interfaceLabeledEdgeManager<Statement, Dependency>- Throws:
UnsupportedOperationException
-
hasEdge
- Specified by:
hasEdgein interfaceLabeledEdgeManager<Statement, Dependency>
-
getEdgeLabels
Description copied from interface:LabeledEdgeManagerReturns a set of all labeled edges between node src and node dst- Specified by:
getEdgeLabelsin interfaceLabeledEdgeManager<Statement, Dependency>- Parameters:
src- source node of the edgedst- target node of the edge- Returns:
- Set of edge labels
-