GCC Middle and Back End API Reference
|
#include <dumpfile.h>
Public Member Functions | |
dump_manager () | |
~dump_manager () | |
unsigned int | dump_register (const char *suffix, const char *swtch, const char *glob, dump_kind dkind, optgroup_flags_t optgroup_flags, bool take_ownership) |
void | register_dumps () |
struct dump_file_info * | get_dump_file_info (int phase) const |
struct dump_file_info * | get_dump_file_info_by_switch (const char *swtch) const |
char * | get_dump_file_name (int phase, int part=-1) const |
char * | get_dump_file_name (struct dump_file_info *dfi, int part=-1) const |
void | dump_switch_p (const char *arg) |
int | dump_start (int phase, dump_flags_t *flag_ptr) |
void | dump_finish (int phase) |
FILE * | dump_begin (int phase, dump_flags_t *flag_ptr, int part) |
int | dump_initialized_p (int phase) const |
const char * | dump_flag_name (int phase) const |
void | register_pass (opt_pass *pass) |
Private Member Functions | |
int | dump_phase_enabled_p (int phase) const |
int | dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob) |
int | dump_enable_all (dump_kind dkind, dump_flags_t flags, const char *filename) |
int | opt_info_enable_passes (optgroup_flags_t optgroup_flags, dump_flags_t flags, const char *filename) |
bool | update_dfi_for_opt_info (dump_file_info *dfi) const |
friend | bool::enable_rtl_dump_file (void) |
friend | int::opt_info_switch_p (const char *arg) |
Private Attributes | |
int | m_next_dump |
struct dump_file_info * | m_extra_dump_files |
size_t | m_extra_dump_files_in_use |
size_t | m_extra_dump_files_alloced |
optgroup_flags_t | m_optgroup_flags |
dump_flags_t | m_optinfo_flags |
char * | m_optinfo_filename |
A class for managing all of the various dump files used by the optimization passes.
gcc::dump_manager::dump_manager | ( | ) |
gcc::dump_manager::~dump_manager | ( | ) |
|
private |
FILE * gcc::dump_manager::dump_begin | ( | int | phase, |
dump_flags_t * | flag_ptr, | ||
int | part ) |
|
private |
Enable all tree dumps with FLAGS on FILENAME. Return number of enabled tree dumps.
References CONST_CAST, dump_files, free(), i, m_extra_dump_files, m_extra_dump_files_in_use, TDI_end, and TDI_none.
Referenced by dump_switch_p_1(), and enable_rtl_dump_file().
void gcc::dump_manager::dump_finish | ( | int | phase | ) |
Finish a tree dump for PHASE and close associated dump streams. Also reset the globals DUMP_FILE, ALT_DUMP_FILE, and DUMP_FLAGS.
References alt_flags, dump_file_info::alt_stream, dump_flags, get_dump_file_info(), NULL, pflags, dump_file_info::pstream, set_alt_dump_file(), set_dump_file(), and TDF_NONE.
Referenced by gcc::pass_manager::finish_optimization_passes().
const char * gcc::dump_manager::dump_flag_name | ( | int | phase | ) | const |
References get_dump_file_info(), and dump_file_info::swtch.
int gcc::dump_manager::dump_initialized_p | ( | int | phase | ) | const |
Returns nonzero if tree dump PHASE has been initialized.
References dump_file_info::alt_state, get_dump_file_info(), and dump_file_info::pstate.
Referenced by pass_init_dump_file().
|
private |
Returns nonzero if dump PHASE is enabled for at least one stream. If PHASE is TDI_tree_all, return nonzero if any dump is enabled for any phase.
References dump_file_info::alt_state, dump_files, get_dump_file_info(), i, m_extra_dump_files, m_extra_dump_files_in_use, dump_file_info::pstate, TDI_end, TDI_none, and TDI_tree_all.
Referenced by dump_begin(), and dump_start().
unsigned int gcc::dump_manager::dump_register | ( | const char * | suffix, |
const char * | swtch, | ||
const char * | glob, | ||
dump_kind | dkind, | ||
optgroup_flags_t | optgroup_flags, | ||
bool | take_ownership ) |
References count, m_extra_dump_files, m_extra_dump_files_alloced, m_extra_dump_files_in_use, m_next_dump, and TDI_end.
Referenced by debuginfo_early_init(), gcc::pass_manager::register_one_dump_file(), and statistics_early_init().
int gcc::dump_manager::dump_start | ( | int | phase, |
dump_flags_t * | flag_ptr ) |
Start a dump for PHASE. Store user-supplied dump flags in *FLAG_PTR. Return the number of streams opened. Set globals DUMP_FILE, and ALT_DUMP_FILE to point to the opened streams, and set dump_flags appropriately for both pass dump stream and -fopt-info stream.
References alt_flags, dump_file_info::alt_flags, dump_file_info::alt_stream, count, dump_open(), dump_open_alternate_stream(), dump_phase_enabled_p(), free(), get_dump_file_info(), get_dump_file_name(), dump_file_info::pflags, pflags, dump_file_info::pstate, dump_file_info::pstream, set_alt_dump_file(), set_dump_file(), and TDI_none.
Referenced by gcc::pass_manager::finish_optimization_passes(), and pass_init_dump_file().
void gcc::dump_manager::dump_switch_p | ( | const char * | arg | ) |
References candidates, dump_files, dump_switch_p_1(), error(), find_closest_string(), i, m_extra_dump_files, m_extra_dump_files_in_use, TDI_end, and TDI_none.
|
private |
Parse ARG as a dump switch. Return nonzero if it is, and store the relevant details in the dump_files array.
References CONST_CAST, dump_file_info::dkind, dump_enable_all(), free(), dump_file_info::glob, NULL, parse_dump_option(), dump_file_info::pfilename, dump_file_info::pflags, dump_file_info::pstate, skip_leading_substring, dump_file_info::suffix, dump_file_info::swtch, and TDF_NONE.
Referenced by dump_switch_p().
struct dump_file_info * gcc::dump_manager::get_dump_file_info | ( | int | phase | ) | const |
Return the dump_file_info for the given phase.
References dump_files, m_extra_dump_files, m_extra_dump_files_in_use, NULL, and TDI_end.
Referenced by debuginfo_init(), dump_begin(), dump_finish(), dump_flag_name(), dump_initialized_p(), dump_phase_enabled_p(), gcc::pass_manager::dump_profile_report(), dump_start(), execute_function_dump(), gcc::pass_manager::finish_optimization_passes(), get_dump_file_name(), pass_init_dump_file(), register_pass(), and statistics_init().
struct dump_file_info * gcc::dump_manager::get_dump_file_info_by_switch | ( | const char * | swtch | ) | const |
Locate the dump_file_info with swtch equal to SWTCH, or return NULL if no such dump_file_info exists.
References i, m_extra_dump_files, m_extra_dump_files_in_use, and NULL.
char * gcc::dump_manager::get_dump_file_name | ( | int | phase, |
int | part = -1 ) const |
Return the name of the dump file for the given phase. The caller is responsible for calling free on the returned buffer. If the dump is not enabled, returns NULL.
References get_dump_file_info(), get_dump_file_name(), NULL, and TDI_none.
Referenced by dump_begin(), dump_start(), gcc::pass_manager::finish_optimization_passes(), get_dump_file_name(), and pass_init_dump_file().
char * gcc::dump_manager::get_dump_file_name | ( | struct dump_file_info * | dfi, |
int | part = -1 ) const |
Return the name of the dump file for the given dump_file_info. The caller is responsible for calling free on the returned buffer. If the dump is not enabled, returns NULL.
References dump_file_info::dkind, gcc_assert, NULL, dump_file_info::num, dump_file_info::pfilename, dump_file_info::pstate, and dump_file_info::suffix.
|
private |
|
private |
Enable -fopt-info dumps on all dump files matching OPTGROUP_FLAGS. Enable dumps with FLAGS on FILENAME. Return the number of enabled dumps.
References dump_files, i, m_extra_dump_files, m_extra_dump_files_in_use, m_optgroup_flags, m_optinfo_filename, m_optinfo_flags, TDI_end, TDI_none, and update_dfi_for_opt_info().
Referenced by opt_info_switch_p().
void gcc::dump_manager::register_dumps | ( | ) |
Allow languages and middle-end to register their dumps before the optimization passes.
References dump_files, FIRST_ME_AUTO_NUMBERED_DUMP, gcc_assert, m_next_dump, lang_hooks::register_dumps, TDI_gimple, TDI_nested, and TDI_original.
void gcc::dump_manager::register_pass | ( | opt_pass * | pass | ) |
Handle -fdump-* and -fopt-info for a pass added after command-line options are parsed (those from plugins and those from backends). Because the registration of plugin/backend passes happens after the command-line options are parsed, the options that specify single pass dumping (e.g. -fdump-tree-PASSNAME) cannot be used for new passes. Therefore we currently can only enable dumping of new passes when the 'dump-all' flags (e.g. -fdump-tree-all) are specified. This is done here. Similarly, the saved -fopt-info options are wired up to the new pass.
References gcc_assert, get_dump_file_info(), GIMPLE_PASS, IPA_PASS, dump_file_info::pflags, dump_file_info::pstate, register_one_dump_file(), SIMPLE_IPA_PASS, opt_pass::static_pass_number, TDI_ipa_all, TDI_rtl_all, TDI_tree_all, pass_data::type, and update_dfi_for_opt_info().
Referenced by gcc::pass_manager::register_pass().
|
private |
Use the saved -fopt-info options to update DFI. Return true if the dump is enabled.
References dump_file_info::alt_filename, dump_file_info::alt_flags, dump_file_info::alt_state, CONST_CAST, free(), gcc_assert, m_optgroup_flags, m_optinfo_filename, m_optinfo_flags, and dump_file_info::optgroup_flags.
Referenced by opt_info_enable_passes(), and register_pass().
|
private |
|
private |
Referenced by dump_manager(), and dump_register().
|
private |
|
private |
Referenced by dump_manager(), dump_register(), and register_dumps().
|
private |
Referenced by dump_manager(), opt_info_enable_passes(), and update_dfi_for_opt_info().
|
private |
Referenced by dump_manager(), opt_info_enable_passes(), update_dfi_for_opt_info(), and ~dump_manager().
|
private |
Referenced by dump_manager(), opt_info_enable_passes(), and update_dfi_for_opt_info().