Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public void AddEdge(GraphVizEdge edge)
 {
     edges.Add(edge);
 }
Ejemplo n.º 4
0
 public void AddEdge(GraphVizEdge edge)
 {
     edges.Add(edge);
 }