GCC Middle and Back End API Reference
gcc::dump_manager Class Reference

#include <dumpfile.h>

Collaboration diagram for gcc::dump_manager:

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_infoget_dump_file_info (int phase) const
 
struct dump_file_infoget_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_infom_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
 

Detailed Description

A class for managing all of the various dump files used by the
optimization passes.   

Constructor & Destructor Documentation

◆ dump_manager()

gcc::dump_manager::dump_manager ( )

◆ ~dump_manager()

Member Function Documentation

◆ bool::enable_rtl_dump_file()

gcc::dump_manager::bool::enable_rtl_dump_file ( void )
private

◆ dump_begin()

FILE * gcc::dump_manager::dump_begin ( int phase,
dump_flags_t * flag_ptr,
int part )

◆ dump_enable_all()

int gcc::dump_manager::dump_enable_all ( dump_kind dkind,
dump_flags_t flags,
const char * filename )
private
Enable all tree dumps with FLAGS on FILENAME.  Return number of
enabled tree dumps.   

References CONST_CAST, dump_files, free(), i, dump_file_info::pfilename, dump_file_info::pflags, dump_file_info::pstate, TDI_end, and TDI_none.

Referenced by enable_rtl_dump_file().

◆ dump_finish()

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, NULL, pflags, dump_file_info::pstream, set_alt_dump_file(), set_dump_file(), and TDF_NONE.

Referenced by coverage_init(), gcc::pass_manager::finish_optimization_passes(), and pass_fini_dump_file().

◆ dump_flag_name()

const char * gcc::dump_manager::dump_flag_name ( int phase) const

References dump_file_info::swtch.

Referenced by dump_flag_name().

◆ dump_initialized_p()

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, and dump_file_info::pstate.

Referenced by pass_init_dump_file().

◆ dump_phase_enabled_p()

int gcc::dump_manager::dump_phase_enabled_p ( int phase) const
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, i, dump_file_info::pstate, TDI_end, TDI_none, and TDI_tree_all.

◆ dump_register()

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 )

◆ dump_start()

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(), free(), 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 coverage_init(), gcc::pass_manager::finish_optimization_passes(), and pass_init_dump_file().

◆ dump_switch_p()

void gcc::dump_manager::dump_switch_p ( const char * arg)

◆ dump_switch_p_1()

int gcc::dump_manager::dump_switch_p_1 ( const char * arg,
struct dump_file_info * dfi,
bool doglob )
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, 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.

◆ get_dump_file_info()

struct dump_file_info * gcc::dump_manager::get_dump_file_info ( int phase) const

◆ get_dump_file_info_by_switch()

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, and NULL.

◆ get_dump_file_name() [1/2]

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 NULL, and TDI_none.

Referenced by gcc::pass_manager::finish_optimization_passes(), and pass_init_dump_file().

◆ get_dump_file_name() [2/2]

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.

◆ int::opt_info_switch_p()

gcc::dump_manager::int::opt_info_switch_p ( const char * arg)
private

◆ opt_info_enable_passes()

int gcc::dump_manager::opt_info_enable_passes ( optgroup_flags_t optgroup_flags,
dump_flags_t flags,
const char * filename )
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, TDI_end, and TDI_none.

Referenced by opt_info_switch_p().

◆ register_dumps()

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, dump_file_info::num, lang_hooks::register_dumps, TDI_gimple, TDI_nested, and TDI_original.

Referenced by general_init().

◆ register_pass()

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, 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, and pass_data::type.

Referenced by gcc::pass_manager::register_pass().

◆ update_dfi_for_opt_info()

bool gcc::dump_manager::update_dfi_for_opt_info ( dump_file_info * dfi) const
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, and dump_file_info::optgroup_flags.

Field Documentation

◆ m_extra_dump_files

struct dump_file_info* gcc::dump_manager::m_extra_dump_files
private

◆ m_extra_dump_files_alloced

size_t gcc::dump_manager::m_extra_dump_files_alloced
private

◆ m_extra_dump_files_in_use

size_t gcc::dump_manager::m_extra_dump_files_in_use
private

◆ m_next_dump

int gcc::dump_manager::m_next_dump
private

◆ m_optgroup_flags

optgroup_flags_t gcc::dump_manager::m_optgroup_flags
private

◆ m_optinfo_filename

char* gcc::dump_manager::m_optinfo_filename
private

◆ m_optinfo_flags

dump_flags_t gcc::dump_manager::m_optinfo_flags
private

The documentation for this class was generated from the following files: