private void OnRemoveEdge(GraphEdge <T> edge) { edge.Sink.IncomingEdges.Remove(edge); edge.Source.OutgoingEdges.Remove(edge); if (edge.Sink.IsRootNode) { RootNodes.Add(edge.Sink); } if (edge.Source.IsLeafNode) { LeafNodes.Add(edge.Source); } }
private void OnSourceGraphEdgeAdded(GraphEdge <T> newGraphEdge) { GraphNode <T> source = newGraphEdge.Source; GraphNode <T> sink = newGraphEdge.Sink; if (sink.IncomingEdges.Count == 1 && source.OutgoingEdges.Count == 1) { MergeBasicBlock(_blockMapping[source], _blockMapping[sink]); } else if (sink.IncomingEdges.Count == 1 && source.OutgoingEdges.Count == 2) { var otherSourceEdge = source.OutgoingEdges[0] == newGraphEdge ? source.OutgoingEdges[1] : source.OutgoingEdges[0]; if (otherSourceEdge.Sink.IncomingEdges.Count == 1) { SplitBasicBlock(_blockMapping[otherSourceEdge.Source], otherSourceEdge.Sink.Item); } if (FindEdge(_blockMapping[source], _blockMapping[sink]) == null) { OnAddEdge(_blockMapping[source], _blockMapping[sink], newGraphEdge); } } else if (sink.IncomingEdges.Count == 2) { var otherEdge = sink.IncomingEdges[0] == newGraphEdge ? sink.IncomingEdges[1] : sink.IncomingEdges[0]; if (otherEdge.Source.OutgoingEdges.Count == 1) { SplitBasicBlock(_blockMapping[otherEdge.Source], sink.Item); } } else { if (FindEdge(_blockMapping[source], _blockMapping[sink]) == null) { OnAddEdge(_blockMapping[source], _blockMapping[sink], newGraphEdge); } } }
private void OnSourceGraphEdgeRemoved(GraphEdge <T> oldGraphEdge) { GraphNode <T> source = oldGraphEdge.Source; GraphNode <T> sink = oldGraphEdge.Sink; if (sink.IncomingEdges.Count == 0 && source.OutgoingEdges.Count == 0) { SplitBasicBlock(_blockMapping[source], sink.Item); } else if (sink.IncomingEdges.Count == 0 && source.OutgoingEdges.Count == 1 && source.OutgoingEdges[0].Sink.IncomingEdges.Count == 1) { MergeBasicBlock(_blockMapping[source], _blockMapping[source.OutgoingEdges[0].Sink]); } else if (sink.IncomingEdges.Count == 1 && !sink.IsLeader) { MergeBasicBlock(_blockMapping[sink.IncomingEdges[0].Source], _blockMapping[sink]); } if (SourceGraph.FindEdge(source.Item, sink.Item) == null) { OnRemoveEdge(FindEdge(_blockMapping[source], _blockMapping[sink])); } }
public void RelocateEdge(GraphEdge <T> edge, GraphNode <T> newSourceNode, GraphNode <T> newSinkNode) { GraphManager.GraphEdgeRelocator.RelocateEdge(this, edge, newSourceNode, newSinkNode); }
public bool RemoveEdge(GraphEdge <T> edge) { return(GraphManager.GraphEdgeRemover.RemoveEdge(this, edge)); }
public GraphEdge <T> AddEdge(GraphEdge <T> edge) { GraphManager.GraphEdgeBuilder.AddEdge(this, edge); return(edge); }
private void OnRemoveEdge(GraphEdge <BasicBlock <T> > edge) { RemoveEdge(edge); }
private void OnAddEdge(GraphNode <BasicBlock <T> > sourceNode, GraphNode <BasicBlock <T> > sinkNode, GraphEdge <T> dataProvider) { AddEdge(sourceNode, sinkNode, null, dataProvider.SourceData, dataProvider.SinkData); }
private void OnAddEdge(BasicBlock <T> source, BasicBlock <T> sink, GraphEdge <T> dataProvider) { AddEdge(source, sink, null, dataProvider.SourceData, dataProvider.SinkData); }