2008-12-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[official-gcc.git] / gcc / sel-sched-dump.h
blob70750f9cdcd22709e50e32e5a6e0f91c62d1fe4b
1 /* Instruction scheduling pass. Log dumping infrastructure.
2 Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
21 #ifndef GCC_SEL_SCHED_DUMP_H
22 #define GCC_SEL_SCHED_DUMP_H
24 #include "sel-sched-ir.h"
27 /* These values control the dumping of control flow graph to the .dot file. */
28 enum sel_dump_cfg_def
30 /* Dump only current region. */
31 SEL_DUMP_CFG_CURRENT_REGION = 2,
33 /* Dump note_list for this bb. */
34 SEL_DUMP_CFG_BB_NOTES_LIST = 4,
36 /* Dump availability set from the bb header. */
37 SEL_DUMP_CFG_AV_SET = 8,
39 /* Dump liveness set from the bb header. */
40 SEL_DUMP_CFG_LV_SET = 16,
42 /* Dump insns of the given block. */
43 SEL_DUMP_CFG_BB_INSNS = 32,
45 /* Show current fences when dumping cfg. */
46 SEL_DUMP_CFG_FENCES = 64,
48 /* Show insn's seqnos when dumping cfg. */
49 SEL_DUMP_CFG_INSN_SEQNO = 128,
51 /* Dump function name when dumping cfg. */
52 SEL_DUMP_CFG_FUNCTION_NAME = 256,
54 /* Dump loop father number of the given bb. */
55 SEL_DUMP_CFG_BB_LOOP = 512,
57 /* The default flags for cfg dumping. */
58 SEL_DUMP_CFG_FLAGS = (SEL_DUMP_CFG_CURRENT_REGION
59 | SEL_DUMP_CFG_BB_NOTES_LIST
60 | SEL_DUMP_CFG_AV_SET
61 | SEL_DUMP_CFG_LV_SET
62 | SEL_DUMP_CFG_BB_INSNS
63 | SEL_DUMP_CFG_FENCES
64 | SEL_DUMP_CFG_INSN_SEQNO
65 | SEL_DUMP_CFG_BB_LOOP)
68 /* These values control the dumping of insns containing in expressions. */
69 enum dump_insn_rtx_def
71 /* Dump insn's UID. */
72 DUMP_INSN_RTX_UID = 2,
74 /* Dump insn's pattern. */
75 DUMP_INSN_RTX_PATTERN = 4,
77 /* Dump insn's basic block number. */
78 DUMP_INSN_RTX_BBN = 8,
80 /* Dump all of the above. */
81 DUMP_INSN_RTX_ALL = (DUMP_INSN_RTX_UID | DUMP_INSN_RTX_PATTERN
82 | DUMP_INSN_RTX_BBN)
85 extern void dump_insn_rtx_1 (rtx, int);
86 extern void dump_insn_rtx (rtx);
87 extern void debug_insn_rtx (rtx);
89 /* These values control dumping of vinsns. The meaning of different fields
90 of a vinsn is explained in sel-sched-ir.h. */
91 enum dump_vinsn_def
93 /* Dump the insn behind this vinsn. */
94 DUMP_VINSN_INSN_RTX = 2,
96 /* Dump vinsn's type. */
97 DUMP_VINSN_TYPE = 4,
99 /* Dump vinsn's count. */
100 DUMP_VINSN_COUNT = 8,
102 /* Dump the cost (default latency) of the insn behind this vinsn. */
103 DUMP_VINSN_COST = 16,
105 /* Dump all of the above. */
106 DUMP_VINSN_ALL = (DUMP_VINSN_INSN_RTX | DUMP_VINSN_TYPE | DUMP_VINSN_COUNT
107 | DUMP_VINSN_COST)
110 extern void dump_vinsn_1 (vinsn_t, int);
111 extern void dump_vinsn (vinsn_t);
112 extern void debug_vinsn (vinsn_t);
114 /* These values control dumping of expressions. The meaning of the fields
115 is explained in sel-sched-ir.h. */
116 enum dump_expr_def
118 /* Dump the vinsn behind this expression. */
119 DUMP_EXPR_VINSN = 2,
121 /* Dump expression's SPEC parameter. */
122 DUMP_EXPR_SPEC = 4,
124 /* Dump expression's priority. */
125 DUMP_EXPR_PRIORITY = 8,
127 /* Dump the number of times this expression was scheduled. */
128 DUMP_EXPR_SCHED_TIMES = 16,
130 /* Dump speculative status of the expression. */
131 DUMP_EXPR_SPEC_DONE_DS = 32,
133 /* Dump the basic block number which originated this expression. */
134 DUMP_EXPR_ORIG_BB = 64,
136 /* Dump expression's usefulness. */
137 DUMP_EXPR_USEFULNESS = 128,
139 /* Dump all of the above. */
140 DUMP_EXPR_ALL = (DUMP_EXPR_VINSN | DUMP_EXPR_SPEC | DUMP_EXPR_PRIORITY
141 | DUMP_EXPR_SCHED_TIMES | DUMP_EXPR_SPEC_DONE_DS
142 | DUMP_EXPR_ORIG_BB | DUMP_EXPR_USEFULNESS)
145 extern void dump_expr_1 (expr_t, int);
146 extern void dump_expr (expr_t);
147 extern void debug_expr (expr_t);
149 /* A enumeration for dumping flags of an insn. The difference from
150 dump_insn_rtx_def is that these fields are for insns in stream only. */
151 enum dump_insn_def
153 /* Dump expression of this insn. */
154 DUMP_INSN_EXPR = 2,
156 /* Dump insn's seqno. */
157 DUMP_INSN_SEQNO = 4,
159 /* Dump the cycle on which insn was scheduled. */
160 DUMP_INSN_SCHED_CYCLE = 8,
162 /* Dump insn's UID. */
163 DUMP_INSN_UID = 16,
165 /* Dump insn's pattern. */
166 DUMP_INSN_PATTERN = 32,
168 /* Dump insn's basic block number. */
169 DUMP_INSN_BBN = 64,
171 /* Dump all of the above. */
172 DUMP_INSN_ALL = (DUMP_INSN_EXPR | DUMP_INSN_SEQNO | DUMP_INSN_BBN
173 | DUMP_INSN_SCHED_CYCLE | DUMP_INSN_UID | DUMP_INSN_PATTERN)
176 extern void dump_insn_1 (insn_t, int);
177 extern void dump_insn (insn_t);
178 extern void debug_insn (insn_t);
180 extern void sel_prepare_string_for_dot_label (char *);
182 /* When this flag is on, we are dumping to the .dot file.
183 When it is off, we are dumping to log. */
184 extern bool sched_dump_to_dot_p;
186 /* This macro acts like printf but dumps information to the .dot file.
187 Used when dumping control flow. */
188 #define sel_print_to_dot(...) \
189 do { \
190 int __j = 1 + 2 * snprintf (NULL, 0, __VA_ARGS__); \
191 char *__s = XALLOCAVEC (char, __j); \
192 snprintf (__s, __j, __VA_ARGS__); \
193 sel_prepare_string_for_dot_label (__s); \
194 fprintf (sched_dump, "%s", __s); \
195 } while (0)
197 /* This macro acts like printf but dumps to the sched_dump file. */
198 #define sel_print(...) \
199 do { \
200 if (sched_dump_to_dot_p) \
201 sel_print_to_dot (__VA_ARGS__); \
202 else \
203 fprintf (sched_dump, __VA_ARGS__); \
204 } while (0)
207 /* Functions from sel-sched-dump.c. */
208 extern const char * sel_print_insn (const_rtx, int);
209 extern void free_sel_dump_data (void);
211 extern void block_start (void);
212 extern void block_finish (void);
213 extern int get_print_blocks_num (void);
214 extern void line_start (void);
215 extern void line_finish (void);
217 extern void sel_print_rtl (rtx x);
218 extern void dump_insn_1 (insn_t, int);
219 extern void dump_insn (insn_t);
220 extern void dump_insn_vector (rtx_vec_t);
221 extern void dump_expr (expr_t);
222 extern void dump_used_regs (bitmap);
223 extern void dump_av_set (av_set_t);
224 extern void dump_lv_set (regset);
225 extern void dump_blist (blist_t);
226 extern void dump_flist (flist_t);
227 extern void dump_hard_reg_set (const char *, HARD_REG_SET);
228 extern void sel_debug_cfg_1 (int);
229 extern void sel_debug_cfg (void);
230 extern void setup_dump_cfg_params (void);
232 /* Debug functions. */
233 extern void debug_expr (expr_t);
234 extern void debug_av_set (av_set_t);
235 extern void debug_lv_set (regset);
236 extern void debug_ilist (ilist_t);
237 extern void debug_blist (blist_t);
238 extern void debug_insn_vector (rtx_vec_t);
239 extern void debug_hard_reg_set (HARD_REG_SET);
240 extern rtx debug_mem_addr_value (rtx);
241 #endif