public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> extends Object implements NumberedGraph<BasicBlockInContext<T>>
Constructor and Description |
---|
AbstractInterproceduralCFG(CallGraph cg)
Build an Interprocedural CFG from a call graph.
|
AbstractInterproceduralCFG(CallGraph CG,
Predicate<CGNode> relevant)
Build an Interprocedural CFG from a call graph.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public AbstractInterproceduralCFG(CallGraph cg)
cg
- the call graphpublic AbstractInterproceduralCFG(CallGraph CG, Predicate<CGNode> relevant)
CG
- the call graphrelevant
- a filter which accepts those call graph nodes which should be included in the I-CFG. Other nodes are ignored.public void callGraphUpdated()
public abstract ControlFlowGraph<SSAInstruction,T> getCFG(CGNode n)
protected void addEdgesToNonEntryBlock(CGNode n, ControlFlowGraph<?,T> cfg, SSAInstruction[] instrs, T bb)
n
- a call graph nodecfg
- the CFG for ninstrs
- the instructions for node nbb
- a basic block in the CFGprotected SSAInstruction getLastInstructionForBlock(T pb, SSAInstruction[] instrs)
public ControlFlowGraph<SSAInstruction,T> getCFG(BasicBlockInContext B) throws IllegalArgumentException
IllegalArgumentException
- if B == nullpublic CGNode getCGNode(BasicBlockInContext B) throws IllegalArgumentException
IllegalArgumentException
- if B == nullpublic void removeNodeAndEdges(BasicBlockInContext N) throws UnsupportedOperationException
Graph
removeNodeAndEdges
in interface Graph<BasicBlockInContext<T extends ISSABasicBlock>>
UnsupportedOperationException
- if the graph implementation does not allow removalpublic Iterator<BasicBlockInContext<T>> iterator()
iterator
in interface NodeManager<BasicBlockInContext<T extends ISSABasicBlock>>
iterator
in interface Iterable<BasicBlockInContext<T extends ISSABasicBlock>>
Iterator
of the nodes in this graphpublic int getNumberOfNodes()
getNumberOfNodes
in interface NodeManager<BasicBlockInContext<T extends ISSABasicBlock>>
public void addNode(BasicBlockInContext n) throws UnsupportedOperationException
NodeManager
addNode
in interface NodeManager<BasicBlockInContext<T extends ISSABasicBlock>>
UnsupportedOperationException
public void removeNode(BasicBlockInContext n) throws UnsupportedOperationException
NodeManager
removeNode
in interface NodeManager<BasicBlockInContext<T extends ISSABasicBlock>>
UnsupportedOperationException
public Iterator<BasicBlockInContext<T>> getPredNodes(BasicBlockInContext<T> N)
EdgeManager
Iterator
over the immediate predecessor nodes of n
This method never returns null
.getPredNodes
in interface EdgeManager<BasicBlockInContext<T extends ISSABasicBlock>>
Iterator
over the immediate predecessor nodes of this Node.public int getPredNodeCount(BasicBlockInContext<T> N)
EdgeManager
immediate predecessor
nodes of ngetPredNodeCount
in interface EdgeManager<BasicBlockInContext<T extends ISSABasicBlock>>
public Iterator<BasicBlockInContext<T>> getSuccNodes(BasicBlockInContext<T> N)
EdgeManager
This method never returns null
.
getSuccNodes
in interface EdgeManager<BasicBlockInContext<T extends ISSABasicBlock>>
public int getSuccNodeCount(BasicBlockInContext<T> N)
EdgeManager
immediate successor
nodes of this Node in the GraphgetSuccNodeCount
in interface EdgeManager<BasicBlockInContext<T extends ISSABasicBlock>>
public void addEdge(BasicBlockInContext src, BasicBlockInContext dst) throws UnsupportedOperationException
addEdge
in interface EdgeManager<BasicBlockInContext<T extends ISSABasicBlock>>
UnsupportedOperationException
public void removeEdge(BasicBlockInContext src, BasicBlockInContext dst) throws UnsupportedOperationException
removeEdge
in interface EdgeManager<BasicBlockInContext<T extends ISSABasicBlock>>
UnsupportedOperationException
public void removeAllIncidentEdges(BasicBlockInContext node) throws UnsupportedOperationException
removeAllIncidentEdges
in interface EdgeManager<BasicBlockInContext<T extends ISSABasicBlock>>
UnsupportedOperationException
public boolean containsNode(BasicBlockInContext<T> N)
containsNode
in interface NodeManager<BasicBlockInContext<T extends ISSABasicBlock>>
public boolean hasCall(BasicBlockInContext<T> B)
B
- protected boolean hasCall(BasicBlockInContext<T> B, ControlFlowGraph<SSAInstruction,T> cfg)
public Set<CGNode> getCallTargets(BasicBlockInContext<T> B)
B
- IllegalArgumentException
- if B is nullprotected CallSiteReference getCallSiteForCallBlock(IBasicBlock<SSAInstruction> B, ControlFlowGraph<SSAInstruction,T> cfg)
CallSiteReference
corresponding to the last instruction in B (assumed to be a call)public void removeIncomingEdges(BasicBlockInContext node) throws UnsupportedOperationException
removeIncomingEdges
in interface EdgeManager<BasicBlockInContext<T extends ISSABasicBlock>>
UnsupportedOperationException
public void removeOutgoingEdges(BasicBlockInContext node) throws UnsupportedOperationException
removeOutgoingEdges
in interface EdgeManager<BasicBlockInContext<T extends ISSABasicBlock>>
UnsupportedOperationException
public boolean hasEdge(BasicBlockInContext<T> src, BasicBlockInContext<T> dst)
hasEdge
in interface EdgeManager<BasicBlockInContext<T extends ISSABasicBlock>>
public int getNumber(BasicBlockInContext<T> N)
getNumber
in interface NumberedNodeManager<BasicBlockInContext<T extends ISSABasicBlock>>
public BasicBlockInContext<T> getNode(int number) throws UnimplementedError
getNode
in interface NumberedNodeManager<BasicBlockInContext<T extends ISSABasicBlock>>
UnimplementedError
public int getMaxNumber()
getMaxNumber
in interface NumberedNodeManager<BasicBlockInContext<T extends ISSABasicBlock>>
public Iterator<BasicBlockInContext<T>> iterateNodes(IntSet s) throws UnimplementedError
iterateNodes
in interface NumberedNodeManager<BasicBlockInContext<T extends ISSABasicBlock>>
UnimplementedError
public IntSet getSuccNodeNumbers(BasicBlockInContext<T> node)
getSuccNodeNumbers
in interface NumberedEdgeManager<BasicBlockInContext<T extends ISSABasicBlock>>
public IntSet getPredNodeNumbers(BasicBlockInContext<T> node)
getPredNodeNumbers
in interface NumberedEdgeManager<BasicBlockInContext<T extends ISSABasicBlock>>
public BasicBlockInContext<T> getEntry(CGNode n)
public BasicBlockInContext<T> getExit(CGNode n)
public Iterator<BasicBlockInContext<T>> getReturnSites(BasicBlockInContext<T> callBlock)
callBlock
- node in the IPCFG that ends in a callIllegalArgumentException
- if bb is nullpublic Iterator<BasicBlockInContext<T>> getCallSites(BasicBlockInContext<T> returnBlock, CGNode callee)
public boolean isReturn(BasicBlockInContext<T> bb) throws IllegalArgumentException
IllegalArgumentException