]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/dumpfile.h
Tweak directives in GCC tests for msp430-elf
[thirdparty/gcc.git] / gcc / dumpfile.h
CommitLineData
7ee2468b 1/* Definitions for the shared dumpfile.
85ec4feb 2 Copyright (C) 2004-2018 Free Software Foundation, Inc.
7ee2468b
SB
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 3, or (at your option)
9any later version.
10
11GCC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for 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_DUMPFILE_H
22#define GCC_DUMPFILE_H 1
23
4f5b9c80 24#include "profile-count.h"
78c60e3d 25
6f795a92
DM
26/* An attribute for annotating formatting printing functions that use
27 the dumpfile/optinfo formatting codes. These are the pretty_printer
28 format codes (see pretty-print.c), with additional codes for middle-end
29 specific entities (see dumpfile.c). */
30
19784080 31#if GCC_VERSION >= 9000
6f795a92
DM
32#define ATTRIBUTE_GCC_DUMP_PRINTF(m, n) \
33 __attribute__ ((__format__ (__gcc_dump_printf__, m ,n))) \
34 ATTRIBUTE_NONNULL(m)
35#else
36#define ATTRIBUTE_GCC_DUMP_PRINTF(m, n) ATTRIBUTE_NONNULL(m)
37#endif
38
7ee2468b 39/* Different tree dump places. When you add new tree dump places,
2b4e6bf1 40 extend the DUMP_FILES array in dumpfile.c. */
7ee2468b
SB
41enum tree_dump_index
42{
43 TDI_none, /* No dump */
0e0a19c5
NS
44 TDI_cgraph, /* dump function call graph. */
45 TDI_inheritance, /* dump type inheritance graph. */
0bdad123 46 TDI_clones, /* dump IPA cloning decisions. */
7ee2468b 47 TDI_original, /* dump each function before optimizing it */
363dc72c 48 TDI_gimple, /* dump each function after gimplifying it */
7ee2468b 49 TDI_nested, /* dump each function after unnesting it */
b4da704c 50 TDI_lto_stream_out, /* dump information about lto streaming */
a529e0a6
NS
51
52 TDI_lang_all, /* enable all the language dumps. */
0e0a19c5
NS
53 TDI_tree_all, /* enable all the GENERIC/GIMPLE dumps. */
54 TDI_rtl_all, /* enable all the RTL dumps. */
55 TDI_ipa_all, /* enable all the IPA dumps. */
7ee2468b
SB
56
57 TDI_end
58};
59
8264c84d
ML
60/* Enum used to distinguish dump files to types. */
61
62enum dump_kind
63{
64 DK_none,
65 DK_lang,
66 DK_tree,
67 DK_rtl,
286c97f3 68 DK_ipa
8264c84d
ML
69};
70
78c60e3d
SS
71/* Bit masks to control dumping. Not all values are applicable to all
72 dumps. Add new ones at the end. When you define new values, extend
2b4e6bf1
SS
73 the DUMP_OPTIONS array in dumpfile.c. The TDF_* flags coexist with
74 MSG_* flags (for -fopt-info) and the bit values must be chosen to
75 allow that. */
4af78ef8
DM
76enum dump_flag
77{
78 /* Value of TDF_NONE is used just for bits filtered by TDF_KIND_MASK. */
79 TDF_NONE = 0,
80
81 /* Dump node addresses. */
82 TDF_ADDRESS = (1 << 0),
83
84 /* Don't go wild following links. */
85 TDF_SLIM = (1 << 1),
86
87 /* Don't unparse the function. */
88 TDF_RAW = (1 << 2),
89
90 /* Show more detailed info about each pass. */
91 TDF_DETAILS = (1 << 3),
92
93 /* Dump various statistics about each pass. */
94 TDF_STATS = (1 << 4),
95
96 /* Display basic block boundaries. */
97 TDF_BLOCKS = (1 << 5),
98
99 /* Display virtual operands. */
100 TDF_VOPS = (1 << 6),
101
102 /* Display statement line numbers. */
103 TDF_LINENO = (1 << 7),
104
105 /* Display decl UIDs. */
106 TDF_UID = (1 << 8),
107
108 /* Address of stmt. */
109 TDF_STMTADDR = (1 << 9),
110
111 /* A graph dump is being emitted. */
112 TDF_GRAPH = (1 << 10),
113
114 /* Display memory symbols in expr.
115 Implies TDF_VOPS. */
116 TDF_MEMSYMS = (1 << 11),
117
118 /* A flag to only print the RHS of a gimple stmt. */
119 TDF_RHS_ONLY = (1 << 12),
120
121 /* Display asm names of decls. */
122 TDF_ASMNAME = (1 << 13),
123
124 /* Display EH region number holding this gimple statement. */
125 TDF_EH = (1 << 14),
126
127 /* Omit UIDs from dumps. */
128 TDF_NOUID = (1 << 15),
129
130 /* Display alias information. */
131 TDF_ALIAS = (1 << 16),
132
133 /* Enumerate locals by uid. */
134 TDF_ENUMERATE_LOCALS = (1 << 17),
135
136 /* Dump cselib details. */
137 TDF_CSELIB = (1 << 18),
138
139 /* Dump SCEV details. */
140 TDF_SCEV = (1 << 19),
141
142 /* Dump in GIMPLE FE syntax */
143 TDF_GIMPLE = (1 << 20),
144
145 /* Dump folding details. */
146 TDF_FOLDING = (1 << 21),
147
7db960c5
DM
148 /* MSG_* flags for expressing the kinds of message to
149 be emitted by -fopt-info. */
150
4af78ef8
DM
151 /* -fopt-info optimized sources. */
152 MSG_OPTIMIZED_LOCATIONS = (1 << 22),
153
154 /* Missed opportunities. */
155 MSG_MISSED_OPTIMIZATION = (1 << 23),
156
157 /* General optimization info. */
158 MSG_NOTE = (1 << 24),
159
7db960c5
DM
160 /* Mask for selecting MSG_-kind flags. */
161 MSG_ALL_KINDS = (MSG_OPTIMIZED_LOCATIONS
162 | MSG_MISSED_OPTIMIZATION
163 | MSG_NOTE),
164
165 /* MSG_PRIORITY_* flags for expressing the priority levels of message
166 to be emitted by -fopt-info, and filtering on them.
167 By default, messages at the top-level dump scope are "user-facing",
168 whereas those that are in nested scopes are implicitly "internals".
169 This behavior can be overridden for a given dump message by explicitly
170 specifying one of the MSG_PRIORITY_* flags.
171
172 By default, dump files show both kinds of message, whereas -fopt-info
173 only shows "user-facing" messages, and requires the "-internals"
174 sub-option of -fopt-info to show the internal messages. */
175
176 /* Implicitly supplied for messages at the top-level dump scope. */
177 MSG_PRIORITY_USER_FACING = (1 << 25),
178
179 /* Implicitly supplied for messages within nested dump scopes. */
180 MSG_PRIORITY_INTERNALS = (1 << 26),
181
f4ebbd24
DM
182 /* Supplied when an opt_problem generated in a nested scope is re-emitted
183 at the top-level. We want to default to showing these in -fopt-info
184 output, but to *not* show them in dump files, as the message would be
185 shown twice, messing up "scan-tree-dump-times" in DejaGnu tests. */
186 MSG_PRIORITY_REEMITTED = (1 << 27),
187
7db960c5
DM
188 /* Mask for selecting MSG_PRIORITY_* flags. */
189 MSG_ALL_PRIORITIES = (MSG_PRIORITY_USER_FACING
f4ebbd24
DM
190 | MSG_PRIORITY_INTERNALS
191 | MSG_PRIORITY_REEMITTED),
4af78ef8
DM
192
193 /* Dumping for -fcompare-debug. */
f4ebbd24 194 TDF_COMPARE_DEBUG = (1 << 28),
de6c8d7f
ML
195
196 /* All values. */
f4ebbd24 197 TDF_ALL_VALUES = (1 << 29) - 1
4af78ef8
DM
198};
199
200/* Dump flags type. */
201
202typedef enum dump_flag dump_flags_t;
203
204static inline dump_flags_t
205operator| (dump_flags_t lhs, dump_flags_t rhs)
206{
207 return (dump_flags_t)((int)lhs | (int)rhs);
208}
209
210static inline dump_flags_t
211operator& (dump_flags_t lhs, dump_flags_t rhs)
212{
213 return (dump_flags_t)((int)lhs & (int)rhs);
214}
215
216static inline dump_flags_t
217operator~ (dump_flags_t flags)
218{
219 return (dump_flags_t)~((int)flags);
220}
221
222static inline dump_flags_t &
223operator|= (dump_flags_t &lhs, dump_flags_t rhs)
224{
225 lhs = (dump_flags_t)((int)lhs | (int)rhs);
226 return lhs;
227}
228
229static inline dump_flags_t &
230operator&= (dump_flags_t &lhs, dump_flags_t rhs)
231{
232 lhs = (dump_flags_t)((int)lhs & (int)rhs);
233 return lhs;
234}
1a817418 235
2b4e6bf1
SS
236/* Flags to control high-level -fopt-info dumps. Usually these flags
237 define a group of passes. An optimization pass can be part of
238 multiple groups. */
2b4e6bf1 239
4af78ef8
DM
240enum optgroup_flag
241{
242 OPTGROUP_NONE = 0,
243
244 /* IPA optimization passes */
245 OPTGROUP_IPA = (1 << 1),
246
247 /* Loop optimization passes */
248 OPTGROUP_LOOP = (1 << 2),
249
250 /* Inlining passes */
251 OPTGROUP_INLINE = (1 << 3),
1a817418 252
4af78ef8
DM
253 /* OMP (Offloading and Multi Processing) transformations */
254 OPTGROUP_OMP = (1 << 4),
255
256 /* Vectorization passes */
257 OPTGROUP_VEC = (1 << 5),
258
259 /* All other passes */
260 OPTGROUP_OTHER = (1 << 6),
261
262 OPTGROUP_ALL = (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE
263 | OPTGROUP_OMP | OPTGROUP_VEC | OPTGROUP_OTHER)
264};
265
266typedef enum optgroup_flag optgroup_flags_t;
267
268static inline optgroup_flags_t
269operator| (optgroup_flags_t lhs, optgroup_flags_t rhs)
270{
271 return (optgroup_flags_t)((int)lhs | (int)rhs);
272}
273
274static inline optgroup_flags_t &
275operator|= (optgroup_flags_t &lhs, optgroup_flags_t rhs)
276{
277 lhs = (optgroup_flags_t)((int)lhs | (int)rhs);
278 return lhs;
279}
1a817418 280
78c60e3d
SS
281/* Define a tree dump switch. */
282struct dump_file_info
283{
8264c84d
ML
284 /* Suffix to give output file. */
285 const char *suffix;
286 /* Command line dump switch. */
287 const char *swtch;
288 /* Command line glob. */
289 const char *glob;
290 /* Filename for the pass-specific stream. */
291 const char *pfilename;
292 /* Filename for the -fopt-info stream. */
293 const char *alt_filename;
294 /* Pass-specific dump stream. */
295 FILE *pstream;
296 /* -fopt-info stream. */
297 FILE *alt_stream;
298 /* Dump kind. */
299 dump_kind dkind;
300 /* Dump flags. */
301 dump_flags_t pflags;
302 /* A pass flags for -fopt-info. */
4af78ef8 303 dump_flags_t alt_flags;
8264c84d 304 /* Flags for -fopt-info given by a user. */
4af78ef8 305 optgroup_flags_t optgroup_flags;
8264c84d
ML
306 /* State of pass-specific stream. */
307 int pstate;
308 /* State of the -fopt-info stream. */
309 int alt_state;
310 /* Dump file number. */
311 int num;
312 /* Fields "suffix", "swtch", "glob" can be const strings,
313 or can be dynamically allocated, needing free. */
314 bool owns_strings;
315 /* When a given dump file is being initialized, this flag is set to true
316 if the corresponding TDF_graph dump file has also been initialized. */
317 bool graph_dump_initialized;
78c60e3d 318};
7ee2468b 319
4f5b9c80
DM
320/* A class for describing where in the user's source that a dump message
321 relates to, with various constructors for convenience.
322 In particular, this lets us associate dump messages
323 with hotness information (e.g. from PGO), allowing them to
324 be prioritized by code hotness. */
325
326class dump_user_location_t
327{
328 public:
329 /* Default constructor, analogous to UNKNOWN_LOCATION. */
330 dump_user_location_t () : m_count (), m_loc (UNKNOWN_LOCATION) {}
331
332 /* Construct from a gimple statement (using its location and hotness). */
12c27c75 333 dump_user_location_t (const gimple *stmt);
4f5b9c80
DM
334
335 /* Construct from an RTL instruction (using its location and hotness). */
12c27c75 336 dump_user_location_t (const rtx_insn *insn);
4f5b9c80
DM
337
338 /* Construct from a location_t. This one is deprecated (since it doesn't
339 capture hotness information); it thus needs to be spelled out. */
340 static dump_user_location_t
341 from_location_t (location_t loc)
342 {
343 return dump_user_location_t (profile_count (), loc);
344 }
345
346 /* Construct from a function declaration. This one requires spelling out
347 to avoid accidentally constructing from other kinds of tree. */
348 static dump_user_location_t
349 from_function_decl (tree fndecl);
350
351 profile_count get_count () const { return m_count; }
352 location_t get_location_t () const { return m_loc; }
353
354 private:
355 /* Private ctor from count and location, for use by from_location_t. */
356 dump_user_location_t (profile_count count, location_t loc)
357 : m_count (count), m_loc (loc)
358 {}
359
360 profile_count m_count;
361 location_t m_loc;
362};
363
364/* A class for identifying where in the compiler's own source
365 (or a plugin) that a dump message is being emitted from. */
366
367struct dump_impl_location_t
368{
369 dump_impl_location_t (
370#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
371 const char *file = __builtin_FILE (),
372 int line = __builtin_LINE (),
373 const char *function = __builtin_FUNCTION ()
374#else
375 const char *file = __FILE__,
376 int line = __LINE__,
377 const char *function = NULL
378#endif
379 )
380 : m_file (file), m_line (line), m_function (function)
381 {}
382
383 const char *m_file;
384 int m_line;
385 const char *m_function;
386};
387
388/* A bundle of information for describing the location of a dump message:
389 (a) the source location and hotness within the user's code, together with
390 (b) the source location within the compiler/plugin.
391
392 The constructors use default parameters so that (b) gets sets up
393 automatically.
394
395 The upshot is that you can pass in e.g. a gimple * to dump_printf_loc,
396 and the dump call will automatically record where in GCC's source
397 code the dump was emitted from. */
398
399class dump_location_t
400{
401 public:
402 /* Default constructor, analogous to UNKNOWN_LOCATION. */
403 dump_location_t (const dump_impl_location_t &impl_location
404 = dump_impl_location_t ())
405 : m_user_location (dump_user_location_t ()),
406 m_impl_location (impl_location)
407 {
408 }
409
410 /* Construct from a gimple statement (using its location and hotness). */
12c27c75 411 dump_location_t (const gimple *stmt,
4f5b9c80
DM
412 const dump_impl_location_t &impl_location
413 = dump_impl_location_t ())
414 : m_user_location (dump_user_location_t (stmt)),
415 m_impl_location (impl_location)
416 {
417 }
418
419 /* Construct from an RTL instruction (using its location and hotness). */
12c27c75 420 dump_location_t (const rtx_insn *insn,
4f5b9c80
DM
421 const dump_impl_location_t &impl_location
422 = dump_impl_location_t ())
423 : m_user_location (dump_user_location_t (insn)),
424 m_impl_location (impl_location)
425 {
426 }
427
428 /* Construct from a dump_user_location_t. */
429 dump_location_t (const dump_user_location_t &user_location,
430 const dump_impl_location_t &impl_location
431 = dump_impl_location_t ())
432 : m_user_location (user_location),
433 m_impl_location (impl_location)
434 {
435 }
436
437 /* Construct from a location_t. This one is deprecated (since it doesn't
438 capture hotness information), and thus requires spelling out. */
439 static dump_location_t
440 from_location_t (location_t loc,
441 const dump_impl_location_t &impl_location
442 = dump_impl_location_t ())
443 {
444 return dump_location_t (dump_user_location_t::from_location_t (loc),
445 impl_location);
446 }
447
448 const dump_user_location_t &
449 get_user_location () const { return m_user_location; }
450
451 const dump_impl_location_t &
452 get_impl_location () const { return m_impl_location; }
453
454 location_t get_location_t () const
455 {
456 return m_user_location.get_location_t ();
457 }
458
459 profile_count get_count () const { return m_user_location.get_count (); }
460
461 private:
462 dump_user_location_t m_user_location;
463 dump_impl_location_t m_impl_location;
464};
465
78c60e3d 466/* In dumpfile.c */
75fdb07e 467extern FILE *dump_begin (int, dump_flags_t *, int part=-1);
7ee2468b 468extern void dump_end (int, FILE *);
78c60e3d 469extern int opt_info_switch_p (const char *);
7ee2468b 470extern const char *dump_flag_name (int);
4a4412b9 471extern const kv_pair<optgroup_flags_t> optgroup_options[];
4df3629e
DM
472
473/* Global variables used to communicate with passes. */
474extern FILE *dump_file;
475extern dump_flags_t dump_flags;
476extern const char *dump_file_name;
477
478extern bool dumps_are_enabled;
479
480extern void set_dump_file (FILE *new_dump_file);
481
482/* Return true if any of the dumps is enabled, false otherwise. */
483static inline bool
484dump_enabled_p (void)
485{
486 return dumps_are_enabled;
487}
488
489/* The following API calls (which *don't* take a "FILE *")
b84e3bde
DM
490 write the output to zero or more locations.
491
492 Some destinations are written to immediately as dump_* calls
493 are made; for others, the output is consolidated into an "optinfo"
494 instance (with its own metadata), and only emitted once the optinfo
495 is complete.
496
497 The destinations are:
498
499 (a) the "immediate" destinations:
500 (a.1) the active dump_file, if any
501 (a.2) the -fopt-info destination, if any
502 (b) the "optinfo" destinations, if any:
503 (b.1) as optimization records
504
505 dump_* (MSG_*) --> dumpfile.c --> items --> (a.1) dump_file
506 | `-> (a.2) alt_dump_file
507 |
508 `--> (b) optinfo
509 `---> optinfo destinations
510 (b.1) optimization records
4df3629e
DM
511
512 For optinfos, the dump_*_loc mark the beginning of an optinfo
513 instance: all subsequent dump_* calls are consolidated into
514 that optinfo, until the next dump_*_loc call (or a change in
515 dump scope, or a call to dumpfile_ensure_any_optinfo_are_flushed).
516
517 A group of dump_* calls should be guarded by:
518
519 if (dump_enabled_p ())
520
521 to minimize the work done for the common case where dumps
522 are disabled. */
523
6f795a92
DM
524extern void dump_printf (dump_flags_t, const char *, ...)
525 ATTRIBUTE_GCC_DUMP_PRINTF (2, 3);
526
4f5b9c80 527extern void dump_printf_loc (dump_flags_t, const dump_location_t &,
6f795a92
DM
528 const char *, ...)
529 ATTRIBUTE_GCC_DUMP_PRINTF (3, 0);
c24e924f 530extern void dump_function (int phase, tree fn);
4af78ef8 531extern void dump_basic_block (dump_flags_t, basic_block, int);
d7259673
DM
532extern void dump_generic_expr_loc (dump_flags_t, const dump_location_t &,
533 dump_flags_t, tree);
1a817418 534extern void dump_generic_expr (dump_flags_t, dump_flags_t, tree);
4f5b9c80
DM
535extern void dump_gimple_stmt_loc (dump_flags_t, const dump_location_t &,
536 dump_flags_t, gimple *, int);
1a817418 537extern void dump_gimple_stmt (dump_flags_t, dump_flags_t, gimple *, int);
30f502ed
RB
538extern void dump_gimple_expr_loc (dump_flags_t, const dump_location_t &,
539 dump_flags_t, gimple *, int);
540extern void dump_gimple_expr (dump_flags_t, dump_flags_t, gimple *, int);
4df3629e 541extern void dump_symtab_node (dump_flags_t, symtab_node *);
78c60e3d 542
dc3f3805 543template<unsigned int N, typename C>
4af78ef8 544void dump_dec (dump_flags_t, const poly_int<N, C> &);
370c2ebe
RS
545extern void dump_dec (dump_flags_t, const poly_wide_int &, signop);
546extern void dump_hex (dump_flags_t, const poly_wide_int &);
dc3f3805 547
4df3629e 548extern void dumpfile_ensure_any_optinfo_are_flushed ();
73fbfcad 549
6475e077
DM
550/* Managing nested scopes, so that dumps can express the call chain
551 leading to a dump message. */
552
553extern unsigned int get_dump_scope_depth ();
554extern void dump_begin_scope (const char *name, const dump_location_t &loc);
555extern void dump_end_scope ();
556
557/* Implementation detail of the AUTO_DUMP_SCOPE macro below.
558
559 A RAII-style class intended to make it easy to emit dump
560 information about entering and exiting a collection of nested
561 function calls. */
562
563class auto_dump_scope
564{
565 public:
566 auto_dump_scope (const char *name, dump_location_t loc)
567 {
568 if (dump_enabled_p ())
569 dump_begin_scope (name, loc);
570 }
571 ~auto_dump_scope ()
572 {
573 if (dump_enabled_p ())
574 dump_end_scope ();
575 }
576};
577
578/* A macro for calling:
579 dump_begin_scope (NAME, LOC);
580 via an RAII object, thus printing "=== MSG ===\n" to the dumpfile etc,
581 and then calling
582 dump_end_scope ();
583 once the object goes out of scope, thus capturing the nesting of
7db960c5
DM
584 the scopes.
585
586 These scopes affect dump messages within them: dump messages at the
587 top level implicitly default to MSG_PRIORITY_USER_FACING, whereas those
588 in a nested scope implicitly default to MSG_PRIORITY_INTERNALS. */
6475e077
DM
589
590#define AUTO_DUMP_SCOPE(NAME, LOC) \
591 auto_dump_scope scope (NAME, LOC)
592
4df3629e
DM
593extern void dump_function (int phase, tree fn);
594extern void print_combine_total_stats (void);
595extern bool enable_rtl_dump_file (void);
596
597/* In tree-dump.c */
598extern void dump_node (const_tree, dump_flags_t, FILE *);
599
600/* In combine.c */
601extern void dump_combine_total_stats (FILE *);
602/* In cfghooks.c */
603extern void dump_bb (FILE *, basic_block, int, dump_flags_t);
604
5d98e5a6
DM
605struct opt_pass;
606
47e0da37
DM
607namespace gcc {
608
4df3629e
DM
609/* A class for managing all of the various dump files used by the
610 optimization passes. */
611
47e0da37
DM
612class dump_manager
613{
614public:
615
616 dump_manager ();
10fdd6e9 617 ~dump_manager ();
47e0da37 618
10fdd6e9
DM
619 /* Register a dumpfile.
620
621 TAKE_OWNERSHIP determines whether callee takes ownership of strings
622 SUFFIX, SWTCH, and GLOB. */
47e0da37
DM
623 unsigned int
624 dump_register (const char *suffix, const char *swtch, const char *glob,
4af78ef8
DM
625 dump_kind dkind, optgroup_flags_t optgroup_flags,
626 bool take_ownership);
47e0da37 627
363dc72c
JJ
628 /* Allow languages and middle-end to register their dumps before the
629 optimization passes. */
630 void
631 register_dumps ();
632
47e0da37
DM
633 /* Return the dump_file_info for the given phase. */
634 struct dump_file_info *
635 get_dump_file_info (int phase) const;
636
799505ae
DM
637 struct dump_file_info *
638 get_dump_file_info_by_switch (const char *swtch) const;
639
47e0da37
DM
640 /* Return the name of the dump file for the given phase.
641 If the dump is not enabled, returns NULL. */
642 char *
75fdb07e 643 get_dump_file_name (int phase, int part = -1) const;
47e0da37 644
799505ae 645 char *
75fdb07e 646 get_dump_file_name (struct dump_file_info *dfi, int part = -1) const;
799505ae 647
47e0da37
DM
648 int
649 dump_switch_p (const char *arg);
650
651 /* Start a dump for PHASE. Store user-supplied dump flags in
652 *FLAG_PTR. Return the number of streams opened. Set globals
653 DUMP_FILE, and ALT_DUMP_FILE to point to the opened streams, and
654 set dump_flags appropriately for both pass dump stream and
655 -fopt-info stream. */
656 int
1a817418 657 dump_start (int phase, dump_flags_t *flag_ptr);
47e0da37
DM
658
659 /* Finish a tree dump for PHASE and close associated dump streams. Also
660 reset the globals DUMP_FILE, ALT_DUMP_FILE, and DUMP_FLAGS. */
661 void
662 dump_finish (int phase);
663
664 FILE *
75fdb07e 665 dump_begin (int phase, dump_flags_t *flag_ptr, int part);
47e0da37
DM
666
667 /* Returns nonzero if tree dump PHASE has been initialized. */
668 int
669 dump_initialized_p (int phase) const;
670
671 /* Returns the switch name of PHASE. */
672 const char *
673 dump_flag_name (int phase) const;
674
5d98e5a6
DM
675 void register_pass (opt_pass *pass);
676
47e0da37
DM
677private:
678
679 int
680 dump_phase_enabled_p (int phase) const;
681
682 int
683 dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob);
684
685 int
8264c84d 686 dump_enable_all (dump_kind dkind, dump_flags_t flags, const char *filename);
47e0da37
DM
687
688 int
4af78ef8 689 opt_info_enable_passes (optgroup_flags_t optgroup_flags, dump_flags_t flags,
1a817418 690 const char *filename);
47e0da37 691
5d98e5a6
DM
692 bool update_dfi_for_opt_info (dump_file_info *dfi) const;
693
47e0da37
DM
694private:
695
696 /* Dynamically registered dump files and switches. */
697 int m_next_dump;
698 struct dump_file_info *m_extra_dump_files;
699 size_t m_extra_dump_files_in_use;
700 size_t m_extra_dump_files_alloced;
701
5d98e5a6
DM
702 /* Stored values from -fopt-info, for handling passes created after
703 option-parsing (by backends and by plugins). */
704 optgroup_flags_t m_optgroup_flags;
705 dump_flags_t m_optinfo_flags;
706 char *m_optinfo_filename;
707
47e0da37
DM
708 /* Grant access to dump_enable_all. */
709 friend bool ::enable_rtl_dump_file (void);
710
711 /* Grant access to opt_info_enable_passes. */
712 friend int ::opt_info_switch_p (const char *arg);
713
714}; // class dump_manager
715
716} // namespace gcc
717
7ee2468b 718#endif /* GCC_DUMPFILE_H */