summaryrefslogtreecommitdiff
path: root/gcc/dumpfile.c
AgeCommit message (Collapse)Author
2020-05-05Provide hint for misspelled -fdump-foo options.Martin Liska
gcc/ChangeLog: 2020-03-19 Martin Liska <mliska@suse.cz> * dumpfile.c (dump_switch_p): Change return type and print option suggestion. * dumpfile.h: Change return type. * opts-global.c (handle_common_deferred_options): Move error into dump_switch_p function. gcc/testsuite/ChangeLog: 2020-03-19 Martin Liska <mliska@suse.cz> * gcc.dg/spellcheck-options-22.c: New test.
2020-04-15selftest: Work around GCC 4.2 PR33916 bug by optimizing the ctor [PR89494]Gustavo Romero
GCC 4.2 due to PR33916 miscompiles temp_dump_context ctor, because it doesn't zero initialize the whole dump_context temporary on which it runs the static get method and during destruction of the temporary an uninitialized pointer is deleted. More recent GCC versions properly zero initialize it and ideally optimize away the construction/destruction of the temporary, as it isn't used for anything, but there is no reason to create the temporary, static member functions can be called without an associated object. 2020-04-15 Gustavo Romero <gromero@linux.ibm.com> PR bootstrap/89494 * dumpfile.c (selftest::temp_dump_context::temp_dump_context): Don't construct a dump_context temporary to call static method.
2020-01-01Update copyright years.Jakub Jelinek
From-SVN: r279813
2019-10-24[dump] small source cleanupNathan Sidwell
https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01760.html * dumpfile.c (dump_begin): Reorder decls to use RAII. From-SVN: r277415
2019-05-06Add lto-dump tool.Hrishikesh Kulkarni
2019-05-06 Hrishikesh Kulkarni <hrishikeshparag@gmail.com> Martin Liska <mliska@suse.cz> * Makefile.in: Add lto-dump.texi. * cgraph.h: Add new functions get_visibility_string and get_symtab_type_string. * doc/gcc.texi: Include lto-dump section. * doc/lto-dump.texi: New file. * dumpfile.c (dump_switch_p_1): Use parse_dump_option. (parse_dump_option): Factor out this function. * dumpfile.h (enum dump_flag): Add new value TDF_ERROR. (parse_dump_option): Export the function. * symtab.c (symtab_node::get_visibility_string): New function. (symtab_node::get_symtab_type_string): Likewise. 2019-05-06 Hrishikesh Kulkarni <hrishikeshparag@gmail.com> Martin Liska <mliska@suse.cz> * Make-lang.in: Add lto_dump-related definition. * config-lang.in: Likewise. * lang.opt: Add new language LTODump and options related to LTO dump tool. * lto-common.c (lto_read_decls): Support type statistics dump. (lto_file_read): Likewise for object files. * lto-dump.c: New file. * lto-lang.c (lto_option_lang_mask): Move from .. * lto.c (lto_option_lang_mask): .. here. * lto.h (lto_option_lang_mask): New declaration. Co-Authored-By: Martin Liska <mliska@suse.cz> From-SVN: r270897
2019-01-30dumpfile.c (opt_info_switch_p_1): Ignore '-' if it appears after '='.Ulrich Drepper
* dumpfile.c (opt_info_switch_p_1): Ignore '-' if it appears after '='. From-SVN: r268380
2019-01-01Update copyright years.Jakub Jelinek
From-SVN: r267494
2018-11-27Fix missing dump_impl_location_t values, using a new dump_metadata_tDavid Malcolm
The dump_* API attempts to capture emission location metadata for the various dump messages, but looking in -fsave-optimization-record shows that many dump messages are lacking useful impl_location values, instead having this location within dumpfile.c: "impl_location": { "file": "../../src/gcc/dumpfile.c", "function": "ensure_pending_optinfo", "line": 1169 }, The problem is that the auto-capturing of dump_impl_location_t is tied to dump_location_t, and this is tied to the dump_*_loc calls. If a message comes from a dump_* call without a "_loc" suffix (e.g. dump_printf), the current code synthesizes the dump_location_t within dump_context::ensure_pending_optinfo, and thus saves the useless impl_location seen above. This patch fixes things by changing the dump_* API so that, rather than taking a dump_flags_t, they take a new class dump_metadata_t, which is constructed from a dump_flags_t, but captures the emission location. Hence e.g.: dump_printf (MSG_NOTE, "some message\n"); implicitly builds a dump_metadata_t wrapping the MSG_NOTE and the emission location. If there are several dump_printf calls without a dump_*_loc call, the emission location within the optinfo is that of the first dump call within it. The patch updates selftest::test_capture_of_dump_calls to verify that the impl location of various dump_* calls is captured. I also verified things manually. gcc/ChangeLog: * dump-context.h (dump_context::dump_loc): Convert 1st param from dump_flags_t to const dump_metadata_t &. Convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_context::dump_loc_immediate): Convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_context::dump_gimple_stmt): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_context::void dump_gimple_stmt_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_context::dump_gimple_expr): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_context::dump_gimple_expr_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_context::dump_generic_expr): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_context::dump_generic_expr_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_context::dump_printf_va): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_context::dump_printf_loc_va): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_context::dump_dec): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_context::dump_symtab_node): Likewise. (dump_context::begin_scope): Split out 2nd param into user and impl locations. (dump_context::ensure_pending_optinfo): Add metadata param. (dump_context::begin_next_optinfo): Replace dump_location_t param with metadata and user location. * dumpfile.c (dump_context::dump_loc): Convert 1st param from dump_flags_t to const dump_metadata_t &. Convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_context::dump_loc_immediate): Convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_context::dump_gimple_stmt): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_context::void dump_gimple_stmt_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_context::dump_gimple_expr): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_context::dump_gimple_expr_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_context::dump_generic_expr): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_context::dump_generic_expr_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_context::dump_printf_va): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_context::dump_printf_loc_va): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_context::dump_dec): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_context::dump_symtab_node): Likewise. (dump_context::begin_scope): Split out 2nd param into user and impl locations. (dump_context::ensure_pending_optinfo): Add metadata param. (dump_context::begin_next_optinfo): Replace dump_location_t param with metadata and user location. (dump_gimple_stmt): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_gimple_stmt_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_gimple_expr): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_gimple_expr_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_generic_expr): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_generic_expr_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_printf): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_printf_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_dec): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_symtab_node): Likewise. (dump_begin_scope): Split out 2nd param into user and impl locations. (selftest::assert_impl_location_eq): New function. (ASSERT_IMPL_LOCATION_EQ): New macro. (selftest::test_impl_location): Update to use ASSERT_IMPL_LOCATION_EQ. (selftest::test_capture_of_dump_calls): Convert "loc" to dump_user_location_t. Add ASSERT_IMPL_LOCATION_EQ throughout, verifying line numbers of dump emissions. * dumpfile.h (class dump_metadata_t): New class. (dump_printf): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_printf_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_generic_expr_loc): Likewise. (dump_generic_expr): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_gimple_stmt_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_gimple_stmt): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_gimple_expr_loc): Likewise; convert 2nd param from const dump_location_t & to const dump_user_location_t &. (dump_gimple_expr): Convert 1st param from dump_flags_t to const dump_metadata_t &. (dump_symtab_node): Likewise. (dump_dec): Likewise. (dump_begin_scope): Split out 2nd param into user and impl locations. (auto_dump_scope::auto_dump_scope): Split "loc" param into a user location and impl_location, and capture the impl_location. (AUTO_DUMP_SCOPE): Rename param from LOC to USER_LOC. * loop-unroll.c (report_unroll): Update for changes to dump_printf_loc and dump_printf. * opt-problem.cc (opt_problem::opt_problem): Update for change to dump_loc. * optinfo-emit-json.cc (selftest::test_building_json_from_dump_calls): Convert "loc" from dump_location_t to dump_user_location_t. * optinfo.cc (optinfo::emit_for_opt_problem): Update for change in dump_loc_immediate. * profile.c (compute_branch_probabilities): Update for change to dump_printf_loc. * selftest.h (ASSERT_STR_CONTAINS_AT): New macro. * tree-vect-slp.c (vect_print_slp_tree): Update for change to dump_printf_loc. From-SVN: r266501
2018-11-19Fix -fsave-optimization-record ICE (PR tree-optimization/87025)David Malcolm
PR tree-optimization/87025 reports an ICE within -fsave-optimization-record's optrecord_json_writer. The issue is that dump_context::begin_scope creates an optinfo of kind OPTINFO_KIND_SCOPE, but fails to call dump_context::end_any_optinfo, so the optinfo for the scope remains pending. The JSON writer would normally push a JSON array for the "scope" optinfo when the latter is emitted. However, if a dump_* call happens that doesn't flush the "scope" optinfo e.g. dump_printf (as opposed to dump_printf_loc), that dump_ call is added to the pending optinfo, and optinfo::handle_dump_file_kind changes the pending optinfo's m_kind (e.g. to OPTINFO_KIND_NOTE). Hence when the pending optinfo is eventually emitted, it isn't OPTINFO_KIND_SCOPE anymore, and hence the JSON writer doesn't create and push a JSON array for it, leading to dump_context's view of scopes getting out-of-sync with that of the JSON writer's. Later, dump_context::end_scope unconditionally tries to pop the JSON scope array, but no JSON scope array was added, leading to an assertion failure (or crash). The fix is to call dump_context::end_any_optinfo immediately after creating the scope optinfo, so that it is emitted immediately, ensuring that the JSON writer stays in-sync with the dump_context. gcc/ChangeLog: PR tree-optimization/87025 * dumpfile.c (dump_context::begin_scope): Call end_any_optinfo immediately after creating the scope optinfo. (selftest::test_pr87025): New function. (selftest::dumpfile_c_tests): Call it. * optinfo-emit-json.cc (optrecord_json_writer::pop_scope): Assert that we're not popping the top-level records array. * optinfo.cc (optinfo::handle_dump_file_kind): Assert that we're not changing the kind of a "scope" optinfo. gcc/testsuite/ChangeLog: PR tree-optimization/87025 * gcc.dg/pr87025.c: New test. From-SVN: r266280
2018-11-19Eliminate global state from -fsave-optimization-recordDavid Malcolm
As work towards fixing PR tree-optimization/87025, this patch eliminates global state from optinfo-emit-json.cc in favor of adding an optional m_json_writer field to dump_context, replacing the m_forcibly_enable_optinfo flag. This allows for writing selftests for the interaction of the JSON-building code with the dumpfile.c code. In particular, the existing selftest that created optinfo instances now exercise the JSON-building code (although no JSON is actually written out). The patch also simplifies the layering by replacing optinfo::emit () with dump_context::emit_optinfo, so that dump_context has responsibility for keeping track of dump destinations. gcc/ChangeLog: PR tree-optimization/87025 * dump-context.h: Include "optinfo.h". (class optrecord_json_writer): New forward decl. (dump_context::forcibly_enable_optinfo_p): Delete. (dump_context::optinfo_enabled_p): New member function. (dump_context::optimization_records_enabled_p): New member function. (dump_context::set_json_writer): New member function. (dump_context::emit_optinfo): New member function. (dump_context::m_forcibly_enable_optinfo): Delete. (dump_context::m_json_writer): New member data. * dumpfile.c (dump_context::set_json_writer): New member function. (dump_context::finish_any_json_writer): New member function. (dump_context::end_scope): Replace call to optimization_records_maybe_pop_dump_scope with call to m_json_writer->pop_scope. (dump_context::optinfo_enabled_p): New member function. (dump_context::end_any_optinfo): Replace call to optinfo::emit with call to dump_context::emit_optinfo. (dump_context::emit_optinfo): New member function. (temp_dump_context::temp_dump_context): Replace m_forcibly_enable_optinfo with call to set_json_writer. (temp_dump_context::~temp_dump_context): Clean up any json writer. * optinfo-emit-json.cc (class optrecord_json_writer): Move to optinfo-emit-json.h (the_json_writer): Delete. (optimization_records_start): Delete. (optimization_records_finish): Delete. (optimization_records_enabled_p): Delete, in favor of dump_context::optimization_records_enabled_p. (optimization_records_maybe_record_optinfo): Delete. (optimization_records_maybe_pop_dump_scope): Delete. * optinfo-emit-json.h: Include "json.h". Delete forward decl of opt_pass. (optimization_records_start): Delete. (optimization_records_finish): Delete. (optimization_records_enabled_p): Delete. (optimization_records_maybe_record_optinfo): Delete. (optimization_records_maybe_pop_dump_scope): Delete. (class optrecord_json_writer): Move here from optinfo-emit-json.cc. * optinfo.cc (optinfo::emit_for_opt_problem): Replace call to optinfo::emit with call to dump_context::emit_optinfo. (optinfo::emit): Delete, in favor of dump_context::emit_optinfo. (optinfo_enabled_p): Delete, in favor of dump_context::optinfo_enabled_p. (optinfo_wants_inlining_info_p): Update for conversion o optimization_records_enabled_p to a member function of dump_context. * optinfo.h (optinfo_enabled_p): Delete, in favor of dump_context::optinfo_enabled_p. (optinfo::emit): Delete, in favor of dump_context::emit_optinfo. * toplev.c: Include "dump-context.h". (compile_file): Replace call to optimization_records_finish with dump_context::finish_any_json_writer. (do_compile): Replace call to optimization_records_start with conditionally creating a optrecord_json_writer for the dump_context. From-SVN: r266279
2018-11-13Eliminate source_location in favor of location_tDavid Malcolm
Historically GCC used location_t, while libcpp used source_location. This inconsistency has been annoying me for a while, so this patch removes source_location in favor of location_t throughout (as the latter is shorter). gcc/ChangeLog: * builtins.c: Replace "source_location" with "location_t". * diagnostic-show-locus.c: Likewise. * diagnostic.c: Likewise. * dumpfile.c: Likewise. * gcc-rich-location.h: Likewise. * genmatch.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * input.c: Likewise. * input.h: Likewise. Eliminate the typedef. * omp-expand.c: Likewise. * selftest.h: Likewise. * substring-locations.h (get_source_location_for_substring): Rename to.. (get_location_within_string): ...this. * tree-cfg.c: Replace "source_location" with "location_t". * tree-cfgcleanup.c: Likewise. * tree-diagnostic.c: Likewise. * tree-into-ssa.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-phinodes.h: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa.c: Likewise. * tree-ssa.h: Likewise. * tree-vect-loop-manip.c: Likewise. gcc/c-family/ChangeLog: * c-common.c (c_get_substring_location): Update for renaming of get_source_location_for_substring to get_location_within_string. * c-lex.c: Replace "source_location" with "location_t". * c-opts.c: Likewise. * c-ppoutput.c: Likewise. gcc/c/ChangeLog: * c-decl.c: Replace "source_location" with "location_t". * c-tree.h: Likewise. * c-typeck.c: Likewise. * gimple-parser.c: Likewise. gcc/cp/ChangeLog: * call.c: Replace "source_location" with "location_t". * cp-tree.h: Likewise. * cvt.c: Likewise. * name-lookup.c: Likewise. * parser.c: Likewise. * typeck.c: Likewise. gcc/fortran/ChangeLog: * cpp.c: Replace "source_location" with "location_t". * gfortran.h: Likewise. gcc/go/ChangeLog: * go-gcc-diagnostics.cc: Replace "source_location" with "location_t". * go-gcc.cc: Likewise. * go-linemap.cc: Likewise. * go-location.h: Likewise. * gofrontend/README: Likewise. gcc/jit/ChangeLog: * jit-playback.c: Replace "source_location" with "location_t". gcc/testsuite/ChangeLog: * g++.dg/plugin/comment_plugin.c: Replace "source_location" with "location_t". * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Likewise. libcc1/ChangeLog: * libcc1plugin.cc: Replace "source_location" with "location_t". (plugin_context::get_source_location): Rename to... (plugin_context::get_location_t): ...this. * libcp1plugin.cc: Likewise. libcpp/ChangeLog: * charset.c: Replace "source_location" with "location_t". * directives-only.c: Likewise. * directives.c: Likewise. * errors.c: Likewise. * expr.c: Likewise. * files.c: Likewise. * include/cpplib.h: Likewise. Rename MAX_SOURCE_LOCATION to MAX_LOCATION_T. * include/line-map.h: Likewise. * init.c: Likewise. * internal.h: Likewise. * lex.c: Likewise. * line-map.c: Likewise. * location-example.txt: Likewise. * macro.c: Likewise. * pch.c: Likewise. * traditional.c: Likewise. From-SVN: r266085
2018-11-13Ensure that dump calls are guarded with dump_enabled_pDavid Malcolm
If called when !dump_enabled_p, the dump_* functions effectively do nothing, but as of r263178 this doing "nothing" involves non-trivial work internally. I wasn't sure whether the dump_* functions should assert that dump_enabled_p () is true when they're called, or if they should bail out immediately for this case, so in this patch I implemented both, so that we get an assertion failure, and otherwise bail out for the case where !dump_enabled_p when assertions are disabled. The patch also fixes all of the places I found during testing (on x86_64-pc-linux-gnu) that call into dump_* but which weren't guarded by if (dump_enabled_p ()) gcc/ChangeLog: * dumpfile.c (VERIFY_DUMP_ENABLED_P): New macro. (dump_gimple_stmt): Use it. (dump_gimple_stmt_loc): Likewise. (dump_gimple_expr): Likewise. (dump_gimple_expr_loc): Likewise. (dump_generic_expr): Likewise. (dump_generic_expr_loc): Likewise. (dump_printf): Likewise. (dump_printf_loc): Likewise. (dump_dec): Likewise. (dump_dec): Likewise. (dump_hex): Likewise. (dump_symtab_node): Likewise. gcc/ChangeLog: * gimple-loop-interchange.cc (tree_loop_interchange::interchange): Guard dump call with dump_enabled_p. * graphite-isl-ast-to-gimple.c (graphite_regenerate_ast_isl): Likewise. * graphite-optimize-isl.c (optimize_isl): Likewise. * graphite.c (graphite_transform_loops): Likewise. * tree-loop-distribution.c (pass_loop_distribution::execute): Likewise. * tree-parloops.c (parallelize_loops): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_exit): Likewise. * tree-vect-data-refs.c (vect_analyze_group_access_1): Likewise. (vect_prune_runtime_alias_test_list): Likewise. * tree-vect-loop.c (vect_update_vf_for_slp): Likewise. (vect_estimate_min_profitable_iters): Likewise. * tree-vect-slp.c (vect_record_max_nunits): Likewise. (vect_build_slp_tree_2): Likewise. (vect_supported_load_permutation_p): Likewise. (vect_slp_analyze_operations): Likewise. (vect_slp_analyze_bb_1): Likewise. (vect_slp_bb): Likewise. * tree-vect-stmts.c (vect_analyze_stmt): Likewise. * tree-vectorizer.c (try_vectorize_loop_1): Likewise. (pass_slp_vectorize::execute): Likewise. (increase_alignment): Likewise. From-SVN: r266080
2018-11-08dump_printf: add "%C" for dumping cgraph_node *David Malcolm
This patch implements support for %C in dump_printf for dumping cgraph_node *. (I would have preferred to have a code for printing symtab_node * and both subclasses, but there doesn't seem to be a good way for -Wformat to handle inheritance, so, failing that, I went with this approach). gcc/c-family/ChangeLog: * c-format.c (local_cgraph_node_ptr_node): New variable. (gcc_dump_printf_char_table): Add entry for %C. (get_pointer_to_named_type): New function, taken from the handling code for "gimple *" from... (init_dynamic_diag_info): ...here. Add handling for "cgraph_node *". * c-format.h (T_CGRAPH_NODE): New. gcc/ChangeLog: * dump-context.h (ASSERT_IS_CGRAPH_NODE): New macro. * dumpfile.c (make_item_for_dump_cgraph_node): Move to before... (dump_pretty_printer::decode_format): Implement "%C" for cgraph_node *. (selftest::test_capture_of_dump_calls): Rename "where" to "stmt_loc". Convert test_decl to a function decl and set its location. Add a symbol_table_test RAII instance and a cgraph_node, using it to test "%C" and dump_symtab_node. gcc/testsuite/ChangeLog: * gcc.dg/format/gcc_diag-10.c (cgraph_node): New typedef. (test_dump): Add testing of %C. From-SVN: r265918
2018-10-04Report vectorization problems via a new opt_problem classDavid Malcolm
This is v3 of the patch; previous versions were: v2: https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00446.html v1: https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01462.html This patch introduces a class opt_problem, along with wrapper classes for bool (opt_result) and for pointers (e.g. opt_loop_vec_info for loop_vec_info). opt_problem instances are created when an optimization problem is encountered, but only if dump_enabled_p. They are manually propagated up the callstack, and are manually reported at the "top level" of an optimization if dumping is enabled, to give the user a concise summary of the problem *after* the failure is reported. In particular, the location of the problematic statement is captured and emitted, rather than just the loop's location. For example: no-vfa-vect-102.c:24:3: missed: couldn't vectorize loop no-vfa-vect-102.c:27:7: missed: statement clobbers memory: __asm__ __volatile__("" : : : "memory"); Changed in v3: * This version bootstraps and passes regression testing (on x86_64-pc-linux-gnu). * added selftests, to exercise the opt_problem machinery * removed the "bool to opt_result" ctor, so that attempts to use e.g. return a bool from an opt_result-returning function will fail at compile time * use formatted printing within opt_problem ctor to replace the various dump_printf_loc calls * dropped i18n * changed the sense of vect_analyze_data_ref_dependence's return value (see the ChangeLog) * add MSG_PRIORITY_REEMITTED, so that -fopt-info can show the messages, without them messing up the counts in scan-tree-dump-times in DejaGnu tests gcc/ChangeLog: * Makefile.in (OBJS): Add opt-problem.o. * dump-context.h: Include "selftest.h. (selftest::temp_dump_context): New forward decl. (class dump_context): Make friend of class selftest::temp_dump_context. (dump_context::dump_loc_immediate): New decl. (class dump_pretty_printer): Move here from dumpfile.c. (class temp_dump_context): Move to namespace selftest. (temp_dump_context::temp_dump_context): Add param "forcibly_enable_dumping". (selftest::verify_dumped_text): (ASSERT_DUMPED_TEXT_EQ): Move here from dumpfile.c. (selftest::verify_item): (ASSERT_IS_TEXT): Move here from dumpfile.c. (ASSERT_IS_TREE): Likewise. (ASSERT_IS_GIMPLE): Likewise. * dumpfile.c (dump_context::dump_loc): Move immediate dumping to... (dump_context::dump_loc_immediate): ...this new function. (class dump_pretty_printer): Move to dump-context.h. (dump_switch_p_1): Don't enable MSG_PRIORITY_REEMITTED. (opt_info_switch_p_1): Enable MSG_PRIORITY_REEMITTED. (temp_dump_context::temp_dump_context): Move to "selftest" namespace. Add param "forcibly_enable_dumping", and use it to conditionalize the use of m_pp; (selftest::verify_dumped_text): Make non-static. (ASSERT_DUMPED_TEXT_EQ): Move to dump-context.h. (selftest::verify_item): Make non-static. (ASSERT_IS_TEXT): Move to dump-context.h. (ASSERT_IS_TREE): Likewise. (ASSERT_IS_GIMPLE): Likewise. (selftest::test_capture_of_dump_calls): Pass "true" for new param of temp_dump_context. * dumpfile.h (enum dump_flag): Add MSG_PRIORITY_REEMITTED, adding it to MSG_ALL_PRIORITIES. Update values of TDF_COMPARE_DEBUG and TDF_COMPARE_DEBUG. * opt-problem.cc: New file. * opt-problem.h: New file. * optinfo-emit-json.cc (selftest::test_building_json_from_dump_calls): Pass "true" for new param of temp_dump_context. * optinfo.cc (optinfo_kind_to_dump_flag): New function. (optinfo::emit_for_opt_problem): New function. (optinfo::emit): Clarity which emit_item is used. * optinfo.h (optinfo::get_dump_location): New accessor. (optinfo::emit_for_opt_problem): New decl. (optinfo::emit): Make const. * selftest-run-tests.c (selftest::run_tests): Call selftest::opt_problem_cc_tests. * selftest.h (selftest::opt_problem_cc_tests): New decl. * tree-data-ref.c (dr_analyze_innermost): Convert return type from bool to opt_result, converting fprintf messages to opt_result::failure_at calls. Add "stmt" param for use by the failure_at calls. (create_data_ref): Pass "stmt" to the dr_analyze_innermost call. (runtime_alias_check_p): Convert return type from bool to opt_result, converting dump_printf calls to opt_result::failure_at, using the statement DDR_A for their location. (find_data_references_in_stmt): Convert return type from bool to opt_result, converting "return false" to opt_result::failure_at with a new message. * tree-data-ref.h: Include "opt-problem.h". (dr_analyze_innermost): Convert return type from bool to opt_result, and add a const gimple * param. (find_data_references_in_stmt): Convert return type from bool to opt_result. (runtime_alias_check_p): Likewise. * tree-predcom.c (find_looparound_phi): Pass "init_stmt" to dr_analyze_innermost. * tree-vect-data-refs.c (vect_mark_for_runtime_alias_test): Convert return type from bool to opt_result, adding a message for the PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS zero case. (vect_analyze_data_ref_dependence): Convert return type from bool to opt_result. Change sense of return type from "false" effectively meaning "no problems" to "false" meaning a problem, so that "return false" becomes "return opt_result::success". Convert "return true" calls to opt_result::failure_at, using the location of statement A rather than vect_location. (vect_analyze_data_ref_dependences): Convert return type from bool to opt_result. (verify_data_ref_alignment): Likewise, converting dump_printf_loc calls to opt_result::failure_at, using the stmt location rather than vect_location. (vect_verify_datarefs_alignment): Convert return type from bool to opt_result. (vect_enhance_data_refs_alignment): Likewise. Split local "stat" into multiple more-tightly-scoped copies. (vect_analyze_data_refs_alignment): Convert return type from bool to opt_result. (vect_analyze_data_ref_accesses): Likewise, converting a "return false" to a "return opt_result::failure_at", adding a new message. (vect_prune_runtime_alias_test_list): Convert return type from bool to opt_result, converting dump_printf_loc to opt_result::failure_at. Add a %G to show the pertinent statement, and use the stmt's location rather than vect_location. (vect_find_stmt_data_reference): Convert return type from bool to opt_result, converting dump_printf_loc to opt_result::failure_at, using stmt's location. (vect_analyze_data_refs): Convert return type from bool to opt_result. Convert "return false" to "return opt_result::failure_at", adding messages as needed. * tree-vect-loop.c (vect_determine_vf_for_stmt_1): Convert return type from bool to opt_result. (vect_determine_vf_for_stmt): Likewise. (vect_determine_vectorization_factor): Likewise, converting dump_printf_loc to opt_result::failure_at, using location of phi rather than vect_location. (vect_analyze_loop_form_1): Convert return type from bool to opt_result, converting dump_printf_loc calls, retaining the use of vect_location. (vect_analyze_loop_form): Convert return type from loop_vec_info to opt_loop_vec_info. (vect_analyze_loop_operations): Convert return type from bool to opt_result, converting dump_printf_loc calls, using the location of phi/stmt rather than vect_location where available. Convert various "return false" to "return opt_result::failure_at" with "unsupported phi" messages. (vect_get_datarefs_in_loop): Convert return type from bool to opt_result. Add a message for the PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS failure. (vect_analyze_loop_2): Convert return type from bool to opt_result. Ensure "ok" is set to a opt_result::failure_at before each "goto again;", adding new messages where needed. Add "unsupported grouped {store|load}" messages. (vect_analyze_loop): Convert return type from loop_vec_info to opt_loop_vec_info. * tree-vect-slp.c (vect_analyze_slp): Convert return type from bool to opt_result. * tree-vect-stmts.c (process_use): Likewise, converting dump_printf_loc call and using stmt location, rather than vect_location. (vect_mark_stmts_to_be_vectorized): Likeise. (vect_analyze_stmt): Likewise, adding a %G. (vect_get_vector_types_for_stmt): Convert return type from bool to opt_result, converting dump_printf_loc calls and using stmt location, rather than vect_location. (vect_get_mask_type_for_stmt): Convert return type from tree to opt_tree, converting dump_printf_loc calls and using stmt location. * tree-vectorizer.c: Include "opt-problem.h. (try_vectorize_loop_1): Flag "Analyzing loop at" dump message as MSG_PRIORITY_INTERNALS. Convert local "loop_vinfo" from loop_vec_info to opt_loop_vec_info. If if fails, and dumping is enabled, use it to report at the top level "couldn't vectorize loop" followed by the problem. * tree-vectorizer.h (opt_loop_vec_info): New typedef. (vect_mark_stmts_to_be_vectorized): Convert return type from bool to opt_result. (vect_analyze_stmt): Likewise. (vect_get_vector_types_for_stmt): Likewise. (tree vect_get_mask_type_for_stmt): Likewise. (vect_analyze_data_ref_dependences): Likewise. (vect_enhance_data_refs_alignment): Likewise. (vect_analyze_data_refs_alignment): Likewise. (vect_verify_datarefs_alignment): Likewise. (vect_analyze_data_ref_accesses): Likewise. (vect_prune_runtime_alias_test_list): Likewise. (vect_find_stmt_data_reference): Likewise. (vect_analyze_data_refs): Likewise. (vect_analyze_loop): Convert return type from loop_vec_info to opt_loop_vec_info. (vect_analyze_loop_form): Likewise. (vect_analyze_slp): Convert return type from bool to opt_result. gcc/testsuite/ChangeLog: * gcc.dg/vect/nodump-vect-opt-info-2.c: New test. * gcc.dg/vect/vect-alias-check-4.c: Add "-fopt-info-vec-all" to dg-additional-options. Add dg-message and dg-missed directives to verify that -fopt-info messages are written at the correct locations. From-SVN: r264852
2018-10-04Add -fopt-info-internalsDavid Malcolm
This patch introduces a verbosity level to dump messages: "user-facing" vs "internals". By default, messages at the top-level dump scope are "user-facing", whereas those that are in nested scopes are implicitly "internals", and are filtered out by -fopt-info unless a new "-internals" sub-option of "-fopt-info" is supplied (intended purely for use by GCC developers). Dumpfiles are unaffected by the change. Given that the vectorizer is the only subsystem using AUTO_DUMP_SCOPE (via DUMP_VECT_SCOPE), this only affects the vectorizer. Filtering out these implementation-detail messages goes a long way towards making -fopt-info-vec-all more accessible to advanced end-users; the follow-up patch restores the most pertinent missing details. gcc/ChangeLog: * doc/invoke.texi (-fopt-info): Document new "internals" sub-option. * dump-context.h (dump_context::apply_dump_filter_p): New decl. * dumpfile.c (dump_options): Update for renaming of MSG_ALL to MSG_ALL_KINDS. (optinfo_verbosity_options): Add "internals". (kind_as_string): Update for renaming of MSG_ALL to MSG_ALL_KINDS. (dump_context::apply_dump_filter_p): New member function. (dump_context::dump_loc): Use apply_dump_filter_p rather than explicitly masking the dump_kind. (dump_context::begin_scope): Increment the scope depth first. Use apply_dump_filter_p rather than explicitly masking the dump_kind. (dump_context::emit_item): Use apply_dump_filter_p rather than explicitly masking the dump_kind. (dump_dec): Likewise. (dump_hex): Likewise. (dump_switch_p_1): Default to MSG_ALL_PRIORITIES. (opt_info_switch_p_1): Default to MSG_PRIORITY_USER_FACING. (opt_info_switch_p): Update handling of default MSG_OPTIMIZED_LOCATIONS to cope with default of MSG_PRIORITY_USER_FACING. (dump_basic_block): Use apply_dump_filter_p rather than explicitly masking the dump_kind. (selftest::test_capture_of_dump_calls): Update test_dump_context instances to use MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING rather than MSG_ALL. Generalize scope test to be run at all four combinations of with/without MSG_PRIORITY_USER_FACING and MSG_PRIORITY_INTERNALS, adding examples of explicit priority for each of the two values. * dumpfile.h (enum dump_flag): Add comment about the MSG_* flags. Rename MSG_ALL to MSG_ALL_KINDS. Add MSG_PRIORITY_USER_FACING, MSG_PRIORITY_INTERNALS, and MSG_ALL_PRIORITIES, updating the values for TDF_COMPARE_DEBUG and TDF_ALL_VALUES. (AUTO_DUMP_SCOPE): Add a note to the comment about the interaction with MSG_PRIORITY_*. * tree-vect-loop-manip.c (vect_loop_versioning): Mark versioning dump messages as MSG_PRIORITY_USER_FACING. * tree-vectorizer.h (DUMP_VECT_SCOPE): Add a note to the comment about the interaction with MSG_PRIORITY_*. gcc/testsuite/ChangeLog: * gcc.dg/plugin/dump-1.c: Update expected output for test_scopes due to "-internals" not being selected. * gcc.dg/plugin/dump-2.c: New test, based on dump-1.c, with "-internals" added to re-enable the output from test_scopes. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add dump-2.c. From-SVN: r264851
2018-10-04Fix -fopt-info for plugin passesDavid Malcolm
Attempts to dump via -fopt-info from a plugin pass fail, due to the dfi->alt_state for such passes never being set. This is because the -fopt-info options were being set up per-pass during option-parsing (via gcc::dump_manager::opt_info_enable_passes), but this data was not retained or used it for passes created later (for plugins and target-specific passes). This patch fixes the issue by storing the -fopt-info options into gcc::dump_manager, refactoring the dfi-setup code out of opt_info_enable_passes, and reusing it for such passes, fixing the issue. The patch adds a demo plugin to test that dumping from a plugin works. gcc/ChangeLog: * dumpfile.c (gcc::dump_manager::dump_manager): Initialize new fields. (gcc::dump_manager::~dump_manager): Free m_optinfo_filename. (gcc::dump_manager::register_pass): New member function, adapted from loop body in gcc::pass_manager::register_pass, adding a call to update_dfi_for_opt_info. (gcc::dump_manager::opt_info_enable_passes): Store the -fopt-info options into the new fields. Move the loop bodies into... (gcc::dump_manager::update_dfi_for_opt_info): ...this new member function. * dumpfile.h (struct opt_pass): New forward decl. (gcc::dump_manager::register_pass): New decl. (gcc::dump_manager::update_dfi_for_opt_info): New decl. (class gcc::dump_manager): Add fields "m_optgroup_flags", "m_optinfo_flags", and "m_optinfo_filename". * passes.c (gcc::pass_manager::register_pass): Move all of the dump-handling code to gcc::dump_manager::register_pass. gcc/testsuite/ChangeLog: * gcc.dg/plugin/dump-1.c: New test. * gcc.dg/plugin/dump_plugin.c: New test plugin. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add the above. From-SVN: r264844
2018-09-28dumpfile.c: use prefixes other than 'note: ' for ↵David Malcolm
MSG_{OPTIMIZED_LOCATIONS|MISSED_OPTIMIZATION} As noted at Cauldron, dumpfile.c currently emits "note: " for all kinds of dump message, so that (after filtering) there's no distinction between MSG_OPTIMIZED_LOCATIONS vs MSG_NOTE vs MSG_MISSED_OPTIMIZATION in the textual output. This patch changes dumpfile.c so that the "note: " varies to show which MSG_* was used, with the string prefix matching that used for filtering in -fopt-info, hence e.g. directive_unroll_3.f90:24:0: optimized: loop unrolled 7 times and: pr19210-1.c:24:3: missed: missed loop optimization: niters analysis ends up with assumptions. The patch adds "dg-optimized" and "dg-missed" directives for use in the testsuite for matching these (with -fopt-info on stderr; they don't help for dumpfile output). The patch also converts the various problem-reporting dump messages in coverage.c:get_coverage_counts to use MSG_MISSED_OPTIMIZATION rather than MSG_OPTIMIZED_LOCATIONS, as the docs call out "optimized" as "information when an optimization is successfully applied", whereas "missed" is for "information about missed optimizations", and problems with profile data seem to me to fall much more into the latter category than the former. Doing so requires converting a few tests from using "-fopt-info" (which is implicitly "-fopt-info-optimized-optall") to getting the "missed" optimizations. Changing them to "-fopt-info-missed" added lots of noise from the vectorizer, so I changed these tests to use "-fopt-info-missed-ipa". gcc/ChangeLog: * coverage.c (get_coverage_counts): Convert problem-reporting dump messages from MSG_OPTIMIZED_LOCATIONS to MSG_MISSED_OPTIMIZATION. * dumpfile.c (kind_as_string): New function. (dump_loc): Rather than a hardcoded prefix of "note: ", use kind_as_string to vary the prefix based on dump_kind. (selftest::test_capture_of_dump_calls): Update for above. gcc/testsuite/ChangeLog: * c-c++-common/unroll-1.c: Update expected output from "note" to "optimized". * c-c++-common/unroll-2.c: Likewise. * c-c++-common/unroll-3.c: Likewise. * g++.dg/tree-ssa/dom-invalid.C: Update expected output from dg-message to dg-missed. Convert param from -fopt-info to -fopt-info-missed-ipa. * g++.dg/tree-ssa/pr81408.C: Update expected output from dg-message to dg-missed. * g++.dg/vect/slp-pr56812.cc: Update expected output from dg-message to dg-optimized. * gcc.dg/pr26570.c: Update expected output from dg-message to dg-missed. Convert param from -fopt-info to -fopt-info-missed-ipa. * gcc.dg/pr32773.c: Likewise. * gcc.dg/tree-ssa/pr19210-1.c: Update expected output from dg-message to dg-missed. * gcc.dg/unroll-2.c: Update expected output from dg-message to dg-optimized. * gcc.dg/vect/nodump-vect-opt-info-1.c: Likewise. Convert param from -fopt-info to -fopt-info-vec. * gfortran.dg/directive_unroll_1.f90: Update expected output from "note" to "optimized". * gfortran.dg/directive_unroll_2.f90: Likewise. * gfortran.dg/directive_unroll_3.f90: Likewise. * gnat.dg/unroll4.adb: Likewise. * lib/gcc-dg.exp (dg-optimized): New procedure. (dg-missed): New procedure. From-SVN: r264697
2018-09-25Fix small coding style issues (PR fortran/87394).Martin Liska
2018-09-25 Martin Liska <mliska@suse.cz> PR fortran/87394 * dbgcnt.c (dbg_cnt_process_single_pair): Return false instead of NULL. * dumpfile.c (dump_enable_all): Remove extra parenthesis. * gcov-tool.c: Declare the function with ATTRIBUTE_NORETURN. * godump.c (go_format_type): Remove extra parenthesis. 2018-09-25 Martin Liska <mliska@suse.cz> PR fortran/87394 * decl.c (add_hidden_procptr_result): Simplify condition as we are in branch witch 'case1 || case2'. From-SVN: r264562
2018-09-21dumpfile.c: fix stray dump_loc output (PR tree-optimization/87309)David Malcolm
In r262891 I reimplemented this call: dump_printf_loc (MSG_NOTE, loc, "=== %s ===\n", name); in dump_begin_scope to use direct calls to dump_loc: if (dump_file) { dump_loc (MSG_NOTE, dump_file, loc.get_location_t ()); fprintf (dump_file, "=== %s ===\n", name); } if (alt_dump_file) { dump_loc (MSG_NOTE, alt_dump_file, loc.get_location_t ()); fprintf (alt_dump_file, "=== %s ===\n", name); } However ::dump_loc doesn't filter with pflags and alt_flags. This lead to stray output of the form: test.cpp:1:6: note: test.cpp:1:11: note: when using -fopt-info with "optimized" or "missed". This patch adds this missing filtering, eliminating the stray partial note output. gcc/ChangeLog: PR tree-optimization/87309 * dumpfile.c (dump_context::begin_scope): Filter the dump_loc calls with pflags and alt_flags. (selftest::test_capture_of_dump_calls): Add test of interaction of MSG_OPTIMIZED_LOCATIONS with AUTO_DUMP_SCOPE. gcc/testsuite/ChangeLog: PR tree-optimization/87309 * gcc.dg/pr87309.c: New test. From-SVN: r264481
2018-08-17Formatted printing for dump_* in the middle-endDavid Malcolm
This patch converts dump_print and dump_printf_loc from using printf (and thus ATTRIBUTE_PRINTF) to using a new pretty-printer based on pp_format, which supports formatting middle-end types. In particular, the following codes are implemented (in addition to the standard pretty_printer ones): %E: gimple *: Equivalent to: dump_gimple_expr (MSG_*, TDF_SLIM, stmt, 0) %G: gimple *: Equivalent to: dump_gimple_stmt (MSG_*, TDF_SLIM, stmt, 0) %T: tree: Equivalent to: dump_generic_expr (MSG_*, arg, TDF_SLIM). Hence it becomes possible to convert e.g.: if (dump_enabled_p ()) { dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, "not vectorized: different sized vector " "types in statement, "); dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, vectype); dump_printf (MSG_MISSED_OPTIMIZATION, " and "); dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, nunits_vectype); dump_printf (MSG_MISSED_OPTIMIZATION, "\n"); } into a one-liner: if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, "not vectorized: different sized vector " "types in statement, %T and %T\n", vectype, nunits_vectype); Unlike regular pretty-printers, this one captures optinfo_item instances for the formatted chunks as appropriate, so that when written out to a JSON optimization record, the relevant parts of the message are labelled by type, and by source location (so that e.g. %G is entirely equivalent to using dump_gimple_stmt). dump_printf and dump_printf_loc become marked with ATTRIBUTE_GCC_DUMP_PRINTF, which the patch also implements. gcc/c-family/ChangeLog: * c-format.c (enum format_type): Add gcc_dump_printf_format_type. (gcc_dump_printf_length_specs): New. (gcc_dump_printf_flag_pairs): New. (gcc_dump_printf_flag_specs): New. (gcc_dump_printf_char_table): New. (format_types_orig): Add entry for "gcc_dump_printf". (init_dynamic_diag_info): Set up length_char_specs and conversion_specs for gcc_dump_printf_format_type. (handle_format_attribute): Handle gcc_dump_printf_format_type. gcc/ChangeLog: * dump-context.h: Include "dumpfile.h". (dump_context::dump_printf_va): Convert final param from va_list to va_list *. Convert from ATTRIBUTE_PRINTF to ATTRIBUTE_GCC_DUMP_PRINTF. (dump_context::dump_printf_loc_va): Likewise. * dumpfile.c: Include "stringpool.h". (make_item_for_dump_printf_va): Delete. (make_item_for_dump_printf): Delete. (class dump_pretty_printer): New class. (dump_pretty_printer::dump_pretty_printer): New ctor. (dump_pretty_printer::emit_items): New member function. (dump_pretty_printer::emit_any_pending_textual_chunks): New member function. (dump_pretty_printer::emit_item): New member function. (dump_pretty_printer::stash_item): New member function. (dump_pretty_printer::format_decoder_cb): New member function. (dump_pretty_printer::decode_format): New member function. (dump_context::dump_printf_va): Reimplement in terms of dump_pretty_printer. (dump_context::dump_printf_loc_va): Convert final param from va_list to va_list *. (dump_context::begin_scope): Reimplement call to make_item_for_dump_printf. (dump_printf): Update for change to dump_printf_va. (dump_printf_loc): Likewise. (selftest::test_capture_of_dump_calls): Convert "stmt" from greturn * to gimple *. Add a test_decl. Add tests of dump_printf with %T, %E, and %G. * dumpfile.h (ATTRIBUTE_GCC_DUMP_PRINTF): New macro. (dump_printf): Replace ATTRIBUTE_PRINTF_2 with ATTRIBUTE_GCC_DUMP_PRINTF (2, 3). (dump_printf_loc): Replace ATTRIBUTE_PRINTF_3 with ATTRIBUTE_GCC_DUMP_PRINTF (3, 0). * tree-vect-data-refs.c (vect_lanes_optab_supported_p): Convert use of HOST_WIDE_INT_PRINT_DEC on unsigned HOST_WIDE_INT "count" within a dump_printf_loc call to "%wu". (vector_alignment_reachable_p): Merge two dump_printf[_loc] calls, converting a use of HOST_WIDE_INT_PRINT_DEC to "%wd". Add a missing space after "=". * tree-vect-loop.c (vect_analyze_loop_2) Within a dump_printf call, convert use of HOST_WIDE_INT_PRINT_DEC to "%wd". * tree-vect-slp.c (vect_slp_bb): Within a dump_printf_loc call, convert use of HOST_WIDE_INT_PRINT_UNSIGNED to "%wu". * tree-vectorizer.c (try_vectorize_loop_1): Likewise. Remove duplicate "vectorized" from message. gcc/testsuite/ChangeLog: * gcc.dg/format/gcc_diag-1.c: Fix typo. Add test coverage for gcc_dump_printf. * gcc.dg/format/gcc_diag-10.c: Add gimple typedef. Add test coverage for gcc_dump_printf. From-SVN: r263626
2018-08-02dumpfile.c/h: add "const" to dump location ctorsDavid Malcolm
gcc/ChangeLog: * dumpfile.c (dump_user_location_t::dump_user_location_t): Add "const" to the "gimple *" and "rtx_insn *" parameters. * dumpfile.h (dump_user_location_t::dump_user_location_t): Likewise. (dump_location_t::dump_location_t): Likewise. From-SVN: r263244
2018-07-31dumpfile.c: eliminate special-casing of dump_file/alt_dump_fileDavid Malcolm
With the addition of optinfo, the various dump_* calls had three parts: - optionally print to dump_file - optionally print to alt_dump_file - optionally make an optinfo_item and add it to the pending optinfo, creating it for dump_*_loc calls. However, this split makes it difficult to implement the formatted dumps later in patch kit, so as enabling work towards that, this patch removes the above split, so that all dumping within the dump_* API goes through optinfo_item. In order to ensure that the dumps to dump_file and alt_dump_file are processed immediately (rather than being buffered within the pending optinfo for consolidation), this patch introduces the idea of "immediate" optinfo_item destinations vs "non-immediate" destinations. The patch also adds selftest coverage of what's printed, and of scopes. This adds two allocations per dump_* call when dumping is enabled. I'm assuming that this isn't a problem, as dump_enabled_p is normally false. There are ways of optimizing it if it is an issue (by making optinfo_item instances become temporaries that borrow the underlying buffer), but they require nontrivial changes, so I'd prefer to leave that for another patch kit, if it becomes necessary. gcc/ChangeLog: * dump-context.h: Include "pretty-print.h". (dump_context::refresh_dumps_are_enabled): New decl. (dump_context::emit_item): New decl. (class dump_context): Add fields "m_test_pp" and "m_test_pp_flags". (temp_dump_context::temp_dump_context): Add param "test_pp_flags". (temp_dump_context::get_dumped_text): New decl. (class temp_dump_context): Add field "m_pp". * dumpfile.c (refresh_dumps_are_enabled): Convert to... (dump_context::refresh_dumps_are_enabled): ...and add a test for m_test_pp. (set_dump_file): Update for above change. (set_alt_dump_file): Likewise. (dump_loc): New overload, taking a pretty_printer *. (dump_context::dump_loc): Call end_any_optinfo. Dump the location to any test pretty-printer. (make_item_for_dump_gimple_stmt): New function, adapted from optinfo::add_gimple_stmt. (dump_context::dump_gimple_stmt): Call it, and use the result, eliminating the direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (make_item_for_dump_gimple_expr): New function, adapted from optinfo::add_gimple_expr. (dump_context::dump_gimple_expr): Call it, and use the result, eliminating the direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (make_item_for_dump_generic_expr): New function, adapted from optinfo::add_tree. (dump_context::dump_generic_expr): Call it, and use the result, eliminating the direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (make_item_for_dump_printf_va): New function, adapted from optinfo::add_printf_va. (make_item_for_dump_printf): New function. (dump_context::dump_printf_va): Call make_item_for_dump_printf_va, and use the result, eliminating the direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (make_item_for_dump_dec): New function. (dump_context::dump_dec): Call it, and use the result, eliminating the direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (make_item_for_dump_symtab_node): New function, adapted from optinfo::add_symtab_node. (dump_context::dump_symtab_node): Call it, and use the result, eliminating the direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (dump_context::begin_scope): Reimplement, avoiding direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (dump_context::emit_item): New member function. (temp_dump_context::temp_dump_context): Add param "test_pp_flags". Set up test pretty-printer on the underlying context. Call refresh_dumps_are_enabled. (temp_dump_context::~temp_dump_context): Call refresh_dumps_are_enabled. (temp_dump_context::get_dumped_text): New member function. (selftest::verify_dumped_text): New function. (ASSERT_DUMPED_TEXT_EQ): New macro. (selftest::test_capture_of_dump_calls): Run all tests twice, with and then without optinfo enabled. Add uses of ASSERT_DUMPED_TEXT_EQ to all tests. Add test of nested scopes. * dumpfile.h: Update comment for the dump_* API. * optinfo-emit-json.cc (selftest::test_building_json_from_dump_calls): Update for new param for temp_dump_context ctor. * optinfo.cc (optinfo_item::optinfo_item): Remove "owned" param and "m_owned" field. (optinfo_item::~optinfo_item): Likewise. (optinfo::add_item): New member function. (optinfo::emit): Update comment. (optinfo::add_string): Delete. (optinfo::add_printf): Delete. (optinfo::add_printf_va): Delete. (optinfo::add_gimple_stmt): Delete. (optinfo::add_gimple_expr): Delete. (optinfo::add_tree): Delete. (optinfo::add_symtab_node): Delete. (optinfo::add_dec): Delete. * optinfo.h (class dump_context): New forward decl. (optinfo::add_item): New decl. (optinfo::add_string): Delete. (optinfo::add_printf): Delete. (optinfo::add_printf_va): Delete. (optinfo::add_gimple_stmt): Delete. (optinfo::add_gimple_expr): Delete. (optinfo::add_tree): Delete. (optinfo::add_symtab_node): Delete. (optinfo::add_dec): Delete. (optinfo::add_poly_int): Delete. (optinfo_item::optinfo_item): Remove "owned" param. (class optinfo_item): Remove field "m_owned". From-SVN: r263178
2018-07-31Simplify dump_context by adding a dump_loc member functionDavid Malcolm
This patch removes some duplicated code in dumpfile.c by reimplementing the various dump_foo_loc calls in terms of dump_foo. gcc/ChangeLog: * dump-context.h (dump_context::dump_loc): New decl. * dumpfile.c (dump_context::dump_loc): New member function. (dump_context::dump_gimple_stmt_loc): Reimplement using dump_loc and dump_gimple_stmt. (dump_context::dump_gimple_expr_loc): Likewise, using dump_gimple_expr. (dump_context::dump_generic_expr_loc): Likewise, using dump_generic_expr. (dump_context::dump_printf_loc_va): Likewise, using dump_printf_va. (dump_context::begin_scope): Explicitly using the global function "dump_loc", rather than the member function. From-SVN: r263167
2018-07-25Limit dump_flag enum values range (PR middle-end/86645).Martin Liska
2018-07-25 Martin Liska <mliska@suse.cz> PR middle-end/86645 * dumpfile.c: And excluded values with TDF_ALL_VALUES. * dumpfile.h (enum dump_flag): Defince TDF_ALL_VALUES. From-SVN: r262960
2018-07-20Add "-fsave-optimization-record"David Malcolm
This patch implements a -fsave-optimization-record option, which leads to a JSON file being written out, recording the dump_* calls made (via the optinfo infrastructure). The patch includes a minimal version of the JSON patch I posted last year, with just enough support needed for optimization records (I removed all of the parser code, leaving just the code for building in-memory JSON trees and writing them to a pretty_printer). gcc/ChangeLog: * Makefile.in (OBJS): Add json.o and optinfo-emit-json.o. (CFLAGS-optinfo-emit-json.o): Define TARGET_NAME. * common.opt (fsave-optimization-record): New option. * coretypes.h (struct kv_pair): Move here from dumpfile.c. * doc/invoke.texi (-fsave-optimization-record): New option. * dumpfile.c: Include "optinfo-emit-json.h". (struct kv_pair): Move to coretypes.h. (optgroup_options): Make non-static. (dump_context::end_scope): Call optimization_records_maybe_pop_dump_scope. * dumpfile.h (optgroup_options): New decl. * json.cc: New file. * json.h: New file. * optinfo-emit-json.cc: New file. * optinfo-emit-json.h: New file. * optinfo.cc: Include "optinfo-emit-json.h". (optinfo::emit): Call optimization_records_maybe_record_optinfo. (optinfo_enabled_p): Check optimization_records_enabled_p. (optinfo_wants_inlining_info_p): Likewise. * optinfo.h: Update comment. * profile-count.c (profile_quality_as_string): New function. * profile-count.h (profile_quality_as_string): New decl. (profile_count::quality): New accessor. * selftest-run-tests.c (selftest::run_tests): Call json_cc_tests and optinfo_emit_json_cc_tests. * selftest.h (selftest::json_cc_tests): New decl. (selftest::optinfo_emit_json_cc_tests): New decl. * toplev.c: Include "optinfo-emit-json.h". (compile_file): Call optimization_records_finish. (do_compile): Call optimization_records_start. * tree-ssa-live.c: Include optinfo.h. (remove_unused_scope_block_p): Retain inlining information if optinfo_wants_inlining_info_p returns true. From-SVN: r262905
2018-07-19Add "optinfo" frameworkDavid Malcolm
This patch implements a way to consolidate dump_* calls into optinfo objects, as enabling work towards being able to write out optimization records to a file. The patch adds the support for building optinfo instances from dump_* calls, but leaves implementing any *users* of them to followup patches. gcc/ChangeLog: * Makefile.in (OBJS): Add optinfo.o. * coretypes.h (class symtab_node): New forward decl. (struct cgraph_node): New forward decl. (class varpool_node): New forward decl. * dump-context.h: New file. * dumpfile.c: Include "optinfo.h", "dump-context.h", "cgraph.h", "tree-pass.h". (refresh_dumps_are_enabled): Use optinfo_enabled_p. (set_dump_file): Call dumpfile_ensure_any_optinfo_are_flushed. (set_alt_dump_file): Likewise. (dump_context::~dump_context): New dtor. (dump_gimple_stmt): Move implementation to... (dump_context::dump_gimple_stmt): ...this new member function. Add the stmt to any pending optinfo, creating one if need be. (dump_gimple_stmt_loc): Move implementation to... (dump_context::dump_gimple_stmt_loc): ...this new member function. Start a new optinfo and add the stmt to it. (dump_gimple_expr): Move implementation to... (dump_context::dump_gimple_expr): ...this new member function. Add the stmt to any pending optinfo, creating one if need be. (dump_gimple_expr_loc): Move implementation to... (dump_context::dump_gimple_expr_loc): ...this new member function. Start a new optinfo and add the stmt to it. (dump_generic_expr): Move implementation to... (dump_context::dump_generic_expr): ...this new member function. Add the tree to any pending optinfo, creating one if need be. (dump_generic_expr_loc): Move implementation to... (dump_context::dump_generic_expr_loc): ...this new member function. Add the tree to any pending optinfo, creating one if need be. (dump_printf): Move implementation to... (dump_context::dump_printf_va): ...this new member function. Add the text to any pending optinfo, creating one if need be. (dump_printf_loc): Move implementation to... (dump_context::dump_printf_loc_va): ...this new member function. Start a new optinfo and add the stmt to it. (dump_dec): Move implementation to... (dump_context::dump_dec): ...this new member function. Add the value to any pending optinfo, creating one if need be. (dump_context::dump_symtab_node): New member function. (dump_context::get_scope_depth): New member function. (dump_context::begin_scope): New member function. (dump_context::end_scope): New member function. (dump_context::ensure_pending_optinfo): New member function. (dump_context::begin_next_optinfo): New member function. (dump_context::end_any_optinfo): New member function. (dump_context::s_current): New global. (dump_context::s_default): New global. (dump_scope_depth): Delete global. (dumpfile_ensure_any_optinfo_are_flushed): New function. (dump_symtab_node): New function. (get_dump_scope_depth): Reimplement in terms of dump_context. (dump_begin_scope): Likewise. (dump_end_scope): Likewise. (selftest::temp_dump_context::temp_dump_context): New ctor. (selftest::temp_dump_context::~temp_dump_context): New dtor. (selftest::verify_item): New function. (ASSERT_IS_TEXT): New macro. (ASSERT_IS_TREE): New macro. (ASSERT_IS_GIMPLE): New macro. (selftest::test_capture_of_dump_calls): New test. (selftest::dumpfile_c_tests): Call it. * dumpfile.h (dump_printf, dump_printf_loc, dump_basic_block) (dump_generic_expr_loc, dump_generic_expr, dump_gimple_stmt_loc) (dump_gimple_stmt, dump_dec): Gather these related decls and add a descriptive comment. (dump_function, print_combine_total_stats, enable_rtl_dump_file) (dump_node, dump_bb): Move these unrelated decls. (class dump_manager): Add leading comment. * optinfo.cc: New file. * optinfo.h: New file. From-SVN: r262891
2018-07-12dumpfile.c (gcc::dump_manager::get_dump_file_name): Add PART parameter.Jan Hubicka
* dumpfile.c (gcc::dump_manager::get_dump_file_name): Add PART parameter. (gcc::dump_manager::get_dump_file_name): likewise. (dump_begin): Likewise. * dumpfile.h (dump_begin): Update prototype. (gcc::dump_manager::get_dump_file_name, gcc::dump_manager::get_dump_file_name): Update prototype. From-SVN: r262591
2018-07-03[14/n] PR85694: Rework overwidening detectionRichard Sandiford
This patch is the main part of PR85694. The aim is to recognise at least: signed char *a, *b, *c; ... for (int i = 0; i < 2048; i++) c[i] = (a[i] + b[i]) >> 1; as an over-widening pattern, since the addition and shift can be done on shorts rather than ints. However, it ended up being a lot more general than that. The current over-widening pattern detection is limited to a few simple cases: logical ops with immediate second operands, and shifts by a constant. These cases are enough for common pixel-format conversion and can be detected in a peephole way. The loop above requires two generalisations of the current code: support for addition as well as logical ops, and support for non-constant second operands. These are harder to detect in the same peephole way, so the patch tries to take a more global approach. The idea is to get information about the minimum operation width in two ways: (1) by using the range information attached to the SSA_NAMEs (effectively a forward walk, since the range info is context-independent). (2) by back-propagating the number of output bits required by users of the result. As explained in the comments, there's a balance to be struck between narrowing an individual operation and fitting in with the surrounding code. The approach is pretty conservative: if we could narrow an operation to N bits without changing its semantics, it's OK to do that if: - no operations later in the chain require more than N bits; or - all internally-defined inputs are extended from N bits or fewer, and at least one of them is single-use. See the comments for the rationale. I didn't bother adding STMT_VINFO_* wrappers for the new fields since the code seemed more readable without. 2018-06-20 Richard Sandiford <richard.sandiford@arm.com> gcc/ * poly-int.h (print_hex): New function. * dumpfile.h (dump_dec, dump_hex): Declare. * dumpfile.c (dump_dec, dump_hex): New poly_wide_int functions. * tree-vectorizer.h (_stmt_vec_info): Add min_output_precision, min_input_precision, operation_precision and operation_sign. * tree-vect-patterns.c (vect_get_range_info): New function. (vect_same_loop_or_bb_p, vect_single_imm_use) (vect_operation_fits_smaller_type): Delete. (vect_look_through_possible_promotion): Add an optional single_use_p parameter. (vect_recog_over_widening_pattern): Rewrite to use new stmt_vec_info infomration. Handle one operation at a time. (vect_recog_cast_forwprop_pattern, vect_narrowable_type_p) (vect_truncatable_operation_p, vect_set_operation_type) (vect_set_min_input_precision): New functions. (vect_determine_min_output_precision_1): Likewise. (vect_determine_min_output_precision): Likewise. (vect_determine_precisions_from_range): Likewise. (vect_determine_precisions_from_users): Likewise. (vect_determine_stmt_precisions, vect_determine_precisions): Likewise. (vect_vect_recog_func_ptrs): Put over_widening first. Add cast_forwprop. (vect_pattern_recog): Call vect_determine_precisions. gcc/testsuite/ * gcc.dg/vect/vect-widen-mult-u8-u32.c: Check specifically for a widen_mult pattern. * gcc.dg/vect/vect-over-widen-1.c: Update the scan tests for new over-widening messages. * gcc.dg/vect/vect-over-widen-1-big-array.c: Likewise. * gcc.dg/vect/vect-over-widen-2.c: Likewise. * gcc.dg/vect/vect-over-widen-2-big-array.c: Likewise. * gcc.dg/vect/vect-over-widen-3.c: Likewise. * gcc.dg/vect/vect-over-widen-3-big-array.c: Likewise. * gcc.dg/vect/vect-over-widen-4.c: Likewise. * gcc.dg/vect/vect-over-widen-4-big-array.c: Likewise. * gcc.dg/vect/bb-slp-over-widen-1.c: New test. * gcc.dg/vect/bb-slp-over-widen-2.c: Likewise. * gcc.dg/vect/vect-over-widen-5.c: Likewise. * gcc.dg/vect/vect-over-widen-6.c: Likewise. * gcc.dg/vect/vect-over-widen-7.c: Likewise. * gcc.dg/vect/vect-over-widen-8.c: Likewise. * gcc.dg/vect/vect-over-widen-9.c: Likewise. * gcc.dg/vect/vect-over-widen-10.c: Likewise. * gcc.dg/vect/vect-over-widen-11.c: Likewise. * gcc.dg/vect/vect-over-widen-12.c: Likewise. * gcc.dg/vect/vect-over-widen-13.c: Likewise. * gcc.dg/vect/vect-over-widen-14.c: Likewise. * gcc.dg/vect/vect-over-widen-15.c: Likewise. * gcc.dg/vect/vect-over-widen-16.c: Likewise. * gcc.dg/vect/vect-over-widen-17.c: Likewise. * gcc.dg/vect/vect-over-widen-18.c: Likewise. * gcc.dg/vect/vect-over-widen-19.c: Likewise. * gcc.dg/vect/vect-over-widen-20.c: Likewise. * gcc.dg/vect/vect-over-widen-21.c: Likewise. From-SVN: r262333
2018-07-03tree-vect-stmts.c (vect_is_simple_use): Consolidate dumping, always set *dt.Richard Biener
2018-07-03 Richard Biener <rguenther@suse.de> * tree-vect-stmts.c (vect_is_simple_use): Consolidate dumping, always set *dt. Dump vectype in vectype overload. * dumpfile.h (dump_gimple_expr): New function. (dump_gimple_expr_loc): Likewise. * dumpfile.c (dump_gimple_expr): New function. (dump_gimple_expr_loc): Likewise. From-SVN: r262330
2018-07-02Reinstate dump_generic_expr_locDavid Malcolm
gcc/ChangeLog: * dumpfile.c (dump_generic_expr_loc): Undo removal of this function in r262149, changing "loc" param from source_location to const dump_location_t &. * dumpfile.h (dump_generic_expr_loc): Undo removal of this declaration, as above. From-SVN: r262295
2018-06-29dumpfile.c: add indentation via DUMP_VECT_SCOPEDavid Malcolm
This patch adds a concept of nested "scopes" to dumpfile.c's dump_*_loc calls, and wires it up to the DUMP_VECT_SCOPE macro in tree-vectorizer.h, so that the nested structure is shown in -fopt-info by indentation. For example, this converts -fopt-info-all e.g. from: test.c:8:3: note: === analyzing loop === test.c:8:3: note: === analyze_loop_nest === test.c:8:3: note: === vect_analyze_loop_form === test.c:8:3: note: === get_loop_niters === test.c:8:3: note: symbolic number of iterations is (unsigned int) n_9(D) test.c:8:3: note: not vectorized: loop contains function calls or data references that cannot be analyzed test.c:8:3: note: vectorized 0 loops in function to: test.c:8:3: note: === analyzing loop === test.c:8:3: note: === analyze_loop_nest === test.c:8:3: note: === vect_analyze_loop_form === test.c:8:3: note: === get_loop_niters === test.c:8:3: note: symbolic number of iterations is (unsigned int) n_9(D) test.c:8:3: note: not vectorized: loop contains function calls or data references that cannot be analyzed test.c:8:3: note: vectorized 0 loops in function showing that the "symbolic number of iterations" message is within the "=== analyze_loop_nest ===" (and not within the "=== vect_analyze_loop_form ==="). This is also enabling work for followups involving optimization records (allowing the records to directly capture the nested structure of the dump messages). gcc/ChangeLog: * dumpfile.c (dump_loc): Add indentation based on scope depth. (dump_scope_depth): New variable. (get_dump_scope_depth): New function. (dump_begin_scope): New function. (dump_end_scope): New function. * dumpfile.h (get_dump_scope_depth): New declaration. (dump_begin_scope): New declaration. (dump_end_scope): New declaration. (class auto_dump_scope): New class. (AUTO_DUMP_SCOPE): New macro. * tree-vectorizer.h (DUMP_VECT_SCOPE): Reimplement in terms of AUTO_DUMP_SCOPE. From-SVN: r262246
2018-06-28Hide alt_dump_file within dumpfile.cDavid Malcolm
This patch removes alt_dump_file from dumpfile.h, making it static within dumpfile.c. This allows for changing how -fopt-info is implemented, and potentially adding other kinds of dump target, such as remarks or optimization records. Doing so requires changing the implementation of dump_enabled_p, so the patch changes this to a simple lookup of a boolean global, which is updated any time dump_file or alt_dump_file change. gcc/ChangeLog: * cgraph.c (cgraph_node::get_body): Replace assignments to "dump_file" with calls to set_dump_file. * dumpfile.c (alt_dump_file): Make static, and group with... (alt_flags): ...this definition. (dumps_are_enabled): New variable. (refresh_dumps_are_enabled): New function. (set_dump_file): New function. (set_alt_dump_file): New function. (gcc::dump_manager::dump_start): Replace assignments to "dump_file" and "alt_dump_file" with calls to set_dump_file and set_alt_dump_file. (gcc::dump_manager::dump_finish): Likewise. * dumpfile.h (alt_dump_file): Delete decl. (dumps_are_enabled): New variable decl. (set_dump_file): New function decl. (dump_enabled_p): Rewrite in terms of new "dumps_are_enabled" global. * tree-nested.c (lower_nested_functions): Replace assignments to "dump_file" with calls to set_dump_file. From-SVN: r262220
2018-06-26Introduce dump_location_tDavid Malcolm
gcc/ChangeLog: * cfgloop.c (get_loop_location): Convert return type from location_t to dump_user_location_t, replacing INSN_LOCATION lookups by implicit construction from rtx_insn *, and using dump_user_location_t::from_function_decl for the fallback case. * cfgloop.h (get_loop_location): Convert return type from location_t to dump_user_location_t. * cgraphunit.c (walk_polymorphic_call_targets): Update call to dump_printf_loc to pass in a dump_location_t rather than a location_t, via the gimple stmt. * coverage.c (get_coverage_counts): Update calls to dump_printf_loc to pass in dump_location_t rather than a location_t. * doc/optinfo.texi (Dump types): Convert example of dump_printf_loc from taking "locus" to taking "insn". Update description of the "_loc" calls to cover dump_location_t. * dumpfile.c: Include "backend.h", "gimple.h", "rtl.h", and "selftest.h". (dump_user_location_t::dump_user_location_t): New constructors, from gimple *stmt and rtx_insn *. (dump_user_location_t::from_function_decl): New function. (dump_loc): Make static. (dump_gimple_stmt_loc): Convert param "loc" from location_t to const dump_location_t &. (dump_generic_expr_loc): Delete. (dump_printf_loc): Convert param "loc" from location_t to const dump_location_t &. (selftest::test_impl_location): New function. (selftest::dumpfile_c_tests): New function. * dumpfile.h: Include "profile-count.h". (class dump_user_location_t): New class. (struct dump_impl_location_t): New struct. (class dump_location_t): New class. (dump_printf_loc): Convert 2nd param from source_location to const dump_location_t &. (dump_generic_expr_loc): Delete. (dump_gimple_stmt_loc): Convert 2nd param from source_location to const dump_location_t &. * gimple-fold.c (fold_gimple_assign): Update call to dump_printf_loc to pass in a dump_location_t rather than a location_t, via the gimple stmt. (gimple_fold_call): Likewise. * gimple-loop-interchange.cc (loop_cand::analyze_iloop_reduction_var): Update for change to check_reduction_path. (tree_loop_interchange::interchange): Update for change to find_loop_location. * graphite-isl-ast-to-gimple.c (scop_to_isl_ast): Update for change in return-type of find_loop_location. (graphite_regenerate_ast_isl): Likewise. * graphite-optimize-isl.c (optimize_isl): Likewise. * graphite.c (graphite_transform_loops): Likewise. * ipa-devirt.c (ipa_devirt): Update call to dump_printf_loc to pass in a dump_location_t rather than a location_t, via the gimple stmt. * ipa-prop.c (ipa_make_edge_direct_to_target): Likewise. * ipa.c (walk_polymorphic_call_targets): Likewise. * loop-unroll.c (report_unroll): Convert "locus" param from location_t to dump_location_t. (decide_unrolling): Update for change to get_loop_location's return type. * omp-grid.c (struct grid_prop): Convert field "target_loc" from location_t to dump_user_location_t. (grid_find_single_omp_among_assignments_1): Updates calls to dump_printf_loc to pass in a dump_location_t rather than a location_t, via the gimple stmt. (grid_parallel_clauses_gridifiable): Convert "tloc" from location_t to dump_location_t. Updates calls to dump_printf_loc to pass in a dump_location_t rather than a location_t, via the gimple stmt. (grid_inner_loop_gridifiable_p): Likewise. (grid_dist_follows_simple_pattern): Likewise. (grid_gfor_follows_tiling_pattern): Likewise. (grid_target_follows_gridifiable_pattern): Likewise. (grid_attempt_target_gridification): Convert initialization of local "grid" from memset to zero-initialization; FIXME: does this require C++11? Update call to dump_printf_loc to pass in a optinfo_location rather than a location_t, via the gimple stmt. * profile.c (read_profile_edge_counts): Updates call to dump_printf_loc to pass in a dump_location_t rather than a location_t (compute_branch_probabilities): Likewise. * selftest-run-tests.c (selftest::run_tests): Call dumpfile_c_tests. * selftest.h (dumpfile_c_tests): New decl. * tree-loop-distribution.c (pass_loop_distribution::execute): Update for change in return type of find_loop_location. * tree-parloops.c (parallelize_loops): Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Convert "locus" from location_t to dump_user_location_t. (canonicalize_loop_induction_variables): Likewise. * tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize_loop): Update for change in return type of find_loop_location. * tree-ssa-loop-niter.c (number_of_iterations_exit): Update call to dump_printf_loc to pass in a dump_location_t rather than a location_t, via the stmt. * tree-ssa-sccvn.c (eliminate_dom_walker::before_dom_children): Likewise. * tree-vect-loop-manip.c (find_loop_location): Convert return type from source_location to dump_user_location_t. (vect_do_peeling): Update for above change. (vect_loop_versioning): Update for change in type of vect_location. * tree-vect-loop.c (check_reduction_path): Convert "loc" param from location_t to dump_user_location_t. (vect_estimate_min_profitable_iters): Update for change in type of vect_location. * tree-vect-slp.c (vect_print_slp_tree): Convert param "loc" from location_t to dump_location_t. (vect_slp_bb): Update for change in type of vect_location. * tree-vectorizer.c (vect_location): Convert from source_location to dump_user_location_t. (try_vectorize_loop_1): Update for change in vect_location's type. (vectorize_loops): Likewise. (increase_alignment): Likewise. * tree-vectorizer.h (vect_location): Convert from source_location to dump_user_location_t. (find_loop_location): Convert return type from source_location to dump_user_location_t. (check_reduction_path): Convert 1st param from location_t to dump_user_location_t. * value-prof.c (check_counter): Update call to dump_printf_loc to pass in a dump_user_location_t rather than a location_t; update call to error_at for change in type of "locus". (check_ic_target): Update call to dump_printf_loc to pass in a dump_user_location_t rather than a location_t, via the call_stmt. From-SVN: r262149
2018-06-13cgraph.c (cgraph_node::get_untransformed_body): Dump function bodies ↵Jan Hubicka
streamed in with -Q. * cgraph.c (cgraph_node::get_untransformed_body): Dump function bodies streamed in with -Q. * dumpfile.c (dump_files): Add lto-stream-out dump file. * dumpfile.h (tree_dump_index): Add lto_stream_out. * gimple-streamer-out.c: Include gimple-pretty-print.h (output_bb): Dump stmts streamed. * lto-section-out.c: Include print-tree.h (lto_begin_section): Dump sections created. (lto_output_decl_index): Dump decl encoded. * lto-streamer-out.c: Include print-tree.h (create_output_block): Dump output block created. (DFS::DFS_write_tree_body): Dump DFS SCCs streamed. (output_function): Dump function output. (output_constructor): Dump constructor streamed. (write_global_stream): Output indexes encoded. (produce_asm_for_decls): Dump streams encoded. * lto-streamer.c (streamer_dump_file): New global var. * lto-streamer.h (streamer_dump_file): Declare. * passes.c (ipa_write_summaries): Initialize streamer dump. * varpool.c (varpool_node::get_constructor): Dump constructors streamed in. From-SVN: r261546
2018-06-08dumpfile.c (FIRST_ME_AUTO_NUMBERED_DUMP): Bump to 4.Jan Hubicka
* dumpfile.c (FIRST_ME_AUTO_NUMBERED_DUMP): Bump to 4. * lto-lang.c (lto_link_dump_id, decl_merge_dump_id, partition_dump_id): New global vars. (lto_register_dumps): New hook. (LANG_HOOKS_REGISTER_DUMPS): New. * lto-partition.c: Dump into dump_file instead of symtab->dump_file. * lto-symtab.c: Include lto.h; dump into dump_file instead of symtab->dump_file. (lto_symtab_merge_decls): Initialize dump file. * lto.c (read_cgraph_and_symbols): Initialize dump file. (do_whole_program_analysis): Likewise. From-SVN: r261337
2018-06-08Convert dump and optgroup flags to enumsDavid Malcolm
gcc/brig/ChangeLog: * brigfrontend/brig-to-generic.cc (brig_to_generic::write_globals): Use TDF_NONE rather than 0. (dump_function): Likewise. gcc/c-family/ChangeLog: * c-pretty-print.c (c_pretty_printer::statement): Use TDF_NONE rather than 0. gcc/ChangeLog: * cfg.c (debug): Use TDF_NONE rather than 0. * cfghooks.c (debug): Likewise. * dumpfile.c (DUMP_FILE_INFO): Likewise; also for OPTGROUP. (struct dump_option_value_info): Convert to... (struct kv_pair): ...this template type. (dump_options): Convert to kv_pair<dump_flags_t>; use TDF_NONE rather than 0. (optinfo_verbosity_options): Likewise. (optgroup_options): Convert to kv_pair<optgroup_flags_t>; use OPTGROUP_NONE. (gcc::dump_manager::dump_register): Use optgroup_flags_t rather than int for "optgroup_flags" param. (dump_generic_expr_loc): Use dump_flags_t rather than int for "dump_kind" param. (dump_dec): Likewise. (dump_finish): Use TDF_NONE rather than 0. (gcc::dump_manager::opt_info_enable_passes): Use optgroup_flags_t rather than int for "optgroup_flags" param. Use TDF_NONE rather than 0. Update for change to option_ptr. (opt_info_switch_p_1): Convert "optgroup_flags" param from int * to optgroup_flags_t *. Use TDF_NONE and OPTGROUP_NONE rather than 0. Update for changes to optinfo_verbosity_options and optgroup_options. (opt_info_switch_p): Convert optgroup_flags from int to optgroup_flags_t. (dump_basic_block): Use dump_flags_t rather than int for "dump_kind" param. * dumpfile.h (TDF_ADDRESS, TDF_SLIM, TDF_RAW, TDF_DETAILS, TDF_STATS, TDF_BLOCKS, TDF_VOPS, TDF_LINENO, TDF_UID) TDF_STMTADDR, TDF_GRAPH, TDF_MEMSYMS, TDF_RHS_ONLY, TDF_ASMNAME, TDF_EH, TDF_NOUID, TDF_ALIAS, TDF_ENUMERATE_LOCALS, TDF_CSELIB, TDF_SCEV, TDF_GIMPLE, TDF_FOLDING, MSG_OPTIMIZED_LOCATIONS, MSG_MISSED_OPTIMIZATION, MSG_NOTE, MSG_ALL, TDF_COMPARE_DEBUG, TDF_NONE): Convert from macros to... (enum dump_flag): ...this new enum. (dump_flags_t): Update to use enum. (operator|, operator&, operator~, operator|=, operator&=): Implement for dump_flags_t. (OPTGROUP_NONE, OPTGROUP_IPA, OPTGROUP_LOOP, OPTGROUP_INLINE, OPTGROUP_OMP, OPTGROUP_VEC, OPTGROUP_OTHER, OPTGROUP_ALL): Convert from macros to... (enum optgroup_flag): ...this new enum. (optgroup_flags_t): New typedef. (operator|, operator|=): Implement for optgroup_flags_t. (struct dump_file_info): Convert field "alt_flags" to dump_flags_t. Convert field "optgroup_flags" to optgroup_flags_t. (dump_basic_block): Use dump_flags_t rather than int for param. (dump_generic_expr_loc): Likewise. (dump_dec): Likewise. (dump_register): Convert param "optgroup_flags" to optgroup_flags_t. (opt_info_enable_passes): Likewise. * early-remat.c (early_remat::dump_edge_list): Use TDF_NONE rather than 0. * gimple-pretty-print.c (debug): Likewise. * gimple-ssa-store-merging.c (bswap_replace): Likewise. (merged_store_group::apply_stores): Likewise. * gimple-ssa-strength-reduction.c (insert_initializers): Likewise. * gimple.c (verify_gimple_pp): Likewise. * graphite-poly.c (print_pbb_body): Likewise. * passes.c (pass_manager::register_one_dump_file): Convert local "optgroup_flags" to optgroup_flags_t. * print-tree.c (print_node): Use TDF_NONE rather than 0. (debug): Likewise. (debug_body): Likewise. * tree-pass.h (struct pass_data): Convert field "optgroup_flags" to optgroup_flags_t. * tree-pretty-print.c (print_struct_decl): Use TDF_NONE rather than 0. * tree-ssa-math-opts.c (convert_mult_to_fma_1): Likewise. (convert_mult_to_fma): Likewise. * tree-ssa-reassoc.c (undistribute_ops_list): Likewise. * tree-ssa-sccvn.c (vn_eliminate): Likewise. * tree-vect-data-refs.c (dump_lower_bound): Convert param "dump_kind" to dump_flags_t. From-SVN: r261325
2018-04-30[patch] allow '-' for stdout dumpNathan Sidwell
https://gcc.gnu.org/ml/gcc-patches/2018-04/msg01303.html * dumpfile.c (dump_open): Allow '-' for stdout. * doc/invoke.texi (Developer Options): Document dump filename determination early. Document stdin/stdout selection. Co-Authored-By: Sandra Loosemore <sandra@codesourcery.com> From-SVN: r259760
2018-04-26dumpfile cleanupNathan Sidwell
https://gcc.gnu.org/ml/gcc-patches/2018-04/msg01173.html * dumpfile.c (dump_open): New. (dump_open_alternate_stream, dump_start, dump_begin): Call it. (dump_finish): Detect stdio/stderr by value not name. From-SVN: r259681
2018-01-03Update copyright years.Jakub Jelinek
From-SVN: r256169
2017-12-20poly_int: dump routinesRichard Sandiford
2017-12-20 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * dumpfile.h (dump_dec): Declare. * dumpfile.c (dump_dec): New function. * pretty-print.h (pp_wide_integer): Turn into a function and declare a poly_int version. * pretty-print.c (pp_wide_integer): New function for poly_ints. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255864
2017-12-19read-rtl.c (parse_reg_note_name): Replace Yoda conditions with typical order ↵Jakub Jelinek
conditions. * read-rtl.c (parse_reg_note_name): Replace Yoda conditions with typical order conditions. * sel-sched.c (extract_new_fences_from): Likewise. * config/visium/constraints.md (J, K, L): Likewise. * config/visium/predicates.md (const_shift_operand): Likewise. * config/visium/visium.c (visium_legitimize_address, visium_legitimize_reload_address): Likewise. * config/m68k/m68k.c (output_reg_adjust, emit_reg_adjust): Likewise. * config/arm/arm.c (arm_block_move_unaligned_straight): Likewise. * config/avr/constraints.md (Y01, Ym1, Y02, Ym2): Likewise. * config/avr/avr-log.c (avr_vdump, avr_log_set_avr_log, SET_DUMP_DETAIL): Likewise. * config/avr/predicates.md (const_8_16_24_operand): Likewise. * config/avr/avr.c (STR_PREFIX_P, avr_popcount_each_byte, avr_is_casesi_sequence, avr_casei_sequence_check_operands, avr_set_core_architecture, avr_set_current_function, avr_legitimize_reload_address, avr_asm_len, avr_print_operand, output_movqi, output_movsisf, avr_out_plus, avr_out_bitop, avr_out_fract, avr_adjust_insn_length, avr_encode_section_info, avr_2word_insn_p, output_reload_in_const, avr_has_nibble_0xf, avr_map_decompose, avr_fold_builtin): Likewise. * config/avr/driver-avr.c (avr_devicespecs_file): Likewise. * config/avr/gen-avr-mmcu-specs.c (str_prefix_p, print_mcu): Likewise. * config/i386/i386.c (ix86_parse_stringop_strategy_string): Likewise. * config/m32c/m32c-pragma.c (m32c_pragma_memregs): Likewise. * config/m32c/m32c.c (m32c_conditional_register_usage, m32c_address_cost): Likewise. * config/m32c/predicates.md (shiftcount_operand, longshiftcount_operand): Likewise. * config/iq2000/iq2000.c (iq2000_expand_prologue): Likewise. * config/nios2/nios2.c (nios2_handle_custom_fpu_insn_option, can_use_cdx_ldstw): Likewise. * config/nios2/nios2.h (CDX_REG_P): Likewise. * config/cr16/cr16.h (RETURN_ADDR_RTX, REGNO_MODE_OK_FOR_BASE_P): Likewise. * config/cr16/cr16.md (*mov<mode>_double): Likewise. * config/cr16/cr16.c (cr16_create_dwarf_for_multi_push): Likewise. * config/h8300/h8300.c (h8300_rtx_costs, get_shift_alg): Likewise. * config/vax/constraints.md (U06, U08, U16, CN6, S08, S16): Likewise. * config/vax/vax.c (adjacent_operands_p): Likewise. * config/ft32/constraints.md (L, b, KA): Likewise. * config/ft32/ft32.c (ft32_load_immediate, ft32_expand_prologue): Likewise. * cfgexpand.c (expand_stack_alignment): Likewise. * gcse.c (insert_expr_in_table): Likewise. * print-rtl.c (rtx_writer::print_rtx_operand_codes_E_and_V): Likewise. * cgraphunit.c (cgraph_node::expand): Likewise. * ira-build.c (setup_min_max_allocno_live_range_point): Likewise. * emit-rtl.c (add_insn): Likewise. * input.c (dump_location_info): Likewise. * passes.c (NEXT_PASS): Likewise. * read-rtl-function.c (parse_note_insn_name, function_reader::read_rtx_operand_r, function_reader::parse_mem_expr): Likewise. * sched-rgn.c (sched_rgn_init): Likewise. * diagnostic-show-locus.c (layout::show_ruler): Likewise. * combine.c (find_split_point, simplify_if_then_else, force_to_mode, if_then_else_cond, simplify_shift_const_1, simplify_comparison): Likewise. * explow.c (eliminate_constant_term): Likewise. * final.c (leaf_renumber_regs_insn): Likewise. * cfgrtl.c (print_rtl_with_bb): Likewise. * genhooks.c (emit_init_macros): Likewise. * poly-int.h (maybe_ne, maybe_le, maybe_lt): Likewise. * tree-data-ref.c (conflict_fn): Likewise. * selftest.c (assert_streq): Likewise. * expr.c (store_constructor_field, expand_expr_real_1): Likewise. * fold-const.c (fold_range_test, extract_muldiv_1, fold_truth_andor, fold_binary_loc, multiple_of_p): Likewise. * reload.c (push_reload, find_equiv_reg): Likewise. * et-forest.c (et_nca, et_below): Likewise. * dbxout.c (dbxout_symbol_location): Likewise. * reorg.c (relax_delay_slots): Likewise. * dojump.c (do_compare_rtx_and_jump): Likewise. * gengtype-parse.c (type): Likewise. * simplify-rtx.c (simplify_gen_ternary, simplify_gen_relational, simplify_const_relational_operation): Likewise. * reload1.c (do_output_reload): Likewise. * dumpfile.c (get_dump_file_info_by_switch): Likewise. * gengtype.c (type_for_name): Likewise. * gimple-ssa-sprintf.c (format_directive): Likewise. ada/ * gcc-interface/trans.c (Loop_Statement_to_gnu): Replace Yoda conditions with typical order conditions. * gcc-interface/misc.c (gnat_get_array_descr_info, default_pass_by_ref): Likewise. * gcc-interface/decl.c (gnat_to_gnu_entity): Likewise. * adaint.c (__gnat_tmp_name): Likewise. c-family/ * known-headers.cc (get_stdlib_header_for_name): Replace Yoda conditions with typical order conditions. c/ * c-typeck.c (comptypes_internal, function_types_compatible_p, perform_integral_promotions, digest_init): Replace Yoda conditions with typical order conditions. * c-decl.c (check_bitfield_type_and_width): Likewise. cp/ * name-lookup.c (get_std_name_hint): Replace Yoda conditions with typical order conditions. * class.c (check_bitfield_decl): Likewise. * pt.c (convert_template_argument): Likewise. * decl.c (duplicate_decls): Likewise. * typeck.c (commonparms): Likewise. fortran/ * scanner.c (preprocessor_line): Replace Yoda conditions with typical order conditions. * dependency.c (check_section_vs_section): Likewise. * trans-array.c (gfc_conv_expr_descriptor): Likewise. jit/ * jit-playback.c (get_type, playback::compile_to_file::copy_file, playback::context::acquire_mutex): Replace Yoda conditions with typical order conditions. * libgccjit.c (gcc_jit_context_new_struct_type, gcc_jit_struct_set_fields, gcc_jit_context_new_union_type, gcc_jit_context_new_function, gcc_jit_timer_pop): Likewise. * jit-builtins.c (matches_builtin): Likewise. * jit-recording.c (recording::compound_type::set_fields, recording::fields::write_reproducer, recording::rvalue::set_scope, recording::function::validate): Likewise. * jit-logging.c (logger::decref): Likewise. From-SVN: r255831
2017-07-02dumpfile.c: Include profile-count.hJan Hubicka
* dumpfile.c: Include profile-count.h * tree-cfg.c (gimple_duplicate_sese_tail): Drop UNUSED attributes; update profile. (insert_cond_bb): Update profile. * tree-cfg.h (insert_cond_bb): Update prototype. * tree-chkp-opt.c (chkp_optimize_string_function_calls): Update. * tree-dump.c: Do not include tree-cfg. From-SVN: r249887
2017-06-27predict.c (test_prediction_value_range): Use -1U instead of -1 to avoid ↵Jakub Jelinek
narrowing conversion warning. * predict.c (test_prediction_value_range): Use -1U instead of -1 to avoid narrowing conversion warning. * dumpfile.c (dump_options): Wrap all value into dump_flags_t cast to avoid narrowing conversion warning. * opt-functions.awk (var_ref): Return (unsigned short) -1 instead of -1. * optc-gen.awk (END): Expect (unsigned short) -1 instead of -1. From-SVN: r249683
2017-06-15PR c++/80560 - warn on undefined memory operations involving non-trivial typesMartin Sebor
gcc/c-family/ChangeLog: PR c++/80560 * c.opt (-Wclass-memaccess): New option. gcc/cp/ChangeLog: PR c++/80560 * call.c (first_non_public_field, maybe_warn_class_memaccess): New functions. (has_trivial_copy_assign_p, has_trivial_copy_p): Ditto. (build_cxx_call): Call maybe_warn_class_memaccess. gcc/ChangeLog: PR c++/80560 * dumpfile.c (dump_register): Avoid calling memset to initialize a class with a default ctor. * gcc.c (struct compiler): Remove const qualification. * genattrtab.c (gen_insn_reserv): Replace memset with initialization. * hash-table.h: Ditto. * ipa-cp.c (allocate_and_init_ipcp_value): Replace memset with assignment. * ipa-prop.c (ipa_free_edge_args_substructures): Ditto. * omp-low.c (lower_omp_ordered_clauses): Replace memset with default ctor. * params.h (struct param_info): Make struct members non-const. * tree-switch-conversion.c (emit_case_bit_tests): Replace memset with default initialization. * vec.h (vec_copy_construct, vec_default_construct): New helper functions. (vec<T>::copy, vec<T>::splice, vec<T>::reserve): Replace memcpy with vec_copy_construct. (vect<T>::quick_grow_cleared): Replace memset with default ctor. (vect<T>::vec_safe_grow_cleared, vec_safe_grow_cleared): Same. * doc/invoke.texi (-Wclass-memaccess): Document. libcpp/ChangeLog: PR c++/80560 * line-map.c (line_maps::~line_maps): Avoid calling htab_delete with a null pointer. (linemap_init): Avoid calling memset on an object of a non-trivial type. libitm/ChangeLog: PR c++/80560 * beginend.cc (GTM::gtm_thread::rollback): Avoid calling memset on an object of a non-trivial type. (GTM::gtm_transaction_cp::commit): Use assignment instead of memcpy to copy an object. * method-ml.cc (orec_iterator::reinit): Avoid -Wclass-memaccess. gcc/testsuite/ChangeLog: PR c++/80560 * g++.dg/Wclass-memaccess.C: New test. From-SVN: r249234
2017-06-07dumpfile.h (enum tree_dump_index): Rename TDI_generic to TDI_gimple.Jakub Jelinek
* dumpfile.h (enum tree_dump_index): Rename TDI_generic to TDI_gimple. (class dump_manager): Add register_dumps method. * dumpfile.c: Include langhooks.h. (dump_files): Use 0 instead of 3/4/5 for TDI_{original,gimple,nested}. (FIRST_AUTO_NUMBERED_DUMP): Decrease to 1. (FIRST_ME_AUTO_NUMBERED_DUMP): Define. (dump_manager::dump_register): Start with 512 entries instead of 32. (dump_manager::register_dumps): New method. * toplev.c (general_init): Instead of invoking register_dumps langhook, invoke register_dumps method on the dump manager. * gimplify.c (gimplify_function_tree): Use TDI_gimple instead of TDI_generic. * gimple-parser.c (c_parser_parse_gimple_body): Use TDI_gimple instead of TDI_generic. From-SVN: r248947
2017-05-30Remove dump_file_info::dump_file_info and replace it with macro.Martin Liska
2017-05-30 Martin Liska <mliska@suse.cz> * dumpfile.c: Use newly added macro DUMP_FILE_INFO. * dumpfile.h (struct dump_file_info): Remove ctors. From-SVN: r248617
2017-05-26Simplify usage of some TDF_* flags.Martin Liska
2017-05-26 Martin Liska <mliska@suse.cz> * cfg.c (check_bb_profile): Do not use TDF_COMMENT and print always leading ';; '. (dump_bb_info): Likewise. (brief_dump_cfg): Likewise. * cfgrtl.c (print_rtl_with_bb): Do not use TDF_COMMENT. * dumpfile.c: Remove usage of TDF_VERBOSE. * dumpfile.h (enum dump_kind): Likewise. (dump_gimple_bb_header): Do not use TDF_COMMENT. * print-tree.c (debug_verbose): Remove. * tree-cfg.c (gimple_dump_cfg): Do not use TDF_COMMENT. (dump_function_to_file): Remove dumps guarded with TDF_VERBOSE. * tree-diagnostic.c (default_tree_printer): Replace TDF_DIAGNOSTIC with TDF_SLIM. From-SVN: r248514
2017-05-25Add -fdump*-folding suboption.Martin Liska
2017-05-25 Martin Liska <mliska@suse.cz> * dumpfile.c: Add TDF_FOLDING. * dumpfile.h (enum dump_kind): Likewise. * genmatch.c (dt_simplify::gen_1): Use it. From-SVN: r248452
2017-05-22invoke.texi (fdump-translation-unit): Delete documentation.Nathan Sidwell
gcc/ * doc/invoke.texi (fdump-translation-unit): Delete documentation. (fdump-lang): Document 'raw' option. * dumpfile.h (TDI_tu): Delete. * dumpfile.c (dump_files): Remove translation-unit. (FIRST_AUTO_NUMBERED_DUMP): Decrement. gcc/cp/ * cp-objcp-common.c (cp_register_dumps): Register raw dumper. * cp-tree.h (raw_dump_id): Declare. * decl2.c (raw_dump_id): Define. (dump_tu): Use raw_dump_id. gcc/c/ * c-decl.c (c_parse_final_cleanups): Drop TDI_tu handling. From-SVN: r248333
2017-05-19toplev.c (general_init): Call register dump lang hook.Nathan Sidwell
LANG_HOOK_REGISTER_DUMPS gcc/ * toplev.c (general_init): Call register dump lang hook. * doc/invoke.texi: Document -fdump-lang option family. * dumpfile.c (dump_files): Remove class dump here. (FIRST_AUTO_NUMBERED_DUMP): Adjust. * dumpfile.h (tree_dump_index): Remove TDI_class. * langhooks-def.h (lhd_register_dumps): Declare. (LANG_HOOKS_REGISTER_DUMPS): Define. (LANG_HOOKS_INITIALIZER): Add it. * langhooks.c (lhd_register_dumps): Define. * langhooks.h (struct lang_hooks): Add register_dumps. c-family/ * c-opts.c (class_dump_file, class_dump_flags): Delete. (c_common_parse_file): Remove class dump handling. (get_dump_info): Likewise. cp/ * class.c (class_dump_id): Define. (dump_class_hierarchy, dump_vtable, dump_vtt): Use it. * cp-objcp-common.c (cp_register_dumps): New. * cp-objcp-common.h (cp_register_dumps): Declare. (LANG_HOOKS_REGISTER_DUMPS): Override. * cp-tree.h (class_dump_id): Declare. testsuite/ * g++.dg/inherit/covariant7.C: Adjust. From-SVN: r248271