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
 
charget_dump_file_name (int phase, int part=-1) const
 
charget_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)
 
FILEdump_begin (int phase, dump_flags_t *flag_ptr, int part)
 
int dump_initialized_p (int phase) const
 
const chardump_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
 
charm_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()

gcc::dump_manager::~dump_manager ( )

References free(), ggc_alloc(), and i.

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 )

References dump_open(), free(), ggc_alloc(), NULL, pflags, and TDI_none.

Referenced by dump_begin().

◆ 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(), ggc_alloc(), i, dump_file_info::pfilename, dump_file_info::pflags, dump_file_info::pstate, TDI_end, and TDI_none.

◆ 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_flags, ggc_alloc(), NULL, pflags, set_alt_dump_file(), set_dump_file(), and TDF_NONE.

Referenced by coverage_init(), and pass_fini_dump_file().

◆ dump_flag_name()

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

References ggc_alloc().

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 ggc_alloc().

◆ 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_files, ggc_alloc(), i, TDI_end, TDI_none, and TDI_tree_all.

Referenced by dump_start().

◆ 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 )

References count, ggc_alloc(), and TDI_end.

◆ 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, count, dump_open(), dump_open_alternate_stream(), dump_phase_enabled_p(), free(), get_dump_file_info(), get_dump_file_name(), ggc_alloc(), pflags, set_alt_dump_file(), set_dump_file(), and TDI_none.

Referenced by coverage_init().

◆ 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, free(), ggc_alloc(), NULL, parse_dump_option(), skip_leading_substring, and TDF_NONE.

◆ get_dump_file_info()

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

Referenced by dump_start().

◆ 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 ggc_alloc(), 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 ggc_alloc(), NULL, and TDI_none.

Referenced by dump_start().

◆ 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 gcc_assert, ggc_alloc(), and NULL.

◆ 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, ggc_alloc(), i, TDI_end, and TDI_none.

◆ 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, ggc_alloc(), GIMPLE_PASS, IPA_PASS, 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.

◆ 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 CONST_CAST, free(), gcc_assert, and ggc_alloc().

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: