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
13 # include "irnode_t.h"
14 # include "irgraph_t.h"
24 # include "type_or_entity.h"
26 # include "typewalk.h"
28 /* Attributes of nodes */
29 #define DEFAULT_NODE_ATTR ""
30 #define DEFAULT_TYPE_ATTRIBUTE ""
32 /* Attributes of edges between Firm nodes */
33 #define BLOCK_EDGE_ATTR "class: 2 priority: 2 linestyle: dotted"
34 #define CF_EDGE_ATTR "color: red"
35 #define MEM_EDGE_ATTR "color: blue"
37 /* Attributes of edges between Firm nodes and type/entity nodes */
38 #define NODE2TYPE_EDGE_ATTR ""
40 /* Attributes of edges in type/entity graphs. */
41 #define TYPE_METH_NODE_ATTR "color: lightyellow"
42 #define TYPE_CLASS_NODE_ATTR "color: green"
43 #define ENTITY_NODE_ATTR "color: yellow"
44 #define ENT_TYPE_EDGE_ATTR "class: 3 label: \"type\" color: red"
45 #define ENT_OWN_EDGE_ATTR "class: 4 label: \"owner\" color: black"
46 #define METH_PAR_EDGE_ATTR "class: 5 label: \"param %d\" color: green"
47 #define METH_RES_EDGE_ATTR "class: 6 label: \"res %d\" color: green"
48 #define TYPE_SUPER_EDGE_ATTR "class: 7 label: \"supertype\" color: blue"
49 #define UNION_EDGE_ATTR "class: 8 label: \"component\" color: blue"
50 #define PTR_PTS_TO_EDGE_ATTR "class: 9 label: \"points to\" color:green"
51 #define ARR_ELT_TYPE_EDGE_ATTR "class: 10 label: \"arr elt\" color:green"
52 #define ENT_OVERWRITES_EDGE_ATTR "class: 11 label: \"overwrites\" color:red"
53 #define TYPE_MEMBER_EDGE_ATTR "class: 12 label: \"member\" color:blue"
55 #define PRINT_NODEID(X) fprintf(F, "%p", X)
60 /* A compiler option to turn off edge labels */
63 /* A global variable to record output of the Bad node. */
66 /*******************************************************************/
67 /* routines to dump information about a single node */
68 /*******************************************************************/
73 dump_node_opcode (ir_node *n)
77 if (n->op->code == iro_Const) {
78 xfprintf (F, "%v", n->attr.con);
81 } else if (n->op->code == iro_SymConst) {
82 if (get_SymConst_kind(n) == linkage_ptr_info) {
83 xfprintf (F, "%I", get_SymConst_ptrinfo(n));
85 assert(get_kind(get_SymConst_type(n)) == k_type);
86 assert(get_type_ident(get_SymConst_type(n)));
87 xfprintf (F, "%s ", id_to_str(get_type_ident(get_SymConst_type(n))));
88 if (get_SymConst_kind == type_tag)
95 xfprintf (F, "%I", get_irn_opident(n));
100 dump_node_mode (ir_node *n)
102 switch (n->op->code) {
119 xfprintf (F, "%I", get_mode_ident(n->mode));
126 dump_node_nodeattr (ir_node *n)
128 switch (n->op->code) {
130 if (n->in[1]->op->code == iro_Cmp) {
131 xfprintf (F, "%s", get_pnc_string(n->attr.proj));
133 xfprintf (F, "%ld", n->attr.proj);
137 assert(get_kind(get_Sel_entity(n)) == k_entity);
138 xfprintf (F, "%s", id_to_str(get_entity_ident(get_Sel_entity(n))));
145 dump_node_vcgattr (ir_node *n)
147 switch (n->op->code) {
150 xfprintf (F, "color: blue");
153 xfprintf (F, "color: lightyellow");
156 xfprintf (F, "color: green");
161 xfprintf (F, "color: yellow");
164 xfprintf (F, DEFAULT_NODE_ATTR);
169 dump_node (ir_node *n) {
172 xfprintf (F, "node: {title: \""); PRINT_NODEID(n); fprintf(F, "\" label: \"");
177 dump_node_nodeattr(n);
179 xfprintf (F, " %ld", get_irn_node_nr(n));
182 dump_node_vcgattr(n);
187 dump_ir_node (ir_node *n)
190 fprintf (F, "node: {title: \""); PRINT_NODEID(n); fprintf(F, "\" label: ");
192 switch (n->op->code) { /* node label */
194 xfprintf (F, "\"%I\" color: blue ", get_irn_opident(n));
195 xfprintf (F, DEFAULT_NODE_ATTR);
198 xfprintf (F, "\"%I\" color: blue ", get_irn_opident(n));
199 xfprintf (F, DEFAULT_NODE_ATTR);
202 xfprintf (F, "\"%I\" color: lightyellow ", get_irn_opident(n));
203 xfprintf (F, DEFAULT_NODE_ATTR);
206 xfprintf (F, "\"%I%I\" color: green", get_irn_opident(n), get_irn_modeident(n));
207 if (get_irn_modecode(n) == irm_M)
208 xfprintf (F, DEFAULT_NODE_ATTR " color: green");
210 xfprintf (F, DEFAULT_NODE_ATTR);
213 xfprintf (F, "\"%v%I\" color: yellow ", n->attr.con, get_irn_modeident(n));
214 xfprintf (F, DEFAULT_NODE_ATTR);
217 xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
218 xfprintf (F, DEFAULT_NODE_ATTR);
221 if (n->in[1]->op->code == iro_Cmp) {
222 xfprintf (F, "\"%I%I %s\" color: yellow", get_irn_opident(n), get_irn_modeident(n),
223 get_pnc_string(n->attr.proj));
225 xfprintf (F, "\"%I%I %ld\"", get_irn_opident(n), get_irn_modeident(n), n->attr.proj);
227 xfprintf (F, DEFAULT_NODE_ATTR);
230 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
231 xfprintf (F, DEFAULT_NODE_ATTR);
234 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
235 xfprintf (F, DEFAULT_NODE_ATTR);
238 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
239 xfprintf (F, DEFAULT_NODE_ATTR);
242 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
243 xfprintf (F, DEFAULT_NODE_ATTR);
246 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
247 xfprintf (F, DEFAULT_NODE_ATTR);
250 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
251 xfprintf (F, DEFAULT_NODE_ATTR);
254 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
255 xfprintf (F, DEFAULT_NODE_ATTR);
258 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
259 xfprintf (F, DEFAULT_NODE_ATTR);
262 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
263 xfprintf (F, DEFAULT_NODE_ATTR);
266 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
267 xfprintf (F, DEFAULT_NODE_ATTR);
270 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
271 xfprintf (F, DEFAULT_NODE_ATTR);
274 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
275 xfprintf (F, DEFAULT_NODE_ATTR);
278 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
279 xfprintf (F, DEFAULT_NODE_ATTR);
282 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
283 xfprintf (F, DEFAULT_NODE_ATTR);
286 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
287 xfprintf (F, DEFAULT_NODE_ATTR);
290 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
291 xfprintf (F, DEFAULT_NODE_ATTR);
294 xfprintf (F, "\"%I\"", get_irn_opident(n));
295 xfprintf (F, DEFAULT_NODE_ATTR);
298 xfprintf (F, "\"%I\"", get_irn_opident(n));
299 xfprintf (F, DEFAULT_NODE_ATTR);
302 xfprintf (F, "\"%I\"", get_irn_opident(n));
303 xfprintf (F, DEFAULT_NODE_ATTR);
306 xfprintf (F, "\"%I\"", get_irn_opident(n));
307 xfprintf (F, DEFAULT_NODE_ATTR);
310 xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
311 xfprintf (F, DEFAULT_NODE_ATTR);
315 xfprintf (F, "\"%R\"", n);
316 xfprintf (F, DEFAULT_NODE_ATTR);
319 xfprintf (F, "\"%I\" ", get_irn_opident(n));
320 xfprintf (F, DEFAULT_NODE_ATTR);
323 assert(get_kind(get_Sel_entity(n)) == k_entity);
324 xfprintf (F, "\"%I ", get_irn_opident(n));
325 xfprintf (F, "%s", id_to_str(get_entity_ident(get_Sel_entity(n))));
326 xfprintf (F, DEFAULT_NODE_ATTR);
329 assert(get_kind(get_SymConst_type(n)) == k_type);
330 assert(get_type_ident(get_SymConst_type(n)));
331 xfprintf (F, "\"%s ", get_type_name(get_SymConst_type(n)));
332 switch (n->attr.i.num){
334 xfprintf (F, "tag\" ");
337 xfprintf (F, "size\" ");
343 xfprintf (F, DEFAULT_NODE_ATTR);
346 xfprintf (F, "\"%I\" ", get_irn_opident(n));
347 xfprintf (F, DEFAULT_NODE_ATTR " color: green");
350 xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
351 xfprintf (F, DEFAULT_NODE_ATTR);
354 xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
356 xfprintf (F, "}\n"); /* footer */
360 /* dump the edge to the block this node belongs to */
362 dump_ir_block_edge(ir_node *n) {
364 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
365 BLOCK_EDGE_ATTR "}\n", n, get_nodes_Block(n));
368 void print_edge_vcgattr(ir_node *from, int to) {
371 switch (get_irn_opcode(from)) {
373 xfprintf (F, CF_EDGE_ATTR);
375 case iro_Start: break;
378 case iro_Cond: break;
381 if (to == 0) xfprintf (F, MEM_EDGE_ATTR);
383 case iro_Const: break;
384 case iro_SymConst:break;
387 if (to == 0) xfprintf (F, MEM_EDGE_ATTR);
391 case iro_Minus: break;
397 if (to == 0) xfprintf (F, MEM_EDGE_ATTR);
405 case iro_Shrs: break;
408 case iro_Conv: break;
410 if (get_irn_modecode(from) == irm_M) xfprintf (F, MEM_EDGE_ATTR);
416 if (to == 0) xfprintf (F, MEM_EDGE_ATTR);
419 xfprintf (F, MEM_EDGE_ATTR);
421 case iro_Tuple: break;
423 switch (get_irn_modecode(from)) {
425 xfprintf (F, CF_EDGE_ATTR);
428 xfprintf (F, MEM_EDGE_ATTR);
439 /* dump edges to our inputs */
441 dump_ir_data_edges(ir_node *n) {
444 for (i = 0; i < get_irn_arity(n); i++) {
445 assert(get_irn_n(n, i));
446 xfprintf (F, "edge: {sourcename: \"%p\" targetname: \"%p\"",
448 fprintf (F, " label: \"%d\" ", i);
449 print_edge_vcgattr(n, i);
454 /* dumps the edges between nodes and their type or entity attributes. */
455 void dump_node2type_edges (ir_node *n, void *env)
459 switch (get_irn_opcode(n)) {
461 if ( (get_SymConst_kind(n) == type_tag)
462 || (get_SymConst_kind(n) == size))
463 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
464 NODE2TYPE_EDGE_ATTR "}\n", n, get_SymConst_type(n));
467 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
468 NODE2TYPE_EDGE_ATTR "}\n", n, get_Sel_entity(n));
471 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
472 NODE2TYPE_EDGE_ATTR "}\n", n, get_Call_type(n));
475 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
476 NODE2TYPE_EDGE_ATTR "}\n", n, get_Alloc_type(n));
479 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
480 NODE2TYPE_EDGE_ATTR "}\n", n, get_Free_type(n));
488 /* dumps a type or entity and it's edges. */
490 dump_type_info (type_or_ent *tore, void *env) {
491 int i = 0; /* to shutup gcc */
493 /* dump this type or entity */
494 xfprintf (F, "node: {title: \"%p\" ", tore);
495 xfprintf (F, DEFAULT_TYPE_ATTRIBUTE);
496 xfprintf (F, "label: ");
498 switch (get_kind(tore)) {
501 entity *ent = (entity *)tore;
502 xfprintf (F, "\"ent %I\" " ENTITY_NODE_ATTR , get_entity_ident(ent));
503 if(dynamic_allocated == get_entity_allocation(ent))
504 xfprintf (F, " info1:\"dynamic allocated\"}\n");
506 xfprintf (F, " info1:\"static allocated\"}\n");
507 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
508 ENT_OWN_EDGE_ATTR "}\n", tore, get_entity_owner(ent));
509 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
510 ENT_TYPE_EDGE_ATTR "}\n", tore, get_entity_type(ent));
511 for(i = 0; i < get_entity_n_overwrites(ent); i++)
512 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
513 ENT_OVERWRITES_EDGE_ATTR "}\n", tore, get_entity_overwrites(ent, i));
517 /* why can't I cast here??? @@@ */
519 xfprintf (F, "\"%I %I", get_type_tpop_nameid(type), get_type_ident(type));
521 switch (get_type_tpop_code(type)) {
524 xfprintf (F, "\" " TYPE_CLASS_NODE_ATTR "}\n");
525 for (i=0; i < get_class_n_supertype(type); i++)
526 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
527 TYPE_SUPER_EDGE_ATTR "}\n",
528 type, get_class_supertype(type, i));
529 for (i=0; i < get_class_n_member(type); i++)
530 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
531 TYPE_MEMBER_EDGE_ATTR "}\n",
532 type, get_class_member(type, i));
536 xfprintf (F, "\"}\n");
537 for (i=0; i < get_struct_n_member(type); i++)
538 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
539 TYPE_MEMBER_EDGE_ATTR "}\n",
540 type, get_struct_member(type, i));
544 xfprintf (F, "\" " TYPE_METH_NODE_ATTR "}\n");
545 for (i = 0; i < get_method_n_params(type); i++)
546 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
547 METH_PAR_EDGE_ATTR "}\n",
548 type, get_method_param_type(type, i), i);
549 for (i = 0; i < get_method_n_res(type); i++)
550 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
551 METH_RES_EDGE_ATTR "}\n",
552 type, get_method_res_type(type, i), i);
556 xfprintf (F, "\"}\n");
557 for (i = 0; i < get_union_n_members(type); i++)
558 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
559 "label: \"\"f" UNION_EDGE_ATTR "}\n",
560 type, get_union_member(type, i));
564 xfprintf (F, "\"}\n");
565 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
566 ARR_ELT_TYPE_EDGE_ATTR "}\n", type, get_array_element_type(type), i);
568 case tpo_enumeration:
570 xfprintf (F, "\"}\n");
574 xfprintf (F, "\"}\n");
575 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
576 PTR_PTS_TO_EDGE_ATTR "}\n", type,
577 get_pointer_points_to_type(type), i);
581 xfprintf (F, "mode %I\"}\n", get_mode_ident(get_type_mode(type)));
586 break; /* case k_type */
589 xfprintf (F, "\" faulty type \"}\n");
590 printf(" *** irdump, %s(l.%i), faulty type.\n", __FUNCTION__, __LINE__);
592 } /* switch kind_or_entity */
595 /************************************************************************/
596 /* open and close vcg file */
597 /************************************************************************/
599 void vcg_open (ir_graph *irg, char *suffix) {
600 char *fname; /* filename to put the vcg information in */
606 /** open file for vcg graph */
607 id = get_entity_ld_ident (get_irg_ent(irg));
608 len = id_to_strlen (id);
611 fname = malloc (len + 5 + strlen(suffix));
612 strncpy (fname, cp, len); /* copy the filename */
614 strcat (fname, suffix); /* append file suffix */
616 fname = malloc (len + 5 + strlen(suffix));
617 strncpy (fname, cp, len); /* copy the filename */
618 fname[len] = '\0'; /* ensure string termination */
619 /*strcpy (fname, cp); * copy the filename *
620 this produces wrong, too long strings in conjuction with the
621 jocca frontend. The \0 seems to be missing. */
622 strcat (fname, suffix); /* append file suffix */
623 strcat (fname, ".vcg"); /* append the .vcg suffix */
624 F = fopen (fname, "w"); /* open file for writing */
626 panic ("cannot open %s for writing (%m)", fname); /* not reached */
630 strcpy(label, "yes");
632 strcpy (label, "no");
637 "graph: { title: \"ir graph of %s\"\n"
638 "display_edge_labels: %s\n"
639 "layoutalgorithm: mindepth\n"
640 "manhattan_edges: yes\n"
642 "orientation: bottom_to_top\n"
643 "classname 1: \"Data\"\n"
644 "classname 2: \"Block\"\n"
645 "classname 3: \"Entity type\""
646 "classname 4: \"Entity owner\""
647 "classname 5: \"Method Param\""
648 "classname 6: \"Method Res\""
649 "classname 7: \"Super\""
650 "classname 8: \"Union\""
651 "classname 9: \"Points-to\""
652 "classname 10: \"Array Element Type\""
653 "classname 11: \"Overwrites\""
654 "classname 12: \"Member\""
657 xfprintf (F, "\n"); /* a separator */
660 void vcg_open_name (const char *name) {
661 char *fname; /* filename to put the vcg information in */
665 /** open file for vcg graph */
667 fname = malloc (len + 5);
668 strcpy (fname, name); /* copy the filename */
669 strcat (fname, ".vcg"); /* append the .vcg suffix */
670 F = fopen (fname, "w"); /* open file for writing */
672 panic ("cannot open %s for writing (%m)", fname); /* not reached */
676 strcpy(label, "yes");
678 strcpy (label, "no");
683 "graph: { title: \"ir graph of %s\"\n"
684 "display_edge_labels: %s\n"
685 "layoutalgorithm: mindepth\n"
686 "manhattan_edges: yes\n"
688 "orientation: bottom_to_top\n"
689 "classname 1: \"Data\"\n"
690 "classname 2: \"Block\"\n"
691 "classname 3: \"Entity type\"\n"
692 "classname 4: \"Entity owner\"\n"
693 "classname 5: \"Method Param\"\n"
694 "classname 6: \"Method Res\"\n"
695 "classname 7: \"Super\"\n"
696 "classname 8: \"Union\"\n"
697 "classname 9: \"Points-to\"\n"
698 "classname 10: \"Array Element Type\"\n"
699 "classname 11: \"Overwrites\"\n"
700 "classname 12: \"Member\"\n"
703 xfprintf (F, "\n"); /* a separator */
708 xfprintf (F, "}\n"); /* print footer */
709 fclose (F); /* close vcg file */
712 /************************************************************************/
713 /* routines to dump a graph, blocks as conventional nodes. */
714 /************************************************************************/
717 dump_whole_node (ir_node *n, void* env) {
719 dump_ir_block_edge(n);
720 dump_ir_data_edges(n);
724 dump_ir_graph (ir_graph *irg)
727 rem = current_ir_graph;
728 current_ir_graph = irg;
732 /* walk over the graph */
733 irg_walk(irg->end, dump_whole_node, NULL, NULL);
737 current_ir_graph = rem;
740 /***********************************************************************/
741 /* the following routines dump the nodes as attached to the blocks. */
742 /***********************************************************************/
745 dump_ir_blocks_nodes (ir_node *n, void *env) {
746 ir_node *block = (ir_node *)env;
748 if (is_no_Block(n) && get_nodes_Block(n) == block) {
750 dump_ir_data_edges(n);
752 if (get_irn_op(n) == op_Bad)
757 dump_ir_block (ir_node *block, void *env) {
758 ir_graph *irg = (ir_graph *)env;
760 if (get_irn_opcode(block) == iro_Block) {
762 /* This is a block. So dump the vcg information to make a block. */
763 xfprintf(F, "graph: { title: \""); PRINT_NODEID(block); fprintf(F, "\" label: \"");
765 xfprintf (F, "%ld", get_irn_node_nr(block));
767 xfprintf (F, "%I", block->op->name);
769 xfprintf(F, "\" status:clustered color:lightyellow \n");
770 /* dump the blocks edges */
771 dump_ir_data_edges(block);
773 /* dump the nodes that go into the block */
774 irg_walk(irg->end, dump_ir_blocks_nodes, NULL, block);
776 /* Close the vcg information for the block */
777 xfprintf(F, "}\n\n");
783 dump_blockless_nodes (ir_node *n, void *env) {
784 if (is_no_Block(n) && get_irn_op(get_nodes_Block(n)) == op_Bad) {
786 dump_ir_data_edges(n);
787 dump_ir_block_edge(n);
789 if (get_irn_op(n) == op_Bad)
794 dump_ir_block_graph (ir_graph *irg)
797 rem = current_ir_graph;
798 current_ir_graph = irg;
803 /* walk over the blocks in the graph */
804 irg_block_walk(irg->end, dump_ir_block, NULL, irg);
806 /* dump all nodes that are not in a Block */
807 irg_walk(irg->end, dump_blockless_nodes, NULL, NULL);
809 /* dump the Bad node */
811 dump_node(get_irg_bad(irg));
813 current_ir_graph = rem;
817 /***********************************************************************/
818 /* the following routines dump a control flow graph */
819 /***********************************************************************/
823 dump_block_to_cfg (ir_node *block, void *env) {
827 if (get_irn_opcode(block) == iro_Block) {
828 /* This is a block. Dump a node for the block. */
829 xfprintf (F, "node: {title: \"%p\" label: \"%I\"}", block,
832 for ( i = 0; i < get_Block_n_cfgpreds(block); i++) {
833 pred = get_nodes_Block(skip_Proj(get_Block_cfgpred(block, i)));
834 xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" }\n",
841 dump_cfg (ir_graph *irg)
843 vcg_open (irg, "-cfg");
845 /* walk over the blocks in the graph */
846 irg_block_walk(irg->end, dump_block_to_cfg, NULL, NULL);
852 /***********************************************************************/
853 /* the following routine dumps all type information reachable from an */
855 /***********************************************************************/
859 dump_type_graph (ir_graph *irg)
862 rem = current_ir_graph;
863 current_ir_graph = irg;
865 vcg_open (irg, "-type");
867 /* walk over the blocks in the graph */
868 type_walk_irg(irg, dump_type_info, NULL, NULL);
871 current_ir_graph = rem;
874 /***********************************************************************/
875 /* the following routine dumps all type information */
876 /***********************************************************************/
880 dump_all_types (void)
882 vcg_open_name ("All_types");
883 type_walk(dump_type_info, NULL, NULL);
887 /***********************************************************************/
888 /* dumps a graph with type information */
889 /***********************************************************************/
893 dump_ir_graph_w_types (ir_graph *irg)
896 rem = current_ir_graph;
897 current_ir_graph = irg;
899 vcg_open (irg, "-all");
901 /* dump common ir graph */
902 /* irg_block_walk(irg->end, dump_ir_block, NULL, irg); */
903 irg_walk(irg->end, dump_whole_node, NULL, NULL);
905 type_walk_irg(irg, dump_type_info, NULL, NULL);
906 /* dump edges from graph to type info */
907 irg_walk(irg->end, dump_node2type_edges, NULL, NULL);
910 current_ir_graph = rem;
913 /***********************************************************************/
914 /* dumps all graphs with the graph-dumper passed. Possible dumpers: */
916 /* dump_ir_block_graph */
918 /* dump_type_graph */
919 /* dump_ir_graph_w_types */
920 /***********************************************************************/
921 void dump_all_ir_graphs (void dump_graph(ir_graph*)) {
923 for (i=0; i < get_irp_n_irgs(); i++) {
924 dump_graph(get_irp_irg(i));
929 /* To turn off display of edge labels. Edge labels offen cause xvcg to
930 abort with a segmentation fault. */
931 void turn_of_edge_labels() {