Class ICFGSupergraph
java.lang.Object
com.ibm.wala.dataflow.IFDS.ICFGSupergraph
- All Implemented Interfaces:
ISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>, EdgeManager<BasicBlockInContext<IExplodedBasicBlock>>, Graph<BasicBlockInContext<IExplodedBasicBlock>>, NodeManager<BasicBlockInContext<IExplodedBasicBlock>>, NumberedEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>, NumberedGraph<BasicBlockInContext<IExplodedBasicBlock>>, NumberedNodeManager<BasicBlockInContext<IExplodedBasicBlock>>, Iterable<BasicBlockInContext<IExplodedBasicBlock>>
public class ICFGSupergraph
extends Object
implements ISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>
Forward supergraph induced over an
ExplodedInterproceduralCFG
This should lazily build the supergraph as it is explored.
- Author:
- sjfink
-
Field Summary
Fields inherited from interface ISupergraph
CALL_EDGE, CALL_TO_RETURN_EDGE, OTHER, RETURN_EDGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidadd a node to this graphbyteclassifyEdge(BasicBlockInContext<IExplodedBasicBlock> src, BasicBlockInContext<IExplodedBasicBlock> dest) booleanIterator<? extends BasicBlockInContext<IExplodedBasicBlock>> getCallSites(BasicBlockInContext<IExplodedBasicBlock> r, CGNode callee) getEntriesForProcedure(CGNode procedure) getExitsForProcedure(CGNode procedure) getICFG()getLocalBlock(CGNode procedure, int i) intintgetNode(int number) intintgetNumberOfBlocks(CGNode procedure) intintReturn the number ofimmediate predecessornodes of nReturn anIteratorover the immediate predecessor nodes of nIterator<? extends BasicBlockInContext<IExplodedBasicBlock>> getReturnSites(BasicBlockInContext<IExplodedBasicBlock> call, CGNode callee) intReturn the number ofimmediate successornodes of this Node in the GraphReturn an Iterator over the immediate successor nodes of nbooleanbooleanbooleanbooleanbooleaniterator()static ICFGSupergraphvoidvoidremoveEdge(BasicBlockInContext<IExplodedBasicBlock> src, BasicBlockInContext<IExplodedBasicBlock> dst) voidvoidremove a node from this graphvoidremove a node and all its incident edgesvoidstream()toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
ICFGSupergraph
-
-
Method Details
-
make
-
getProcedureGraph
- Specified by:
getProcedureGraphin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Returns:
- the graph of procedures (e.g. a call graph) over which this supergraph is induced.
-
getClassHierarchy
-
classifyEdge
public byte classifyEdge(BasicBlockInContext<IExplodedBasicBlock> src, BasicBlockInContext<IExplodedBasicBlock> dest) - Specified by:
classifyEdgein interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Parameters:
src- node in the supergraphdest- a successor of src in the supergraph- Returns:
- one of CALL_EDGE, RETURN_EDGE, CALL_TO_RETURN_EDGE, or OTHER
-
getCallSites
public Iterator<BasicBlockInContext<IExplodedBasicBlock>> getCallSites(BasicBlockInContext<IExplodedBasicBlock> r, CGNode callee) - Specified by:
getCallSitesin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Parameters:
r- a "return" node in the supergraphcallee- a "called" "procedure" in the supergraph. if callee is null, answer return sites for which no callee was found.- Returns:
- the corresponding call nodes. There may be many.
-
getCalledNodes
public Iterator<? extends BasicBlockInContext<IExplodedBasicBlock>> getCalledNodes(BasicBlockInContext<IExplodedBasicBlock> call) - Specified by:
getCalledNodesin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Parameters:
call- a "call" node in the supergraph- Returns:
- an Iterator of nodes that are targets of this call.
-
getEntriesForProcedure
- Specified by:
getEntriesForProcedurein interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Returns:
- the blocks in the supergraph that represents entry nodes for procedure p
-
getExitsForProcedure
- Specified by:
getExitsForProcedurein interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Returns:
- the blocks in the supergraph that represents exit nodes for procedure p
-
getLocalBlock
- Specified by:
getLocalBlockin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Parameters:
procedure- an object that represents a procedurei- the "logical" basic block number of a node in the procedure- Returns:
- the corresponding node in the supergraph
-
getLocalBlockNumber
- Specified by:
getLocalBlockNumberin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Parameters:
n- a node in the supergraph- Returns:
- the "logical" basic block number of n in its procedure
-
getMainEntry
-
getNormalSuccessors
public Iterator<BasicBlockInContext<IExplodedBasicBlock>> getNormalSuccessors(BasicBlockInContext<IExplodedBasicBlock> call) - Specified by:
getNormalSuccessorsin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Parameters:
call- a "call" node in the supergraph- Returns:
- an Iterator of nodes that are normal (non-call) successors of this call. This should only apply to backwards problems, where we might have, say, a call and a goto flow into a return site.
-
getNumberOfBlocks
- Specified by:
getNumberOfBlocksin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Parameters:
procedure- an object that represents a procedure- Returns:
- the number of blocks from this procedure in this supergraph
-
getProcOf
- Specified by:
getProcOfin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Parameters:
n- a node in the supergraph- Returns:
- an object which represents the procedure which contains n
-
getReturnSites
public Iterator<? extends BasicBlockInContext<IExplodedBasicBlock>> getReturnSites(BasicBlockInContext<IExplodedBasicBlock> call, CGNode callee) - Specified by:
getReturnSitesin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Parameters:
call- a "call" node in the supergraphcallee- a "called" "procedure" in the supergraph. if callee is null, answer return sites for which no callee was found.- Returns:
- the corresponding return nodes. There may be many, because of exceptional control flow.
-
isCall
- Specified by:
isCallin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Parameters:
n- a node in this supergraph- Returns:
- true iff this node includes a call.
-
isEntry
- Specified by:
isEntryin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Returns:
- true iff this node is an entry node s_p for a procedure
-
isExit
- Specified by:
isExitin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Parameters:
n- a node in the supergraph- Returns:
- true iff this node is an exit node
-
isReturn
- Specified by:
isReturnin interfaceISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode>- Parameters:
n- a node in this supergraph- Returns:
- true iff this node is a return site.
-
removeNodeAndEdges
public void removeNodeAndEdges(BasicBlockInContext<IExplodedBasicBlock> N) throws UnsupportedOperationException Description copied from interface:Graphremove a node and all its incident edges- Specified by:
removeNodeAndEdgesin interfaceGraph<BasicBlockInContext<IExplodedBasicBlock>>- 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<BasicBlockInContext<IExplodedBasicBlock>>
-
containsNode
- Specified by:
containsNodein interfaceNodeManager<BasicBlockInContext<IExplodedBasicBlock>>- Returns:
- true iff the graph contains the specified node
-
getNumberOfNodes
public int getNumberOfNodes()- Specified by:
getNumberOfNodesin interfaceNodeManager<BasicBlockInContext<IExplodedBasicBlock>>- Returns:
- the number of nodes in this graph
-
iterator
- Specified by:
iteratorin interfaceIterable<BasicBlockInContext<IExplodedBasicBlock>>- Specified by:
iteratorin interfaceNodeManager<BasicBlockInContext<IExplodedBasicBlock>>- Returns:
- an
Iteratorof the nodes in this graph
-
stream
- Specified by:
streamin interfaceNodeManager<BasicBlockInContext<IExplodedBasicBlock>>- Returns:
- a
Streamof the nodes in this graph
-
removeNode
Description copied from interface:NodeManagerremove a node from this graph- Specified by:
removeNodein interfaceNodeManager<BasicBlockInContext<IExplodedBasicBlock>>
-
addEdge
public void addEdge(BasicBlockInContext<IExplodedBasicBlock> src, BasicBlockInContext<IExplodedBasicBlock> dst) - Specified by:
addEdgein interfaceEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
-
getPredNodeCount
Description copied from interface:EdgeManagerReturn the number ofimmediate predecessornodes of n- Specified by:
getPredNodeCountin interfaceEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>- Returns:
- the number of immediate predecessors of n.
-
getPredNodes
public Iterator<BasicBlockInContext<IExplodedBasicBlock>> getPredNodes(BasicBlockInContext<IExplodedBasicBlock> N) Description copied from interface:EdgeManagerReturn anIteratorover the immediate predecessor nodes of nThis method never returns
null.- Specified by:
getPredNodesin interfaceEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>- 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<BasicBlockInContext<IExplodedBasicBlock>>- Returns:
- the number of immediate successor Nodes of this Node in the Graph.
-
getSuccNodes
public Iterator<BasicBlockInContext<IExplodedBasicBlock>> getSuccNodes(BasicBlockInContext<IExplodedBasicBlock> N) Description copied from interface:EdgeManagerReturn an Iterator over the immediate successor nodes of nThis method never returns
null.- Specified by:
getSuccNodesin interfaceEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>- Returns:
- an Iterator over the immediate successor nodes of n
-
hasEdge
public boolean hasEdge(BasicBlockInContext<IExplodedBasicBlock> src, BasicBlockInContext<IExplodedBasicBlock> dst) - Specified by:
hasEdgein interfaceEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
-
removeAllIncidentEdges
public void removeAllIncidentEdges(BasicBlockInContext<IExplodedBasicBlock> node) throws UnsupportedOperationException - Specified by:
removeAllIncidentEdgesin interfaceEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>- Throws:
UnsupportedOperationException
-
removeEdge
public void removeEdge(BasicBlockInContext<IExplodedBasicBlock> src, BasicBlockInContext<IExplodedBasicBlock> dst) throws UnsupportedOperationException - Specified by:
removeEdgein interfaceEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>- Throws:
UnsupportedOperationException
-
removeIncomingEdges
public void removeIncomingEdges(BasicBlockInContext<IExplodedBasicBlock> node) throws UnsupportedOperationException - Specified by:
removeIncomingEdgesin interfaceEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>- Throws:
UnsupportedOperationException
-
removeOutgoingEdges
public void removeOutgoingEdges(BasicBlockInContext<IExplodedBasicBlock> node) throws UnsupportedOperationException - Specified by:
removeOutgoingEdgesin interfaceEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>- Throws:
UnsupportedOperationException
-
getMaxNumber
public int getMaxNumber()- Specified by:
getMaxNumberin interfaceNumberedNodeManager<BasicBlockInContext<IExplodedBasicBlock>>
-
getNode
- Specified by:
getNodein interfaceNumberedNodeManager<BasicBlockInContext<IExplodedBasicBlock>>
-
getNumber
- Specified by:
getNumberin interfaceNumberedNodeManager<BasicBlockInContext<IExplodedBasicBlock>>
-
iterateNodes
- Specified by:
iterateNodesin interfaceNumberedNodeManager<BasicBlockInContext<IExplodedBasicBlock>>- Returns:
- iterator of nodes with the numbers in set s
-
getPredNodeNumbers
- Specified by:
getPredNodeNumbersin interfaceNumberedEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>- Returns:
- the numbers identifying the immediate predecessors of node
-
getSuccNodeNumbers
- Specified by:
getSuccNodeNumbersin interfaceNumberedEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>- Returns:
- the numbers identifying the immediate successors of node
-
getCFG
public ControlFlowGraph<SSAInstruction, IExplodedBasicBlock> getCFG(BasicBlockInContext<IExplodedBasicBlock> node) -
getICFG
-
toString
-