1 /* Dump infrastructure for optimizations and intermediate representation.
2 Copyright (C) 2012-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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/>. */
22 #include "coretypes.h"
23 #include "diagnostic-core.h"
26 #include "gimple-pretty-print.h"
29 /* If non-NULL, return one past-the-end of the matching SUBPART of
31 #define skip_leading_substring(whole, part) \
32 (strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
34 static int pflags
; /* current dump_flags */
35 static int alt_flags
; /* current opt_info flags */
37 static void dump_loc (int, FILE *, source_location
);
38 static FILE *dump_open_alternate_stream (struct dump_file_info
*);
40 /* These are currently used for communicating between passes.
41 However, instead of accessing them directly, the passes can use
42 dump_printf () for dumps. */
43 FILE *dump_file
= NULL
;
44 FILE *alt_dump_file
= NULL
;
45 const char *dump_file_name
;
48 /* Table of tree dump switches. This must be consistent with the
49 TREE_DUMP_INDEX enumeration in dumpfile.h. */
50 static struct dump_file_info dump_files
[TDI_end
] =
52 {NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, 0, 0, 0, 0, 0, 0},
53 {".cgraph", "ipa-cgraph", NULL
, NULL
, NULL
, NULL
, NULL
, TDF_IPA
,
55 {".type-inheritance", "ipa-type-inheritance", NULL
, NULL
, NULL
, NULL
, NULL
, TDF_IPA
,
57 {".tu", "translation-unit", NULL
, NULL
, NULL
, NULL
, NULL
, TDF_TREE
,
59 {".class", "class-hierarchy", NULL
, NULL
, NULL
, NULL
, NULL
, TDF_TREE
,
61 {".original", "tree-original", NULL
, NULL
, NULL
, NULL
, NULL
, TDF_TREE
,
63 {".gimple", "tree-gimple", NULL
, NULL
, NULL
, NULL
, NULL
, TDF_TREE
,
65 {".nested", "tree-nested", NULL
, NULL
, NULL
, NULL
, NULL
, TDF_TREE
,
67 #define FIRST_AUTO_NUMBERED_DUMP 6
69 {NULL
, "tree-all", NULL
, NULL
, NULL
, NULL
, NULL
, TDF_TREE
,
71 {NULL
, "rtl-all", NULL
, NULL
, NULL
, NULL
, NULL
, TDF_RTL
,
73 {NULL
, "ipa-all", NULL
, NULL
, NULL
, NULL
, NULL
, TDF_IPA
,
77 /* Define a name->number mapping for a dump flag value. */
78 struct dump_option_value_info
80 const char *const name
; /* the name of the value */
81 const int value
; /* the value of the name */
84 /* Table of dump options. This must be consistent with the TDF_* flags
85 in dumpfile.h and opt_info_options below. */
86 static const struct dump_option_value_info dump_options
[] =
88 {"address", TDF_ADDRESS
},
89 {"asmname", TDF_ASMNAME
},
93 {"details", (TDF_DETAILS
| MSG_OPTIMIZED_LOCATIONS
94 | MSG_MISSED_OPTIMIZATION
96 {"cselib", TDF_CSELIB
},
98 {"blocks", TDF_BLOCKS
},
100 {"lineno", TDF_LINENO
},
102 {"stmtaddr", TDF_STMTADDR
},
103 {"memsyms", TDF_MEMSYMS
},
104 {"verbose", TDF_VERBOSE
},
106 {"alias", TDF_ALIAS
},
107 {"nouid", TDF_NOUID
},
108 {"enumerate_locals", TDF_ENUMERATE_LOCALS
},
110 {"all", ~(TDF_RAW
| TDF_SLIM
| TDF_LINENO
| TDF_TREE
| TDF_RTL
| TDF_IPA
111 | TDF_STMTADDR
| TDF_GRAPH
| TDF_DIAGNOSTIC
| TDF_VERBOSE
112 | TDF_RHS_ONLY
| TDF_NOUID
| TDF_ENUMERATE_LOCALS
| TDF_SCEV
)},
116 /* A subset of the dump_options table which is used for -fopt-info
117 types. This must be consistent with the MSG_* flags in dumpfile.h.
119 static const struct dump_option_value_info optinfo_verbosity_options
[] =
121 {"optimized", MSG_OPTIMIZED_LOCATIONS
},
122 {"missed", MSG_MISSED_OPTIMIZATION
},
128 /* Flags used for -fopt-info groups. */
129 static const struct dump_option_value_info optgroup_options
[] =
131 {"ipa", OPTGROUP_IPA
},
132 {"loop", OPTGROUP_LOOP
},
133 {"inline", OPTGROUP_INLINE
},
134 {"vec", OPTGROUP_VEC
},
135 {"optall", OPTGROUP_ALL
},
139 gcc::dump_manager::dump_manager ():
140 m_next_dump (FIRST_AUTO_NUMBERED_DUMP
),
141 m_extra_dump_files (NULL
),
142 m_extra_dump_files_in_use (0),
143 m_extra_dump_files_alloced (0)
149 dump_register (const char *suffix
, const char *swtch
, const char *glob
,
150 int flags
, int optgroup_flags
)
152 int num
= m_next_dump
++;
154 size_t count
= m_extra_dump_files_in_use
++;
156 if (count
>= m_extra_dump_files_alloced
)
158 if (m_extra_dump_files_alloced
== 0)
159 m_extra_dump_files_alloced
= 32;
161 m_extra_dump_files_alloced
*= 2;
162 m_extra_dump_files
= XRESIZEVEC (struct dump_file_info
,
164 m_extra_dump_files_alloced
);
167 memset (&m_extra_dump_files
[count
], 0, sizeof (struct dump_file_info
));
168 m_extra_dump_files
[count
].suffix
= suffix
;
169 m_extra_dump_files
[count
].swtch
= swtch
;
170 m_extra_dump_files
[count
].glob
= glob
;
171 m_extra_dump_files
[count
].pflags
= flags
;
172 m_extra_dump_files
[count
].optgroup_flags
= optgroup_flags
;
173 m_extra_dump_files
[count
].num
= num
;
175 return count
+ TDI_end
;
179 /* Return the dump_file_info for the given phase. */
181 struct dump_file_info
*
183 get_dump_file_info (int phase
) const
186 return &dump_files
[phase
];
187 else if ((size_t) (phase
- TDI_end
) >= m_extra_dump_files_in_use
)
190 return m_extra_dump_files
+ (phase
- TDI_end
);
194 /* Return the name of the dump file for the given phase.
195 If the dump is not enabled, returns NULL. */
199 get_dump_file_name (int phase
) const
202 struct dump_file_info
*dfi
;
204 if (phase
== TDI_none
)
207 dfi
= get_dump_file_info (phase
);
208 if (dfi
->pstate
== 0)
211 /* If available, use the command line dump filename. */
213 return xstrdup (dfi
->pfilename
);
220 if (dfi
->pflags
& TDF_TREE
)
222 else if (dfi
->pflags
& TDF_IPA
)
227 if (snprintf (dump_id
, sizeof (dump_id
), ".%03d%c", dfi
->num
, suffix
) < 0)
231 return concat (dump_base_name
, dump_id
, dfi
->suffix
, NULL
);
234 /* For a given DFI, open an alternate dump filename (which could also
235 be a standard stream such as stdout/stderr). If the alternate dump
236 file cannot be opened, return NULL. */
239 dump_open_alternate_stream (struct dump_file_info
*dfi
)
242 if (!dfi
->alt_filename
)
246 return dfi
->alt_stream
;
248 stream
= strcmp ("stderr", dfi
->alt_filename
) == 0
250 : strcmp ("stdout", dfi
->alt_filename
) == 0
252 : fopen (dfi
->alt_filename
, dfi
->alt_state
< 0 ? "w" : "a");
255 error ("could not open dump file %qs: %m", dfi
->alt_filename
);
262 /* Print source location on DFILE if enabled. */
265 dump_loc (int dump_kind
, FILE *dfile
, source_location loc
)
269 if (LOCATION_LOCUS (loc
) > BUILTINS_LOCATION
)
270 fprintf (dfile
, "%s:%d:%d: note: ", LOCATION_FILE (loc
),
271 LOCATION_LINE (loc
), LOCATION_COLUMN (loc
));
272 else if (current_function_decl
)
273 fprintf (dfile
, "%s:%d:%d: note: ",
274 DECL_SOURCE_FILE (current_function_decl
),
275 DECL_SOURCE_LINE (current_function_decl
),
276 DECL_SOURCE_COLUMN (current_function_decl
));
280 /* Dump gimple statement GS with SPC indentation spaces and
281 EXTRA_DUMP_FLAGS on the dump streams if DUMP_KIND is enabled. */
284 dump_gimple_stmt (int dump_kind
, int extra_dump_flags
, gimple gs
, int spc
)
286 if (dump_file
&& (dump_kind
& pflags
))
287 print_gimple_stmt (dump_file
, gs
, spc
, dump_flags
| extra_dump_flags
);
289 if (alt_dump_file
&& (dump_kind
& alt_flags
))
290 print_gimple_stmt (alt_dump_file
, gs
, spc
, dump_flags
| extra_dump_flags
);
293 /* Similar to dump_gimple_stmt, except additionally print source location. */
296 dump_gimple_stmt_loc (int dump_kind
, source_location loc
, int extra_dump_flags
,
299 if (dump_file
&& (dump_kind
& pflags
))
301 dump_loc (dump_kind
, dump_file
, loc
);
302 print_gimple_stmt (dump_file
, gs
, spc
, dump_flags
| extra_dump_flags
);
305 if (alt_dump_file
&& (dump_kind
& alt_flags
))
307 dump_loc (dump_kind
, alt_dump_file
, loc
);
308 print_gimple_stmt (alt_dump_file
, gs
, spc
, dump_flags
| extra_dump_flags
);
312 /* Dump expression tree T using EXTRA_DUMP_FLAGS on dump streams if
313 DUMP_KIND is enabled. */
316 dump_generic_expr (int dump_kind
, int extra_dump_flags
, tree t
)
318 if (dump_file
&& (dump_kind
& pflags
))
319 print_generic_expr (dump_file
, t
, dump_flags
| extra_dump_flags
);
321 if (alt_dump_file
&& (dump_kind
& alt_flags
))
322 print_generic_expr (alt_dump_file
, t
, dump_flags
| extra_dump_flags
);
326 /* Similar to dump_generic_expr, except additionally print the source
330 dump_generic_expr_loc (int dump_kind
, source_location loc
,
331 int extra_dump_flags
, tree t
)
333 if (dump_file
&& (dump_kind
& pflags
))
335 dump_loc (dump_kind
, dump_file
, loc
);
336 print_generic_expr (dump_file
, t
, dump_flags
| extra_dump_flags
);
339 if (alt_dump_file
&& (dump_kind
& alt_flags
))
341 dump_loc (dump_kind
, alt_dump_file
, loc
);
342 print_generic_expr (alt_dump_file
, t
, dump_flags
| extra_dump_flags
);
346 /* Output a formatted message using FORMAT on appropriate dump streams. */
349 dump_printf (int dump_kind
, const char *format
, ...)
351 if (dump_file
&& (dump_kind
& pflags
))
354 va_start (ap
, format
);
355 vfprintf (dump_file
, format
, ap
);
359 if (alt_dump_file
&& (dump_kind
& alt_flags
))
362 va_start (ap
, format
);
363 vfprintf (alt_dump_file
, format
, ap
);
368 /* Similar to dump_printf, except source location is also printed. */
371 dump_printf_loc (int dump_kind
, source_location loc
, const char *format
, ...)
373 if (dump_file
&& (dump_kind
& pflags
))
376 dump_loc (dump_kind
, dump_file
, loc
);
377 va_start (ap
, format
);
378 vfprintf (dump_file
, format
, ap
);
382 if (alt_dump_file
&& (dump_kind
& alt_flags
))
385 dump_loc (dump_kind
, alt_dump_file
, loc
);
386 va_start (ap
, format
);
387 vfprintf (alt_dump_file
, format
, ap
);
392 /* Start a dump for PHASE. Store user-supplied dump flags in
393 *FLAG_PTR. Return the number of streams opened. Set globals
394 DUMP_FILE, and ALT_DUMP_FILE to point to the opened streams, and
395 set dump_flags appropriately for both pass dump stream and
396 -fopt-info stream. */
400 dump_start (int phase
, int *flag_ptr
)
404 struct dump_file_info
*dfi
;
406 if (phase
== TDI_none
|| !dump_phase_enabled_p (phase
))
409 dfi
= get_dump_file_info (phase
);
410 name
= get_dump_file_name (phase
);
413 stream
= strcmp ("stderr", name
) == 0
415 : strcmp ("stdout", name
) == 0
417 : fopen (name
, dfi
->pstate
< 0 ? "w" : "a");
419 error ("could not open dump file %qs: %m", name
);
426 dfi
->pstream
= stream
;
427 dump_file
= dfi
->pstream
;
428 /* Initialize current dump flags. */
429 pflags
= dfi
->pflags
;
432 stream
= dump_open_alternate_stream (dfi
);
435 dfi
->alt_stream
= stream
;
437 alt_dump_file
= dfi
->alt_stream
;
438 /* Initialize current -fopt-info flags. */
439 alt_flags
= dfi
->alt_flags
;
443 *flag_ptr
= dfi
->pflags
;
448 /* Finish a tree dump for PHASE and close associated dump streams. Also
449 reset the globals DUMP_FILE, ALT_DUMP_FILE, and DUMP_FLAGS. */
453 dump_finish (int phase
)
455 struct dump_file_info
*dfi
;
459 dfi
= get_dump_file_info (phase
);
460 if (dfi
->pstream
&& (!dfi
->pfilename
461 || (strcmp ("stderr", dfi
->pfilename
) != 0
462 && strcmp ("stdout", dfi
->pfilename
) != 0)))
463 fclose (dfi
->pstream
);
465 if (dfi
->alt_stream
&& strcmp ("stderr", dfi
->alt_filename
) != 0
466 && strcmp ("stdout", dfi
->alt_filename
) != 0)
467 fclose (dfi
->alt_stream
);
469 dfi
->alt_stream
= NULL
;
472 alt_dump_file
= NULL
;
473 dump_flags
= TDI_none
;
478 /* Begin a tree dump for PHASE. Stores any user supplied flag in
479 *FLAG_PTR and returns a stream to write to. If the dump is not
480 enabled, returns NULL.
481 Multiple calls will reopen and append to the dump file. */
484 dump_begin (int phase
, int *flag_ptr
)
486 return g
->get_dumps ()->dump_begin (phase
, flag_ptr
);
491 dump_begin (int phase
, int *flag_ptr
)
494 struct dump_file_info
*dfi
;
497 if (phase
== TDI_none
|| !dump_phase_enabled_p (phase
))
500 name
= get_dump_file_name (phase
);
503 dfi
= get_dump_file_info (phase
);
505 stream
= strcmp ("stderr", name
) == 0
507 : strcmp ("stdout", name
) == 0
509 : fopen (name
, dfi
->pstate
< 0 ? "w" : "a");
512 error ("could not open dump file %qs: %m", name
);
518 *flag_ptr
= dfi
->pflags
;
520 /* Initialize current flags */
521 pflags
= dfi
->pflags
;
525 /* Returns nonzero if dump PHASE is enabled for at least one stream.
526 If PHASE is TDI_tree_all, return nonzero if any dump is enabled for
531 dump_phase_enabled_p (int phase
) const
533 if (phase
== TDI_tree_all
)
536 for (i
= TDI_none
+ 1; i
< (size_t) TDI_end
; i
++)
537 if (dump_files
[i
].pstate
|| dump_files
[i
].alt_state
)
539 for (i
= 0; i
< m_extra_dump_files_in_use
; i
++)
540 if (m_extra_dump_files
[i
].pstate
|| m_extra_dump_files
[i
].alt_state
)
546 struct dump_file_info
*dfi
= get_dump_file_info (phase
);
547 return dfi
->pstate
|| dfi
->alt_state
;
551 /* Returns nonzero if tree dump PHASE has been initialized. */
555 dump_initialized_p (int phase
) const
557 struct dump_file_info
*dfi
= get_dump_file_info (phase
);
558 return dfi
->pstate
> 0 || dfi
->alt_state
> 0;
561 /* Returns the switch name of PHASE. */
564 dump_flag_name (int phase
)
566 return g
->get_dumps ()->dump_flag_name (phase
);
571 dump_flag_name (int phase
) const
573 struct dump_file_info
*dfi
= get_dump_file_info (phase
);
577 /* Finish a tree dump for PHASE. STREAM is the stream created by
581 dump_end (int phase ATTRIBUTE_UNUSED
, FILE *stream
)
583 if (stream
!= stderr
&& stream
!= stdout
)
587 /* Enable all tree dumps with FLAGS on FILENAME. Return number of
588 enabled tree dumps. */
592 dump_enable_all (int flags
, const char *filename
)
594 int ir_dump_type
= (flags
& (TDF_TREE
| TDF_RTL
| TDF_IPA
));
598 for (i
= TDI_none
+ 1; i
< (size_t) TDI_end
; i
++)
600 if ((dump_files
[i
].pflags
& ir_dump_type
))
602 const char *old_filename
= dump_files
[i
].pfilename
;
603 dump_files
[i
].pstate
= -1;
604 dump_files
[i
].pflags
|= flags
;
606 /* Override the existing filename. */
609 dump_files
[i
].pfilename
= xstrdup (filename
);
610 /* Since it is a command-line provided file, which is
611 common to all the phases, use it in append mode. */
612 dump_files
[i
].pstate
= 1;
614 if (old_filename
&& filename
!= old_filename
)
615 free (CONST_CAST (char *, old_filename
));
619 for (i
= 0; i
< m_extra_dump_files_in_use
; i
++)
621 if ((m_extra_dump_files
[i
].pflags
& ir_dump_type
))
623 const char *old_filename
= m_extra_dump_files
[i
].pfilename
;
624 m_extra_dump_files
[i
].pstate
= -1;
625 m_extra_dump_files
[i
].pflags
|= flags
;
627 /* Override the existing filename. */
630 m_extra_dump_files
[i
].pfilename
= xstrdup (filename
);
631 /* Since it is a command-line provided file, which is
632 common to all the phases, use it in append mode. */
633 m_extra_dump_files
[i
].pstate
= 1;
635 if (old_filename
&& filename
!= old_filename
)
636 free (CONST_CAST (char *, old_filename
));
643 /* Enable -fopt-info dumps on all dump files matching OPTGROUP_FLAGS.
644 Enable dumps with FLAGS on FILENAME. Return the number of enabled
649 opt_info_enable_passes (int optgroup_flags
, int flags
, const char *filename
)
654 for (i
= TDI_none
+ 1; i
< (size_t) TDI_end
; i
++)
656 if ((dump_files
[i
].optgroup_flags
& optgroup_flags
))
658 const char *old_filename
= dump_files
[i
].alt_filename
;
659 /* Since this file is shared among different passes, it
660 should be opened in append mode. */
661 dump_files
[i
].alt_state
= 1;
662 dump_files
[i
].alt_flags
|= flags
;
664 /* Override the existing filename. */
666 dump_files
[i
].alt_filename
= xstrdup (filename
);
667 if (old_filename
&& filename
!= old_filename
)
668 free (CONST_CAST (char *, old_filename
));
672 for (i
= 0; i
< m_extra_dump_files_in_use
; i
++)
674 if ((m_extra_dump_files
[i
].optgroup_flags
& optgroup_flags
))
676 const char *old_filename
= m_extra_dump_files
[i
].alt_filename
;
677 /* Since this file is shared among different passes, it
678 should be opened in append mode. */
679 m_extra_dump_files
[i
].alt_state
= 1;
680 m_extra_dump_files
[i
].alt_flags
|= flags
;
682 /* Override the existing filename. */
684 m_extra_dump_files
[i
].alt_filename
= xstrdup (filename
);
685 if (old_filename
&& filename
!= old_filename
)
686 free (CONST_CAST (char *, old_filename
));
693 /* Parse ARG as a dump switch. Return nonzero if it is, and store the
694 relevant details in the dump_files array. */
698 dump_switch_p_1 (const char *arg
, struct dump_file_info
*dfi
, bool doglob
)
700 const char *option_value
;
704 if (doglob
&& !dfi
->glob
)
707 option_value
= skip_leading_substring (arg
, doglob
? dfi
->glob
: dfi
->swtch
);
711 if (*option_value
&& *option_value
!= '-' && *option_value
!= '=')
719 const struct dump_option_value_info
*option_ptr
;
726 end_ptr
= strchr (ptr
, '-');
727 eq_ptr
= strchr (ptr
, '=');
729 if (eq_ptr
&& !end_ptr
)
733 end_ptr
= ptr
+ strlen (ptr
);
734 length
= end_ptr
- ptr
;
736 for (option_ptr
= dump_options
; option_ptr
->name
; option_ptr
++)
737 if (strlen (option_ptr
->name
) == length
738 && !memcmp (option_ptr
->name
, ptr
, length
))
740 flags
|= option_ptr
->value
;
746 /* Interpret rest of the argument as a dump filename. This
747 filename overrides other command line filenames. */
749 free (CONST_CAST (char *, dfi
->pfilename
));
750 dfi
->pfilename
= xstrdup (ptr
+ 1);
754 warning (0, "ignoring unknown option %q.*s in %<-fdump-%s%>",
755 length
, ptr
, dfi
->swtch
);
761 dfi
->pflags
|= flags
;
763 /* Process -fdump-tree-all and -fdump-rtl-all, by enabling all the
765 if (dfi
->suffix
== NULL
)
766 dump_enable_all (dfi
->pflags
, dfi
->pfilename
);
773 dump_switch_p (const char *arg
)
778 for (i
= TDI_none
+ 1; i
!= TDI_end
; i
++)
779 any
|= dump_switch_p_1 (arg
, &dump_files
[i
], false);
781 /* Don't glob if we got a hit already */
783 for (i
= TDI_none
+ 1; i
!= TDI_end
; i
++)
784 any
|= dump_switch_p_1 (arg
, &dump_files
[i
], true);
786 for (i
= 0; i
< m_extra_dump_files_in_use
; i
++)
787 any
|= dump_switch_p_1 (arg
, &m_extra_dump_files
[i
], false);
790 for (i
= 0; i
< m_extra_dump_files_in_use
; i
++)
791 any
|= dump_switch_p_1 (arg
, &m_extra_dump_files
[i
], true);
797 /* Parse ARG as a -fopt-info switch and store flags, optgroup_flags
798 and filename. Return non-zero if it is a recognized switch. */
801 opt_info_switch_p_1 (const char *arg
, int *flags
, int *optgroup_flags
,
804 const char *option_value
;
815 return 1; /* Handle '-fopt-info' without any additional options. */
819 const struct dump_option_value_info
*option_ptr
;
826 end_ptr
= strchr (ptr
, '-');
827 eq_ptr
= strchr (ptr
, '=');
829 if (eq_ptr
&& !end_ptr
)
833 end_ptr
= ptr
+ strlen (ptr
);
834 length
= end_ptr
- ptr
;
836 for (option_ptr
= optinfo_verbosity_options
; option_ptr
->name
;
838 if (strlen (option_ptr
->name
) == length
839 && !memcmp (option_ptr
->name
, ptr
, length
))
841 *flags
|= option_ptr
->value
;
845 for (option_ptr
= optgroup_options
; option_ptr
->name
; option_ptr
++)
846 if (strlen (option_ptr
->name
) == length
847 && !memcmp (option_ptr
->name
, ptr
, length
))
849 *optgroup_flags
|= option_ptr
->value
;
855 /* Interpret rest of the argument as a dump filename. This
856 filename overrides other command line filenames. */
857 *filename
= xstrdup (ptr
+ 1);
862 warning (0, "unknown option %q.*s in %<-fopt-info-%s%>",
873 /* Return non-zero if ARG is a recognized switch for
874 -fopt-info. Return zero otherwise. */
877 opt_info_switch_p (const char *arg
)
882 static char *file_seen
= NULL
;
883 gcc::dump_manager
*dumps
= g
->get_dumps ();
885 if (!opt_info_switch_p_1 (arg
, &flags
, &optgroup_flags
, &filename
))
889 filename
= xstrdup ("stderr");
891 /* Bail out if a different filename has been specified. */
892 if (file_seen
&& strcmp (file_seen
, filename
))
894 warning (0, "ignoring possibly conflicting option %<-fopt-info-%s%>",
899 file_seen
= xstrdup (filename
);
901 flags
= MSG_OPTIMIZED_LOCATIONS
;
903 optgroup_flags
= OPTGROUP_ALL
;
905 return dumps
->opt_info_enable_passes (optgroup_flags
, flags
, filename
);
908 /* Print basic block on the dump streams. */
911 dump_basic_block (int dump_kind
, basic_block bb
, int indent
)
913 if (dump_file
&& (dump_kind
& pflags
))
914 dump_bb (dump_file
, bb
, indent
, TDF_DETAILS
);
915 if (alt_dump_file
&& (dump_kind
& alt_flags
))
916 dump_bb (alt_dump_file
, bb
, indent
, TDF_DETAILS
);
919 /* Print information from the combine pass on dump_file. */
922 print_combine_total_stats (void)
925 dump_combine_total_stats (dump_file
);
928 /* Enable RTL dump for all the RTL passes. */
931 enable_rtl_dump_file (void)
933 gcc::dump_manager
*dumps
= g
->get_dumps ();
935 dumps
->dump_enable_all (TDF_RTL
| TDF_DETAILS
| TDF_BLOCKS
, NULL
);
936 return num_enabled
> 0;