GCC Middle and Back End API Reference
|
#include <dump-context.h>
Static Public Member Functions | |
static dump_context & | get () |
Private Member Functions | |
optinfo & | ensure_pending_optinfo (const dump_metadata_t &metadata) |
optinfo & | begin_next_optinfo (const dump_metadata_t &metadata, const dump_user_location_t &loc) |
Private Attributes | |
unsigned int | m_scope_depth |
optinfo * | m_pending |
optrecord_json_writer * | m_json_writer |
pretty_printer * | m_test_pp |
dump_flags_t | m_test_pp_flags |
Static Private Attributes | |
static dump_context * | s_current = &dump_context::s_default |
static dump_context | s_default |
Friends | |
class | selftest::temp_dump_context |
class | debug_dump_context |
A class for handling the various dump_* calls. In particular, this class has responsibility for consolidating the "dump_*" calls into optinfo instances (delimited by "dump_*_loc" calls), and emitting them. Putting this in a class (rather than as global state) allows for selftesting of this code.
dump_context::~dump_context | ( | ) |
bool dump_context::apply_dump_filter_p | ( | dump_flags_t | dump_kind, |
dump_flags_t | filter ) const |
Determine if a message of kind DUMP_KIND and at the current scope depth should be printed. Only show messages that match FILTER both on their kind *and* their priority.
References m_scope_depth, MSG_ALL_KINDS, MSG_ALL_PRIORITIES, MSG_PRIORITY_INTERNALS, and MSG_PRIORITY_USER_FACING.
Referenced by dump_loc_immediate().
|
private |
Start a new optinfo and return it, ending any optinfo that was already accumulated.
References current_pass, gcc_assert, dump_metadata_t::get_dump_flags(), dump_metadata_t::get_impl_location(), NULL, and OPTINFO_KIND_NOTE.
Referenced by dump_loc().
void dump_context::begin_scope | ( | const char * | name, |
const dump_user_location_t & | user_location, | ||
const dump_impl_location_t & | impl_location ) |
Push a nested dump scope. Increment the scope depth. Print "=== NAME ===\n" to the dumpfile, if any, and to the -fopt-info destination, if any. Emit a "scope" optinfo if optinfos are enabled.
References optinfo::add_item(), alt_dump_file, alt_flags, dump_file, dump_loc(), dump_pretty_printer::emit_item(), dump_user_location_t::get_location_t(), optinfo::m_kind, make_unique(), MSG_NOTE, OPTINFO_ITEM_KIND_TEXT, OPTINFO_KIND_SCOPE, pflags, pp_formatted_text(), pp_newline(), pp_printf(), and UNKNOWN_LOCATION.
Referenced by dump_begin_scope().
void void void dump_context::dump_dec | ( | const dump_metadata_t & | metadata, |
const poly_int< N, C > & | value ) |
Referenced by dump_dec().
void dump_context::dump_dec | ( | const dump_metadata_t & | metadata, |
const poly_int< N, C > & | value ) |
Output VALUE in decimal to appropriate dump streams.
References optinfo::add_item(), dump_pretty_printer::emit_item(), dump_metadata_t::get_dump_flags(), and make_item_for_dump_dec().
void dump_context::dump_generic_expr | ( | const dump_metadata_t & | metadata, |
dump_flags_t | extra_dump_flags, | ||
tree | t ) |
Dump expression tree T using EXTRA_DUMP_FLAGS on dump streams if DUMP_KIND is enabled.
References optinfo::add_item(), dump_flags, emit_item(), ensure_pending_optinfo(), dump_metadata_t::get_dump_flags(), make_item_for_dump_generic_expr(), and optinfo_enabled_p().
Referenced by dump_generic_expr(), and dump_generic_expr_loc().
void dump_context::dump_generic_expr_loc | ( | const dump_metadata_t & | metadata, |
const dump_user_location_t & | loc, | ||
dump_flags_t | extra_dump_flags, | ||
tree | t ) |
Similar to dump_generic_expr, except additionally print the source location.
References dump_generic_expr(), and dump_loc().
Referenced by dump_generic_expr_loc().
void dump_context::dump_gimple_expr | ( | const dump_metadata_t & | metadata, |
dump_flags_t | extra_dump_flags, | ||
gimple * | gs, | ||
int | spc ) |
Dump gimple statement GS with SPC indentation spaces and EXTRA_DUMP_FLAGS on the dump streams if DUMP_KIND is enabled. Do not terminate with a newline or semicolon.
References optinfo::add_item(), dump_flags, emit_item(), ensure_pending_optinfo(), dump_metadata_t::get_dump_flags(), make_item_for_dump_gimple_expr(), and optinfo_enabled_p().
Referenced by dump_gimple_expr(), and dump_gimple_expr_loc().
void dump_context::dump_gimple_expr_loc | ( | const dump_metadata_t & | metadata, |
const dump_user_location_t & | loc, | ||
dump_flags_t | extra_dump_flags, | ||
gimple * | gs, | ||
int | spc ) |
Similar to dump_gimple_expr, except additionally print source location.
References dump_gimple_expr(), and dump_loc().
Referenced by dump_gimple_expr_loc().
void dump_context::dump_gimple_stmt | ( | const dump_metadata_t & | metadata, |
dump_flags_t | extra_dump_flags, | ||
gimple * | gs, | ||
int | spc ) |
Dump gimple statement GS with SPC indentation spaces and EXTRA_DUMP_FLAGS on the dump streams if DUMP_KIND is enabled.
References optinfo::add_item(), dump_flags, emit_item(), ensure_pending_optinfo(), dump_metadata_t::get_dump_flags(), make_item_for_dump_gimple_stmt(), and optinfo_enabled_p().
Referenced by dump_gimple_stmt(), and dump_gimple_stmt_loc().
void dump_context::dump_gimple_stmt_loc | ( | const dump_metadata_t & | metadata, |
const dump_user_location_t & | loc, | ||
dump_flags_t | extra_dump_flags, | ||
gimple * | gs, | ||
int | spc ) |
Similar to dump_gimple_stmt, except additionally print source location.
References dump_gimple_stmt(), and dump_loc().
Referenced by dump_gimple_stmt_loc().
void dump_context::dump_loc | ( | const dump_metadata_t & | metadata, |
const dump_user_location_t & | loc ) |
Print LOC to the appropriate dump destinations, given DUMP_KIND. If optinfos are enabled, begin a new optinfo.
References begin_next_optinfo(), dump_loc_immediate(), end_any_optinfo(), dump_metadata_t::get_dump_flags(), and optinfo_enabled_p().
Referenced by dump_generic_expr_loc(), dump_gimple_expr_loc(), dump_gimple_stmt_loc(), dump_loc_immediate(), and opt_problem::opt_problem().
void dump_context::dump_loc_immediate | ( | dump_flags_t | dump_kind, |
const dump_user_location_t & | loc ) |
As dump_loc above, but without starting a new optinfo.
References alt_dump_file, alt_flags, apply_dump_filter_p(), dump_file, dump_loc(), dump_user_location_t::get_location_t(), m_test_pp, m_test_pp_flags, and pflags.
Referenced by dump_loc(), and optinfo::emit_for_opt_problem().
void dump_context::dump_printf_loc_va | ( | const dump_metadata_t & | metadata, |
const dump_user_location_t & | loc, | ||
const char * | format, | ||
va_list * | ap ) |
Similar to dump_printf, except source location is also printed, and dump location captured.
References ap, dump_loc(), and pretty_printer::format().
Referenced by dump_printf_loc().
void dump_context::dump_printf_va | ( | const dump_metadata_t & | metadata, |
const char * | format, | ||
va_list * | ap ) |
Output a formatted message using FORMAT on appropriate dump streams.
References ap, errno, pretty_printer::format(), dump_metadata_t::get_dump_flags(), pp_format(), pretty_printer::pp_output_formatted_text, and dump_pretty_printer::set_optinfo().
Referenced by dump_printf().
void dump_context::dump_symtab_node | ( | const dump_metadata_t & | metadata, |
symtab_node * | node ) |
Output the name of NODE on appropriate dump streams.
References optinfo::add_item(), dump_pretty_printer::emit_item(), dump_metadata_t::get_dump_flags(), and make_item_for_dump_symtab_node().
Referenced by dump_symtab_node().
void dump_context::emit_item | ( | const optinfo_item & | item, |
dump_flags_t | dump_kind ) |
Emit ITEM to all item destinations (those that don't require consolidation into optinfo instances).
References alt_dump_file, alt_flags, dump_file, optinfo_item::get_text(), pflags, and pp_string().
Referenced by dump_generic_expr(), dump_gimple_expr(), dump_gimple_stmt(), optinfo::emit_for_opt_problem(), and dump_pretty_printer::emit_item().
void dump_context::emit_optinfo | ( | const optinfo * | info | ) |
Emit the optinfo to all of the "non-immediate" destinations (emission to "immediate" destinations is done by dump_context::emit_item).
Referenced by optinfo::emit_for_opt_problem().
void dump_context::end_any_optinfo | ( | ) |
End any optinfo that has been accumulated within this context; emitting it to any destinations as appropriate, such as optimization records.
References NULL.
Referenced by dump_loc(), and dumpfile_ensure_any_optinfo_are_flushed().
void dump_context::end_scope | ( | ) |
Pop a nested dump scope.
Referenced by dump_end_scope().
|
private |
Return the optinfo currently being accumulated, creating one if necessary.
Referenced by dump_generic_expr(), dump_gimple_expr(), and dump_gimple_stmt().
void dump_context::finish_any_json_writer | ( | ) |
Perform cleanup activity for -fsave-optimization-record. Currently, the file is written out here in one go, before cleaning up.
References m_json_writer, NULL, and optrecord_json_writer::write().
Referenced by compile_file().
|
inlinestatic |
References s_current.
Referenced by compile_file(), debug_dump_context::debug_dump_context(), do_compile(), dump_basic_block(), dump_begin_scope(), dump_dec(), dump_dec(), dump_end_scope(), dump_generic_expr(), dump_generic_expr_loc(), dump_gimple_expr(), dump_gimple_expr_loc(), dump_gimple_stmt(), dump_gimple_stmt_loc(), dump_hex(), dump_printf(), dump_printf_loc(), dump_symtab_node(), dumpfile_ensure_any_optinfo_are_flushed(), optinfo::emit_for_opt_problem(), get_dump_scope_depth(), opt_problem::opt_problem(), optinfo_wants_inlining_info_p(), set_alt_dump_file(), set_dump_file(), and debug_dump_context::~debug_dump_context().
unsigned int dump_context::get_scope_depth | ( | ) | const |
Get the current dump scope-nesting depth. For use by -fopt-info (for showing nesting via indentation).
Referenced by get_dump_scope_depth().
|
inline |
References m_json_writer, and NULL.
Referenced by optinfo_wants_inlining_info_p().
bool dump_context::optinfo_enabled_p | ( | ) | const |
Should optinfo instances be created? All creation of optinfos should be guarded by this predicate. Return true if any optinfo destinations are active.
Referenced by dump_generic_expr(), dump_gimple_expr(), dump_gimple_stmt(), dump_loc(), and refresh_dumps_are_enabled().
void dump_context::refresh_dumps_are_enabled | ( | ) |
Update the "dumps_are_enabled" global; to be called whenever dump_file or alt_dump_file change, or when changing dump_context in selftests.
References alt_dump_file, dump_file, dumps_are_enabled, m_test_pp, and optinfo_enabled_p().
Referenced by debug_dump_context::debug_dump_context(), set_alt_dump_file(), set_dump_file(), and debug_dump_context::~debug_dump_context().
void dump_context::set_json_writer | ( | optrecord_json_writer * | writer | ) |
References m_json_writer.
Referenced by do_compile().
|
friend |
|
friend |
|
private |
Referenced by finish_any_json_writer(), optimization_records_enabled_p(), and set_json_writer().
|
private |
Referenced by ~dump_context().
|
private |
Referenced by apply_dump_filter_p().
|
private |
Referenced by dump_loc_immediate(), and refresh_dumps_are_enabled().
|
private |
Referenced by dump_loc_immediate().
|
staticprivate |
The current singleton dump_context, and its default.
Referenced by debug_dump_context::debug_dump_context(), get(), and debug_dump_context::~debug_dump_context().
|
staticprivate |