1/* Instruction scheduling pass.  Log dumping infrastructure.
2   Copyright (C) 2006-2015 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3.  If not see
18<http://www.gnu.org/licenses/>.  */
19
20
21#ifndef GCC_SEL_SCHED_DUMP_H
22#define GCC_SEL_SCHED_DUMP_H
23
24#include "sel-sched-ir.h"
25
26
27/* These values control the dumping of control flow graph to the .dot file.  */
28enum sel_dump_cfg_def
29  {
30    /* Dump only current region.  */
31    SEL_DUMP_CFG_CURRENT_REGION = 2,
32
33    /* Dump note_list for this bb.  */
34    SEL_DUMP_CFG_BB_NOTES_LIST = 4,
35
36    /* Dump availability set from the bb header.  */
37    SEL_DUMP_CFG_AV_SET = 8,
38
39    /* Dump liveness set from the bb header.  */
40    SEL_DUMP_CFG_LV_SET = 16,
41
42    /* Dump insns of the given block.  */
43    SEL_DUMP_CFG_BB_INSNS = 32,
44
45    /* Show current fences when dumping cfg.  */
46    SEL_DUMP_CFG_FENCES = 64,
47
48    /* Show insn's seqnos when dumping cfg.  */
49    SEL_DUMP_CFG_INSN_SEQNO = 128,
50
51    /* Dump function name when dumping cfg.  */
52    SEL_DUMP_CFG_FUNCTION_NAME = 256,
53
54    /* Dump loop father number of the given bb.  */
55    SEL_DUMP_CFG_BB_LOOP = 512,
56
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)
66  };
67
68/* These values control the dumping of insns containing in expressions.  */
69enum dump_insn_rtx_def
70  {
71    /* Dump insn's UID.  */
72    DUMP_INSN_RTX_UID = 2,
73
74    /* Dump insn's pattern.  */
75    DUMP_INSN_RTX_PATTERN = 4,
76
77    /* Dump insn's basic block number.  */
78    DUMP_INSN_RTX_BBN = 8,
79
80    /* Dump all of the above.  */
81    DUMP_INSN_RTX_ALL = (DUMP_INSN_RTX_UID | DUMP_INSN_RTX_PATTERN
82			 | DUMP_INSN_RTX_BBN)
83  };
84
85extern void dump_insn_rtx_1 (rtx, int);
86extern void dump_insn_rtx (rtx);
87extern void debug_insn_rtx (rtx);
88
89/* These values control dumping of vinsns.  The meaning of different fields
90   of a vinsn is explained in sel-sched-ir.h.  */
91enum dump_vinsn_def
92  {
93    /* Dump the insn behind this vinsn.  */
94    DUMP_VINSN_INSN_RTX = 2,
95
96    /* Dump vinsn's type.  */
97    DUMP_VINSN_TYPE = 4,
98
99    /* Dump vinsn's count.  */
100    DUMP_VINSN_COUNT = 8,
101
102    /* Dump the cost (default latency) of the insn behind this vinsn.  */
103    DUMP_VINSN_COST = 16,
104
105    /* Dump all of the above.  */
106    DUMP_VINSN_ALL = (DUMP_VINSN_INSN_RTX | DUMP_VINSN_TYPE | DUMP_VINSN_COUNT
107		      | DUMP_VINSN_COST)
108  };
109
110extern void dump_vinsn_1 (vinsn_t, int);
111extern void dump_vinsn (vinsn_t);
112extern void debug_vinsn (vinsn_t);
113
114extern void debug (vinsn_def &ref);
115extern void debug (vinsn_def *ptr);
116extern void debug_verbose (vinsn_def &ref);
117extern void debug_verbose (vinsn_def *ptr);
118
119
120/* These values control dumping of expressions.  The meaning of the fields
121   is explained in sel-sched-ir.h.  */
122enum dump_expr_def
123  {
124    /* Dump the vinsn behind this expression.  */
125    DUMP_EXPR_VINSN = 2,
126
127    /* Dump expression's SPEC parameter.  */
128    DUMP_EXPR_SPEC = 4,
129
130    /* Dump expression's priority.  */
131    DUMP_EXPR_PRIORITY = 8,
132
133    /* Dump the number of times this expression was scheduled.  */
134    DUMP_EXPR_SCHED_TIMES = 16,
135
136    /* Dump speculative status of the expression.  */
137    DUMP_EXPR_SPEC_DONE_DS = 32,
138
139    /* Dump the basic block number which originated this expression.  */
140    DUMP_EXPR_ORIG_BB = 64,
141
142    /* Dump expression's usefulness.  */
143    DUMP_EXPR_USEFULNESS = 128,
144
145    /* Dump all of the above.  */
146    DUMP_EXPR_ALL = (DUMP_EXPR_VINSN | DUMP_EXPR_SPEC | DUMP_EXPR_PRIORITY
147		     | DUMP_EXPR_SCHED_TIMES | DUMP_EXPR_SPEC_DONE_DS
148		     | DUMP_EXPR_ORIG_BB | DUMP_EXPR_USEFULNESS)
149  };
150
151extern void dump_expr_1 (expr_t, int);
152extern void dump_expr (expr_t);
153extern void debug_expr (expr_t);
154
155extern void debug (expr_def &ref);
156extern void debug (expr_def *ptr);
157extern void debug_verbose (expr_def &ref);
158extern void debug_verbose (expr_def *ptr);
159
160
161/* A enumeration for dumping flags of an insn.  The difference from
162   dump_insn_rtx_def is that these fields are for insns in stream only.  */
163enum dump_insn_def
164{
165  /* Dump expression of this insn.  */
166  DUMP_INSN_EXPR = 2,
167
168  /* Dump insn's seqno.  */
169  DUMP_INSN_SEQNO = 4,
170
171  /* Dump the cycle on which insn was scheduled.  */
172  DUMP_INSN_SCHED_CYCLE = 8,
173
174  /* Dump insn's UID.  */
175  DUMP_INSN_UID = 16,
176
177  /* Dump insn's pattern.  */
178  DUMP_INSN_PATTERN = 32,
179
180  /* Dump insn's basic block number.  */
181  DUMP_INSN_BBN = 64,
182
183  /* Dump all of the above.  */
184  DUMP_INSN_ALL = (DUMP_INSN_EXPR | DUMP_INSN_SEQNO | DUMP_INSN_BBN
185		   | DUMP_INSN_SCHED_CYCLE | DUMP_INSN_UID | DUMP_INSN_PATTERN)
186};
187
188extern void dump_insn_1 (insn_t, int);
189extern void dump_insn (insn_t);
190extern void debug_insn (insn_t);
191
192/* When this flag is on, we are dumping to the .dot file.
193   When it is off, we are dumping to log.  */
194extern bool sched_dump_to_dot_p;
195
196
197/* Functions from sel-sched-dump.c.  */
198extern void sel_print (const char *fmt, ...) ATTRIBUTE_PRINTF_1;
199extern const char * sel_print_insn (const rtx_insn *, int);
200extern void free_sel_dump_data (void);
201
202extern void block_start (void);
203extern void block_finish (void);
204extern int get_print_blocks_num (void);
205extern void line_start (void);
206extern void line_finish (void);
207
208extern void sel_print_rtl (rtx x);
209extern void dump_insn_1 (insn_t, int);
210extern void dump_insn (insn_t);
211extern void dump_insn_vector (rtx_vec_t);
212extern void dump_expr (expr_t);
213extern void dump_used_regs (bitmap);
214extern void dump_av_set (av_set_t);
215extern void dump_lv_set (regset);
216extern void dump_blist (blist_t);
217extern void dump_flist (flist_t);
218extern void dump_hard_reg_set (const char *, HARD_REG_SET);
219extern void sel_debug_cfg_1 (int);
220extern void sel_debug_cfg (void);
221extern void setup_dump_cfg_params (void);
222
223/* Debug functions.  */
224extern void debug_expr (expr_t);
225extern void debug_av_set (av_set_t);
226extern void debug_lv_set (regset);
227extern void debug_ilist (ilist_t);
228extern void debug_blist (blist_t);
229extern void debug (vec<rtx> &ref);
230extern void debug (vec<rtx> *ptr);
231extern void debug_insn_vector (rtx_vec_t);
232extern void debug_hard_reg_set (HARD_REG_SET);
233extern rtx debug_mem_addr_value (rtx);
234#endif
235