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