summaryrefslogtreecommitdiff
path: root/gcc/sel-sched-dump.h
blob: 70750f9cdcd22709e50e32e5a6e0f91c62d1fe4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/* Instruction scheduling pass.  Log dumping infrastructure.  
   Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */


#ifndef GCC_SEL_SCHED_DUMP_H
#define GCC_SEL_SCHED_DUMP_H

#include "sel-sched-ir.h"


/* These values control the dumping of control flow graph to the .dot file.  */
enum sel_dump_cfg_def
  {
    /* Dump only current region.  */
    SEL_DUMP_CFG_CURRENT_REGION = 2,

    /* Dump note_list for this bb.  */
    SEL_DUMP_CFG_BB_NOTES_LIST = 4,

    /* Dump availability set from the bb header.  */
    SEL_DUMP_CFG_AV_SET = 8,

    /* Dump liveness set from the bb header.  */
    SEL_DUMP_CFG_LV_SET = 16,

    /* Dump insns of the given block.  */
    SEL_DUMP_CFG_BB_INSNS = 32,

    /* Show current fences when dumping cfg.  */
    SEL_DUMP_CFG_FENCES = 64,

    /* Show insn's seqnos when dumping cfg.  */
    SEL_DUMP_CFG_INSN_SEQNO = 128,

    /* Dump function name when dumping cfg.  */
    SEL_DUMP_CFG_FUNCTION_NAME = 256,

    /* Dump loop father number of the given bb.  */
    SEL_DUMP_CFG_BB_LOOP = 512,

    /* The default flags for cfg dumping.  */
    SEL_DUMP_CFG_FLAGS = (SEL_DUMP_CFG_CURRENT_REGION   
                          | SEL_DUMP_CFG_BB_NOTES_LIST   
                          | SEL_DUMP_CFG_AV_SET         
                          | SEL_DUMP_CFG_LV_SET         
                          | SEL_DUMP_CFG_BB_INSNS       
                          | SEL_DUMP_CFG_FENCES         
                          | SEL_DUMP_CFG_INSN_SEQNO     
                          | SEL_DUMP_CFG_BB_LOOP)
  };

/* These values control the dumping of insns containing in expressions.  */
enum dump_insn_rtx_def
  {
    /* Dump insn's UID.  */
    DUMP_INSN_RTX_UID = 2,

    /* Dump insn's pattern.  */
    DUMP_INSN_RTX_PATTERN = 4,

    /* Dump insn's basic block number.  */
    DUMP_INSN_RTX_BBN = 8,

    /* Dump all of the above.  */
    DUMP_INSN_RTX_ALL = (DUMP_INSN_RTX_UID | DUMP_INSN_RTX_PATTERN
			 | DUMP_INSN_RTX_BBN)
  };

extern void dump_insn_rtx_1 (rtx, int);
extern void dump_insn_rtx (rtx);
extern void debug_insn_rtx (rtx);

/* These values control dumping of vinsns.  The meaning of different fields
   of a vinsn is explained in sel-sched-ir.h.  */
enum dump_vinsn_def
  {
    /* Dump the insn behind this vinsn.  */
    DUMP_VINSN_INSN_RTX = 2,

    /* Dump vinsn's type.  */
    DUMP_VINSN_TYPE = 4,

    /* Dump vinsn's count.  */
    DUMP_VINSN_COUNT = 8,

    /* Dump the cost (default latency) of the insn behind this vinsn.  */
    DUMP_VINSN_COST = 16,

    /* Dump all of the above.  */
    DUMP_VINSN_ALL = (DUMP_VINSN_INSN_RTX | DUMP_VINSN_TYPE | DUMP_VINSN_COUNT
		      | DUMP_VINSN_COST)
  };

extern void dump_vinsn_1 (vinsn_t, int);
extern void dump_vinsn (vinsn_t);
extern void debug_vinsn (vinsn_t);

/* These values control dumping of expressions.  The meaning of the fields
   is explained in sel-sched-ir.h.  */
enum dump_expr_def
  {
    /* Dump the vinsn behind this expression.  */
    DUMP_EXPR_VINSN = 2,
    
    /* Dump expression's SPEC parameter.  */
    DUMP_EXPR_SPEC = 4,

    /* Dump expression's priority.  */
    DUMP_EXPR_PRIORITY = 8,

    /* Dump the number of times this expression was scheduled.  */
    DUMP_EXPR_SCHED_TIMES = 16,

    /* Dump speculative status of the expression.  */
    DUMP_EXPR_SPEC_DONE_DS = 32,

    /* Dump the basic block number which originated this expression.  */
    DUMP_EXPR_ORIG_BB = 64,

    /* Dump expression's usefulness.  */
    DUMP_EXPR_USEFULNESS = 128,

    /* Dump all of the above.  */
    DUMP_EXPR_ALL = (DUMP_EXPR_VINSN | DUMP_EXPR_SPEC | DUMP_EXPR_PRIORITY
		     | DUMP_EXPR_SCHED_TIMES | DUMP_EXPR_SPEC_DONE_DS
		     | DUMP_EXPR_ORIG_BB | DUMP_EXPR_USEFULNESS)
  };

extern void dump_expr_1 (expr_t, int);
extern void dump_expr (expr_t);
extern void debug_expr (expr_t);

/* A enumeration for dumping flags of an insn.  The difference from 
   dump_insn_rtx_def is that these fields are for insns in stream only.  */
enum dump_insn_def
{
  /* Dump expression of this insn.  */
  DUMP_INSN_EXPR = 2,

  /* Dump insn's seqno.  */
  DUMP_INSN_SEQNO = 4,

  /* Dump the cycle on which insn was scheduled.  */
  DUMP_INSN_SCHED_CYCLE = 8,

  /* Dump insn's UID.  */
  DUMP_INSN_UID = 16,

  /* Dump insn's pattern.  */
  DUMP_INSN_PATTERN = 32,

  /* Dump insn's basic block number.  */
  DUMP_INSN_BBN = 64,

  /* Dump all of the above.  */
  DUMP_INSN_ALL = (DUMP_INSN_EXPR | DUMP_INSN_SEQNO | DUMP_INSN_BBN
		   | DUMP_INSN_SCHED_CYCLE | DUMP_INSN_UID | DUMP_INSN_PATTERN)
};

extern void dump_insn_1 (insn_t, int);
extern void dump_insn (insn_t);
extern void debug_insn (insn_t);

extern void sel_prepare_string_for_dot_label (char *);

/* When this flag is on, we are dumping to the .dot file.
   When it is off, we are dumping to log.  */
extern bool sched_dump_to_dot_p;

/* This macro acts like printf but dumps information to the .dot file.  
   Used when dumping control flow.  */
#define sel_print_to_dot(...)                           \
  do {                                                  \
    int __j = 1 + 2 * snprintf (NULL, 0, __VA_ARGS__);  \
    char *__s = XALLOCAVEC (char, __j);                 \
    snprintf (__s, __j, __VA_ARGS__);                   \
    sel_prepare_string_for_dot_label (__s);             \
    fprintf (sched_dump, "%s", __s);                    \
  } while (0)

/* This macro acts like printf but dumps to the sched_dump file.  */
#define sel_print(...)					\
  do {							\
    if (sched_dump_to_dot_p)                            \
      sel_print_to_dot (__VA_ARGS__);                   \
    else                                                \
      fprintf (sched_dump, __VA_ARGS__);                \
  } while (0)


/* Functions from sel-sched-dump.c.  */
extern const char * sel_print_insn (const_rtx, int);
extern void free_sel_dump_data (void);

extern void block_start (void);
extern void block_finish (void);
extern int get_print_blocks_num (void);
extern void line_start (void);
extern void line_finish (void);

extern void sel_print_rtl (rtx x);
extern void dump_insn_1 (insn_t, int);
extern void dump_insn (insn_t);
extern void dump_insn_vector (rtx_vec_t);
extern void dump_expr (expr_t);
extern void dump_used_regs (bitmap);
extern void dump_av_set (av_set_t);
extern void dump_lv_set (regset);
extern void dump_blist (blist_t);
extern void dump_flist (flist_t);
extern void dump_hard_reg_set (const char *, HARD_REG_SET);
extern void sel_debug_cfg_1 (int);
extern void sel_debug_cfg (void);
extern void setup_dump_cfg_params (void);

/* Debug functions.  */
extern void debug_expr (expr_t);
extern void debug_av_set (av_set_t);
extern void debug_lv_set (regset);
extern void debug_ilist (ilist_t);
extern void debug_blist (blist_t);
extern void debug_insn_vector (rtx_vec_t);
extern void debug_hard_reg_set (HARD_REG_SET);
extern rtx debug_mem_addr_value (rtx);
#endif