public class ICFGSupergraph extends Object implements ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
ExplodedInterproceduralCFG
This should lazily build the supergraph as it is explored.CALL_EDGE, CALL_TO_RETURN_EDGE, OTHER, RETURN_EDGE
Modifier | Constructor and Description |
---|---|
protected |
ICFGSupergraph(ExplodedInterproceduralCFG icfg,
AnalysisCache cache) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected ICFGSupergraph(ExplodedInterproceduralCFG icfg, AnalysisCache cache)
public static ICFGSupergraph make(CallGraph cg, AnalysisCache cache)
public Graph<? extends CGNode> getProcedureGraph()
getProcedureGraph
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
public IClassHierarchy getClassHierarchy()
public byte classifyEdge(BasicBlockInContext<IExplodedBasicBlock> src, BasicBlockInContext<IExplodedBasicBlock> dest)
classifyEdge
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
src
- node in the supergraphdest
- a successor of src in the supergraphpublic Iterator<BasicBlockInContext<IExplodedBasicBlock>> getCallSites(BasicBlockInContext<IExplodedBasicBlock> r, CGNode callee)
getCallSites
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
callee
- a "called" "procedure" in the supergraph. if callee is null, answer return sites for which no callee was found.public Iterator<? extends BasicBlockInContext<IExplodedBasicBlock>> getCalledNodes(BasicBlockInContext<IExplodedBasicBlock> call)
getCalledNodes
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
call
- a "call" node in the supergraphpublic BasicBlockInContext<IExplodedBasicBlock>[] getEntriesForProcedure(CGNode procedure)
getEntriesForProcedure
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
public BasicBlockInContext<IExplodedBasicBlock>[] getExitsForProcedure(CGNode procedure)
getExitsForProcedure
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
public BasicBlockInContext<IExplodedBasicBlock> getLocalBlock(CGNode procedure, int i)
getLocalBlock
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
procedure
- an object that represents a procedurei
- the "logical" basic block number of a node in the procedurepublic int getLocalBlockNumber(BasicBlockInContext<IExplodedBasicBlock> n)
getLocalBlockNumber
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
n
- a node in the supergraphpublic BasicBlockInContext<IExplodedBasicBlock> getMainEntry()
public Iterator<BasicBlockInContext<IExplodedBasicBlock>> getNormalSuccessors(BasicBlockInContext<IExplodedBasicBlock> call)
getNormalSuccessors
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
call
- a "call" node in the supergraphpublic int getNumberOfBlocks(CGNode procedure)
getNumberOfBlocks
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
procedure
- an object that represents a procedurepublic CGNode getProcOf(BasicBlockInContext<IExplodedBasicBlock> n)
getProcOf
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
n
- a node in the supergraphpublic Iterator<? extends BasicBlockInContext<IExplodedBasicBlock>> getReturnSites(BasicBlockInContext<IExplodedBasicBlock> call, CGNode callee)
getReturnSites
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
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.public boolean isCall(BasicBlockInContext<IExplodedBasicBlock> n)
isCall
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
n
- a node in this supergraphpublic boolean isEntry(BasicBlockInContext<IExplodedBasicBlock> n)
isEntry
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
public boolean isExit(BasicBlockInContext<IExplodedBasicBlock> n)
isExit
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
n
- a node in the supergraphpublic boolean isReturn(BasicBlockInContext<IExplodedBasicBlock> n)
isReturn
in interface ISupergraph<BasicBlockInContext<IExplodedBasicBlock>,CGNode>
n
- a node in this supergraphpublic void removeNodeAndEdges(BasicBlockInContext<IExplodedBasicBlock> N) throws UnsupportedOperationException
Graph
removeNodeAndEdges
in interface Graph<BasicBlockInContext<IExplodedBasicBlock>>
UnsupportedOperationException
- if the graph implementation does not allow removalpublic void addNode(BasicBlockInContext<IExplodedBasicBlock> n)
NodeManager
addNode
in interface NodeManager<BasicBlockInContext<IExplodedBasicBlock>>
public boolean containsNode(BasicBlockInContext<IExplodedBasicBlock> N)
containsNode
in interface NodeManager<BasicBlockInContext<IExplodedBasicBlock>>
public int getNumberOfNodes()
getNumberOfNodes
in interface NodeManager<BasicBlockInContext<IExplodedBasicBlock>>
public Iterator<BasicBlockInContext<IExplodedBasicBlock>> iterator()
iterator
in interface NodeManager<BasicBlockInContext<IExplodedBasicBlock>>
iterator
in interface Iterable<BasicBlockInContext<IExplodedBasicBlock>>
Iterator
of the nodes in this graphpublic void removeNode(BasicBlockInContext<IExplodedBasicBlock> n)
NodeManager
removeNode
in interface NodeManager<BasicBlockInContext<IExplodedBasicBlock>>
public void addEdge(BasicBlockInContext<IExplodedBasicBlock> src, BasicBlockInContext<IExplodedBasicBlock> dst)
addEdge
in interface EdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
public int getPredNodeCount(BasicBlockInContext<IExplodedBasicBlock> N)
EdgeManager
immediate predecessor
nodes of ngetPredNodeCount
in interface EdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
public Iterator<BasicBlockInContext<IExplodedBasicBlock>> getPredNodes(BasicBlockInContext<IExplodedBasicBlock> N)
EdgeManager
Iterator
over the immediate predecessor nodes of n
This method never returns null
.getPredNodes
in interface EdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
Iterator
over the immediate predecessor nodes of this Node.public int getSuccNodeCount(BasicBlockInContext<IExplodedBasicBlock> N)
EdgeManager
immediate successor
nodes of this Node in the GraphgetSuccNodeCount
in interface EdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
public Iterator<BasicBlockInContext<IExplodedBasicBlock>> getSuccNodes(BasicBlockInContext<IExplodedBasicBlock> N)
EdgeManager
This method never returns null
.
getSuccNodes
in interface EdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
public boolean hasEdge(BasicBlockInContext<IExplodedBasicBlock> src, BasicBlockInContext<IExplodedBasicBlock> dst)
hasEdge
in interface EdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
public void removeAllIncidentEdges(BasicBlockInContext<IExplodedBasicBlock> node) throws UnsupportedOperationException
removeAllIncidentEdges
in interface EdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
UnsupportedOperationException
public void removeEdge(BasicBlockInContext<IExplodedBasicBlock> src, BasicBlockInContext<IExplodedBasicBlock> dst) throws UnsupportedOperationException
removeEdge
in interface EdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
UnsupportedOperationException
public void removeIncomingEdges(BasicBlockInContext<IExplodedBasicBlock> node) throws UnsupportedOperationException
removeIncomingEdges
in interface EdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
UnsupportedOperationException
public void removeOutgoingEdges(BasicBlockInContext<IExplodedBasicBlock> node) throws UnsupportedOperationException
removeOutgoingEdges
in interface EdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
UnsupportedOperationException
public int getMaxNumber()
getMaxNumber
in interface NumberedNodeManager<BasicBlockInContext<IExplodedBasicBlock>>
public BasicBlockInContext<IExplodedBasicBlock> getNode(int number)
getNode
in interface NumberedNodeManager<BasicBlockInContext<IExplodedBasicBlock>>
public int getNumber(BasicBlockInContext<IExplodedBasicBlock> N)
getNumber
in interface NumberedNodeManager<BasicBlockInContext<IExplodedBasicBlock>>
public Iterator<BasicBlockInContext<IExplodedBasicBlock>> iterateNodes(IntSet s)
iterateNodes
in interface NumberedNodeManager<BasicBlockInContext<IExplodedBasicBlock>>
public IntSet getPredNodeNumbers(BasicBlockInContext<IExplodedBasicBlock> node)
getPredNodeNumbers
in interface NumberedEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
public IntSet getSuccNodeNumbers(BasicBlockInContext<IExplodedBasicBlock> node)
getSuccNodeNumbers
in interface NumberedEdgeManager<BasicBlockInContext<IExplodedBasicBlock>>
public ControlFlowGraph<SSAInstruction,IExplodedBasicBlock> getCFG(BasicBlockInContext<IExplodedBasicBlock> node)
public ExplodedInterproceduralCFG getICFG()