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 {
35 ird_color_prog_background,
36 ird_color_block_background,
37 ird_color_dead_block_background,
38 ird_color_block_inout,
39 ird_color_default_node,
42 ird_color_controlflow,
46 ird_color_uses_memory,
56 data_edge = 0x01, /**< A data edge between two basic blocks. */
57 block_edge = 0x02, /**< An edge from a node to its basic block. */
58 cf_edge = 0x03, /**< A regularly control flow edge. */
59 exc_cf_edge = 0x04, /**< An exceptional control flow edge. */
60 mem_edge = 0x05, /**< A memory edge. */
61 dominator_edge = 0x06, /**< A dominator edge from a block to its immediate dominator. */
62 node2type_edge = 0x07, /**< An edge from an IR node to a type. */
64 ent_type_edge = 0x11, /**< An edge from an entity to its type. */
65 ent_own_edge = 0x12, /**< An edge from an entity to its owner type. */
66 ent_overwrites_edge = 0x13, /**< An edge from an entity to the entity it overwrites. */
67 ent_value_edge = 0x14, /**< An edge from an entity to its value entity. */
68 ent_corr_edge = 0x15, /**< An edge from an entity to the member entity its initializes. */
70 meth_par_edge = 0x21, /**< An edge from a method type to one of its parameter types. */
71 meth_res_edge = 0x22, /**< An edge from a method type to one of its result types. */
72 type_super_edge = 0x23, /**< An edge from a class type to its super/basis type. */
73 union_edge = 0x24, /**< An edge from a union type to its member types. */
74 ptr_pts_to_edge = 0x25, /**< An edge from a pointer type to its points-to type. */
75 arr_elt_type_edge = 0x26, /**< An edge from an array type to its element type. */
76 arr_ent_edge = 0x27, /**< An edge from a array type to its element entity. */
77 type_member_edge = 0x28, /**< An edge from a compound type to its member entities. */
79 /* additional flags */
80 intra_edge = 0, /**< Intra edge flag: edge do not cross basic block boundaries */
81 inter_edge = 0x40, /**< Inter edge flag: edge cross basic block boundaries */
82 back_edge = 0x80 /**< Backwards edge flag. */
85 /* Attributes of nodes */
86 #define PRINT_DEFAULT_NODE_ATTR
87 #define DEFAULT_NODE_ATTR " "
88 #define DEFAULT_TYPE_ATTRIBUTE " "
89 #define DEFAULT_ENUM_ITEM_ATTRIBUTE " "
91 /* Attributes of edges between Firm nodes */
92 #define INTRA_DATA_EDGE_ATTR "class:1 priority:50"
93 #define INTER_DATA_EDGE_ATTR "class:16 priority:10"
94 #define BLOCK_EDGE_ATTR "class:2 priority:50 linestyle:dotted"
95 #define CF_EDGE_ATTR "class:13 priority:60 color:red"
96 #define EXC_CF_EDGE_ATTR "class:18 priority:60 color:blue"
97 #define INTRA_MEM_EDGE_ATTR "class:14 priority:50 color:blue"
98 #define INTER_MEM_EDGE_ATTR "class:17 priority:10 color:blue"
99 #define DOMINATOR_EDGE_ATTR "class:15 color:red"
100 #define POSTDOMINATOR_EDGE_ATTR "class:19 color:red linestyle:dotted"
101 #define KEEP_ALIVE_EDGE_ATTR "class:20 priority:10 color:purple"
102 #define KEEP_ALIVE_CF_EDGE_ATTR "class:20 priority:60 color:purple"
103 #define KEEP_ALIVE_DF_EDGE_ATTR "class:20 priority:10 color:purple"
104 #define ANCHOR_EDGE_ATTR "class:20 priority:60 color:purple linestyle:dotted"
105 #define OUT_EDGE_ATTR "class:21 priority:10 color:gold linestyle:dashed"
106 #define MACROBLOCK_EDGE_ATTR "class:22 priority:10 color:green 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%d", 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 extern int dump_dominator_information_flag;
145 extern int opt_dump_pointer_values_to_info;
146 extern int opt_dump_analysed_type_info;
148 FILE *vcg_open(const ir_graph *irg, const char * suffix1, const char *suffix2);
149 FILE *vcg_open_name(const char *name, const char *suffix);
150 void dump_vcg_header(FILE *F, const char *name, const char *layout, const char *orientation);
151 void dump_vcg_footer(FILE *F);
152 const char *get_irg_dump_name(const ir_graph *irg);
155 const char *get_ent_dump_name(const ir_entity *ent);
156 const char *get_mode_name_ex(const ir_mode *mode, int *bad);
158 * dump the name of a node n to the File F.
160 int dump_node_opcode(FILE *F, ir_node *n);
162 int dump_node_label(FILE *F, ir_node *n);
164 int dump_vrp_info(FILE *F, ir_node *n);
166 /** Writes vcg representation with title "PRINT_TYPEID(tp)" to file F. */
167 int dump_type_node(FILE *F, ir_type *tp);
169 #endif /* FIRM_IR_IRDUMPT_T_H */