2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Private header for irdump
25 #ifndef FIRM_IR_IRDUMPT_T_H
26 #define FIRM_IR_IRDUMPT_T_H
29 #include "irgraph_t.h"
32 * Symbolic names for the different dumping colors.
34 typedef enum ird_color_t {
36 ird_color_prog_background,
37 ird_color_block_background,
38 ird_color_dead_block_background,
39 ird_color_block_inout,
40 ird_color_default_node,
43 ird_color_controlflow,
47 ird_color_uses_memory,
57 data_edge = 0x01, /**< A data edge between two basic blocks. */
58 block_edge = 0x02, /**< An edge from a node to its basic block. */
59 cf_edge = 0x03, /**< A regularly control flow edge. */
60 exc_cf_edge = 0x04, /**< An exceptional control flow edge. */
61 mem_edge = 0x05, /**< A memory edge. */
62 dominator_edge = 0x06, /**< A dominator edge from a block to its immediate dominator. */
63 node2type_edge = 0x07, /**< An edge from an IR node to a type. */
65 ent_type_edge = 0x11, /**< An edge from an entity to its type. */
66 ent_own_edge = 0x12, /**< An edge from an entity to its owner type. */
67 ent_overwrites_edge = 0x13, /**< An edge from an entity to the entity it overwrites. */
68 ent_value_edge = 0x14, /**< An edge from an entity to its value entity. */
69 ent_corr_edge = 0x15, /**< An edge from an entity to the member entity its initializes. */
71 meth_par_edge = 0x21, /**< An edge from a method type to one of its parameter types. */
72 meth_res_edge = 0x22, /**< An edge from a method type to one of its result types. */
73 type_super_edge = 0x23, /**< An edge from a class type to its super/basis type. */
74 union_edge = 0x24, /**< An edge from a union type to its member types. */
75 ptr_pts_to_edge = 0x25, /**< An edge from a pointer type to its points-to type. */
76 arr_elt_type_edge = 0x26, /**< An edge from an array type to its element type. */
77 arr_ent_edge = 0x27, /**< An edge from a array type to its element entity. */
78 type_member_edge = 0x28, /**< An edge from a compound type to its member entities. */
80 /* additional flags */
81 intra_edge = 0, /**< Intra edge flag: edge do not cross basic block boundaries */
82 inter_edge = 0x40, /**< Inter edge flag: edge cross basic block boundaries */
83 back_edge = 0x80 /**< Backwards edge flag. */
86 /* Attributes of nodes */
87 #define PRINT_DEFAULT_NODE_ATTR
88 #define DEFAULT_NODE_ATTR " "
89 #define DEFAULT_TYPE_ATTRIBUTE " "
90 #define DEFAULT_ENUM_ITEM_ATTRIBUTE " "
92 /* Attributes of edges between Firm nodes */
93 #define INTRA_DATA_EDGE_ATTR "class:1 priority:50"
94 #define INTER_DATA_EDGE_ATTR "class:16 priority:10"
95 #define BLOCK_EDGE_ATTR "class:2 priority:50 linestyle:dotted"
96 #define CF_EDGE_ATTR "class:13 priority:60 color:red"
97 #define EXC_CF_EDGE_ATTR "class:18 priority:60 color:blue"
98 #define INTRA_MEM_EDGE_ATTR "class:14 priority:50 color:blue"
99 #define INTER_MEM_EDGE_ATTR "class:17 priority:10 color:blue"
100 #define DOMINATOR_EDGE_ATTR "class:15 color:red"
101 #define POSTDOMINATOR_EDGE_ATTR "class:19 color:red linestyle:dotted"
102 #define KEEP_ALIVE_EDGE_ATTR "class:20 priority:10 color:purple"
103 #define KEEP_ALIVE_CF_EDGE_ATTR "class:20 priority:60 color:purple"
104 #define KEEP_ALIVE_DF_EDGE_ATTR "class:20 priority:10 color:purple"
105 #define ANCHOR_EDGE_ATTR "class:20 priority:60 color:purple linestyle:dotted"
106 #define OUT_EDGE_ATTR "class:21 priority:10 color:gold linestyle:dashed"
108 #define BACK_EDGE_ATTR "linestyle:dashed "
110 /* Attributes of edges between Firm nodes and type/entity nodes */
111 #define NODE2TYPE_EDGE_ATTR "class:2 priority:2 linestyle:dotted"
113 /* Attributes of edges in type/entity graphs. */
114 #define TYPE_METH_NODE_ATTR "color: lightyellow"
115 #define TYPE_CLASS_NODE_ATTR "color: green"
116 #define TYPE_DESCRIPTION_NODE_ATTR "color: lightgreen"
117 #define ENTITY_NODE_ATTR "color: yellow"
118 #define ENUM_ITEM_NODE_ATTR "color: green"
119 #define ENT_TYPE_EDGE_ATTR "class: 3 label: \"type\" color: red"
120 #define ENT_OWN_EDGE_ATTR "class: 4 label: \"owner\" color: black"
121 #define METH_PAR_EDGE_ATTR "class: 5 label: \"param %d\" color: green"
122 #define METH_RES_EDGE_ATTR "class: 6 label: \"res %d\" color: green"
123 #define TYPE_SUPER_EDGE_ATTR "class: 7 label: \"supertype\" color: red"
124 #define UNION_EDGE_ATTR "class: 8 label: \"component\" color: blue"
125 #define PTR_PTS_TO_EDGE_ATTR "class: 9 label: \"points to\" color:green"
126 #define ARR_ELT_TYPE_EDGE_ATTR "class: 10 label: \"arr elt tp\" color:green"
127 #define ARR_ENT_EDGE_ATTR "class: 10 label: \"arr ent\" color: green"
128 #define ENT_OVERWRITES_EDGE_ATTR "class: 11 label: \"overwrites\" color:red"
129 #define ENT_VALUE_EDGE_ATTR "label: \"value %d\""
130 #define ENT_CORR_EDGE_ATTR "label: \"value %d corresponds to \" "
131 #define TYPE_MEMBER_EDGE_ATTR "class: 12 label: \"member\" color:blue"
132 /* #define CALLGRAPH_EDGE_ATTR "calls" */
134 #define PRINT_NODEID(X) fprintf(F, "n%ld", get_irn_node_nr(X))
135 #define PRINT_TYPEID(X) fprintf(F, "\"t%ld\"", get_type_nr(X))
136 #define PRINT_ENTID(X) fprintf(F, "e%ld", get_entity_nr(X))
137 #define PRINT_IRGID(X) fprintf(F, "g%ld", get_irg_graph_nr(X))
138 #define PRINT_CONSTID(X,Y) fprintf(F, "\"n%ldn%ld\"", get_irn_node_nr(X),get_irn_node_nr(Y))
139 #define PRINT_CONSTBLKID(X,Y) fprintf(F, "n%ldb%ld", get_irn_node_nr(X),get_irn_node_nr(Y))
140 #define PRINT_LOOPID(X) fprintf(F, "l%ld", get_loop_loop_nr(X))
141 #define PRINT_ITEMID(X,Y) fprintf(F, "i%ldT%d", get_type_nr(X), (Y))
142 #define PRINT_EXTBBID(X) fprintf(F, "x%ld", get_irn_node_nr(X))
144 void dump_vcg_header(FILE *out, const char *name, const char *layout, const char *orientation);
145 void dump_vcg_footer(FILE *out);
146 const char *get_irg_dump_name(const ir_graph *irg);
148 const char *get_ent_dump_name(const ir_entity *ent);
151 * returns the name of a mode or "<ERROR>" if mode is NOT a mode object.
152 * in the later case, sets bad.
154 const char *get_mode_name_ex(const ir_mode *mode, int *bad);
155 /** dump the name of a node n to the File F. */
156 void dump_node_opcode(FILE *out, ir_node *n);
158 void dump_node_label(FILE *out, ir_node *n);
160 void dump_vrp_info(FILE *out, ir_node *n);
162 /** Writes vcg representation with title "PRINT_TYPEID(tp)" to file F. */
163 void dump_type_node(FILE *out, ir_type *tp);