Package com.ibm.wala.ipa.slicer
Class PDG<T extends InstanceKey>
- java.lang.Object
-
- com.ibm.wala.ipa.slicer.PDG<T>
-
- All Implemented Interfaces:
EdgeManager<Statement>,Graph<Statement>,NodeManager<Statement>,NumberedEdgeManager<Statement>,NumberedGraph<Statement>,NumberedNodeManager<Statement>,Iterable<Statement>
public class PDG<T extends InstanceKey> extends Object implements NumberedGraph<Statement>
Program dependence graph for a single call graph node
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPDG.DependencyBEGIN Custom change: control deps
-
Constructor Summary
Constructors Constructor Description 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 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 modRef, boolean ignoreAllocHeapDefs)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEdge(Statement src, Statement dst)voidaddNode(Statement n)add a node to this graphstatic Map<SSAInstruction,Integer>computeInstructionIndices(IR ir)booleancontainsNode(Statement N)booleanequals(Object obj)Set<Statement>getCallerParamStatements(SSAAbstractInvokeInstruction call)return the set of all PARAM_CALLER and HEAP_PARAM_CALLER statements associated with a given callSet<Statement>getCallerReturnStatements(SSAAbstractInvokeInstruction call)return the set of all NORMAL_RETURN_CALLER and HEAP_RETURN_CALLER statements associated with a given call.CGNodegetCallGraphNode()Set<Statement>getCallStatements(SSAAbstractInvokeInstruction call)return the set of all PARAM_CALLER, HEAP_PARAM_CALLER, and NORMAL statements (i.e., the actual call statement) associated with a given callintgetMaxNumber()StatementgetNode(int number)intgetNumber(Statement N)intgetNumberOfNodes()Statement[]getParamCalleeStatements()intgetPredNodeCount(Statement N)Return the number ofimmediate predecessornodes of nIntSetgetPredNodeNumbers(Statement node)Iterator<Statement>getPredNodes(Statement N)Return anIteratorover the immediate predecessor nodes of n This method never returnsnull.Statement[]getReturnStatements()intgetSuccNodeCount(Statement N)Return the number ofimmediate successornodes of this Node in the GraphIntSetgetSuccNodeNumbers(Statement node)Iterator<Statement>getSuccNodes(Statement N)Return an Iterator over the immediate successor nodes of nbooleanhasEdge(Statement src, Statement dst)inthashCode()booleanisControlDependend(Statement from, Statement to)BEGIN Custom change: control depsIterator<Statement>iterateNodes(IntSet s)Iterator<Statement>iterator()voidremoveAllIncidentEdges(Statement node)voidremoveEdge(Statement src, Statement dst)voidremoveIncomingEdges(Statement node)voidremoveNode(Statement n)remove a node from this graphvoidremoveNodeAndEdges(Statement N)remove a node and all its incident edgesvoidremoveOutgoingEdges(Statement node)static StatementssaInstruction2Statement(CGNode node, SSAInstruction s, Map<SSAInstruction,Integer> instructionIndices, IR ir)StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
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 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 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 Detail
-
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
public static Map<SSAInstruction,Integer> computeInstructionIndices(IR ir)
- Returns:
- for each SSAInstruction, its instruction index in the ir instruction array
-
getParamCalleeStatements
public Statement[] getParamCalleeStatements()
-
getReturnStatements
public Statement[] getReturnStatements()
-
getCallGraphNode
public CGNode getCallGraphNode()
-
getPredNodeCount
public int getPredNodeCount(Statement N) throws UnimplementedError
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
public Iterator<Statement> getPredNodes(Statement N)
Description copied from interface:EdgeManagerReturn anIteratorover the immediate predecessor nodes of n This method never returnsnull.- Specified by:
getPredNodesin interfaceEdgeManager<T extends InstanceKey>- Returns:
- an
Iteratorover the immediate predecessor nodes of this Node.
-
getSuccNodeCount
public int getSuccNodeCount(Statement N) throws UnimplementedError
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
public Iterator<Statement> getSuccNodes(Statement N)
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
public boolean hasEdge(Statement src, Statement dst) throws UnimplementedError
- Specified by:
hasEdgein interfaceEdgeManager<T extends InstanceKey>- Throws:
UnimplementedError
-
removeNodeAndEdges
public void removeNodeAndEdges(Statement N) throws UnsupportedOperationException
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
public void addNode(Statement n)
Description copied from interface:NodeManageradd a node to this graph- Specified by:
addNodein interfaceNodeManager<T extends InstanceKey>
-
containsNode
public boolean containsNode(Statement N)
- 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
public Iterator<Statement> iterator()
- Specified by:
iteratorin interfaceIterable<T extends InstanceKey>- Specified by:
iteratorin interfaceNodeManager<T extends InstanceKey>- Returns:
- an
Iteratorof the nodes in this graph
-
removeNode
public void removeNode(Statement n)
Description copied from interface:NodeManagerremove a node from this graph- Specified by:
removeNodein interfaceNodeManager<T extends InstanceKey>
-
addEdge
public void addEdge(Statement src, Statement dst)
- Specified by:
addEdgein interfaceEdgeManager<T extends InstanceKey>
-
removeAllIncidentEdges
public void removeAllIncidentEdges(Statement node) throws UnsupportedOperationException
- Specified by:
removeAllIncidentEdgesin interfaceEdgeManager<T extends InstanceKey>- Throws:
UnsupportedOperationException
-
removeEdge
public void removeEdge(Statement src, Statement dst) throws UnsupportedOperationException
- Specified by:
removeEdgein interfaceEdgeManager<T extends InstanceKey>- Throws:
UnsupportedOperationException
-
removeIncomingEdges
public void removeIncomingEdges(Statement node) throws UnsupportedOperationException
- Specified by:
removeIncomingEdgesin interfaceEdgeManager<T extends InstanceKey>- Throws:
UnsupportedOperationException
-
removeOutgoingEdges
public void removeOutgoingEdges(Statement node) throws UnsupportedOperationException
- Specified by:
removeOutgoingEdgesin interfaceEdgeManager<T extends InstanceKey>- Throws:
UnsupportedOperationException
-
getMaxNumber
public int getMaxNumber()
- Specified by:
getMaxNumberin interfaceNumberedNodeManager<T extends InstanceKey>
-
getNode
public Statement getNode(int number)
- Specified by:
getNodein interfaceNumberedNodeManager<T extends InstanceKey>
-
getNumber
public int getNumber(Statement N)
- Specified by:
getNumberin interfaceNumberedNodeManager<T extends InstanceKey>
-
iterateNodes
public Iterator<Statement> iterateNodes(IntSet s)
- Specified by:
iterateNodesin interfaceNumberedNodeManager<T extends InstanceKey>- Returns:
- iterator of nodes with the numbers in set s
-
getPredNodeNumbers
public IntSet getPredNodeNumbers(Statement node)
- Specified by:
getPredNodeNumbersin interfaceNumberedEdgeManager<T extends InstanceKey>- Returns:
- the numbers identifying the immediate predecessors of node
-
getSuccNodeNumbers
public IntSet getSuccNodeNumbers(Statement node)
- Specified by:
getSuccNodeNumbersin interfaceNumberedEdgeManager<T extends InstanceKey>- Returns:
- the numbers identifying the immediate successors of node
-
-