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