public GraphVizGraph ExportGraph() { GraphVizGraph graph = new GraphVizGraph(); foreach (ControlFlowNode node in nodes) { graph.AddNode(new GraphVizNode(node.BlockIndex) { label = node.ToString(), shape = "box" }); } foreach (ControlFlowNode node in nodes) { foreach (ControlFlowEdge edge in node.Outgoing) { GraphVizEdge e = new GraphVizEdge(edge.Source.BlockIndex, edge.Target.BlockIndex); switch (edge.Type) { case JumpType.Normal: break; case JumpType.PopEnviroment: case JumpType.PushEnviroment: e.color = "pink"; break; default: e.color = "gray"; //e.constraint = false; break; } graph.AddEdge(e); } if (node.ImmediateDominator != null) { graph.AddEdge(new GraphVizEdge(node.ImmediateDominator.BlockIndex, node.BlockIndex) { color = "green", constraint = false }); } } return graph; }
public GraphVizGraph ExportGraph() { GraphVizGraph graph = new GraphVizGraph(); foreach (ControlFlowNode node in nodes) { graph.AddNode(new GraphVizNode(node.BlockIndex) { label = node.ToString(), shape = "box" }); } foreach (ControlFlowNode node in nodes) { foreach (ControlFlowEdge edge in node.Outgoing) { GraphVizEdge e = new GraphVizEdge(edge.Source.BlockIndex, edge.Target.BlockIndex); switch (edge.Type) { case JumpType.Normal: break; case JumpType.PopEnviroment: case JumpType.PushEnviroment: e.color = "pink"; break; default: e.color = "gray"; //e.constraint = false; break; } graph.AddEdge(e); } if (node.ImmediateDominator != null) { graph.AddEdge(new GraphVizEdge(node.ImmediateDominator.BlockIndex, node.BlockIndex) { color = "green", constraint = false }); } } return(graph); }