aboutsummaryrefslogtreecommitdiff
path: root/gcc/dump-context.h
AgeCommit message (Collapse)AuthorFilesLines
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-07-09PR c++/61339 - add mismatch between struct and class [-Wmismatched-tags] to ↵Martin Sebor1-1/+2
non-bugs gcc/c/ChangeLog: PR c++/61339 * c-decl.c: Change class-key from class to struct and vice versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. * gimple-parser.c: Same. gcc/c-family/ChangeLog: PR c++/61339 * c-format.c (check_argument_type): Change class-key from class to struct and vice versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. * c-pretty-print.h: Same. gcc/cp/ChangeLog: PR c++/61339 * constexpr.c (cxx_eval_call_expression): Change class-key from class to struct and vice versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. * constraint.cc (get_concept_definition): Same. * cp-tree.h: Same. * cxx-pretty-print.h: Same. * error.c: Same. * logic.cc (term_list::replace): Same. * name-lookup.c (find_local_binding): Same. * pt.c (tsubst_binary_right_fold): Same. * search.c (field_accessor_p): Same. * semantics.c (expand_or_defer_fn): Same. gcc/lto/ChangeLog: PR c++/61339 * lto-dump.c: Change class-key from classi to struct and vice versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. gcc/ChangeLog: PR c++/61339 * align.h: Change class-key from class to struct and vice versa to match convention and avoid -Wclass-is-pod and -Wstruct-no-pod. * alloc-pool.h: Same. * asan.c (shadow_mem_size): Same. * auto-profile.c: Same. * basic-block.h: Same. * bitmap.h: Same. * cfgexpand.c (set_rtl): Same. (expand_one_stack_var_at): Same. * cfghooks.h: Same. * cfgloop.h: Same. * cgraph.h: Same. * config/i386/i386.h: Same. * df-problems.c (df_print_bb_index): Same. * df-scan.c: Same. * df.h (df_single_use): Same. * diagnostic-show-locus.c (layout::print_annotation_line): Same. (layout::annotation_line_showed_range_p): Same. (get_printed_columns): Same. (correction::ensure_terminated): Same. (line_corrections::~line_corrections): Same. * dojump.h: Same. * dse.c: Same. * dump-context.h: Same. * dumpfile.h: Same. * dwarf2out.c: Same. * edit-context.c: Same. * fibonacci_heap.c (test_union_of_equal_heaps): Same. * flags.h: Same. * function.c (assign_stack_local): Same. * function.h: Same. * gcc.c: Same. * gcov.c (block_info::block_info): Same. * genattrtab.c: Same. * genextract.c: Same. * genmatch.c (comparison_code_p): Same. (id_base::id_base): Same. (decision_tree::print): Same. * genoutput.c: Same. * genpreds.c (write_one_predicate_function): Same. * genrecog.c (validate_pattern): Same. (find_operand_positions): Same. (optimize_subroutine_group): Same. (merge_pattern_transition::merge_pattern_transition): Same. (merge_pattern_info::merge_pattern_info): Same. (merge_state_result::merge_state_result): Same. (merge_into_state): Same. * gensupport.c: Same. * gensupport.h: Same. * ggc-common.c (init_ggc_heuristics): Same. * ggc-tests.c (test_union): Same. * gimple-loop-interchange.cc (dump_induction): Same. * gimple-loop-versioning.cc: Same. * gimple-match.h (gimple_match_cond::any_else): Same. * gimple-ssa-backprop.c: Same. * gimple-ssa-sprintf.c: Same. * gimple-ssa-store-merging.c (store_operand_info::store_operand_info): Same. (store_immediate_info::store_immediate_info): Same. (merged_store_group::apply_stores): Same. (get_location_for_stmts): Same. * gimple-ssa-strength-reduction.c: Same. * gimple-ssa-warn-alloca.c: Same. * gimple-ssa-warn-restrict.c (pass_wrestrict::execute): Same. * godump.c (go_type_decl): Same. * hash-map-tests.c (test_map_of_strings_to_int): Same. * hash-map.h: Same. * hash-set-tests.c (test_set_of_strings): Same. * hsa-brig.c: Same. * hsa-common.h: Same. * hsa-gen.c (transformable_switch_to_sbr_p): Same. * input.c (assert_loceq): Same. * input.h: Same. * ipa-cp.c: Same. * ipa-devirt.c (possible_polymorphic_call_targets_1): Same. * ipa-fnsummary.h: Same. * ipa-inline.h: Same. * ipa-prop.h: Same. * ipa-split.c (visit_bb): Same. * ira-int.h (minmax_set_iter_next): Same. * loop-invariant.c: Same. * loop-iv.c: Same. * lra-eliminations.c: Same. * lra-int.h: Same. * lra-lives.c (mark_regno_dead): Same. * lra-remat.c: Same. * lra-spills.c: Same. * lto-streamer.h: Same. * mem-stats.h: Same. * omp-grid.c (omp_grid_lastprivate_predicate): Same. * omp-low.c (omp_clause_aligned_alignment): Same. * optabs-query.h (get_vcond_eq_icode): Same. * optabs.h: Same. * opts.c (wrap_help): Same. * poly-int.h: Same. * predict.c (predict_paths_leading_to_edge): Same. * pretty-print.h: Same. * profile-count.h: Same. * read-md.h: Same. * read-rtl-function.c: Same. * ree.c: Same. * reginfo.c: Same. * regrename.c: Same. * regrename.h: Same. * reload.h: Same. * rtl-iter.h: Same. * rtl.h (costs_add_n_insns): Same. * sanopt.c: Same. * sched-int.h: Same. * sel-sched-ir.h: Same. * selftest.h: Same. * sese.h (vec_find): Same. * stmt.c: Same. * target-globals.h: Same. * tree-affine.c (aff_combination_find_elt): Same. * tree-affine.h: Same. * tree-data-ref.h: Same. * tree-outof-ssa.c (ssa_is_replaceable_p): Same. * tree-predcom.c: Same. * tree-scalar-evolution.c (find_var_scev_info): Same. * tree-ssa-alias.h: Same. * tree-ssa-ccp.c: Same. * tree-ssa-coalesce.c (ssa_conflicts_dump): Same. * tree-ssa-loop-im.c (for_all_locs_in_loop): Same. (rewrite_mem_refs): Same. (execute_sm_if_changed): Same. (hoist_memory_references): Same. * tree-ssa-loop-ivopts.c (operator<=): Same. * tree-ssa-loop.h: Same. * tree-ssa-pre.c (get_or_alloc_expr_for_name): Same. * tree-ssa-structalias.c: Same. * tree-switch-conversion.h (cluster::cluster): Same. (simple_cluster::simple_cluster): Same. * tree-vect-patterns.c (type_conversion_p): Same. * tree-vectorizer.c (dump_stmt_cost): Same. * tree-vectorizer.h (loop_vec_info_for_loop): Same. * tree.c (protected_set_expr_location): Same. * tree.h (desired_pro_or_demotion_p): Same. (fndecl_built_in_p): Same. * unique-ptr-tests.cc: Same. * var-tracking.c (delete_variable_part): Same. * varasm.c (assemble_real): Same. (tree_output_constant_def): Same. * vec.c: Same. * wide-int-bitmask.h: Same. * wide-int.h (decompose): Same. From-SVN: r273308
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-11-27Fix missing dump_impl_location_t values, using a new dump_metadata_tDavid Malcolm1-21/+28
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-19Eliminate global state from -fsave-optimization-recordDavid Malcolm1-6/+16
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-08dump_printf: add "%C" for dumping cgraph_node *David Malcolm1-0/+8
This patch implements support for %C in dump_printf for dumping cgraph_node *. (I would have preferred to have a code for printing symtab_node * and both subclasses, but there doesn't seem to be a good way for -Wformat to handle inheritance, so, failing that, I went with this approach). gcc/c-family/ChangeLog: * c-format.c (local_cgraph_node_ptr_node): New variable. (gcc_dump_printf_char_table): Add entry for %C. (get_pointer_to_named_type): New function, taken from the handling code for "gimple *" from... (init_dynamic_diag_info): ...here. Add handling for "cgraph_node *". * c-format.h (T_CGRAPH_NODE): New. gcc/ChangeLog: * dump-context.h (ASSERT_IS_CGRAPH_NODE): New macro. * dumpfile.c (make_item_for_dump_cgraph_node): Move to before... (dump_pretty_printer::decode_format): Implement "%C" for cgraph_node *. (selftest::test_capture_of_dump_calls): Rename "where" to "stmt_loc". Convert test_decl to a function decl and set its location. Add a symbol_table_test RAII instance and a cgraph_node, using it to test "%C" and dump_symtab_node. gcc/testsuite/ChangeLog: * gcc.dg/format/gcc_diag-10.c (cgraph_node): New typedef. (test_dump): Add testing of %C. From-SVN: r265918
2018-10-04Report vectorization problems via a new opt_problem classDavid Malcolm1-1/+103
This is v3 of the patch; previous versions were: v2: https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00446.html v1: https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01462.html This patch introduces a class opt_problem, along with wrapper classes for bool (opt_result) and for pointers (e.g. opt_loop_vec_info for loop_vec_info). opt_problem instances are created when an optimization problem is encountered, but only if dump_enabled_p. They are manually propagated up the callstack, and are manually reported at the "top level" of an optimization if dumping is enabled, to give the user a concise summary of the problem *after* the failure is reported. In particular, the location of the problematic statement is captured and emitted, rather than just the loop's location. For example: no-vfa-vect-102.c:24:3: missed: couldn't vectorize loop no-vfa-vect-102.c:27:7: missed: statement clobbers memory: __asm__ __volatile__("" : : : "memory"); Changed in v3: * This version bootstraps and passes regression testing (on x86_64-pc-linux-gnu). * added selftests, to exercise the opt_problem machinery * removed the "bool to opt_result" ctor, so that attempts to use e.g. return a bool from an opt_result-returning function will fail at compile time * use formatted printing within opt_problem ctor to replace the various dump_printf_loc calls * dropped i18n * changed the sense of vect_analyze_data_ref_dependence's return value (see the ChangeLog) * add MSG_PRIORITY_REEMITTED, so that -fopt-info can show the messages, without them messing up the counts in scan-tree-dump-times in DejaGnu tests gcc/ChangeLog: * Makefile.in (OBJS): Add opt-problem.o. * dump-context.h: Include "selftest.h. (selftest::temp_dump_context): New forward decl. (class dump_context): Make friend of class selftest::temp_dump_context. (dump_context::dump_loc_immediate): New decl. (class dump_pretty_printer): Move here from dumpfile.c. (class temp_dump_context): Move to namespace selftest. (temp_dump_context::temp_dump_context): Add param "forcibly_enable_dumping". (selftest::verify_dumped_text): (ASSERT_DUMPED_TEXT_EQ): Move here from dumpfile.c. (selftest::verify_item): (ASSERT_IS_TEXT): Move here from dumpfile.c. (ASSERT_IS_TREE): Likewise. (ASSERT_IS_GIMPLE): Likewise. * dumpfile.c (dump_context::dump_loc): Move immediate dumping to... (dump_context::dump_loc_immediate): ...this new function. (class dump_pretty_printer): Move to dump-context.h. (dump_switch_p_1): Don't enable MSG_PRIORITY_REEMITTED. (opt_info_switch_p_1): Enable MSG_PRIORITY_REEMITTED. (temp_dump_context::temp_dump_context): Move to "selftest" namespace. Add param "forcibly_enable_dumping", and use it to conditionalize the use of m_pp; (selftest::verify_dumped_text): Make non-static. (ASSERT_DUMPED_TEXT_EQ): Move to dump-context.h. (selftest::verify_item): Make non-static. (ASSERT_IS_TEXT): Move to dump-context.h. (ASSERT_IS_TREE): Likewise. (ASSERT_IS_GIMPLE): Likewise. (selftest::test_capture_of_dump_calls): Pass "true" for new param of temp_dump_context. * dumpfile.h (enum dump_flag): Add MSG_PRIORITY_REEMITTED, adding it to MSG_ALL_PRIORITIES. Update values of TDF_COMPARE_DEBUG and TDF_COMPARE_DEBUG. * opt-problem.cc: New file. * opt-problem.h: New file. * optinfo-emit-json.cc (selftest::test_building_json_from_dump_calls): Pass "true" for new param of temp_dump_context. * optinfo.cc (optinfo_kind_to_dump_flag): New function. (optinfo::emit_for_opt_problem): New function. (optinfo::emit): Clarity which emit_item is used. * optinfo.h (optinfo::get_dump_location): New accessor. (optinfo::emit_for_opt_problem): New decl. (optinfo::emit): Make const. * selftest-run-tests.c (selftest::run_tests): Call selftest::opt_problem_cc_tests. * selftest.h (selftest::opt_problem_cc_tests): New decl. * tree-data-ref.c (dr_analyze_innermost): Convert return type from bool to opt_result, converting fprintf messages to opt_result::failure_at calls. Add "stmt" param for use by the failure_at calls. (create_data_ref): Pass "stmt" to the dr_analyze_innermost call. (runtime_alias_check_p): Convert return type from bool to opt_result, converting dump_printf calls to opt_result::failure_at, using the statement DDR_A for their location. (find_data_references_in_stmt): Convert return type from bool to opt_result, converting "return false" to opt_result::failure_at with a new message. * tree-data-ref.h: Include "opt-problem.h". (dr_analyze_innermost): Convert return type from bool to opt_result, and add a const gimple * param. (find_data_references_in_stmt): Convert return type from bool to opt_result. (runtime_alias_check_p): Likewise. * tree-predcom.c (find_looparound_phi): Pass "init_stmt" to dr_analyze_innermost. * tree-vect-data-refs.c (vect_mark_for_runtime_alias_test): Convert return type from bool to opt_result, adding a message for the PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS zero case. (vect_analyze_data_ref_dependence): Convert return type from bool to opt_result. Change sense of return type from "false" effectively meaning "no problems" to "false" meaning a problem, so that "return false" becomes "return opt_result::success". Convert "return true" calls to opt_result::failure_at, using the location of statement A rather than vect_location. (vect_analyze_data_ref_dependences): Convert return type from bool to opt_result. (verify_data_ref_alignment): Likewise, converting dump_printf_loc calls to opt_result::failure_at, using the stmt location rather than vect_location. (vect_verify_datarefs_alignment): Convert return type from bool to opt_result. (vect_enhance_data_refs_alignment): Likewise. Split local "stat" into multiple more-tightly-scoped copies. (vect_analyze_data_refs_alignment): Convert return type from bool to opt_result. (vect_analyze_data_ref_accesses): Likewise, converting a "return false" to a "return opt_result::failure_at", adding a new message. (vect_prune_runtime_alias_test_list): Convert return type from bool to opt_result, converting dump_printf_loc to opt_result::failure_at. Add a %G to show the pertinent statement, and use the stmt's location rather than vect_location. (vect_find_stmt_data_reference): Convert return type from bool to opt_result, converting dump_printf_loc to opt_result::failure_at, using stmt's location. (vect_analyze_data_refs): Convert return type from bool to opt_result. Convert "return false" to "return opt_result::failure_at", adding messages as needed. * tree-vect-loop.c (vect_determine_vf_for_stmt_1): Convert return type from bool to opt_result. (vect_determine_vf_for_stmt): Likewise. (vect_determine_vectorization_factor): Likewise, converting dump_printf_loc to opt_result::failure_at, using location of phi rather than vect_location. (vect_analyze_loop_form_1): Convert return type from bool to opt_result, converting dump_printf_loc calls, retaining the use of vect_location. (vect_analyze_loop_form): Convert return type from loop_vec_info to opt_loop_vec_info. (vect_analyze_loop_operations): Convert return type from bool to opt_result, converting dump_printf_loc calls, using the location of phi/stmt rather than vect_location where available. Convert various "return false" to "return opt_result::failure_at" with "unsupported phi" messages. (vect_get_datarefs_in_loop): Convert return type from bool to opt_result. Add a message for the PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS failure. (vect_analyze_loop_2): Convert return type from bool to opt_result. Ensure "ok" is set to a opt_result::failure_at before each "goto again;", adding new messages where needed. Add "unsupported grouped {store|load}" messages. (vect_analyze_loop): Convert return type from loop_vec_info to opt_loop_vec_info. * tree-vect-slp.c (vect_analyze_slp): Convert return type from bool to opt_result. * tree-vect-stmts.c (process_use): Likewise, converting dump_printf_loc call and using stmt location, rather than vect_location. (vect_mark_stmts_to_be_vectorized): Likeise. (vect_analyze_stmt): Likewise, adding a %G. (vect_get_vector_types_for_stmt): Convert return type from bool to opt_result, converting dump_printf_loc calls and using stmt location, rather than vect_location. (vect_get_mask_type_for_stmt): Convert return type from tree to opt_tree, converting dump_printf_loc calls and using stmt location. * tree-vectorizer.c: Include "opt-problem.h. (try_vectorize_loop_1): Flag "Analyzing loop at" dump message as MSG_PRIORITY_INTERNALS. Convert local "loop_vinfo" from loop_vec_info to opt_loop_vec_info. If if fails, and dumping is enabled, use it to report at the top level "couldn't vectorize loop" followed by the problem. * tree-vectorizer.h (opt_loop_vec_info): New typedef. (vect_mark_stmts_to_be_vectorized): Convert return type from bool to opt_result. (vect_analyze_stmt): Likewise. (vect_get_vector_types_for_stmt): Likewise. (tree vect_get_mask_type_for_stmt): Likewise. (vect_analyze_data_ref_dependences): Likewise. (vect_enhance_data_refs_alignment): Likewise. (vect_analyze_data_refs_alignment): Likewise. (vect_verify_datarefs_alignment): Likewise. (vect_analyze_data_ref_accesses): Likewise. (vect_prune_runtime_alias_test_list): Likewise. (vect_find_stmt_data_reference): Likewise. (vect_analyze_data_refs): Likewise. (vect_analyze_loop): Convert return type from loop_vec_info to opt_loop_vec_info. (vect_analyze_loop_form): Likewise. (vect_analyze_slp): Convert return type from bool to opt_result. gcc/testsuite/ChangeLog: * gcc.dg/vect/nodump-vect-opt-info-2.c: New test. * gcc.dg/vect/vect-alias-check-4.c: Add "-fopt-info-vec-all" to dg-additional-options. Add dg-message and dg-missed directives to verify that -fopt-info messages are written at the correct locations. From-SVN: r264852
2018-10-04Add -fopt-info-internalsDavid Malcolm1-0/+2
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-09-25Remove unused functions and fields.Martin Liska1-1/+0
2018-09-25 Martin Liska <mliska@suse.cz> * alias.c (set_dest_equal_p): Remove unused function. * config/i386/i386.c (def_builtin_pure2): Likewise. * diagnostic-show-locus.c (class layout): Remove unused field. (layout::layout): Likewise here. * dump-context.h (class temp_dump_context): Likewise. * dwarf2out.c (add_AT_fde_ref): Remove unused function. (add_AT_loclistsptr): Likewise. (add_AT_offset): Likewise. (get_AT_hi_pc): Likewise. (is_comdat_die): Likewise. (type_is_enum): Likewise. (ceiling): Likewise. (add_AT_vms_delta): Likewise. (is_class_die): Likewise. * edit-context.c (class line_event): Remove unused field. * graphite-sese-to-poly.c (tree_int_to_gmp): Remove unused function. * ipa-cp.c (ipa_get_vr_lat): Likewise. * lra-constraints.c (ok_for_index_p_nonstrict): Likewise. (ok_for_base_p_nonstrict): Likewise. * tree-chrec.c (is_not_constant_evolution): Likewise. (chrec_fold_poly_cst): Likewise. * tree-if-conv.c (has_pred_critical_p): Likewise. * tree-ssa-coalesce.c (print_exprs): Likewise. * tree-ssa-pre.c (bitmap_set_contains_expr): Likewise. * tree-ssa-uninit.c (is_and_or_or_p): Likewise. * tree-vrp.c (value_ranges_intersect_p): Likewise. (value_range_nonnegative_p): Likewise. 2018-09-25 Martin Liska <mliska@suse.cz> * name-lookup.c (namespace_scope_ht_size): Remove unused function. * parser.c (cp_lexer_next_token_is_not_keyword): Likewise. 2018-09-25 Martin Liska <mliska@suse.cz> * trans.c (remove_suffix): Remove unused function. 2018-09-25 Martin Liska <mliska@suse.cz> * gofrontend/escape.cc (Gogo::analyze_escape): Remove usage of a parameter. (Gogo::assign_connectivity): Likewise. (class Escape_analysis_tag): Likewise. (Gogo::tag_function): Likewise. * gofrontend/expressions.cc (Call_expression::do_type): Likewise. * gofrontend/gogo.h (class Gogo): Likewise. * gofrontend/types.cc (class Call_multiple_result_type): Likewise. (Type::make_call_multiple_result_type): Likewise. * gofrontend/types.h (class Type): Likewise. * gofrontend/wb.cc (class Check_escape): Likewise. (Gogo::add_write_barriers): Likewise. From-SVN: r264561
2018-08-17Formatted printing for dump_* in the middle-endDavid Malcolm1-3/+4
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-07-31dumpfile.c: eliminate special-casing of dump_file/alt_dump_fileDavid Malcolm1-1/+15
With the addition of optinfo, the various dump_* calls had three parts: - optionally print to dump_file - optionally print to alt_dump_file - optionally make an optinfo_item and add it to the pending optinfo, creating it for dump_*_loc calls. However, this split makes it difficult to implement the formatted dumps later in patch kit, so as enabling work towards that, this patch removes the above split, so that all dumping within the dump_* API goes through optinfo_item. In order to ensure that the dumps to dump_file and alt_dump_file are processed immediately (rather than being buffered within the pending optinfo for consolidation), this patch introduces the idea of "immediate" optinfo_item destinations vs "non-immediate" destinations. The patch also adds selftest coverage of what's printed, and of scopes. This adds two allocations per dump_* call when dumping is enabled. I'm assuming that this isn't a problem, as dump_enabled_p is normally false. There are ways of optimizing it if it is an issue (by making optinfo_item instances become temporaries that borrow the underlying buffer), but they require nontrivial changes, so I'd prefer to leave that for another patch kit, if it becomes necessary. gcc/ChangeLog: * dump-context.h: Include "pretty-print.h". (dump_context::refresh_dumps_are_enabled): New decl. (dump_context::emit_item): New decl. (class dump_context): Add fields "m_test_pp" and "m_test_pp_flags". (temp_dump_context::temp_dump_context): Add param "test_pp_flags". (temp_dump_context::get_dumped_text): New decl. (class temp_dump_context): Add field "m_pp". * dumpfile.c (refresh_dumps_are_enabled): Convert to... (dump_context::refresh_dumps_are_enabled): ...and add a test for m_test_pp. (set_dump_file): Update for above change. (set_alt_dump_file): Likewise. (dump_loc): New overload, taking a pretty_printer *. (dump_context::dump_loc): Call end_any_optinfo. Dump the location to any test pretty-printer. (make_item_for_dump_gimple_stmt): New function, adapted from optinfo::add_gimple_stmt. (dump_context::dump_gimple_stmt): Call it, and use the result, eliminating the direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (make_item_for_dump_gimple_expr): New function, adapted from optinfo::add_gimple_expr. (dump_context::dump_gimple_expr): Call it, and use the result, eliminating the direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (make_item_for_dump_generic_expr): New function, adapted from optinfo::add_tree. (dump_context::dump_generic_expr): Call it, and use the result, eliminating the direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (make_item_for_dump_printf_va): New function, adapted from optinfo::add_printf_va. (make_item_for_dump_printf): New function. (dump_context::dump_printf_va): Call make_item_for_dump_printf_va, and use the result, eliminating the direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (make_item_for_dump_dec): New function. (dump_context::dump_dec): Call it, and use the result, eliminating the direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (make_item_for_dump_symtab_node): New function, adapted from optinfo::add_symtab_node. (dump_context::dump_symtab_node): Call it, and use the result, eliminating the direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (dump_context::begin_scope): Reimplement, avoiding direct usage of dump_file and alt_dump_file in favor of indirectly using them via emit_item. (dump_context::emit_item): New member function. (temp_dump_context::temp_dump_context): Add param "test_pp_flags". Set up test pretty-printer on the underlying context. Call refresh_dumps_are_enabled. (temp_dump_context::~temp_dump_context): Call refresh_dumps_are_enabled. (temp_dump_context::get_dumped_text): New member function. (selftest::verify_dumped_text): New function. (ASSERT_DUMPED_TEXT_EQ): New macro. (selftest::test_capture_of_dump_calls): Run all tests twice, with and then without optinfo enabled. Add uses of ASSERT_DUMPED_TEXT_EQ to all tests. Add test of nested scopes. * dumpfile.h: Update comment for the dump_* API. * optinfo-emit-json.cc (selftest::test_building_json_from_dump_calls): Update for new param for temp_dump_context ctor. * optinfo.cc (optinfo_item::optinfo_item): Remove "owned" param and "m_owned" field. (optinfo_item::~optinfo_item): Likewise. (optinfo::add_item): New member function. (optinfo::emit): Update comment. (optinfo::add_string): Delete. (optinfo::add_printf): Delete. (optinfo::add_printf_va): Delete. (optinfo::add_gimple_stmt): Delete. (optinfo::add_gimple_expr): Delete. (optinfo::add_tree): Delete. (optinfo::add_symtab_node): Delete. (optinfo::add_dec): Delete. * optinfo.h (class dump_context): New forward decl. (optinfo::add_item): New decl. (optinfo::add_string): Delete. (optinfo::add_printf): Delete. (optinfo::add_printf_va): Delete. (optinfo::add_gimple_stmt): Delete. (optinfo::add_gimple_expr): Delete. (optinfo::add_tree): Delete. (optinfo::add_symtab_node): Delete. (optinfo::add_dec): Delete. (optinfo::add_poly_int): Delete. (optinfo_item::optinfo_item): Remove "owned" param. (class optinfo_item): Remove field "m_owned". From-SVN: r263178
2018-07-31Simplify dump_context by adding a dump_loc member functionDavid Malcolm1-0/+2
This patch removes some duplicated code in dumpfile.c by reimplementing the various dump_foo_loc calls in terms of dump_foo. gcc/ChangeLog: * dump-context.h (dump_context::dump_loc): New decl. * dumpfile.c (dump_context::dump_loc): New member function. (dump_context::dump_gimple_stmt_loc): Reimplement using dump_loc and dump_gimple_stmt. (dump_context::dump_gimple_expr_loc): Likewise, using dump_gimple_expr. (dump_context::dump_generic_expr_loc): Likewise, using dump_generic_expr. (dump_context::dump_printf_loc_va): Likewise, using dump_printf_va. (dump_context::begin_scope): Explicitly using the global function "dump_loc", rather than the member function. From-SVN: r263167
2018-07-19Add "optinfo" frameworkDavid Malcolm1-0/+138
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