use of com.jopdesign.common.code.ControlFlowGraph.ReturnNode in project jop by jop-devel.
the class SuperGraph method incomingEdgesOf.
/**
* The incoming edges are generated as follows:
* <ul>
* <li/>return node: superedge returning to the caller
* <li/>entry node: superedge invoking the node's method
* <li/>other: intraprocedural CFG edge
* </ul>
* @param node
* @return
*/
public Iterable<SuperGraphEdge> incomingEdgesOf(SuperGraphNode node) {
CFGNode cfgNode = node.getCFGNode();
if (cfgNode instanceof ReturnNode) {
/* return node: incoming edges are callgraph return edges */
final ReturnNode retNode = (ReturnNode) cfgNode;
Set<SuperEdge> cgReturnEdges = superGraph.incomingEdgesOf(node.getContextCFG());
return new Filter<SuperGraphEdge>() {
@Override
protected boolean include(SuperGraphEdge e) {
if (!(e instanceof SuperReturnEdge))
return false;
SuperReturnEdge retEdge = (SuperReturnEdge) e;
return retEdge.getReturnNode().equals(retNode);
}
}.<SuperGraphEdge>filter(cgReturnEdges);
} else if (cfgNode instanceof VirtualNode && ((VirtualNode) cfgNode).getKind() == VirtualNodeKind.ENTRY) {
/* entry node: superedge invoking the node's method */
Set<SuperEdge> cgInvokeEdges = superGraph.incomingEdgesOf(node.getContextCFG());
return new Filter<SuperGraphEdge>() {
@Override
protected boolean include(SuperGraphEdge e) {
return (e instanceof SuperInvokeEdge);
}
}.<SuperGraphEdge>filter(cgInvokeEdges);
} else {
/* standard edges: incoming edges of cfg node */
return liftCFGEdges(node.getContextCFG(), node.getContextCFG().getCfg().incomingEdgesOf(cfgNode));
}
}
Aggregations