ba2d53d31d085610f95a451bba68860ce8e96c51
[libfirm] / ir / ir / irdump_t.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief   Private header for irdump
23  * @version $Id$
24  */
25 #ifndef FIRM_IR_IRDUMPT_T_H
26 #define FIRM_IR_IRDUMPT_T_H
27
28 #include "irdump.h"
29 #include "irgraph_t.h"
30
31 /* Attributes of nodes */
32 #define PRINT_DEFAULT_NODE_ATTR
33 #define DEFAULT_NODE_ATTR " "
34 #define DEFAULT_TYPE_ATTRIBUTE " "
35 #define DEFAULT_ENUM_ITEM_ATTRIBUTE " "
36
37 /* Attributes of edges between Firm nodes */
38 #define INTRA_DATA_EDGE_ATTR     "class:1  priority:50"
39 #define INTER_DATA_EDGE_ATTR     "class:16 priority:10"
40 #define BLOCK_EDGE_ATTR          "class:2  priority:50 linestyle:dotted"
41 #define CF_EDGE_ATTR             "class:13 priority:60 color:red"
42 #define EXC_CF_EDGE_ATTR         "class:18 priority:60 color:blue"
43 #define INTRA_MEM_EDGE_ATTR      "class:14 priority:50 color:blue"
44 #define INTER_MEM_EDGE_ATTR      "class:17 priority:10 color:blue"
45 #define DOMINATOR_EDGE_ATTR      "class:15 color:red"
46 #define POSTDOMINATOR_EDGE_ATTR  "class:19 color:red linestyle:dotted"
47 #define KEEP_ALIVE_EDGE_ATTR     "class:20 priority:10 color:purple"
48 #define KEEP_ALIVE_CF_EDGE_ATTR  "class:20 priority:60 color:purple"
49 #define KEEP_ALIVE_DF_EDGE_ATTR  "class:20 priority:10 color:purple"
50 #define ANCHOR_EDGE_ATTR         "class:20 priority:60 color:purple linestyle:dotted"
51 #define OUT_EDGE_ATTR            "class:21 priority:10 color:gold linestyle:dashed"
52 #define MACROBLOCK_EDGE_ATTR     "class:22 priority:10 color:green linestyle:dashed"
53
54 #define BACK_EDGE_ATTR "linestyle:dashed "
55
56 /* Attributes of edges between Firm nodes and type/entity nodes */
57 #define NODE2TYPE_EDGE_ATTR "class:2 priority:2 linestyle:dotted"
58
59 /* Attributes of edges in type/entity graphs. */
60 #define TYPE_METH_NODE_ATTR      "color: lightyellow"
61 #define TYPE_CLASS_NODE_ATTR     "color: green"
62 #define TYPE_DESCRIPTION_NODE_ATTR "color: lightgreen"
63 #define ENTITY_NODE_ATTR         "color: yellow"
64 #define ENUM_ITEM_NODE_ATTR      "color: green"
65 #define ENT_TYPE_EDGE_ATTR       "class: 3 label: \"type\" color: red"
66 #define ENT_OWN_EDGE_ATTR        "class: 4 label: \"owner\" color: black"
67 #define METH_PAR_EDGE_ATTR       "class: 5 label: \"param %d\" color: green"
68 #define METH_RES_EDGE_ATTR       "class: 6 label: \"res %d\" color: green"
69 #define TYPE_SUPER_EDGE_ATTR     "class: 7 label: \"supertype\" color: red"
70 #define UNION_EDGE_ATTR          "class: 8 label: \"component\" color: blue"
71 #define PTR_PTS_TO_EDGE_ATTR     "class: 9 label: \"points to\" color:green"
72 #define ARR_ELT_TYPE_EDGE_ATTR   "class: 10 label: \"arr elt tp\" color:green"
73 #define ARR_ENT_EDGE_ATTR        "class: 10 label: \"arr ent\" color: green"
74 #define ENT_OVERWRITES_EDGE_ATTR "class: 11 label: \"overwrites\" color:red"
75 #define ENT_VALUE_EDGE_ATTR      "label: \"value %d\""
76 #define ENT_CORR_EDGE_ATTR       "label: \"value %d corresponds to \" "
77 #define TYPE_MEMBER_EDGE_ATTR    "class: 12 label: \"member\" color:blue"
78 /* #define CALLGRAPH_EDGE_ATTR      "calls" */
79
80 #define PRINT_NODEID(X)       fprintf(F, "n%ld", get_irn_node_nr(X))
81 #define PRINT_TYPEID(X)       fprintf(F, "\"t%ld\"", get_type_nr(X))
82 #define PRINT_ENTID(X)        fprintf(F, "e%ld", get_entity_nr(X))
83 #define PRINT_IRGID(X)        fprintf(F, "g%ld", get_irg_graph_nr(X))
84 #define PRINT_CONSTID(X,Y)    fprintf(F, "\"n%ldn%ld\"", get_irn_node_nr(X),get_irn_node_nr(Y))
85 #define PRINT_CONSTBLKID(X,Y) fprintf(F, "n%ldb%ld", get_irn_node_nr(X),get_irn_node_nr(Y))
86 #define PRINT_LOOPID(X)       fprintf(F, "l%d", get_loop_loop_nr(X))
87 #define PRINT_ITEMID(X,Y)     fprintf(F, "i%ldT%d", get_type_nr(X), (Y))
88 #define PRINT_EXTBBID(X)      fprintf(F, "x%ld", get_irn_node_nr(X))
89
90 extern int dump_dominator_information_flag;
91 extern int opt_dump_pointer_values_to_info;
92 extern int opt_dump_analysed_type_info;
93
94 FILE *vcg_open (ir_graph *irg, const char * suffix1, const char *suffix2);
95 FILE *vcg_open_name (const char *name, const char *suffix);
96 void dump_vcg_header(FILE *F, const char *name, const char *orientation);
97 void dump_vcg_footer(FILE *F);
98 const char *get_irg_dump_name(ir_graph *irg);
99
100
101 const char *get_ent_dump_name(ir_entity *ent);
102 const char *get_type_name_ex(ir_type *tp, int *bad);
103 const char *get_mode_name_ex(ir_mode *mode, int *bad);
104 /**
105  * dump the name of a node n to the File F.
106  */
107 int
108 dump_node_opcode(FILE *F, ir_node *n);
109
110 int dump_node_label(FILE *F, ir_node *n);
111
112
113 /** Writes vcg representation with title "PRINT_TYPEID(tp)" to file F. */
114 int dump_type_node(FILE *F, ir_type *tp);
115
116 #endif /* FIRM_IR_IRDUMPT_T_H */