gcc/gcc/dumpfile.cc

2779 lines
79 KiB
C++
Raw Normal View History

/* Dump infrastructure for optimizations and intermediate representation.
2022-01-03 10:42:10 +01:00
Copyright (C) 2012-2022 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
alias.c: Reorder #include statements and remove duplicates. 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * alias.c: Reorder #include statements and remove duplicates. * asan.c: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * auto-profile.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * ccmp.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * cilk-common.c: Likewise. * combine-stack-adj.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * cppbuiltin.c: Likewise. * cprop.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * data-streamer-in.c: Likewise. * data-streamer-out.c: Likewise. * data-streamer.c: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * debug.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dfp.c: Likewise. * dojump.c: Likewise. * dominance.c: Likewise. * double-int.c: Likewise. * dse.c: Likewise. * dumpfile.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * final.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * fwprop.c: Likewise. * gcse.c: Likewise. * generic-match-head.c: Likewise. * ggc-common.c: Likewise. * gimple-builder.c: Likewise. * gimple-expr.c: Likewise. * gimple-fold.c: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-match-head.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimple.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * godump.c: Likewise. * graph.c: Likewise. * graphite-poly.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * internal-fn.c: Likewise. * ipa-chkp.c: Likewise. * ipa-comdats.c: Likewise. * ipa-cp.c: Likewise. * ipa-devirt.c: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref.c: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-visibility.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-assigns.c: Likewise. * lra-coalesce.c: Likewise. * lra-constraints.c: Likewise. * lra-eliminations.c: Likewise. * lra-lives.c: Likewise. * lra-remat.c: Likewise. * lra-spills.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * opts-global.c: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * realmpfr.c: Likewise. * recog.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regrename.c: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl-chkp.c: Likewise. * rtl-error.c: Likewise. * rtlanal.c: Likewise. * rtlhooks.c: Likewise. * sanopt.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sese.c: Likewise. * shrink-wrap.c: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * statistics.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * symtab.c: Likewise. * target-globals.c: Likewise. * targhooks.c: Likewise. * toplev.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-affine.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp-opt.c: Likewise. * tree-chkp.c: Likewise. * tree-chrec.c: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nested.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-scopedtables.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tsan.c: Likewise. * ubsan.c: Likewise. * value-prof.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vtable-verify.c: Likewise. * web.c: Likewise. * wide-int-print.cc: Likewise. * wide-int.cc: Likewise. * xcoffout.c: Likewise. From-SVN: r229526
2015-10-29 14:57:32 +01:00
#include "options.h"
#include "tree.h"
#include "gimple-pretty-print.h"
#include "diagnostic-core.h"
#include "dumpfile.h"
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
#include "context.h"
#include "profile-count.h"
#include "tree-cfg.h"
#include "langhooks.h"
Introduce dump_location_t 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-26 15:34:59 +02:00
#include "backend.h" /* for gimple.h. */
#include "gimple.h" /* for dump_user_location_t ctor. */
#include "rtl.h" /* for dump_user_location_t ctor. */
#include "selftest.h"
Add "optinfo" framework 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-19 22:49:25 +02:00
#include "optinfo.h"
#include "dump-context.h"
#include "cgraph.h"
#include "tree-pass.h" /* for "current_pass". */
Add "-fsave-optimization-record" 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-20 17:37:23 +02:00
#include "optinfo-emit-json.h"
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
#include "stringpool.h" /* for get_identifier. */
#include "spellcheck.h"
/* If non-NULL, return one past-the-end of the matching SUBPART of
the WHOLE string. */
#define skip_leading_substring(whole, part) \
(strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * class.c (dump_class_hierarchy): Introduce dump_flags_t type and use it instead of int type. (dump_vtable): Likewise. (dump_vtt): Likewise. * decl2.c (dump_tu): Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-common.h: Introduce dump_flags_t type and use it instead of int type. * c-gimplify.c (c_genericize): Likewise. * c-opts.c: Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-decl.c (c_parse_final_cleanups): Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * cfg.c: Introduce dump_flags_t type and use it instead of int type. * cfg.h: Likewise. * cfghooks.c: Likewise. * cfghooks.h (struct cfg_hooks): Likewise. * cfgrtl.c: Likewise. * cfgrtl.h: Likewise. * cgraph.c (cgraph_node::get_body): Likewise. * coretypes.h: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dumpfile.c (struct dump_option_value_info): Likewise. (dump_enable_all): Likewise. (dump_switch_p_1): Likewise. (opt_info_switch_p): Likewise. * dumpfile.h (enum tree_dump_index): Likewise. (struct dump_file_info): Likewise. * genemit.c: Likewise. * generic-match-head.c: Likewise. * gengtype.c (open_base_files): Likewise. * gimple-pretty-print.c: Likewise. * gimple-pretty-print.h: Likewise. * graph.c (print_graph_cfg): Likewise. * graphite-scop-detection.c (dot_all_sese): Likewise. * ipa-devirt.c (build_type_inheritance_graph): Likewise. * loop-unroll.c (report_unroll): Likewise. * passes.c (pass_manager::register_one_dump_file): Likewise. * print-tree.c: Likewise. * statistics.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-dfa.c: Likewise. * tree-dfa.h: Likewise. * tree-dump.c (dump_function): Likewise. * tree-dump.h (struct dump_info): Likewise. * tree-pretty-print.c: Likewise. * tree-pretty-print.h: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise. * tree-vect-loop.c: Likewise. * tree-vect-slp.c: Likewise. From-SVN: r248140
2017-05-17 11:01:36 +02:00
static dump_flags_t pflags; /* current dump_flags */
Eliminate source_location in favor of location_t 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-13 21:05:03 +01:00
static void dump_loc (dump_flags_t, FILE *, location_t);
/* Current -fopt-info output stream, if any, and flags. */
static FILE *alt_dump_file = NULL;
static dump_flags_t alt_flags;
static FILE *dump_open_alternate_stream (struct dump_file_info *);
/* These are currently used for communicating between passes.
However, instead of accessing them directly, the passes can use
dump_printf () for dumps. */
FILE *dump_file = NULL;
const char *dump_file_name;
Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * class.c (dump_class_hierarchy): Introduce dump_flags_t type and use it instead of int type. (dump_vtable): Likewise. (dump_vtt): Likewise. * decl2.c (dump_tu): Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-common.h: Introduce dump_flags_t type and use it instead of int type. * c-gimplify.c (c_genericize): Likewise. * c-opts.c: Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-decl.c (c_parse_final_cleanups): Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * cfg.c: Introduce dump_flags_t type and use it instead of int type. * cfg.h: Likewise. * cfghooks.c: Likewise. * cfghooks.h (struct cfg_hooks): Likewise. * cfgrtl.c: Likewise. * cfgrtl.h: Likewise. * cgraph.c (cgraph_node::get_body): Likewise. * coretypes.h: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dumpfile.c (struct dump_option_value_info): Likewise. (dump_enable_all): Likewise. (dump_switch_p_1): Likewise. (opt_info_switch_p): Likewise. * dumpfile.h (enum tree_dump_index): Likewise. (struct dump_file_info): Likewise. * genemit.c: Likewise. * generic-match-head.c: Likewise. * gengtype.c (open_base_files): Likewise. * gimple-pretty-print.c: Likewise. * gimple-pretty-print.h: Likewise. * graph.c (print_graph_cfg): Likewise. * graphite-scop-detection.c (dot_all_sese): Likewise. * ipa-devirt.c (build_type_inheritance_graph): Likewise. * loop-unroll.c (report_unroll): Likewise. * passes.c (pass_manager::register_one_dump_file): Likewise. * print-tree.c: Likewise. * statistics.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-dfa.c: Likewise. * tree-dfa.h: Likewise. * tree-dump.c (dump_function): Likewise. * tree-dump.h (struct dump_info): Likewise. * tree-pretty-print.c: Likewise. * tree-pretty-print.h: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise. * tree-vect-loop.c: Likewise. * tree-vect-slp.c: Likewise. From-SVN: r248140
2017-05-17 11:01:36 +02:00
dump_flags_t dump_flags;
bool dumps_are_enabled = false;
/* Set global "dump_file" to NEW_DUMP_FILE, refreshing the "dumps_are_enabled"
global. */
void
set_dump_file (FILE *new_dump_file)
{
Add "optinfo" framework 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-19 22:49:25 +02:00
dumpfile_ensure_any_optinfo_are_flushed ();
dump_file = new_dump_file;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_context::get ().refresh_dumps_are_enabled ();
}
/* Set "alt_dump_file" to NEW_ALT_DUMP_FILE, refreshing the "dumps_are_enabled"
global. */
static void
set_alt_dump_file (FILE *new_alt_dump_file)
{
Add "optinfo" framework 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-19 22:49:25 +02:00
dumpfile_ensure_any_optinfo_are_flushed ();
alt_dump_file = new_alt_dump_file;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_context::get ().refresh_dumps_are_enabled ();
}
#define DUMP_FILE_INFO(suffix, swtch, dkind, num) \
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
{suffix, swtch, NULL, NULL, NULL, NULL, NULL, dkind, TDF_NONE, TDF_NONE, \
OPTGROUP_NONE, 0, 0, num, false, false}
/* Table of tree dump switches. This must be consistent with the
TREE_DUMP_INDEX enumeration in dumpfile.h. */
static struct dump_file_info dump_files[TDI_end] =
{
DUMP_FILE_INFO (NULL, NULL, DK_none, 0),
DUMP_FILE_INFO (".cgraph", "ipa-cgraph", DK_ipa, 0),
DUMP_FILE_INFO (".type-inheritance", "ipa-type-inheritance", DK_ipa, 0),
DUMP_FILE_INFO (".ipa-clones", "ipa-clones", DK_ipa, 0),
DUMP_FILE_INFO (".original", "tree-original", DK_tree, 0),
DUMP_FILE_INFO (".gimple", "tree-gimple", DK_tree, 0),
DUMP_FILE_INFO (".nested", "tree-nested", DK_tree, 0),
DUMP_FILE_INFO (".lto-stream-out", "ipa-lto-stream-out", DK_ipa, 0),
DUMP_FILE_INFO (".profile-report", "profile-report", DK_ipa, 0),
#define FIRST_AUTO_NUMBERED_DUMP 1
#define FIRST_ME_AUTO_NUMBERED_DUMP 5
DUMP_FILE_INFO (NULL, "lang-all", DK_lang, 0),
DUMP_FILE_INFO (NULL, "tree-all", DK_tree, 0),
DUMP_FILE_INFO (NULL, "rtl-all", DK_rtl, 0),
DUMP_FILE_INFO (NULL, "ipa-all", DK_ipa, 0),
};
/* Table of dump options. This must be consistent with the TDF_* flags
in dumpfile.h and opt_info_options below. */
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
static const kv_pair<dump_flags_t> dump_options[] =
{
{"none", TDF_NONE},
{"address", TDF_ADDRESS},
{"asmname", TDF_ASMNAME},
{"slim", TDF_SLIM},
{"raw", TDF_RAW},
{"graph", TDF_GRAPH},
{"details", (TDF_DETAILS | MSG_OPTIMIZED_LOCATIONS
| MSG_MISSED_OPTIMIZATION
| MSG_NOTE)},
{"cselib", TDF_CSELIB},
{"stats", TDF_STATS},
{"blocks", TDF_BLOCKS},
{"vops", TDF_VOPS},
{"lineno", TDF_LINENO},
{"uid", TDF_UID},
{"stmtaddr", TDF_STMTADDR},
{"memsyms", TDF_MEMSYMS},
{"eh", TDF_EH},
{"alias", TDF_ALIAS},
{"nouid", TDF_NOUID},
{"enumerate_locals", TDF_ENUMERATE_LOCALS},
{"scev", TDF_SCEV},
Make-lang.in (C_AND_OBJC_OBJS): Add gimple-parser.o. 2016-11-14 Prasad Ghangal <prasad.ghangal@gmail.com> Richard Biener <rguenther@suse.de> c/ * Make-lang.in (C_AND_OBJC_OBJS): Add gimple-parser.o. * config-lang.in (gtfiles): Add c/c-parser.h. * c-tree.h (enum c_declspec_word): Add cdw_gimple. (struct c_declspecs): Add gimple_pass member and gimple_p flag. * c-parser.c (enum c_id_kind, struct c_token, c_parser_next_token_is, c_parser_next_token_is_not, c_parser_next_token_is_keyword, enum c_lookahead_kind, enum c_dtr_syn, enum c_parser_prec): Split out to ... * c-parser.h: ... new header. * c-parser.c: Include c-parser.h and gimple-parser.h. (c_parser_peek_token, c_parser_peek_2nd_token, c_token_starts_typename, c_parser_next_token_starts_declspecs, c_parser_next_tokens_start_declaration, c_parser_consume_token, c_parser_error, c_parser_require, c_parser_skip_until_found, c_parser_declspecs, c_parser_declarator, c_parser_peek_nth_token, c_parser_type_name): Export. (c_parser_tokens_buf): New function. (c_parser_error): Likewise. (c_parser_set_error): Likewise. (c_parser_declspecs): Handle RID_GIMPLE. (c_parser_declaration_or_fndef): Parse __GIMPLE marked body via c_parser_parse_gimple_body. * c-parser.h (c_parser_peek_token, c_parser_peek_2nd_token, c_token_starts_typename, c_parser_next_token_starts_declspecs, c_parser_next_tokens_start_declaration, c_parser_consume_token, c_parser_error, c_parser_require, c_parser_skip_until_found, c_parser_declspecs, c_parser_declarator, c_parser_peek_nth_token, c_parser_type_name): Declare. (struct c_parser): Declare forward. (c_parser_tokens_buf): Declare. (c_parser_error): Likewise. (c_parser_set_error): Likewise. * gimple-parser.c: New file. * gimple-parser.h: Likewise. obj-c/ * config-lang.in (gtfiles): Add c/c-parser.h. c-family/ * c-common.h (c_common_resword): Add RID_GIMPLE, RID_PHI types. * c-common.h (enum rid): Add RID_GIMPLE, RID_PHI. * c.opt (fgimple): New option. * doc/invoke.texi (fgimple): Document. * dumpfile.h (TDF_GIMPLE): Add. * dumpfile.c (dump_options): Add gimple. * gimple-pretty-print.c (dump_gimple_switch): Adjust dump for TDF_GIMPLE. (dump_gimple_label): Likewise. (dump_gimple_phi): Likewise. (dump_gimple_bb_header): Likewise. (dump_phi_nodes): Likewise. (pp_cfg_jump): Likewise. Pass in dump flags. (dump_implicit_edges): Adjust. * passes.c (pass_init_dump_file): Do not dump function header for TDF_GIMPLE. * tree-cfg.c (dump_function_to_file): Dump function return type and __GIMPLE keyword for TDF_GIMPLE. Change guard for dumping GIMPLE stmts. * tree-pretty-print.c (dump_decl_name): Adjust dump for TDF_GIMPLE. (dump_generic_node): Likewise. * function.h (struct function): Add pass_startwith member. * passes.c (execute_one_pass): Implement startwith. * tree-ssanames.c (make_ssa_name_fn): New argument, check for version and assign proper version for parsed ssa names. * tree-ssanames.h (make_ssa_name_fn): Add new argument to the function. * internal-fn.c (expand_PHI): New function. * internal-fn.h (expand_PHI): Declared here. * internal-fn.def: New defination for PHI. * tree-cfg.c (lower_phi_internal_fn): New function. (build_gimple_cfg): Call it. (verify_gimple_call): Condition for passing label as arg in internal function PHI. * tree-into-ssa.c (rewrite_add_phi_arguments): Handle already present PHIs with arguments. testsuite/ * gcc.dg/gimplefe-1.c: New testcase. * gcc.dg/gimplefe-2.c: Likewise. * gcc.dg/gimplefe-3.c: Likewise. * gcc.dg/gimplefe-4.c: Likewise. * gcc.dg/gimplefe-5.c: Likewise. * gcc.dg/gimplefe-6.c: Likewise. * gcc.dg/gimplefe-7.c: Likewise. * gcc.dg/gimplefe-8.c: Likewise. * gcc.dg/gimplefe-9.c: Likewise. * gcc.dg/gimplefe-10.c: Likewise. * gcc.dg/gimplefe-11.c: Likewise. * gcc.dg/gimplefe-12.c: Likewise. * gcc.dg/gimplefe-13.c: Likewise. * gcc.dg/gimplefe-14.c: Likewise. * gcc.dg/gimplefe-15.c: Likewise. * gcc.dg/gimplefe-16.c: Likewise. * gcc.dg/gimplefe-17.c: Likewise. * gcc.dg/gimplefe-18.c: Likewise. Co-Authored-By: Richard Biener <rguenther@suse.de> From-SVN: r242387
2016-11-14 14:51:48 +01:00
{"gimple", TDF_GIMPLE},
{"folding", TDF_FOLDING},
{"optimized", MSG_OPTIMIZED_LOCATIONS},
{"missed", MSG_MISSED_OPTIMIZATION},
{"note", MSG_NOTE},
Add -fopt-info-internals 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-04 19:41:08 +02:00
{"optall", MSG_ALL_KINDS},
{"all", dump_flags_t (TDF_ALL_VALUES
& ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_GRAPH
| TDF_STMTADDR | TDF_RHS_ONLY | TDF_NOUID
| TDF_ENUMERATE_LOCALS | TDF_SCEV | TDF_GIMPLE))},
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
{NULL, TDF_NONE}
};
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
/* A subset of the dump_options table which is used for -fopt-info
types. This must be consistent with the MSG_* flags in dumpfile.h.
*/
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
static const kv_pair<dump_flags_t> optinfo_verbosity_options[] =
{
{"optimized", MSG_OPTIMIZED_LOCATIONS},
{"missed", MSG_MISSED_OPTIMIZATION},
{"note", MSG_NOTE},
Add -fopt-info-internals 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-04 19:41:08 +02:00
{"all", MSG_ALL_KINDS},
{"internals", MSG_PRIORITY_INTERNALS},
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
{NULL, TDF_NONE}
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
};
/* Flags used for -fopt-info groups. */
Add "-fsave-optimization-record" 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-20 17:37:23 +02:00
const kv_pair<optgroup_flags_t> optgroup_options[] =
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
{
{"ipa", OPTGROUP_IPA},
{"loop", OPTGROUP_LOOP},
{"inline", OPTGROUP_INLINE},
{"omp", OPTGROUP_OMP},
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
{"vec", OPTGROUP_VEC},
{"optall", OPTGROUP_ALL},
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
{NULL, OPTGROUP_NONE}
};
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
gcc::dump_manager::dump_manager ():
m_next_dump (FIRST_AUTO_NUMBERED_DUMP),
m_extra_dump_files (NULL),
m_extra_dump_files_in_use (0),
Fix -fopt-info for plugin passes 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-10-04 16:33:47 +02:00
m_extra_dump_files_alloced (0),
m_optgroup_flags (OPTGROUP_NONE),
m_optinfo_flags (TDF_NONE),
m_optinfo_filename (NULL)
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
{
}
gcc::dump_manager::~dump_manager ()
{
Fix -fopt-info for plugin passes 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-10-04 16:33:47 +02:00
free (m_optinfo_filename);
for (size_t i = 0; i < m_extra_dump_files_in_use; i++)
{
dump_file_info *dfi = &m_extra_dump_files[i];
/* suffix, swtch, glob are statically allocated for the entries
in dump_files, and for statistics, but are dynamically allocated
for those for passes. */
if (dfi->owns_strings)
{
XDELETEVEC (const_cast <char *> (dfi->suffix));
XDELETEVEC (const_cast <char *> (dfi->swtch));
XDELETEVEC (const_cast <char *> (dfi->glob));
}
/* These, if non-NULL, are always dynamically allocated. */
XDELETEVEC (const_cast <char *> (dfi->pfilename));
XDELETEVEC (const_cast <char *> (dfi->alt_filename));
}
XDELETEVEC (m_extra_dump_files);
}
unsigned int
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
gcc::dump_manager::
dump_register (const char *suffix, const char *swtch, const char *glob,
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
dump_kind dkind, optgroup_flags_t optgroup_flags,
bool take_ownership)
{
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
int num = m_next_dump++;
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
size_t count = m_extra_dump_files_in_use++;
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
if (count >= m_extra_dump_files_alloced)
{
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
if (m_extra_dump_files_alloced == 0)
m_extra_dump_files_alloced = 512;
else
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
m_extra_dump_files_alloced *= 2;
m_extra_dump_files = XRESIZEVEC (struct dump_file_info,
m_extra_dump_files,
m_extra_dump_files_alloced);
PR c++/80560 - warn on undefined memory operations involving non-trivial types 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-16 05:48:59 +02:00
/* Construct a new object in the space allocated above. */
new (m_extra_dump_files + count) dump_file_info ();
}
else
{
/* Zero out the already constructed object. */
m_extra_dump_files[count] = dump_file_info ();
}
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
m_extra_dump_files[count].suffix = suffix;
m_extra_dump_files[count].swtch = swtch;
m_extra_dump_files[count].glob = glob;
m_extra_dump_files[count].dkind = dkind;
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
m_extra_dump_files[count].optgroup_flags = optgroup_flags;
m_extra_dump_files[count].num = num;
m_extra_dump_files[count].owns_strings = take_ownership;
return count + TDI_end;
}
/* Allow languages and middle-end to register their dumps before the
optimization passes. */
void
gcc::dump_manager::
register_dumps ()
{
lang_hooks.register_dumps (this);
/* If this assert fails, some FE registered more than
FIRST_ME_AUTO_NUMBERED_DUMP - FIRST_AUTO_NUMBERED_DUMP
dump files. Bump FIRST_ME_AUTO_NUMBERED_DUMP accordingly. */
gcc_assert (m_next_dump <= FIRST_ME_AUTO_NUMBERED_DUMP);
m_next_dump = FIRST_ME_AUTO_NUMBERED_DUMP;
dump_files[TDI_original].num = m_next_dump++;
dump_files[TDI_gimple].num = m_next_dump++;
dump_files[TDI_nested].num = m_next_dump++;
}
/* Return the dump_file_info for the given phase. */
struct dump_file_info *
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
gcc::dump_manager::
get_dump_file_info (int phase) const
{
if (phase < TDI_end)
return &dump_files[phase];
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
else if ((size_t) (phase - TDI_end) >= m_extra_dump_files_in_use)
return NULL;
else
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
return m_extra_dump_files + (phase - TDI_end);
}
/* Locate the dump_file_info with swtch equal to SWTCH,
or return NULL if no such dump_file_info exists. */
struct dump_file_info *
gcc::dump_manager::
get_dump_file_info_by_switch (const char *swtch) const
{
for (unsigned i = 0; i < m_extra_dump_files_in_use; i++)
read-rtl.c (parse_reg_note_name): Replace Yoda conditions with typical order 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-12-19 18:11:57 +01:00
if (strcmp (m_extra_dump_files[i].swtch, swtch) == 0)
return &m_extra_dump_files[i];
/* Not found. */
return NULL;
}
/* Return the name of the dump file for the given phase.
The caller is responsible for calling free on the returned
buffer.
If the dump is not enabled, returns NULL. */
char *
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
gcc::dump_manager::
get_dump_file_name (int phase, int part) const
{
struct dump_file_info *dfi;
if (phase == TDI_none)
return NULL;
dfi = get_dump_file_info (phase);
return get_dump_file_name (dfi, part);
}
/* Return the name of the dump file for the given dump_file_info.
The caller is responsible for calling free on the returned
buffer.
If the dump is not enabled, returns NULL. */
char *
gcc::dump_manager::
get_dump_file_name (struct dump_file_info *dfi, int part) const
{
char dump_id[10];
gcc_assert (dfi);
if (dfi->pstate == 0)
return NULL;
/* If available, use the command line dump filename. */
if (dfi->pfilename)
return xstrdup (dfi->pfilename);
if (dfi->num < 0)
dump_id[0] = '\0';
else
{
/* (null), LANG, TREE, RTL, IPA. */
char suffix = " ltri"[dfi->dkind];
if (snprintf (dump_id, sizeof (dump_id), ".%03d%c", dfi->num, suffix) < 0)
dump_id[0] = '\0';
}
if (part != -1)
{
char part_id[8];
snprintf (part_id, sizeof (part_id), ".%i", part);
return concat (dump_base_name, dump_id, part_id, dfi->suffix, NULL);
}
else
return concat (dump_base_name, dump_id, dfi->suffix, NULL);
}
/* Open a dump file called FILENAME. Some filenames are special and
refer to the standard streams. TRUNC indicates whether this is the
first open (so the file should be truncated, rather than appended).
An error message is emitted in the event of failure. */
static FILE *
dump_open (const char *filename, bool trunc)
{
if (strcmp ("stderr", filename) == 0)
return stderr;
if (strcmp ("stdout", filename) == 0
|| strcmp ("-", filename) == 0)
return stdout;
FILE *stream = fopen (filename, trunc ? "w" : "a");
if (!stream)
error ("could not open dump file %qs: %m", filename);
return stream;
}
/* For a given DFI, open an alternate dump filename (which could also
be a standard stream such as stdout/stderr). If the alternate dump
file cannot be opened, return NULL. */
static FILE *
dump_open_alternate_stream (struct dump_file_info *dfi)
{
if (!dfi->alt_filename)
return NULL;
if (dfi->alt_stream)
return dfi->alt_stream;
FILE *stream = dump_open (dfi->alt_filename, dfi->alt_state < 0);
if (stream)
dfi->alt_state = 1;
return stream;
}
Introduce dump_location_t 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-26 15:34:59 +02:00
/* Construct a dump_user_location_t from STMT (using its location and
hotness). */
dump_user_location_t::dump_user_location_t (const gimple *stmt)
Introduce dump_location_t 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-26 15:34:59 +02:00
: m_count (), m_loc (UNKNOWN_LOCATION)
{
if (stmt)
{
if (stmt->bb)
m_count = stmt->bb->count;
m_loc = gimple_location (stmt);
}
}
/* Construct a dump_user_location_t from an RTL instruction (using its
location and hotness). */
dump_user_location_t::dump_user_location_t (const rtx_insn *insn)
Introduce dump_location_t 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-26 15:34:59 +02:00
: m_count (), m_loc (UNKNOWN_LOCATION)
{
if (insn)
{
basic_block bb = BLOCK_FOR_INSN (insn);
if (bb)
m_count = bb->count;
m_loc = INSN_LOCATION (insn);
}
}
/* Construct from a function declaration. This one requires spelling out
to avoid accidentally constructing from other kinds of tree. */
dump_user_location_t
dump_user_location_t::from_function_decl (tree fndecl)
{
gcc_assert (fndecl);
// FIXME: profile count for function?
return dump_user_location_t (profile_count (),
DECL_SOURCE_LOCATION (fndecl));
}
dumpfile.c: use prefixes other than 'note: ' for 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-28 19:40:04 +02:00
/* Extract the MSG_* component from DUMP_KIND and return a string for use
as a prefix to dump messages.
These match the strings in optinfo_verbosity_options and thus the
"OPTIONS" within "-fopt-info-OPTIONS". */
static const char *
kind_as_string (dump_flags_t dump_kind)
{
Add -fopt-info-internals 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-04 19:41:08 +02:00
switch (dump_kind & MSG_ALL_KINDS)
dumpfile.c: use prefixes other than 'note: ' for 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-28 19:40:04 +02:00
{
default:
gcc_unreachable ();
case MSG_OPTIMIZED_LOCATIONS:
return "optimized";
case MSG_MISSED_OPTIMIZATION:
return "missed";
case MSG_NOTE:
return "note";
}
}
/* Print source location on DFILE if enabled. */
Introduce dump_location_t 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-26 15:34:59 +02:00
static void
Eliminate source_location in favor of location_t 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-13 21:05:03 +01:00
dump_loc (dump_flags_t dump_kind, FILE *dfile, location_t loc)
{
if (dump_kind)
{
if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION)
dumpfile.c: use prefixes other than 'note: ' for 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-28 19:40:04 +02:00
fprintf (dfile, "%s:%d:%d: ", LOCATION_FILE (loc),
LOCATION_LINE (loc), LOCATION_COLUMN (loc));
else if (current_function_decl)
dumpfile.c: use prefixes other than 'note: ' for 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-28 19:40:04 +02:00
fprintf (dfile, "%s:%d:%d: ",
DECL_SOURCE_FILE (current_function_decl),
DECL_SOURCE_LINE (current_function_decl),
DECL_SOURCE_COLUMN (current_function_decl));
dumpfile.c: use prefixes other than 'note: ' for 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-28 19:40:04 +02:00
fprintf (dfile, "%s: ", kind_as_string (dump_kind));
dumpfile.c: add indentation via DUMP_VECT_SCOPE 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-29 11:56:40 +02:00
/* Indentation based on scope depth. */
fprintf (dfile, "%*s", get_dump_scope_depth (), "");
}
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Print source location to PP if enabled. */
static void
Eliminate source_location in favor of location_t 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-13 21:05:03 +01:00
dump_loc (dump_flags_t dump_kind, pretty_printer *pp, location_t loc)
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
{
/* Disable warnings about missing quoting in GCC diagnostics for
the pp_printf calls. Their format strings aren't used to format
diagnostics so don't need to follow GCC diagnostic conventions. */
#if __GNUC__ >= 10
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wformat-diag"
#endif
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
if (dump_kind)
{
if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION)
dumpfile.c: use prefixes other than 'note: ' for 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-28 19:40:04 +02:00
pp_printf (pp, "%s:%d:%d: ", LOCATION_FILE (loc),
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
LOCATION_LINE (loc), LOCATION_COLUMN (loc));
else if (current_function_decl)
dumpfile.c: use prefixes other than 'note: ' for 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-28 19:40:04 +02:00
pp_printf (pp, "%s:%d:%d: ",
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
DECL_SOURCE_FILE (current_function_decl),
DECL_SOURCE_LINE (current_function_decl),
DECL_SOURCE_COLUMN (current_function_decl));
dumpfile.c: use prefixes other than 'note: ' for 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-28 19:40:04 +02:00
pp_printf (pp, "%s: ", kind_as_string (dump_kind));
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Indentation based on scope depth. */
for (unsigned i = 0; i < get_dump_scope_depth (); i++)
pp_character (pp, ' ');
}
#if __GNUC__ >= 10
# pragma GCC diagnostic pop
#endif
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
Add "optinfo" framework 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-19 22:49:25 +02:00
/* Implementation of dump_context member functions. */
/* dump_context's dtor. */
dump_context::~dump_context ()
{
delete m_pending;
}
Eliminate global state from -fsave-optimization-record 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-19 17:31:03 +01:00
void
dump_context::set_json_writer (optrecord_json_writer *writer)
{
delete m_json_writer;
m_json_writer = writer;
}
/* Perform cleanup activity for -fsave-optimization-record.
Currently, the file is written out here in one go, before cleaning
up. */
void
dump_context::finish_any_json_writer ()
{
if (!m_json_writer)
return;
m_json_writer->write ();
delete m_json_writer;
m_json_writer = NULL;
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Update the "dumps_are_enabled" global; to be called whenever dump_file
or alt_dump_file change, or when changing dump_context in selftests. */
void
dump_context::refresh_dumps_are_enabled ()
{
dumps_are_enabled = (dump_file || alt_dump_file || optinfo_enabled_p ()
|| m_test_pp);
}
Add -fopt-info-internals 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-04 19:41:08 +02:00
/* Determine if a message of kind DUMP_KIND and at the current scope depth
should be printed.
Only show messages that match FILTER both on their kind *and*
their priority. */
bool
dump_context::apply_dump_filter_p (dump_flags_t dump_kind,
dump_flags_t filter) const
{
/* Few messages, if any, have an explicit MSG_PRIORITY.
If DUMP_KIND does, we'll use it.
Otherwise, generate an implicit priority value for the message based
on the current scope depth.
Messages at the top-level scope are MSG_PRIORITY_USER_FACING,
whereas those in nested scopes are MSG_PRIORITY_INTERNALS. */
if (!(dump_kind & MSG_ALL_PRIORITIES))
{
dump_flags_t implicit_priority
= (m_scope_depth > 0
? MSG_PRIORITY_INTERNALS
: MSG_PRIORITY_USER_FACING);
dump_kind |= implicit_priority;
}
return (dump_kind & (filter & MSG_ALL_KINDS)
&& dump_kind & (filter & MSG_ALL_PRIORITIES));
}
/* Print LOC to the appropriate dump destinations, given DUMP_KIND.
If optinfos are enabled, begin a new optinfo. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::dump_loc (const dump_metadata_t &metadata,
const dump_user_location_t &loc)
{
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
end_any_optinfo ();
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_loc_immediate (metadata.get_dump_flags (), loc);
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
if (optinfo_enabled_p ())
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
begin_next_optinfo (metadata, loc);
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
}
/* As dump_loc above, but without starting a new optinfo. */
void
dump_context::dump_loc_immediate (dump_flags_t dump_kind,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const dump_user_location_t &loc)
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
{
location_t srcloc = loc.get_location_t ();
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (dump_file && apply_dump_filter_p (dump_kind, pflags))
::dump_loc (dump_kind, dump_file, srcloc);
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (alt_dump_file && apply_dump_filter_p (dump_kind, alt_flags))
::dump_loc (dump_kind, alt_dump_file, srcloc);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Support for temp_dump_context in selftests. */
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (m_test_pp && apply_dump_filter_p (dump_kind, m_test_pp_flags))
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
::dump_loc (dump_kind, m_test_pp, srcloc);
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Make an item for the given dump call, equivalent to print_gimple_stmt. */
static optinfo_item *
make_item_for_dump_gimple_stmt (gimple *stmt, int spc, dump_flags_t dump_flags)
{
pretty_printer pp;
pp_needs_newline (&pp) = true;
pp_gimple_stmt_1 (&pp, stmt, spc, dump_flags);
pp_newline (&pp);
optinfo_item *item
= new optinfo_item (OPTINFO_ITEM_KIND_GIMPLE, gimple_location (stmt),
xstrdup (pp_formatted_text (&pp)));
return item;
}
/* Dump gimple statement GS with SPC indentation spaces and
EXTRA_DUMP_FLAGS on the dump streams if DUMP_KIND is enabled. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::dump_gimple_stmt (const dump_metadata_t &metadata,
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_flags_t extra_dump_flags,
gimple *gs, int spc)
{
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
optinfo_item *item
= make_item_for_dump_gimple_stmt (gs, spc, dump_flags | extra_dump_flags);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
emit_item (item, metadata.get_dump_flags ());
Add "optinfo" framework 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-19 22:49:25 +02:00
if (optinfo_enabled_p ())
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
optinfo &info = ensure_pending_optinfo (metadata);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
info.add_item (item);
Add "optinfo" framework 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-19 22:49:25 +02:00
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
else
delete item;
}
/* Similar to dump_gimple_stmt, except additionally print source location. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::dump_gimple_stmt_loc (const dump_metadata_t &metadata,
const dump_user_location_t &loc,
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_flags_t extra_dump_flags,
gimple *gs, int spc)
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_loc (metadata, loc);
dump_gimple_stmt (metadata, extra_dump_flags, gs, spc);
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Make an item for the given dump call, equivalent to print_gimple_expr. */
static optinfo_item *
make_item_for_dump_gimple_expr (gimple *stmt, int spc, dump_flags_t dump_flags)
{
dump_flags |= TDF_RHS_ONLY;
pretty_printer pp;
pp_needs_newline (&pp) = true;
pp_gimple_stmt_1 (&pp, stmt, spc, dump_flags);
optinfo_item *item
= new optinfo_item (OPTINFO_ITEM_KIND_GIMPLE, gimple_location (stmt),
xstrdup (pp_formatted_text (&pp)));
return item;
}
/* Dump gimple statement GS with SPC indentation spaces and
EXTRA_DUMP_FLAGS on the dump streams if DUMP_KIND is enabled.
Do not terminate with a newline or semicolon. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::dump_gimple_expr (const dump_metadata_t &metadata,
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_flags_t extra_dump_flags,
gimple *gs, int spc)
{
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
optinfo_item *item
= make_item_for_dump_gimple_expr (gs, spc, dump_flags | extra_dump_flags);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
emit_item (item, metadata.get_dump_flags ());
Add "optinfo" framework 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-19 22:49:25 +02:00
if (optinfo_enabled_p ())
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
optinfo &info = ensure_pending_optinfo (metadata);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
info.add_item (item);
Add "optinfo" framework 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-19 22:49:25 +02:00
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
else
delete item;
}
/* Similar to dump_gimple_expr, except additionally print source location. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::dump_gimple_expr_loc (const dump_metadata_t &metadata,
const dump_user_location_t &loc,
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_flags_t extra_dump_flags,
gimple *gs,
int spc)
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_loc (metadata, loc);
dump_gimple_expr (metadata, extra_dump_flags, gs, spc);
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Make an item for the given dump call, equivalent to print_generic_expr. */
static optinfo_item *
make_item_for_dump_generic_expr (tree node, dump_flags_t dump_flags)
{
pretty_printer pp;
pp_needs_newline (&pp) = true;
pp_translate_identifiers (&pp) = false;
dump_generic_node (&pp, node, 0, dump_flags, false);
location_t loc = UNKNOWN_LOCATION;
if (EXPR_HAS_LOCATION (node))
loc = EXPR_LOCATION (node);
optinfo_item *item
= new optinfo_item (OPTINFO_ITEM_KIND_TREE, loc,
xstrdup (pp_formatted_text (&pp)));
return item;
}
/* Dump expression tree T using EXTRA_DUMP_FLAGS on dump streams if
DUMP_KIND is enabled. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::dump_generic_expr (const dump_metadata_t &metadata,
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_flags_t extra_dump_flags,
tree t)
{
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
optinfo_item *item
= make_item_for_dump_generic_expr (t, dump_flags | extra_dump_flags);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
emit_item (item, metadata.get_dump_flags ());
Add "optinfo" framework 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-19 22:49:25 +02:00
if (optinfo_enabled_p ())
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
optinfo &info = ensure_pending_optinfo (metadata);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
info.add_item (item);
Add "optinfo" framework 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-19 22:49:25 +02:00
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
else
delete item;
}
/* Similar to dump_generic_expr, except additionally print the source
location. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::dump_generic_expr_loc (const dump_metadata_t &metadata,
const dump_user_location_t &loc,
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_flags_t extra_dump_flags,
tree t)
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_loc (metadata, loc);
dump_generic_expr (metadata, extra_dump_flags, t);
}
/* Make an item for the given dump call. */
static optinfo_item *
make_item_for_dump_symtab_node (symtab_node *node)
{
location_t loc = DECL_SOURCE_LOCATION (node->decl);
optinfo_item *item
= new optinfo_item (OPTINFO_ITEM_KIND_SYMTAB_NODE, loc,
xstrdup (node->dump_name ()));
return item;
}
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
/* dump_pretty_printer's ctor. */
dump_pretty_printer::dump_pretty_printer (dump_context *context,
dump_flags_t dump_kind)
: pretty_printer (), m_context (context), m_dump_kind (dump_kind),
m_stashed_items ()
{
pp_format_decoder (this) = format_decoder_cb;
}
/* Phase 3 of formatting; compare with pp_output_formatted_text.
Emit optinfo_item instances for the various formatted chunks from phases
1 and 2 (i.e. pp_format).
Some chunks may already have had their items built (during decode_format).
These chunks have been stashed into m_stashed_items; we emit them here.
For all other purely textual chunks, they are printed into
buffer->formatted_obstack, and then emitted as a textual optinfo_item.
This consolidates multiple adjacent text chunks into a single text
optinfo_item. */
void
dump_pretty_printer::emit_items (optinfo *dest)
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
{
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
output_buffer *buffer = pp_buffer (this);
struct chunk_info *chunk_array = buffer->cur_chunk_array;
const char **args = chunk_array->args;
gcc_assert (buffer->obstack == &buffer->formatted_obstack);
gcc_assert (buffer->line_length == 0);
unsigned stashed_item_idx = 0;
for (unsigned chunk = 0; args[chunk]; chunk++)
{
if (stashed_item_idx < m_stashed_items.length ()
&& args[chunk] == *m_stashed_items[stashed_item_idx].buffer_ptr)
{
emit_any_pending_textual_chunks (dest);
/* This chunk has a stashed item: use it. */
emit_item (m_stashed_items[stashed_item_idx++].item, dest);
}
else
/* This chunk is purely textual. Print it (to
buffer->formatted_obstack), so that we can consolidate adjacent
chunks into one textual optinfo_item. */
pp_string (this, args[chunk]);
}
emit_any_pending_textual_chunks (dest);
/* Ensure that we consumed all of stashed_items. */
gcc_assert (stashed_item_idx == m_stashed_items.length ());
/* Deallocate the chunk structure and everything after it (i.e. the
associated series of formatted strings). */
buffer->cur_chunk_array = chunk_array->prev;
obstack_free (&buffer->chunk_obstack, chunk_array);
}
/* Subroutine of dump_pretty_printer::emit_items
for consolidating multiple adjacent pure-text chunks into single
optinfo_items (in phase 3). */
void
dump_pretty_printer::emit_any_pending_textual_chunks (optinfo *dest)
{
gcc_assert (buffer->obstack == &buffer->formatted_obstack);
/* Don't emit an item if the pending text is empty. */
if (output_buffer_last_position_in_text (buffer) == NULL)
return;
char *formatted_text = xstrdup (pp_formatted_text (this));
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
optinfo_item *item
= new optinfo_item (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION,
formatted_text);
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
emit_item (item, dest);
/* Clear the pending text by unwinding formatted_text back to the start
of the buffer (without deallocating). */
obstack_free (&buffer->formatted_obstack,
buffer->formatted_obstack.object_base);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
/* Emit ITEM and take ownership of it. If DEST is non-NULL, add ITEM
to DEST; otherwise delete ITEM. */
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
void
dump_pretty_printer::emit_item (optinfo_item *item, optinfo *dest)
{
m_context->emit_item (item, m_dump_kind);
if (dest)
dest->add_item (item);
else
delete item;
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
/* Record that ITEM (generated in phase 2 of formatting) is to be used for
the chunk at BUFFER_PTR in phase 3 (by emit_items). */
void
dump_pretty_printer::stash_item (const char **buffer_ptr, optinfo_item *item)
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
{
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
gcc_assert (buffer_ptr);
gcc_assert (item);
m_stashed_items.safe_push (stashed_item (buffer_ptr, item));
}
/* pp_format_decoder callback for dump_pretty_printer, and thus for
dump_printf and dump_printf_loc.
A wrapper around decode_format, for type-safety. */
bool
dump_pretty_printer::format_decoder_cb (pretty_printer *pp, text_info *text,
const char *spec, int /*precision*/,
bool /*wide*/, bool /*set_locus*/,
bool /*verbose*/, bool */*quoted*/,
const char **buffer_ptr)
{
dump_pretty_printer *opp = static_cast <dump_pretty_printer *> (pp);
return opp->decode_format (text, spec, buffer_ptr);
}
/* Format decoder for dump_pretty_printer, and thus for dump_printf and
dump_printf_loc.
Supported format codes (in addition to the standard pretty_printer ones)
are:
%C: cgraph_node *:
Equivalent to: dump_symtab_node (MSG_*, node)
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
%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).
TODO: add a format code that can handle (symtab_node*) *and* both
subclasses (presumably means teaching -Wformat about non-virtual
subclasses).
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
These format codes build optinfo_item instances, thus capturing metadata
about the arguments being dumped, as well as the textual output. */
bool
dump_pretty_printer::decode_format (text_info *text, const char *spec,
const char **buffer_ptr)
{
/* Various format codes that imply making an optinfo_item and stashed it
for later use (to capture metadata, rather than plain text). */
switch (*spec)
{
case 'C':
{
cgraph_node *node = va_arg (*text->args_ptr, cgraph_node *);
/* Make an item for the node, and stash it. */
optinfo_item *item = make_item_for_dump_symtab_node (node);
stash_item (buffer_ptr, item);
return true;
}
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
case 'E':
{
gimple *stmt = va_arg (*text->args_ptr, gimple *);
/* Make an item for the stmt, and stash it. */
optinfo_item *item = make_item_for_dump_gimple_expr (stmt, 0, TDF_SLIM);
stash_item (buffer_ptr, item);
return true;
}
case 'G':
{
gimple *stmt = va_arg (*text->args_ptr, gimple *);
/* Make an item for the stmt, and stash it. */
optinfo_item *item = make_item_for_dump_gimple_stmt (stmt, 0, TDF_SLIM);
stash_item (buffer_ptr, item);
return true;
}
case 'T':
{
tree t = va_arg (*text->args_ptr, tree);
/* Make an item for the tree, and stash it. */
optinfo_item *item = make_item_for_dump_generic_expr (t, TDF_SLIM);
stash_item (buffer_ptr, item);
return true;
}
default:
return false;
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
/* Output a formatted message using FORMAT on appropriate dump streams. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::dump_printf_va (const dump_metadata_t &metadata, const char *format,
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
va_list *ap)
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_pretty_printer pp (this, metadata.get_dump_flags ());
Add "optinfo" framework 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-19 22:49:25 +02:00
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
text_info text;
text.err_no = errno;
text.args_ptr = ap;
text.format_spec = format;
/* Phases 1 and 2, using pp_format. */
pp_format (&pp, &text);
/* Phase 3. */
Add "optinfo" framework 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-19 22:49:25 +02:00
if (optinfo_enabled_p ())
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
optinfo &info = ensure_pending_optinfo (metadata);
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
pp.emit_items (&info);
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
else
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
pp.emit_items (NULL);
}
Add "optinfo" framework 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-19 22:49:25 +02:00
/* Similar to dump_printf, except source location is also printed, and
dump location captured. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::dump_printf_loc_va (const dump_metadata_t &metadata,
const dump_user_location_t &loc,
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
const char *format, va_list *ap)
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_loc (metadata, loc);
dump_printf_va (metadata, format, ap);
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Make an item for the given dump call, equivalent to print_dec. */
template<unsigned int N, typename C>
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
static optinfo_item *
make_item_for_dump_dec (const poly_int<N, C> &value)
{
STATIC_ASSERT (poly_coeff_traits<C>::signedness >= 0);
signop sgn = poly_coeff_traits<C>::signedness ? SIGNED : UNSIGNED;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
pretty_printer pp;
if (value.is_constant ())
pp_wide_int (&pp, value.coeffs[0], sgn);
else
{
pp_character (&pp, '[');
for (unsigned int i = 0; i < N; ++i)
{
pp_wide_int (&pp, value.coeffs[i], sgn);
pp_character (&pp, i == N - 1 ? ']' : ',');
}
}
optinfo_item *item
= new optinfo_item (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION,
xstrdup (pp_formatted_text (&pp)));
return item;
}
/* Output VALUE in decimal to appropriate dump streams. */
template<unsigned int N, typename C>
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::dump_dec (const dump_metadata_t &metadata, const poly_int<N, C> &value)
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
{
optinfo_item *item = make_item_for_dump_dec (value);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
emit_item (item, metadata.get_dump_flags ());
Add "optinfo" framework 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-19 22:49:25 +02:00
if (optinfo_enabled_p ())
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
optinfo &info = ensure_pending_optinfo (metadata);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
info.add_item (item);
Add "optinfo" framework 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-19 22:49:25 +02:00
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
else
delete item;
}
Add "optinfo" framework 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-19 22:49:25 +02:00
/* Output the name of NODE on appropriate dump streams. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::dump_symtab_node (const dump_metadata_t &metadata, symtab_node *node)
Add "optinfo" framework 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-19 22:49:25 +02:00
{
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
optinfo_item *item = make_item_for_dump_symtab_node (node);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
emit_item (item, metadata.get_dump_flags ());
Add "optinfo" framework 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-19 22:49:25 +02:00
if (optinfo_enabled_p ())
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
optinfo &info = ensure_pending_optinfo (metadata);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
info.add_item (item);
Add "optinfo" framework 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-19 22:49:25 +02:00
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
else
delete item;
Add "optinfo" framework 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-19 22:49:25 +02:00
}
/* Get the current dump scope-nesting depth.
For use by -fopt-info (for showing nesting via indentation). */
unsigned int
dump_context::get_scope_depth () const
{
return m_scope_depth;
}
/* Push a nested dump scope.
Add -fopt-info-internals 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-04 19:41:08 +02:00
Increment the scope depth.
Add "optinfo" framework 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-19 22:49:25 +02:00
Print "=== NAME ===\n" to the dumpfile, if any, and to the -fopt-info
destination, if any.
Add -fopt-info-internals 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-04 19:41:08 +02:00
Emit a "scope" optinfo if optinfos are enabled. */
Add "optinfo" framework 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-19 22:49:25 +02:00
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::begin_scope (const char *name,
const dump_user_location_t &user_location,
const dump_impl_location_t &impl_location)
Add "optinfo" framework 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-19 22:49:25 +02:00
{
Add -fopt-info-internals 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-04 19:41:08 +02:00
m_scope_depth++;
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
location_t src_loc = user_location.get_location_t ();
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (dump_file && apply_dump_filter_p (MSG_NOTE, pflags))
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
::dump_loc (MSG_NOTE, dump_file, src_loc);
Add "optinfo" framework 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-19 22:49:25 +02:00
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (alt_dump_file && apply_dump_filter_p (MSG_NOTE, alt_flags))
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
::dump_loc (MSG_NOTE, alt_dump_file, src_loc);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Support for temp_dump_context in selftests. */
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (m_test_pp && apply_dump_filter_p (MSG_NOTE, m_test_pp_flags))
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
::dump_loc (MSG_NOTE, m_test_pp, src_loc);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Format multiple consecutive punctuation characters via %s to
avoid -Wformat-diag in the pp_printf call below whose output
isn't used for diagnostic output. */
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
pretty_printer pp;
pp_printf (&pp, "%s %s %s", "===", name, "===");
pp_newline (&pp);
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
optinfo_item *item
= new optinfo_item (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION,
xstrdup (pp_formatted_text (&pp)));
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
emit_item (item, MSG_NOTE);
Add "optinfo" framework 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-19 22:49:25 +02:00
if (optinfo_enabled_p ())
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
optinfo &info
= begin_next_optinfo (dump_metadata_t (MSG_NOTE, impl_location),
user_location);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
info.m_kind = OPTINFO_KIND_SCOPE;
info.add_item (item);
Fix -fsave-optimization-record ICE (PR tree-optimization/87025) 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-19 17:42:03 +01:00
end_any_optinfo ();
Add "optinfo" framework 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-19 22:49:25 +02:00
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
else
delete item;
Add "optinfo" framework 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-19 22:49:25 +02:00
}
/* Pop a nested dump scope. */
void
dump_context::end_scope ()
{
end_any_optinfo ();
m_scope_depth--;
Eliminate global state from -fsave-optimization-record 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-19 17:31:03 +01:00
if (m_json_writer)
m_json_writer->pop_scope ();
}
/* Should optinfo instances be created?
All creation of optinfos should be guarded by this predicate.
Return true if any optinfo destinations are active. */
bool
dump_context::optinfo_enabled_p () const
{
return (optimization_records_enabled_p ());
Add "optinfo" framework 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-19 22:49:25 +02:00
}
/* Return the optinfo currently being accumulated, creating one if
necessary. */
optinfo &
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::ensure_pending_optinfo (const dump_metadata_t &metadata)
Add "optinfo" framework 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-19 22:49:25 +02:00
{
if (!m_pending)
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
return begin_next_optinfo (metadata, dump_user_location_t ());
Add "optinfo" framework 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-19 22:49:25 +02:00
return *m_pending;
}
/* Start a new optinfo and return it, ending any optinfo that was already
accumulated. */
optinfo &
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::begin_next_optinfo (const dump_metadata_t &metadata,
const dump_user_location_t &user_loc)
Add "optinfo" framework 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-19 22:49:25 +02:00
{
end_any_optinfo ();
gcc_assert (m_pending == NULL);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_location_t loc (user_loc, metadata.get_impl_location ());
Add "optinfo" framework 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-19 22:49:25 +02:00
m_pending = new optinfo (loc, OPTINFO_KIND_NOTE, current_pass);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
m_pending->handle_dump_file_kind (metadata.get_dump_flags ());
Add "optinfo" framework 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-19 22:49:25 +02:00
return *m_pending;
}
/* End any optinfo that has been accumulated within this context; emitting
Add "-fsave-optimization-record" 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-20 17:37:23 +02:00
it to any destinations as appropriate, such as optimization records. */
Add "optinfo" framework 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-19 22:49:25 +02:00
void
dump_context::end_any_optinfo ()
{
if (m_pending)
Eliminate global state from -fsave-optimization-record 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-19 17:31:03 +01:00
emit_optinfo (m_pending);
Add "optinfo" framework 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-19 22:49:25 +02:00
delete m_pending;
m_pending = NULL;
}
Eliminate global state from -fsave-optimization-record 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-19 17:31:03 +01:00
/* Emit the optinfo to all of the "non-immediate" destinations
(emission to "immediate" destinations is done by
dump_context::emit_item). */
void
dump_context::emit_optinfo (const optinfo *info)
{
/* -fsave-optimization-record. */
if (m_json_writer)
m_json_writer->add_record (info);
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Emit ITEM to all item destinations (those that don't require
consolidation into optinfo instances). */
void
dump_context::emit_item (optinfo_item *item, dump_flags_t dump_kind)
{
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (dump_file && apply_dump_filter_p (dump_kind, pflags))
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
fprintf (dump_file, "%s", item->get_text ());
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (alt_dump_file && apply_dump_filter_p (dump_kind, alt_flags))
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
fprintf (alt_dump_file, "%s", item->get_text ());
/* Support for temp_dump_context in selftests. */
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (m_test_pp && apply_dump_filter_p (dump_kind, m_test_pp_flags))
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
pp_string (m_test_pp, item->get_text ());
}
Add "optinfo" framework 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-19 22:49:25 +02:00
/* The current singleton dump_context, and its default. */
dump_context *dump_context::s_current = &dump_context::s_default;
dump_context dump_context::s_default;
/* Implementation of dump_* API calls, calling into dump_context
member functions. */
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
/* Calls to the dump_* functions do non-trivial work, so they ought
to be guarded by:
if (dump_enabled_p ())
Assert that they are guarded, and, if assertions are disabled,
bail out if the calls weren't properly guarded. */
#define VERIFY_DUMP_ENABLED_P \
do { \
gcc_assert (dump_enabled_p ()); \
if (!dump_enabled_p ()) \
return; \
} while (0)
Add "optinfo" framework 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-19 22:49:25 +02:00
/* Dump gimple statement GS with SPC indentation spaces and
EXTRA_DUMP_FLAGS on the dump streams if DUMP_KIND is enabled. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_gimple_stmt (const dump_metadata_t &metadata, dump_flags_t extra_dump_flags,
Add "optinfo" framework 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-19 22:49:25 +02:00
gimple *gs, int spc)
{
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
VERIFY_DUMP_ENABLED_P;
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::get ().dump_gimple_stmt (metadata, extra_dump_flags, gs, spc);
Add "optinfo" framework 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-19 22:49:25 +02:00
}
/* Similar to dump_gimple_stmt, except additionally print source location. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_gimple_stmt_loc (const dump_metadata_t &metadata,
const dump_user_location_t &loc,
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_flags_t extra_dump_flags, gimple *gs, int spc)
{
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
VERIFY_DUMP_ENABLED_P;
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::get ().dump_gimple_stmt_loc (metadata, loc, extra_dump_flags,
Add "optinfo" framework 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-19 22:49:25 +02:00
gs, spc);
}
/* Dump gimple statement GS with SPC indentation spaces and
EXTRA_DUMP_FLAGS on the dump streams if DUMP_KIND is enabled.
Do not terminate with a newline or semicolon. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_gimple_expr (const dump_metadata_t &metadata,
dump_flags_t extra_dump_flags,
Add "optinfo" framework 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-19 22:49:25 +02:00
gimple *gs, int spc)
{
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
VERIFY_DUMP_ENABLED_P;
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::get ().dump_gimple_expr (metadata, extra_dump_flags, gs, spc);
Add "optinfo" framework 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-19 22:49:25 +02:00
}
/* Similar to dump_gimple_expr, except additionally print source location. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_gimple_expr_loc (const dump_metadata_t &metadata,
const dump_user_location_t &loc,
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_flags_t extra_dump_flags, gimple *gs, int spc)
{
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
VERIFY_DUMP_ENABLED_P;
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::get ().dump_gimple_expr_loc (metadata, loc, extra_dump_flags,
Add "optinfo" framework 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-19 22:49:25 +02:00
gs, spc);
}
/* Dump expression tree T using EXTRA_DUMP_FLAGS on dump streams if
DUMP_KIND is enabled. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_generic_expr (const dump_metadata_t &metadata, dump_flags_t extra_dump_flags,
Add "optinfo" framework 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-19 22:49:25 +02:00
tree t)
{
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
VERIFY_DUMP_ENABLED_P;
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::get ().dump_generic_expr (metadata, extra_dump_flags, t);
Add "optinfo" framework 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-19 22:49:25 +02:00
}
/* Similar to dump_generic_expr, except additionally print the source
location. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_generic_expr_loc (const dump_metadata_t &metadata,
const dump_user_location_t &loc,
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_flags_t extra_dump_flags, tree t)
{
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
VERIFY_DUMP_ENABLED_P;
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::get ().dump_generic_expr_loc (metadata, loc, extra_dump_flags,
Add "optinfo" framework 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-19 22:49:25 +02:00
t);
}
/* Output a formatted message using FORMAT on appropriate dump streams. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_printf (const dump_metadata_t &metadata, const char *format, ...)
Add "optinfo" framework 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-19 22:49:25 +02:00
{
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
VERIFY_DUMP_ENABLED_P;
Add "optinfo" framework 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-19 22:49:25 +02:00
va_list ap;
va_start (ap, format);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::get ().dump_printf_va (metadata, format, &ap);
Add "optinfo" framework 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-19 22:49:25 +02:00
va_end (ap);
}
/* Similar to dump_printf, except source location is also printed, and
dump location captured. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_printf_loc (const dump_metadata_t &metadata,
const dump_user_location_t &loc,
Add "optinfo" framework 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-19 22:49:25 +02:00
const char *format, ...)
{
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
VERIFY_DUMP_ENABLED_P;
Add "optinfo" framework 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-19 22:49:25 +02:00
va_list ap;
va_start (ap, format);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::get ().dump_printf_loc_va (metadata, loc, format, &ap);
Add "optinfo" framework 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-19 22:49:25 +02:00
va_end (ap);
}
/* Output VALUE in decimal to appropriate dump streams. */
template<unsigned int N, typename C>
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_dec (const dump_metadata_t &metadata, const poly_int<N, C> &value)
Add "optinfo" framework 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-19 22:49:25 +02:00
{
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
VERIFY_DUMP_ENABLED_P;
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::get ().dump_dec (metadata, value);
}
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
template void dump_dec (const dump_metadata_t &metadata, const poly_uint16 &);
template void dump_dec (const dump_metadata_t &metadata, const poly_int64 &);
template void dump_dec (const dump_metadata_t &metadata, const poly_uint64 &);
template void dump_dec (const dump_metadata_t &metadata, const poly_offset_int &);
template void dump_dec (const dump_metadata_t &metadata, const poly_widest_int &);
[14/n] PR85694: Rework overwidening detection 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-03 11:59:37 +02:00
void
dump_dec (dump_flags_t dump_kind, const poly_wide_int &value, signop sgn)
{
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
VERIFY_DUMP_ENABLED_P;
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (dump_file
&& dump_context::get ().apply_dump_filter_p (dump_kind, pflags))
[14/n] PR85694: Rework overwidening detection 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-03 11:59:37 +02:00
print_dec (value, dump_file, sgn);
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (alt_dump_file
&& dump_context::get ().apply_dump_filter_p (dump_kind, alt_flags))
[14/n] PR85694: Rework overwidening detection 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-03 11:59:37 +02:00
print_dec (value, alt_dump_file, sgn);
}
/* Output VALUE in hexadecimal to appropriate dump streams. */
void
dump_hex (dump_flags_t dump_kind, const poly_wide_int &value)
{
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
VERIFY_DUMP_ENABLED_P;
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (dump_file
&& dump_context::get ().apply_dump_filter_p (dump_kind, pflags))
[14/n] PR85694: Rework overwidening detection 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-03 11:59:37 +02:00
print_hex (value, dump_file);
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (alt_dump_file
&& dump_context::get ().apply_dump_filter_p (dump_kind, alt_flags))
[14/n] PR85694: Rework overwidening detection 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-03 11:59:37 +02:00
print_hex (value, alt_dump_file);
}
Add "optinfo" framework 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-19 22:49:25 +02:00
/* Emit and delete the currently pending optinfo, if there is one,
without the caller needing to know about class dump_context. */
void
dumpfile_ensure_any_optinfo_are_flushed ()
{
dump_context::get().end_any_optinfo ();
}
/* Output the name of NODE on appropriate dump streams. */
dumpfile.c: add indentation via DUMP_VECT_SCOPE 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-29 11:56:40 +02:00
Add "optinfo" framework 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-19 22:49:25 +02:00
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_symtab_node (const dump_metadata_t &metadata, symtab_node *node)
Add "optinfo" framework 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-19 22:49:25 +02:00
{
Ensure that dump calls are guarded with dump_enabled_p 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-13 17:10:13 +01:00
VERIFY_DUMP_ENABLED_P;
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::get ().dump_symtab_node (metadata, node);
Add "optinfo" framework 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-19 22:49:25 +02:00
}
dumpfile.c: add indentation via DUMP_VECT_SCOPE 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-29 11:56:40 +02:00
/* Get the current dump scope-nesting depth.
Add "optinfo" framework 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-19 22:49:25 +02:00
For use by -fopt-info (for showing nesting via indentation). */
dumpfile.c: add indentation via DUMP_VECT_SCOPE 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-29 11:56:40 +02:00
unsigned int
get_dump_scope_depth ()
{
Add "optinfo" framework 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-19 22:49:25 +02:00
return dump_context::get ().get_scope_depth ();
dumpfile.c: add indentation via DUMP_VECT_SCOPE 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-29 11:56:40 +02:00
}
/* Push a nested dump scope.
Print "=== NAME ===\n" to the dumpfile, if any, and to the -fopt-info
destination, if any.
Add "optinfo" framework 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-19 22:49:25 +02:00
Emit a "scope" opinfo if optinfos are enabled.
dumpfile.c: add indentation via DUMP_VECT_SCOPE 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-29 11:56:40 +02:00
Increment the scope depth. */
void
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_begin_scope (const char *name,
const dump_user_location_t &user_location,
const dump_impl_location_t &impl_location)
dumpfile.c: add indentation via DUMP_VECT_SCOPE 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-29 11:56:40 +02:00
{
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_context::get ().begin_scope (name, user_location, impl_location);
dumpfile.c: add indentation via DUMP_VECT_SCOPE 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-29 11:56:40 +02:00
}
/* Pop a nested dump scope. */
void
dump_end_scope ()
{
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_context::get ().end_scope ();
dumpfile.c: add indentation via DUMP_VECT_SCOPE 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-29 11:56:40 +02:00
}
/* Start a dump for PHASE. Store user-supplied dump flags in
*FLAG_PTR. Return the number of streams opened. Set globals
DUMP_FILE, and ALT_DUMP_FILE to point to the opened streams, and
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
set dump_flags appropriately for both pass dump stream and
-fopt-info stream. */
int
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
gcc::dump_manager::
Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * class.c (dump_class_hierarchy): Introduce dump_flags_t type and use it instead of int type. (dump_vtable): Likewise. (dump_vtt): Likewise. * decl2.c (dump_tu): Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-common.h: Introduce dump_flags_t type and use it instead of int type. * c-gimplify.c (c_genericize): Likewise. * c-opts.c: Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-decl.c (c_parse_final_cleanups): Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * cfg.c: Introduce dump_flags_t type and use it instead of int type. * cfg.h: Likewise. * cfghooks.c: Likewise. * cfghooks.h (struct cfg_hooks): Likewise. * cfgrtl.c: Likewise. * cfgrtl.h: Likewise. * cgraph.c (cgraph_node::get_body): Likewise. * coretypes.h: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dumpfile.c (struct dump_option_value_info): Likewise. (dump_enable_all): Likewise. (dump_switch_p_1): Likewise. (opt_info_switch_p): Likewise. * dumpfile.h (enum tree_dump_index): Likewise. (struct dump_file_info): Likewise. * genemit.c: Likewise. * generic-match-head.c: Likewise. * gengtype.c (open_base_files): Likewise. * gimple-pretty-print.c: Likewise. * gimple-pretty-print.h: Likewise. * graph.c (print_graph_cfg): Likewise. * graphite-scop-detection.c (dot_all_sese): Likewise. * ipa-devirt.c (build_type_inheritance_graph): Likewise. * loop-unroll.c (report_unroll): Likewise. * passes.c (pass_manager::register_one_dump_file): Likewise. * print-tree.c: Likewise. * statistics.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-dfa.c: Likewise. * tree-dfa.h: Likewise. * tree-dump.c (dump_function): Likewise. * tree-dump.h (struct dump_info): Likewise. * tree-pretty-print.c: Likewise. * tree-pretty-print.h: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise. * tree-vect-loop.c: Likewise. * tree-vect-slp.c: Likewise. From-SVN: r248140
2017-05-17 11:01:36 +02:00
dump_start (int phase, dump_flags_t *flag_ptr)
{
int count = 0;
char *name;
struct dump_file_info *dfi;
FILE *stream;
if (phase == TDI_none || !dump_phase_enabled_p (phase))
return 0;
dfi = get_dump_file_info (phase);
name = get_dump_file_name (phase);
if (name)
{
stream = dump_open (name, dfi->pstate < 0);
if (stream)
{
dfi->pstate = 1;
count++;
}
free (name);
dfi->pstream = stream;
set_dump_file (dfi->pstream);
/* Initialize current dump flags. */
pflags = dfi->pflags;
}
stream = dump_open_alternate_stream (dfi);
if (stream)
{
dfi->alt_stream = stream;
count++;
set_alt_dump_file (dfi->alt_stream);
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
/* Initialize current -fopt-info flags. */
alt_flags = dfi->alt_flags;
}
if (flag_ptr)
*flag_ptr = dfi->pflags;
return count;
}
/* Finish a tree dump for PHASE and close associated dump streams. Also
reset the globals DUMP_FILE, ALT_DUMP_FILE, and DUMP_FLAGS. */
void
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
gcc::dump_manager::
dump_finish (int phase)
{
struct dump_file_info *dfi;
if (phase < 0)
return;
dfi = get_dump_file_info (phase);
if (dfi->pstream && dfi->pstream != stdout && dfi->pstream != stderr)
fclose (dfi->pstream);
if (dfi->alt_stream && dfi->alt_stream != stdout && dfi->alt_stream != stderr)
fclose (dfi->alt_stream);
dfi->alt_stream = NULL;
dfi->pstream = NULL;
set_dump_file (NULL);
set_alt_dump_file (NULL);
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
dump_flags = TDF_NONE;
alt_flags = TDF_NONE;
pflags = TDF_NONE;
}
/* Begin a tree dump for PHASE. Stores any user supplied flag in
*FLAG_PTR and returns a stream to write to. If the dump is not
enabled, returns NULL.
PART can be used for dump files which should be split to multiple
parts. PART == -1 indicates dump file with no parts.
If PART is -1, multiple calls will reopen and append to the dump file. */
FILE *
dump_begin (int phase, dump_flags_t *flag_ptr, int part)
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
{
return g->get_dumps ()->dump_begin (phase, flag_ptr, part);
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
}
FILE *
gcc::dump_manager::
dump_begin (int phase, dump_flags_t *flag_ptr, int part)
{
if (phase == TDI_none || !dump_phase_enabled_p (phase))
return NULL;
char *name = get_dump_file_name (phase, part);
if (!name)
return NULL;
struct dump_file_info *dfi = get_dump_file_info (phase);
/* We do not support re-opening of dump files with parts. This would require
tracking pstate per part of the dump file. */
FILE *stream = dump_open (name, part != -1 || dfi->pstate < 0);
if (stream)
dfi->pstate = 1;
free (name);
if (flag_ptr)
*flag_ptr = dfi->pflags;
/* Initialize current flags */
pflags = dfi->pflags;
return stream;
}
/* Returns nonzero if dump PHASE is enabled for at least one stream.
If PHASE is TDI_tree_all, return nonzero if any dump is enabled for
any phase. */
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
int
gcc::dump_manager::
dump_phase_enabled_p (int phase) const
{
if (phase == TDI_tree_all)
{
size_t i;
for (i = TDI_none + 1; i < (size_t) TDI_end; i++)
if (dump_files[i].pstate || dump_files[i].alt_state)
return 1;
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
for (i = 0; i < m_extra_dump_files_in_use; i++)
if (m_extra_dump_files[i].pstate || m_extra_dump_files[i].alt_state)
return 1;
return 0;
}
else
{
struct dump_file_info *dfi = get_dump_file_info (phase);
return dfi->pstate || dfi->alt_state;
}
}
/* Returns nonzero if tree dump PHASE has been initialized. */
int
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
gcc::dump_manager::
dump_initialized_p (int phase) const
{
struct dump_file_info *dfi = get_dump_file_info (phase);
return dfi->pstate > 0 || dfi->alt_state > 0;
}
/* Returns the switch name of PHASE. */
const char *
dump_flag_name (int phase)
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
{
return g->get_dumps ()->dump_flag_name (phase);
}
const char *
gcc::dump_manager::
dump_flag_name (int phase) const
{
struct dump_file_info *dfi = get_dump_file_info (phase);
return dfi->swtch;
}
Fix -fopt-info for plugin passes 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-10-04 16:33:47 +02:00
/* Handle -fdump-* and -fopt-info for a pass added after
command-line options are parsed (those from plugins and
those from backends).
Because the registration of plugin/backend passes happens after the
command-line options are parsed, the options that specify single
pass dumping (e.g. -fdump-tree-PASSNAME) cannot be used for new
passes. Therefore we currently can only enable dumping of
new passes when the 'dump-all' flags (e.g. -fdump-tree-all)
are specified. This is done here.
Similarly, the saved -fopt-info options are wired up to the new pass. */
void
gcc::dump_manager::register_pass (opt_pass *pass)
{
gcc_assert (pass);
register_one_dump_file (pass);
dump_file_info *pass_dfi = get_dump_file_info (pass->static_pass_number);
gcc_assert (pass_dfi);
enum tree_dump_index tdi;
if (pass->type == SIMPLE_IPA_PASS
|| pass->type == IPA_PASS)
tdi = TDI_ipa_all;
else if (pass->type == GIMPLE_PASS)
tdi = TDI_tree_all;
else
tdi = TDI_rtl_all;
const dump_file_info *tdi_dfi = get_dump_file_info (tdi);
gcc_assert (tdi_dfi);
/* Check if dump-all flag is specified. */
if (tdi_dfi->pstate)
{
pass_dfi->pstate = tdi_dfi->pstate;
pass_dfi->pflags = tdi_dfi->pflags;
}
update_dfi_for_opt_info (pass_dfi);
}
/* Finish a tree dump for PHASE. STREAM is the stream created by
dump_begin. */
void
dump_end (int phase ATTRIBUTE_UNUSED, FILE *stream)
{
if (stream != stderr && stream != stdout)
fclose (stream);
}
/* Enable all tree dumps with FLAGS on FILENAME. Return number of
enabled tree dumps. */
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
int
gcc::dump_manager::
dump_enable_all (dump_kind dkind, dump_flags_t flags, const char *filename)
{
int n = 0;
size_t i;
for (i = TDI_none + 1; i < (size_t) TDI_end; i++)
{
if (dump_files[i].dkind == dkind)
{
const char *old_filename = dump_files[i].pfilename;
dump_files[i].pstate = -1;
dump_files[i].pflags |= flags;
n++;
/* Override the existing filename. */
if (filename)
{
dump_files[i].pfilename = xstrdup (filename);
/* Since it is a command-line provided file, which is
common to all the phases, use it in append mode. */
dump_files[i].pstate = 1;
}
if (old_filename && filename != old_filename)
free (CONST_CAST (char *, old_filename));
}
}
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
for (i = 0; i < m_extra_dump_files_in_use; i++)
{
if (m_extra_dump_files[i].dkind == dkind)
{
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
const char *old_filename = m_extra_dump_files[i].pfilename;
m_extra_dump_files[i].pstate = -1;
m_extra_dump_files[i].pflags |= flags;
n++;
/* Override the existing filename. */
if (filename)
{
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
m_extra_dump_files[i].pfilename = xstrdup (filename);
/* Since it is a command-line provided file, which is
common to all the phases, use it in append mode. */
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
m_extra_dump_files[i].pstate = 1;
}
if (old_filename && filename != old_filename)
free (CONST_CAST (char *, old_filename));
}
}
return n;
}
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
/* Enable -fopt-info dumps on all dump files matching OPTGROUP_FLAGS.
Enable dumps with FLAGS on FILENAME. Return the number of enabled
dumps. */
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
int
gcc::dump_manager::
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
opt_info_enable_passes (optgroup_flags_t optgroup_flags, dump_flags_t flags,
Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * class.c (dump_class_hierarchy): Introduce dump_flags_t type and use it instead of int type. (dump_vtable): Likewise. (dump_vtt): Likewise. * decl2.c (dump_tu): Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-common.h: Introduce dump_flags_t type and use it instead of int type. * c-gimplify.c (c_genericize): Likewise. * c-opts.c: Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-decl.c (c_parse_final_cleanups): Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * cfg.c: Introduce dump_flags_t type and use it instead of int type. * cfg.h: Likewise. * cfghooks.c: Likewise. * cfghooks.h (struct cfg_hooks): Likewise. * cfgrtl.c: Likewise. * cfgrtl.h: Likewise. * cgraph.c (cgraph_node::get_body): Likewise. * coretypes.h: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dumpfile.c (struct dump_option_value_info): Likewise. (dump_enable_all): Likewise. (dump_switch_p_1): Likewise. (opt_info_switch_p): Likewise. * dumpfile.h (enum tree_dump_index): Likewise. (struct dump_file_info): Likewise. * genemit.c: Likewise. * generic-match-head.c: Likewise. * gengtype.c (open_base_files): Likewise. * gimple-pretty-print.c: Likewise. * gimple-pretty-print.h: Likewise. * graph.c (print_graph_cfg): Likewise. * graphite-scop-detection.c (dot_all_sese): Likewise. * ipa-devirt.c (build_type_inheritance_graph): Likewise. * loop-unroll.c (report_unroll): Likewise. * passes.c (pass_manager::register_one_dump_file): Likewise. * print-tree.c: Likewise. * statistics.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-dfa.c: Likewise. * tree-dfa.h: Likewise. * tree-dump.c (dump_function): Likewise. * tree-dump.h (struct dump_info): Likewise. * tree-pretty-print.c: Likewise. * tree-pretty-print.h: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise. * tree-vect-loop.c: Likewise. * tree-vect-slp.c: Likewise. From-SVN: r248140
2017-05-17 11:01:36 +02:00
const char *filename)
{
int n = 0;
Fix -fopt-info for plugin passes 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-10-04 16:33:47 +02:00
m_optgroup_flags = optgroup_flags;
m_optinfo_flags = flags;
m_optinfo_filename = xstrdup (filename);
Fix -fopt-info for plugin passes 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-10-04 16:33:47 +02:00
for (size_t i = TDI_none + 1; i < (size_t) TDI_end; i++)
if (update_dfi_for_opt_info (&dump_files[i]))
n++;
for (size_t i = 0; i < m_extra_dump_files_in_use; i++)
if (update_dfi_for_opt_info (&m_extra_dump_files[i]))
n++;
return n;
}
Fix -fopt-info for plugin passes 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-10-04 16:33:47 +02:00
/* Use the saved -fopt-info options to update DFI.
Return true if the dump is enabled. */
bool
gcc::dump_manager::update_dfi_for_opt_info (dump_file_info *dfi) const
{
gcc_assert (dfi);
if (!(dfi->optgroup_flags & m_optgroup_flags))
return false;
const char *old_filename = dfi->alt_filename;
/* Since this file is shared among different passes, it
should be opened in append mode. */
dfi->alt_state = 1;
dfi->alt_flags |= m_optinfo_flags;
/* Override the existing filename. */
if (m_optinfo_filename)
dfi->alt_filename = xstrdup (m_optinfo_filename);
if (old_filename && m_optinfo_filename != old_filename)
free (CONST_CAST (char *, old_filename));
return true;
}
/* Helper routine to parse -<dump format>[=filename]
and return the corresponding dump flag. If POS_P is non-NULL,
assign start of filename into *POS_P. */
dump_flags_t
parse_dump_option (const char *option_value, const char **pos_p)
{
const char *ptr;
Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * class.c (dump_class_hierarchy): Introduce dump_flags_t type and use it instead of int type. (dump_vtable): Likewise. (dump_vtt): Likewise. * decl2.c (dump_tu): Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-common.h: Introduce dump_flags_t type and use it instead of int type. * c-gimplify.c (c_genericize): Likewise. * c-opts.c: Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-decl.c (c_parse_final_cleanups): Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * cfg.c: Introduce dump_flags_t type and use it instead of int type. * cfg.h: Likewise. * cfghooks.c: Likewise. * cfghooks.h (struct cfg_hooks): Likewise. * cfgrtl.c: Likewise. * cfgrtl.h: Likewise. * cgraph.c (cgraph_node::get_body): Likewise. * coretypes.h: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dumpfile.c (struct dump_option_value_info): Likewise. (dump_enable_all): Likewise. (dump_switch_p_1): Likewise. (opt_info_switch_p): Likewise. * dumpfile.h (enum tree_dump_index): Likewise. (struct dump_file_info): Likewise. * genemit.c: Likewise. * generic-match-head.c: Likewise. * gengtype.c (open_base_files): Likewise. * gimple-pretty-print.c: Likewise. * gimple-pretty-print.h: Likewise. * graph.c (print_graph_cfg): Likewise. * graphite-scop-detection.c (dot_all_sese): Likewise. * ipa-devirt.c (build_type_inheritance_graph): Likewise. * loop-unroll.c (report_unroll): Likewise. * passes.c (pass_manager::register_one_dump_file): Likewise. * print-tree.c: Likewise. * statistics.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-dfa.c: Likewise. * tree-dfa.h: Likewise. * tree-dump.c (dump_function): Likewise. * tree-dump.h (struct dump_info): Likewise. * tree-pretty-print.c: Likewise. * tree-pretty-print.h: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise. * tree-vect-loop.c: Likewise. * tree-vect-slp.c: Likewise. From-SVN: r248140
2017-05-17 11:01:36 +02:00
dump_flags_t flags;
ptr = option_value;
if (pos_p)
*pos_p = NULL;
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
/* Retain "user-facing" and "internals" messages, but filter out
those from an opt_problem being re-emitted at the top level
(MSG_PRIORITY_REEMITTED), so as to avoid duplicate messages
messing up scan-tree-dump-times" in DejaGnu tests. */
flags = MSG_PRIORITY_USER_FACING | MSG_PRIORITY_INTERNALS;
while (*ptr)
{
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
const struct kv_pair<dump_flags_t> *option_ptr;
const char *end_ptr;
const char *eq_ptr;
unsigned length;
while (*ptr == '-')
ptr++;
end_ptr = strchr (ptr, '-');
eq_ptr = strchr (ptr, '=');
if (eq_ptr && (!end_ptr || end_ptr > eq_ptr))
end_ptr = eq_ptr;
if (!end_ptr)
end_ptr = ptr + strlen (ptr);
length = end_ptr - ptr;
for (option_ptr = dump_options; option_ptr->name; option_ptr++)
if (strlen (option_ptr->name) == length
&& !memcmp (option_ptr->name, ptr, length))
{
flags |= option_ptr->value;
goto found;
}
if (*ptr == '=')
{
/* Interpret rest of the argument as a dump filename. This
filename overrides other command line filenames. */
if (pos_p)
*pos_p = ptr + 1;
break;
}
else
{
warning (0, "ignoring unknown option %q.*s",
length, ptr);
flags = TDF_ERROR;
}
found:
ptr = end_ptr;
}
return flags;
}
/* Parse ARG as a dump switch. Return nonzero if it is, and store the
relevant details in the dump_files array. */
int
gcc::dump_manager::
dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob)
{
const char *option_value;
dump_flags_t flags = TDF_NONE;
if (doglob && !dfi->glob)
return 0;
option_value = skip_leading_substring (arg, doglob ? dfi->glob : dfi->swtch);
if (!option_value)
return 0;
if (*option_value && *option_value != '-' && *option_value != '=')
return 0;
const char *filename;
flags = parse_dump_option (option_value, &filename);
if (filename)
{
if (dfi->pfilename)
free (CONST_CAST (char *, dfi->pfilename));
dfi->pfilename = xstrdup (filename);
}
dfi->pstate = -1;
dfi->pflags |= flags;
/* Process -fdump-tree-all and -fdump-rtl-all, by enabling all the
known dumps. */
if (dfi->suffix == NULL)
dump_enable_all (dfi->dkind, dfi->pflags, dfi->pfilename);
return 1;
}
void
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
gcc::dump_manager::
dump_switch_p (const char *arg)
{
size_t i;
int any = 0;
for (i = TDI_none + 1; i != TDI_end; i++)
any |= dump_switch_p_1 (arg, &dump_files[i], false);
/* Don't glob if we got a hit already */
if (!any)
for (i = TDI_none + 1; i != TDI_end; i++)
any |= dump_switch_p_1 (arg, &dump_files[i], true);
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
for (i = 0; i < m_extra_dump_files_in_use; i++)
any |= dump_switch_p_1 (arg, &m_extra_dump_files[i], false);
if (!any)
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
for (i = 0; i < m_extra_dump_files_in_use; i++)
any |= dump_switch_p_1 (arg, &m_extra_dump_files[i], true);
if (!any)
{
auto_vec<const char *> candidates;
for (size_t i = TDI_none + 1; i != TDI_end; i++)
candidates.safe_push (dump_files[i].swtch);
for (size_t i = 0; i < m_extra_dump_files_in_use; i++)
candidates.safe_push (m_extra_dump_files[i].swtch);
const char *hint = find_closest_string (arg, &candidates);
if (hint)
error ("unrecognized command-line option %<-fdump-%s%>; "
"did you mean %<-fdump-%s%>?", arg, hint);
else
error ("unrecognized command-line option %<-fdump-%s%>", arg);
}
}
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
/* Parse ARG as a -fopt-info switch and store flags, optgroup_flags
and filename. Return non-zero if it is a recognized switch. */
static int
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
opt_info_switch_p_1 (const char *arg, dump_flags_t *flags,
optgroup_flags_t *optgroup_flags, char **filename)
{
const char *option_value;
const char *ptr;
option_value = arg;
ptr = option_value;
*filename = NULL;
Add -fopt-info-internals 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-04 19:41:08 +02:00
/* Default to filtering out "internals" messages, and retaining
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
"user-facing" messages, and those from an opt_problem being
re-emitted at the top level. */
*flags = MSG_PRIORITY_USER_FACING | MSG_PRIORITY_REEMITTED;
Add -fopt-info-internals 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-04 19:41:08 +02:00
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
*optgroup_flags = OPTGROUP_NONE;
if (!ptr)
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
return 1; /* Handle '-fopt-info' without any additional options. */
while (*ptr)
{
const char *end_ptr;
const char *eq_ptr;
unsigned length;
while (*ptr == '-')
ptr++;
end_ptr = strchr (ptr, '-');
eq_ptr = strchr (ptr, '=');
if (eq_ptr && (!end_ptr || eq_ptr < end_ptr))
end_ptr = eq_ptr;
else if (!end_ptr)
end_ptr = ptr + strlen (ptr);
length = end_ptr - ptr;
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
for (const kv_pair<dump_flags_t> *option_ptr = optinfo_verbosity_options;
option_ptr->name; option_ptr++)
if (strlen (option_ptr->name) == length
&& !memcmp (option_ptr->name, ptr, length))
{
*flags |= option_ptr->value;
goto found;
}
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
for (const kv_pair<optgroup_flags_t> *option_ptr = optgroup_options;
option_ptr->name; option_ptr++)
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
if (strlen (option_ptr->name) == length
&& !memcmp (option_ptr->name, ptr, length))
{
*optgroup_flags |= option_ptr->value;
goto found;
}
if (*ptr == '=')
{
/* Interpret rest of the argument as a dump filename. This
filename overrides other command line filenames. */
*filename = xstrdup (ptr + 1);
break;
}
else
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
{
warning (0, "unknown option %q.*s in %<-fopt-info-%s%>",
length, ptr, arg);
return 0;
}
found:;
ptr = end_ptr;
}
return 1;
}
/* Return non-zero if ARG is a recognized switch for
-fopt-info. Return zero otherwise. */
int
opt_info_switch_p (const char *arg)
{
Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * class.c (dump_class_hierarchy): Introduce dump_flags_t type and use it instead of int type. (dump_vtable): Likewise. (dump_vtt): Likewise. * decl2.c (dump_tu): Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-common.h: Introduce dump_flags_t type and use it instead of int type. * c-gimplify.c (c_genericize): Likewise. * c-opts.c: Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-decl.c (c_parse_final_cleanups): Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * cfg.c: Introduce dump_flags_t type and use it instead of int type. * cfg.h: Likewise. * cfghooks.c: Likewise. * cfghooks.h (struct cfg_hooks): Likewise. * cfgrtl.c: Likewise. * cfgrtl.h: Likewise. * cgraph.c (cgraph_node::get_body): Likewise. * coretypes.h: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dumpfile.c (struct dump_option_value_info): Likewise. (dump_enable_all): Likewise. (dump_switch_p_1): Likewise. (opt_info_switch_p): Likewise. * dumpfile.h (enum tree_dump_index): Likewise. (struct dump_file_info): Likewise. * genemit.c: Likewise. * generic-match-head.c: Likewise. * gengtype.c (open_base_files): Likewise. * gimple-pretty-print.c: Likewise. * gimple-pretty-print.h: Likewise. * graph.c (print_graph_cfg): Likewise. * graphite-scop-detection.c (dot_all_sese): Likewise. * ipa-devirt.c (build_type_inheritance_graph): Likewise. * loop-unroll.c (report_unroll): Likewise. * passes.c (pass_manager::register_one_dump_file): Likewise. * print-tree.c: Likewise. * statistics.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-dfa.c: Likewise. * tree-dfa.h: Likewise. * tree-dump.c (dump_function): Likewise. * tree-dump.h (struct dump_info): Likewise. * tree-pretty-print.c: Likewise. * tree-pretty-print.h: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise. * tree-vect-loop.c: Likewise. * tree-vect-slp.c: Likewise. From-SVN: r248140
2017-05-17 11:01:36 +02:00
dump_flags_t flags;
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
optgroup_flags_t optgroup_flags;
char *filename;
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
static char *file_seen = NULL;
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
gcc::dump_manager *dumps = g->get_dumps ();
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
if (!opt_info_switch_p_1 (arg, &flags, &optgroup_flags, &filename))
return 0;
if (!filename)
filename = xstrdup ("stderr");
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
/* Bail out if a different filename has been specified. */
if (file_seen && strcmp (file_seen, filename))
{
warning (0, "ignoring possibly conflicting option %<-fopt-info-%s%>",
arg);
return 1;
}
file_seen = xstrdup (filename);
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (!(flags & MSG_ALL_KINDS))
flags |= MSG_OPTIMIZED_LOCATIONS;
invoke.texi: Update -fopt-info documentation. 2012-11-01 Sharad Singhai <singhai@google.com> * doc/invoke.texi: Update -fopt-info documentation. * dumpfile.c: Move dump_flags here from passes.c. Rename opt_info_options to optinfo_verbosity_options. Add optgroup_options. (dump_files): Add field for optinfo_flags in the static initializer. (dump_register): Handle additional parameter for optgroup_flags. (opt_info_enable_passes): Renamed opt_info_enable_all. Handle optgroup_flags. Fix documentation. (opt_info_switch_p_1): Handle optgroup options. (opt_info_switch_p): Handle optgroup_flags. Warn on multiple files. * dumpfile.h (dump_register): Additional argument for optgroup_flags. All callers updated. (struct dump_file_info): Add field for optgroup_flags. Define OPTGROUP_* flags. * tree-pass.h (struct opt_pass): Add addtional field for optinfo_flags. All opt_pass static initializers updated. * opts-global.c (dump_remap_tree_vectorizer_verbose): Use 'all' instead of 'optall'. (handle_common_deferred_options): Fix typo in error message. * passes.c (register_one_dump_file): Add argument for optgroup_flags. Turn on OPTGROUP_IPA for IPA passes. Move dump_flags from here to dumpfile.c. * statistics.c (statistics_early_init): Use OPTGROUP_NONE in call to dump_register. testsuite/ChangeLog * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. * testsuite/g++.dg/plugin/dumb_plugin.c: Likewise. From-SVN: r193061
2012-11-01 08:34:44 +01:00
if (!optgroup_flags)
optgroup_flags = OPTGROUP_ALL;
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
return dumps->opt_info_enable_passes (optgroup_flags, flags, filename);
}
/* Print basic block on the dump streams. */
void
Convert dump and optgroup flags to enums 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-06-08 14:50:19 +02:00
dump_basic_block (dump_flags_t dump_kind, basic_block bb, int indent)
{
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (dump_file
&& dump_context::get ().apply_dump_filter_p (dump_kind, pflags))
dump_bb (dump_file, bb, indent, TDF_DETAILS);
Add -fopt-info-internals 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-04 19:41:08 +02:00
if (alt_dump_file
&& dump_context::get ().apply_dump_filter_p (dump_kind, alt_flags))
dump_bb (alt_dump_file, bb, indent, TDF_DETAILS);
}
/* Dump FUNCTION_DECL FN as tree dump PHASE. */
void
dump_function (int phase, tree fn)
{
FILE *stream;
Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * class.c (dump_class_hierarchy): Introduce dump_flags_t type and use it instead of int type. (dump_vtable): Likewise. (dump_vtt): Likewise. * decl2.c (dump_tu): Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-common.h: Introduce dump_flags_t type and use it instead of int type. * c-gimplify.c (c_genericize): Likewise. * c-opts.c: Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-decl.c (c_parse_final_cleanups): Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * cfg.c: Introduce dump_flags_t type and use it instead of int type. * cfg.h: Likewise. * cfghooks.c: Likewise. * cfghooks.h (struct cfg_hooks): Likewise. * cfgrtl.c: Likewise. * cfgrtl.h: Likewise. * cgraph.c (cgraph_node::get_body): Likewise. * coretypes.h: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dumpfile.c (struct dump_option_value_info): Likewise. (dump_enable_all): Likewise. (dump_switch_p_1): Likewise. (opt_info_switch_p): Likewise. * dumpfile.h (enum tree_dump_index): Likewise. (struct dump_file_info): Likewise. * genemit.c: Likewise. * generic-match-head.c: Likewise. * gengtype.c (open_base_files): Likewise. * gimple-pretty-print.c: Likewise. * gimple-pretty-print.h: Likewise. * graph.c (print_graph_cfg): Likewise. * graphite-scop-detection.c (dot_all_sese): Likewise. * ipa-devirt.c (build_type_inheritance_graph): Likewise. * loop-unroll.c (report_unroll): Likewise. * passes.c (pass_manager::register_one_dump_file): Likewise. * print-tree.c: Likewise. * statistics.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-dfa.c: Likewise. * tree-dfa.h: Likewise. * tree-dump.c (dump_function): Likewise. * tree-dump.h (struct dump_info): Likewise. * tree-pretty-print.c: Likewise. * tree-pretty-print.h: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise. * tree-vect-loop.c: Likewise. * tree-vect-slp.c: Likewise. From-SVN: r248140
2017-05-17 11:01:36 +02:00
dump_flags_t flags;
stream = dump_begin (phase, &flags);
if (stream)
{
dump_function_to_file (fn, stream, flags);
dump_end (phase, stream);
}
}
/* Print information from the combine pass on dump_file. */
void
print_combine_total_stats (void)
{
if (dump_file)
dump_combine_total_stats (dump_file);
}
/* Enable RTL dump for all the RTL passes. */
bool
enable_rtl_dump_file (void)
{
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
gcc::dump_manager *dumps = g->get_dumps ();
int num_enabled =
dumps->dump_enable_all (DK_rtl, dump_flags_t (TDF_DETAILS) | TDF_BLOCKS,
NULL);
Introduce gcc::dump_manager class gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
2013-10-14 18:15:38 +02:00
return num_enabled > 0;
}
Introduce dump_location_t 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-26 15:34:59 +02:00
/* debug_dump_context's ctor. Temporarily override the dump_context
(to forcibly enable output to stderr). */
debug_dump_context::debug_dump_context (FILE *f)
: m_context (),
m_saved (&dump_context::get ()),
m_saved_flags (dump_flags),
m_saved_pflags (pflags),
m_saved_file (dump_file)
{
set_dump_file (f);
dump_context::s_current = &m_context;
pflags = dump_flags = MSG_ALL_KINDS | MSG_ALL_PRIORITIES;
dump_context::get ().refresh_dumps_are_enabled ();
}
/* debug_dump_context's dtor. Restore the saved dump_context. */
debug_dump_context::~debug_dump_context ()
{
set_dump_file (m_saved_file);
dump_context::s_current = m_saved;
dump_flags = m_saved_flags;
pflags = m_saved_pflags;
dump_context::get ().refresh_dumps_are_enabled ();
}
Introduce dump_location_t 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-26 15:34:59 +02:00
#if CHECKING_P
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
namespace selftest {
Add "optinfo" framework 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-19 22:49:25 +02:00
/* temp_dump_context's ctor. Temporarily override the dump_context
(to forcibly enable optinfo-generation). */
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
temp_dump_context::temp_dump_context (bool forcibly_enable_optinfo,
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
bool forcibly_enable_dumping,
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_flags_t test_pp_flags)
Add "optinfo" framework 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-19 22:49:25 +02:00
: m_context (),
m_saved (&dump_context::get ())
Add "optinfo" framework 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-19 22:49:25 +02:00
{
dump_context::s_current = &m_context;
Eliminate global state from -fsave-optimization-record 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-19 17:31:03 +01:00
if (forcibly_enable_optinfo)
m_context.set_json_writer (new optrecord_json_writer ());
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
/* Conditionally enable the test dump, so that we can verify both the
dump_enabled_p and the !dump_enabled_p cases in selftests. */
if (forcibly_enable_dumping)
{
m_context.m_test_pp = &m_pp;
m_context.m_test_pp_flags = test_pp_flags;
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_context::get ().refresh_dumps_are_enabled ();
Add "optinfo" framework 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-19 22:49:25 +02:00
}
/* temp_dump_context's dtor. Restore the saved dump_context. */
temp_dump_context::~temp_dump_context ()
{
Eliminate global state from -fsave-optimization-record 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-19 17:31:03 +01:00
m_context.set_json_writer (NULL);
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_context::s_current = m_saved;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_context::get ().refresh_dumps_are_enabled ();
}
/* 0-terminate the text dumped so far, and return it. */
const char *
temp_dump_context::get_dumped_text ()
{
return pp_formatted_text (&m_pp);
Add "optinfo" framework 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-19 22:49:25 +02:00
}
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
/* Verify that IMPL_LOC is within EXPECTED_FILE at EXPECTED_LINE,
from EXPECTED_FUNCTION, using LOC for the location of any failure,
provided that the build compiler is sufficiently recent. */
static void
assert_impl_location_eq (const location &loc ATTRIBUTE_UNUSED,
const dump_impl_location_t &impl_loc ATTRIBUTE_UNUSED,
const char *expected_file ATTRIBUTE_UNUSED,
int expected_line ATTRIBUTE_UNUSED,
const char *expected_function ATTRIBUTE_UNUSED)
{
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
ASSERT_STR_CONTAINS_AT (loc, impl_loc.m_file, expected_file);
ASSERT_EQ_AT (loc, impl_loc.m_line, expected_line);
ASSERT_STR_CONTAINS_AT (loc, impl_loc.m_function, expected_function);
#endif
}
/* Verify that IMPL_LOC is within EXPECTED_FILE at EXPECTED_LINE,
from EXPECTED_FUNCTION, provided that the build compiler is
sufficiently recent. */
#define ASSERT_IMPL_LOCATION_EQ(IMPL_LOC, EXPECTED_FILE, EXPECTED_LINE, \
EXPECTED_FUNCTION) \
SELFTEST_BEGIN_STMT \
assert_impl_location_eq (SELFTEST_LOCATION, IMPL_LOC, \
EXPECTED_FILE, EXPECTED_LINE, \
EXPECTED_FUNCTION); \
SELFTEST_END_STMT
Introduce dump_location_t 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-26 15:34:59 +02:00
/* Verify that the dump_location_t constructors capture the source location
at which they were called (provided that the build compiler is sufficiently
recent). */
static void
test_impl_location ()
{
/* Default ctor. */
{
dump_location_t loc;
const int expected_line = __LINE__ - 1;
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (loc.get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_line, "test_impl_location");
Introduce dump_location_t 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-26 15:34:59 +02:00
}
/* Constructing from a gimple. */
{
dump_location_t loc ((gimple *)NULL);
const int expected_line = __LINE__ - 1;
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (loc.get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_line, "test_impl_location");
Introduce dump_location_t 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-26 15:34:59 +02:00
}
/* Constructing from an rtx_insn. */
{
dump_location_t loc ((rtx_insn *)NULL);
const int expected_line = __LINE__ - 1;
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (loc.get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_line, "test_impl_location");
Introduce dump_location_t 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-26 15:34:59 +02:00
}
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Verify that the text dumped so far in CONTEXT equals
EXPECTED_TEXT, using LOC for the location of any failure.
As a side-effect, the internal buffer is 0-terminated. */
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
void
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
verify_dumped_text (const location &loc,
temp_dump_context *context,
const char *expected_text)
{
gcc_assert (context);
ASSERT_STREQ_AT (loc, context->get_dumped_text (),
expected_text);
}
Add "optinfo" framework 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-19 22:49:25 +02:00
/* Verify that ITEM has the expected values. */
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
void
Add "optinfo" framework 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-19 22:49:25 +02:00
verify_item (const location &loc,
const optinfo_item *item,
enum optinfo_item_kind expected_kind,
location_t expected_location,
const char *expected_text)
{
ASSERT_EQ_AT (loc, item->get_kind (), expected_kind);
ASSERT_EQ_AT (loc, item->get_location (), expected_location);
ASSERT_STREQ_AT (loc, item->get_text (), expected_text);
}
/* Verify that calls to the dump_* API are captured and consolidated into
optimization records. */
static void
test_capture_of_dump_calls (const line_table_case &case_)
{
/* Generate a location_t for testing. */
line_table_test ltt (case_);
linemap_add (line_table, LC_ENTER, false, "test.txt", 0);
linemap_line_start (line_table, 5, 100);
linemap_add (line_table, LC_LEAVE, false, NULL, 0);
location_t decl_loc = linemap_position_for_column (line_table, 8);
location_t stmt_loc = linemap_position_for_column (line_table, 10);
if (stmt_loc > LINE_MAP_MAX_LOCATION_WITH_COLS)
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
return;
Add "optinfo" framework 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-19 22:49:25 +02:00
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
dump_user_location_t loc = dump_user_location_t::from_location_t (stmt_loc);
Add "optinfo" framework 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-19 22:49:25 +02:00
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
gimple *stmt = gimple_build_return (NULL);
gimple_set_location (stmt, stmt_loc);
Add "optinfo" framework 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-19 22:49:25 +02:00
tree test_decl = build_decl (decl_loc, FUNCTION_DECL,
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
get_identifier ("test_decl"),
build_function_type_list (void_type_node,
NULL_TREE));
symbol_table_test tmp_symtab;
cgraph_node *node = cgraph_node::get_create (test_decl);
gcc_assert (node);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Run all tests twice, with and then without optinfo enabled, to ensure
that immediate destinations vs optinfo-based destinations both
work, independently of each other, with no leaks. */
for (int i = 0 ; i < 2; i++)
Add "optinfo" framework 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-19 22:49:25 +02:00
{
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
bool with_optinfo = (i == 0);
/* Test of dump_printf. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_printf (MSG_NOTE, "int: %i str: %s", 42, "foo");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
ASSERT_DUMPED_TEXT_EQ (tmp, "int: 42 str: foo");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 1);
ASSERT_IS_TEXT (info->get_item (0), "int: 42 str: foo");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
}
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
/* Test of dump_printf with %T. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
dump_printf (MSG_NOTE, "tree: %T", integer_zero_node);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
ASSERT_DUMPED_TEXT_EQ (tmp, "tree: 0");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 2);
ASSERT_IS_TEXT (info->get_item (0), "tree: ");
ASSERT_IS_TREE (info->get_item (1), UNKNOWN_LOCATION, "0");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
}
}
/* Test of dump_printf with %E. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
dump_printf (MSG_NOTE, "gimple: %E", stmt);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
ASSERT_DUMPED_TEXT_EQ (tmp, "gimple: return;");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 2);
ASSERT_IS_TEXT (info->get_item (0), "gimple: ");
ASSERT_IS_GIMPLE (info->get_item (1), stmt_loc, "return;");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
}
}
/* Test of dump_printf with %G. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
dump_printf (MSG_NOTE, "gimple: %G", stmt);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
ASSERT_DUMPED_TEXT_EQ (tmp, "gimple: return;\n");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 2);
ASSERT_IS_TEXT (info->get_item (0), "gimple: ");
ASSERT_IS_GIMPLE (info->get_item (1), stmt_loc, "return;\n");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
}
}
/* Test of dump_printf with %C. */
{
temp_dump_context tmp (with_optinfo, true,
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
dump_printf (MSG_NOTE, "node: %C", node);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
ASSERT_DUMPED_TEXT_EQ (tmp, "node: test_decl/0");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 2);
ASSERT_IS_TEXT (info->get_item (0), "node: ");
ASSERT_IS_SYMTAB_NODE (info->get_item (1), decl_loc, "test_decl/0");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
}
}
/* dump_print_loc with multiple format codes. This tests various
things:
- intermingling of text, format codes handled by the base
pretty_printer, and dump-specific format codes
- multiple dump-specific format codes: some consecutive, others
separated by text, trailing text after the final one. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
dump_printf_loc (MSG_NOTE, loc, "before %T and %T"
" %i consecutive %E%E after\n",
integer_zero_node, test_decl, 42, stmt, stmt);
ASSERT_DUMPED_TEXT_EQ (tmp,
"test.txt:5:10: note: before 0 and test_decl"
" 42 consecutive return;return; after\n");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 8);
ASSERT_IS_TEXT (info->get_item (0), "before ");
ASSERT_IS_TREE (info->get_item (1), UNKNOWN_LOCATION, "0");
ASSERT_IS_TEXT (info->get_item (2), " and ");
ASSERT_IS_TREE (info->get_item (3), UNKNOWN_LOCATION, "test_decl");
ASSERT_IS_TEXT (info->get_item (4), " 42 consecutive ");
ASSERT_IS_GIMPLE (info->get_item (5), stmt_loc, "return;");
ASSERT_IS_GIMPLE (info->get_item (6), stmt_loc, "return;");
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
ASSERT_IS_TEXT (info->get_item (7), " after\n");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
/* We don't ASSERT_IMPL_LOCATION_EQ here, to avoid having to
enforce at which exact line the multiline dump_printf_loc
occurred. */
Formatted printing for dump_* in the middle-end 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-17 20:21:31 +02:00
}
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* Tree, via dump_generic_expr. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_printf_loc (MSG_NOTE, loc, "test of tree: ");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_generic_expr (MSG_NOTE, TDF_SLIM, integer_zero_node);
ASSERT_DUMPED_TEXT_EQ (tmp, "test.txt:5:10: note: test of tree: 0");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->get_location_t (), stmt_loc);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 2);
ASSERT_IS_TEXT (info->get_item (0), "test of tree: ");
ASSERT_IS_TREE (info->get_item (1), UNKNOWN_LOCATION, "0");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
}
/* Tree, via dump_generic_expr_loc. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_generic_expr_loc (MSG_NOTE, loc, TDF_SLIM, integer_one_node);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
ASSERT_DUMPED_TEXT_EQ (tmp, "test.txt:5:10: note: 1");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->get_location_t (), stmt_loc);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 1);
ASSERT_IS_TREE (info->get_item (0), UNKNOWN_LOCATION, "1");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
}
/* Gimple. */
{
/* dump_gimple_stmt_loc. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_gimple_stmt_loc (MSG_NOTE, loc, TDF_SLIM, stmt, 2);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
ASSERT_DUMPED_TEXT_EQ (tmp, "test.txt:5:10: note: return;\n");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->num_items (), 1);
ASSERT_IS_GIMPLE (info->get_item (0), stmt_loc, "return;\n");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
}
Add "optinfo" framework 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-19 22:49:25 +02:00
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* dump_gimple_stmt. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 2);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
ASSERT_DUMPED_TEXT_EQ (tmp, "return;\n");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->num_items (), 1);
ASSERT_IS_GIMPLE (info->get_item (0), stmt_loc, "return;\n");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
}
Add "optinfo" framework 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-19 22:49:25 +02:00
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* dump_gimple_expr_loc. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_gimple_expr_loc (MSG_NOTE, loc, TDF_SLIM, stmt, 2);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
ASSERT_DUMPED_TEXT_EQ (tmp, "test.txt:5:10: note: return;");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->num_items (), 1);
ASSERT_IS_GIMPLE (info->get_item (0), stmt_loc, "return;");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
}
Add "optinfo" framework 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-19 22:49:25 +02:00
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* dump_gimple_expr. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_gimple_expr (MSG_NOTE, TDF_SLIM, stmt, 2);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
ASSERT_DUMPED_TEXT_EQ (tmp, "return;");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->num_items (), 1);
ASSERT_IS_GIMPLE (info->get_item (0), stmt_loc, "return;");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
}
}
/* symtab_node. */
{
temp_dump_context tmp (with_optinfo, true,
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
dump_symtab_node (MSG_NOTE, node);
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
ASSERT_DUMPED_TEXT_EQ (tmp, "test_decl/0");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE);
ASSERT_EQ (info->num_items (), 1);
ASSERT_IS_SYMTAB_NODE (info->get_item (0), decl_loc, "test_decl/0");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
}
}
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
/* poly_int. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
dump_dec (MSG_NOTE, poly_int64 (42));
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
ASSERT_DUMPED_TEXT_EQ (tmp, "42");
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->num_items (), 1);
ASSERT_IS_TEXT (info->get_item (0), "42");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
}
Add -fopt-info-internals 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-04 19:41:08 +02:00
/* Scopes. Test with all 4 combinations of
filtering by MSG_PRIORITY_USER_FACING
and/or filtering by MSG_PRIORITY_INTERNALS. */
for (int j = 0; j < 3; j++)
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
{
Add -fopt-info-internals 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-04 19:41:08 +02:00
dump_flags_t dump_filter = MSG_ALL_KINDS;
if (j % 2)
dump_filter |= MSG_PRIORITY_USER_FACING;
if (j / 2)
dump_filter |= MSG_PRIORITY_INTERNALS;
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (with_optinfo, true, dump_filter);
Add -fopt-info-internals 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-04 19:41:08 +02:00
/* Emit various messages, mostly with implicit priority. */
dump_printf_loc (MSG_NOTE, stmt, "msg 1\n");
dump_printf_loc (MSG_NOTE | MSG_PRIORITY_INTERNALS, stmt,
"explicitly internal msg\n");
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
{
Add -fopt-info-internals 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-04 19:41:08 +02:00
AUTO_DUMP_SCOPE ("outer scope", stmt);
dump_printf_loc (MSG_NOTE, stmt, "msg 2\n");
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
{
Add -fopt-info-internals 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-04 19:41:08 +02:00
AUTO_DUMP_SCOPE ("middle scope", stmt);
dump_printf_loc (MSG_NOTE, stmt, "msg 3\n");
{
AUTO_DUMP_SCOPE ("inner scope", stmt);
dump_printf_loc (MSG_NOTE, stmt, "msg 4\n");
dump_printf_loc (MSG_NOTE | MSG_PRIORITY_USER_FACING, stmt,
"explicitly user-facing msg\n");
}
dump_printf_loc (MSG_NOTE, stmt, "msg 5\n");
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
Add -fopt-info-internals 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-04 19:41:08 +02:00
dump_printf_loc (MSG_NOTE, stmt, "msg 6\n");
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
}
Add -fopt-info-internals 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-04 19:41:08 +02:00
dump_printf_loc (MSG_NOTE, stmt, "msg 7\n");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
const int expected_impl_line = __LINE__ - 1;
dumpfile.c: eliminate special-casing of dump_file/alt_dump_file 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-31 21:22:48 +02:00
Add -fopt-info-internals 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-04 19:41:08 +02:00
switch (dump_filter & MSG_ALL_PRIORITIES)
{
default:
gcc_unreachable ();
case 0:
ASSERT_DUMPED_TEXT_EQ (tmp, "");
break;
case MSG_PRIORITY_USER_FACING:
ASSERT_DUMPED_TEXT_EQ
(tmp,
"test.txt:5:10: note: msg 1\n"
"test.txt:5:10: note: explicitly user-facing msg\n"
"test.txt:5:10: note: msg 7\n");
break;
case MSG_PRIORITY_INTERNALS:
ASSERT_DUMPED_TEXT_EQ
(tmp,
"test.txt:5:10: note: explicitly internal msg\n"
"test.txt:5:10: note: === outer scope ===\n"
"test.txt:5:10: note: msg 2\n"
"test.txt:5:10: note: === middle scope ===\n"
"test.txt:5:10: note: msg 3\n"
"test.txt:5:10: note: === inner scope ===\n"
"test.txt:5:10: note: msg 4\n"
"test.txt:5:10: note: msg 5\n"
"test.txt:5:10: note: msg 6\n");
break;
case MSG_ALL_PRIORITIES:
ASSERT_DUMPED_TEXT_EQ
(tmp,
"test.txt:5:10: note: msg 1\n"
"test.txt:5:10: note: explicitly internal msg\n"
"test.txt:5:10: note: === outer scope ===\n"
"test.txt:5:10: note: msg 2\n"
"test.txt:5:10: note: === middle scope ===\n"
"test.txt:5:10: note: msg 3\n"
"test.txt:5:10: note: === inner scope ===\n"
"test.txt:5:10: note: msg 4\n"
"test.txt:5:10: note: explicitly user-facing msg\n"
"test.txt:5:10: note: msg 5\n"
"test.txt:5:10: note: msg 6\n"
"test.txt:5:10: note: msg 7\n");
break;
}
if (with_optinfo)
{
optinfo *info = tmp.get_pending_optinfo ();
ASSERT_TRUE (info != NULL);
ASSERT_EQ (info->num_items (), 1);
ASSERT_IS_TEXT (info->get_item (0), "msg 7\n");
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (),
Change references of .c files to .cc files ChangeLog: * MAINTAINERS: Rename .c names to .cc. contrib/ChangeLog: * filter-clang-warnings.py: Rename .c names to .cc. * gcc_update: Likewise. * paranoia.cc: Likewise. contrib/header-tools/ChangeLog: * README: Rename .c names to .cc. gcc/ChangeLog: * Makefile.in: Rename .c names to .cc. * alias.h: Likewise. * asan.cc: Likewise. * auto-profile.h: Likewise. * basic-block.h (struct basic_block_d): Likewise. * btfout.cc: Likewise. * builtins.cc (expand_builtin_longjmp): Likewise. (validate_arg): Likewise. (access_ref::offset_bounded): Likewise. * caller-save.cc (reg_restore_code): Likewise. (setup_save_areas): Likewise. * calls.cc (initialize_argument_information): Likewise. (expand_call): Likewise. (emit_library_call_value_1): Likewise. * cfg-flags.def (RTL): Likewise. (SIBCALL): Likewise. (CAN_FALLTHRU): Likewise. * cfganal.cc (post_order_compute): Likewise. * cfgcleanup.cc (try_simplify_condjump): Likewise. (merge_blocks_move_predecessor_nojumps): Likewise. (merge_blocks_move_successor_nojumps): Likewise. (merge_blocks_move): Likewise. (old_insns_match_p): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.cc (expand_gimple_stmt): Likewise. * cfghooks.cc (split_block_before_cond_jump): Likewise. (profile_record_check_consistency): Likewise. * cfghooks.h: Likewise. * cfgrtl.cc (pass_free_cfg::execute): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (make_pass_outof_cfg_layout_mode): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. * cgraph.cc (release_function_body): Likewise. (cgraph_node::get_fun): Likewise. * cgraph.h (struct cgraph_node): Likewise. (asmname_hasher::equal): Likewise. (cgraph_inline_failed_type): Likewise. (thunk_adjust): Likewise. (dump_callgraph_transformation): Likewise. (record_references_in_initializer): Likewise. (ipa_discover_variable_flags): Likewise. * cgraphclones.cc (GTY): Likewise. * cgraphunit.cc (symbol_table::finalize_compilation_unit): Likewise. * collect-utils.h (GCC_COLLECT_UTILS_H): Likewise. * collect2-aix.h (GCC_COLLECT2_AIX_H): Likewise. * collect2.cc (maybe_run_lto_and_relink): Likewise. * combine-stack-adj.cc: Likewise. * combine.cc (setup_incoming_promotions): Likewise. (combine_simplify_rtx): Likewise. (count_rtxs): Likewise. * common.opt: Likewise. * common/config/aarch64/aarch64-common.cc: Likewise. * common/config/arm/arm-common.cc (arm_asm_auto_mfpu): Likewise. * common/config/avr/avr-common.cc: Likewise. * common/config/i386/i386-isas.h (struct _isa_names_table): Likewise. * conditions.h: Likewise. * config.gcc: Likewise. * config/aarch64/aarch64-builtins.cc (aarch64_resolve_overloaded_memtag): Likewise. * config/aarch64/aarch64-protos.h (aarch64_classify_address): Likewise. (aarch64_get_extension_string_for_isa_flags): Likewise. * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Likewise. * config/aarch64/aarch64.cc (aarch64_regmode_natural_size): Likewise. (aarch64_sched_first_cycle_multipass_dfa_lookahead): Likewise. (aarch64_option_valid_attribute_p): Likewise. (aarch64_short_vector_p): Likewise. (aarch64_float_const_representable_p): Likewise. * config/aarch64/aarch64.h (DBX_REGISTER_NUMBER): Likewise. (ASM_OUTPUT_POOL_EPILOGUE): Likewise. (GTY): Likewise. * config/aarch64/cortex-a57-fma-steering.cc: Likewise. * config/aarch64/driver-aarch64.cc (contains_core_p): Likewise. * config/aarch64/t-aarch64: Likewise. * config/aarch64/x-aarch64: Likewise. * config/aarch64/x-darwin: Likewise. * config/alpha/alpha-protos.h: Likewise. * config/alpha/alpha.cc (alpha_scalar_mode_supported_p): Likewise. * config/alpha/alpha.h (LONG_DOUBLE_TYPE_SIZE): Likewise. (enum reg_class): Likewise. * config/alpha/alpha.md: Likewise. * config/alpha/driver-alpha.cc (AMASK_LOCKPFTCHOK): Likewise. * config/alpha/x-alpha: Likewise. * config/arc/arc-protos.h (arc_eh_uses): Likewise. * config/arc/arc.cc (ARC_OPT): Likewise. (arc_ccfsm_advance): Likewise. (arc_arg_partial_bytes): Likewise. (conditionalize_nonjump): Likewise. * config/arc/arc.md: Likewise. * config/arc/builtins.def: Likewise. * config/arc/t-arc: Likewise. * config/arm/arm-c.cc (arm_resolve_overloaded_builtin): Likewise. (arm_pragma_target_parse): Likewise. * config/arm/arm-protos.h (save_restore_target_globals): Likewise. (arm_cpu_cpp_builtins): Likewise. * config/arm/arm.cc (vfp3_const_double_index): Likewise. (shift_op): Likewise. (thumb2_final_prescan_insn): Likewise. (arm_final_prescan_insn): Likewise. (arm_asm_output_labelref): Likewise. (arm_small_register_classes_for_mode_p): Likewise. * config/arm/arm.h: Likewise. * config/arm/arm.md: Likewise. * config/arm/driver-arm.cc: Likewise. * config/arm/symbian.h: Likewise. * config/arm/t-arm: Likewise. * config/arm/thumb1.md: Likewise. * config/arm/x-arm: Likewise. * config/avr/avr-c.cc (avr_register_target_pragmas): Likewise. * config/avr/avr-fixed.md: Likewise. * config/avr/avr-log.cc (avr_log_vadump): Likewise. * config/avr/avr-mcus.def: Likewise. * config/avr/avr-modes.def (FRACTIONAL_INT_MODE): Likewise. * config/avr/avr-passes.def (INSERT_PASS_BEFORE): Likewise. * config/avr/avr-protos.h (make_avr_pass_casesi): Likewise. * config/avr/avr.cc (avr_option_override): Likewise. (avr_build_builtin_va_list): Likewise. (avr_mode_dependent_address_p): Likewise. (avr_function_arg_advance): Likewise. (avr_asm_output_aligned_decl_common): Likewise. * config/avr/avr.h (RETURN_ADDR_RTX): Likewise. (SUPPORTS_INIT_PRIORITY): Likewise. * config/avr/avr.md: Likewise. * config/avr/builtins.def: Likewise. * config/avr/gen-avr-mmcu-specs.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. * config/avr/gen-avr-mmcu-texi.cc (IN_GEN_AVR_MMCU_TEXI): Likewise. (main): Likewise. * config/avr/t-avr: Likewise. * config/bfin/bfin.cc (frame_related_constant_load): Likewise. * config/bpf/bpf-protos.h (GCC_BPF_PROTOS_H): Likewise. * config/bpf/bpf.h (enum reg_class): Likewise. * config/bpf/t-bpf: Likewise. * config/c6x/c6x-protos.h (GCC_C6X_PROTOS_H): Likewise. * config/cr16/cr16-protos.h: Likewise. * config/cris/cris.cc (cris_address_cost): Likewise. (cris_side_effect_mode_ok): Likewise. (cris_init_machine_status): Likewise. (cris_emit_movem_store): Likewise. * config/cris/cris.h (INDEX_REG_CLASS): Likewise. (enum reg_class): Likewise. (struct cum_args): Likewise. * config/cris/cris.opt: Likewise. * config/cris/sync.md: Likewise. * config/csky/csky.cc (csky_expand_prologue): Likewise. * config/darwin-c.cc: Likewise. * config/darwin-f.cc: Likewise. * config/darwin-sections.def (zobj_const_section): Likewise. * config/darwin.cc (output_objc_section_asm_op): Likewise. (fprintf): Likewise. * config/darwin.h (GTY): Likewise. * config/elfos.h: Likewise. * config/epiphany/epiphany-sched.md: Likewise. * config/epiphany/epiphany.cc (epiphany_function_value): Likewise. * config/epiphany/epiphany.h (GTY): Likewise. (NO_FUNCTION_CSE): Likewise. * config/epiphany/mode-switch-use.cc: Likewise. * config/epiphany/predicates.md: Likewise. * config/epiphany/t-epiphany: Likewise. * config/fr30/fr30-protos.h: Likewise. * config/frv/frv-protos.h: Likewise. * config/frv/frv.cc (TLS_BIAS): Likewise. * config/frv/frv.h (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. * config/ft32/ft32-protos.h: Likewise. * config/gcn/gcn-hsa.h (ASM_APP_OFF): Likewise. * config/gcn/gcn.cc (gcn_init_libfuncs): Likewise. * config/gcn/mkoffload.cc (copy_early_debug_info): Likewise. * config/gcn/t-gcn-hsa: Likewise. * config/gcn/t-omp-device: Likewise. * config/h8300/h8300-protos.h (GCC_H8300_PROTOS_H): Likewise. (same_cmp_following_p): Likewise. * config/h8300/h8300.cc (F): Likewise. * config/h8300/h8300.h (struct cum_arg): Likewise. (BRANCH_COST): Likewise. * config/i386/cygming.h (DEFAULT_PCC_STRUCT_RETURN): Likewise. * config/i386/djgpp.h (TARGET_ASM_LTO_END): Likewise. * config/i386/dragonfly.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/driver-i386.cc (detect_caches_intel): Likewise. * config/i386/freebsd.h (NO_PROFILE_COUNTERS): Likewise. * config/i386/i386-c.cc (ix86_target_macros): Likewise. * config/i386/i386-expand.cc (get_mode_wider_vector): Likewise. * config/i386/i386-options.cc (ix86_set_func_type): Likewise. * config/i386/i386-protos.h (ix86_extract_perm_from_pool_constant): Likewise. (ix86_register_pragmas): Likewise. (ix86_d_has_stdcall_convention): Likewise. (i386_pe_seh_init_sections): Likewise. * config/i386/i386.cc (ix86_function_arg_regno_p): Likewise. (ix86_function_value_regno_p): Likewise. (ix86_compute_frame_layout): Likewise. (legitimize_pe_coff_symbol): Likewise. (output_pic_addr_const): Likewise. * config/i386/i386.h (defined): Likewise. (host_detect_local_cpu): Likewise. (CONSTANT_ADDRESS_P): Likewise. (DEFAULT_LARGE_SECTION_THRESHOLD): Likewise. (struct machine_frame_state): Likewise. * config/i386/i386.md: Likewise. * config/i386/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/i386/mmx.md: Likewise. * config/i386/sse.md: Likewise. * config/i386/t-cygming: Likewise. * config/i386/t-djgpp: Likewise. * config/i386/t-gnu-property: Likewise. * config/i386/t-i386: Likewise. * config/i386/t-intelmic: Likewise. * config/i386/t-omp-device: Likewise. * config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Likewise. (i386_pe_adjust_class_at_definition): Likewise. * config/i386/winnt.cc (gen_stdcall_or_fastcall_suffix): Likewise. (i386_pe_mangle_decl_assembler_name): Likewise. (i386_pe_encode_section_info): Likewise. * config/i386/x-cygwin: Likewise. * config/i386/x-darwin: Likewise. * config/i386/x-i386: Likewise. * config/i386/x-mingw32: Likewise. * config/i386/x86-tune-sched-core.cc: Likewise. * config/i386/x86-tune.def: Likewise. * config/i386/xm-djgpp.h (STANDARD_STARTFILE_PREFIX_1): Likewise. * config/ia64/freebsd.h: Likewise. * config/ia64/hpux.h (REGISTER_TARGET_PRAGMAS): Likewise. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Likewise. * config/ia64/ia64.cc (ia64_function_value_regno_p): Likewise. (ia64_secondary_reload_class): Likewise. (bundling): Likewise. * config/ia64/ia64.h: Likewise. * config/ia64/ia64.md: Likewise. * config/ia64/predicates.md: Likewise. * config/ia64/sysv4.h: Likewise. * config/ia64/t-ia64: Likewise. * config/iq2000/iq2000.h (FUNCTION_MODE): Likewise. * config/iq2000/iq2000.md: Likewise. * config/linux.h (TARGET_HAS_BIONIC): Likewise. (if): Likewise. * config/m32c/m32c.cc (m32c_function_needs_enter): Likewise. * config/m32c/m32c.h (MAX_REGS_PER_ADDRESS): Likewise. * config/m32c/t-m32c: Likewise. * config/m32r/m32r-protos.h: Likewise. * config/m32r/m32r.cc (m32r_print_operand): Likewise. * config/m32r/m32r.h: Likewise. * config/m32r/m32r.md: Likewise. * config/m68k/m68k-isas.def: Likewise. * config/m68k/m68k-microarchs.def: Likewise. * config/m68k/m68k-protos.h (strict_low_part_peephole_ok): Likewise. (m68k_epilogue_uses): Likewise. * config/m68k/m68k.cc (m68k_call_tls_get_addr): Likewise. (m68k_sched_adjust_cost): Likewise. (m68k_sched_md_init): Likewise. * config/m68k/m68k.h (__transfer_from_trampoline): Likewise. (enum m68k_function_kind): Likewise. * config/m68k/m68k.md: Likewise. * config/m68k/m68kemb.h: Likewise. * config/m68k/uclinux.h (ENDFILE_SPEC): Likewise. * config/mcore/mcore-protos.h: Likewise. * config/mcore/mcore.cc (mcore_expand_insv): Likewise. (mcore_expand_prolog): Likewise. * config/mcore/mcore.h (TARGET_MCORE): Likewise. * config/mcore/mcore.md: Likewise. * config/microblaze/microblaze-protos.h: Likewise. * config/microblaze/microblaze.cc (microblaze_legitimate_pic_operand): Likewise. (microblaze_function_prologue): Likewise. (microblaze_function_epilogue): Likewise. (microblaze_select_section): Likewise. (microblaze_asm_output_mi_thunk): Likewise. (microblaze_eh_return): Likewise. * config/microblaze/microblaze.h: Likewise. * config/microblaze/microblaze.md: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/driver-native.cc: Likewise. * config/mips/loongson2ef.md: Likewise. * config/mips/mips-protos.h (mips_expand_vec_cmp_expr): Likewise. * config/mips/mips.cc (mips_rtx_costs): Likewise. (mips_output_filename): Likewise. (mips_output_function_prologue): Likewise. (mips_output_function_epilogue): Likewise. (mips_output_mi_thunk): Likewise. * config/mips/mips.h: Likewise. * config/mips/mips.md: Likewise. * config/mips/t-mips: Likewise. * config/mips/x-native: Likewise. * config/mmix/mmix-protos.h: Likewise. * config/mmix/mmix.cc (mmix_option_override): Likewise. (mmix_dbx_register_number): Likewise. (mmix_expand_prologue): Likewise. * config/mmix/mmix.h: Likewise. * config/mmix/mmix.md: Likewise. * config/mmix/predicates.md: Likewise. * config/mn10300/mn10300.cc (mn10300_symbolic_operand): Likewise. (mn10300_legitimate_pic_operand_p): Likewise. * config/mn10300/mn10300.h (enum reg_class): Likewise. (NO_FUNCTION_CSE): Likewise. * config/moxie/moxie-protos.h: Likewise. * config/moxie/uclinux.h (TARGET_LIBC_HAS_FUNCTION): Likewise. * config/msp430/msp430-devices.cc (extract_devices_dir_from_exec_prefix): Likewise. * config/msp430/msp430.cc (msp430_gimplify_va_arg_expr): Likewise. (msp430_incoming_return_addr_rtx): Likewise. * config/msp430/msp430.h (msp430_get_linker_devices_include_path): Likewise. * config/msp430/t-msp430: Likewise. * config/nds32/nds32-cost.cc (nds32_rtx_costs_speed_prefer): Likewise. (nds32_rtx_costs_size_prefer): Likewise. (nds32_init_rtx_costs): Likewise. * config/nds32/nds32-doubleword.md: Likewise. * config/nds32/nds32.cc (nds32_memory_move_cost): Likewise. (nds32_builtin_decl): Likewise. * config/nds32/nds32.h (enum nds32_16bit_address_type): Likewise. (enum nds32_isr_nested_type): Likewise. (enum reg_class): Likewise. * config/nds32/predicates.md: Likewise. * config/nds32/t-nds32: Likewise. * config/nios2/nios2.cc (nios2_pragma_target_parse): Likewise. * config/nvptx/nvptx-protos.h: Likewise. * config/nvptx/nvptx.cc (nvptx_goacc_expand_var_decl): Likewise. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Likewise. * config/nvptx/t-nvptx: Likewise. * config/nvptx/t-omp-device: Likewise. * config/pa/elf.h: Likewise. * config/pa/pa-linux.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-netbsd.h (GLOBAL_ASM_OP): Likewise. * config/pa/pa-openbsd.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/pa/pa-protos.h (pa_eh_return_handler_rtx): Likewise. (pa_legitimize_reload_address): Likewise. (pa_can_use_return_insn): Likewise. * config/pa/pa.cc (mem_shadd_or_shadd_rtx_p): Likewise. (som_output_text_section_asm_op): Likewise. * config/pa/pa.h (PROFILE_BEFORE_PROLOGUE): Likewise. * config/pa/pa.md: Likewise. * config/pa/som.h: Likewise. * config/pa/t-pa: Likewise. * config/pdp11/pdp11.cc (decode_pdp11_d): Likewise. * config/pdp11/pdp11.h: Likewise. * config/pdp11/pdp11.md: Likewise. * config/pdp11/t-pdp11: Likewise. * config/pru/pru.md: Likewise. * config/pru/t-pru: Likewise. * config/riscv/riscv-protos.h (NUM_SYMBOL_TYPES): Likewise. (riscv_gpr_save_operation_p): Likewise. (riscv_d_register_target_info): Likewise. (riscv_init_builtins): Likewise. * config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise. * config/riscv/riscv.h (CSW_MAX_OFFSET): Likewise. * config/riscv/t-riscv: Likewise. * config/rl78/rl78.cc (rl78_asm_ctor_dtor): Likewise. * config/rl78/t-rl78: Likewise. * config/rs6000/aix.h: Likewise. * config/rs6000/aix71.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix72.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/aix73.h (ASM_SPEC_COMMON): Likewise. * config/rs6000/darwin.h (TARGET_ASM_GLOBALIZE_LABEL): Likewise. * config/rs6000/driver-rs6000.cc: Likewise. * config/rs6000/freebsd.h: Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/lynx.h (ASM_OUTPUT_ALIGN): Likewise. * config/rs6000/rbtree.cc: Likewise. * config/rs6000/rbtree.h: Likewise. * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000-call.cc (rs6000_invalid_builtin): Likewise. (rs6000_expand_builtin): Likewise. (rs6000_init_builtins): Likewise. * config/rs6000/rs6000-cpus.def: Likewise. * config/rs6000/rs6000-gen-builtins.cc (write_init_ovld_table): Likewise. * config/rs6000/rs6000-internal.h (ALTIVEC_REG_BIT): Likewise. (quad_address_offset_p): Likewise. * config/rs6000/rs6000-logue.cc (interesting_frame_related_regno): Likewise. (rs6000_emit_epilogue): Likewise. * config/rs6000/rs6000-overload.def: Likewise. * config/rs6000/rs6000-p8swap.cc: Likewise. * config/rs6000/rs6000-protos.h (GCC_RS6000_PROTOS_H): Likewise. (rs6000_const_f32_to_i32): Likewise. * config/rs6000/rs6000.cc (legitimate_lo_sum_address_p): Likewise. (rs6000_debug_legitimize_address): Likewise. (rs6000_mode_dependent_address): Likewise. (rs6000_adjust_priority): Likewise. (rs6000_c_mode_for_suffix): Likewise. * config/rs6000/rs6000.h (defined): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.md: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/t-linux: Likewise. * config/rs6000/t-linux64: Likewise. * config/rs6000/t-rs6000: Likewise. * config/rs6000/x-darwin: Likewise. * config/rs6000/x-darwin64: Likewise. * config/rs6000/x-rs6000: Likewise. * config/rs6000/xcoff.h (ASM_OUTPUT_LABELREF): Likewise. * config/rx/rx.cc (rx_expand_builtin): Likewise. * config/s390/constraints.md: Likewise. * config/s390/driver-native.cc: Likewise. * config/s390/htmxlintrin.h: Likewise. * config/s390/s390-builtins.def (B_DEF): Likewise. (OB_DEF_VAR): Likewise. * config/s390/s390-builtins.h: Likewise. * config/s390/s390-c.cc: Likewise. * config/s390/s390-opts.h: Likewise. * config/s390/s390-protos.h (s390_check_symref_alignment): Likewise. (s390_register_target_pragmas): Likewise. * config/s390/s390.cc (s390_init_builtins): Likewise. (s390_expand_plus_operand): Likewise. (s390_expand_atomic): Likewise. (s390_valid_target_attribute_inner_p): Likewise. * config/s390/s390.h (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.md: Likewise. * config/s390/t-s390: Likewise. * config/s390/vx-builtins.md: Likewise. * config/s390/x-native: Likewise. * config/sh/divtab-sh4-300.cc (main): Likewise. * config/sh/divtab-sh4.cc (main): Likewise. * config/sh/divtab.cc (main): Likewise. * config/sh/elf.h: Likewise. * config/sh/sh-protos.h (sh_fsca_int2sf): Likewise. * config/sh/sh.cc (SYMBOL_FLAG_FUNCVEC_FUNCTION): Likewise. (sh_struct_value_rtx): Likewise. (sh_remove_reg_dead_or_unused_notes): Likewise. * config/sh/sh.h (MIN_UNITS_PER_WORD): Likewise. * config/sh/t-sh: Likewise. * config/sol2-protos.h (solaris_override_options): Likewise. * config/sol2.h: Likewise. * config/sparc/driver-sparc.cc: Likewise. * config/sparc/freebsd.h: Likewise. * config/sparc/sparc-protos.h (make_pass_work_around_errata): Likewise. * config/sparc/sparc.cc (sparc_output_mi_thunk): Likewise. (sparc_asan_shadow_offset): Likewise. * config/sparc/sparc.h: Likewise. * config/sparc/sparc.md: Likewise. * config/sparc/t-sparc: Likewise. * config/sparc/x-sparc: Likewise. * config/stormy16/stormy16.cc (xstormy16_mode_dependent_address_p): Likewise. * config/t-darwin: Likewise. * config/t-dragonfly: Likewise. * config/t-freebsd: Likewise. * config/t-glibc: Likewise. * config/t-linux: Likewise. * config/t-netbsd: Likewise. * config/t-openbsd: Likewise. * config/t-pnt16-warn: Likewise. * config/t-sol2: Likewise. * config/t-vxworks: Likewise. * config/t-winnt: Likewise. * config/tilegx/t-tilegx: Likewise. * config/tilegx/tilegx-c.cc: Likewise. * config/tilegx/tilegx-protos.h (tilegx_function_profiler): Likewise. * config/tilegx/tilegx.md: Likewise. * config/tilepro/t-tilepro: Likewise. * config/tilepro/tilepro-c.cc: Likewise. * config/v850/t-v850: Likewise. * config/v850/v850-protos.h: Likewise. * config/v850/v850.cc (F): Likewise. * config/v850/v850.h (enum reg_class): Likewise. (SLOW_BYTE_ACCESS): Likewise. * config/vax/vax.cc (vax_mode_dependent_address_p): Likewise. * config/vax/vax.h (enum reg_class): Likewise. * config/vax/vax.md: Likewise. * config/visium/visium.cc (visium_legitimate_address_p): Likewise. * config/visium/visium.h: Likewise. * config/vms/t-vms: Likewise. * config/vms/vms-crtlmap.map: Likewise. * config/vms/vms-protos.h (vms_c_get_vms_ver): Likewise. * config/vx-common.h: Likewise. * config/x-darwin: Likewise. * config/x-hpux: Likewise. * config/x-linux: Likewise. * config/x-netbsd: Likewise. * config/x-openbsd: Likewise. * config/x-solaris: Likewise. * config/xtensa/xtensa-protos.h (xtensa_mem_offset): Likewise. * config/xtensa/xtensa.cc (xtensa_option_override): Likewise. * config/xtensa/xtensa.h: Likewise. * configure.ac: Likewise. * context.cc: Likewise. * convert.h: Likewise. * coretypes.h: Likewise. * coverage.cc: Likewise. * coverage.h: Likewise. * cppdefault.h (struct default_include): Likewise. * cprop.cc (local_cprop_pass): Likewise. (one_cprop_pass): Likewise. * cse.cc (hash_rtx_cb): Likewise. (fold_rtx): Likewise. * ctfc.h (ctfc_get_num_vlen_bytes): Likewise. * data-streamer.h (bp_unpack_var_len_int): Likewise. (streamer_write_widest_int): Likewise. * dbgcnt.def: Likewise. * dbxout.cc (dbxout_early_global_decl): Likewise. (dbxout_common_check): Likewise. * dbxout.h: Likewise. * debug.h (struct gcc_debug_hooks): Likewise. (dump_go_spec_init): Likewise. * df-core.cc: Likewise. * df-scan.cc (df_insn_info_delete): Likewise. (df_insn_delete): Likewise. * df.h (debug_df_chain): Likewise. (can_move_insns_across): Likewise. * dfp.cc (decimal_from_binary): Likewise. * diagnostic-color.cc: Likewise. * diagnostic-event-id.h: Likewise. * diagnostic-show-locus.cc (test_one_liner_labels): Likewise. * diagnostic.cc (bt_callback): Likewise. (num_digits): Likewise. * doc/avr-mmcu.texi: Likewise. * doc/cfg.texi: Likewise. * doc/contrib.texi: Likewise. * doc/cppinternals.texi: Likewise. * doc/extend.texi: Likewise. * doc/generic.texi: Likewise. * doc/gimple.texi: Likewise. * doc/gty.texi: Likewise. * doc/invoke.texi: Likewise. * doc/loop.texi: Likewise. * doc/lto.texi: Likewise. * doc/match-and-simplify.texi: Likewise. * doc/md.texi: Likewise. * doc/optinfo.texi: Likewise. * doc/options.texi: Likewise. * doc/passes.texi: Likewise. * doc/plugins.texi: Likewise. * doc/rtl.texi: Likewise. * doc/sourcebuild.texi: Likewise. * doc/tm.texi: Likewise. * doc/tm.texi.in: Likewise. * doc/tree-ssa.texi: Likewise. * dojump.cc (do_jump): Likewise. * dojump.h: Likewise. * dumpfile.cc (test_impl_location): Likewise. (test_capture_of_dump_calls): Likewise. * dumpfile.h (enum dump_kind): Likewise. (class dump_location_t): Likewise. (dump_enabled_p): Likewise. (enable_rtl_dump_file): Likewise. (dump_combine_total_stats): Likewise. * dwarf2asm.cc (dw2_asm_output_delta_uleb128): Likewise. * dwarf2ctf.h (ctf_debug_finish): Likewise. * dwarf2out.cc (dwarf2out_begin_prologue): Likewise. (struct loc_descr_context): Likewise. (rtl_for_decl_location): Likewise. (gen_subprogram_die): Likewise. (gen_label_die): Likewise. (is_trivial_indirect_ref): Likewise. (dwarf2out_late_global_decl): Likewise. (dwarf_file_hasher::hash): Likewise. (dwarf2out_end_source_file): Likewise. (dwarf2out_define): Likewise. (dwarf2out_early_finish): Likewise. * dwarf2out.h (struct dw_fde_node): Likewise. (struct dw_discr_list_node): Likewise. (output_loc_sequence_raw): Likewise. * emit-rtl.cc (gen_raw_REG): Likewise. (maybe_set_max_label_num): Likewise. * emit-rtl.h (struct rtl_data): Likewise. * errors.cc (internal_error): Likewise. (trim_filename): Likewise. * et-forest.cc: Likewise. * except.cc (init_eh_for_function): Likewise. * explow.cc (promote_ssa_mode): Likewise. (get_dynamic_stack_size): Likewise. * explow.h: Likewise. * expmed.h: Likewise. * expr.cc (safe_from_p): Likewise. (expand_expr_real_2): Likewise. (expand_expr_real_1): Likewise. * file-prefix-map.cc (remap_filename): Likewise. * final.cc (app_enable): Likewise. (make_pass_compute_alignments): Likewise. (final_scan_insn_1): Likewise. (final_scan_insn): Likewise. * fixed-value.h (fixed_from_string): Likewise. * flag-types.h (NO_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (VMS_DEBUG): Likewise. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): Likewise. * fold-const.cc (const_binop): Likewise. (fold_binary_loc): Likewise. (fold_checksum_tree): Likewise. * fp-test.cc: Likewise. * function.cc (expand_function_end): Likewise. * function.h (struct function): Likewise. * fwprop.cc (should_replace_address): Likewise. * gcc-main.cc: Likewise. * gcc-rich-location.h (class gcc_rich_location): Likewise. * gcc-symtab.h: Likewise. * gcc.cc (MIN_FATAL_STATUS): Likewise. (driver_handle_option): Likewise. (quote_spec_arg): Likewise. (driver::finalize): Likewise. * gcc.h (set_input): Likewise. * gcov-dump.cc: Likewise. * gcov.cc (solve_flow_graph): Likewise. * gcse-common.cc: Likewise. * gcse.cc (make_pass_rtl_hoist): Likewise. * genattr-common.cc: Likewise. * genattrtab.cc (min_fn): Likewise. (write_const_num_delay_slots): Likewise. * genautomata.cc: Likewise. * genconditions.cc (write_one_condition): Likewise. * genconstants.cc: Likewise. * genemit.cc (gen_exp): Likewise. * generic-match-head.cc: Likewise. * genextract.cc: Likewise. * gengenrtl.cc (always_void_p): Likewise. * gengtype-parse.cc (gtymarker_opt): Likewise. * gengtype-state.cc (state_writer::state_writer): Likewise. (write_state_trailer): Likewise. (equals_type_number): Likewise. (read_state): Likewise. * gengtype.cc (open_base_files): Likewise. (struct file_rule_st): Likewise. (header_dot_h_frul): Likewise. * gengtype.h: Likewise. * genmatch.cc (main): Likewise. * genmddeps.cc: Likewise. * genmodes.cc (emit_mode_inner): Likewise. (emit_mode_unit_size): Likewise. * genpeep.cc (gen_peephole): Likewise. * genpreds.cc (write_tm_preds_h): Likewise. * genrecog.cc (validate_pattern): Likewise. (write_header): Likewise. (main): Likewise. * gensupport.cc (change_subst_attribute): Likewise. (traverse_c_tests): Likewise. (add_predicate): Likewise. (init_predicate_table): Likewise. * gensupport.h (struct optab_pattern): Likewise. (get_num_insn_codes): Likewise. (maybe_eval_c_test): Likewise. (struct pred_data): Likewise. * ggc-internal.h: Likewise. * gimple-fold.cc (maybe_fold_reference): Likewise. (get_range_strlen_tree): Likewise. * gimple-fold.h (gimple_stmt_integer_valued_real_p): Likewise. * gimple-low.cc: Likewise. * gimple-match-head.cc (directly_supported_p): Likewise. * gimple-pretty-print.h: Likewise. * gimple-ssa-sprintf.cc (format_percent): Likewise. (adjust_range_for_overflow): Likewise. * gimple-streamer.h: Likewise. * gimple.h (struct GTY): Likewise. (is_gimple_resx): Likewise. * gimplify.cc (gimplify_expr): Likewise. (gimplify_init_constructor): Likewise. (omp_construct_selector_matches): Likewise. (gimplify_omp_target_update): Likewise. (gimplify_omp_ordered): Likewise. (gimplify_va_arg_expr): Likewise. * graphite-isl-ast-to-gimple.cc (should_copy_to_new_region): Likewise. * haifa-sched.cc (increase_insn_priority): Likewise. (try_ready): Likewise. (sched_create_recovery_edges): Likewise. * ifcvt.cc (find_if_case_1): Likewise. (find_if_case_2): Likewise. * inchash.h: Likewise. * incpath.cc (add_env_var_paths): Likewise. * input.cc (dump_location_info): Likewise. (assert_loceq): Likewise. (test_lexer_string_locations_concatenation_1): Likewise. (test_lexer_string_locations_concatenation_2): Likewise. (test_lexer_string_locations_concatenation_3): Likewise. * input.h (BUILTINS_LOCATION): Likewise. (class string_concat_db): Likewise. * internal-fn.cc (expand_MUL_OVERFLOW): Likewise. (expand_LOOP_VECTORIZED): Likewise. * ipa-cp.cc (make_pass_ipa_cp): Likewise. * ipa-fnsummary.cc (remap_freqcounting_preds_after_dup): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (make_pass_ipa_fn_summary): Likewise. * ipa-fnsummary.h (enum ipa_hints_vals): Likewise. * ipa-free-lang-data.cc (fld_simplified_type): Likewise. (free_lang_data_in_decl): Likewise. * ipa-inline.cc (compute_inlined_call_time): Likewise. (inline_always_inline_functions): Likewise. * ipa-inline.h (free_growth_caches): Likewise. (inline_account_function_p): Likewise. * ipa-modref.cc (modref_access_analysis::analyze_stmt): Likewise. (modref_eaf_analysis::analyze_ssa_name): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::mark_dead_statements): Likewise. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. * ipa-prop.cc (ipa_set_node_agg_value_chain): Likewise. * ipa-prop.h (IPA_UNDESCRIBED_USE): Likewise. (unadjusted_ptr_and_unit_offset): Likewise. * ipa-reference.cc (make_pass_ipa_reference): Likewise. * ipa-reference.h (GCC_IPA_REFERENCE_H): Likewise. * ipa-split.cc (consider_split): Likewise. * ipa-sra.cc (isra_read_node_info): Likewise. * ipa-utils.h (struct ipa_dfs_info): Likewise. (recursive_call_p): Likewise. (ipa_make_function_pure): Likewise. * ira-build.cc (ira_create_allocno): Likewise. (ira_flattening): Likewise. * ira-color.cc (do_coloring): Likewise. (update_curr_costs): Likewise. * ira-conflicts.cc (process_regs_for_copy): Likewise. * ira-int.h (struct ira_emit_data): Likewise. (ira_prohibited_mode_move_regs): Likewise. (ira_get_dup_out_num): Likewise. (ira_destroy): Likewise. (ira_tune_allocno_costs): Likewise. (ira_implicitly_set_insn_hard_regs): Likewise. (ira_build_conflicts): Likewise. (ira_color): Likewise. * ira-lives.cc (process_bb_node_lives): Likewise. * ira.cc (class ira_spilled_reg_stack_slot): Likewise. (setup_uniform_class_p): Likewise. (def_dominates_uses): Likewise. * ira.h (ira_nullify_asm_goto): Likewise. * langhooks.cc (lhd_post_options): Likewise. * langhooks.h (class substring_loc): Likewise. (struct lang_hooks_for_tree_inlining): Likewise. (struct lang_hooks_for_types): Likewise. (struct lang_hooks): Likewise. * libfuncs.h (synchronize_libfunc): Likewise. * loop-doloop.cc (doloop_condition_get): Likewise. * loop-init.cc (fix_loop_structure): Likewise. * loop-invariant.cc: Likewise. * lower-subreg.h: Likewise. * lra-constraints.cc (curr_insn_transform): Likewise. * lra-int.h (struct lra_insn_reg): Likewise. (lra_undo_inheritance): Likewise. (lra_setup_reload_pseudo_preferenced_hard_reg): Likewise. (lra_split_hard_reg_for): Likewise. (lra_coalesce): Likewise. (lra_final_code_change): Likewise. * lra-spills.cc (lra_final_code_change): Likewise. * lra.cc (lra_process_new_insns): Likewise. * lto-compress.h (struct lto_compression_stream): Likewise. * lto-streamer-out.cc (DFS::DFS_write_tree_body): Likewise. (write_symbol): Likewise. * lto-streamer.h (enum LTO_tags): Likewise. (lto_value_range_error): Likewise. (lto_append_block): Likewise. (lto_streamer_hooks_init): Likewise. (stream_read_tree_ref): Likewise. (lto_prepare_function_for_streaming): Likewise. (select_what_to_stream): Likewise. (omp_lto_input_declare_variant_alt): Likewise. (cl_optimization_stream_in): Likewise. * lto-wrapper.cc (append_compiler_options): Likewise. * machmode.def: Likewise. * machmode.h (struct int_n_data_t): Likewise. * main.cc (main): Likewise. * match.pd: Likewise. * omp-builtins.def (BUILT_IN_GOMP_CRITICAL_NAME_END): Likewise. (BUILT_IN_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT): Likewise. * omp-expand.cc (expand_omp_atomic_fetch_op): Likewise. (make_pass_expand_omp_ssa): Likewise. * omp-low.cc (struct omp_context): Likewise. (struct omp_taskcopy_context): Likewise. (lower_omp): Likewise. * omp-oacc-neuter-broadcast.cc (omp_sese_active_worker_call): Likewise. (mask_name): Likewise. (omp_sese_dump_pars): Likewise. (worker_single_simple): Likewise. * omp-offload.cc (omp_finish_file): Likewise. (execute_oacc_loop_designation): Likewise. * optabs-query.cc (lshift_cheap_p): Likewise. * optc-gen.awk: Likewise. * optc-save-gen.awk: Likewise. * optinfo-emit-json.cc (optrecord_json_writer::optrecord_json_writer): Likewise. * opts-common.cc: Likewise. * output.h (app_enable): Likewise. (output_operand_lossage): Likewise. (insn_current_reference_address): Likewise. (get_insn_template): Likewise. (output_quoted_string): Likewise. * pass_manager.h (struct register_pass_info): Likewise. * plugin.cc: Likewise. * plugin.def (PLUGIN_ANALYZER_INIT): Likewise. * plugin.h (invoke_plugin_callbacks): Likewise. * pointer-query.cc (handle_mem_ref): Likewise. * postreload-gcse.cc (alloc_mem): Likewise. * predict.h (enum prediction): Likewise. (add_reg_br_prob_note): Likewise. * prefix.h: Likewise. * profile.h (get_working_sets): Likewise. * read-md.cc: Likewise. * read-md.h (struct mapping): Likewise. (class md_reader): Likewise. (class noop_reader): Likewise. * read-rtl-function.cc (function_reader::create_function): Likewise. (function_reader::extra_parsing_for_operand_code_0): Likewise. * read-rtl.cc (initialize_iterators): Likewise. * real.cc: Likewise. * real.h (struct real_value): Likewise. (format_helper::format_helper): Likewise. (real_hash): Likewise. (real_can_shorten_arithmetic): Likewise. * recog.cc (struct target_recog): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * recog.h (MAX_RECOG_ALTERNATIVES): Likewise. (which_op_alt): Likewise. (struct insn_gen_fn): Likewise. * reg-notes.def (REG_NOTE): Likewise. * reg-stack.cc: Likewise. * regs.h (reg_is_parm_p): Likewise. * regset.h: Likewise. * reload.cc (push_reload): Likewise. (find_reloads): Likewise. (find_reloads_address_1): Likewise. (find_replacement): Likewise. (refers_to_regno_for_reload_p): Likewise. (refers_to_mem_for_reload_p): Likewise. * reload.h (push_reload): Likewise. (deallocate_reload_reg): Likewise. * reload1.cc (emit_input_reload_insns): Likewise. * reorg.cc (relax_delay_slots): Likewise. * rtl.def (UNKNOWN): Likewise. (SEQUENCE): Likewise. (BARRIER): Likewise. (ASM_OPERANDS): Likewise. (EQ_ATTR_ALT): Likewise. * rtl.h (struct GTY): Likewise. (LABEL_NAME): Likewise. (LABEL_ALT_ENTRY_P): Likewise. (SUBREG_BYTE): Likewise. (get_stack_check_protect): Likewise. (dump_rtx_statistics): Likewise. (unwrap_const_vec_duplicate): Likewise. (subreg_promoted_mode): Likewise. (gen_lowpart_common): Likewise. (operand_subword): Likewise. (immed_wide_int_const): Likewise. (decide_function_section): Likewise. (active_insn_p): Likewise. (delete_related_insns): Likewise. (try_split): Likewise. (val_signbit_known_clear_p): Likewise. (simplifiable_subregs): Likewise. (set_insn_deleted): Likewise. (subreg_get_info): Likewise. (remove_free_EXPR_LIST_node): Likewise. (finish_subregs_of_mode): Likewise. (get_mem_attrs): Likewise. (lookup_constant_def): Likewise. (rtx_to_tree_code): Likewise. (hash_rtx): Likewise. (condjump_in_parallel_p): Likewise. (validate_subreg): Likewise. (make_compound_operation): Likewise. (schedule_ebbs): Likewise. (print_inline_rtx): Likewise. (fixup_args_size_notes): Likewise. (expand_dec): Likewise. (prepare_copy_insn): Likewise. (mark_elimination): Likewise. (valid_mode_changes_for_regno): Likewise. (make_debug_expr_from_rtl): Likewise. (delete_vta_debug_insns): Likewise. (simplify_using_condition): Likewise. (set_insn_locations): Likewise. (fatal_insn_not_found): Likewise. (word_register_operation_p): Likewise. * rtlanal.cc (get_call_fndecl): Likewise. (side_effects_p): Likewise. (subreg_nregs): Likewise. (rtx_cost): Likewise. (canonicalize_condition): Likewise. * rtlanal.h (rtx_properties::try_to_add_note): Likewise. * run-rtl-passes.cc (run_rtl_passes): Likewise. * sanitizer.def (BUILT_IN_ASAN_VERSION_MISMATCH_CHECK): Likewise. * sched-deps.cc (add_dependence_1): Likewise. * sched-ebb.cc (begin_move_insn): Likewise. (add_deps_for_risky_insns): Likewise. (advance_target_bb): Likewise. * sched-int.h (reemit_notes): Likewise. (struct _haifa_insn_data): Likewise. (HID): Likewise. (DEP_CANCELLED): Likewise. (debug_ds): Likewise. (number_in_ready): Likewise. (schedule_ebbs_finish): Likewise. (find_modifiable_mems): Likewise. * sched-rgn.cc (debug_rgn_dependencies): Likewise. * sel-sched-dump.cc (dump_lv_set): Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.cc (sel_insn_rtx_cost): Likewise. (setup_id_reg_sets): Likewise. (has_dependence_p): Likewise. (sel_num_cfg_preds_gt_1): Likewise. (bb_ends_ebb_p): Likewise. * sel-sched-ir.h (struct _list_node): Likewise. (struct idata_def): Likewise. (bb_next_bb): Likewise. * sel-sched.cc (vinsn_writes_one_of_regs_p): Likewise. (choose_best_pseudo_reg): Likewise. (verify_target_availability): Likewise. (can_speculate_dep_p): Likewise. (sel_rank_for_schedule): Likewise. * selftest-run-tests.cc (selftest::run_tests): Likewise. * selftest.h (class auto_fix_quotes): Likewise. * shrink-wrap.cc (handle_simple_exit): Likewise. * shrink-wrap.h: Likewise. * simplify-rtx.cc (simplify_context::simplify_associative_operation): Likewise. (simplify_context::simplify_gen_vec_select): Likewise. * spellcheck-tree.h: Likewise. * spellcheck.h: Likewise. * statistics.h (struct function): Likewise. * stmt.cc (conditional_probability): Likewise. * stmt.h: Likewise. * stor-layout.h: Likewise. * streamer-hooks.h: Likewise. * stringpool.h: Likewise. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * target.def (HOOK_VECTOR_END): Likewise. (type.): Likewise. * target.h (union cumulative_args_t): Likewise. (by_pieces_ninsns): Likewise. (class predefined_function_abi): Likewise. * targhooks.cc (default_translate_mode_attribute): Likewise. * timevar.def: Likewise. * timevar.h (class timer): Likewise. * toplev.h (enable_rtl_dump_file): Likewise. * trans-mem.cc (collect_bb2reg): Likewise. * tree-call-cdce.cc (gen_conditions_for_pow): Likewise. * tree-cfg.cc (remove_bb): Likewise. (verify_gimple_debug): Likewise. (remove_edge_and_dominated_blocks): Likewise. (push_fndecl): Likewise. * tree-cfgcleanup.h (GCC_TREE_CFGCLEANUP_H): Likewise. * tree-complex.cc (expand_complex_multiplication): Likewise. (expand_complex_div_straight): Likewise. * tree-core.h (enum tree_index): Likewise. (enum operand_equal_flag): Likewise. * tree-eh.cc (honor_protect_cleanup_actions): Likewise. * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Likewise. * tree-inline.cc (initialize_inlined_parameters): Likewise. * tree-inline.h (force_value_to_type): Likewise. * tree-nested.cc (get_chain_decl): Likewise. (walk_all_functions): Likewise. * tree-object-size.h: Likewise. * tree-outof-ssa.cc: Likewise. * tree-parloops.cc (create_parallel_loop): Likewise. * tree-pretty-print.cc (print_generic_expr_to_str): Likewise. (dump_generic_node): Likewise. * tree-profile.cc (tree_profiling): Likewise. * tree-sra.cc (maybe_add_sra_candidate): Likewise. * tree-ssa-address.cc: Likewise. * tree-ssa-alias.cc: Likewise. * tree-ssa-alias.h (ao_ref::max_size_known_p): Likewise. (dump_alias_stats): Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-coalesce.h: Likewise. * tree-ssa-live.cc (remove_unused_scope_block_p): Likewise. * tree-ssa-loop-manip.cc (copy_phi_node_args): Likewise. * tree-ssa-loop-unswitch.cc: Likewise. * tree-ssa-math-opts.cc: Likewise. * tree-ssa-operands.cc (class operands_scanner): Likewise. * tree-ssa-pre.cc: Likewise. * tree-ssa-reassoc.cc (optimize_ops_list): Likewise. (debug_range_entry): Likewise. * tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt): Likewise. * tree-ssa-sccvn.h (TREE_SSA_SCCVN_H): Likewise. * tree-ssa-scopedtables.cc (add_expr_commutative): Likewise. (equal_mem_array_ref_p): Likewise. * tree-ssa-strlen.cc (is_strlen_related_p): Likewise. * tree-ssa-strlen.h (get_range_strlen_dynamic): Likewise. * tree-ssa-tail-merge.cc (stmt_local_def): Likewise. * tree-ssa-ter.h: Likewise. * tree-ssa-threadupdate.h (enum bb_dom_status): Likewise. * tree-streamer-in.cc (lto_input_ts_block_tree_pointers): Likewise. * tree-streamer-out.cc (pack_ts_block_value_fields): Likewise. (write_ts_block_tree_pointers): Likewise. * tree-streamer.h (struct streamer_tree_cache_d): Likewise. (streamer_read_tree_bitfields): Likewise. (streamer_write_integer_cst): Likewise. * tree-vect-patterns.cc (apply_binop_and_append_stmt): Likewise. (vect_synth_mult_by_constant): Likewise. * tree-vect-stmts.cc (vectorizable_operation): Likewise. * tree-vectorizer.cc: Likewise. * tree-vectorizer.h (class auto_purge_vect_location): Likewise. (vect_update_inits_of_drs): Likewise. (vect_get_mask_type_for_stmt): Likewise. (vect_rgroup_iv_might_wrap_p): Likewise. (cse_and_gimplify_to_preheader): Likewise. (vect_free_slp_tree): Likewise. (vect_pattern_recog): Likewise. (vect_stmt_dominates_stmt_p): Likewise. * tree.cc (initialize_tree_contains_struct): Likewise. (need_assembler_name_p): Likewise. (type_with_interoperable_signedness): Likewise. * tree.def (SWITCH_EXPR): Likewise. * tree.h (TYPE_SYMTAB_ADDRESS): Likewise. (poly_int_tree_p): Likewise. (inlined_function_outer_scope_p): Likewise. (tree_code_for_canonical_type_merging): Likewise. * value-prof.cc: Likewise. * value-prof.h (get_nth_most_common_value): Likewise. (find_func_by_profile_id): Likewise. * value-range.cc (vrp_operand_equal_p): Likewise. * value-range.h: Likewise. * var-tracking.cc: Likewise. * varasm.cc (default_function_section): Likewise. (function_section_1): Likewise. (assemble_variable): Likewise. (handle_vtv_comdat_section): Likewise. * vec.h (struct vec_prefix): Likewise. * vmsdbgout.cc (full_name): Likewise. * vtable-verify.cc: Likewise. * vtable-verify.h (struct vtv_graph_node): Likewise. * xcoffout.cc: Likewise. * xcoffout.h (DEBUG_SYMS_TEXT): Likewise. gcc/ada/ChangeLog: * Make-generated.in: Rename .c names to .cc. * adaint.c: Likewise. * ctrl_c.c (dummy_handler): Likewise. * gcc-interface/Makefile.in: Likewise. * gcc-interface/config-lang.in: Likewise. * gcc-interface/decl.cc (concat_name): Likewise. (init_gnat_decl): Likewise. * gcc-interface/gigi.h (concat_name): Likewise. (init_gnat_utils): Likewise. (build_call_raise_range): Likewise. (gnat_mark_addressable): Likewise. (gnat_protect_expr): Likewise. (gnat_rewrite_reference): Likewise. * gcc-interface/lang-specs.h (ADA_DUMPS_OPTIONS): Likewise. * gcc-interface/utils.cc (GTY): Likewise. (add_deferred_type_context): Likewise. (init_gnat_utils): Likewise. * gcc-interface/utils2.cc (gnat_stable_expr_p): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Likewise. * gsocket.h: Likewise. * init.cc (__gnat_error_handler): Likewise. * libgnarl/s-intman.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-taskin.ads: Likewise. * rtfinal.cc: Likewise. * s-oscons-tmplt.c (CND): Likewise. * set_targ.ads: Likewise. gcc/analyzer/ChangeLog: * analyzer.cc (is_special_named_call_p): Rename .c names to .cc. (is_named_call_p): Likewise. * region-model-asm.cc (deterministic_p): Likewise. * region.cc (field_region::get_relative_concrete_offset): Likewise. * sm-malloc.cc (method_p): Likewise. * supergraph.cc (superedge::dump_dot): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename .c names to .cc. * c-ada-spec.h: Likewise. * c-common.cc (c_build_vec_convert): Likewise. (warning_candidate_p): Likewise. * c-common.h (enum rid): Likewise. (build_real_imag_expr): Likewise. (finish_label_address_expr): Likewise. (c_get_substring_location): Likewise. (c_build_bind_expr): Likewise. (conflict_marker_get_final_tok_kind): Likewise. (c_parse_error): Likewise. (check_missing_format_attribute): Likewise. (invalid_array_size_error): Likewise. (warn_for_multistatement_macros): Likewise. (build_attr_access_from_parms): Likewise. * c-cppbuiltin.cc (c_cpp_builtins): Likewise. * c-format.cc: Likewise. * c-gimplify.cc (c_gimplify_expr): Likewise. * c-indentation.h: Likewise. * c-objc.h (objc_prop_attr_kind_for_rid): Likewise. * c-omp.cc (c_omp_predetermined_mapping): Likewise. * c-opts.cc (c_common_post_options): Likewise. (set_std_cxx23): Likewise. * c-pragma.cc (handle_pragma_redefine_extname): Likewise. * c-pretty-print.h: Likewise. gcc/c/ChangeLog: * Make-lang.in: Rename .c names to .cc. * c-convert.cc: Likewise. * c-decl.cc (struct lang_identifier): Likewise. (pop_scope): Likewise. (finish_decl): Likewise. * c-objc-common.h (GCC_C_OBJC_COMMON): Likewise. * c-parser.cc (c_parser_skip_to_end_of_block_or_statement): Likewise. * c-parser.h (GCC_C_PARSER_H): Likewise. * c-tree.h (c_keyword_starts_typename): Likewise. (finish_declspecs): Likewise. (c_get_alias_set): Likewise. (enum c_oracle_request): Likewise. (tag_exists_p): Likewise. (set_c_expr_source_range): Likewise. * c-typeck.cc (c_common_type): Likewise. (c_finish_omp_clauses): Likewise. * config-lang.in: Likewise. gcc/cp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * constexpr.cc (cxx_eval_constant_expression): Likewise. * coroutines.cc (morph_fn_to_coro): Likewise. * cp-gimplify.cc (cp_gimplify_expr): Likewise. * cp-lang.cc (struct lang_hooks): Likewise. (get_template_argument_pack_elems_folded): Likewise. * cp-objcp-common.cc (cp_tree_size): Likewise. (cp_unit_size_without_reusable_padding): Likewise. (pop_file_scope): Likewise. (cp_pushdecl): Likewise. * cp-objcp-common.h (GCC_CP_OBJCP_COMMON): Likewise. (cxx_simulate_record_decl): Likewise. * cp-tree.h (struct named_label_entry): Likewise. (current_function_return_value): Likewise. (more_aggr_init_expr_args_p): Likewise. (get_function_version_dispatcher): Likewise. (common_enclosing_class): Likewise. (strip_fnptr_conv): Likewise. (current_decl_namespace): Likewise. (do_aggregate_paren_init): Likewise. (cp_check_const_attributes): Likewise. (qualified_name_lookup_error): Likewise. (generic_targs_for): Likewise. (mark_exp_read): Likewise. (is_global_friend): Likewise. (maybe_reject_flexarray_init): Likewise. (module_token_lang): Likewise. (handle_module_option): Likewise. (literal_integer_zerop): Likewise. (build_extra_args): Likewise. (build_if_nonnull): Likewise. (maybe_check_overriding_exception_spec): Likewise. (finish_omp_target_clauses): Likewise. (maybe_warn_zero_as_null_pointer_constant): Likewise. (cxx_print_error_function): Likewise. (decl_in_std_namespace_p): Likewise. (merge_exception_specifiers): Likewise. (mangle_module_global_init): Likewise. (cxx_block_may_fallthru): Likewise. (fold_builtin_source_location): Likewise. (enum cp_oracle_request): Likewise. (subsumes): Likewise. (cp_finish_injected_record_type): Likewise. (vtv_build_vtable_verify_fndecl): Likewise. (cp_tree_c_finish_parsing): Likewise. * cvt.cc (diagnose_ref_binding): Likewise. (convert_to_void): Likewise. (convert_force): Likewise. (type_promotes_to): Likewise. * decl.cc (make_unbound_class_template_raw): Likewise. (cxx_init_decl_processing): Likewise. (check_class_member_definition_namespace): Likewise. (cxx_maybe_build_cleanup): Likewise. * decl2.cc (maybe_emit_vtables): Likewise. * error.cc (dump_function_name): Likewise. * init.cc (is_class_type): Likewise. (build_new_1): Likewise. * lang-specs.h: Likewise. * method.cc (make_alias_for_thunk): Likewise. * module.cc (specialization_add): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (check_extern_c_conflict): Likewise. * name-lookup.h (struct cxx_binding): Likewise. * parser.cc (cp_parser_identifier): Likewise. * parser.h (struct cp_parser): Likewise. * pt.cc (has_value_dependent_address): Likewise. (push_tinst_level_loc): Likewise. * semantics.cc (finish_omp_clauses): Likewise. (finish_omp_atomic): Likewise. * tree.cc (cp_save_expr): Likewise. (cp_free_lang_data): Likewise. * typeck.cc (cp_common_type): Likewise. (strip_array_domain): Likewise. (rationalize_conditional_expr): Likewise. (check_return_expr): Likewise. * vtable-class-hierarchy.cc: Likewise. gcc/d/ChangeLog: * d-gimplify.cc: Rename .c names to .cc. * d-incpath.cc: Likewise. * lang-specs.h: Likewise. gcc/fortran/ChangeLog: * check.cc (gfc_check_all_any): Rename .c names to .cc. * class.cc (find_intrinsic_vtab): Likewise. * config-lang.in: Likewise. * cpp.cc (cpp_define_builtins): Likewise. * data.cc (get_array_index): Likewise. * decl.cc (match_clist_expr): Likewise. (get_proc_name): Likewise. (gfc_verify_c_interop_param): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_match_formal_arglist): Likewise. (gfc_get_type_attr_spec): Likewise. * dependency.cc: Likewise. * error.cc (gfc_format_decoder): Likewise. * expr.cc (check_restricted): Likewise. (gfc_build_default_init_expr): Likewise. * f95-lang.cc: Likewise. * gfc-internals.texi: Likewise. * gfortran.h (enum match): Likewise. (enum procedure_type): Likewise. (enum oacc_routine_lop): Likewise. (gfc_get_pdt_instance): Likewise. (gfc_end_source_files): Likewise. (gfc_mpz_set_hwi): Likewise. (gfc_get_option_string): Likewise. (gfc_find_sym_in_expr): Likewise. (gfc_errors_to_warnings): Likewise. (gfc_real_4_kind): Likewise. (gfc_free_finalizer): Likewise. (gfc_sym_get_dummy_args): Likewise. (gfc_check_intrinsic_standard): Likewise. (gfc_free_case_list): Likewise. (gfc_resolve_oacc_routines): Likewise. (gfc_check_vardef_context): Likewise. (gfc_free_association_list): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_ref_dimen_size): Likewise. (gfc_compare_actual_formal): Likewise. (gfc_resolve_wait): Likewise. (gfc_dt_upper_string): Likewise. (gfc_generate_module_code): Likewise. (gfc_delete_bbt): Likewise. (debug): Likewise. (gfc_build_block_ns): Likewise. (gfc_dep_difference): Likewise. (gfc_invalid_null_arg): Likewise. (gfc_is_finalizable): Likewise. (gfc_fix_implicit_pure): Likewise. (gfc_is_size_zero_array): Likewise. (gfc_is_reallocatable_lhs): Likewise. * gfortranspec.cc: Likewise. * interface.cc (compare_actual_expr): Likewise. * intrinsic.cc (add_functions): Likewise. * iresolve.cc (gfc_resolve_matmul): Likewise. (gfc_resolve_alarm_sub): Likewise. * iso-c-binding.def: Likewise. * lang-specs.h: Likewise. * libgfortran.h (GFC_STDERR_UNIT_NUMBER): Likewise. * match.cc (gfc_match_label): Likewise. (gfc_match_symbol): Likewise. (match_derived_type_spec): Likewise. (copy_ts_from_selector_to_associate): Likewise. * match.h (gfc_match_call): Likewise. (gfc_get_common): Likewise. (gfc_match_omp_end_single): Likewise. (gfc_match_volatile): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_literal_constant): Likewise. (gfc_match_init_expr): Likewise. (gfc_match_array_constructor): Likewise. (gfc_match_end_interface): Likewise. (gfc_match_print): Likewise. (gfc_match_expr): Likewise. * matchexp.cc (next_operator): Likewise. * mathbuiltins.def: Likewise. * module.cc (free_true_name): Likewise. * openmp.cc (gfc_resolve_omp_parallel_blocks): Likewise. (gfc_omp_save_and_clear_state): Likewise. * parse.cc (parse_union): Likewise. (set_syms_host_assoc): Likewise. * resolve.cc (resolve_actual_arglist): Likewise. (resolve_elemental_actual): Likewise. (check_host_association): Likewise. (resolve_typebound_function): Likewise. (resolve_typebound_subroutine): Likewise. (gfc_resolve_expr): Likewise. (resolve_assoc_var): Likewise. (resolve_typebound_procedures): Likewise. (resolve_equivalence_derived): Likewise. * simplify.cc (simplify_bound): Likewise. * symbol.cc (gfc_set_default_type): Likewise. (gfc_add_ext_attribute): Likewise. * target-memory.cc (gfc_target_interpret_expr): Likewise. * target-memory.h (gfc_target_interpret_expr): Likewise. * trans-array.cc (gfc_get_cfi_dim_sm): Likewise. (gfc_conv_shift_descriptor_lbound): Likewise. (gfc_could_be_alias): Likewise. (gfc_get_dataptr_offset): Likewise. * trans-const.cc: Likewise. * trans-decl.cc (trans_function_start): Likewise. (gfc_trans_deferred_vars): Likewise. (generate_local_decl): Likewise. (gfc_generate_function_code): Likewise. * trans-expr.cc (gfc_vptr_size_get): Likewise. (gfc_trans_class_array_init_assign): Likewise. (POWI_TABLE_SIZE): Likewise. (gfc_conv_procedure_call): Likewise. (gfc_trans_arrayfunc_assign): Likewise. * trans-intrinsic.cc (gfc_conv_intrinsic_len): Likewise. (gfc_conv_intrinsic_loc): Likewise. (conv_intrinsic_event_query): Likewise. * trans-io.cc (gfc_build_st_parameter): Likewise. * trans-openmp.cc (gfc_omp_check_optional_argument): Likewise. (gfc_omp_unshare_expr_r): Likewise. (gfc_trans_omp_array_section): Likewise. (gfc_trans_omp_clauses): Likewise. * trans-stmt.cc (trans_associate_var): Likewise. (gfc_trans_deallocate): Likewise. * trans-stmt.h (gfc_trans_class_init_assign): Likewise. (gfc_trans_deallocate): Likewise. (gfc_trans_oacc_declare): Likewise. * trans-types.cc: Likewise. * trans-types.h (enum gfc_packed): Likewise. * trans.cc (N_): Likewise. (trans_code): Likewise. * trans.h (gfc_build_compare_string): Likewise. (gfc_conv_expr_type): Likewise. (gfc_trans_deferred_vars): Likewise. (getdecls): Likewise. (gfc_get_array_descr_info): Likewise. (gfc_omp_firstprivatize_type_sizes): Likewise. (GTY): Likewise. gcc/go/ChangeLog: * config-lang.in: Rename .c names to .cc. * go-backend.cc: Likewise. * go-lang.cc: Likewise. * gospec.cc: Likewise. * lang-specs.h: Likewise. gcc/jit/ChangeLog: * config-lang.in: Rename .c names to .cc. * docs/_build/texinfo/libgccjit.texi: Likewise. * docs/internals/index.rst: Likewise. * jit-builtins.cc (builtins_manager::make_builtin_function): Likewise. * jit-playback.cc (fold_const_var): Likewise. (playback::context::~context): Likewise. (new_field): Likewise. (new_bitfield): Likewise. (new_compound_type): Likewise. (playback::compound_type::set_fields): Likewise. (global_set_init_rvalue): Likewise. (load_blob_in_ctor): Likewise. (new_global_initialized): Likewise. (double>): Likewise. (new_string_literal): Likewise. (as_truth_value): Likewise. (build_call): Likewise. (playback::context::build_cast): Likewise. (new_array_access): Likewise. (new_field_access): Likewise. (dereference): Likewise. (postprocess): Likewise. (add_jump): Likewise. (add_switch): Likewise. (build_goto_operands): Likewise. (playback::context::read_dump_file): Likewise. (init_types): Likewise. * jit-recording.cc (recording::context::get_int_type): Likewise. * jit-recording.h: Likewise. * libgccjit.cc (compatible_types): Likewise. (gcc_jit_context_acquire): Likewise. (gcc_jit_context_release): Likewise. (gcc_jit_context_new_child_context): Likewise. (gcc_jit_type_as_object): Likewise. (gcc_jit_context_get_type): Likewise. (gcc_jit_context_get_int_type): Likewise. (gcc_jit_type_get_pointer): Likewise. (gcc_jit_type_get_const): Likewise. (gcc_jit_type_get_volatile): Likewise. (gcc_jit_type_dyncast_array): Likewise. (gcc_jit_type_is_bool): Likewise. (gcc_jit_type_is_pointer): Likewise. (gcc_jit_type_is_integral): Likewise. (gcc_jit_type_dyncast_vector): Likewise. (gcc_jit_type_is_struct): Likewise. (gcc_jit_vector_type_get_num_units): Likewise. (gcc_jit_vector_type_get_element_type): Likewise. (gcc_jit_type_unqualified): Likewise. (gcc_jit_type_dyncast_function_ptr_type): Likewise. (gcc_jit_function_type_get_return_type): Likewise. (gcc_jit_function_type_get_param_count): Likewise. (gcc_jit_function_type_get_param_type): Likewise. (gcc_jit_context_new_array_type): Likewise. (gcc_jit_context_new_field): Likewise. (gcc_jit_field_as_object): Likewise. (gcc_jit_context_new_struct_type): Likewise. (gcc_jit_struct_as_type): Likewise. (gcc_jit_struct_set_fields): Likewise. (gcc_jit_struct_get_field_count): Likewise. (gcc_jit_context_new_union_type): Likewise. (gcc_jit_context_new_function_ptr_type): Likewise. (gcc_jit_param_as_rvalue): Likewise. (gcc_jit_context_new_function): Likewise. (gcc_jit_function_get_return_type): Likewise. (gcc_jit_function_dump_to_dot): Likewise. (gcc_jit_block_get_function): Likewise. (gcc_jit_global_set_initializer_rvalue): Likewise. (gcc_jit_rvalue_get_type): Likewise. (gcc_jit_context_new_rvalue_from_int): Likewise. (gcc_jit_context_one): Likewise. (gcc_jit_context_new_rvalue_from_double): Likewise. (gcc_jit_context_null): Likewise. (gcc_jit_context_new_string_literal): Likewise. (valid_binary_op_p): Likewise. (gcc_jit_context_new_binary_op): Likewise. (gcc_jit_context_new_comparison): Likewise. (gcc_jit_context_new_call): Likewise. (is_valid_cast): Likewise. (gcc_jit_context_new_cast): Likewise. (gcc_jit_object_get_context): Likewise. (gcc_jit_object_get_debug_string): Likewise. (gcc_jit_lvalue_access_field): Likewise. (gcc_jit_rvalue_access_field): Likewise. (gcc_jit_rvalue_dereference_field): Likewise. (gcc_jit_rvalue_dereference): Likewise. (gcc_jit_lvalue_get_address): Likewise. (gcc_jit_lvalue_set_tls_model): Likewise. (gcc_jit_lvalue_set_link_section): Likewise. (gcc_jit_function_new_local): Likewise. (gcc_jit_block_add_eval): Likewise. (gcc_jit_block_add_assignment): Likewise. (is_bool): Likewise. (gcc_jit_block_end_with_conditional): Likewise. (gcc_jit_block_add_comment): Likewise. (gcc_jit_block_end_with_jump): Likewise. (gcc_jit_block_end_with_return): Likewise. (gcc_jit_block_end_with_void_return): Likewise. (case_range_validator::case_range_validator): Likewise. (case_range_validator::validate): Likewise. (case_range_validator::get_wide_int): Likewise. (gcc_jit_block_end_with_switch): Likewise. (gcc_jit_context_set_str_option): Likewise. (gcc_jit_context_set_int_option): Likewise. (gcc_jit_context_set_bool_option): Likewise. (gcc_jit_context_set_bool_allow_unreachable_blocks): Likewise. (gcc_jit_context_set_bool_use_external_driver): Likewise. (gcc_jit_context_add_command_line_option): Likewise. (gcc_jit_context_add_driver_option): Likewise. (gcc_jit_context_enable_dump): Likewise. (gcc_jit_context_compile): Likewise. (gcc_jit_context_compile_to_file): Likewise. (gcc_jit_context_set_logfile): Likewise. (gcc_jit_context_dump_reproducer_to_file): Likewise. (gcc_jit_context_get_first_error): Likewise. (gcc_jit_context_get_last_error): Likewise. (gcc_jit_result_get_code): Likewise. (gcc_jit_result_get_global): Likewise. (gcc_jit_rvalue_set_bool_require_tail_call): Likewise. (gcc_jit_type_get_aligned): Likewise. (gcc_jit_type_get_vector): Likewise. (gcc_jit_function_get_address): Likewise. (gcc_jit_version_patchlevel): Likewise. (gcc_jit_block_add_extended_asm): Likewise. (gcc_jit_extended_asm_as_object): Likewise. (gcc_jit_extended_asm_set_volatile_flag): Likewise. (gcc_jit_extended_asm_set_inline_flag): Likewise. (gcc_jit_extended_asm_add_output_operand): Likewise. (gcc_jit_extended_asm_add_input_operand): Likewise. (gcc_jit_extended_asm_add_clobber): Likewise. * notes.txt: Likewise. gcc/lto/ChangeLog: * config-lang.in: Rename .c names to .cc. * lang-specs.h: Likewise. * lto-common.cc (gimple_register_canonical_type_1): Likewise. * lto-common.h: Likewise. * lto-dump.cc (lto_main): Likewise. * lto-lang.cc (handle_fnspec_attribute): Likewise. (lto_getdecls): Likewise. (lto_init): Likewise. * lto.cc (lto_main): Likewise. * lto.h: Likewise. gcc/objc/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objc-act.cc (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (lookup_method_in_hash_lists): Likewise. (objc_finish_foreach_loop): Likewise. * objc-act.h (objc_common_init_ts): Likewise. * objc-gnu-runtime-abi-01.cc: Likewise. * objc-lang.cc (struct lang_hooks): Likewise. * objc-map.cc: Likewise. * objc-next-runtime-abi-01.cc (generate_objc_symtab_decl): Likewise. * objc-runtime-shared-support.cc: Likewise. * objc-runtime-shared-support.h (build_protocol_initializer): Likewise. gcc/objcp/ChangeLog: * Make-lang.in: Rename .c names to .cc. * config-lang.in: Likewise. * lang-specs.h: Likewise. * objcp-decl.cc (objcp_end_compound_stmt): Likewise. * objcp-lang.cc (struct lang_hooks): Likewise. gcc/po/ChangeLog: * EXCLUDES: Rename .c names to .cc. libcpp/ChangeLog: * Makefile.in: Rename .c names to .cc. * charset.cc (convert_escape): Likewise. * directives.cc (directive_diagnostics): Likewise. (_cpp_handle_directive): Likewise. (lex_macro_node): Likewise. * include/cpplib.h (struct _cpp_file): Likewise. (PURE_ZERO): Likewise. (cpp_defined): Likewise. (cpp_error_at): Likewise. (cpp_forall_identifiers): Likewise. (cpp_compare_macros): Likewise. (cpp_get_converted_source): Likewise. (cpp_read_state): Likewise. (cpp_directive_only_process): Likewise. (struct cpp_decoded_char): Likewise. * include/line-map.h (enum lc_reason): Likewise. (enum location_aspect): Likewise. * include/mkdeps.h: Likewise. * init.cc (cpp_destroy): Likewise. (cpp_finish): Likewise. * internal.h (struct cpp_reader): Likewise. (_cpp_defined_macro_p): Likewise. (_cpp_backup_tokens_direct): Likewise. (_cpp_destroy_hashtable): Likewise. (_cpp_has_header): Likewise. (_cpp_expand_op_stack): Likewise. (_cpp_commit_buff): Likewise. (_cpp_restore_special_builtin): Likewise. (_cpp_bracket_include): Likewise. (_cpp_replacement_text_len): Likewise. (ufputs): Likewise. * line-map.cc (linemap_macro_loc_to_exp_point): Likewise. (linemap_check_files_exited): Likewise. (line_map_new_raw): Likewise. * traditional.cc (enum ls): Likewise.
2022-01-14 16:57:02 +01:00
"dumpfile.cc", expected_impl_line,
Fix missing dump_impl_location_t values, using a new dump_metadata_t 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-27 01:55:28 +01:00
"test_capture_of_dump_calls");
Add -fopt-info-internals 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-04 19:41:08 +02:00
}
}
Add "optinfo" framework 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-19 22:49:25 +02:00
}
/* Verify that MSG_* affects optinfo->get_kind (); we tested MSG_NOTE
above. */
{
/* MSG_OPTIMIZED_LOCATIONS. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (true, true, MSG_ALL_KINDS);
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, "test");
ASSERT_EQ (tmp.get_pending_optinfo ()->get_kind (),
OPTINFO_KIND_SUCCESS);
}
/* MSG_MISSED_OPTIMIZATION. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (true, true, MSG_ALL_KINDS);
Add "optinfo" framework 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-19 22:49:25 +02:00
dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc, "test");
ASSERT_EQ (tmp.get_pending_optinfo ()->get_kind (),
OPTINFO_KIND_FAILURE);
}
}
/* Verify that MSG_* affect AUTO_DUMP_SCOPE and the dump calls. */
{
Report vectorization problems via a new opt_problem class 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-04 19:50:52 +02:00
temp_dump_context tmp (false, true,
Add -fopt-info-internals 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-04 19:41:08 +02:00
MSG_OPTIMIZED_LOCATIONS | MSG_ALL_PRIORITIES);
dump_printf_loc (MSG_NOTE, stmt, "msg 1\n");
{
AUTO_DUMP_SCOPE ("outer scope", stmt);
dump_printf_loc (MSG_NOTE, stmt, "msg 2\n");
{
AUTO_DUMP_SCOPE ("middle scope", stmt);
dump_printf_loc (MSG_NOTE, stmt, "msg 3\n");
{
AUTO_DUMP_SCOPE ("inner scope", stmt);
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt, "msg 4\n");
}
dump_printf_loc (MSG_NOTE, stmt, "msg 5\n");
}
dump_printf_loc (MSG_NOTE, stmt, "msg 6\n");
}
dump_printf_loc (MSG_NOTE, stmt, "msg 7\n");
dumpfile.c: use prefixes other than 'note: ' for 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-28 19:40:04 +02:00
ASSERT_DUMPED_TEXT_EQ (tmp, "test.txt:5:10: optimized: msg 4\n");
}
Add "optinfo" framework 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-19 22:49:25 +02:00
}
Fix -fsave-optimization-record ICE (PR tree-optimization/87025) 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-19 17:42:03 +01:00
static void
test_pr87025 ()
{
dump_user_location_t loc
= dump_user_location_t::from_location_t (UNKNOWN_LOCATION);
temp_dump_context tmp (true, true,
MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
{
AUTO_DUMP_SCOPE ("outer scope", loc);
dump_printf (MSG_NOTE, "msg1\n");
}
}
Introduce dump_location_t 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-26 15:34:59 +02:00
/* Run all of the selftests within this file. */
void
Update per-file selftest and finalization hooks for .c to .cc renaming This is mostly a mechanical change, apart from: - fix the name of attribute_c_tests to match its filename (attribs.cc) - fix the name of opt_proposer_c to match its filename (opt-suggestions.cc) - delete a bogus "modref_c_tests" decl from ipa-modref-tree.h that's been present since the initial commit of that file (d119f34c952f8718fdbabc63e2f369a16e92fa07) gcc/ChangeLog: * attribs.cc (attribute_c_tests): Rename to... (attribs_cc_tests): ...this. * bitmap.cc (bitmap_c_tests): Rename to... (bitmap_cc_tests): ...this. * cgraph.cc (cgraph_c_finalize): Rename to... (cgraph_cc_finalize): ...this. (cgraph_c_tests): Rename to... (cgraph_cc_tests): ...this. * cgraph.h (cgraph_c_finalize): Rename to... (cgraph_cc_finalize): ...this. (cgraphunit_c_finalize): Rename to... (cgraphunit_cc_finalize): ...this. * cgraphunit.cc (cgraphunit_c_finalize): Rename to... (cgraphunit_cc_finalize): ...this. * convert.cc (convert_c_tests): Rename to... (convert_cc_tests): ...this. * dbgcnt.cc (dbgcnt_c_tests): Rename to... (dbgcnt_cc_tests): ...this. * diagnostic-show-locus.cc (diagnostic_show_locus_c_tests): Rename to... (diagnostic_show_locus_cc_tests): ...this. * diagnostic.cc (diagnostic_c_tests): Rename to... (diagnostic_cc_tests): ...this. * dumpfile.cc (dumpfile_c_tests): Rename to... (dumpfile_cc_tests): ...this. * dwarf2out.cc (dwarf2out_c_finalize): Rename to... (dwarf2out_cc_finalize): ...this. * dwarf2out.h (dwarf2out_c_finalize): Rename to... (dwarf2out_cc_finalize): ...this. * edit-context.cc (edit_context_c_tests): Rename to... (edit_context_cc_tests): ...this. * et-forest.cc (et_forest_c_tests): Rename to... (et_forest_cc_tests): ...this. * fibonacci_heap.cc (fibonacci_heap_c_tests): Rename to... (fibonacci_heap_cc_tests): ...this. * fold-const.cc (fold_const_c_tests): Rename to... (fold_const_cc_tests): ...this. * function-tests.cc (function_tests_c_tests): Rename to... (function_tests_cc_tests): ...this. * gcse.cc (gcse_c_finalize): Rename to... (gcse_cc_finalize): ...this. * gcse.h (gcse_c_finalize): Rename to... (gcse_cc_finalize): ...this. * ggc-tests.cc (ggc_tests_c_tests): Rename to... (ggc_tests_cc_tests): ...this. * gimple-ssa-store-merging.cc (store_merging_c_tests): Rename to... (store_merging_cc_tests): ...this. * gimple.cc (gimple_c_tests): Rename to... (gimple_cc_tests): ...this. * hash-map-tests.cc (hash_map_tests_c_tests): Rename to... (hash_map_tests_cc_tests): ...this. * hash-set-tests.cc (hash_set_tests_c_tests): Rename to... (hash_set_tests_cc_tests): ...this. * input.cc (input_c_tests): Rename to... (input_cc_tests): ...this. * ipa-cp.cc (ipa_cp_c_finalize): Rename to... (ipa_cp_cc_finalize): ...this. * ipa-fnsummary.cc (ipa_fnsummary_c_finalize): Rename to... (ipa_fnsummary_cc_finalize): ...this. * ipa-fnsummary.h (ipa_fnsummary_c_finalize): Rename to... (ipa_fnsummary_cc_finalize): ...this. * ipa-modref-tree.cc (ipa_modref_tree_c_tests): Rename to... (ipa_modref_tree_cc_tests): ...this. * ipa-modref-tree.h (modref_c_tests): Delete bogus decl. * ipa-modref.cc (ipa_modref_c_finalize): Rename to... (ipa_modref_cc_finalize): ...this. * ipa-modref.h (ipa_modref_c_finalize): Rename to... (ipa_modref_cc_finalize): ...this. * ipa-prop.h (ipa_cp_c_finalize): Rename to... (ipa_cp_cc_finalize): ...this. * ipa-reference.cc (ipa_reference_c_finalize): Rename to... (ipa_reference_cc_finalize): ...this. * ipa-reference.h (ipa_reference_c_finalize): Rename to... (ipa_reference_cc_finalize): ...this. * ira-costs.cc (ira_costs_c_finalize): Rename to... (ira_costs_cc_finalize): ...this. * ira.h (ira_costs_c_finalize): Rename to... (ira_costs_cc_finalize): ...this. * opt-suggestions.cc (opt_proposer_c_tests): Rename to... (opt_suggestions_cc_tests): ...this. * opts.cc (opts_c_tests): Rename to... (opts_cc_tests): ...this. * predict.cc (predict_c_tests): Rename to... (predict_cc_tests): ...this. * pretty-print.cc (pretty_print_c_tests): Rename to... (pretty_print_cc_tests): ...this. * read-rtl-function.cc (read_rtl_function_c_tests): Rename to... (read_rtl_function_cc_tests): ...this. * rtl-tests.cc (rtl_tests_c_tests): Rename to... (rtl_tests_cc_tests): ...this. * sbitmap.cc (sbitmap_c_tests): Rename to... (sbitmap_cc_tests): ...this. * selftest-run-tests.cc (selftest::run_tests): Update calls for _c_ to _cc_ function renamings; fix names of attribs and opt-suggestions tests. * selftest.cc (selftest_c_tests): Rename to... (selftest_cc_tests): ...this. * selftest.h (attribute_c_tests): Rename to... (attribs_cc_tests): ...this. (bitmap_c_tests): Rename to... (bitmap_cc_tests): ...this. (cgraph_c_tests): Rename to... (cgraph_cc_tests): ...this. (convert_c_tests): Rename to... (convert_cc_tests): ...this. (diagnostic_c_tests): Rename to... (diagnostic_cc_tests): ...this. (diagnostic_show_locus_c_tests): Rename to... (diagnostic_show_locus_cc_tests): ...this. (dumpfile_c_tests): Rename to... (dumpfile_cc_tests): ...this. (edit_context_c_tests): Rename to... (edit_context_cc_tests): ...this. (et_forest_c_tests): Rename to... (et_forest_cc_tests): ...this. (fibonacci_heap_c_tests): Rename to... (fibonacci_heap_cc_tests): ...this. (fold_const_c_tests): Rename to... (fold_const_cc_tests): ...this. (function_tests_c_tests): Rename to... (function_tests_cc_tests): ...this. (ggc_tests_c_tests): Rename to... (ggc_tests_cc_tests): ...this. (gimple_c_tests): Rename to... (gimple_cc_tests): ...this. (hash_map_tests_c_tests): Rename to... (hash_map_tests_cc_tests): ...this. (hash_set_tests_c_tests): Rename to... (hash_set_tests_cc_tests): ...this. (input_c_tests): Rename to... (input_cc_tests): ...this. (opts_c_tests): Rename to... (opts_cc_tests): ...this. (predict_c_tests): Rename to... (predict_cc_tests): ...this. (pretty_print_c_tests): Rename to... (pretty_print_cc_tests): ...this. (read_rtl_function_c_tests): Rename to... (read_rtl_function_cc_tests): ...this. (rtl_tests_c_tests): Rename to... (rtl_tests_cc_tests): ...this. (sbitmap_c_tests): Rename to... (sbitmap_cc_tests): ...this. (selftest_c_tests): Rename to... (selftest_cc_tests): ...this. (simplify_rtx_c_tests): Rename to... (simplify_rtx_cc_tests): ...this. (spellcheck_c_tests): Rename to... (spellcheck_cc_tests): ...this. (spellcheck_tree_c_tests): Rename to... (spellcheck_tree_cc_tests): ...this. (sreal_c_tests): Rename to... (sreal_cc_tests): ...this. (store_merging_c_tests): Rename to... (store_merging_cc_tests): ...this. (tree_c_tests): Rename to... (tree_cc_tests): ...this. (tree_cfg_c_tests): Rename to... (tree_cfg_cc_tests): ...this. (typed_splay_tree_c_tests): Rename to... (typed_splay_tree_cc_tests): ...this. (vec_c_tests): Rename to... (vec_cc_tests): ...this. (vec_perm_indices_c_tests): Rename to... (vec_perm_indices_cc_tests): ..this. (opt_proposer_c_tests): Rename to... (opt_suggestions_cc_tests): ...this. (dbgcnt_c_tests): Rename to... (dbgcnt_cc_tests): ...this. (ipa_modref_tree_c_tests): Rename to... (ipa_modref_tree_cc_tests): ...this. * simplify-rtx.cc (simplify_rtx_c_tests): Rename to... (simplify_rtx_cc_tests): ...this. * spellcheck-tree.cc (spellcheck_tree_c_tests): Rename to... (spellcheck_tree_cc_tests): ...this. * spellcheck.cc (spellcheck_c_tests): Rename to... (spellcheck_cc_tests): ...this. * sreal.cc (sreal_c_tests): Rename to... (sreal_cc_tests): ...this. * toplev.cc (toplev::finalize): Update calls for _c_ to _cc_ function renamings. * tree-cfg.cc (tree_cfg_c_tests): Rename to... (tree_cfg_cc_tests): ...this. * tree.cc (tree_c_tests): Rename to... (tree_cc_tests): ...this. * typed-splay-tree.cc (typed_splay_tree_c_tests): Rename to... (typed_splay_tree_cc_tests): ...this. * vec-perm-indices.cc (vec_perm_indices_c_tests): Rename to... (vec_perm_indices_cc_tests): ...this. * vec.cc (vec_c_tests): Rename to... (vec_cc_tests): ...this. gcc/c-family/ChangeLog: * c-common.cc (c_common_c_tests): Rename to... (c_common_cc_tests): ...this. (c_family_tests): Update calls for .c to .cc renaming. * c-common.h (c_format_c_tests): Rename to... (c_format_cc_tests): ...this. (c_indentation_c_tests): Rename to... (c_indentation_cc_tests): ...this. (c_pretty_print_c_tests): Rename to... (c_pretty_print_cc_tests): ...this. * c-format.cc (c_format_c_tests): Rename to... (c_format_cc_tests): ...this. * c-indentation.cc (c_indentation_c_tests): Rename to... (c_indentation_cc_tests): ...this. * c-pretty-print.cc (c_pretty_print_c_tests): Rename to... (c_pretty_print_cc_tests): ...this. gcc/cp/ChangeLog: * cp-lang.cc (selftest::run_cp_tests): Update calls for .c to .cc renaming. * cp-tree.h (cp_pt_c_tests): Rename to... (cp_pt_cc_tests): ...this. (cp_tree_c_tests): Rename to... (cp_tree_cc_tests): ...this. * pt.cc (cp_pt_c_tests): Rename to... (cp_pt_cc_tests): ...this. * tree.cc (cp_tree_c_tests): Rename to... (cp_tree_cc_tests): ...this. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-01-18 20:36:27 +01:00
dumpfile_cc_tests ()
Introduce dump_location_t 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-26 15:34:59 +02:00
{
test_impl_location ();
Add "optinfo" framework 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-19 22:49:25 +02:00
for_each_line_table_case (test_capture_of_dump_calls);
Fix -fsave-optimization-record ICE (PR tree-optimization/87025) 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-19 17:42:03 +01:00
test_pr87025 ();
Introduce dump_location_t 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-26 15:34:59 +02:00
}
} // namespace selftest
#endif /* CHECKING_P */