1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Martin Trapp, Christian Schaefer
6 ** irdump.h: dumping of an intermediate representation graph
15 # include "irnode_t.h"
16 # include "irgraph_t.h"
26 # include "type_or_entity.h"
28 # include "typewalk.h"
30 /* Attributes of nodes */
31 #define DEFAULT_NODE_ATTR ""
32 #define DEFAULT_TYPE_ATTRIBUTE ""
34 /* Attributes of edges between Firm nodes */
35 #define BLOCK_EDGE_ATTR "class: 2 priority: 2 linestyle: dotted"
36 #define CF_EDGE_ATTR "color: red"
37 #define MEM_EDGE_ATTR "color: blue"
39 /* Attributes of edges between Firm nodes and type/entity nodes */
40 #define NODE2TYPE_EDGE_ATTR "class: 2 priority: 2 linestyle: dotted"
42 /* Attributes of edges in type/entity graphs. */
43 #define TYPE_METH_NODE_ATTR "color: lightyellow"
44 #define TYPE_CLASS_NODE_ATTR "color: green"
45 #define ENTITY_NODE_ATTR "color: yellow"
46 #define ENT_TYPE_EDGE_ATTR "class: 3 label: \"type\" color: red"
47 #define ENT_OWN_EDGE_ATTR "class: 4 label: \"owner\" color: black"
48 #define METH_PAR_EDGE_ATTR "class: 5 label: \"param %d\" color: green"
49 #define METH_RES_EDGE_ATTR "class: 6 label: \"res %d\" color: green"
50 #define TYPE_SUPER_EDGE_ATTR "class: 7 label: \"supertype\" color: blue"
51 #define UNION_EDGE_ATTR "class: 8 label: \"component\" color: blue"
52 #define PTR_PTS_TO_EDGE_ATTR "class: 9 label: \"points to\" color:green"
53 #define ARR_ELT_TYPE_EDGE_ATTR "class: 10 label: \"arr elt\" color:green"
54 #define ENT_OVERWRITES_EDGE_ATTR "class: 11 label: \"overwrites\" color:red"
55 #define TYPE_MEMBER_EDGE_ATTR "class: 12 label: \"member\" color:blue"
57 #define PRINT_NODEID(X) fprintf(F, "%p", X)
62 /* A compiler option to turn off edge labels */
65 /* A global variable to record output of the Bad node. */
68 /*******************************************************************/
69 /* routines to dump information about a single node */
70 /*******************************************************************/
75 dump_node_opcode (ir_node *n)
79 if (n->op->code == iro_Const) {
80 xfprintf (F, "%v", n->attr.con);
83 } else if (n->op->code == iro_SymConst) {
84 if (get_SymConst_kind(n) == linkage_ptr_info) {
85 xfprintf (F, "%I", get_SymConst_ptrinfo(n));
87 assert(get_kind(get_SymConst_type(n)) == k_type);
88 assert(get_type_ident(get_SymConst_type(n)));
89 xfprintf (F, "%s ", id_to_str(get_type_ident(get_SymConst_type(n))));
90 if (get_SymConst_kind == type_tag)
97 xfprintf (F, "%I", get_irn_opident(n));
102 dump_node_mode (ir_node *n)
104 switch (n->op->code) {
121 xfprintf (F, "%I", get_mode_ident(n->mode));
128 dump_node_nodeattr (ir_node *n)
130 switch (n->op->code) {
132 if (n->in[1]->op->code == iro_Cmp) {
133 xfprintf (F, "%s", get_pnc_string(n->attr.proj));
135 xfprintf (F, "%ld", n->attr.proj);
139 assert(get_kind(get_Sel_entity(n)) == k_entity);
140 xfprintf (F, "%s", id_to_str(get_entity_ident(get_Sel_entity(n))));
147 dump_node_vcgattr (ir_node *n)
149 switch (n->op->code) {
152 xfprintf (F, "color: blue");
155 xfprintf (F, "color: lightyellow");
158 xfprintf (F, "color: green");
163 xfprintf (F, "color: yellow");
166 xfprintf (F, DEFAULT_NODE_ATTR);
171 dump_node (ir_node *n) {
174 xfprintf (F, "node: {title: \""); PRINT_NODEID(n); fprintf(F, "\" label: \"");
179 dump_node_nodeattr(n);
181 xfprintf (F, " %ld", get_irn_node_nr(n));
184 dump_node_vcgattr(n);
189 dump_ir_node (ir_node *n)
192 fprintf (F, "node: {title: \""); PRINT_NODEID(n); fprintf(F, "\" label: ");
194 switch (n->op->code) { /* node label */
196 xfprintf (F, "\"%I\" color: blue ", get_irn_opident(n));
197 xfprintf (F, DEFAULT_NODE_ATTR);
200 xfprintf (F, "\"%I\" color: blue ", get_irn_opident(n));
201 xfprintf (F, DEFAULT_NODE_ATTR);
204 xfprintf (F, "\"%I\" color: lightyellow ", get_irn_opident(n));
205 xfprintf (F, DEFAULT_NODE_ATTR);
208 xfprintf (F, "\"%I%I\" color: green", get_irn_opident(n), get_irn_modeident(n));
209 if (get_irn_modecode(n) == irm_M)
210 xfprintf (F, DEFAULT_NODE_ATTR " color: green");
212 xfprintf (F, DEFAULT_NODE_ATTR);
215 xfprintf (F, "\"%v%I\" color: yellow ", n->attr.con, get_irn_modeident(n));
216 xfprintf (F, DEFAULT_NODE_ATTR);
219 xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
220 xfprintf (F, DEFAULT_NODE_ATTR);
223 if (n->in[1]->op->code == iro_Cmp) {
224 xfprintf (F, "\"%I%I %s\" color: yellow", get_irn_opident(n), get_irn_modeident(n),
225 get_pnc_string(n->attr.proj));
227 xfprintf (F, "\"%I%I %ld\"", get_irn_opident(n), get_irn_modeident(n), n->attr.proj);
229 xfprintf (F, DEFAULT_NODE_ATTR);
232 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
233 xfprintf (F, DEFAULT_NODE_ATTR);
236 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
237 xfprintf (F, DEFAULT_NODE_ATTR);
240 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
241 xfprintf (F, DEFAULT_NODE_ATTR);
244 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
245 xfprintf (F, DEFAULT_NODE_ATTR);
248 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
249 xfprintf (F, DEFAULT_NODE_ATTR);
252 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
253 xfprintf (F, DEFAULT_NODE_ATTR);
256 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
257 xfprintf (F, DEFAULT_NODE_ATTR);
260 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
261 xfprintf (F, DEFAULT_NODE_ATTR);
264 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
265 xfprintf (F, DEFAULT_NODE_ATTR);
268 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
269 xfprintf (F, DEFAULT_NODE_ATTR);
272 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
273 xfprintf (F, DEFAULT_NODE_ATTR);
276 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
277 xfprintf (F, DEFAULT_NODE_ATTR);
280 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
281 xfprintf (F, DEFAULT_NODE_ATTR);
284 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
285 xfprintf (F, DEFAULT_NODE_ATTR);
288 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
289 xfprintf (F, DEFAULT_NODE_ATTR);
292 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
293 xfprintf (F, DEFAULT_NODE_ATTR);
296 xfprintf (F, "\"%I\"", get_irn_opident(n));
297 xfprintf (F, DEFAULT_NODE_ATTR);
300 xfprintf (F, "\"%I\"", get_irn_opident(n));
301 xfprintf (F, DEFAULT_NODE_ATTR);
304 xfprintf (F, "\"%I\"", get_irn_opident(n));
305 xfprintf (F, DEFAULT_NODE_ATTR);
308 xfprintf (F, "\"%I\"", get_irn_opident(n));
309 xfprintf (F, DEFAULT_NODE_ATTR);
312 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
313 xfprintf (F, DEFAULT_NODE_ATTR);
317 xfprintf (F, "\"%R\"", n);
318 xfprintf (F, DEFAULT_NODE_ATTR);
321 xfprintf (F, "\"%I\" ", get_irn_opident(n));
322 xfprintf (F, DEFAULT_NODE_ATTR);
325 assert(get_kind(get_Sel_entity(n)) == k_entity);
326 xfprintf (F, "\"%I ", get_irn_opident(n));
327 xfprintf (F, "%s", id_to_str(get_entity_ident(get_Sel_entity(n))));
328 xfprintf (F, DEFAULT_NODE_ATTR);
331 assert(get_kind(get_SymConst_type(n)) == k_type);
332 assert(get_type_ident(get_SymConst_type(n)));
333 xfprintf (F, "\"%s ", get_type_name(get_SymConst_type(n)));
334 switch (n->attr.i.num){
336 xfprintf (F, "tag\" ");
339 xfprintf (F, "size\" ");
345 xfprintf (F, DEFAULT_NODE_ATTR);
348 xfprintf (F, "\"%I\" ", get_irn_opident(n));
349 xfprintf (F, DEFAULT_NODE_ATTR " color: green");
352 xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
353 xfprintf (F, DEFAULT_NODE_ATTR);
356 xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
358 xfprintf (F, "}\n"); /* footer */
362 /* dump the edge to the block this node belongs to */
364 dump_ir_block_edge(ir_node *n) {
366 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
367 BLOCK_EDGE_ATTR "}\n", n, get_nodes_Block(n));
370 void print_edge_vcgattr(ir_node *from, int to) {
373 switch (get_irn_opcode(from)) {
375 xfprintf (F, CF_EDGE_ATTR);
377 case iro_Start: break;
380 case iro_Cond: break;
383 if (to == 0) xfprintf (F, MEM_EDGE_ATTR);
385 case iro_Const: break;
386 case iro_SymConst:break;
389 if (to == 0) xfprintf (F, MEM_EDGE_ATTR);
393 case iro_Minus: break;
399 if (to == 0) xfprintf (F, MEM_EDGE_ATTR);
407 case iro_Shrs: break;
410 case iro_Conv: break;
412 if (get_irn_modecode(from) == irm_M) xfprintf (F, MEM_EDGE_ATTR);
418 if (to == 0) xfprintf (F, MEM_EDGE_ATTR);
421 xfprintf (F, MEM_EDGE_ATTR);
423 case iro_Tuple: break;
425 switch (get_irn_modecode(from)) {
427 xfprintf (F, CF_EDGE_ATTR);
430 xfprintf (F, MEM_EDGE_ATTR);
441 /* dump edges to our inputs */
443 dump_ir_data_edges(ir_node *n) {
446 for (i = 0; i < get_irn_arity(n); i++) {
447 assert(get_irn_n(n, i));
448 xfprintf (F, "edge: {sourcename: \"%p\" targetname: \"%p\"",
450 fprintf (F, " label: \"%d\" ", i);
451 print_edge_vcgattr(n, i);
456 /* dumps the edges between nodes and their type or entity attributes. */
457 void dump_node2type_edges (ir_node *n, void *env)
461 switch (get_irn_opcode(n)) {
463 if ( (get_SymConst_kind(n) == type_tag)
464 || (get_SymConst_kind(n) == size))
465 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
466 NODE2TYPE_EDGE_ATTR "}\n", n, get_SymConst_type(n));
469 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
470 NODE2TYPE_EDGE_ATTR "}\n", n, get_Sel_entity(n));
473 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
474 NODE2TYPE_EDGE_ATTR "}\n", n, get_Call_type(n));
477 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
478 NODE2TYPE_EDGE_ATTR "}\n", n, get_Alloc_type(n));
481 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
482 NODE2TYPE_EDGE_ATTR "}\n", n, get_Free_type(n));
490 /* dumps a type or entity and it's edges. */
492 dump_type_info (type_or_ent *tore, void *env) {
493 int i = 0; /* to shutup gcc */
495 /* dump this type or entity */
496 xfprintf (F, "node: {title: \"%p\" ", tore);
497 xfprintf (F, DEFAULT_TYPE_ATTRIBUTE);
498 xfprintf (F, "label: ");
500 switch (get_kind(tore)) {
503 entity *ent = (entity *)tore;
504 xfprintf (F, "\"ent %I\" " ENTITY_NODE_ATTR , get_entity_ident(ent));
505 if(dynamic_allocated == get_entity_allocation(ent))
506 xfprintf (F, " info1:\"dynamic allocated\"}\n");
508 xfprintf (F, " info1:\"static allocated\"}\n");
509 xfprintf (F, "nearedge: { sourcename: \"%p\" targetname: \"%p\" "
510 ENT_OWN_EDGE_ATTR "}\n", tore, get_entity_owner(ent));
511 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
512 ENT_TYPE_EDGE_ATTR "}\n", tore, get_entity_type(ent));
513 for(i = 0; i < get_entity_n_overwrites(ent); i++)
514 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
515 ENT_OVERWRITES_EDGE_ATTR "}\n", tore, get_entity_overwrites(ent, i));
519 type *tp = (type *)tore;
520 xfprintf (F, "\"%I %I", get_type_tpop_nameid(tp), get_type_ident(tp));
522 switch (get_type_tpop_code(tp)) {
525 xfprintf (F, "\" " TYPE_CLASS_NODE_ATTR "}\n");
526 for (i=0; i < get_class_n_supertype(tp); i++)
527 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
528 TYPE_SUPER_EDGE_ATTR "}\n",
529 tp, get_class_supertype(tp, i));
530 for (i=0; i < get_class_n_member(tp); i++)
531 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
532 TYPE_MEMBER_EDGE_ATTR "}\n",
533 tp, get_class_member(tp, i));
537 xfprintf (F, "\"}\n");
538 for (i=0; i < get_struct_n_member(tp); i++)
539 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
540 TYPE_MEMBER_EDGE_ATTR "}\n",
541 tp, get_struct_member(tp, i));
545 xfprintf (F, "\" " TYPE_METH_NODE_ATTR "}\n");
546 for (i = 0; i < get_method_n_params(tp); i++)
547 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
548 METH_PAR_EDGE_ATTR "}\n",
549 tp, get_method_param_type(tp, i), i);
550 for (i = 0; i < get_method_n_res(tp); i++)
551 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
552 METH_RES_EDGE_ATTR "}\n",
553 tp, get_method_res_type(tp, i), i);
557 xfprintf (F, "\"}\n");
558 for (i = 0; i < get_union_n_members(tp); i++)
559 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
560 "label: \"\"f" UNION_EDGE_ATTR "}\n",
561 tp, get_union_member(tp, i));
565 xfprintf (F, "\"}\n");
566 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
567 ARR_ELT_TYPE_EDGE_ATTR "}\n", tp, get_array_element_type(tp), i);
569 case tpo_enumeration:
571 xfprintf (F, "\"}\n");
575 xfprintf (F, "\"}\n");
576 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
577 PTR_PTS_TO_EDGE_ATTR "}\n", tp,
578 get_pointer_points_to_type(tp), i);
582 xfprintf (F, " (mode %I)\"}\n", get_mode_ident(get_type_mode(tp)));
587 break; /* case k_type */
590 xfprintf (F, "\" faulty type \"}\n");
591 printf(" *** irdump, %s(l.%i), faulty type.\n", __FUNCTION__, __LINE__);
593 } /* switch kind_or_entity */
596 /************************************************************************/
597 /* open and close vcg file */
598 /************************************************************************/
600 void vcg_open (ir_graph *irg, char *suffix) {
601 char *fname; /* filename to put the vcg information in */
607 /** open file for vcg graph */
608 id = get_entity_ld_ident (get_irg_ent(irg));
609 len = id_to_strlen (id);
612 fname = malloc (len + 5 + strlen(suffix));
613 strncpy (fname, cp, len); /* copy the filename */
615 strcat (fname, suffix); /* append file suffix */
617 fname = malloc (len + 5 + strlen(suffix));
618 strncpy (fname, cp, len); /* copy the filename */
619 fname[len] = '\0'; /* ensure string termination */
620 /*strcpy (fname, cp); * copy the filename *
621 this produces wrong, too long strings in conjuction with the
622 jocca frontend. The \0 seems to be missing. */
623 strcat (fname, suffix); /* append file suffix */
624 strcat (fname, ".vcg"); /* append the .vcg suffix */
625 F = fopen (fname, "w"); /* open file for writing */
627 panic ("cannot open %s for writing (%m)", fname); /* not reached */
631 strcpy(label, "yes");
633 strcpy (label, "no");
638 "graph: { title: \"ir graph of %s\"\n"
639 "display_edge_labels: %s\n"
640 "layoutalgorithm: mindepth\n"
641 "manhattan_edges: yes\n"
643 "orientation: bottom_to_top\n"
644 "classname 1: \"Data\"\n"
645 "classname 2: \"Block\"\n"
646 "classname 3: \"Entity type\""
647 "classname 4: \"Entity owner\""
648 "classname 5: \"Method Param\""
649 "classname 6: \"Method Res\""
650 "classname 7: \"Super\""
651 "classname 8: \"Union\""
652 "classname 9: \"Points-to\""
653 "classname 10: \"Array Element Type\""
654 "classname 11: \"Overwrites\""
655 "classname 12: \"Member\""
658 xfprintf (F, "\n"); /* a separator */
661 void vcg_open_name (const char *name) {
662 char *fname; /* filename to put the vcg information in */
666 /** open file for vcg graph */
668 fname = malloc (len + 5);
669 strcpy (fname, name); /* copy the filename */
670 strcat (fname, ".vcg"); /* append the .vcg suffix */
671 F = fopen (fname, "w"); /* open file for writing */
673 panic ("cannot open %s for writing (%m)", fname); /* not reached */
677 strcpy(label, "yes");
679 strcpy (label, "no");
684 "graph: { title: \"ir graph of %s\"\n"
685 "display_edge_labels: %s\n"
686 "layoutalgorithm: mindepth\n"
687 "manhattan_edges: yes\n"
689 "orientation: bottom_to_top\n"
690 "classname 1: \"Data\"\n"
691 "classname 2: \"Block\"\n"
692 "classname 3: \"Entity type\"\n"
693 "classname 4: \"Entity owner\"\n"
694 "classname 5: \"Method Param\"\n"
695 "classname 6: \"Method Res\"\n"
696 "classname 7: \"Super\"\n"
697 "classname 8: \"Union\"\n"
698 "classname 9: \"Points-to\"\n"
699 "classname 10: \"Array Element Type\"\n"
700 "classname 11: \"Overwrites\"\n"
701 "classname 12: \"Member\"\n"
704 xfprintf (F, "\n"); /* a separator */
709 xfprintf (F, "}\n"); /* print footer */
710 fclose (F); /* close vcg file */
713 /************************************************************************/
714 /* routines to dump a graph, blocks as conventional nodes. */
715 /************************************************************************/
718 dump_whole_node (ir_node *n, void* env) {
720 dump_ir_block_edge(n);
721 dump_ir_data_edges(n);
725 dump_ir_graph (ir_graph *irg)
728 rem = current_ir_graph;
729 current_ir_graph = irg;
733 /* walk over the graph */
734 irg_walk(irg->end, dump_whole_node, NULL, NULL);
738 current_ir_graph = rem;
741 /***********************************************************************/
742 /* the following routines dump the nodes as attached to the blocks. */
743 /***********************************************************************/
746 dump_ir_blocks_nodes (ir_node *n, void *env) {
747 ir_node *block = (ir_node *)env;
749 if (is_no_Block(n) && get_nodes_Block(n) == block) {
751 dump_ir_data_edges(n);
753 if (get_irn_op(n) == op_Bad)
758 dump_ir_block (ir_node *block, void *env) {
759 ir_graph *irg = (ir_graph *)env;
761 if (get_irn_opcode(block) == iro_Block) {
763 /* This is a block. So dump the vcg information to make a block. */
764 xfprintf(F, "graph: { title: \""); PRINT_NODEID(block); fprintf(F, "\" label: \"");
766 xfprintf (F, "%ld", get_irn_node_nr(block));
768 xfprintf (F, "%I", block->op->name);
770 xfprintf(F, "\" status:clustered color:lightyellow \n");
771 /* dump the blocks edges */
772 dump_ir_data_edges(block);
774 /* dump the nodes that go into the block */
775 irg_walk(irg->end, dump_ir_blocks_nodes, NULL, block);
777 /* Close the vcg information for the block */
778 xfprintf(F, "}\n\n");
784 dump_blockless_nodes (ir_node *n, void *env) {
785 if (is_no_Block(n) && get_irn_op(get_nodes_Block(n)) == op_Bad) {
787 dump_ir_data_edges(n);
788 dump_ir_block_edge(n);
790 if (get_irn_op(n) == op_Bad)
794 void dump_ir_block_graph_2 (ir_graph *irg)
797 /* walk over the blocks in the graph */
798 irg_block_walk(irg->end, dump_ir_block, NULL, irg);
800 /* dump all nodes that are not in a Block */
801 irg_walk(irg->end, dump_blockless_nodes, NULL, NULL);
803 /* dump the Bad node */
805 dump_node(get_irg_bad(irg));
809 dump_ir_block_graph (ir_graph *irg)
812 rem = current_ir_graph;
813 current_ir_graph = irg;
817 dump_ir_block_graph_2 (irg);
820 current_ir_graph = rem;
824 /***********************************************************************/
825 /* the following routines dump a control flow graph */
826 /***********************************************************************/
830 dump_block_to_cfg (ir_node *block, void *env) {
834 if (get_irn_opcode(block) == iro_Block) {
835 /* This is a block. Dump a node for the block. */
836 xfprintf (F, "node: {title: \"%p\" label: \"%I\"}", block,
839 for ( i = 0; i < get_Block_n_cfgpreds(block); i++) {
840 pred = get_nodes_Block(skip_Proj(get_Block_cfgpred(block, i)));
841 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" }\n",
848 dump_cfg (ir_graph *irg)
850 vcg_open (irg, "-cfg");
852 /* walk over the blocks in the graph */
853 irg_block_walk(irg->end, dump_block_to_cfg, NULL, NULL);
859 /***********************************************************************/
860 /* the following routine dumps all type information reachable from an */
862 /***********************************************************************/
866 dump_type_graph (ir_graph *irg)
869 rem = current_ir_graph;
870 current_ir_graph = irg;
872 vcg_open (irg, "-type");
874 /* walk over the blocks in the graph */
875 type_walk_irg(irg, dump_type_info, NULL, NULL);
878 current_ir_graph = rem;
881 /***********************************************************************/
882 /* the following routine dumps all type information */
883 /***********************************************************************/
887 dump_all_types (void)
889 vcg_open_name ("All_types");
890 type_walk(dump_type_info, NULL, NULL);
894 /***********************************************************************/
895 /* dumps a graph with type information */
896 /***********************************************************************/
900 dump_ir_graph_w_types (ir_graph *irg)
903 rem = current_ir_graph;
904 current_ir_graph = irg;
906 vcg_open (irg, "-all");
908 /* dump common ir graph */
909 irg_walk(irg->end, dump_whole_node, NULL, NULL);
911 type_walk_irg(irg, dump_type_info, NULL, NULL);
912 /* dump edges from graph to type info */
913 irg_walk(irg->end, dump_node2type_edges, NULL, NULL);
916 current_ir_graph = rem;
920 dump_ir_block_graph_w_types (ir_graph *irg)
923 rem = current_ir_graph;
924 current_ir_graph = irg;
926 vcg_open (irg, "-all");
928 /* dump common blocked ir graph */
929 dump_ir_block_graph_2(irg);
931 type_walk_irg(irg, dump_type_info, NULL, NULL);
932 /* dump edges from graph to type info */
933 irg_walk(irg->end, dump_node2type_edges, NULL, NULL);
936 current_ir_graph = rem;
939 /***********************************************************************/
940 /* dumps all graphs with the graph-dumper passed. Possible dumpers: */
942 /* dump_ir_block_graph */
944 /* dump_type_graph */
945 /* dump_ir_graph_w_types */
946 /***********************************************************************/
947 void dump_all_ir_graphs (void dump_graph(ir_graph*)) {
949 for (i=0; i < get_irp_n_irgs(); i++) {
950 dump_graph(get_irp_irg(i));
955 /* To turn off display of edge labels. Edge labels offen cause xvcg to
956 abort with a segmentation fault. */
957 void turn_of_edge_labels() {