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