public class BackwardsSupergraph<T,P> extends Object implements ISupergraph<T,P>
CALL_EDGE, CALL_TO_RETURN_EDGE, OTHER, RETURN_EDGE
Modifier | Constructor and Description |
---|---|
protected |
BackwardsSupergraph(ISupergraph<T,P> forwardGraph) |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(Object src,
Object dst) |
void |
addNode(Object n)
add a node to this graph
|
byte |
classifyEdge(T src,
T dest) |
boolean |
containsNode(T N) |
Iterator<T> |
getCalledNodes(T ret)
get the "called" (sic) nodes for a return site; i.e., the exit nodes that flow directly to this return site.
|
Iterator<? extends T> |
getCallSites(T r,
P callee) |
T[] |
getEntriesForProcedure(P object) |
T[] |
getExitsForProcedure(P object) |
T |
getLocalBlock(P procedure,
int i) |
int |
getLocalBlockNumber(T n) |
int |
getMaxNumber() |
T |
getNode(int number) |
Iterator<T> |
getNormalSuccessors(T ret)
get the "normal" successors (sic) for a return site; i.e., the "normal" CFG predecessors that are not call nodes.
|
int |
getNumber(T N) |
int |
getNumberOfBlocks(P procedure) |
int |
getNumberOfNodes() |
int |
getPredNodeCount(T N)
Return the number of
immediate predecessor nodes of n |
IntSet |
getPredNodeNumbers(Object node) |
Iterator<T> |
getPredNodes(T N)
Return an
Iterator over the immediate predecessor nodes of n
This method never returns null . |
Graph<? extends P> |
getProcedureGraph()
TODO: for now, this is not inverted.
|
P |
getProcOf(T n) |
Iterator<? extends T> |
getReturnSites(T c,
P callee) |
int |
getSuccNodeCount(T N)
Return the number of
immediate successor nodes of this Node in the Graph |
IntSet |
getSuccNodeNumbers(T node) |
Iterator<T> |
getSuccNodes(T N)
Return an Iterator over the immediate successor nodes of n
|
boolean |
hasEdge(T src,
T dst) |
boolean |
isCall(T n) |
boolean |
isEntry(T n) |
boolean |
isExit(T n) |
boolean |
isReturn(T n) |
Iterator<T> |
iterateNodes(IntSet s) |
Iterator<T> |
iterator() |
static <T,P> BackwardsSupergraph<T,P> |
make(ISupergraph<T,P> forwardGraph) |
void |
removeAllIncidentEdges(Object node) |
void |
removeEdge(Object src,
Object dst) |
void |
removeIncomingEdges(Object node) |
void |
removeNode(Object n)
remove a node from this graph
|
void |
removeNodeAndEdges(Object N)
remove a node and all its incident edges
|
void |
removeOutgoingEdges(T node) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected BackwardsSupergraph(ISupergraph<T,P> forwardGraph)
forwardGraph
- the graph to ``reverse''public static <T,P> BackwardsSupergraph<T,P> make(ISupergraph<T,P> forwardGraph)
public Graph<? extends P> getProcedureGraph()
getProcedureGraph
in interface ISupergraph<T,P>
ISupergraph.getProcedureGraph()
public boolean isCall(T n)
isCall
in interface ISupergraph<T,P>
n
- a node in this supergraphpublic Iterator<T> getCalledNodes(T ret)
getCalledNodes
in interface ISupergraph<T,P>
ret
- a "call" node in the supergraphISupergraph.getCalledNodes(java.lang.Object)
public Iterator<T> getNormalSuccessors(T ret)
getNormalSuccessors
in interface ISupergraph<T,P>
ret
- a "call" node in the supergraphISupergraph.getCalledNodes(java.lang.Object)
public Iterator<? extends T> getReturnSites(T c, P callee)
getReturnSites
in interface ISupergraph<T,P>
c
- 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 isExit(T n)
isExit
in interface ISupergraph<T,P>
n
- a node in the supergraphpublic P getProcOf(T n)
getProcOf
in interface ISupergraph<T,P>
n
- a node in the supergraphpublic void removeNodeAndEdges(Object N) throws UnsupportedOperationException
Graph
removeNodeAndEdges
in interface Graph<T>
UnsupportedOperationException
- if the graph implementation does not allow removalpublic int getNumberOfNodes()
getNumberOfNodes
in interface NodeManager<T>
public void addNode(Object n) throws UnsupportedOperationException
NodeManager
addNode
in interface NodeManager<T>
UnsupportedOperationException
public void removeNode(Object n) throws UnsupportedOperationException
NodeManager
removeNode
in interface NodeManager<T>
UnsupportedOperationException
public boolean containsNode(T N)
containsNode
in interface NodeManager<T>
public Iterator<T> getPredNodes(T N)
EdgeManager
Iterator
over the immediate predecessor nodes of n
This method never returns null
.getPredNodes
in interface EdgeManager<T>
Iterator
over the immediate predecessor nodes of this Node.public int getPredNodeCount(T N)
EdgeManager
immediate predecessor
nodes of ngetPredNodeCount
in interface EdgeManager<T>
public Iterator<T> getSuccNodes(T N)
EdgeManager
This method never returns null
.
getSuccNodes
in interface EdgeManager<T>
public boolean hasEdge(T src, T dst)
hasEdge
in interface EdgeManager<T>
public int getSuccNodeCount(T N)
EdgeManager
immediate successor
nodes of this Node in the GraphgetSuccNodeCount
in interface EdgeManager<T>
public void addEdge(Object src, Object dst) throws UnsupportedOperationException
addEdge
in interface EdgeManager<T>
UnsupportedOperationException
public void removeEdge(Object src, Object dst) throws UnsupportedOperationException
removeEdge
in interface EdgeManager<T>
UnsupportedOperationException
public void removeAllIncidentEdges(Object node) throws UnsupportedOperationException
removeAllIncidentEdges
in interface EdgeManager<T>
UnsupportedOperationException
public T[] getEntriesForProcedure(P object)
getEntriesForProcedure
in interface ISupergraph<T,P>
public T[] getExitsForProcedure(P object)
getExitsForProcedure
in interface ISupergraph<T,P>
public boolean isReturn(T n) throws UnimplementedError
isReturn
in interface ISupergraph<T,P>
n
- a node in this supergraphUnimplementedError
public Iterator<? extends T> getCallSites(T r, P callee)
getCallSites
in interface ISupergraph<T,P>
callee
- a "called" "procedure" in the supergraph. if callee is null, answer return sites for which no callee was found.public boolean isEntry(T n)
isEntry
in interface ISupergraph<T,P>
public byte classifyEdge(T src, T dest)
classifyEdge
in interface ISupergraph<T,P>
src
- node in the supergraphdest
- a successor of src in the supergraphpublic void removeIncomingEdges(Object node) throws UnsupportedOperationException
removeIncomingEdges
in interface EdgeManager<T>
UnsupportedOperationException
public void removeOutgoingEdges(T node) throws UnsupportedOperationException
removeOutgoingEdges
in interface EdgeManager<T>
UnsupportedOperationException
public int getNumberOfBlocks(P procedure)
getNumberOfBlocks
in interface ISupergraph<T,P>
procedure
- an object that represents a procedurepublic int getLocalBlockNumber(T n)
getLocalBlockNumber
in interface ISupergraph<T,P>
n
- a node in the supergraphpublic T getLocalBlock(P procedure, int i)
getLocalBlock
in interface ISupergraph<T,P>
procedure
- an object that represents a procedurei
- the "logical" basic block number of a node in the procedurepublic int getNumber(T N)
getNumber
in interface NumberedNodeManager<T>
public T getNode(int number)
getNode
in interface NumberedNodeManager<T>
public int getMaxNumber()
getMaxNumber
in interface NumberedNodeManager<T>
public Iterator<T> iterateNodes(IntSet s) throws UnimplementedError
iterateNodes
in interface NumberedNodeManager<T>
UnimplementedError
public IntSet getSuccNodeNumbers(T node)
getSuccNodeNumbers
in interface NumberedEdgeManager<T>
public IntSet getPredNodeNumbers(Object node) throws UnimplementedError
getPredNodeNumbers
in interface NumberedEdgeManager<T>
UnimplementedError