3 * File name: ir/ir/irdump.c
4 * Purpose: Write vcg representation of firm to file.
5 * Author: Martin Trapp, Christian Schaefer
6 * Modified by: Goetz Lindenmaier, Hubert Schmidt
9 * Copyright: (c) 1998-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
22 # include "irnode_t.h"
23 # include "irgraph_t.h"
24 # include "entity_t.h"
26 # include "firm_common_t.h"
31 # include "typewalk.h"
34 # include "type_or_entity.h"
47 void dump_chi_term(FILE *FL, ir_node *n);
48 void dump_state(FILE *FL, ir_node *n);
49 int get_opt_dump_abstvals(void);
50 typedef unsigned long SeqNo;
51 SeqNo get_Block_seqno(ir_node *n);
54 /* Attributes of nodes */
55 #define PRINT_DEFAULT_NODE_ATTR
56 #define DEFAULT_NODE_ATTR " "
57 #define DEFAULT_TYPE_ATTRIBUTE " "
59 /* Attributes of edges between Firm nodes */
60 #define BLOCK_EDGE_ATTR "class: 2 priority: 2 linestyle: dotted"
61 #define CF_EDGE_ATTR "color: red"
62 #define MEM_EDGE_ATTR "color: blue"
63 #define DOMINATOR_EDGE_ATTR "color: red"
65 #define BACK_EDGE_ATTR "linestyle: dashed "
67 /* Attributes of edges between Firm nodes and type/entity nodes */
68 #define NODE2TYPE_EDGE_ATTR "class: 2 priority: 2 linestyle: dotted"
70 /* Attributes of edges in type/entity graphs. */
71 #define TYPE_METH_NODE_ATTR "color: lightyellow"
72 #define TYPE_CLASS_NODE_ATTR "color: green"
73 #define TYPE_DESCRIPTION_NODE_ATTR "color: lightgreen"
74 #define ENTITY_NODE_ATTR "color: yellow"
75 #define ENT_TYPE_EDGE_ATTR "class: 3 label: \"type\" color: red"
76 #define ENT_OWN_EDGE_ATTR "class: 4 label: \"owner\" color: black"
77 #define METH_PAR_EDGE_ATTR "class: 5 label: \"param %d\" color: green"
78 #define METH_RES_EDGE_ATTR "class: 6 label: \"res %d\" color: green"
79 #define TYPE_SUPER_EDGE_ATTR "class: 7 label: \"supertype\" color: red"
80 #define UNION_EDGE_ATTR "class: 8 label: \"component\" color: blue"
81 #define PTR_PTS_TO_EDGE_ATTR "class: 9 label: \"points to\" color:green"
82 #define ARR_ELT_TYPE_EDGE_ATTR "class: 10 label: \"arr elt tp\" color:green"
83 #define ARR_ENT_EDGE_ATTR "class: 10 label: \"arr ent\" color: green"
84 #define ENT_OVERWRITES_EDGE_ATTR "class: 11 label: \"overwrites\" color:red"
85 #define ENT_VALUE_EDGE_ATTR "label: \"value %d\""
86 #define ENT_CORR_EDGE_ATTR "label: \"value %d corresponds to \" "
87 #define TYPE_MEMBER_EDGE_ATTR "class: 12 label: \"member\" color:blue"
90 #if DEBUG_libfirm && NODEID_AS_LABEL
91 #define PRINT_NODEID(X) fprintf(F, "n%ld", get_irn_node_nr(X))
92 #define PRINT_TYPEID(X) fprintf(F, "\"t%ld\"", get_type_nr(X))
93 #define PRINT_ENTID(X) fprintf(F, "e%ld", get_entity_nr(X))
94 #define PRINT_IRGID(X) fprintf(F, "g%ld", get_irg_graph_nr(X))
95 #define PRINT_CONSTID(X,Y) fprintf(F, "\"n%ldn%ld\"", get_irn_node_nr(X),get_irn_node_nr(Y))
98 #define PRINT_NODEID(X) fprintf(F, "n%p", (void*) X)
99 #define PRINT_TYPEID(X) fprintf(F, "\"t%p\"", (void *) X)
100 #define PRINT_ENTID(X) fprintf(F, "e%p", (void*) X)
101 #define PRINT_IRGID(X) fprintf(F, "g%p",(void*) X)
102 #define PRINT_CONSTID(X,Y) fprintf(F, "\"n%pn%p\"", (void*) X, (void*) Y)
105 static void print_type_type_edge(FILE *F, type *S, type *T, const char *fmt, ...)
110 fprintf(F, "edge: { sourcename: "); PRINT_TYPEID(S);
111 fprintf(F, " targetname: "); PRINT_TYPEID(T);
112 vfprintf(F, fmt, ap);
117 static void print_type_ent_edge(FILE *F, type *T, entity *E, const char *fmt, ...)
122 fprintf(F, "edge: { sourcename: "); PRINT_TYPEID(T);
123 fprintf(F, " targetname: \""); PRINT_ENTID(E); fprintf(F, "\"");
124 vfprintf(F, fmt, ap);
129 static void print_ent_ent_edge(FILE *F, entity *E, entity *T, const char *fmt, ...)
134 fprintf(F, "edge: { sourcename: \""); PRINT_ENTID(E);
135 fprintf(F, "\" targetname: \""); PRINT_ENTID(T); fprintf(F, "\"");
136 vfprintf(F, fmt, ap);
141 static void print_ent_type_edge(FILE *F, entity *E, type *T, const char *fmt, ...)
146 fprintf(F, "edge: { sourcename: \""); PRINT_ENTID(E);
147 fprintf(F, "\" targetname: "); PRINT_TYPEID(T);
148 vfprintf(F, fmt, ap);
153 static void print_node_type_edge(FILE *F, const ir_node *N, type *T, const char *fmt, ...)
158 fprintf(F, "edge: { sourcename: \""); PRINT_NODEID(N);
159 fprintf(F, "\" targetname: "); PRINT_TYPEID(T);
160 vfprintf(F, fmt, ap);
165 static void print_node_ent_edge(FILE *F, const ir_node *N, entity *E, const char *fmt, ...)
170 fprintf(F, "edge: { sourcename: \""); PRINT_NODEID(N);
171 fprintf(F, "\" targetname: \""); PRINT_ENTID(E);
173 vfprintf(F, fmt, ap);
178 static void print_ent_node_edge(FILE *F, entity *E, const ir_node *N, const char *fmt, ...)
183 fprintf(F, "edge: { sourcename: \""); PRINT_ENTID(E);
184 fprintf(F, "\" targetname: \""); PRINT_NODEID(N); fprintf(F, "\"");
185 vfprintf(F, fmt, ap);
190 /*******************************************************************/
191 /* global and ahead declarations */
192 /*******************************************************************/
194 /* A suffix to manipulate the file name. */
195 char *dump_file_suffix = "";
197 /* file to dump to */
200 static void dump_whole_node(ir_node *n, void* env);
201 static INLINE void dump_loop_info(ir_graph *irg);
203 /*******************************************************************/
204 /* Helper functions. */
205 /*******************************************************************/
207 /* Use private link attr to be able to call dumper anywhere without
208 destroying link fields. */
210 static pmap *irdump_link_map = NULL;
212 static void init_irdump(void) {
213 /* We need a new, empty map. */
214 if (irdump_link_map) pmap_destroy(irdump_link_map);
215 irdump_link_map = pmap_create();
219 void *ird_get_irn_link(ir_node *n) {
221 if (!irdump_link_map) return NULL;
223 if (pmap_contains(irdump_link_map, (void *)n))
224 res = pmap_get(irdump_link_map, (void *)n);
228 void ird_set_irn_link(ir_node *n, void *x) {
229 if (!irdump_link_map) init_irdump();
230 pmap_insert(irdump_link_map, (void *)n, x);
233 void *ird_get_irg_link(ir_graph *irg) {
235 if (!irdump_link_map) return NULL;
237 if (pmap_contains(irdump_link_map, (void *)irg))
238 res = pmap_get(irdump_link_map, (void *)irg);
242 void ird_set_irg_link(ir_graph *irg, void *x) {
243 if (!irdump_link_map) init_irdump();
244 pmap_insert(irdump_link_map, (void *)irg, x);
247 static void clear_link(ir_node * node, void * env) {
248 ird_set_irn_link(node, NULL);
252 static int node_floats(ir_node *n) {
253 return ((get_op_pinned(get_irn_op(n)) == floats) &&
254 (get_irg_pinned(current_ir_graph) == floats));
257 static const char *get_ent_dump_name (entity *ent) {
258 /* Don't use get_entity_ld_ident (ent) as it computes the mangled name! */
259 if (ent->ld_name) return get_id_str(ent->ld_name);
260 return get_id_str(ent->name);
263 static const char *get_irg_dump_name (ir_graph *irg) {
264 /* Don't use get_entity_ld_ident (ent) as it computes the mangled name! */
265 entity *ent = get_irg_ent(irg);
266 return get_ent_dump_name(ent);
269 static void collect_node(ir_node * node, void *env) {
272 || get_irn_op(node) == op_Bad
273 || get_irn_op(node) == op_Unknown) {
274 ir_node ** arr = (ir_node **) ird_get_irg_link(get_irn_irg(node));
275 if (!arr) arr = NEW_ARR_F(ir_node *, 0);
276 ARR_APP1(ir_node *, arr, node);
277 ird_set_irg_link(get_irn_irg(node), arr); /* arr is an l-value, APP_ARR might change it! */
279 ir_node * block = get_nodes_block(node);
280 ird_set_irn_link(node, ird_get_irn_link(block));
281 ird_set_irn_link(block, node);
285 /** Construct lists to walk ir block-wise.
287 * Collects all blocks, nodes not pinned,
288 * Bad and Unknown into a flexible array in link field of
289 * irg they belong to. Sets the irg link field to NULL in all
290 * graphs not visited.
291 * Free the list with DEL_ARR_F. */
292 static ir_node ** construct_block_lists(ir_graph *irg) {
294 ir_graph *rem = current_ir_graph;
295 current_ir_graph = irg;
297 for (i = 0; i < get_irp_n_irgs(); i++)
298 ird_set_irg_link(get_irp_irg(i), NULL);
300 irg_walk_graph(current_ir_graph, clear_link, collect_node, current_ir_graph);
302 current_ir_graph = rem;
303 return ird_get_irg_link(irg);
306 /*******************************************************************/
307 /* flags to steer output */
308 /*******************************************************************/
310 /* A compiler option to turn off edge labels */
312 /* A compiler option to turn off dumping values of constant entities */
313 int const_entities = 1;
314 /* A compiler option to dump the keep alive edges */
315 int dump_keepalive = 0;
316 /* Compiler options to dump analysis information in dump_ir_graph */
317 int dump_out_edge_flag = 0;
318 int dump_dominator_information_flag = 0;
319 int dump_loop_information_flag = 0;
320 int dump_backedge_information_flag = 1;
321 int dump_const_local = 0;
322 bool opt_dump_analysed_type_info = 1;
323 bool opt_dump_pointer_values_to_info = 0; /* default off: for test compares!! */
325 INLINE bool get_opt_dump_const_local(void) {
326 if (!dump_out_edge_flag && !dump_loop_information_flag)
327 return dump_const_local;
332 /* To turn off display of edge labels. Edge labels offen cause xvcg to
333 abort with a segmentation fault. */
334 void turn_off_edge_labels(void) {
338 void dump_consts_local(bool b) {
339 dump_const_local = b;
342 void turn_off_constant_entity_values(void) {
346 void dump_keepalive_edges(bool b) {
350 bool get_opt_dump_keepalive_edges(void) {
351 return dump_keepalive;
354 void dump_out_edges(void) {
355 dump_out_edge_flag = 1;
358 void dump_dominator_information(void) {
359 dump_dominator_information_flag = 1;
362 void dump_loop_information(void) {
363 dump_loop_information_flag = 1;
366 void dont_dump_loop_information(void) {
367 dump_loop_information_flag = 0;
370 void dump_backedge_information(bool b) {
371 dump_backedge_information_flag = b;
374 /* Dump the information of type field specified in ana/irtypeinfo.h.
375 * If the flag is set, the type name is output in [] in the node label,
376 * else it is output as info.
378 void dump_analysed_type_info(bool b) {
379 opt_dump_analysed_type_info = b;
382 void dump_pointer_values_to_info(bool b) {
383 opt_dump_pointer_values_to_info = b;
386 /*******************************************************************/
387 /* Routines to dump information about a single ir node. */
388 /*******************************************************************/
391 dump_node_opcode (ir_node *n)
394 switch(get_irn_opcode(n)) {
399 res = tarval_snprintf(buf, sizeof(buf), get_Const_tarval(n));
400 assert(res < sizeof(buf) && "buffer to small for tarval_snprintf");
405 if (get_SymConst_kind(n) == linkage_ptr_info) {
406 /* don't use get_SymConst_ptr_info as it mangles the name. */
407 fprintf (F, "SymC %s", get_id_str(get_SymConst_ptrinfo(n)));
409 assert(get_kind(get_SymConst_type(n)) == k_type);
410 assert(get_type_ident(get_SymConst_type(n)));
411 fprintf (F, "SymC %s ", get_type_name(get_SymConst_type(n)));
412 if (get_SymConst_kind(n) == type_tag)
420 if (!interprocedural_view) fprintf(F, "Proj'");
421 else fprintf(F, "%s", get_irn_opname(n));
425 if (interprocedural_view) {
426 fprintf(F, "%s %s", get_irn_opname(n), get_ent_dump_name(get_irg_ent(get_irn_irg(n))));
432 fprintf (F, "%s", get_irn_opname(n));
439 dump_node_mode (ir_node *n)
441 switch (get_irn_opcode(n)) {
460 fprintf (F, "%s", get_mode_name(get_irn_mode(n)));
467 static void dump_node_typeinfo(ir_node *n) {
468 if (!opt_dump_analysed_type_info) return;
469 if (get_irg_typeinfo_state(current_ir_graph) == irg_typeinfo_consistent ||
470 get_irg_typeinfo_state(current_ir_graph) == irg_typeinfo_inconsistent ) {
471 type *tp = get_irn_type(n);
473 fprintf (F, " [%s]", get_type_name(tp));
480 dump_node_nodeattr (ir_node *n)
482 switch (get_irn_opcode(n)) {
484 if (false && interprocedural_view) {
485 fprintf (F, "%s", get_ent_dump_name(get_irg_ent(current_ir_graph)));
489 if (get_irn_opcode(get_Proj_pred(n)) == iro_Cmp) {
490 fprintf (F, "%s", get_pnc_string(get_Proj_proj(n)));
492 fprintf (F, "%ld", get_Proj_proj(n));
496 fprintf (F, "%ld", get_Filter_proj(n));
499 fprintf (F, "%s", get_ent_dump_name(get_Sel_entity(n)));
502 fprintf (F, "(%s)", get_type_name(get_Cast_type(n)));
505 fprintf (F, "%s", get_pnc_string(get_Confirm_cmp(n)));
514 dump_node_vcgattr (ir_node *n)
516 switch (get_irn_opcode(n)) {
523 fprintf (F, "color: blue");
526 fprintf (F, "color: lightyellow");
529 fprintf (F, "color: green");
535 fprintf (F, "color: yellow");
538 PRINT_DEFAULT_NODE_ATTR;
543 dump_node_info (ir_node *n) {
546 fprintf (F, " info1: \"");
547 if (opt_dump_pointer_values_to_info)
548 fprintf (F, "addr: %p \n", (void *)n);
549 fprintf (F, "visited: %ld \n", get_irn_visited(n));
550 irg = get_irn_irg(n);
551 if (irg != get_const_code_irg())
552 fprintf (F, "irg: %s\n", get_ent_dump_name(get_irg_entity(irg)));
555 switch (get_irn_opcode(n)) {
557 type *tp = get_entity_type(get_irg_ent(get_irn_irg(n)));
558 fprintf(F, "start of method of type %s \n", get_type_name(tp));
559 for (i = 0; i < get_method_n_params(tp); ++i)
560 fprintf(F, " param %d type: %s \n", i, get_type_name(get_method_param_type(tp, i)));
563 fprintf(F, "allocating entity of type %s \n", get_type_name(get_Alloc_type(n)));
566 fprintf(F, "freeing entity of type %s \n", get_type_name(get_Free_type(n)));
569 fprintf(F, "Selecting entity of type %s \n", get_type_name(get_entity_type(get_Sel_entity(n))));
570 fprintf(F, " from entity of type %s \n", get_type_name(get_entity_owner(get_Sel_entity(n))));
573 type *tp = get_Call_type(n);
574 fprintf(F, "calling method of type %s \n", get_type_name(tp));
575 for (i = 0; i < get_method_n_params(tp); ++i)
576 fprintf(F, " param %d type: %s \n", i, get_type_name(get_method_param_type(tp, i)));
577 for (i = 0; i < get_method_n_ress(tp); ++i)
578 fprintf(F, " resul %d type: %s \n", i, get_type_name(get_method_res_type(tp, i)));
579 if (Call_has_callees(n)) {
580 fprintf(F, "possible callees: \n");
581 for (i = 0; i < get_Call_n_callees(n); i++) {
582 if (!get_Call_callee(n, i)) {
583 fprintf(F, " %d external method\n", i);
585 fprintf(F, " %d: %s\n", i, get_ent_dump_name(get_Call_callee(n, i)));
590 case iro_CallBegin: {
591 ir_node *call = get_CallBegin_call(n);
592 if (Call_has_callees(call)) {
593 fprintf(F, "possible callees: \n");
594 for (i = 0; i < get_Call_n_callees(call); i++) {
595 if (!get_Call_callee(call, i)) {
596 fprintf(F, " %d external method\n", i);
598 fprintf(F, " %d: %s\n", i, get_ent_dump_name(get_Call_callee(call, i)));
604 if (!interprocedural_view) {
605 type *tp = get_entity_type(get_irg_ent(get_irn_irg(n)));
606 fprintf(F, "return in method of type %s \n", get_type_name(tp));
607 for (i = 0; i < get_method_n_ress(tp); ++i)
608 fprintf(F, " res %d type: %s \n", i, get_type_name(get_method_res_type(tp, i)));
612 type *tp = get_Const_type(n);
613 assert(tp != none_type);
614 fprintf(F, "Const of type %s \n", get_type_name(get_Const_type(n)));
618 if (interprocedural_view) {
619 fprintf(F, "intra predecessor nodes:\n");
620 for (i = 0; i < get_irn_intra_arity(n); i++) {
621 ir_node *pred = get_irn_intra_n(n, i);
622 fprintf(F, " %s%s %ld\n", get_irn_opname(pred), get_irn_modename(pred), get_irn_node_nr(pred));
625 fprintf(F, "inter predecessor nodes:\n");
626 for (i = 0; i < get_irn_inter_arity(n); i++) {
627 ir_node *pred = get_irn_inter_n(n, i);
628 fprintf(F, " %s%s %ld \tin graph %s\n", get_irn_opname(pred), get_irn_modename(pred),
629 get_irn_node_nr(pred), get_ent_dump_name(get_irg_entity(get_irn_irg(pred))));
637 if (get_irg_typeinfo_state(get_irn_irg(n)) == irg_typeinfo_consistent ||
638 get_irg_typeinfo_state(get_irn_irg(n)) == irg_typeinfo_inconsistent )
639 if (get_irn_type(n) != none_type)
640 fprintf (F, "\nAnalysed type: %s", get_type_name(get_irn_type(n)));
647 bool is_constlike_node(ir_node *n) {
648 ir_op *op = get_irn_op(n);
649 return (op == op_Const || op == op_Bad || op == op_SymConst || op == op_Unknown);
653 /* outputs the predecessors of n, that are constants, local. I.e.,
654 generates a copy of the constant predecessors for each node called with. */
655 static void dump_const_node_local(ir_node *n) {
657 if (!get_opt_dump_const_local()) return;
659 /* Use visited flag to avoid outputting nodes twice.
660 initialize it first. */
661 for (i = 0; i < get_irn_arity(n); i++) {
662 ir_node *con = get_irn_n(n, i);
663 if (is_constlike_node(con)) {
664 set_irn_visited(con, get_irg_visited(current_ir_graph)-1);
668 for (i = 0; i < get_irn_arity(n); i++) {
669 ir_node *con = get_irn_n(n, i);
670 if (is_constlike_node(con) && irn_not_visited(con)) {
671 mark_irn_visited(con);
672 /* Generate a new name for the node by appending the names of
674 fprintf (F, "node: {title: "); PRINT_CONSTID(n, con);
675 fprintf(F, " label: \"");
676 dump_node_opcode(con);
677 dump_node_mode (con);
678 dump_node_typeinfo(con);
680 dump_node_nodeattr(con);
681 fprintf (F, " %ld", get_irn_node_nr(con));
683 dump_node_vcgattr(con);
691 dump_node (ir_node *n) {
692 if (get_opt_dump_const_local() && is_constlike_node(n)) return;
694 fprintf (F, "node: {title: \""); PRINT_NODEID(n); fprintf(F, "\" label: \"");
698 dump_node_typeinfo(n);
700 dump_node_nodeattr(n);
701 fprintf (F, " %ld", get_irn_node_nr(n));
703 dump_node_vcgattr(n);
706 dump_const_node_local(n);
713 /* dump the edge to the block this node belongs to */
715 dump_ir_block_edge(ir_node *n) {
716 if (get_opt_dump_const_local() && is_constlike_node(n)) return;
717 if (is_no_Block(n)) {
718 fprintf (F, "edge: { sourcename: \"");
720 fprintf (F, "\" targetname: \"");
721 PRINT_NODEID(get_nodes_block(n));
722 fprintf (F, "\" " BLOCK_EDGE_ATTR "}\n");
726 static void print_edge_vcgattr(ir_node *from, int to) {
729 if (dump_backedge_information_flag && is_backedge(from, to))
730 fprintf (F, BACK_EDGE_ATTR);
732 switch (get_irn_opcode(from)) {
734 fprintf (F, CF_EDGE_ATTR);
736 case iro_Start: break;
739 if (get_irn_mode(get_End_keepalive(from, to)) == mode_BB)
740 fprintf (F, CF_EDGE_ATTR);
741 if (get_irn_mode(get_End_keepalive(from, to)) == mode_X)
742 fprintf (F, MEM_EDGE_ATTR);
745 case iro_EndReg: break;
746 case iro_EndExcept: break;
748 case iro_Break: break;
749 case iro_Cond: break;
752 if (to == 0) fprintf (F, MEM_EDGE_ATTR);
754 case iro_Const: break;
755 case iro_SymConst:break;
758 if (to == 0) fprintf (F, MEM_EDGE_ATTR);
760 case iro_CallBegin: break;
763 case iro_Minus: break;
769 if (to == 0) fprintf (F, MEM_EDGE_ATTR);
777 case iro_Shrs: break;
780 case iro_Conv: break;
782 if (get_irn_modecode(from) == irm_M) fprintf (F, MEM_EDGE_ATTR);
788 if (to == 0) fprintf (F, MEM_EDGE_ATTR);
791 fprintf (F, MEM_EDGE_ATTR);
793 case iro_Tuple: break;
796 switch (get_irn_modecode(from)) {
798 fprintf (F, CF_EDGE_ATTR);
801 fprintf (F, MEM_EDGE_ATTR);
807 case iro_Unknown: break;
814 /* dump edges to our inputs */
816 dump_ir_data_edges(ir_node *n) {
817 int i, visited = get_irn_visited(n);
819 if ((get_irn_op(n) == op_End) && (!dump_keepalive))
822 for (i = 0; i < get_irn_arity(n); i++) {
823 ir_node * pred = get_irn_n(n, i);
826 if ((interprocedural_view && get_irn_visited(pred) < visited))
827 continue; /* pred not dumped */
829 if (dump_backedge_information_flag && is_backedge(n, i))
830 fprintf (F, "backedge: {sourcename: \"");
832 fprintf (F, "edge: {sourcename: \"");
834 fprintf (F, "\" targetname: ");
835 if ((get_opt_dump_const_local()) && is_constlike_node(pred)) {
836 PRINT_CONSTID(n, pred);
838 fprintf(F, "\""); PRINT_NODEID(pred); fprintf(F, "\"");
840 fprintf (F, " label: \"%d\" ", i);
841 print_edge_vcgattr(n, i);
846 /** Dumps a node and its edges but not the block edge
849 dump_node_wo_blockedge (ir_node *n, void* env) {
851 dump_ir_data_edges(n);
854 /** Dumps a node and its edges.
857 dump_whole_node (ir_node *n, void* env) {
858 dump_node_wo_blockedge(n, env);
859 if (!node_floats(n)) dump_ir_block_edge(n);
863 dump_const_node(ir_node *n, void *env) {
864 if (is_Block(n)) return;
865 dump_node_wo_blockedge(n, env);
868 /***********************************************************************/
869 /* the following routines dump the nodes/irgs bracketed to graphs. */
870 /***********************************************************************/
872 /** Dumps a constant expression as entity initializer, array bound ...
874 static void dump_const_expression(ir_node *value) {
875 ir_graph *rem = current_ir_graph;
876 int rem_dump_const_local = dump_const_local;
877 dump_const_local = 0;
878 current_ir_graph = get_const_code_irg();
879 irg_walk(value, dump_const_node, NULL, NULL);
880 /* Decrease visited flag so that we walk with the same flag for the next
881 expresssion. This guarantees that we don't dump the same node twice,
882 as for const expressions cse is performed to save memory. */
883 set_irg_visited(current_ir_graph, get_irg_visited(current_ir_graph) -1);
884 current_ir_graph = rem;
885 dump_const_local = rem_dump_const_local;
888 /** Dump a block as graph containing its nodes.
890 * Expects to find nodes belonging to the block as list in its
892 * Dumps the edges of all nodes including itself. */
894 dump_whole_block(ir_node *block) {
896 assert(is_Block(block));
898 fprintf(F, "graph: { title: \"");
900 fprintf(F, "\" label: \"");
901 dump_node_opcode(block);
902 fprintf (F, " %ld", get_irn_node_nr(block));
904 if (get_opt_dump_abstvals())
905 fprintf (F, " seqno: %d", (int)get_Block_seqno(block));
907 fprintf(F, "\" status:clustered color:%s \n",
908 get_Block_matured(block) ? "yellow" : "red");
910 /* dump the blocks edges */
911 dump_ir_data_edges(block);
913 dump_chi_term(F, block);
916 /* dump the nodes that go into the block */
917 for (node = ird_get_irn_link(block); node; node = ird_get_irn_link(node)) {
919 dump_ir_data_edges(node);
922 /* Close the vcg information for the block */
924 dump_const_node_local(block);
928 /** dumps a graph block-wise. Expects all blockless nodes in arr in irgs link.
929 * The outermost nodes: blocks and nodes not pinned, Bad, Unknown. */
931 dump_block_graph (ir_graph *irg) {
933 ir_graph *rem = current_ir_graph;
934 ir_node **arr = ird_get_irg_link(irg);
935 current_ir_graph = irg;
937 for (i = ARR_LEN(arr) - 1; i >= 0; --i) {
938 ir_node * node = arr[i];
939 if (is_Block(node)) {
940 /* Dumps the block and all the nodes in the block, which are to
941 be found in Block->link. */
942 dump_whole_block(node);
944 /* Nodes that are not in a Block. */
946 dump_ir_data_edges(node);
950 if (dump_loop_information_flag) dump_loop_info(irg);
952 current_ir_graph = rem;
955 /** Dumps an irg as a graph.
956 * If interprocedural view edges can point to nodes out of this graph.
958 static void dump_graph(ir_graph *irg) {
960 fprintf(F, "graph: { title: \"");
962 fprintf(F, "\" label: \"%s\" status:clustered color:white \n",
963 get_ent_dump_name(get_irg_ent(irg)));
965 dump_block_graph (irg);
967 /* Close the vcg information for the irg */
971 /*******************************************************************/
972 /* Basic type and entity nodes and edges. */
973 /*******************************************************************/
975 /* dumps the edges between nodes and their type or entity attributes. */
976 static void dump_node2type_edges (ir_node *n, void *env)
980 switch (get_irn_opcode(n)) {
982 /* @@@ some consts have an entity */
985 if ( (get_SymConst_kind(n) == type_tag)
986 || (get_SymConst_kind(n) == size))
988 print_node_type_edge(F,n,get_SymConst_type(n),NODE2TYPE_EDGE_ATTR);
992 print_node_ent_edge(F,n,get_Sel_entity(n),NODE2TYPE_EDGE_ATTR);
995 print_node_type_edge(F,n,get_Call_type(n),NODE2TYPE_EDGE_ATTR);
998 print_node_type_edge(F,n,get_Alloc_type(n),NODE2TYPE_EDGE_ATTR);
1001 print_node_type_edge(F,n,get_Free_type(n),NODE2TYPE_EDGE_ATTR);
1004 print_node_type_edge(F,n,get_Cast_type(n),NODE2TYPE_EDGE_ATTR);
1012 static void print_type_info(type *tp) {
1013 if (get_type_state(tp) == layout_undefined) {
1014 fprintf(F, "state: layout_undefined\n");
1016 fprintf(F, "state: layout_fixed,\n");
1018 if (get_type_mode(tp))
1019 fprintf(F, "mode: %s,\n", get_mode_name(get_type_mode(tp)));
1020 fprintf(F, "size: %dB,\n", get_type_size(tp));
1023 static void print_typespecific_info(type *tp) {
1024 switch (get_type_tpop_code(tp)) {
1027 fprintf(F, "peculiarity: %s\n", get_peculiarity_string(get_class_peculiarity(tp)));
1041 case tpo_enumeration:
1055 static void print_typespecific_vcgattr(type *tp) {
1056 switch (get_type_tpop_code(tp)) {
1059 if (peculiarity_existent == get_class_peculiarity(tp))
1060 fprintf (F, " " TYPE_CLASS_NODE_ATTR);
1062 fprintf (F, " " TYPE_DESCRIPTION_NODE_ATTR);
1066 fprintf (F, " " TYPE_METH_NODE_ATTR);
1077 case tpo_enumeration:
1090 static void print_type_node(type *tp)
1092 fprintf (F, "node: {title: ");
1094 fprintf (F, " label: \"%s %s\"", get_type_tpop_name(tp), get_type_name(tp));
1095 fprintf (F, " info1: \"");
1096 print_type_info(tp);
1097 print_typespecific_info(tp);
1099 print_typespecific_vcgattr(tp);
1103 #define X(a) case a: fprintf(F, #a); break
1104 void dump_entity_node(entity *ent)
1106 fprintf (F, "node: {title: \"");
1107 PRINT_ENTID(ent); fprintf(F, "\"");
1108 fprintf (F, DEFAULT_TYPE_ATTRIBUTE);
1109 fprintf (F, "label: ");
1110 fprintf (F, "\"ent %s\" " ENTITY_NODE_ATTR , get_ent_dump_name(ent));
1111 fprintf (F, "\n info1: \"\nid: "); PRINT_ENTID(ent);
1113 fprintf (F, "\nallocation: ");
1114 switch (get_entity_allocation(ent)) {
1115 X(allocation_dynamic);
1116 X(allocation_automatic);
1117 X(allocation_static);
1118 X(allocation_parameter);
1121 fprintf (F, "\nvisibility: ");
1122 switch (get_entity_visibility(ent)) {
1123 X(visibility_local);
1124 X(visibility_external_visible);
1125 X(visibility_external_allocated);
1128 fprintf (F, "\nvariability: ");
1129 switch (get_entity_variability(ent)) {
1130 X(variability_uninitialized);
1131 X(variability_initialized);
1132 X(variability_part_constant);
1133 X(variability_constant);
1136 fprintf (F, "\nvolatility: ");
1137 switch (get_entity_volatility(ent)) {
1138 X(volatility_non_volatile);
1139 X(volatility_is_volatile);
1142 fprintf(F, "\npeculiarity: %s", get_peculiarity_string(get_entity_peculiarity(ent)));
1143 fprintf(F, "\nname: %s\nld_name: %s",
1144 get_ent_dump_name(ent), ent->ld_name ? get_entity_ld_name(ent) : "no yet set");
1145 fprintf(F, "\noffset: %d", get_entity_offset(ent));
1146 if (is_method_type(get_entity_type(ent))) {
1147 if (get_entity_irg(ent)) /* can be null */
1148 { fprintf (F, "\nirg = "); PRINT_IRGID(get_entity_irg(ent)); }
1150 { fprintf (F, "\nirg = NULL"); }
1152 fprintf(F, "\"\n}\n");
1156 /* dumps a type or entity and it's edges. */
1158 dump_type_info (type_or_ent *tore, void *env) {
1159 int i = 0; /* to shutup gcc */
1161 /* dump this type or entity */
1163 switch (get_kind(tore)) {
1166 entity *ent = (entity *)tore;
1169 dump_entity_node(ent);
1171 /* skip this to reduce graph. Member edge of type is parallel to this edge. *
1172 fprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
1173 ENT_OWN_EDGE_ATTR "}\n", ent, get_entity_owner(ent));*/
1174 print_ent_type_edge(F,ent, get_entity_type(ent), ENT_TYPE_EDGE_ATTR);
1175 if(is_class_type(get_entity_owner(ent))) {
1176 for(i = 0; i < get_entity_n_overwrites(ent); i++){
1177 print_ent_ent_edge(F,ent, get_entity_overwrites(ent, i), ENT_OVERWRITES_EDGE_ATTR);
1180 /* attached subgraphs */
1181 if (const_entities && (get_entity_variability(ent) != variability_uninitialized)) {
1182 if (is_atomic_entity(ent)) {
1183 value = get_atomic_ent_value(ent);
1185 print_ent_node_edge(F,ent, value, ENT_VALUE_EDGE_ATTR, i);
1186 /* DDMN(value); $$$ */
1187 dump_const_expression(value);
1190 if (is_compound_entity(ent)) {
1191 for (i = 0; i < get_compound_ent_n_values(ent); i++) {
1192 value = get_compound_ent_value(ent, i);
1194 print_ent_node_edge(F,ent,value,ENT_VALUE_EDGE_ATTR,i);
1195 dump_const_expression(value);
1196 print_ent_ent_edge(F,ent, get_compound_ent_value_member(ent, i), ENT_CORR_EDGE_ATTR, i);
1198 fprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
1199 ENT_CORR_EDGE_ATTR "}\n", GET_ENTID(ent),
1200 get_compound_ent_value_member(ent, i), i);
1209 type *tp = (type *)tore;
1210 print_type_node(tp);
1211 /* and now the edges */
1212 switch (get_type_tpop_code(tp)) {
1215 for (i=0; i < get_class_n_supertypes(tp); i++) {
1216 print_type_type_edge(F, tp,get_class_supertype(tp, i),TYPE_SUPER_EDGE_ATTR);
1219 for (i=0; i < get_class_n_members(tp); i++) {
1220 print_type_ent_edge(F,tp,get_class_member(tp, i),TYPE_MEMBER_EDGE_ATTR);
1225 for (i=0; i < get_struct_n_members(tp); i++) {
1226 print_type_ent_edge(F,tp,get_struct_member(tp, i),TYPE_MEMBER_EDGE_ATTR);
1231 for (i = 0; i < get_method_n_params(tp); i++)
1233 print_type_type_edge(F,tp,get_method_param_type(tp, i),METH_PAR_EDGE_ATTR,i);
1235 for (i = 0; i < get_method_n_ress(tp); i++)
1237 print_type_type_edge(F,tp,get_method_res_type(tp, i),METH_RES_EDGE_ATTR,i);
1242 for (i = 0; i < get_union_n_members(tp); i++)
1244 print_type_ent_edge(F,tp,get_union_member(tp, i),UNION_EDGE_ATTR);
1249 print_type_type_edge(F,tp,get_array_element_type(tp),ARR_ELT_TYPE_EDGE_ATTR);
1250 print_type_ent_edge(F,tp,get_array_element_entity(tp),ARR_ENT_EDGE_ATTR);
1251 for (i = 0; i < get_array_n_dimensions(tp); i++) {
1252 ir_node *upper = get_array_upper_bound(tp, i);
1253 ir_node *lower = get_array_lower_bound(tp, i);
1254 print_node_type_edge(F,upper, tp, "label: \"upper %d\"", get_array_order(tp, i));
1255 print_node_type_edge(F,lower, tp, "label: \"lower %d\"", get_array_order(tp, i));
1256 dump_const_expression(upper);
1257 dump_const_expression(lower);
1261 case tpo_enumeration:
1266 print_type_type_edge(F,tp,get_pointer_points_to_type(tp), PTR_PTS_TO_EDGE_ATTR);
1274 break; /* case k_type */
1277 printf(" *** irdump, dump_type_info(l.%i), faulty type.\n", __LINE__);
1279 } /* switch kind_or_entity */
1282 /** For dumping class hierarchies.
1283 * Dumps a class type node and a superclass edge.
1284 * If env != null dumps entities of classes and overwrites edges.
1287 dump_class_hierarchy_node (type_or_ent *tore, void *env) {
1288 int i = 0; /* to shutup gcc */
1290 /* dump this type or entity */
1291 switch (get_kind(tore)) {
1293 entity *ent = (entity *)tore;
1294 if (get_entity_owner(ent) == get_glob_type()) break;
1295 if ((env) && is_class_type(get_entity_owner(ent))) {
1297 dump_entity_node(ent);
1299 print_type_ent_edge(F,get_entity_owner(ent),ent,TYPE_MEMBER_EDGE_ATTR);
1300 for(i = 0; i < get_entity_n_overwrites(ent); i++)
1302 print_ent_ent_edge(F,get_entity_overwrites(ent, i),ent, ENT_OVERWRITES_EDGE_ATTR);
1305 } break; /* case k_entity */
1308 type *tp = (type *)tore;
1309 if (tp == get_glob_type()) break;
1310 switch (get_type_tpop_code(tp)) {
1312 print_type_node(tp);
1313 /* and now the edges */
1314 for (i=0; i < get_class_n_supertypes(tp); i++)
1316 print_type_type_edge(F,tp,get_class_supertype(tp, i),TYPE_SUPER_EDGE_ATTR);
1322 break; /* case k_type */
1325 printf(" *** irdump, dump_class_hierarchy_node(l.%i), faulty type.\n", __LINE__);
1327 } /* switch kind_or_entity */
1330 /*******************************************************************/
1331 /* dump analysis information that is expressed in graph terms. */
1332 /*******************************************************************/
1334 /* dump out edges */
1336 dump_out_edge (ir_node *n, void* env) {
1338 for (i = 0; i < get_irn_n_outs(n); i++) {
1339 assert(get_irn_out(n, i));
1340 fprintf (F, "edge: {sourcename: \"");
1342 fprintf (F, "\" targetname: \"");
1343 PRINT_NODEID(get_irn_out(n, i));
1344 fprintf (F, "\" color: red linestyle: dashed");
1350 dump_loop_node_edge (ir_loop *loop, int i) {
1352 fprintf (F, "edge: {sourcename: \"%p\" targetname: \"", (void*) loop);
1353 PRINT_NODEID(get_loop_node(loop, i));
1354 fprintf (F, "\" color: green");
1359 dump_loop_son_edge (ir_loop *loop, int i) {
1361 fprintf (F, "edge: {sourcename: \"%p\" targetname: \"%p\" color: darkgreen}\n",
1362 (void *)loop, (void *)get_loop_son(loop, i));
1366 void dump_loops (ir_loop *loop) {
1368 /* dump this loop node */
1369 fprintf (F, "node: {title: \"%p\" label: \"loop %d, %d sons, %d nodes\" }\n",
1370 (void*)loop, get_loop_depth(loop), get_loop_n_sons(loop), get_loop_n_nodes(loop));
1371 /* dump edges to nodes in loop -- only if it is a real loop */
1372 if (get_loop_depth(loop) != 0) {
1373 for (i = 0; i < get_loop_n_nodes(loop); i++) {
1374 dump_loop_node_edge(loop, i);
1377 for (i = 0; i < get_loop_n_sons(loop); i++) {
1378 dump_loops(get_loop_son(loop, i));
1379 dump_loop_son_edge(loop, i);
1384 void dump_loop_info(ir_graph *irg) {
1385 ir_graph *rem = current_ir_graph;
1386 current_ir_graph = irg;
1388 if (get_irg_loop(irg)) dump_loops(get_irg_loop(irg));
1390 current_ir_graph = rem;
1394 /************************************************************************/
1395 /* open and close vcg file */
1396 /************************************************************************/
1399 dump_vcg_header(const char *name) {
1409 "graph: { title: \"ir graph of %s\"\n"
1410 "display_edge_labels: %s\n"
1411 "layoutalgorithm: mindepth\n"
1412 "manhattan_edges: yes\n"
1413 "port_sharing: no\n"
1414 "orientation: bottom_to_top\n"
1415 "classname 1: \"Data\"\n"
1416 "classname 2: \"Block\"\n"
1417 "classname 3: \"Entity type\"\n"
1418 "classname 4: \"Entity owner\"\n"
1419 "classname 5: \"Method Param\"\n"
1420 "classname 6: \"Method Res\"\n"
1421 "classname 7: \"Super\"\n"
1422 "classname 8: \"Union\"\n"
1423 "classname 9: \"Points-to\"\n"
1424 "classname 10: \"Array Element Type\"\n"
1425 "classname 11: \"Overwrites\"\n"
1426 "classname 12: \"Member\"\n",
1429 fprintf (F, "\n"); /* a separator */
1432 static void vcg_open (ir_graph *irg, char * suffix1, char *suffix2) {
1433 const char *nm = get_irg_dump_name(irg);
1434 int len = strlen(nm);
1435 char *fname; /* filename to put the vcg information in */
1437 if (!suffix1) suffix1 = "";
1438 if (!suffix2) suffix2 = "";
1440 /** open file for vcg graph */
1441 fname = malloc (len + strlen(suffix1) + strlen(suffix2) + 5);
1442 strncpy (fname, nm, len); /* copy the filename */
1444 strcat (fname, suffix1); /* append file suffix */
1445 strcat (fname, suffix2); /* append file suffix */
1446 strcat (fname, ".vcg"); /* append the .vcg suffix */
1447 F = fopen (fname, "w"); /* open file for writing */
1449 panic ("cannot open %s for writing (%m)", fname); /* not reached */
1453 dump_vcg_header(nm);
1456 static void vcg_open_name (const char *name, char *suffix) {
1457 char *fname; /* filename to put the vcg information in */
1459 if (!suffix) suffix = "";
1461 /** open file for vcg graph */
1462 fname = malloc (strlen(name) + 5 + strlen(suffix));
1463 strcpy (fname, name); /* copy the filename */
1464 strcat (fname, suffix);
1465 strcat (fname, ".vcg"); /* append the .vcg suffix */
1466 F = fopen (fname, "w"); /* open file for writing */
1468 panic ("cannot open %s for writing (%m)", fname); /* not reached */
1472 dump_vcg_header(name);
1477 fprintf (F, "}\n"); /* print footer */
1478 fclose (F); /* close vcg file */
1481 /************************************************************************/
1482 /************************************************************************/
1483 /* Routines that dump all or parts of the firm representation to a file */
1484 /************************************************************************/
1485 /************************************************************************/
1487 /************************************************************************/
1488 /* Dump ir graphs, differnt formats and additional information. */
1489 /************************************************************************/
1491 /** Routine to dump a graph, blocks as conventional nodes.
1494 dump_ir_graph (ir_graph *irg)
1498 rem = current_ir_graph;
1499 current_ir_graph = irg;
1501 if (interprocedural_view) suffix = "-pure-ip";
1502 else suffix = "-pure";
1503 vcg_open (irg, dump_file_suffix, suffix);
1505 /* walk over the graph */
1506 /* dump_whole_node must be called in post visiting predecessors */
1507 irg_walk(get_irg_end(irg), NULL, dump_whole_node, NULL);
1509 /* dump the out edges in a separate walk */
1510 if ((dump_out_edge_flag) && (get_irg_outs_state(irg) != no_outs)) {
1511 irg_out_walk(get_irg_start(irg), dump_out_edge, NULL, NULL);
1516 current_ir_graph = rem;
1521 dump_ir_block_graph (ir_graph *irg)
1526 if (interprocedural_view) suffix = "-ip";
1528 vcg_open (irg, dump_file_suffix, suffix);
1530 construct_block_lists(irg);
1532 for (i = 0; i < get_irp_n_irgs(); i++) {
1533 ir_node **arr = ird_get_irg_link(get_irp_irg(i));
1535 dump_graph(get_irp_irg(i));
1543 /** dumps a graph with type information
1546 dump_ir_graph_w_types (ir_graph *irg)
1548 ir_graph *rem = current_ir_graph;
1550 current_ir_graph = irg;
1552 if (interprocedural_view) suffix = "-pure-wtypes-ip";
1553 else suffix = "-pure-wtypes";
1554 vcg_open (irg, dump_file_suffix, suffix);
1556 /* dump common ir graph */
1557 irg_walk(get_irg_end(irg), NULL, dump_whole_node, NULL);
1558 /* dump type info */
1559 type_walk_irg(irg, dump_type_info, NULL, NULL);
1560 inc_irg_visited(get_const_code_irg());
1561 /* dump edges from graph to type info */
1562 irg_walk(get_irg_end(irg), dump_node2type_edges, NULL, NULL);
1565 current_ir_graph = rem;
1569 dump_ir_block_graph_w_types (ir_graph *irg)
1573 ir_graph *rem = current_ir_graph;
1575 if (interprocedural_view) suffix = "-wtypes-ip";
1576 else suffix = "-wtypes";
1577 vcg_open (irg, dump_file_suffix, suffix);
1579 /* dump common blocked ir graph */
1580 construct_block_lists(irg);
1582 for (i = 0; i < get_irp_n_irgs(); i++) {
1583 ir_node **arr = ird_get_irg_link(get_irp_irg(i));
1585 dump_graph(get_irp_irg(i));
1590 /* dump type info */
1591 current_ir_graph = irg;
1592 type_walk_irg(irg, dump_type_info, NULL, NULL);
1593 inc_irg_visited(get_const_code_irg());
1595 /* dump edges from graph to type info */
1596 irg_walk(get_irg_end(irg), dump_node2type_edges, NULL, NULL);
1598 current_ir_graph = rem;
1602 /***********************************************************************/
1603 /* The following routines dump a control flow graph. */
1604 /***********************************************************************/
1607 dump_block_to_cfg (ir_node *block, void *env) {
1611 if (is_Block(block)) {
1612 /* This is a block. Dump a node for the block. */
1613 fprintf (F, "node: {title: \""); PRINT_NODEID(block);
1614 fprintf (F, "\" label: \"%s ", get_op_name(get_irn_op(block)));
1615 PRINT_NODEID(block);
1617 if (dump_dominator_information_flag)
1618 fprintf(F, "info1:dom depth %d", get_Block_dom_depth(block));
1620 /* Dump the edges */
1621 for ( i = 0; i < get_Block_n_cfgpreds(block); i++)
1622 if (get_irn_op(skip_Proj(get_Block_cfgpred(block, i))) != op_Bad) {
1623 pred = get_nodes_block(skip_Proj(get_Block_cfgpred(block, i)));
1624 fprintf (F, "edge: { sourcename: \"");
1625 PRINT_NODEID(block);
1626 fprintf (F, "\" targetname: \"");
1628 fprintf (F, "\"}\n");
1631 /* Dump dominator edge */
1632 if (dump_dominator_information_flag && get_Block_idom(block)) {
1633 pred = get_Block_idom(block);
1634 fprintf (F, "edge: { sourcename: \"");
1635 PRINT_NODEID(block);
1636 fprintf (F, "\" targetname: \"");
1638 fprintf (F, "\" " DOMINATOR_EDGE_ATTR "}\n");
1644 dump_cfg (ir_graph *irg)
1646 ir_graph *rem = current_ir_graph;
1647 int ddif = dump_dominator_information_flag;
1648 int ipv = interprocedural_view;
1649 current_ir_graph = irg;
1651 vcg_open (irg, dump_file_suffix, "-cfg");
1653 if (interprocedural_view) {
1654 printf("Warning: dumping cfg not in interprocedural view!\n");
1655 interprocedural_view = 0;
1658 if (get_irg_dom_state(irg) != dom_consistent)
1659 dump_dominator_information_flag = 0;
1661 /* walk over the blocks in the graph */
1662 irg_block_walk(get_irg_end(irg), dump_block_to_cfg, NULL, NULL);
1663 dump_node (get_irg_bad(irg));
1665 dump_dominator_information_flag = ddif;
1666 interprocedural_view = ipv;
1668 current_ir_graph = rem;
1673 /* Dump all irgs in interprocedural view to a single file. */
1674 void dump_all_cg_block_graph(void) {
1676 int rem_view = interprocedural_view;
1677 interprocedural_view = 1;
1679 vcg_open_name ("All_graphs", dump_file_suffix);
1681 /* collect nodes in all irgs reachable in call graph*/
1682 for (i = 0; i < get_irp_n_irgs(); i++)
1683 ird_set_irg_link(get_irp_irg(i), NULL);
1685 cg_walk(clear_link, collect_node, NULL);
1687 /* dump all graphs */
1688 for (i = 0; i < get_irp_n_irgs(); i++) {
1689 current_ir_graph = get_irp_irg(i);
1690 assert(ird_get_irg_link(current_ir_graph));
1691 dump_graph(current_ir_graph);
1692 DEL_ARR_F(ird_get_irg_link(current_ir_graph));
1696 interprocedural_view = rem_view;
1699 /***********************************************************************/
1700 /* the following routines dumps type information without any ir nodes. */
1701 /***********************************************************************/
1704 dump_type_graph (ir_graph *irg)
1707 rem = current_ir_graph;
1708 current_ir_graph = irg;
1710 vcg_open (irg, dump_file_suffix, "-type");
1712 /* walk over the blocks in the graph */
1713 type_walk_irg(irg, dump_type_info, NULL, NULL);
1714 /* The walker for the const code can be called several times for the
1715 same (sub) experssion. So that no nodes are dumped several times
1716 we decrease the visited flag of the corresponding graph after each
1717 walk. So now increase it finally. */
1718 inc_irg_visited(get_const_code_irg());
1721 current_ir_graph = rem;
1725 dump_all_types (void)
1727 vcg_open_name ("All_types", dump_file_suffix);
1728 type_walk(dump_type_info, NULL, NULL);
1729 inc_irg_visited(get_const_code_irg());
1734 dump_class_hierarchy (bool entities)
1736 vcg_open_name ("class_hierarchy", dump_file_suffix);
1738 type_walk(dump_class_hierarchy_node, NULL, (void *)1);
1740 type_walk(dump_class_hierarchy_node, NULL, NULL);
1744 /***********************************************************************/
1745 /* dumps all graphs with the graph-dumper passed. Possible dumpers: */
1747 /* dump_ir_block_graph */
1749 /* dump_type_graph */
1750 /* dump_ir_graph_w_types */
1751 /***********************************************************************/
1753 void dump_all_ir_graphs (dump_graph_func *dmp_grph) {
1755 for (i=0; i < get_irp_n_irgs(); i++) {
1756 dmp_grph(get_irp_irg(i));