diff options
author | Sharad Singhai <singhai@google.com> | 2012-10-01 05:43:06 +0000 |
---|---|---|
committer | Sharad Singhai <singhai@gcc.gnu.org> | 2012-10-01 05:43:06 +0000 |
commit | 78c60e3da2d1a25ac13b725980e5f4dd53b9df60 (patch) | |
tree | 525ba5cb84f1f7d04874c56225d38fe09fea8455 | |
parent | d0cfc26205e59848a644a42790fcb3a76d82a287 (diff) | |
download | gcc-78c60e3da2d1a25ac13b725980e5f4dd53b9df60.zip gcc-78c60e3da2d1a25ac13b725980e5f4dd53b9df60.tar.gz gcc-78c60e3da2d1a25ac13b725980e5f4dd53b9df60.tar.bz2 |
invoke.texi: Add documentation for the new option.
2012-09-30 Sharad Singhai <singhai@google.com>
* doc/invoke.texi: Add documentation for the new option.
* tree-dump.c: Move general dump file related functionality into
dumpfile.c. Remove unneeded headers.
* tree-dump.h: Move function declarations into dumpfile.h.
* dumpfile.h: Include "line-map.h". Add defines for MSG flags.
(struct dump_file_info): Move here from tree-dump.c. Rename flags
to pflags, state to pstate, stream to pstream, filename to
pfilename. All callers updated. Add alt_flags, alt_state,
alt_filenmae, alt_stream.
* tree-vectorizer.c: Include "dumpfile.h". Remove vect_dump.
(vect_set_dump_settings): Remove.
(vect_print_dump_info): Ditto.
* tree-vectorizer.h: Remove declaration of vect_dump and
vect_print_dump_info.
* tree-vect-loop.c: Include "dumpfile.h". Use new dump style.
* tree-vect-data-refs.c: Ditto.
* tree-vect-stmts.c: Ditto.
* tree-vect-slp.c: Ditto.
* tree-vect-patterns.c: Ditto.
* tree-vect-loop-manip.c: Ditto.
* testsuite/gcc.target/i386/vect-double-1.c: Fix test.
* opts.c (vect_set_verbosity_level): Remove.
(common_handle_option): Handle -fopt-info flag. Deprecate
-ftree-vectorizer-verbose.
* tree-parloops.c (gather_scalar_reductions): Remove reference to
vect_dump.
* flag-types.h: Remove vect_verbosity_levels.
* common.opt: Add -fopt-info. Deprecate -ftree-vectorizer-verbose.
* opts-global.c (dump_remap_tree_vectorizer_verbose): New
function.
(handle_common_deferred_options): Handle -fopt-info and
-ftree-vectorizer-verbose.
* Makefile.in: Add dumpfile.o.
(tree-dump.o): Update dependencies.
(tree-vect-loop.o): Ditto.
(tree-vect-loop-manip.o): Ditto.
(tree-vect-slp.o): Ditto.
(tree-vect-stmts.o): Ditto.
(tree-vectorizer.o): Ditto.
(opts.o): Ditto.
* passes.c (finish_optimization_passes): Instead of using
dump_begin/dump_end, use dump_start/dump_finish. Do not use dump_file.
(pass_init_dump_file): Ditto.
* c-decl.c (c_write_global_declarations): Use a different method
to determine if the dump has ben initialized.
* decl2.c (cp_write_global_declarations): Use a different method
to determine if the dump has ben initialized.
From-SVN: r191883
-rw-r--r-- | gcc/ChangeLog | 45 | ||||
-rw-r--r-- | gcc/Makefile.in | 22 | ||||
-rw-r--r-- | gcc/c-family/c-ada-spec.c | 2 | ||||
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 4 | ||||
-rw-r--r-- | gcc/common.opt | 19 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 4 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 165 | ||||
-rw-r--r-- | gcc/dumpfile.h | 67 | ||||
-rw-r--r-- | gcc/flag-types.h | 16 | ||||
-rw-r--r-- | gcc/opts-global.c | 47 | ||||
-rw-r--r-- | gcc/opts.c | 22 | ||||
-rw-r--r-- | gcc/passes.c | 30 | ||||
-rw-r--r-- | gcc/statistics.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/vect-double-1.c | 2 | ||||
-rw-r--r-- | gcc/tree-dump.c | 382 | ||||
-rw-r--r-- | gcc/tree-dump.h | 7 | ||||
-rw-r--r-- | gcc/tree-parloops.c | 1 | ||||
-rw-r--r-- | gcc/tree-vect-data-refs.c | 727 | ||||
-rw-r--r-- | gcc/tree-vect-loop-manip.c | 134 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 999 | ||||
-rw-r--r-- | gcc/tree-vect-patterns.c | 110 | ||||
-rw-r--r-- | gcc/tree-vect-slp.c | 478 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.c | 694 | ||||
-rw-r--r-- | gcc/tree-vectorizer.c | 131 | ||||
-rw-r--r-- | gcc/tree-vectorizer.h | 7 |
27 files changed, 2137 insertions, 1990 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d338ee3..af62cff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,48 @@ +2012-09-30 Sharad Singhai <singhai@google.com> + + * doc/invoke.texi: Add documentation for the new -fopt-info option. + * tree-dump.c: Move general dump file related functionality into + dumpfile.c. Remove unneeded headers. + * tree-dump.h: Move function declarations into dumpfile.h. + * dumpfile.h: Include "line-map.h". Add defines for MSG flags. + (struct dump_file_info): Move here from tree-dump.c. Rename flags + to pflags, state to pstate, stream to pstream, filename to + pfilename. All callers updated. Add alt_flags, alt_state, + alt_filenmae, alt_stream. + * tree-vectorizer.c: Include "dumpfile.h". Remove vect_dump. + (vect_set_dump_settings): Remove. + (vect_print_dump_info): Ditto. + * tree-vectorizer.h: Remove declaration of vect_dump and + vect_print_dump_info. + * tree-vect-loop.c: Include "dumpfile.h". Use new dump style. + * tree-vect-data-refs.c: Ditto. + * tree-vect-stmts.c: Ditto. + * tree-vect-slp.c: Ditto. + * tree-vect-patterns.c: Ditto. + * tree-vect-loop-manip.c: Ditto. + * testsuite/gcc.target/i386/vect-double-1.c: Fix test. + * opts.c (vect_set_verbosity_level): Remove. + (common_handle_option): Handle -fopt-info flag. Deprecate + -ftree-vectorizer-verbose. + * tree-parloops.c (gather_scalar_reductions): Remove reference to + vect_dump. + * flag-types.h: Remove vect_verbosity_levels. + * common.opt: Add -fopt-info. Deprecate -ftree-vectorizer-verbose. + * opts-global.c (dump_remap_tree_vectorizer_verbose): New function. + (handle_common_deferred_options): Handle -fopt-info and + -ftree-vectorizer-verbose. + * Makefile.in: Add dumpfile.o. + (tree-dump.o): Update dependencies. + (tree-vect-loop.o): Ditto. + (tree-vect-loop-manip.o): Ditto. + (tree-vect-slp.o): Ditto. + (tree-vect-stmts.o): Ditto. + (tree-vectorizer.o): Ditto. + (opts.o): Ditto. + * passes.c (finish_optimization_passes): Instead of using + dump_begin/dump_end, use dump_start/dump_finish. Do not use dump_file. + (pass_init_dump_file): Ditto. + 2012-09-30 Joern Rennecke <joern.rennecke@embecosm.com> PR rtl-optimization/38449: diff --git a/gcc/Makefile.in b/gcc/Makefile.in index b036e88..94ac3b5 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -916,7 +916,7 @@ MKDEPS_H = $(srcdir)/../libcpp/include/mkdeps.h SYMTAB_H = $(srcdir)/../libcpp/include/symtab.h $(OBSTACK_H) CPP_ID_DATA_H = $(CPPLIB_H) $(srcdir)/../libcpp/include/cpp-id-data.h CPP_INTERNAL_H = $(srcdir)/../libcpp/internal.h $(CPP_ID_DATA_H) -TREE_DUMP_H = tree-dump.h $(SPLAY_TREE_H) +TREE_DUMP_H = tree-dump.h $(SPLAY_TREE_H) dumpfile.h TREE_PASS_H = tree-pass.h $(TIMEVAR_H) dumpfile.h TREE_FLOW_H = tree-flow.h tree-flow-inline.h tree-ssa-operands.h \ $(BITMAP_H) sbitmap.h $(BASIC_BLOCK_H) $(GIMPLE_H) \ @@ -1193,6 +1193,7 @@ OBJS = \ domwalk.o \ double-int.o \ dse.o \ + dumpfile.o \ dwarf2asm.o \ dwarf2cfi.o \ dwarf2out.o \ @@ -2182,9 +2183,8 @@ tree.o: tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(TREE_PASS_H) $(LANGHOOKS_DEF_H) $(DIAGNOSTIC_H) $(CGRAPH_H) \ $(EXCEPT_H) debug.h intl.h tree-diagnostic.h $(TREE_PRETTY_PRINT_H) \ $(COMMON_TARGET_H) -tree-dump.o: tree-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ - $(TREE_H) langhooks.h toplev.h $(SPLAY_TREE_H) $(TREE_DUMP_H) \ - tree-iterator.h $(TREE_PASS_H) $(DIAGNOSTIC_H) +tree-dump.o: tree-dump.c $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TREE_H) \ + langhooks.h $(TREE_DUMP_H) tree-iterator.h tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(RTL_H) $(FLAGS_H) $(PARAMS_H) $(INPUT_H) insn-config.h \ $(HASHTAB_H) langhooks.h $(TREE_INLINE_H) $(CGRAPH_H) \ @@ -2544,12 +2544,12 @@ graphite-optimize-isl.o : graphite-optimize-isl.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h dumpfile.h $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) $(SCEV_H) \ sese.h graphite-poly.h tree-vect-loop.o: tree-vect-loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ - $(TM_H) $(GGC_H) $(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \ + $(TM_H) $(GGC_H) $(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) dumpfile.h \ $(CFGLOOP_H) $(EXPR_H) $(RECOG_H) $(OPTABS_H) \ $(DIAGNOSTIC_CORE_H) $(SCEV_H) $(TREE_VECTORIZER_H) \ $(GIMPLE_PRETTY_PRINT_H) $(TARGET_H) $(TREE_DATA_REF_H) tree-vect-loop-manip.o: tree-vect-loop-manip.c $(CONFIG_H) $(SYSTEM_H) \ - coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(BASIC_BLOCK_H) \ + coretypes.h dumpfile.h $(TM_H) $(GGC_H) $(TREE_H) $(BASIC_BLOCK_H) \ $(TREE_FLOW_H) $(CFGLOOP_H) $(DIAGNOSTIC_CORE_H) \ $(SCEV_H) $(TREE_VECTORIZER_H) langhooks.h $(GIMPLE_PRETTY_PRINT_H) tree-vect-patterns.o: tree-vect-patterns.c $(CONFIG_H) $(SYSTEM_H) \ @@ -2558,8 +2558,8 @@ tree-vect-patterns.o: tree-vect-patterns.c $(CONFIG_H) $(SYSTEM_H) \ $(TREE_FLOW_H) $(CFGLOOP_H) $(EXPR_H) $(OPTABS_H) $(PARAMS_H) \ $(TREE_DATA_REF_H) $(TREE_VECTORIZER_H) $(RECOG_H) $(DIAGNOSTIC_CORE_H) \ $(GIMPLE_PRETTY_PRINT_H) -tree-vect-slp.o: tree-vect-slp.c $(CONFIG_H) $(SYSTEM_H) \ - coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(TARGET_H) $(BASIC_BLOCK_H) \ +tree-vect-slp.o: tree-vect-slp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + dumpfile.h $(TM_H) $(GGC_H) $(TREE_H) $(TARGET_H) $(BASIC_BLOCK_H) \ $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(CFGLOOP_H) \ $(EXPR_H) $(RECOG_H) $(OPTABS_H) $(TREE_VECTORIZER_H) \ $(GIMPLE_PRETTY_PRINT_H) $(TREE_DATA_REF_H) langhooks.h @@ -2574,7 +2574,7 @@ tree-vect-data-refs.o: tree-vect-data-refs.c $(CONFIG_H) $(SYSTEM_H) \ $(EXPR_H) $(OPTABS_H) $(SCEV_H) $(TREE_VECTORIZER_H) \ $(DIAGNOSTIC_CORE_H) $(TM_P_H) $(GIMPLE_PRETTY_PRINT_H) tree-vectorizer.o: tree-vectorizer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ - $(TM_H) $(GGC_H) $(TREE_H) $(TREE_FLOW_H) \ + dumpfile.h $(TM_H) $(GGC_H) $(TREE_H) $(TREE_FLOW_H) \ $(CFGLOOP_H) $(TREE_PASS_H) $(TREE_VECTORIZER_H) \ $(TREE_PRETTY_PRINT_H) tree-loop-distribution.o: tree-loop-distribution.c $(CONFIG_H) $(SYSTEM_H) \ @@ -2623,7 +2623,7 @@ diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ version.h $(DEMANGLE_H) $(INPUT_H) intl.h $(BACKTRACE_H) $(DIAGNOSTIC_H) \ diagnostic.def opts.o : opts.c $(OPTS_H) $(OPTIONS_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_H) $(SYSTEM_H) \ - coretypes.h $(TM_H) \ + coretypes.h dumpfile.h $(TM_H) \ $(DIAGNOSTIC_H) insn-attr-common.h intl.h $(COMMON_TARGET_H) \ $(FLAGS_H) $(PARAMS_H) opts-diagnostic.h opts-global.o : opts-global.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ @@ -2923,6 +2923,8 @@ dce.o : dce.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) $(EXCEPT_H) $(DF_H) cselib.h \ $(DBGCNT_H) dce.h $(VALTRACK_H) $(TREE_PASS_H) $(DBGCNT_H) $(TM_P_H) \ $(EMIT_RTL_H) +dumpfile.o: dumpfile.c dumpfile.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(DIAGNOSTIC_CORE_H) $(GIMPLE_PRETTY_PRINT_H) $(TREE_H) dse.o : dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(TM_P_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \ $(RECOG_H) $(EXPR_H) $(DF_H) cselib.h $(DBGCNT_H) \ diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index e722516..1e27e2c 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -2535,7 +2535,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int is_class = false; tree name = TYPE_NAME (TREE_TYPE (t)); tree decl_name = DECL_NAME (t); - bool dump_internal = get_dump_file_info (TDI_ada)->flags & TDF_RAW; + bool dump_internal = get_dump_file_info (TDI_ada)->pflags & TDF_RAW; tree orig = NULL_TREE; if (cpp_check && cpp_check (t, IS_TEMPLATE)) diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 6aed2c3..770683c 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2012-09-30 Sharad Singhai <singhai@google.com> + + * c-decl.c (c_write_global_declarations): Use a different method + to determine if the dump has ben initialized. + 2012-09-14 Joseph Myers <joseph@codesourcery.com> PR c/54552 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index d4c7b1f..1b4d764 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -10079,10 +10079,10 @@ c_write_global_declarations (void) gcc_assert (!current_scope); /* Handle -fdump-ada-spec[-slim]. */ - if (dump_enabled_p (TDI_ada)) + if (dump_initialized_p (TDI_ada)) { /* Build a table of files to generate specs for */ - if (get_dump_file_info (TDI_ada)->flags & TDF_SLIM) + if (get_dump_file_info (TDI_ada)->pflags & TDF_SLIM) collect_source_ref (main_input_filename); else for_each_global_decl (collect_source_ref_cb); diff --git a/gcc/common.opt b/gcc/common.opt index 31b6210..f0e757c 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -141,9 +141,6 @@ bool use_gnu_debug_info_extensions Variable unsigned int initial_max_fld_align = TARGET_DEFAULT_PACK_STRUCT -Variable -enum vect_verbosity_levels user_vect_verbosity_level = MAX_VERBOSITY_LEVEL - ; Type of stack check. Variable enum stack_check_type flag_stack_check = NO_STACK_CHECK @@ -1536,6 +1533,14 @@ fomit-frame-pointer Common Report Var(flag_omit_frame_pointer) Optimization When possible do not generate stack frames +fopt-info +Common Report Var(flag_opt_info) Optimization +Enable all optimization info dumps on stderr + +fopt-info- +Common Joined RejectNegative Var(common_deferred_options) Defer +-fopt-info[-<type>=filename] Dump compiler optimization details + foptimize-register-move Common Report Var(flag_regmove) Optimization Do the full register move optimization pass @@ -2195,6 +2200,10 @@ ftree-vectorize Common Report Var(flag_tree_vectorize) Optimization Enable loop vectorization on trees +ftree-vectorizer-verbose= +Common RejectNegative Joined UInteger Var(common_deferred_options) Defer +-ftree-vectorizer-verbose=<number> This switch is deprecated. Use -fopt-info instead. + ftree-slp-vectorize Common Report Var(flag_tree_slp_vectorize) Init(2) Optimization Enable basic block vectorization (SLP) on trees @@ -2207,10 +2216,6 @@ ftree-vect-loop-version Common Report Var(flag_tree_vect_loop_version) Init(1) Optimization Enable loop versioning when doing loop vectorization on trees -ftree-vectorizer-verbose= -Common RejectNegative Joined UInteger --ftree-vectorizer-verbose=<number> Set the verbosity level of the vectorizer - ftree-scev-cprop Common Report Var(flag_tree_scev_cprop) Init(1) Optimization Enable copy propagation of scalar-evolution information. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 376cbf6..2fa9565 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2012-09-30 Sharad Singhai <singhai@google.com> + + * decl2.c (cp_write_global_declarations): Use a different method + to determine if the dump has ben initialized. + 2012-09-29 Paolo Carlini <paolo.carlini@oracle.com> PR c++/54738 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 4cff051..9b1a5a1 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3698,9 +3698,9 @@ cp_write_global_declarations (void) cgraph_process_same_body_aliases (); /* Handle -fdump-ada-spec[-slim] */ - if (dump_enabled_p (TDI_ada)) + if (dump_initialized_p (TDI_ada)) { - if (get_dump_file_info (TDI_ada)->flags & TDF_SLIM) + if (get_dump_file_info (TDI_ada)->pflags & TDF_SLIM) collect_source_ref (main_input_filename); else collect_source_refs (global_namespace); diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index c1f9e51..205faa7 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -330,6 +330,8 @@ Objective-C and Objective-C++ Dialects}. -fenable-@var{kind}-@var{pass}=@var{range-list} @gol -fdebug-types-section -fmem-report-wpa @gol -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol +-fopt-info @gol +-fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol -fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol @@ -5350,20 +5352,23 @@ Here are some examples showing uses of these options. @item -d@var{letters} @itemx -fdump-rtl-@var{pass} +@itemx -fdump-rtl-@var{pass}=@var{filename} @opindex d Says to make debugging dumps during compilation at times specified by @var{letters}. This is used for debugging the RTL-based passes of the compiler. The file names for most of the dumps are made by appending a pass number and a word to the @var{dumpname}, and the files are -created in the directory of the output file. Note that the pass -number is computed statically as passes get registered into the pass -manager. Thus the numbering is not related to the dynamic order of -execution of passes. In particular, a pass installed by a plugin -could have a number over 200 even if it executed quite early. -@var{dumpname} is generated from the name of the output file, if -explicitly specified and it is not an executable, otherwise it is the -basename of the source file. These switches may have different effects -when @option{-E} is used for preprocessing. +created in the directory of the output file. In case of +@option{=@var{filename}} option, the dump is output on the given file +instead of the pass numbered dump files. Note that the pass number is +computed statically as passes get registered into the pass manager. +Thus the numbering is not related to the dynamic order of execution of +passes. In particular, a pass installed by a plugin could have a +number over 200 even if it executed quite early. @var{dumpname} is +generated from the name of the output file, if explicitly specified +and it is not an executable, otherwise it is the basename of the +source file. These switches may have different effects when +@option{-E} is used for preprocessing. Debug dumps can be enabled with a @option{-fdump-rtl} switch or some @option{-d} option @var{letters}. Here are the possible @@ -5744,15 +5749,18 @@ counters for each function compiled. @item -fdump-tree-@var{switch} @itemx -fdump-tree-@var{switch}-@var{options} +@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename} @opindex fdump-tree Control the dumping at various stages of processing the intermediate language tree to a file. The file name is generated by appending a switch-specific suffix to the source file name, and the file is -created in the same directory as the output file. If the -@samp{-@var{options}} form is used, @var{options} is a list of -@samp{-} separated options which control the details of the dump. Not -all options are applicable to all dumps; those that are not -meaningful are ignored. The following options are available +created in the same directory as the output file. In case of +@option{=@var{filename}} option, the dump is output on the given file +instead of the auto named dump files. If the @samp{-@var{options}} +form is used, @var{options} is a list of @samp{-} separated options +which control the details of the dump. Not all options are applicable +to all dumps; those that are not meaningful are ignored. The +following options are available @table @samp @item address @@ -5772,7 +5780,8 @@ trees, this option inhibits dumping the bodies of control structures. Print a raw representation of the tree. By default, trees are pretty-printed into a C-like representation. @item details -Enable more detailed dumps (not honored by every dump option). +Enable more detailed dumps (not honored by every dump option). Also +include information from the optimization passes. @item stats Enable dumping various statistics about the pass (not honored by every dump option). @@ -5790,9 +5799,38 @@ Enable showing the tree dump for each statement. Enable showing the EH region number holding each statement. @item scev Enable showing scalar evolution analysis details. +@item optimized +Enable showing optimization information (only available in certain +passes). +@item missed +Enable showing missed optimization information (only available in certain +passes). +@item notes +Enable other detailed optimization information (only available in +certain passes). +@item =@var{filename} +Instead of an auto named dump file, output into the given file +name. The file names @file{stdout} and @file{stderr} are treated +specially and are considered already open standard streams. For +example, + +@smallexample +gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump + -fdump-tree-pre=stderr file.c +@end smallexample + +outputs vectorizer dump into @file{foo.dump}, while the PRE dump is +output on to @file{stderr}. If two conflicting dump filenames are +given for the same pass, then the latter option overrides the earlier +one. + @item all Turn on all options, except @option{raw}, @option{slim}, @option{verbose} and @option{lineno}. + +@item optall +Turn on all optimization options, i.e., @option{optimized}, +@option{missed}, and @option{note}. @end table The following tree dumps are possible: @@ -5940,33 +5978,80 @@ is made by appending @file{.vrp} to the source file name. Enable all the available tree dumps with the flags provided in this option. @end table +@item -fopt-info +@itemx -fopt-info-@var{options} +@itemx -fopt-info-@var{options}=@var{filename} +@opindex fopt-info +Controls optimization dumps from all the passes. If the +@samp{-@var{options}} form is used, @var{options} is a list of +@samp{-} separated options to control the dump details. If +@var{options} is not specified, it defaults to @option{optall}. If the +@var{filename} is not specified, it defaults to @file{stderr}. Note +that the output @var{filename} will be overwritten in case of multiple +translation units. If a combined output from multiple translation +units is desired, @file{stderr} should be used instead. + +The following options are available + +@table @samp +@item optimized +Print information when an optimization is successfully applied. It is +up to a pass to decide which information is relevant. For example, the +vectorizer pass prints the location of loop which got vectorized. +@item missed +Print information about missed optimizations. Individual passes +control which information to include in the output. For example, + +@smallexample +gcc -O2 -ftree-vectorize -fopt-info-missed +@end smallexample + +will print information about missed optimization opportunities on +stderr. +@item note +Print verbose information about optimizations, such as certain +transformations, more detailed messages about decisions etc. +@item optall +Print detailed optimization information. This includes +@var{optimized}, @var{missed}, and @var{note}. For example, + +@smallexample +gcc -O2 -ftree-vectorize -fopt-info-optall=opt.all +@end smallexample + +outputs detailed optimization report from all the passes into +@file{opt.all}. +@end table + +It applies the dump options to all the passes. If the @var{filename} +is provided, the dump from all the passes is concatenated, otherwise +the dump is output onto @file{stderr}. If @var{options} is omitted, it +defaults to @option{optall}. + +@smallexample +gcc -O3 -fopt-info-optimized-missed=optdump.txt +@end smallexample + +This will output information about missed optimizations as well as +optimized locations from all the passes into @file{optdump.txt}. + @item -ftree-vectorizer-verbose=@var{n} @opindex ftree-vectorizer-verbose -This option controls the amount of debugging output the vectorizer prints. -This information is written to standard error, unless -@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified, -in which case it is output to the usual dump listing file, @file{.vect}. -For @var{n}=0 no diagnostic information is reported. -If @var{n}=1 the vectorizer reports each loop that got vectorized, -and the total number of loops that got vectorized. -If @var{n}=2 the vectorizer also reports non-vectorized loops that passed -the first analysis phase (vect_analyze_loop_form) - i.e.@: countable, -inner-most, single-bb, single-entry/exit loops. This is the same verbosity -level that @option{-fdump-tree-vect-stats} uses. -Higher verbosity levels mean either more information dumped for each -reported loop, or same amount of information reported for more loops: -if @var{n}=3, vectorizer cost model information is reported. -If @var{n}=4, alignment related information is added to the reports. -If @var{n}=5, data-references related information (e.g.@: memory dependences, -memory access-patterns) is added to the reports. -If @var{n}=6, the vectorizer reports also non-vectorized inner-most loops -that did not pass the first analysis phase (i.e., may not be countable, or -may have complicated control-flow). -If @var{n}=7, the vectorizer reports also non-vectorized nested loops. -If @var{n}=8, SLP related information is added to the reports. -For @var{n}=9, all the information the vectorizer generates during its -analysis and transformation is reported. This is the same verbosity level -that @option{-fdump-tree-vect-details} uses. +This option is deprecated and is implemented in terms of +@option{-fopt-info}. Please use @option{-fopt-info-@var{kind}} form +instead, where @var{kind} is one of the valid opt-info options. It +prints additional optimization information. For @var{n}=0 no +diagnostic information is reported. If @var{n}=1 the vectorizer +reports each loop that got vectorized, and the total number of loops +that got vectorized. If @var{n}=2 the vectorizer reports locations +which could not be vectorized and the reasons for those. For any +higher verbosity levels all the analysis and transformation +information from the vectorizer is reported. + +Note that the information output by @option{-ftree-vectorizer-verbose} +option is sent to @file{stderr}. If the equivalent form +@option{-fopt-info-@var{options}=@var{filename}} is used then the +output is sent into @var{filename} instead. @item -frandom-seed=@var{string} @opindex frandom-seed diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h index 2ea3901..cbaf47d 100644 --- a/gcc/dumpfile.h +++ b/gcc/dumpfile.h @@ -22,6 +22,8 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_DUMPFILE_H #define GCC_DUMPFILE_H 1 +#include "line-map.h" + /* Different tree dump places. When you add new tree dump places, extend the DUMP_FILES array in tree-dump.c. */ enum tree_dump_index @@ -43,9 +45,11 @@ enum tree_dump_index TDI_end }; -/* Bit masks to control dumping. Not all values are applicable to - all dumps. Add new ones at the end. When you define new - values, extend the DUMP_OPTIONS array in tree-dump.c */ +/* Bit masks to control dumping. Not all values are applicable to all + dumps. Add new ones at the end. When you define new values, extend + the DUMP_OPTIONS array in tree-dump.c. The TDF_* flags coexist with + MSG_* flags (for -fopt-info) and the bit values must be chosen + to allow that. */ #define TDF_ADDRESS (1 << 0) /* dump node addresses */ #define TDF_SLIM (1 << 1) /* don't go wild following links */ #define TDF_RAW (1 << 2) /* don't unparse the function */ @@ -82,18 +86,59 @@ enum tree_dump_index #define TDF_CSELIB (1 << 23) /* Dump cselib details. */ #define TDF_SCEV (1 << 24) /* Dump SCEV details. */ #define TDF_COMMENT (1 << 25) /* Dump lines with prefix ";;" */ +#define MSG_OPTIMIZED_LOCATIONS (1 << 26) /* -fopt-info optimized sources */ +#define MSG_MISSED_OPTIMIZATION (1 << 27) /* missed opportunities */ +#define MSG_NOTE (1 << 28) /* general optimization info */ +#define MSG_ALL (MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION \ + | MSG_NOTE) +/* Define a tree dump switch. */ +struct dump_file_info +{ + const char *suffix; /* suffix to give output file. */ + const char *swtch; /* command line dump switch */ + const char *glob; /* command line glob */ + const char *pfilename; /* filename for the pass-specific stream */ + const char *alt_filename; /* filename for the opt-info stream */ + FILE *pstream; /* pass-specific dump stream */ + FILE *alt_stream; /* opt-info stream */ + int pflags; /* dump flags */ + int alt_flags; /* flags for opt-info */ + int pstate; /* state of pass-specific stream */ + int alt_state; /* state of the opt-info stream */ + int num; /* dump file number */ +}; -/* In tree-dump.c */ +/* In dumpfile.c */ extern char *get_dump_file_name (int); -extern int dump_enabled_p (int); extern int dump_initialized_p (int); extern FILE *dump_begin (int, int *); extern void dump_end (int, FILE *); +extern int dump_start (int, int *); +extern void dump_finish (int); extern void dump_node (const_tree, int, FILE *); extern int dump_switch_p (const char *); +extern int opt_info_switch_p (const char *); extern const char *dump_flag_name (int); +extern bool dump_kind_p (int); +extern void dump_printf (int, const char *, ...) ATTRIBUTE_PRINTF_2; +extern void dump_printf_loc (int, source_location, + const char *, ...) ATTRIBUTE_PRINTF_3; +extern void dump_basic_block (int, basic_block, int); +extern void dump_generic_expr_loc (int, source_location, int, tree); +extern void dump_generic_expr (int, int, tree); +extern void dump_gimple_stmt_loc (int, source_location, int, gimple, int); +extern void dump_gimple_stmt (int, int, gimple, int); +extern void print_combine_total_stats (void); +extern unsigned int dump_register (const char *, const char *, const char *, + int); +extern bool enable_rtl_dump_file (void); + +/* In combine.c */ +extern void dump_combine_total_stats (FILE *); +/* In cfghooks.c */ +extern void dump_bb (FILE *, basic_block, int, int); /* Global variables used to communicate with passes. */ extern FILE *dump_file; @@ -103,16 +148,4 @@ extern const char *dump_file_name; /* Return the dump_file_info for the given phase. */ extern struct dump_file_info *get_dump_file_info (int); -/* Define a tree dump switch. */ -struct dump_file_info -{ - const char *suffix; /* suffix to give output file. */ - const char *swtch; /* command line switch */ - const char *glob; /* command line glob */ - int flags; /* user flags */ - int state; /* state of play */ - int num; /* dump file number */ -}; - - #endif /* GCC_DUMPFILE_H */ diff --git a/gcc/flag-types.h b/gcc/flag-types.h index b503c9f..d6c2610 100644 --- a/gcc/flag-types.h +++ b/gcc/flag-types.h @@ -200,20 +200,4 @@ enum fp_contract_mode { FP_CONTRACT_FAST = 2 }; -/* Vectorizer verbosity levels. */ -enum vect_verbosity_levels { - REPORT_NONE, - REPORT_VECTORIZED_LOCATIONS, - REPORT_UNVECTORIZED_LOCATIONS, - REPORT_COST, - REPORT_ALIGNMENT, - REPORT_DR_DETAILS, - REPORT_BAD_FORM_LOOPS, - REPORT_OUTER_LOOPS, - REPORT_SLP, - REPORT_DETAILS, - /* New verbosity levels should be added before this one. */ - MAX_VERBOSITY_LEVEL -}; - #endif /* ! GCC_FLAG_TYPES_H */ diff --git a/gcc/opts-global.c b/gcc/opts-global.c index b93d56f..ccbfeef 100644 --- a/gcc/opts-global.c +++ b/gcc/opts-global.c @@ -233,6 +233,40 @@ read_cmdline_options (struct gcc_options *opts, struct gcc_options *opts_set, } } +/* Handle -ftree-vectorizer-verbose=ARG by remapping it to -fopt-info. + It remaps the old verbosity values as following: + + REPORT_NONE ==> No dump is output + REPORT_VECTORIZED_LOCATIONS ==> "-optimized" + REPORT_UNVECTORIZED_LOCATIONS ==> "-missed" + + Any higher verbosity levels get mapped to "-optall" flags. */ + +static void +dump_remap_tree_vectorizer_verbose (const char *arg) +{ + int value = atoi (arg); + const char *remapped_opt_info = NULL; + + switch (value) + { + case 0: + break; + case 1: + remapped_opt_info = "optimized"; + break; + case 2: + remapped_opt_info = "missed"; + break; + default: + remapped_opt_info = "optall"; + break; + } + + if (remapped_opt_info) + opt_info_switch_p (remapped_opt_info); +} + /* Language mask determined at initialization. */ static unsigned int initial_lang_mask; @@ -322,6 +356,9 @@ handle_common_deferred_options (void) if (flag_dump_all_passed) enable_rtl_dump_file (); + if (flag_opt_info) + opt_info_switch_p (NULL); + FOR_EACH_VEC_ELT (cl_deferred_option, vec, i, opt) { switch (opt->opt_index) @@ -351,6 +388,12 @@ handle_common_deferred_options (void) error ("unrecognized command line option %<-fdump-%s%>", opt->arg); break; + case OPT_fopt_info_: + if (!opt_info_switch_p (opt->arg)) + error ("unrecognized command line option %<-fopt-info%s%>", + opt->arg); + break; + case OPT_fenable_: case OPT_fdisable_: if (opt->opt_index == OPT_fenable_) @@ -410,6 +453,10 @@ handle_common_deferred_options (void) stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (opt->arg)); break; + case OPT_ftree_vectorizer_verbose_: + dump_remap_tree_vectorizer_verbose (opt->arg); + break; + default: gcc_unreachable (); } @@ -139,19 +139,6 @@ set_struct_debug_option (struct gcc_options *opts, location_t loc, } } -/* Handle -ftree-vectorizer-verbose=VAL for options OPTS. */ - -static void -vect_set_verbosity_level (struct gcc_options *opts, int val) -{ - if (val < MAX_VERBOSITY_LEVEL) - opts->x_user_vect_verbosity_level = (enum vect_verbosity_levels) val; - else - opts->x_user_vect_verbosity_level - = (enum vect_verbosity_levels) (MAX_VERBOSITY_LEVEL - 1); -} - - /* Strip off a legitimate source ending from the input string NAME of length LEN. Rather than having to know the names used by all of our front ends, we strip off an ending of a period followed by @@ -1559,6 +1546,11 @@ common_handle_option (struct gcc_options *opts, diagnostic_set_caret_max_width (dc, value); break; + case OPT_fopt_info: + case OPT_fopt_info_: + /* Deferred. */ + break; + case OPT_fpack_struct_: if (value <= 0 || (value & (value - 1)) || value > 16) error_at (loc, @@ -1694,7 +1686,9 @@ common_handle_option (struct gcc_options *opts, break; case OPT_ftree_vectorizer_verbose_: - vect_set_verbosity_level (opts, value); + /* -ftree-vectorizer-verbose is deprecated. It is defined in + -terms of fopt-info=N. */ + /* Deferred. */ break; case OPT_g: diff --git a/gcc/passes.c b/gcc/passes.c index ba4e98e..86c8255 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -231,27 +231,23 @@ finish_optimization_passes (void) timevar_push (TV_DUMP); if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities) { - dump_file = dump_begin (pass_profile.pass.static_pass_number, NULL); + dump_start (pass_profile.pass.static_pass_number, NULL); end_branch_prob (); - if (dump_file) - dump_end (pass_profile.pass.static_pass_number, dump_file); + dump_finish (pass_profile.pass.static_pass_number); } if (optimize > 0) { - dump_file = dump_begin (pass_combine.pass.static_pass_number, NULL); - if (dump_file) - { - dump_combine_total_stats (dump_file); - dump_end (pass_combine.pass.static_pass_number, dump_file); - } + dump_start (pass_profile.pass.static_pass_number, NULL); + print_combine_total_stats (); + dump_finish (pass_combine.pass.static_pass_number); } /* Do whatever is necessary to finish printing the graphs. */ if (graph_dump_format != no_graph) for (i = TDI_end; (dfi = get_dump_file_info (i)) != NULL; ++i) if (dump_initialized_p (i) - && (dfi->flags & TDF_GRAPH) != 0 + && (dfi->pflags & TDF_GRAPH) != 0 && (name = get_dump_file_name (i)) != NULL) { finish_graph_dump_file (name); @@ -1238,9 +1234,9 @@ register_pass (struct register_pass_info *pass_info) else tdi = TDI_rtl_all; /* Check if dump-all flag is specified. */ - if (get_dump_file_info (tdi)->state) + if (get_dump_file_info (tdi)->pstate) get_dump_file_info (added_pass_nodes->pass->static_pass_number) - ->state = get_dump_file_info (tdi)->state; + ->pstate = get_dump_file_info (tdi)->pstate; XDELETE (added_pass_nodes); added_pass_nodes = next_node; } @@ -1945,7 +1941,7 @@ pass_init_dump_file (struct opt_pass *pass) { bool initializing_dump = !dump_initialized_p (pass->static_pass_number); dump_file_name = get_dump_file_name (pass->static_pass_number); - dump_file = dump_begin (pass->static_pass_number, &dump_flags); + dump_start (pass->static_pass_number, &dump_flags); if (dump_file && current_function_decl) dump_function_header (dump_file, current_function_decl, dump_flags); return initializing_dump; @@ -1967,11 +1963,7 @@ pass_fini_dump_file (struct opt_pass *pass) dump_file_name = NULL; } - if (dump_file) - { - dump_end (pass->static_pass_number, dump_file); - dump_file = NULL; - } + dump_finish (pass->static_pass_number); } /* After executing the pass, apply expected changes to the function @@ -2213,7 +2205,7 @@ execute_one_pass (struct opt_pass *pass) && (cfun->curr_properties & (PROP_cfg | PROP_rtl)) == (PROP_cfg | PROP_rtl)) { - get_dump_file_info (pass->static_pass_number)->flags |= TDF_GRAPH; + get_dump_file_info (pass->static_pass_number)->pflags |= TDF_GRAPH; dump_flags |= TDF_GRAPH; clean_graph_dump_file (dump_file_name); } diff --git a/gcc/statistics.c b/gcc/statistics.c index 55ec981..1b3eefb 100644 --- a/gcc/statistics.c +++ b/gcc/statistics.c @@ -255,7 +255,7 @@ void statistics_init (void) { statistics_dump_file = dump_begin (statistics_dump_nr, NULL); - statistics_dump_flags = get_dump_file_info (statistics_dump_nr)->flags; + statistics_dump_flags = get_dump_file_info (statistics_dump_nr)->pflags; } /* Lookup or add a statistics counter in the hashtable HASH with ID, VAL diff --git a/gcc/testsuite/gcc.target/i386/vect-double-1.c b/gcc/testsuite/gcc.target/i386/vect-double-1.c index 0b691bc..d96d639 100644 --- a/gcc/testsuite/gcc.target/i386/vect-double-1.c +++ b/gcc/testsuite/gcc.target/i386/vect-double-1.c @@ -32,5 +32,5 @@ sse2_test (void) } } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Vectorized loops: 1" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index 5a1fa3a..a1511ea 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -26,17 +26,10 @@ along with GCC; see the file COPYING3. If not see #include "tree.h" #include "splay-tree.h" #include "filenames.h" -#include "diagnostic-core.h" -#include "toplev.h" #include "tree-dump.h" #include "langhooks.h" #include "tree-iterator.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)) - static unsigned int queue (dump_info_p, const_tree, int); static void dump_index (dump_info_p, unsigned int); static void dequeue_and_dump (dump_info_p); @@ -162,6 +155,22 @@ dump_maybe_newline (dump_info_p di) } } +/* Dump FUNCTION_DECL FN as tree dump PHASE. */ + +void +dump_function (int phase, tree fn) +{ + FILE *stream; + int flags; + + stream = dump_begin (phase, &flags); + if (stream) + { + dump_function_to_file (fn, stream, flags); + dump_end (phase, stream); + } +} + /* Dump pointer PTR using FIELD to identify it. */ void @@ -766,362 +775,3 @@ dump_node (const_tree t, int flags, FILE *stream) } splay_tree_delete (di.nodes); } - - -/* Table of tree dump switches. This must be consistent with the - tree_dump_index enumeration in tree-pass.h. */ -static struct dump_file_info dump_files[TDI_end] = -{ - {NULL, NULL, NULL, 0, 0, 0}, - {".cgraph", "ipa-cgraph", NULL, TDF_IPA, 0, 0}, - {".tu", "translation-unit", NULL, TDF_TREE, 0, 1}, - {".class", "class-hierarchy", NULL, TDF_TREE, 0, 2}, - {".original", "tree-original", NULL, TDF_TREE, 0, 3}, - {".gimple", "tree-gimple", NULL, TDF_TREE, 0, 4}, - {".nested", "tree-nested", NULL, TDF_TREE, 0, 5}, - {".vcg", "tree-vcg", NULL, TDF_TREE, 0, 6}, - {".ads", "ada-spec", NULL, 0, 0, 7}, -#define FIRST_AUTO_NUMBERED_DUMP 8 - - {NULL, "tree-all", NULL, TDF_TREE, 0, 0}, - {NULL, "rtl-all", NULL, TDF_RTL, 0, 0}, - {NULL, "ipa-all", NULL, TDF_IPA, 0, 0}, -}; - -/* Dynamically registered tree dump files and switches. */ -static struct dump_file_info *extra_dump_files; -static size_t extra_dump_files_in_use; -static size_t extra_dump_files_alloced; - -/* Define a name->number mapping for a dump flag value. */ -struct dump_option_value_info -{ - const char *const name; /* the name of the value */ - const int value; /* the value of the name */ -}; - -/* Table of dump options. This must be consistent with the TDF_* flags - in tree.h */ -static const struct dump_option_value_info dump_options[] = -{ - {"address", TDF_ADDRESS}, - {"asmname", TDF_ASMNAME}, - {"slim", TDF_SLIM}, - {"raw", TDF_RAW}, - {"graph", TDF_GRAPH}, - {"details", TDF_DETAILS}, - {"cselib", TDF_CSELIB}, - {"stats", TDF_STATS}, - {"blocks", TDF_BLOCKS}, - {"vops", TDF_VOPS}, - {"lineno", TDF_LINENO}, - {"uid", TDF_UID}, - {"stmtaddr", TDF_STMTADDR}, - {"memsyms", TDF_MEMSYMS}, - {"verbose", TDF_VERBOSE}, - {"eh", TDF_EH}, - {"alias", TDF_ALIAS}, - {"nouid", TDF_NOUID}, - {"enumerate_locals", TDF_ENUMERATE_LOCALS}, - {"scev", TDF_SCEV}, - {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_TREE | TDF_RTL | TDF_IPA - | TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC | TDF_VERBOSE - | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV)}, - {NULL, 0} -}; - -unsigned int -dump_register (const char *suffix, const char *swtch, const char *glob, - int flags) -{ - static int next_dump = FIRST_AUTO_NUMBERED_DUMP; - int num = next_dump++; - - size_t count = extra_dump_files_in_use++; - - if (count >= extra_dump_files_alloced) - { - if (extra_dump_files_alloced == 0) - extra_dump_files_alloced = 32; - else - extra_dump_files_alloced *= 2; - extra_dump_files = XRESIZEVEC (struct dump_file_info, - extra_dump_files, - extra_dump_files_alloced); - } - - memset (&extra_dump_files[count], 0, sizeof (struct dump_file_info)); - extra_dump_files[count].suffix = suffix; - extra_dump_files[count].swtch = swtch; - extra_dump_files[count].glob = glob; - extra_dump_files[count].flags = flags; - extra_dump_files[count].num = num; - - return count + TDI_end; -} - - -/* Return the dump_file_info for the given phase. */ - -struct dump_file_info * -get_dump_file_info (int phase) -{ - if (phase < TDI_end) - return &dump_files[phase]; - else if ((size_t) (phase - TDI_end) >= extra_dump_files_in_use) - return NULL; - else - return extra_dump_files + (phase - TDI_end); -} - - -/* Return the name of the dump file for the given phase. - If the dump is not enabled, returns NULL. */ - -char * -get_dump_file_name (int phase) -{ - char dump_id[10]; - struct dump_file_info *dfi; - - if (phase == TDI_none) - return NULL; - - dfi = get_dump_file_info (phase); - if (dfi->state == 0) - return NULL; - - if (dfi->num < 0) - dump_id[0] = '\0'; - else - { - char suffix; - if (dfi->flags & TDF_TREE) - suffix = 't'; - else if (dfi->flags & TDF_IPA) - suffix = 'i'; - else - suffix = 'r'; - - if (snprintf (dump_id, sizeof (dump_id), ".%03d%c", dfi->num, suffix) < 0) - dump_id[0] = '\0'; - } - - return concat (dump_base_name, dump_id, dfi->suffix, NULL); -} - -/* 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. - Multiple calls will reopen and append to the dump file. */ - -FILE * -dump_begin (int phase, int *flag_ptr) -{ - char *name; - struct dump_file_info *dfi; - FILE *stream; - - if (phase == TDI_none || !dump_enabled_p (phase)) - return NULL; - - name = get_dump_file_name (phase); - dfi = get_dump_file_info (phase); - stream = fopen (name, dfi->state < 0 ? "w" : "a"); - if (!stream) - error ("could not open dump file %qs: %m", name); - else - dfi->state = 1; - free (name); - - if (flag_ptr) - *flag_ptr = dfi->flags; - - return stream; -} - -/* Returns nonzero if tree dump PHASE is enabled. If PHASE is - TDI_tree_all, return nonzero if any dump is enabled. */ - -int -dump_enabled_p (int phase) -{ - if (phase == TDI_tree_all) - { - size_t i; - for (i = TDI_none + 1; i < (size_t) TDI_end; i++) - if (dump_files[i].state) - return 1; - for (i = 0; i < extra_dump_files_in_use; i++) - if (extra_dump_files[i].state) - return 1; - return 0; - } - else - { - struct dump_file_info *dfi = get_dump_file_info (phase); - return dfi->state; - } -} - -/* Returns nonzero if tree dump PHASE has been initialized. */ - -int -dump_initialized_p (int phase) -{ - struct dump_file_info *dfi = get_dump_file_info (phase); - return dfi->state > 0; -} - -/* Returns the switch name of PHASE. */ - -const char * -dump_flag_name (int phase) -{ - struct dump_file_info *dfi = get_dump_file_info (phase); - return dfi->swtch; -} - -/* Finish a tree dump for PHASE. STREAM is the stream created by - dump_begin. */ - -void -dump_end (int phase ATTRIBUTE_UNUSED, FILE *stream) -{ - fclose (stream); -} - -/* Enable all tree dumps. Return number of enabled tree dumps. */ - -static int -dump_enable_all (int flags) -{ - int ir_dump_type = (flags & (TDF_TREE | TDF_RTL | TDF_IPA)); - int n = 0; - size_t i; - - for (i = TDI_none + 1; i < (size_t) TDI_end; i++) - if ((dump_files[i].flags & ir_dump_type)) - { - dump_files[i].state = -1; - dump_files[i].flags |= flags; - n++; - } - - for (i = 0; i < extra_dump_files_in_use; i++) - if ((extra_dump_files[i].flags & ir_dump_type)) - { - extra_dump_files[i].state = -1; - extra_dump_files[i].flags |= flags; - n++; - } - - return n; -} - -/* Parse ARG as a dump switch. Return nonzero if it is, and store the - relevant details in the dump_files array. */ - -static int -dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob) -{ - const char *option_value; - const char *ptr; - int flags; - - 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 != '-') - return 0; - - ptr = option_value; - flags = 0; - - while (*ptr) - { - const struct dump_option_value_info *option_ptr; - const char *end_ptr; - unsigned length; - - while (*ptr == '-') - ptr++; - end_ptr = strchr (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; - } - warning (0, "ignoring unknown option %q.*s in %<-fdump-%s%>", - length, ptr, dfi->swtch); - found:; - ptr = end_ptr; - } - - dfi->state = -1; - dfi->flags |= flags; - - /* Process -fdump-tree-all and -fdump-rtl-all, by enabling all the - known dumps. */ - if (dfi->suffix == NULL) - dump_enable_all (dfi->flags); - - return 1; -} - -int -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); - - for (i = 0; i < extra_dump_files_in_use; i++) - any |= dump_switch_p_1 (arg, &extra_dump_files[i], false); - - if (!any) - for (i = 0; i < extra_dump_files_in_use; i++) - any |= dump_switch_p_1 (arg, &extra_dump_files[i], true); - - - return any; -} - -/* Dump FUNCTION_DECL FN as tree dump PHASE. */ - -void -dump_function (int phase, tree fn) -{ - FILE *stream; - int flags; - - stream = dump_begin (phase, &flags); - if (stream) - { - dump_function_to_file (fn, stream, flags); - dump_end (phase, stream); - } -} - -bool -enable_rtl_dump_file (void) -{ - return dump_enable_all (TDF_RTL | TDF_DETAILS | TDF_BLOCKS) > 0; -} diff --git a/gcc/tree-dump.h b/gcc/tree-dump.h index 50faf4b..67ea6e5 100644 --- a/gcc/tree-dump.h +++ b/gcc/tree-dump.h @@ -89,12 +89,9 @@ extern void dump_string_field (dump_info_p, const char *, const char *); extern void queue_and_dump_index (dump_info_p, const char *, const_tree, int); extern void queue_and_dump_type (dump_info_p, const_tree); extern void dump_function (int, tree); -extern void dump_function_to_file (tree, FILE *, int); -extern void debug_function (tree, int); extern int dump_flag (dump_info_p, int, const_tree); -extern unsigned int dump_register (const char *, const char *, const char *, - int); - +/* In tree-cfg.c */ +extern void dump_function_to_file (tree, FILE *, int); #endif /* ! GCC_TREE_DUMP_H */ diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 41ddf57..a3b981e 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -1944,7 +1944,6 @@ gather_scalar_reductions (loop_p loop, htab_t reduction_list) gimple_stmt_iterator gsi; loop_vec_info simple_loop_info; - vect_dump = NULL; simple_loop_info = vect_analyze_loop_form (loop); for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi)) diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 0970469..dc6e1e7 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" +#include "dumpfile.h" #include "tm.h" #include "ggc.h" #include "tree.h" @@ -59,23 +60,26 @@ vect_lanes_optab_supported_p (const char *name, convert_optab optab, if (array_mode == BLKmode) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "no array mode for %s[" HOST_WIDE_INT_PRINT_DEC "]", - GET_MODE_NAME (mode), count); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "no array mode for %s[" HOST_WIDE_INT_PRINT_DEC "]", + GET_MODE_NAME (mode), count); return false; } if (convert_optab_handler (optab, array_mode, mode) == CODE_FOR_nothing) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "cannot use %s<%s><%s>", - name, GET_MODE_NAME (array_mode), GET_MODE_NAME (mode)); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "cannot use %s<%s><%s>", name, + GET_MODE_NAME (array_mode), GET_MODE_NAME (mode)); return false; } - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "can use %s<%s><%s>", - name, GET_MODE_NAME (array_mode), GET_MODE_NAME (mode)); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "can use %s<%s><%s>", name, GET_MODE_NAME (array_mode), + GET_MODE_NAME (mode)); return true; } @@ -435,12 +439,13 @@ vect_check_interleaving (struct data_reference *dra, if (diff_mod_size == 0) { vect_update_interleaving_chain (drb, dra); - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Detected interleaving "); - print_generic_expr (vect_dump, DR_REF (dra), TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, DR_REF (drb), TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "Detected interleaving "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra)); + dump_printf (MSG_NOTE, " and "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb)); } return true; } @@ -457,12 +462,13 @@ vect_check_interleaving (struct data_reference *dra, if (diff_mod_size == 0) { vect_update_interleaving_chain (dra, drb); - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Detected interleaving "); - print_generic_expr (vect_dump, DR_REF (dra), TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, DR_REF (drb), TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "Detected interleaving "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra)); + dump_printf (MSG_NOTE, " and "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb)); } return true; } @@ -518,26 +524,29 @@ vect_mark_for_runtime_alias_test (ddr_p ddr, loop_vec_info loop_vinfo) if ((unsigned) PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS) == 0) return false; - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "mark for run-time aliasing test between "); - print_generic_expr (vect_dump, DR_REF (DDR_A (ddr)), TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, DR_REF (DDR_B (ddr)), TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "mark for run-time aliasing test between "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_A (ddr))); + dump_printf (MSG_NOTE, " and "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_B (ddr))); } if (optimize_loop_nest_for_size_p (loop)) { - if (vect_print_dump_info (REPORT_DR_DETAILS)) - fprintf (vect_dump, "versioning not supported when optimizing for size."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "versioning not supported when optimizing for size."); return false; } /* FORNOW: We don't support versioning with outer-loop vectorization. */ if (loop->inner) { - if (vect_print_dump_info (REPORT_DR_DETAILS)) - fprintf (vect_dump, "versioning not yet supported for outer-loops."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "versioning not yet supported for outer-loops."); return false; } @@ -546,9 +555,10 @@ vect_mark_for_runtime_alias_test (ddr_p ddr, loop_vec_info loop_vinfo) if (TREE_CODE (DR_STEP (DDR_A (ddr))) != INTEGER_CST || TREE_CODE (DR_STEP (DDR_B (ddr))) != INTEGER_CST) { - if (vect_print_dump_info (REPORT_DR_DETAILS)) - fprintf (vect_dump, "versioning not yet supported for non-constant " - "step"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "versioning not yet supported for non-constant " + "step"); return false; } @@ -601,13 +611,16 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, if (loop_vinfo) { - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "versioning for alias required: " - "can't determine dependence between "); - print_generic_expr (vect_dump, DR_REF (dra), TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, DR_REF (drb), TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "versioning for alias required: " + "can't determine dependence between "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + DR_REF (dra)); + dump_printf (MSG_MISSED_OPTIMIZATION, " and "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + DR_REF (drb)); } /* Add to list of ddrs that need to be tested at run-time. */ @@ -624,12 +637,13 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, if (DR_IS_READ (dra) && DR_IS_READ (drb)) return false; - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "can't determine dependence between "); - print_generic_expr (vect_dump, DR_REF (dra), TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, DR_REF (drb), TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "can't determine dependence between "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, DR_REF (dra)); + dump_printf (MSG_MISSED_OPTIMIZATION, " and "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, DR_REF (drb)); } /* We do not vectorize basic blocks with write-write dependencies. */ @@ -652,31 +666,34 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, if (dra != drb && vect_check_interleaving (dra, drb)) return false; - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "determined dependence between "); - print_generic_expr (vect_dump, DR_REF (dra), TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, DR_REF (drb), TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "determined dependence between "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra)); + dump_printf (MSG_NOTE, " and "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb)); } /* Do not vectorize basic blcoks with write-write dependences. */ if (DR_IS_WRITE (dra) && DR_IS_WRITE (drb)) return true; - /* Check if this dependence is allowed in basic block vectorization. */ + /* Check if this dependence is allowed in basic block vectorization. */ return vect_drs_dependent_in_basic_block (dra, drb); } /* Loop-based vectorization and known data dependence. */ if (DDR_NUM_DIST_VECTS (ddr) == 0) { - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "versioning for alias required: bad dist vector for "); - print_generic_expr (vect_dump, DR_REF (dra), TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, DR_REF (drb), TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "versioning for alias required: " + "bad dist vector for "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, DR_REF (dra)); + dump_printf (MSG_MISSED_OPTIMIZATION, " and "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, DR_REF (drb)); } /* Add to list of ddrs that need to be tested at run-time. */ return !vect_mark_for_runtime_alias_test (ddr, loop_vinfo); @@ -687,17 +704,19 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, { int dist = dist_v[loop_depth]; - if (vect_print_dump_info (REPORT_DR_DETAILS)) - fprintf (vect_dump, "dependence distance = %d.", dist); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "dependence distance = %d.", dist); if (dist == 0) { - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "dependence distance == 0 between "); - print_generic_expr (vect_dump, DR_REF (dra), TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, DR_REF (drb), TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "dependence distance == 0 between "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra)); + dump_printf (MSG_NOTE, " and "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb)); } /* For interleaving, mark that there is a read-write dependency if @@ -718,8 +737,9 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, /* If DDR_REVERSED_P the order of the data-refs in DDR was reversed (to make distance vector positive), and the actual distance is negative. */ - if (vect_print_dump_info (REPORT_DR_DETAILS)) - fprintf (vect_dump, "dependence distance negative."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "dependence distance negative."); continue; } @@ -729,27 +749,30 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, /* The dependence distance requires reduction of the maximal vectorization factor. */ *max_vf = abs (dist); - if (vect_print_dump_info (REPORT_DR_DETAILS)) - fprintf (vect_dump, "adjusting maximal vectorization factor to %i", - *max_vf); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "adjusting maximal vectorization factor to %i", + *max_vf); } if (abs (dist) >= *max_vf) { /* Dependence distance does not create dependence, as far as vectorization is concerned, in this case. */ - if (vect_print_dump_info (REPORT_DR_DETAILS)) - fprintf (vect_dump, "dependence distance >= VF."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "dependence distance >= VF."); continue; } - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "not vectorized, possible dependence " - "between data-refs "); - print_generic_expr (vect_dump, DR_REF (dra), TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, DR_REF (drb), TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized, possible dependence " + "between data-refs "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra)); + dump_printf (MSG_NOTE, " and "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb)); } return true; @@ -772,9 +795,9 @@ vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo, VEC (ddr_p, heap) *ddrs = NULL; struct data_dependence_relation *ddr; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_analyze_dependences ==="); - + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_analyze_dependences ==="); if (loop_vinfo) ddrs = LOOP_VINFO_DDRS (loop_vinfo); else @@ -814,8 +837,9 @@ vect_compute_data_ref_alignment (struct data_reference *dr) tree misalign; tree aligned_to, alignment; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vect_compute_data_ref_alignment:"); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_compute_data_ref_alignment:"); if (loop_vinfo) loop = LOOP_VINFO_LOOP (loop_vinfo); @@ -846,16 +870,18 @@ vect_compute_data_ref_alignment (struct data_reference *dr) if (dr_step % GET_MODE_SIZE (TYPE_MODE (vectype)) == 0) { - if (vect_print_dump_info (REPORT_ALIGNMENT)) - fprintf (vect_dump, "inner step divides the vector-size."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "inner step divides the vector-size."); misalign = STMT_VINFO_DR_INIT (stmt_info); aligned_to = STMT_VINFO_DR_ALIGNED_TO (stmt_info); base_addr = STMT_VINFO_DR_BASE_ADDRESS (stmt_info); } else { - if (vect_print_dump_info (REPORT_ALIGNMENT)) - fprintf (vect_dump, "inner step doesn't divide the vector-size."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "inner step doesn't divide the vector-size."); misalign = NULL_TREE; } } @@ -872,8 +898,9 @@ vect_compute_data_ref_alignment (struct data_reference *dr) if (dr_step % GET_MODE_SIZE (TYPE_MODE (vectype)) != 0) { - if (vect_print_dump_info (REPORT_ALIGNMENT)) - fprintf (vect_dump, "SLP: step doesn't divide the vector-size."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "SLP: step doesn't divide the vector-size."); misalign = NULL_TREE; } } @@ -884,10 +911,11 @@ vect_compute_data_ref_alignment (struct data_reference *dr) if ((aligned_to && tree_int_cst_compare (aligned_to, alignment) < 0) || !misalign) { - if (vect_print_dump_info (REPORT_ALIGNMENT)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Unknown alignment for access: "); - print_generic_expr (vect_dump, base, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Unknown alignment for access: "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, base); } return true; } @@ -913,10 +941,11 @@ vect_compute_data_ref_alignment (struct data_reference *dr) if (!vect_can_force_dr_alignment_p (base, TYPE_ALIGN (vectype)) || (TREE_STATIC (base) && flag_section_anchors)) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "can't force alignment of ref: "); - print_generic_expr (vect_dump, ref, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "can't force alignment of ref: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, ref); } return true; } @@ -924,10 +953,10 @@ vect_compute_data_ref_alignment (struct data_reference *dr) /* Force the alignment of the decl. NOTE: This is the only change to the code we make during the analysis phase, before deciding to vectorize the loop. */ - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "force alignment of "); - print_generic_expr (vect_dump, ref, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "force alignment of "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, ref); } DECL_ALIGN (base) = TYPE_ALIGN (vectype); @@ -958,17 +987,19 @@ vect_compute_data_ref_alignment (struct data_reference *dr) if (!host_integerp (misalign, 1)) { /* Negative or overflowed misalignment value. */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "unexpected misalign value"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unexpected misalign value"); return false; } SET_DR_MISALIGNMENT (dr, TREE_INT_CST_LOW (misalign)); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "misalign = %d bytes of ref ", DR_MISALIGNMENT (dr)); - print_generic_expr (vect_dump, ref, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "misalign = %d bytes of ref ", DR_MISALIGNMENT (dr)); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, ref); } return true; @@ -1064,8 +1095,8 @@ vect_update_misalignment_for_peel (struct data_reference *dr, return; } - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Setting misalignment to -1."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "Setting misalignment to -1."); SET_DR_MISALIGNMENT (dr, -1); } @@ -1111,22 +1142,25 @@ vect_verify_datarefs_alignment (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) supportable_dr_alignment = vect_supportable_dr_alignment (dr, false); if (!supportable_dr_alignment) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { if (DR_IS_READ (dr)) - fprintf (vect_dump, - "not vectorized: unsupported unaligned load."); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unsupported unaligned load."); else - fprintf (vect_dump, - "not vectorized: unsupported unaligned store."); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unsupported unaligned " + "store."); - print_generic_expr (vect_dump, DR_REF (dr), TDF_SLIM); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + DR_REF (dr)); } return false; } if (supportable_dr_alignment != dr_aligned - && vect_print_dump_info (REPORT_ALIGNMENT)) - fprintf (vect_dump, "Vectorizing an unaligned access."); + && dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Vectorizing an unaligned access."); } return true; } @@ -1181,15 +1215,18 @@ vector_alignment_reachable_p (struct data_reference *dr) { HOST_WIDE_INT elmsize = int_cst_value (TYPE_SIZE_UNIT (TREE_TYPE (vectype))); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "data size =" HOST_WIDE_INT_PRINT_DEC, elmsize); - fprintf (vect_dump, ". misalignment = %d. ", DR_MISALIGNMENT (dr)); + dump_printf_loc (MSG_NOTE, vect_location, + "data size =" HOST_WIDE_INT_PRINT_DEC, elmsize); + dump_printf (MSG_NOTE, + ". misalignment = %d. ", DR_MISALIGNMENT (dr)); } if (DR_MISALIGNMENT (dr) % elmsize) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "data size does not divide the misalignment.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "data size does not divide the misalignment.\n"); return false; } } @@ -1198,8 +1235,9 @@ vector_alignment_reachable_p (struct data_reference *dr) { tree type = TREE_TYPE (DR_REF (dr)); bool is_packed = not_size_aligned (DR_REF (dr)); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Unknown misalignment, is_packed = %d",is_packed); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Unknown misalignment, is_packed = %d",is_packed); if (targetm.vectorize.vector_alignment_reachable (type, is_packed)) return true; else @@ -1231,9 +1269,10 @@ vect_get_data_access_cost (struct data_reference *dr, else vect_get_store_cost (dr, ncopies, inside_cost, body_cost_vec); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_get_data_access_cost: inside_cost = %d, " - "outside_cost = %d.", *inside_cost, *outside_cost); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_get_data_access_cost: inside_cost = %d, " + "outside_cost = %d.", *inside_cost, *outside_cost); } @@ -1528,8 +1567,9 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) unsigned int nelements, mis, same_align_drs_max = 0; stmt_vector_for_cost body_cost_vec = NULL; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_enhance_data_refs_alignment ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_enhance_data_refs_alignment ==="); /* While cost model enhancements are expected in the future, the high level view of the code at this time is as follows: @@ -1582,8 +1622,9 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) and so we can't generate the new base for the pointer. */ if (STMT_VINFO_STRIDE_LOAD_P (stmt_info)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "strided load prevents peeling"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "strided load prevents peeling"); do_peeling = false; break; } @@ -1697,9 +1738,9 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) { if (!aligned_access_p (dr)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vector alignment may not be reachable"); - + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "vector alignment may not be reachable"); break; } } @@ -1838,8 +1879,9 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) if (STMT_VINFO_GROUPED_ACCESS (stmt_info)) npeel /= GROUP_SIZE (stmt_info); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Try peeling by %d", npeel); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Try peeling by %d", npeel); } /* Ensure that all data refs can be vectorized after the peel. */ @@ -1909,12 +1951,13 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) else LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo) = DR_MISALIGNMENT (dr0); SET_DR_MISALIGNMENT (dr0, 0); - if (vect_print_dump_info (REPORT_ALIGNMENT)) - fprintf (vect_dump, "Alignment of access forced using peeling."); - - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Peeling for alignment will be applied."); - + if (dump_kind_p (MSG_NOTE)) + { + dump_printf_loc (MSG_NOTE, vect_location, + "Alignment of access forced using peeling."); + dump_printf_loc (MSG_NOTE, vect_location, + "Peeling for alignment will be applied."); + } /* We've delayed passing the inside-loop peeling costs to the target cost model until we were sure peeling would happen. Do so now. */ @@ -2034,12 +2077,14 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) stmt_vec_info stmt_info = vinfo_for_stmt (stmt); dr = STMT_VINFO_DATA_REF (stmt_info); SET_DR_MISALIGNMENT (dr, 0); - if (vect_print_dump_info (REPORT_ALIGNMENT)) - fprintf (vect_dump, "Alignment of access forced using versioning."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Alignment of access forced using versioning."); } - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Versioning for alignment will be applied."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Versioning for alignment will be applied."); /* Peeling and versioning can't be done together at this time. */ gcc_assert (! (do_peeling && do_versioning)); @@ -2103,8 +2148,9 @@ vect_find_same_alignment_drs (struct data_dependence_relation *ddr, { int dist = dist_v[loop_depth]; - if (vect_print_dump_info (REPORT_DR_DETAILS)) - fprintf (vect_dump, "dependence distance = %d.", dist); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "dependence distance = %d.", dist); /* Same loop iteration. */ if (dist == 0 @@ -2113,14 +2159,15 @@ vect_find_same_alignment_drs (struct data_dependence_relation *ddr, /* Two references with distance zero have the same alignment. */ VEC_safe_push (dr_p, heap, STMT_VINFO_SAME_ALIGN_REFS (stmtinfo_a), drb); VEC_safe_push (dr_p, heap, STMT_VINFO_SAME_ALIGN_REFS (stmtinfo_b), dra); - if (vect_print_dump_info (REPORT_ALIGNMENT)) - fprintf (vect_dump, "accesses have the same alignment."); - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "dependence distance modulo vf == 0 between "); - print_generic_expr (vect_dump, DR_REF (dra), TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, DR_REF (drb), TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "accesses have the same alignment."); + dump_printf (MSG_NOTE, + "dependence distance modulo vf == 0 between "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra)); + dump_printf (MSG_NOTE, " and "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb)); } } } @@ -2136,8 +2183,9 @@ bool vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_analyze_data_refs_alignment ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_analyze_data_refs_alignment ==="); /* Mark groups of data references with same alignment using data dependence information. */ @@ -2153,9 +2201,10 @@ vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo, if (!vect_compute_data_refs_alignment (loop_vinfo, bb_vinfo)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, - "not vectorized: can't calculate alignment for data ref."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: can't calculate alignment " + "for data ref."); return false; } @@ -2205,24 +2254,27 @@ vect_analyze_group_access (struct data_reference *dr) { GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) = stmt; GROUP_SIZE (vinfo_for_stmt (stmt)) = groupsize; - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Detected single element interleaving "); - print_generic_expr (vect_dump, DR_REF (dr), TDF_SLIM); - fprintf (vect_dump, " step "); - print_generic_expr (vect_dump, step, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "Detected single element interleaving "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dr)); + dump_printf (MSG_NOTE, " step "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, step); } if (loop_vinfo) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Data access with gaps requires scalar " - "epilogue loop"); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Data access with gaps requires scalar " + "epilogue loop"); if (loop->inner) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Peeling for outer loop is not" - " supported"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Peeling for outer loop is not" + " supported"); return false; } @@ -2232,10 +2284,11 @@ vect_analyze_group_access (struct data_reference *dr) return true; } - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "not consecutive access "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not consecutive access "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } if (bb_vinfo) @@ -2244,7 +2297,7 @@ vect_analyze_group_access (struct data_reference *dr) STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (DR_STMT (dr))) = false; return true; } - + return false; } @@ -2271,8 +2324,9 @@ vect_analyze_group_access (struct data_reference *dr) { if (DR_IS_WRITE (data_ref)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Two store stmts share the same dr."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Two store stmts share the same dr."); return false; } @@ -2281,9 +2335,9 @@ vect_analyze_group_access (struct data_reference *dr) if (GROUP_READ_WRITE_DEPENDENCE (vinfo_for_stmt (next)) || GROUP_READ_WRITE_DEPENDENCE (vinfo_for_stmt (prev))) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, - "READ_WRITE dependence in interleaving."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "READ_WRITE dependence in interleaving."); return false; } @@ -2301,8 +2355,9 @@ vect_analyze_group_access (struct data_reference *dr) next_step = DR_STEP (STMT_VINFO_DATA_REF (vinfo_for_stmt (next))); if (tree_int_cst_compare (step, next_step)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "not consecutive access in interleaving"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not consecutive access in interleaving"); return false; } @@ -2317,8 +2372,9 @@ vect_analyze_group_access (struct data_reference *dr) slp_impossible = true; if (DR_IS_WRITE (data_ref)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "interleaved store with gaps"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "interleaved store with gaps"); return false; } @@ -2345,10 +2401,11 @@ vect_analyze_group_access (struct data_reference *dr) greater than STEP. */ if (dr_step && dr_step < count_in_bytes + gaps * type_size) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "interleaving size is greater than step for "); - print_generic_expr (vect_dump, DR_REF (dr), TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "interleaving size is greater than step for "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, DR_REF (dr)); } return false; } @@ -2367,8 +2424,9 @@ vect_analyze_group_access (struct data_reference *dr) } else { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "interleaved store with gaps"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "interleaved store with gaps"); return false; } } @@ -2376,13 +2434,14 @@ vect_analyze_group_access (struct data_reference *dr) /* Check that STEP is a multiple of type size. */ if (dr_step && (dr_step % type_size) != 0) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "step is not a multiple of type size: step "); - print_generic_expr (vect_dump, step, TDF_SLIM); - fprintf (vect_dump, " size "); - print_generic_expr (vect_dump, TYPE_SIZE_UNIT (scalar_type), - TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "step is not a multiple of type size: step "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, step); + dump_printf (MSG_MISSED_OPTIMIZATION, " size "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + TYPE_SIZE_UNIT (scalar_type)); } return false; } @@ -2391,8 +2450,9 @@ vect_analyze_group_access (struct data_reference *dr) groupsize = count; GROUP_SIZE (vinfo_for_stmt (stmt)) = groupsize; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Detected interleaving of size %d", (int)groupsize); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Detected interleaving of size %d", (int)groupsize); /* SLP: create an SLP data structure for every interleaving group of stores for further analysis in vect_analyse_slp. */ @@ -2409,13 +2469,15 @@ vect_analyze_group_access (struct data_reference *dr) /* There is a gap in the end of the group. */ if (groupsize - last_accessed_element > 0 && loop_vinfo) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Data access with gaps requires scalar " - "epilogue loop"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Data access with gaps requires scalar " + "epilogue loop"); if (loop->inner) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Peeling for outer loop is not supported"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Peeling for outer loop is not supported"); return false; } @@ -2446,8 +2508,9 @@ vect_analyze_data_ref_access (struct data_reference *dr) if (loop_vinfo && !step) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bad data-ref access in loop"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bad data-ref access in loop"); return false; } @@ -2468,8 +2531,9 @@ vect_analyze_data_ref_access (struct data_reference *dr) step = STMT_VINFO_DR_STEP (stmt_info); if (integer_zerop (step)) { - if (vect_print_dump_info (REPORT_ALIGNMENT)) - fprintf (vect_dump, "zero step in outer loop."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "zero step in outer loop."); if (DR_IS_READ (dr)) return true; else @@ -2493,8 +2557,9 @@ vect_analyze_data_ref_access (struct data_reference *dr) if (loop && nested_in_vect_loop_p (loop, stmt)) { - if (vect_print_dump_info (REPORT_ALIGNMENT)) - fprintf (vect_dump, "grouped access in outer loop."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "grouped access in outer loop."); return false; } @@ -2523,8 +2588,9 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) VEC (data_reference_p, heap) *datarefs; struct data_reference *dr; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_analyze_data_ref_accesses ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_analyze_data_ref_accesses ==="); if (loop_vinfo) datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); @@ -2535,8 +2601,9 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) if (STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (DR_STMT (dr))) && !vect_analyze_data_ref_access (dr)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: complicated access pattern."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: complicated access pattern."); if (bb_vinfo) { @@ -2564,8 +2631,9 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo) LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo); unsigned i, j; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_prune_runtime_alias_test_list ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_prune_runtime_alias_test_list ==="); for (i = 0; i < VEC_length (ddr_p, ddrs); ) { @@ -2581,16 +2649,17 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo) if (vect_vfa_range_equal (ddr_i, ddr_j)) { - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "found equal ranges "); - print_generic_expr (vect_dump, DR_REF (DDR_A (ddr_i)), TDF_SLIM); - fprintf (vect_dump, ", "); - print_generic_expr (vect_dump, DR_REF (DDR_B (ddr_i)), TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, DR_REF (DDR_A (ddr_j)), TDF_SLIM); - fprintf (vect_dump, ", "); - print_generic_expr (vect_dump, DR_REF (DDR_B (ddr_j)), TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "found equal ranges "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_A (ddr_i))); + dump_printf (MSG_NOTE, ", "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_B (ddr_i))); + dump_printf (MSG_NOTE, " and "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_A (ddr_j))); + dump_printf (MSG_NOTE, ", "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_B (ddr_j))); } found = true; break; @@ -2608,11 +2677,11 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo) if (VEC_length (ddr_p, ddrs) > (unsigned) PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS)) { - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "disable versioning for alias - max number of generated " - "checks exceeded."); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "disable versioning for alias - max number of " + "generated checks exceeded."); } VEC_truncate (ddr_p, LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo), 0); @@ -2895,8 +2964,9 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, tree scalar_type; bool res, stop_bb_analysis = false; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_analyze_data_refs ===\n"); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_analyze_data_refs ===\n"); if (loop_vinfo) { @@ -2909,9 +2979,10 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (!res) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: loop contains function calls" - " or data references that cannot be analyzed"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: loop contains function calls" + " or data references that cannot be analyzed"); return false; } @@ -2940,9 +3011,11 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (!compute_all_dependences (BB_VINFO_DATAREFS (bb_vinfo), &BB_VINFO_DDRS (bb_vinfo), NULL, true)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: basic block contains function" - " calls or data references that cannot be analyzed"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: basic block contains function" + " calls or data references that cannot be" + " analyzed"); return false; } @@ -2962,9 +3035,9 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (!dr || !DR_REF (dr)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: unhandled data-ref "); - + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unhandled data-ref "); return false; } @@ -3008,11 +3081,12 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (!gather) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "not vectorized: data ref analysis " - "failed "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: data ref analysis " + "failed "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } if (bb_vinfo) @@ -3028,9 +3102,10 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (TREE_CODE (DR_BASE_ADDRESS (dr)) == INTEGER_CST) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: base addr of dr is a " - "constant"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: base addr of dr is a " + "constant"); if (bb_vinfo) { @@ -3046,10 +3121,11 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (TREE_THIS_VOLATILE (DR_REF (dr))) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "not vectorized: volatile type "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: volatile type "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } if (bb_vinfo) @@ -3064,11 +3140,12 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (stmt_can_throw_internal (stmt)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "not vectorized: statement can throw an " - "exception "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: statement can throw an " + "exception "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } if (bb_vinfo) @@ -3086,11 +3163,12 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (TREE_CODE (DR_REF (dr)) == COMPONENT_REF && DECL_BIT_FIELD (TREE_OPERAND (DR_REF (dr), 1))) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "not vectorized: statement is bitfield " - "access "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: statement is bitfield " + "access "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } if (bb_vinfo) @@ -3111,10 +3189,11 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (is_gimple_call (stmt)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "not vectorized: dr in a call "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: dr in a call "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } if (bb_vinfo) @@ -3153,10 +3232,11 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, tree inner_base = build_fold_indirect_ref (fold_build_pointer_plus (base, init)); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "analyze in outer-loop: "); - print_generic_expr (vect_dump, inner_base, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "analyze in outer-loop: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, inner_base); } outer_base = get_inner_reference (inner_base, &pbitsize, &pbitpos, @@ -3165,8 +3245,9 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (pbitpos % BITS_PER_UNIT != 0) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "failed: bit offset alignment.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "failed: bit offset alignment.\n"); return false; } @@ -3174,8 +3255,9 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (!simple_iv (loop, loop_containing_stmt (stmt), outer_base, &base_iv, false)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "failed: evolution of base is not affine.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "failed: evolution of base is not affine.\n"); return false; } @@ -3196,8 +3278,9 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, else if (!simple_iv (loop, loop_containing_stmt (stmt), poffset, &offset_iv, false)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "evolution of offset is not affine.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "evolution of offset is not affine.\n"); return false; } @@ -3220,28 +3303,36 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, STMT_VINFO_DR_ALIGNED_TO (stmt_info) = size_int (highest_pow2_factor (offset_iv.base)); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "\touter base_address: "); - print_generic_expr (vect_dump, STMT_VINFO_DR_BASE_ADDRESS (stmt_info), TDF_SLIM); - fprintf (vect_dump, "\n\touter offset from base address: "); - print_generic_expr (vect_dump, STMT_VINFO_DR_OFFSET (stmt_info), TDF_SLIM); - fprintf (vect_dump, "\n\touter constant offset from base address: "); - print_generic_expr (vect_dump, STMT_VINFO_DR_INIT (stmt_info), TDF_SLIM); - fprintf (vect_dump, "\n\touter step: "); - print_generic_expr (vect_dump, STMT_VINFO_DR_STEP (stmt_info), TDF_SLIM); - fprintf (vect_dump, "\n\touter aligned to: "); - print_generic_expr (vect_dump, STMT_VINFO_DR_ALIGNED_TO (stmt_info), TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "\touter base_address: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, + STMT_VINFO_DR_BASE_ADDRESS (stmt_info)); + dump_printf (MSG_NOTE, "\n\touter offset from base address: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, + STMT_VINFO_DR_OFFSET (stmt_info)); + dump_printf (MSG_NOTE, + "\n\touter constant offset from base address: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, + STMT_VINFO_DR_INIT (stmt_info)); + dump_printf (MSG_NOTE, "\n\touter step: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, + STMT_VINFO_DR_STEP (stmt_info)); + dump_printf (MSG_NOTE, "\n\touter aligned to: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, + STMT_VINFO_DR_ALIGNED_TO (stmt_info)); } } if (STMT_VINFO_DATA_REF (stmt_info)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "not vectorized: more than one data ref in stmt: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: more than one data ref " + "in stmt: "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } if (bb_vinfo) @@ -3264,13 +3355,14 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, get_vectype_for_scalar_type (scalar_type); if (!STMT_VINFO_VECTYPE (stmt_info)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "not vectorized: no vectype for stmt: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); - fprintf (vect_dump, " scalar_type: "); - print_generic_expr (vect_dump, scalar_type, TDF_DETAILS); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: no vectype for stmt: "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); + dump_printf (MSG_MISSED_OPTIMIZATION, " scalar_type: "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_DETAILS, + scalar_type); } if (bb_vinfo) @@ -3314,11 +3406,12 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, { STMT_VINFO_DATA_REF (stmt_info) = NULL; free_data_ref (dr); - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "not vectorized: not suitable for gather load "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: not suitable for gather " + "load "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } return false; } @@ -3366,12 +3459,12 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (bad) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "not vectorized: data dependence conflict" - " prevents gather load"); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: data dependence conflict" + " prevents gather load"); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } return false; } @@ -3387,11 +3480,12 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, = vect_check_strided_load (stmt, loop_vinfo, NULL, NULL); if (!strided_load) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "not vectorized: not suitable for strided load "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: not suitable for strided " + "load "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } return false; } @@ -3574,10 +3668,10 @@ vect_create_addr_base_for_vector_ref (gimple stmt, mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (vec_stmt)); } - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "created "); - print_generic_expr (vect_dump, vec_stmt, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "created "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, vec_stmt); } return vec_stmt; @@ -3696,20 +3790,21 @@ vect_create_data_ref_ptr (gimple stmt, tree aggr_type, struct loop *at_loop, in LOOP. */ base_name = build_fold_indirect_ref (unshare_expr (DR_BASE_ADDRESS (dr))); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { tree data_ref_base = base_name; - fprintf (vect_dump, "create %s-pointer variable to type: ", - tree_code_name[(int) TREE_CODE (aggr_type)]); - print_generic_expr (vect_dump, aggr_type, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "create %s-pointer variable to type: ", + tree_code_name[(int) TREE_CODE (aggr_type)]); + dump_generic_expr (MSG_NOTE, TDF_SLIM, aggr_type); if (TREE_CODE (data_ref_base) == VAR_DECL || TREE_CODE (data_ref_base) == ARRAY_REF) - fprintf (vect_dump, " vectorizing an array ref: "); + dump_printf (MSG_NOTE, " vectorizing an array ref: "); else if (TREE_CODE (data_ref_base) == COMPONENT_REF) - fprintf (vect_dump, " vectorizing a record based array ref: "); + dump_printf (MSG_NOTE, " vectorizing a record based array ref: "); else if (TREE_CODE (data_ref_base) == SSA_NAME) - fprintf (vect_dump, " vectorizing a pointer ref: "); - print_generic_expr (vect_dump, base_name, TDF_SLIM); + dump_printf (MSG_NOTE, " vectorizing a pointer ref: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, base_name); } /* (1) Create the new aggregate-pointer variable. */ @@ -4025,9 +4120,10 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count) /* vect_permute_store_chain requires the group size to be a power of two. */ if (exact_log2 (count) == -1) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "the size of the group of accesses" - " is not a power of 2"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "the size of the group of accesses" + " is not a power of 2"); return false; } @@ -4050,8 +4146,9 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count) } } - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "interleave op not supported by target."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf (MSG_MISSED_OPTIMIZATION, + "interleave op not supported by target."); return false; } @@ -4467,9 +4564,10 @@ vect_grouped_load_supported (tree vectype, unsigned HOST_WIDE_INT count) /* vect_permute_load_chain requires the group size to be a power of two. */ if (exact_log2 (count) == -1) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "the size of the group of accesses" - " is not a power of 2"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "the size of the group of accesses" + " is not a power of 2"); return false; } @@ -4490,8 +4588,9 @@ vect_grouped_load_supported (tree vectype, unsigned HOST_WIDE_INT count) } } - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "extract even/odd not supported by target"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "extract even/odd not supported by target"); return false; } diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index f480953..d9b3040 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" +#include "dumpfile.h" #include "tm.h" #include "ggc.h" #include "tree.h" @@ -791,14 +792,12 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters) free_stmt_vec_info (orig_cond); loop_loc = find_loop_location (loop); - if (dump_file && (dump_flags & TDF_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - if (loop_loc != UNKNOWN_LOC) - fprintf (dump_file, "\nloop at %s:%d: ", - LOC_FILE (loop_loc), LOC_LINE (loop_loc)); - print_gimple_stmt (dump_file, cond_stmt, 0, TDF_SLIM); + dump_printf (MSG_NOTE, "\nloop at %s:%d: ", LOC_FILE (loop_loc), + LOC_LINE (loop_loc)); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, cond_stmt, 0); } - loop->nb_iterations = niters; } @@ -1246,13 +1245,8 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop, if (!(new_loop = slpeel_tree_duplicate_loop_to_edge_cfg (loop, e))) { loop_loc = find_loop_location (loop); - if (dump_file && (dump_flags & TDF_DETAILS)) - { - if (loop_loc != UNKNOWN_LOC) - fprintf (dump_file, "\n%s:%d: note: ", - LOC_FILE (loop_loc), LOC_LINE (loop_loc)); - fprintf (dump_file, "tree_duplicate_loop_to_edge_cfg failed.\n"); - } + dump_printf_loc (MSG_MISSED_OPTIMIZATION, loop_loc, + "tree_duplicate_loop_to_edge_cfg failed.\n"); return NULL; } @@ -1688,19 +1682,18 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo) /* Analyze phi functions of the loop header. */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vect_can_advance_ivs_p:"); - + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "vect_can_advance_ivs_p:"); for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { tree access_fn = NULL; tree evolution_part; phi = gsi_stmt (gsi); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Analyze phi: "); - print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "Analyze phi: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0); } /* Skip virtual phi's. The data dependences that are associated with @@ -1708,8 +1701,9 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo) if (virtual_operand_p (PHI_RESULT (phi))) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "virtual phi. skip."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "virtual phi. skip."); continue; } @@ -1717,8 +1711,9 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo) if (STMT_VINFO_DEF_TYPE (vinfo_for_stmt (phi)) == vect_reduction_def) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "reduc phi. skip."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "reduc phi. skip."); continue; } @@ -1729,23 +1724,25 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo) if (!access_fn) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "No Access function."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "No Access function."); return false; } - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Access function of PHI: "); - print_generic_expr (vect_dump, access_fn, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "Access function of PHI: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, access_fn); } evolution_part = evolution_part_in_loop_num (access_fn, loop->num); if (evolution_part == NULL_TREE) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "No evolution."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf (MSG_MISSED_OPTIMIZATION, "No evolution."); return false; } @@ -1829,17 +1826,19 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters, phi = gsi_stmt (gsi); phi1 = gsi_stmt (gsi1); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "vect_update_ivs_after_vectorizer: phi: "); - print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "vect_update_ivs_after_vectorizer: phi: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0); } /* Skip virtual phi's. */ if (virtual_operand_p (PHI_RESULT (phi))) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "virtual phi. skip."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "virtual phi. skip."); continue; } @@ -1847,8 +1846,9 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters, stmt_info = vinfo_for_stmt (phi); if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "reduc phi. skip."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "reduc phi. skip."); continue; } @@ -1909,8 +1909,9 @@ vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo, tree *ratio, tree cond_expr = NULL_TREE; gimple_seq cond_expr_stmt_list = NULL; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_do_peeling_for_loop_bound ==="); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "=== vect_do_peeling_for_loop_bound ==="); initialize_original_copy_tables (); @@ -1956,9 +1957,9 @@ vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo, tree *ratio, if (check_profitability) max_iter = MAX (max_iter, (int) th); record_niter_bound (new_loop, double_int::from_shwi (max_iter), false, true); - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "Setting upper bound of nb iterations for epilogue " - "loop to %d\n", max_iter); + dump_printf (MSG_OPTIMIZED_LOCATIONS, + "Setting upper bound of nb iterations for epilogue " + "loop to %d\n", max_iter); /* After peeling we have to reset scalar evolution analyzer. */ scev_reset (); @@ -2020,8 +2021,9 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters, int { int npeel = LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "known peeling = %d.", npeel); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "known peeling = %d.", npeel); iters = build_int_cst (niters_type, npeel); *bound = LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo); @@ -2073,10 +2075,11 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters, int if (TREE_CODE (loop_niters) != INTEGER_CST) iters = fold_build2 (MIN_EXPR, niters_type, iters, loop_niters); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) { - fprintf (vect_dump, "niters for prolog loop: "); - print_generic_expr (vect_dump, iters, TDF_SLIM); + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "niters for prolog loop: "); + dump_generic_expr (MSG_OPTIMIZED_LOCATIONS, TDF_SLIM, iters); } var = create_tmp_var (niters_type, "prolog_loop_niters"); @@ -2129,9 +2132,10 @@ vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters) unsigned int i; VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); struct data_reference *dr; - - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_update_inits_of_dr ==="); + + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "=== vect_update_inits_of_dr ==="); FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr) vect_update_init_of_dr (dr, niters); @@ -2158,8 +2162,9 @@ vect_do_peeling_for_alignment (loop_vec_info loop_vinfo, int max_iter; int bound = 0; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_do_peeling_for_alignment ==="); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "=== vect_do_peeling_for_alignment ==="); initialize_original_copy_tables (); @@ -2184,9 +2189,9 @@ vect_do_peeling_for_alignment (loop_vec_info loop_vinfo, if (check_profitability) max_iter = MAX (max_iter, (int) th); record_niter_bound (new_loop, double_int::from_shwi (max_iter), false, true); - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "Setting upper bound of nb iterations for prologue " - "loop to %d\n", max_iter); + dump_printf (MSG_OPTIMIZED_LOCATIONS, + "Setting upper bound of nb iterations for prologue " + "loop to %d\n", max_iter); /* Update number of times loop executes. */ n_iters = LOOP_VINFO_NITERS (loop_vinfo); @@ -2469,13 +2474,13 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo, segment_length_a = vect_vfa_segment_size (dr_a, length_factor); segment_length_b = vect_vfa_segment_size (dr_b, length_factor); - if (vect_print_dump_info (REPORT_DR_DETAILS)) + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) { - fprintf (vect_dump, - "create runtime check for data references "); - print_generic_expr (vect_dump, DR_REF (dr_a), TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, DR_REF (dr_b), TDF_SLIM); + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "create runtime check for data references "); + dump_generic_expr (MSG_OPTIMIZED_LOCATIONS, TDF_SLIM, DR_REF (dr_a)); + dump_printf (MSG_OPTIMIZED_LOCATIONS, " and "); + dump_generic_expr (MSG_OPTIMIZED_LOCATIONS, TDF_SLIM, DR_REF (dr_b)); } seg_a_min = addr_base_a; @@ -2500,9 +2505,10 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo, *cond_expr = part_cond_expr; } - if (vect_print_dump_info (REPORT_VECTORIZED_LOCATIONS)) - fprintf (vect_dump, "created %u versioning for alias checks.\n", - VEC_length (ddr_p, may_alias_ddrs)); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "created %u versioning for alias checks.\n", + VEC_length (ddr_p, may_alias_ddrs)); } diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 728bc0f..d01203e 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" +#include "dumpfile.h" #include "tm.h" #include "ggc.h" #include "tree.h" @@ -184,8 +185,9 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) gimple_stmt_iterator pattern_def_si = gsi_none (); bool analyze_pattern_stmt = false; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_determine_vectorization_factor ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_determine_vectorization_factor ==="); for (i = 0; i < nbbs; i++) { @@ -195,10 +197,10 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) { phi = gsi_stmt (si); stmt_info = vinfo_for_stmt (phi); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "==> examining phi: "); - print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "==> examining phi: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0); } gcc_assert (stmt_info); @@ -208,34 +210,37 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) gcc_assert (!STMT_VINFO_VECTYPE (stmt_info)); scalar_type = TREE_TYPE (PHI_RESULT (phi)); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "get vectype for scalar type: "); - print_generic_expr (vect_dump, scalar_type, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "get vectype for scalar type: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, scalar_type); } vectype = get_vectype_for_scalar_type (scalar_type); if (!vectype) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "not vectorized: unsupported data-type "); - print_generic_expr (vect_dump, scalar_type, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unsupported " + "data-type "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + scalar_type); } return false; } STMT_VINFO_VECTYPE (stmt_info) = vectype; - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "vectype: "); - print_generic_expr (vect_dump, vectype, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "vectype: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, vectype); } nunits = TYPE_VECTOR_SUBPARTS (vectype); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "nunits = %d", nunits); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "nunits = %d", nunits); if (!vectorization_factor || (nunits > vectorization_factor)) @@ -254,10 +259,11 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) stmt_info = vinfo_for_stmt (stmt); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "==> examining statement: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "==> examining statement: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); } gcc_assert (stmt_info); @@ -273,16 +279,17 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) { stmt = pattern_stmt; stmt_info = vinfo_for_stmt (pattern_stmt); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "==> examining pattern statement: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "==> examining pattern statement: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); } } else { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "skip."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "skip."); gsi_next (&si); continue; } @@ -321,12 +328,12 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) if (!gsi_end_p (pattern_def_si)) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, - "==> examining pattern def stmt: "); - print_gimple_stmt (vect_dump, pattern_def_stmt, 0, - TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "==> examining pattern def stmt: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, + pattern_def_stmt, 0); } stmt = pattern_def_stmt; @@ -344,20 +351,23 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) if (gimple_get_lhs (stmt) == NULL_TREE) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "not vectorized: irregular stmt."); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: irregular stmt."); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, + 0); } return false; } if (VECTOR_MODE_P (TYPE_MODE (gimple_expr_type (stmt)))) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "not vectorized: vector stmt in loop:"); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: vector stmt in loop:"); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } return false; } @@ -377,19 +387,22 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) { gcc_assert (!STMT_VINFO_DATA_REF (stmt_info)); scalar_type = TREE_TYPE (gimple_get_lhs (stmt)); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "get vectype for scalar type: "); - print_generic_expr (vect_dump, scalar_type, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "get vectype for scalar type: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, scalar_type); } vectype = get_vectype_for_scalar_type (scalar_type); if (!vectype) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "not vectorized: unsupported data-type "); - print_generic_expr (vect_dump, scalar_type, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unsupported " + "data-type "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + scalar_type); } return false; } @@ -402,19 +415,21 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) support one vector size per loop). */ scalar_type = vect_get_smallest_scalar_type (stmt, &dummy, &dummy); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "get vectype for scalar type: "); - print_generic_expr (vect_dump, scalar_type, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "get vectype for scalar type: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, scalar_type); } vf_vectype = get_vectype_for_scalar_type (scalar_type); if (!vf_vectype) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "not vectorized: unsupported data-type "); - print_generic_expr (vect_dump, scalar_type, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unsupported data-type "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + scalar_type); } return false; } @@ -422,28 +437,29 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) if ((GET_MODE_SIZE (TYPE_MODE (vectype)) != GET_MODE_SIZE (TYPE_MODE (vf_vectype)))) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "not vectorized: different sized vector " - "types in statement, "); - print_generic_expr (vect_dump, vectype, TDF_SLIM); - fprintf (vect_dump, " and "); - print_generic_expr (vect_dump, vf_vectype, TDF_SLIM); + 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, + vf_vectype); } return false; } - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "vectype: "); - print_generic_expr (vect_dump, vf_vectype, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "vectype: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, vf_vectype); } nunits = TYPE_VECTOR_SUBPARTS (vf_vectype); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "nunits = %d", nunits); - + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "nunits = %d", nunits); if (!vectorization_factor || (nunits > vectorization_factor)) vectorization_factor = nunits; @@ -457,12 +473,14 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) } /* TODO: Analyze cost. Decide if worth while to vectorize. */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vectorization factor = %d", vectorization_factor); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "vectorization factor = %d", + vectorization_factor); if (vectorization_factor <= 1) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: unsupported data-type"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unsupported data-type"); return false; } LOOP_VINFO_VECT_FACTOR (loop_vinfo) = vectorization_factor; @@ -497,12 +515,12 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init, step_expr = evolution_part; init_expr = unshare_expr (initial_condition_in_loop_num (access_fn, loop_nb)); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "step: "); - print_generic_expr (vect_dump, step_expr, TDF_SLIM); - fprintf (vect_dump, ", init: "); - print_generic_expr (vect_dump, init_expr, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "step: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, step_expr); + dump_printf (MSG_NOTE, ", init: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, init_expr); } *init = init_expr; @@ -510,8 +528,9 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init, if (TREE_CODE (step_expr) != INTEGER_CST) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "step unknown."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "step unknown."); return false; } @@ -534,8 +553,9 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop) gimple_stmt_iterator gsi; bool double_reduc; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_analyze_scalar_cycles ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_analyze_scalar_cycles ==="); /* First - identify all inductions. Reduction detection assumes that all the inductions have been identified, therefore, this order must not be @@ -547,10 +567,10 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop) tree def = PHI_RESULT (phi); stmt_vec_info stmt_vinfo = vinfo_for_stmt (phi); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Analyze phi: "); - print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "Analyze phi: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0); } /* Skip virtual phi's. The data dependences that are associated with @@ -565,10 +585,11 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop) if (access_fn) { STRIP_NOPS (access_fn); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Access function of PHI: "); - print_generic_expr (vect_dump, access_fn, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "Access function of PHI: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, access_fn); } STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_vinfo) = evolution_part_in_loop_num (access_fn, loop->num); @@ -583,8 +604,8 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop) gcc_assert (STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_vinfo) != NULL_TREE); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Detected induction."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "Detected induction."); STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_induction_def; } @@ -598,10 +619,10 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop) gimple reduc_stmt; bool nested_cycle; - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Analyze phi: "); - print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "Analyze phi: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0); } gcc_assert (!virtual_operand_p (def) @@ -614,8 +635,9 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop) { if (double_reduc) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Detected double reduction."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Detected double reduction."); STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_double_reduction_def; STMT_VINFO_DEF_TYPE (vinfo_for_stmt (reduc_stmt)) = @@ -625,8 +647,9 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop) { if (nested_cycle) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Detected vectorizable nested cycle."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Detected vectorizable nested cycle."); STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_nested_cycle; STMT_VINFO_DEF_TYPE (vinfo_for_stmt (reduc_stmt)) = @@ -634,8 +657,9 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop) } else { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Detected reduction."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Detected reduction."); STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_reduction_def; STMT_VINFO_DEF_TYPE (vinfo_for_stmt (reduc_stmt)) = @@ -649,8 +673,9 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop) } } else - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Unknown def-use cycle pattern."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Unknown def-use cycle pattern."); } VEC_free (gimple, heap, worklist); @@ -710,9 +735,9 @@ vect_get_loop_niters (struct loop *loop, tree *number_of_iterations) { tree niters; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== get_loop_niters ==="); - + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== get_loop_niters ==="); niters = number_of_exit_cond_executions (loop); if (niters != NULL_TREE @@ -720,10 +745,10 @@ vect_get_loop_niters (struct loop *loop, tree *number_of_iterations) { *number_of_iterations = niters; - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "==> get_loop_niters:" ); - print_generic_expr (vect_dump, *number_of_iterations, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "==> get_loop_niters:"); + dump_generic_expr (MSG_NOTE, TDF_SLIM, *number_of_iterations); } } @@ -968,16 +993,18 @@ vect_analyze_loop_1 (struct loop *loop) { loop_vec_info loop_vinfo; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "===== analyze_loop_nest_1 ====="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "===== analyze_loop_nest_1 ====="); /* Check the CFG characteristics of the loop (nesting, entry/exit, etc. */ loop_vinfo = vect_analyze_loop_form (loop); if (!loop_vinfo) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bad inner-loop form."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bad inner-loop form."); return NULL; } @@ -1001,8 +1028,9 @@ vect_analyze_loop_form (struct loop *loop) tree number_of_iterations = NULL; loop_vec_info inner_loop_vinfo = NULL; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_analyze_loop_form ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_analyze_loop_form ==="); /* Different restrictions apply when we are considering an inner-most loop, vs. an outer (nested) loop. @@ -1024,15 +1052,17 @@ vect_analyze_loop_form (struct loop *loop) if (loop->num_nodes != 2) { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) - fprintf (vect_dump, "not vectorized: control flow in loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: control flow in loop."); return NULL; } if (empty_block_p (loop->header)) { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) - fprintf (vect_dump, "not vectorized: empty loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: empty loop."); return NULL; } } @@ -1060,8 +1090,9 @@ vect_analyze_loop_form (struct loop *loop) if ((loop->inner)->inner || (loop->inner)->next) { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) - fprintf (vect_dump, "not vectorized: multiple nested loops."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: multiple nested loops."); return NULL; } @@ -1069,25 +1100,27 @@ vect_analyze_loop_form (struct loop *loop) inner_loop_vinfo = vect_analyze_loop_1 (loop->inner); if (!inner_loop_vinfo) { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) - fprintf (vect_dump, "not vectorized: Bad inner loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: Bad inner loop."); return NULL; } if (!expr_invariant_in_loop_p (loop, LOOP_VINFO_NITERS (inner_loop_vinfo))) { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) - fprintf (vect_dump, - "not vectorized: inner-loop count not invariant."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: inner-loop count not invariant."); destroy_loop_vec_info (inner_loop_vinfo, true); return NULL; } if (loop->num_nodes != 5) { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) - fprintf (vect_dump, "not vectorized: control flow in loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: control flow in loop."); destroy_loop_vec_info (inner_loop_vinfo, true); return NULL; } @@ -1101,25 +1134,29 @@ vect_analyze_loop_form (struct loop *loop) || !single_exit (innerloop) || single_exit (innerloop)->dest != EDGE_PRED (loop->latch, 0)->src) { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) - fprintf (vect_dump, "not vectorized: unsupported outerloop form."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unsupported outerloop form."); destroy_loop_vec_info (inner_loop_vinfo, true); return NULL; } - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Considering outer-loop vectorization."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Considering outer-loop vectorization."); } if (!single_exit (loop) || EDGE_COUNT (loop->header->preds) != 2) { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { if (!single_exit (loop)) - fprintf (vect_dump, "not vectorized: multiple exits."); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: multiple exits."); else if (EDGE_COUNT (loop->header->preds) != 2) - fprintf (vect_dump, "not vectorized: too many incoming edges."); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: too many incoming edges."); } if (inner_loop_vinfo) destroy_loop_vec_info (inner_loop_vinfo, true); @@ -1133,8 +1170,9 @@ vect_analyze_loop_form (struct loop *loop) if (!empty_block_p (loop->latch) || !gimple_seq_empty_p (phi_nodes (loop->latch))) { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) - fprintf (vect_dump, "not vectorized: unexpected loop form."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unexpected loop form."); if (inner_loop_vinfo) destroy_loop_vec_info (inner_loop_vinfo, true); return NULL; @@ -1147,13 +1185,14 @@ vect_analyze_loop_form (struct loop *loop) if (!(e->flags & EDGE_ABNORMAL)) { split_loop_exit_edge (e); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "split exit edge."); + if (dump_kind_p (MSG_NOTE)) + dump_printf (MSG_NOTE, "split exit edge."); } else { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) - fprintf (vect_dump, "not vectorized: abnormal loop exit edge."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: abnormal loop exit edge."); if (inner_loop_vinfo) destroy_loop_vec_info (inner_loop_vinfo, true); return NULL; @@ -1163,8 +1202,9 @@ vect_analyze_loop_form (struct loop *loop) loop_cond = vect_get_loop_niters (loop, &number_of_iterations); if (!loop_cond) { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) - fprintf (vect_dump, "not vectorized: complicated exit condition."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: complicated exit condition."); if (inner_loop_vinfo) destroy_loop_vec_info (inner_loop_vinfo, true); return NULL; @@ -1172,9 +1212,10 @@ vect_analyze_loop_form (struct loop *loop) if (!number_of_iterations) { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) - fprintf (vect_dump, - "not vectorized: number of iterations cannot be computed."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: number of iterations cannot be " + "computed."); if (inner_loop_vinfo) destroy_loop_vec_info (inner_loop_vinfo, true); return NULL; @@ -1182,8 +1223,9 @@ vect_analyze_loop_form (struct loop *loop) if (chrec_contains_undetermined (number_of_iterations)) { - if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS)) - fprintf (vect_dump, "Infinite number of iterations."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Infinite number of iterations."); if (inner_loop_vinfo) destroy_loop_vec_info (inner_loop_vinfo, true); return NULL; @@ -1191,16 +1233,18 @@ vect_analyze_loop_form (struct loop *loop) if (!NITERS_KNOWN_P (number_of_iterations)) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Symbolic number of iterations is "); - print_generic_expr (vect_dump, number_of_iterations, TDF_DETAILS); + dump_printf_loc (MSG_NOTE, vect_location, + "Symbolic number of iterations is "); + dump_generic_expr (MSG_NOTE, TDF_DETAILS, number_of_iterations); } } else if (TREE_INT_CST_LOW (number_of_iterations) == 0) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: number of iterations = 0."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: number of iterations = 0."); if (inner_loop_vinfo) destroy_loop_vec_info (inner_loop_vinfo, false); return NULL; @@ -1244,8 +1288,9 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp) bool only_slp_in_loop = true, ok; HOST_WIDE_INT max_niter; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_analyze_loop_operations ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_analyze_loop_operations ==="); gcc_assert (LOOP_VINFO_VECT_FACTOR (loop_vinfo)); vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo); @@ -1279,9 +1324,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp) LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo)); LOOP_VINFO_VECT_FACTOR (loop_vinfo) = vectorization_factor; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Updating vectorization factor to %d ", - vectorization_factor); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Updating vectorization factor to %d ", + vectorization_factor); } for (i = 0; i < nbbs; i++) @@ -1294,10 +1340,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp) ok = true; stmt_info = vinfo_for_stmt (phi); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "examining phi: "); - print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "examining phi: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0); } /* Inner-loop loop-closed exit phi in outer-loop vectorization @@ -1313,9 +1359,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp) && STMT_VINFO_DEF_TYPE (stmt_info) != vect_double_reduction_def) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, - "Unsupported loop-closed phi in outer-loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Unsupported loop-closed phi in " + "outer-loop."); return false; } @@ -1354,8 +1401,9 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp) if (STMT_VINFO_LIVE_P (stmt_info)) { /* FORNOW: not yet supported. */ - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: value used after loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: value used after loop."); return false; } @@ -1363,8 +1411,9 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp) && STMT_VINFO_DEF_TYPE (stmt_info) != vect_induction_def) { /* A scalar-dependence cycle that we don't support. */ - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: scalar dependence cycle."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: scalar dependence cycle."); return false; } @@ -1377,11 +1426,12 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp) if (!ok) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "not vectorized: relevant phi not supported: "); - print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: relevant phi not " + "supported: "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, phi, 0); } return false; } @@ -1402,31 +1452,35 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp) touching this loop. */ if (!need_to_vectorize) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, - "All the computation can be taken out of the loop."); - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, - "not vectorized: redundant loop. no profit to vectorize."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "All the computation can be taken out of the loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: redundant loop. no profit to " + "vectorize."); return false; } if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) - && vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, - "vectorization_factor = %d, niters = " HOST_WIDE_INT_PRINT_DEC, - vectorization_factor, LOOP_VINFO_INT_NITERS (loop_vinfo)); + && dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vectorization_factor = %d, niters = " + HOST_WIDE_INT_PRINT_DEC, vectorization_factor, + LOOP_VINFO_INT_NITERS (loop_vinfo)); if ((LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) && (LOOP_VINFO_INT_NITERS (loop_vinfo) < vectorization_factor)) || ((max_niter = max_stmt_executions_int (loop)) != -1 && (unsigned HOST_WIDE_INT) max_niter < vectorization_factor)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: iteration count too small."); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump,"not vectorized: iteration count smaller than " - "vectorization factor."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: iteration count too small."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: iteration count smaller than " + "vectorization factor."); return false; } @@ -1441,11 +1495,13 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp) if (min_profitable_iters < 0) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: vectorization not profitable."); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "not vectorized: vector version will never be " - "profitable."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: vectorization not profitable."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: vector version will never be " + "profitable."); return false; } @@ -1464,13 +1520,14 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp) if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) && LOOP_VINFO_INT_NITERS (loop_vinfo) <= th) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: vectorization not " - "profitable."); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "not vectorized: iteration count smaller than " - "user specified loop bound parameter or minimum " - "profitable iterations (whichever is more conservative)."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: vectorization not profitable."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "not vectorized: iteration count smaller than user " + "specified loop bound parameter or minimum profitable " + "iterations (whichever is more conservative)."); return false; } @@ -1478,20 +1535,20 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp) || LOOP_VINFO_INT_NITERS (loop_vinfo) % vectorization_factor != 0 || LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "epilog loop required."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "epilog loop required."); if (!vect_can_advance_ivs_p (loop_vinfo)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, - "not vectorized: can't create epilog loop 1."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: can't create epilog loop 1."); return false; } if (!slpeel_can_duplicate_loop_p (loop, single_exit (loop))) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, - "not vectorized: can't create epilog loop 2."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: can't create epilog loop 2."); return false; } } @@ -1522,8 +1579,9 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo) ok = vect_analyze_data_refs (loop_vinfo, NULL, &min_vf); if (!ok) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bad data references."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bad data references."); return false; } @@ -1539,8 +1597,9 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo) ok = vect_mark_stmts_to_be_vectorized (loop_vinfo); if (!ok) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "unexpected pattern."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unexpected pattern."); return false; } @@ -1553,22 +1612,25 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo) if (!ok || max_vf < min_vf) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bad data dependence."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bad data dependence."); return false; } ok = vect_determine_vectorization_factor (loop_vinfo); if (!ok) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "can't determine vectorization factor."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "can't determine vectorization factor."); return false; } if (max_vf < LOOP_VINFO_VECT_FACTOR (loop_vinfo)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bad data dependence."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bad data dependence."); return false; } @@ -1578,8 +1640,9 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo) ok = vect_analyze_data_refs_alignment (loop_vinfo, NULL); if (!ok) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bad data alignment."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bad data alignment."); return false; } @@ -1589,8 +1652,9 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo) ok = vect_analyze_data_ref_accesses (loop_vinfo, NULL); if (!ok) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bad data access."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bad data access."); return false; } @@ -1600,9 +1664,10 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo) ok = vect_prune_runtime_alias_test_list (loop_vinfo); if (!ok) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "too long list of versioning for alias " - "run-time tests."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "too long list of versioning for alias " + "run-time tests."); return false; } @@ -1612,8 +1677,9 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo) ok = vect_enhance_data_refs_alignment (loop_vinfo); if (!ok) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bad data alignment."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bad data alignment."); return false; } @@ -1636,8 +1702,9 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo) ok = vect_analyze_loop_operations (loop_vinfo, slp); if (!ok) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bad operation or unsupported loop bound."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bad operation or unsupported loop bound."); return false; } @@ -1659,15 +1726,17 @@ vect_analyze_loop (struct loop *loop) current_vector_size = 0; vector_sizes = targetm.vectorize.autovectorize_vector_sizes (); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "===== analyze_loop_nest ====="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "===== analyze_loop_nest ====="); if (loop_outer (loop) && loop_vec_info_for_loop (loop_outer (loop)) && LOOP_VINFO_VECTORIZABLE_P (loop_vec_info_for_loop (loop_outer (loop)))) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "outer-loop already vectorized."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "outer-loop already vectorized."); return NULL; } @@ -1677,8 +1746,9 @@ vect_analyze_loop (struct loop *loop) loop_vinfo = vect_analyze_loop_form (loop); if (!loop_vinfo) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bad loop form."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bad loop form."); return NULL; } @@ -1698,9 +1768,10 @@ vect_analyze_loop (struct loop *loop) /* Try the next biggest vector size. */ current_vector_size = 1 << floor_log2 (vector_sizes); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "***** Re-trying analysis with " - "vector size %d\n", current_vector_size); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "***** Re-trying analysis with " + "vector size %d\n", current_vector_size); } } @@ -1754,10 +1825,10 @@ reduction_code_for_scalar_code (enum tree_code code, STMT is printed with a message MSG. */ static void -report_vect_op (gimple stmt, const char *msg) +report_vect_op (int msg_type, gimple stmt, const char *msg) { - fprintf (vect_dump, "%s", msg); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (msg_type, vect_location, "%s", msg); + dump_gimple_stmt (msg_type, TDF_SLIM, stmt, 0); } @@ -1929,10 +2000,10 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple phi, gimple first_stmt) == vect_internal_def && !is_loop_header_bb_p (gimple_bb (def_stmt))))) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "swapping oprnds: "); - print_gimple_stmt (vect_dump, next_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "swapping oprnds: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, next_stmt, 0); } swap_tree_operands (next_stmt, @@ -2031,8 +2102,9 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "intermediate value used outside loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "intermediate value used outside loop."); return NULL; } @@ -2042,18 +2114,20 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, nloop_uses++; if (nloop_uses > 1) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "reduction used in loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "reduction used in loop."); return NULL; } } if (TREE_CODE (loop_arg) != SSA_NAME) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "reduction: not ssa_name: "); - print_generic_expr (vect_dump, loop_arg, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "reduction: not ssa_name: "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, loop_arg); } return NULL; } @@ -2061,15 +2135,16 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, def_stmt = SSA_NAME_DEF_STMT (loop_arg); if (!def_stmt) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "reduction: no def_stmt."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "reduction: no def_stmt."); return NULL; } if (!is_gimple_assign (def_stmt) && gimple_code (def_stmt) != GIMPLE_PHI) { - if (vect_print_dump_info (REPORT_DETAILS)) - print_gimple_stmt (vect_dump, def_stmt, 0, TDF_SLIM); + if (dump_kind_p (MSG_NOTE)) + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, def_stmt, 0); return NULL; } @@ -2096,8 +2171,9 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, nloop_uses++; if (nloop_uses > 1) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "reduction used in loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "reduction used in loop."); return NULL; } } @@ -2111,8 +2187,9 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, if (gimple_phi_num_args (def_stmt) != 1 || TREE_CODE (op1) != SSA_NAME) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "unsupported phi node definition."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unsupported phi node definition."); return NULL; } @@ -2123,8 +2200,9 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, && flow_bb_inside_loop_p (loop->inner, gimple_bb (def1)) && is_gimple_assign (def1)) { - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, "detected double reduction: "); + if (dump_kind_p (MSG_NOTE)) + report_vect_op (MSG_NOTE, def_stmt, + "detected double reduction: "); *double_reduc = true; return def_stmt; @@ -2149,8 +2227,9 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, if (check_reduction && (!commutative_tree_code (code) || !associative_tree_code (code))) { - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, "reduction: not commutative/associative: "); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt, + "reduction: not commutative/associative: "); return NULL; } @@ -2158,8 +2237,9 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, { if (code != COND_EXPR) { - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, "reduction: not binary operation: "); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt, + "reduction: not binary operation: "); return NULL; } @@ -2176,8 +2256,9 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, if (TREE_CODE (op1) != SSA_NAME && TREE_CODE (op2) != SSA_NAME) { - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, "reduction: uses not ssa_names: "); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt, + "reduction: uses not ssa_names: "); return NULL; } @@ -2189,8 +2270,9 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, if (TREE_CODE (op1) != SSA_NAME && TREE_CODE (op2) != SSA_NAME) { - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, "reduction: uses not ssa_names: "); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt, + "reduction: uses not ssa_names: "); return NULL; } @@ -2206,24 +2288,29 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, || (op4 && TREE_CODE (op4) == SSA_NAME && !types_compatible_p (type, TREE_TYPE (op4)))) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "reduction: multiple types: operation type: "); - print_generic_expr (vect_dump, type, TDF_SLIM); - fprintf (vect_dump, ", operands types: "); - print_generic_expr (vect_dump, TREE_TYPE (op1), TDF_SLIM); - fprintf (vect_dump, ","); - print_generic_expr (vect_dump, TREE_TYPE (op2), TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "reduction: multiple types: operation type: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, type); + dump_printf (MSG_NOTE, ", operands types: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, + TREE_TYPE (op1)); + dump_printf (MSG_NOTE, ","); + dump_generic_expr (MSG_NOTE, TDF_SLIM, + TREE_TYPE (op2)); if (op3) { - fprintf (vect_dump, ","); - print_generic_expr (vect_dump, TREE_TYPE (op3), TDF_SLIM); + dump_printf (MSG_NOTE, ","); + dump_generic_expr (MSG_NOTE, TDF_SLIM, + TREE_TYPE (op3)); } if (op4) { - fprintf (vect_dump, ","); - print_generic_expr (vect_dump, TREE_TYPE (op4), TDF_SLIM); + dump_printf (MSG_NOTE, ","); + dump_generic_expr (MSG_NOTE, TDF_SLIM, + TREE_TYPE (op4)); } } @@ -2243,23 +2330,25 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, && check_reduction) { /* Changing the order of operations changes the semantics. */ - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, "reduction: unsafe fp math optimization: "); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt, + "reduction: unsafe fp math optimization: "); return NULL; } else if (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_TRAPS (type) && check_reduction) { /* Changing the order of operations changes the semantics. */ - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, "reduction: unsafe int math optimization: "); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt, + "reduction: unsafe int math optimization: "); return NULL; } else if (SAT_FIXED_POINT_TYPE_P (type) && check_reduction) { /* Changing the order of operations changes the semantics. */ - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt, "reduction: unsafe fixed-point math optimization: "); return NULL; } @@ -2295,8 +2384,8 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, if (code != COND_EXPR && ((!def1 || gimple_nop_p (def1)) && (!def2 || gimple_nop_p (def2)))) { - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, "reduction: no defs for operands: "); + if (dump_kind_p (MSG_NOTE)) + report_vect_op (MSG_NOTE, def_stmt, "reduction: no defs for operands: "); return NULL; } @@ -2317,8 +2406,8 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, == vect_internal_def && !is_loop_header_bb_p (gimple_bb (def1))))))) { - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, "detected reduction: "); + if (dump_kind_p (MSG_NOTE)) + report_vect_op (MSG_NOTE, def_stmt, "detected reduction: "); return def_stmt; } @@ -2340,8 +2429,8 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, /* Swap operands (just for simplicity - so that the rest of the code can assume that the reduction variable is always the last (second) argument). */ - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, + if (dump_kind_p (MSG_NOTE)) + report_vect_op (MSG_NOTE, def_stmt, "detected reduction: need to swap operands: "); swap_tree_operands (def_stmt, gimple_assign_rhs1_ptr (def_stmt), @@ -2352,8 +2441,8 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, } else { - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, "detected reduction: "); + if (dump_kind_p (MSG_NOTE)) + report_vect_op (MSG_NOTE, def_stmt, "detected reduction: "); } return def_stmt; @@ -2362,14 +2451,16 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, /* Try to find SLP reduction chain. */ if (check_reduction && vect_is_slp_reduction (loop_info, phi, def_stmt)) { - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, "reduction: detected reduction chain: "); + if (dump_kind_p (MSG_NOTE)) + report_vect_op (MSG_NOTE, def_stmt, + "reduction: detected reduction chain: "); return def_stmt; } - if (vect_print_dump_info (REPORT_DETAILS)) - report_vect_op (def_stmt, "reduction: unknown pattern: "); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt, + "reduction: unknown pattern: "); return NULL; } @@ -2475,10 +2566,10 @@ vect_get_known_peeling_cost (loop_vec_info loop_vinfo, int peel_iters_prologue, if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)) { *peel_iters_epilogue = vf/2; - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "cost model: " - "epilogue peel iters set to vf/2 because " - "loop iterations are unknown ."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "cost model: epilogue peel iters set to vf/2 " + "because loop iterations are unknown ."); /* If peeled iterations are known but number of scalar loop iterations are unknown, count a taken branch per peeled loop. */ @@ -2536,8 +2627,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo) /* Cost model disabled. */ if (!flag_vect_cost_model) { - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "cost model disabled."); + dump_printf_loc (MSG_NOTE, vect_location, "cost model disabled."); return 0; } @@ -2549,9 +2639,9 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo) LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo)); (void) add_stmt_cost (target_cost_data, len, vector_stmt, NULL, 0, vect_prologue); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "cost model: Adding cost of checks for loop " - "versioning to treat misalignment.\n"); + dump_printf (MSG_NOTE, + "cost model: Adding cost of checks for loop " + "versioning to treat misalignment.\n"); } /* Requires loop versioning with alias checks. */ @@ -2561,9 +2651,9 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo) unsigned len = VEC_length (ddr_p, LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo)); (void) add_stmt_cost (target_cost_data, len, vector_stmt, NULL, 0, vect_prologue); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "cost model: Adding cost of checks for loop " - "versioning aliasing.\n"); + dump_printf (MSG_NOTE, + "cost model: Adding cost of checks for loop " + "versioning aliasing.\n"); } if (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo) @@ -2593,17 +2683,15 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo) if (npeel < 0) { peel_iters_prologue = vf/2; - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "cost model: " - "prologue peel iters set to vf/2."); + dump_printf (MSG_NOTE, "cost model: " + "prologue peel iters set to vf/2."); /* If peeling for alignment is unknown, loop bound of main loop becomes unknown. */ peel_iters_epilogue = vf/2; - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "cost model: " - "epilogue peel iters set to vf/2 because " - "peeling for alignment is unknown ."); + dump_printf (MSG_NOTE, "cost model: " + "epilogue peel iters set to vf/2 because " + "peeling for alignment is unknown."); /* If peeled iterations are unknown, count a taken branch and a not taken branch per peeled loop. Even if scalar loop iterations are known, @@ -2769,32 +2857,35 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo) /* vector version will never be profitable. */ else { - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "cost model: the vector iteration cost = %d " - "divided by the scalar iteration cost = %d " - "is greater or equal to the vectorization factor = %d.", - vec_inside_cost, scalar_single_iter_cost, vf); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "cost model: the vector iteration cost = %d " + "divided by the scalar iteration cost = %d " + "is greater or equal to the vectorization factor = %d.", + vec_inside_cost, scalar_single_iter_cost, vf); return -1; } - if (vect_print_dump_info (REPORT_COST)) - { - fprintf (vect_dump, "Cost model analysis: \n"); - fprintf (vect_dump, " Vector inside of loop cost: %d\n", - vec_inside_cost); - fprintf (vect_dump, " Vector prologue cost: %d\n", - vec_prologue_cost); - fprintf (vect_dump, " Vector epilogue cost: %d\n", - vec_epilogue_cost); - fprintf (vect_dump, " Scalar iteration cost: %d\n", - scalar_single_iter_cost); - fprintf (vect_dump, " Scalar outside cost: %d\n", scalar_outside_cost); - fprintf (vect_dump, " prologue iterations: %d\n", - peel_iters_prologue); - fprintf (vect_dump, " epilogue iterations: %d\n", - peel_iters_epilogue); - fprintf (vect_dump, " Calculated minimum iters for profitability: %d\n", - min_profitable_iters); + if (dump_kind_p (MSG_NOTE)) + { + dump_printf_loc (MSG_NOTE, vect_location, "Cost model analysis: \n"); + dump_printf (MSG_NOTE, " Vector inside of loop cost: %d\n", + vec_inside_cost); + dump_printf (MSG_NOTE, " Vector prologue cost: %d\n", + vec_prologue_cost); + dump_printf (MSG_NOTE, " Vector epilogue cost: %d\n", + vec_epilogue_cost); + dump_printf (MSG_NOTE, " Scalar iteration cost: %d\n", + scalar_single_iter_cost); + dump_printf (MSG_NOTE, " Scalar outside cost: %d\n", + scalar_outside_cost); + dump_printf (MSG_NOTE, " prologue iterations: %d\n", + peel_iters_prologue); + dump_printf (MSG_NOTE, " epilogue iterations: %d\n", + peel_iters_epilogue); + dump_printf (MSG_NOTE, + " Calculated minimum iters for profitability: %d\n", + min_profitable_iters); } min_profitable_iters = @@ -2805,9 +2896,9 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo) then skip the vectorized loop. */ min_profitable_iters--; - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, " Profitability threshold = %d\n", - min_profitable_iters); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + " Profitability threshold = %d\n", min_profitable_iters); return min_profitable_iters; } @@ -2864,10 +2955,12 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code, vectype = get_vectype_for_scalar_type (TREE_TYPE (reduction_op)); if (!vectype) { - if (vect_print_dump_info (REPORT_COST)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "unsupported data-type "); - print_generic_expr (vect_dump, TREE_TYPE (reduction_op), TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unsupported data-type "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + TREE_TYPE (reduction_op)); } return false; } @@ -2933,10 +3026,11 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code, } } - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_reduction_cost: inside_cost = %d, " - "prologue_cost = %d, epilogue_cost = %d .", inside_cost, - prologue_cost, epilogue_cost); + if (dump_kind_p (MSG_NOTE)) + dump_printf (MSG_NOTE, + "vect_model_reduction_cost: inside_cost = %d, " + "prologue_cost = %d, epilogue_cost = %d .", inside_cost, + prologue_cost, epilogue_cost); return true; } @@ -2961,9 +3055,10 @@ vect_model_induction_cost (stmt_vec_info stmt_info, int ncopies) prologue_cost = add_stmt_cost (target_cost_data, 2, scalar_to_vec, stmt_info, 0, vect_prologue); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_induction_cost: inside_cost = %d, " - "prologue_cost = %d .", inside_cost, prologue_cost); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_induction_cost: inside_cost = %d, " + "prologue_cost = %d .", inside_cost, prologue_cost); } @@ -3089,10 +3184,11 @@ get_initial_def_for_induction (gimple iv_phi) new_bb = gsi_insert_on_edge_immediate (pe, init_stmt); gcc_assert (!new_bb); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "created new init_stmt: "); - print_gimple_stmt (vect_dump, init_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "created new init_stmt: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, init_stmt, 0); } CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, new_name); } @@ -3231,21 +3327,24 @@ get_initial_def_for_induction (gimple iv_phi) && !STMT_VINFO_LIVE_P (stmt_vinfo)); STMT_VINFO_VEC_STMT (stmt_vinfo) = new_stmt; - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "vector of inductions after inner-loop:"); - print_gimple_stmt (vect_dump, new_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "vector of inductions after inner-loop:"); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, new_stmt, 0); } } } - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "transform induction: created def-use cycle: "); - print_gimple_stmt (vect_dump, induction_phi, 0, TDF_SLIM); - fprintf (vect_dump, "\n"); - print_gimple_stmt (vect_dump, SSA_NAME_DEF_STMT (vec_def), 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "transform induction: created def-use cycle: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, induction_phi, 0); + dump_printf (MSG_NOTE, "\n"); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, + SSA_NAME_DEF_STMT (vec_def), 0); } STMT_VINFO_VEC_STMT (phi_info) = induction_phi; @@ -3646,14 +3745,13 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt, add_phi_arg (phi, def, loop_latch_edge (loop), UNKNOWN_LOCATION); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "transform reduction: created def-use" - " cycle: "); - print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM); - fprintf (vect_dump, "\n"); - print_gimple_stmt (vect_dump, SSA_NAME_DEF_STMT (def), 0, - TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "transform reduction: created def-use cycle: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0); + dump_printf (MSG_NOTE, "\n"); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, SSA_NAME_DEF_STMT (def), 0); } phi = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (phi)); @@ -3848,8 +3946,9 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt, /*** Case 1: Create: v_out2 = reduc_expr <v_out1> */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Reduce using direct vector reduction."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Reduce using direct vector reduction."); vec_dest = vect_create_destination_var (scalar_dest, vectype); tmp = build1 (reduc_code, vectype, new_phi_result); @@ -3898,8 +3997,9 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt, Create: va = vop <va, va'> } */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Reduce using vector shifts"); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Reduce using vector shifts"); vec_dest = vect_create_destination_var (scalar_dest, vectype); new_temp = new_phi_result; @@ -3938,8 +4038,9 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt, Create: s = op <s, s'> // For non SLP cases } */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Reduce using scalar code. "); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Reduce using scalar code. "); vec_size_in_bits = tree_low_cst (TYPE_SIZE (vectype), 1); FOR_EACH_VEC_ELT (gimple, new_phis, i, new_phi) @@ -4028,8 +4129,9 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt, { tree rhs; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "extract scalar result"); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "extract scalar result"); if (BYTES_BIG_ENDIAN) bitpos = size_binop (MULT_EXPR, @@ -4266,11 +4368,11 @@ vect_finalize_reduction: UNKNOWN_LOCATION); add_phi_arg (vect_phi, PHI_RESULT (inner_phi), loop_latch_edge (outer_loop), UNKNOWN_LOCATION); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "created double reduction phi " - "node: "); - print_gimple_stmt (vect_dump, vect_phi, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "created double reduction phi node: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, vect_phi, 0); } vect_phi_res = PHI_RESULT (vect_phi); @@ -4616,8 +4718,9 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, { if (!vectorizable_condition (stmt, gsi, NULL, ops[reduc_index], 0, NULL)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "unsupported condition in reduction"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unsupported condition in reduction"); return false; } @@ -4630,24 +4733,25 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, optab = optab_for_tree_code (code, vectype_in, optab_default); if (!optab) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "no optab."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "no optab."); return false; } if (optab_handler (optab, vec_mode) == CODE_FOR_nothing) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "op not supported by target."); + if (dump_kind_p (MSG_NOTE)) + dump_printf (MSG_NOTE, "op not supported by target."); if (GET_MODE_SIZE (vec_mode) != UNITS_PER_WORD || LOOP_VINFO_VECT_FACTOR (loop_vinfo) < vect_min_worthwhile_factor (code)) return false; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "proceeding using word mode."); + if (dump_kind_p (MSG_NOTE)) + dump_printf (MSG_NOTE, "proceeding using word mode."); } /* Worthwhile without SIMD support? */ @@ -4655,8 +4759,9 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, && LOOP_VINFO_VECT_FACTOR (loop_vinfo) < vect_min_worthwhile_factor (code)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "not worthwhile without SIMD support."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not worthwhile without SIMD support."); return false; } @@ -4735,8 +4840,9 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, optab_default); if (!reduc_optab) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "no optab for reduction."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "no optab for reduction."); epilog_reduc_code = ERROR_MARK; } @@ -4744,8 +4850,9 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, if (reduc_optab && optab_handler (reduc_optab, vec_mode) == CODE_FOR_nothing) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "reduc op not supported by target."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "reduc op not supported by target."); epilog_reduc_code = ERROR_MARK; } @@ -4754,8 +4861,9 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, { if (!nested_cycle || double_reduc) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "no reduc code for scalar code."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "no reduc code for scalar code."); return false; } @@ -4763,8 +4871,9 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, if (double_reduc && ncopies > 1) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "multiple types in double reduction"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "multiple types in double reduction"); return false; } @@ -4781,8 +4890,9 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, ops[1] = fold_convert (TREE_TYPE (ops[0]), ops[1]); else { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "invalid types in dot-prod"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "invalid types in dot-prod"); return false; } @@ -4798,8 +4908,8 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, /** Transform. **/ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "transform reduction."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "transform reduction."); /* FORNOW: Multiple types are not supported for condition. */ if (code == COND_EXPR) @@ -5084,8 +5194,9 @@ vectorizable_induction (gimple phi, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED, if (ncopies > 1) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "multiple types in nested loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "multiple types in nested loop."); return false; } @@ -5107,9 +5218,10 @@ vectorizable_induction (gimple phi, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED, if (!(STMT_VINFO_RELEVANT_P (exit_phi_vinfo) && !STMT_VINFO_LIVE_P (exit_phi_vinfo))) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "inner-loop induction only used outside " - "of the outer vectorized loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "inner-loop induction only used outside " + "of the outer vectorized loop."); return false; } } @@ -5130,16 +5242,17 @@ vectorizable_induction (gimple phi, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED, if (!vec_stmt) /* transformation not required. */ { STMT_VINFO_TYPE (stmt_info) = induc_vec_info_type; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vectorizable_induction ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vectorizable_induction ==="); vect_model_induction_cost (stmt_info, ncopies); return true; } /** Transform. **/ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "transform induction phi."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "transform induction phi."); vec_def = get_initial_def_for_induction (phi); *vec_stmt = SSA_NAME_DEF_STMT (vec_def); @@ -5203,8 +5316,9 @@ vectorizable_live_operation (gimple stmt, && !vect_is_simple_use (op, stmt, loop_vinfo, NULL, &def_stmt, &def, &dt)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "use not simple."); return false; } @@ -5241,8 +5355,9 @@ vect_loop_kill_debug_uses (struct loop *loop, gimple stmt) { if (gimple_debug_bind_p (ustmt)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "killing debug use"); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "killing debug use"); gimple_debug_bind_reset_value (ustmt); update_stmt (ustmt); @@ -5280,8 +5395,8 @@ vect_transform_loop (loop_vec_info loop_vinfo) bool check_profitability = false; int th; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vec_transform_loop ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "=== vec_transform_loop ==="); /* Use the more conservative vectorization threshold. If the number of iterations is constant assume the cost check has been performed @@ -5294,9 +5409,9 @@ vect_transform_loop (loop_vec_info loop_vinfo) if (th >= LOOP_VINFO_VECT_FACTOR (loop_vinfo) - 1 && !LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)) { - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, - "Profitability threshold is %d loop iterations.", th); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Profitability threshold is %d loop iterations.", th); check_profitability = true; } @@ -5355,10 +5470,11 @@ vect_transform_loop (loop_vec_info loop_vinfo) for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si)) { phi = gsi_stmt (si); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "------>vectorizing phi: "); - print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "------>vectorizing phi: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0); } stmt_info = vinfo_for_stmt (phi); if (!stmt_info) @@ -5373,13 +5489,13 @@ vect_transform_loop (loop_vec_info loop_vinfo) if ((TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info)) != (unsigned HOST_WIDE_INT) vectorization_factor) - && vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "multiple-types."); + && dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "multiple-types."); if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "transform phi."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "transform phi."); vect_transform_stmt (phi, NULL, NULL, NULL, NULL); } } @@ -5394,10 +5510,11 @@ vect_transform_loop (loop_vec_info loop_vinfo) else stmt = gsi_stmt (si); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "------>vectorizing statement: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "------>vectorizing statement: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); } stmt_info = vinfo_for_stmt (stmt); @@ -5465,12 +5582,13 @@ vect_transform_loop (loop_vec_info loop_vinfo) if (!gsi_end_p (pattern_def_si)) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "==> vectorizing pattern def" - " stmt: "); - print_gimple_stmt (vect_dump, pattern_def_stmt, 0, - TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "==> vectorizing pattern def " + "stmt: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, + pattern_def_stmt, 0); } stmt = pattern_def_stmt; @@ -5491,10 +5609,11 @@ vect_transform_loop (loop_vec_info loop_vinfo) STMT_VINFO_VECTYPE (stmt_info)); if (!STMT_SLP_TYPE (stmt_info) && nunits != (unsigned int) vectorization_factor - && vect_print_dump_info (REPORT_DETAILS)) + && dump_kind_p (MSG_NOTE)) /* For SLP VF is set according to unrolling factor, and not to vector size, hence for SLP this print is not valid. */ - fprintf (vect_dump, "multiple-types."); + dump_printf_loc (MSG_NOTE, vect_location, + "multiple-types."); /* SLP. Schedule all the SLP instances when the first SLP stmt is reached. */ @@ -5504,8 +5623,9 @@ vect_transform_loop (loop_vec_info loop_vinfo) { slp_scheduled = true; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== scheduling SLP instances ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== scheduling SLP instances ==="); vect_schedule_slp (loop_vinfo, NULL); } @@ -5523,8 +5643,8 @@ vect_transform_loop (loop_vec_info loop_vinfo) } /* -------- vectorize statement ------------ */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "transform statement."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "transform statement."); grouped_store = false; is_store = vect_transform_stmt (stmt, &si, &grouped_store, NULL, NULL); @@ -5566,8 +5686,9 @@ vect_transform_loop (loop_vec_info loop_vinfo) until all the loops have been transformed? */ update_ssa (TODO_update_ssa); - if (vect_print_dump_info (REPORT_VECTORIZED_LOCATIONS)) - fprintf (vect_dump, "LOOP VECTORIZED."); - if (loop->inner && vect_print_dump_info (REPORT_VECTORIZED_LOCATIONS)) - fprintf (vect_dump, "OUTER LOOP VECTORIZED."); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, "LOOP VECTORIZED."); + if (loop->inner && dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "OUTER LOOP VECTORIZED."); } diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index ef65c3f..b0974ec 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -416,10 +416,11 @@ vect_recog_dot_prod_pattern (VEC (gimple, heap) **stmts, tree *type_in, pattern_stmt = gimple_build_assign_with_ops (DOT_PROD_EXPR, var, oprnd00, oprnd01, oprnd1); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) { - fprintf (vect_dump, "vect_recog_dot_prod_pattern: detected: "); - print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "vect_recog_dot_prod_pattern: detected: "); + dump_gimple_stmt (MSG_OPTIMIZED_LOCATIONS, TDF_SLIM, pattern_stmt, 0); } /* We don't allow changing the order of the computation in the inner-loop @@ -675,8 +676,9 @@ vect_recog_widen_mult_pattern (VEC (gimple, heap) **stmts, return NULL; /* Pattern detected. */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vect_recog_widen_mult_pattern: detected: "); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "vect_recog_widen_mult_pattern: detected: "); /* Check target support */ vectype = get_vectype_for_scalar_type (half_type0); @@ -697,8 +699,8 @@ vect_recog_widen_mult_pattern (VEC (gimple, heap) **stmts, pattern_stmt = gimple_build_assign_with_ops (WIDEN_MULT_EXPR, var, oprnd0, oprnd1); - if (vect_print_dump_info (REPORT_DETAILS)) - print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM); + if (dump_kind_p (MSG_NOTE)) + dump_gimple_stmt_loc (MSG_NOTE, vect_location, TDF_SLIM, pattern_stmt, 0); VEC_safe_push (gimple, heap, *stmts, last_stmt); return pattern_stmt; @@ -910,10 +912,11 @@ vect_recog_widen_sum_pattern (VEC (gimple, heap) **stmts, tree *type_in, pattern_stmt = gimple_build_assign_with_ops (WIDEN_SUM_EXPR, var, oprnd0, oprnd1); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) { - fprintf (vect_dump, "vect_recog_widen_sum_pattern: detected: "); - print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "vect_recog_widen_sum_pattern: detected: "); + dump_gimple_stmt (MSG_OPTIMIZED_LOCATIONS, TDF_SLIM, pattern_stmt, 0); } /* We don't allow changing the order of the computation in the inner-loop @@ -1214,10 +1217,11 @@ vect_recog_over_widening_pattern (VEC (gimple, heap) **stmts, STMT_VINFO_RELATED_STMT (vinfo_for_stmt (stmt)) = pattern_stmt; new_pattern_def_seq (vinfo_for_stmt (stmt), new_def_stmt); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) { - fprintf (vect_dump, "created pattern stmt: "); - print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "created pattern stmt: "); + dump_gimple_stmt (MSG_OPTIMIZED_LOCATIONS, TDF_SLIM, pattern_stmt, 0); } type = gimple_expr_type (stmt); @@ -1281,10 +1285,11 @@ vect_recog_over_widening_pattern (VEC (gimple, heap) **stmts, return NULL; /* Pattern detected. */ - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) { - fprintf (vect_dump, "vect_recog_over_widening_pattern: detected: "); - print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "vect_recog_over_widening_pattern: detected: "); + dump_gimple_stmt (MSG_OPTIMIZED_LOCATIONS, TDF_SLIM, pattern_stmt, 0); } return pattern_stmt; @@ -1416,8 +1421,9 @@ vect_recog_widen_shift_pattern (VEC (gimple, heap) **stmts, return NULL; /* Pattern detected. */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vect_recog_widen_shift_pattern: detected: "); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "vect_recog_widen_shift_pattern: detected: "); /* Check target support. */ vectype = get_vectype_for_scalar_type (half_type0); @@ -1439,8 +1445,8 @@ vect_recog_widen_shift_pattern (VEC (gimple, heap) **stmts, pattern_stmt = gimple_build_assign_with_ops (WIDEN_LSHIFT_EXPR, var, oprnd0, oprnd1); - if (vect_print_dump_info (REPORT_DETAILS)) - print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM); + if (dump_kind_p (MSG_NOTE)) + dump_gimple_stmt_loc (MSG_NOTE, vect_location, TDF_SLIM, pattern_stmt, 0); VEC_safe_push (gimple, heap, *stmts, last_stmt); return pattern_stmt; @@ -1561,15 +1567,16 @@ vect_recog_vector_vector_shift_pattern (VEC (gimple, heap) **stmts, } /* Pattern detected. */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vect_recog_vector_vector_shift_pattern: detected: "); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "vect_recog_vector_vector_shift_pattern: detected: "); /* Pattern supported. Create a stmt to be used to replace the pattern. */ var = vect_recog_temp_ssa_var (TREE_TYPE (oprnd0), NULL); pattern_stmt = gimple_build_assign_with_ops (rhs_code, var, oprnd0, def); - if (vect_print_dump_info (REPORT_DETAILS)) - print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM); + if (dump_kind_p (MSG_NOTE)) + dump_gimple_stmt_loc (MSG_NOTE, vect_location, TDF_SLIM, pattern_stmt, 0); VEC_safe_push (gimple, heap, *stmts, last_stmt); return pattern_stmt; @@ -1678,8 +1685,9 @@ vect_recog_divmod_pattern (VEC (gimple, heap) **stmts, return NULL; /* Pattern detected. */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vect_recog_divmod_pattern: detected: "); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "vect_recog_divmod_pattern: detected: "); cond = build2 (LT_EXPR, boolean_type_node, oprnd0, build_int_cst (itype, 0)); @@ -1781,8 +1789,9 @@ vect_recog_divmod_pattern (VEC (gimple, heap) **stmts, signmask); } - if (vect_print_dump_info (REPORT_DETAILS)) - print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM); + if (dump_kind_p (MSG_NOTE)) + dump_gimple_stmt_loc (MSG_NOTE, vect_location, TDF_SLIM, pattern_stmt, + 0); VEC_safe_push (gimple, heap, *stmts, last_stmt); @@ -2022,11 +2031,12 @@ vect_recog_divmod_pattern (VEC (gimple, heap) **stmts, } /* Pattern detected. */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vect_recog_divmod_pattern: detected: "); - - if (vect_print_dump_info (REPORT_DETAILS)) - print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + { + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "vect_recog_divmod_pattern: detected: "); + dump_gimple_stmt (MSG_OPTIMIZED_LOCATIONS, TDF_SLIM, pattern_stmt, 0); + } VEC_safe_push (gimple, heap, *stmts, last_stmt); @@ -2189,8 +2199,9 @@ vect_recog_mixed_size_cond_pattern (VEC (gimple, heap) **stmts, tree *type_in, *type_in = vecitype; *type_out = vectype; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vect_recog_mixed_size_cond_pattern: detected: "); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "vect_recog_mixed_size_cond_pattern: detected: "); return pattern_stmt; } @@ -2581,8 +2592,9 @@ vect_recog_bool_pattern (VEC (gimple, heap) **stmts, tree *type_in, *type_out = vectype; *type_in = vectype; VEC_safe_push (gimple, heap, *stmts, last_stmt); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vect_recog_bool_pattern: detected: "); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "vect_recog_bool_pattern: detected: "); return pattern_stmt; } @@ -2626,8 +2638,9 @@ vect_recog_bool_pattern (VEC (gimple, heap) **stmts, tree *type_in, *type_out = vectype; *type_in = vectype; VEC_safe_push (gimple, heap, *stmts, last_stmt); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vect_recog_bool_pattern: detected: "); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "vect_recog_bool_pattern: detected: "); return pattern_stmt; } else @@ -2775,10 +2788,11 @@ vect_pattern_recog_1 (vect_recog_func_ptr vect_recog_func, } /* Found a vectorizable pattern. */ - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) { - fprintf (vect_dump, "pattern recognized: "); - print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "pattern recognized: "); + dump_gimple_stmt (MSG_OPTIMIZED_LOCATIONS, TDF_SLIM, pattern_stmt, 0); } /* Mark the stmts that are involved in the pattern. */ @@ -2800,10 +2814,11 @@ vect_pattern_recog_1 (vect_recog_func_ptr vect_recog_func, { stmt_info = vinfo_for_stmt (stmt); pattern_stmt = STMT_VINFO_RELATED_STMT (stmt_info); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) { - fprintf (vect_dump, "additional pattern stmt: "); - print_gimple_stmt (vect_dump, pattern_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "additional pattern stmt: "); + dump_gimple_stmt (MSG_OPTIMIZED_LOCATIONS, TDF_SLIM, pattern_stmt, 0); } vect_mark_pattern_stmts (stmt, pattern_stmt, NULL_TREE); @@ -2900,8 +2915,9 @@ vect_pattern_recog (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) VEC (gimple, heap) *stmts_to_replace = VEC_alloc (gimple, heap, 1); gimple stmt; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_pattern_recog ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_pattern_recog ==="); if (loop_vinfo) { diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 83cbb49..1c4f276 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" +#include "dumpfile.h" #include "tm.h" #include "ggc.h" #include "tree.h" @@ -237,10 +238,11 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, &def, &dt) || (!def_stmt && dt != vect_constant_def)) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: can't find def for "); - print_generic_expr (vect_dump, oprnd, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: can't find def for "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, oprnd); } return false; @@ -261,11 +263,12 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, pattern = true; if (!first && !oprnd_info->first_pattern) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: some of the stmts" - " are in a pattern, and others are not "); - print_generic_expr (vect_dump, oprnd, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: some of the stmts" + " are in a pattern, and others are not "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, oprnd); } return false; @@ -276,8 +279,9 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, if (dt == vect_unknown_def_type) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Unsupported pattern."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Unsupported pattern."); return false; } @@ -292,8 +296,9 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, break; default: - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "unsupported defining stmt: "); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unsupported defining stmt: "); return false; } } @@ -356,8 +361,9 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, { if (number_of_oprnds != 2) { - if (vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "Build SLP failed: different types "); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: different types "); return false; } @@ -382,10 +388,11 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, && !types_compatible_p (oprnd_info->first_def_type, TREE_TYPE (def_op0)))) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Swapping operands of "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "Swapping operands of "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); } swap_tree_operands (stmt, gimple_assign_rhs1_ptr (stmt), @@ -393,8 +400,9 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, } else { - if (vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "Build SLP failed: different types "); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: different types "); return false; } @@ -427,10 +435,11 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, default: /* FORNOW: Not supported. */ - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: illegal type of def "); - print_generic_expr (vect_dump, def, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: illegal type of def "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, def); } return false; @@ -495,20 +504,20 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, /* For every stmt in NODE find its def stmt/s. */ FOR_EACH_VEC_ELT (gimple, stmts, i, stmt) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Build SLP for "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "Build SLP for "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); } /* Fail to vectorize statements marked as unvectorizable. */ if (!STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (stmt))) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "Build SLP failed: unvectorizable statement "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: unvectorizable statement "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } vect_free_oprnd_info (&oprnds_info); @@ -518,11 +527,12 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, lhs = gimple_get_lhs (stmt); if (lhs == NULL_TREE) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "Build SLP failed: not GIMPLE_ASSIGN nor GIMPLE_CALL "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: not GIMPLE_ASSIGN nor " + "GIMPLE_CALL "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } vect_free_oprnd_info (&oprnds_info); @@ -534,11 +544,12 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, && (cond = gimple_assign_rhs1 (stmt)) && !COMPARISON_CLASS_P (cond)) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "Build SLP failed: condition is not comparison "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: condition is not " + "comparison "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } vect_free_oprnd_info (&oprnds_info); @@ -549,10 +560,12 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, vectype = get_vectype_for_scalar_type (scalar_type); if (!vectype) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: unsupported data-type "); - print_generic_expr (vect_dump, scalar_type, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: unsupported data-type "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + scalar_type); } vect_free_oprnd_info (&oprnds_info); @@ -578,11 +591,11 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, || !gimple_call_nothrow_p (stmt) || gimple_call_chain (stmt)) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "Build SLP failed: unsupported call type "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: unsupported call type "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } vect_free_oprnd_info (&oprnds_info); @@ -618,17 +631,19 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, if (!optab) { - if (vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "Build SLP failed: no optab."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: no optab."); vect_free_oprnd_info (&oprnds_info); return false; } icode = (int) optab_handler (optab, vec_mode); if (icode == CODE_FOR_nothing) { - if (vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "Build SLP failed: " - "op not supported by target."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: " + "op not supported by target."); vect_free_oprnd_info (&oprnds_info); return false; } @@ -659,11 +674,12 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, || first_stmt_code == COMPONENT_REF || first_stmt_code == MEM_REF))) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "Build SLP failed: different operation in stmt "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: different operation " + "in stmt "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } vect_free_oprnd_info (&oprnds_info); @@ -673,11 +689,12 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, if (need_same_oprnds && !operand_equal_p (first_op1, gimple_assign_rhs2 (stmt), 0)) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "Build SLP failed: different shift arguments in "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: different shift " + "arguments in "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } vect_free_oprnd_info (&oprnds_info); @@ -693,11 +710,12 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, || gimple_call_fntype (first_stmt) != gimple_call_fntype (stmt)) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, - "Build SLP failed: different calls in "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: different calls in "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + stmt, 0); } vect_free_oprnd_info (&oprnds_info); @@ -731,11 +749,13 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, || (GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) != stmt && GROUP_GAP (vinfo_for_stmt (stmt)) != 1)) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: grouped " - "loads have gaps "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: grouped " + "loads have gaps "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + stmt, 0); } vect_free_oprnd_info (&oprnds_info); @@ -747,12 +767,14 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, if (loop_vinfo && GROUP_SIZE (vinfo_for_stmt (stmt)) > ncopies * group_size) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: the number of " - "interleaved loads is greater than" - " the SLP group size "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: the number " + "of interleaved loads is greater than " + "the SLP group size "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + stmt, 0); } vect_free_oprnd_info (&oprnds_info); @@ -767,16 +789,19 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, chains in the same node. The only exception is complex numbers. */ if (prev_first_load != first_load - && rhs_code != REALPART_EXPR + && rhs_code != REALPART_EXPR && rhs_code != IMAGPART_EXPR) - { - if (vect_print_dump_info (REPORT_SLP)) + { + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: different " - "interleaving chains in one node "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, + vect_location, + "Build SLP failed: different " + "interleaving chains in one node "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + stmt, 0); } - + vect_free_oprnd_info (&oprnds_info); return false; } @@ -792,11 +817,14 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, if (vect_supportable_dr_alignment (first_dr, false) == dr_unaligned_unsupported) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: unsupported " - "unaligned load "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, + vect_location, + "Build SLP failed: unsupported " + "unaligned load "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + stmt, 0); } vect_free_oprnd_info (&oprnds_info); @@ -829,10 +857,11 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, if (TREE_CODE_CLASS (rhs_code) == tcc_reference) { /* Not grouped load. */ - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: not grouped load "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: not grouped load "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } /* FORNOW: Not grouped loads are not supported. */ @@ -846,11 +875,12 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, && rhs_code != COND_EXPR && rhs_code != CALL_EXPR) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: operation"); - fprintf (vect_dump, " unsupported "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: operation"); + dump_printf (MSG_MISSED_OPTIMIZATION, " unsupported "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } vect_free_oprnd_info (&oprnds_info); @@ -865,11 +895,13 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, first_cond_code = TREE_CODE (cond_expr); else if (first_cond_code != TREE_CODE (cond_expr)) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: different" - " operation"); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: different" + " operation"); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + stmt, 0); } vect_free_oprnd_info (&oprnds_info); @@ -944,9 +976,10 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, return true; } +/* Dump a slp tree NODE using flags specified in DUMP_KIND. */ static void -vect_print_slp_tree (slp_tree node) +vect_print_slp_tree (int dump_kind, slp_tree node) { int i; gimple stmt; @@ -955,16 +988,16 @@ vect_print_slp_tree (slp_tree node) if (!node) return; - fprintf (vect_dump, "node "); + dump_printf (dump_kind, "node "); FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt) { - fprintf (vect_dump, "\n\tstmt %d ", i); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf (dump_kind, "\n\tstmt %d ", i); + dump_gimple_stmt (dump_kind, TDF_SLIM, stmt, 0); } - fprintf (vect_dump, "\n"); + dump_printf (dump_kind, "\n"); FOR_EACH_VEC_ELT (slp_void_p, SLP_TREE_CHILDREN (node), i, child) - vect_print_slp_tree ((slp_tree) child); + vect_print_slp_tree (dump_kind, (slp_tree) child); } @@ -1047,11 +1080,13 @@ vect_supported_slp_permutation_p (slp_instance instance) /* Check that the loads are all in the same interleaving chain. */ if (GROUP_FIRST_ELEMENT (vinfo_for_stmt (scalar_stmt)) != first_load) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: unsupported data " - "permutation "); - print_gimple_stmt (vect_dump, scalar_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: unsupported data " + "permutation "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + scalar_stmt, 0); } free (tmp_loads); @@ -1134,11 +1169,11 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size, if (!slp_instn) return false; - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Load permutation "); + dump_printf_loc (MSG_NOTE, vect_location, "Load permutation "); FOR_EACH_VEC_ELT (int, load_permutation, i, next) - fprintf (vect_dump, "%d ", next); + dump_printf (MSG_NOTE, "%d ", next); } /* In case of reduction every load permutation is allowed, since the order @@ -1341,11 +1376,13 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size, if (vect_supportable_dr_alignment (dr, false) == dr_unaligned_unsupported) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "unsupported unaligned load "); - print_gimple_stmt (vect_dump, first_load, 0, - TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, + vect_location, + "unsupported unaligned load "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + first_load, 0); } bad_permutation = true; break; @@ -1499,10 +1536,11 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, if (!vectype) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: unsupported data-type "); - print_generic_expr (vect_dump, scalar_type, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: unsupported data-type "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, scalar_type); } return false; @@ -1518,9 +1556,10 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, unrolling_factor = least_common_multiple (nunits, group_size) / group_size; if (unrolling_factor != 1 && !loop_vinfo) { - if (vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "Build SLP failed: unrolling required in basic" - " block SLP"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: unrolling required in basic" + " block SLP"); return false; } @@ -1579,9 +1618,10 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, if (unrolling_factor != 1 && !loop_vinfo) { - if (vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "Build SLP failed: unrolling required in basic" - " block SLP"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: unrolling required in basic" + " block SLP"); vect_free_slp_tree (node); VEC_free (stmt_info_for_cost, heap, body_cost_vec); VEC_free (stmt_info_for_cost, heap, prologue_cost_vec); @@ -1605,11 +1645,12 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, if (!vect_supported_load_permutation_p (new_instance, group_size, load_permutation)) { - if (vect_print_dump_info (REPORT_SLP)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "Build SLP failed: unsupported load " - "permutation "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: unsupported load " + "permutation "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } vect_free_slp_instance (new_instance); @@ -1644,8 +1685,8 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, VEC_safe_push (slp_instance, heap, BB_VINFO_SLP_INSTANCES (bb_vinfo), new_instance); - if (vect_print_dump_info (REPORT_SLP)) - vect_print_slp_tree (node); + if (dump_kind_p (MSG_NOTE)) + vect_print_slp_tree (MSG_NOTE, node); return true; } @@ -1676,8 +1717,8 @@ vect_analyze_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) gimple first_element; bool ok = false; - if (vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "=== vect_analyze_slp ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "=== vect_analyze_slp ==="); if (loop_vinfo) { @@ -1695,8 +1736,9 @@ vect_analyze_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) if (bb_vinfo && !ok) { - if (vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "Failed to SLP the basic block."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Failed to SLP the basic block."); return false; } @@ -1738,8 +1780,8 @@ vect_make_slp_decision (loop_vec_info loop_vinfo) slp_instance instance; int decided_to_slp = 0; - if (vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "=== vect_make_slp_decision ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "=== vect_make_slp_decision ==="); FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance) { @@ -1756,9 +1798,10 @@ vect_make_slp_decision (loop_vec_info loop_vinfo) LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo) = unrolling_factor; - if (decided_to_slp && vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "Decided to SLP %d instances. Unrolling factor %d", - decided_to_slp, unrolling_factor); + if (decided_to_slp && dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "Decided to SLP %d instances. Unrolling factor %d", + decided_to_slp, unrolling_factor); return (decided_to_slp > 0); } @@ -1820,8 +1863,8 @@ vect_detect_hybrid_slp (loop_vec_info loop_vinfo) VEC (slp_instance, heap) *slp_instances = LOOP_VINFO_SLP_INSTANCES (loop_vinfo); slp_instance instance; - if (vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "=== vect_detect_hybrid_slp ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "=== vect_detect_hybrid_slp ==="); FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance) vect_detect_hybrid_slp_stmts (SLP_INSTANCE_TREE (instance)); @@ -2017,14 +2060,14 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo) vec_outside_cost = vec_prologue_cost + vec_epilogue_cost; - if (vect_print_dump_info (REPORT_COST)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "Cost model analysis: \n"); - fprintf (vect_dump, " Vector inside of basic block cost: %d\n", - vec_inside_cost); - fprintf (vect_dump, " Vector prologue cost: %d\n", vec_prologue_cost); - fprintf (vect_dump, " Vector epilogue cost: %d\n", vec_epilogue_cost); - fprintf (vect_dump, " Scalar cost of basic block: %d", scalar_cost); + dump_printf_loc (MSG_NOTE, vect_location, "Cost model analysis: \n"); + dump_printf (MSG_NOTE, " Vector inside of basic block cost: %d\n", + vec_inside_cost); + dump_printf (MSG_NOTE, " Vector prologue cost: %d\n", vec_prologue_cost); + dump_printf (MSG_NOTE, " Vector epilogue cost: %d\n", vec_epilogue_cost); + dump_printf (MSG_NOTE, " Scalar cost of basic block: %d", scalar_cost); } /* Vectorization is profitable if its cost is less than the cost of scalar @@ -2054,9 +2097,10 @@ vect_slp_analyze_bb_1 (basic_block bb) if (!vect_analyze_data_refs (NULL, bb_vinfo, &min_vf)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: unhandled data-ref in basic " - "block.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unhandled data-ref in basic " + "block.\n"); destroy_bb_vec_info (bb_vinfo); return NULL; @@ -2065,9 +2109,10 @@ vect_slp_analyze_bb_1 (basic_block bb) ddrs = BB_VINFO_DDRS (bb_vinfo); if (!VEC_length (ddr_p, ddrs)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: not enough data-refs in basic " - "block.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: not enough data-refs in " + "basic block.\n"); destroy_bb_vec_info (bb_vinfo); return NULL; @@ -2078,9 +2123,10 @@ vect_slp_analyze_bb_1 (basic_block bb) if (!vect_analyze_data_ref_dependences (NULL, bb_vinfo, &max_vf) || min_vf > max_vf) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: unhandled data dependence " - "in basic block.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unhandled data dependence " + "in basic block.\n"); destroy_bb_vec_info (bb_vinfo); return NULL; @@ -2088,9 +2134,10 @@ vect_slp_analyze_bb_1 (basic_block bb) if (!vect_analyze_data_refs_alignment (NULL, bb_vinfo)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: bad data alignment in basic " - "block.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: bad data alignment in basic " + "block.\n"); destroy_bb_vec_info (bb_vinfo); return NULL; @@ -2098,9 +2145,10 @@ vect_slp_analyze_bb_1 (basic_block bb) if (!vect_analyze_data_ref_accesses (NULL, bb_vinfo)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: unhandled data access in basic " - "block.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unhandled data access in " + "basic block.\n"); destroy_bb_vec_info (bb_vinfo); return NULL; @@ -2110,9 +2158,10 @@ vect_slp_analyze_bb_1 (basic_block bb) trees. */ if (!vect_analyze_slp (NULL, bb_vinfo)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: failed to find SLP opportunities " - "in basic block.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: failed to find SLP opportunities " + "in basic block.\n"); destroy_bb_vec_info (bb_vinfo); return NULL; @@ -2130,18 +2179,19 @@ vect_slp_analyze_bb_1 (basic_block bb) if (!vect_verify_datarefs_alignment (NULL, bb_vinfo)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: unsupported alignment in basic " - "block.\n"); - + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unsupported alignment in basic " + "block.\n"); destroy_bb_vec_info (bb_vinfo); return NULL; } if (!vect_slp_analyze_operations (bb_vinfo)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: bad operation in basic block.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: bad operation in basic block.\n"); destroy_bb_vec_info (bb_vinfo); return NULL; @@ -2151,16 +2201,18 @@ vect_slp_analyze_bb_1 (basic_block bb) if (flag_vect_cost_model && !vect_bb_vectorization_profitable_p (bb_vinfo)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: vectorization is not " - "profitable.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: vectorization is not " + "profitable.\n"); destroy_bb_vec_info (bb_vinfo); return NULL; } - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Basic block will be vectorized using SLP\n"); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Basic block will be vectorized using SLP\n"); return bb_vinfo; } @@ -2174,8 +2226,8 @@ vect_slp_analyze_bb (basic_block bb) gimple_stmt_iterator gsi; unsigned int vector_sizes; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "===vect_slp_analyze_bb===\n"); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "===vect_slp_analyze_bb===\n"); for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { @@ -2188,9 +2240,10 @@ vect_slp_analyze_bb (basic_block bb) if (insns > PARAM_VALUE (PARAM_SLP_MAX_INSNS_IN_BB)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: too many instructions in basic " - "block.\n"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: too many instructions in " + "basic block.\n"); return NULL; } @@ -2214,9 +2267,10 @@ vect_slp_analyze_bb (basic_block bb) /* Try the next biggest vector size. */ current_vector_size = 1 << floor_log2 (vector_sizes); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "***** Re-trying analysis with " - "vector size %d\n", current_vector_size); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "***** Re-trying analysis with " + "vector size %d\n", current_vector_size); } } @@ -2238,8 +2292,9 @@ vect_update_slp_costs_according_to_vf (loop_vec_info loop_vinfo) stmt_info_for_cost *si; void *data = LOOP_VINFO_TARGET_COST_DATA (loop_vinfo); - if (vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "=== vect_update_slp_costs_according_to_vf ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_update_slp_costs_according_to_vf ==="); FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance) { @@ -2719,10 +2774,11 @@ vect_get_mask_element (gimple stmt, int first_mask_element, int m, the next vector as well. */ if (only_one_vec && *current_mask_element >= mask_nunits) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "permutation requires at least two vectors "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "permutation requires at least two vectors "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } return false; @@ -2736,11 +2792,12 @@ vect_get_mask_element (gimple stmt, int first_mask_element, int m, /* We either need the first vector too or have already moved to the next vector. In both cases, this permutation needs three vectors. */ - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "permutation requires at " - "least three vectors "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "permutation requires at " + "least three vectors "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } return false; @@ -2801,10 +2858,11 @@ vect_transform_slp_perm_load (gimple stmt, VEC (tree, heap) *dr_chain, if (!can_vec_perm_p (mode, false, NULL)) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "no vect permute for "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "no vect permute for "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } return false; } @@ -2880,12 +2938,15 @@ vect_transform_slp_perm_load (gimple stmt, VEC (tree, heap) *dr_chain, if (!can_vec_perm_p (mode, false, mask)) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "unsupported vect permute { "); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, + vect_location, + "unsupported vect permute { "); for (i = 0; i < nunits; ++i) - fprintf (vect_dump, "%d ", mask[i]); - fprintf (vect_dump, "}\n"); + dump_printf (MSG_MISSED_OPTIMIZATION, "%d ", + mask[i]); + dump_printf (MSG_MISSED_OPTIMIZATION, "}\n"); } return false; } @@ -2981,10 +3042,11 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance, SLP_TREE_NUMBER_OF_VEC_STMTS (node) = vec_stmts_size; } - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "------>vectorizing SLP node starting from: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE,vect_location, + "------>vectorizing SLP node starting from: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); } /* Loads should be inserted before the first load. */ @@ -3089,9 +3151,9 @@ vect_schedule_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) /* Schedule the tree of INSTANCE. */ is_store = vect_schedule_slp_instance (SLP_INSTANCE_TREE (instance), instance, vf); - if (vect_print_dump_info (REPORT_VECTORIZED_LOCATIONS) - || vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "vectorizing stmts using SLP."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vectorizing stmts using SLP."); } FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance) @@ -3134,18 +3196,19 @@ vect_slp_transform_bb (basic_block bb) gcc_assert (bb_vinfo); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "SLPing BB\n"); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "SLPing BB\n"); for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) { gimple stmt = gsi_stmt (si); stmt_vec_info stmt_info; - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "------>SLPing statement: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "------>SLPing statement: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); } stmt_info = vinfo_for_stmt (stmt); @@ -3159,9 +3222,8 @@ vect_slp_transform_bb (basic_block bb) } } - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "BASIC BLOCK VECTORIZED\n"); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf (MSG_OPTIMIZED_LOCATIONS, "BASIC BLOCK VECTORIZED\n"); destroy_bb_vec_info (bb_vinfo); } - diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 210e5b5..1cc37ff 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" +#include "dumpfile.h" #include "tm.h" #include "ggc.h" #include "tree.h" @@ -189,8 +190,9 @@ vect_mark_relevant (VEC(gimple,heap) **worklist, gimple stmt, bool save_live_p = STMT_VINFO_LIVE_P (stmt_info); gimple pattern_stmt; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "mark relevant %d, live %d.", relevant, live_p); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "mark relevant %d, live %d.", relevant, live_p); /* If this stmt is an original stmt in a pattern, we might need to mark its related pattern stmt instead of the original stmt. However, such stmts @@ -244,9 +246,10 @@ vect_mark_relevant (VEC(gimple,heap) **worklist, gimple stmt, pattern_stmt = STMT_VINFO_RELATED_STMT (stmt_info); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "last stmt in pattern. don't mark" - " relevant/live."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "last stmt in pattern. don't mark" + " relevant/live."); stmt_info = vinfo_for_stmt (pattern_stmt); gcc_assert (STMT_VINFO_RELATED_STMT (stmt_info) == stmt); save_relevant = STMT_VINFO_RELEVANT (stmt_info); @@ -262,8 +265,9 @@ vect_mark_relevant (VEC(gimple,heap) **worklist, gimple stmt, if (STMT_VINFO_RELEVANT (stmt_info) == save_relevant && STMT_VINFO_LIVE_P (stmt_info) == save_live_p) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "already marked relevant/live."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "already marked relevant/live."); return; } @@ -306,8 +310,9 @@ vect_stmt_relevant_p (gimple stmt, loop_vec_info loop_vinfo, if (gimple_code (stmt) != GIMPLE_PHI) if (gimple_vdef (stmt)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vec_stmt_relevant_p: stmt has vdefs."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vec_stmt_relevant_p: stmt has vdefs."); *relevant = vect_used_in_scope; } @@ -319,8 +324,9 @@ vect_stmt_relevant_p (gimple stmt, loop_vec_info loop_vinfo, basic_block bb = gimple_bb (USE_STMT (use_p)); if (!flow_bb_inside_loop_p (loop, bb)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vec_stmt_relevant_p: used out of loop."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vec_stmt_relevant_p: used out of loop."); if (is_gimple_debug (USE_STMT (use_p))) continue; @@ -431,8 +437,9 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p, if (!vect_is_simple_use (use, stmt, loop_vinfo, NULL, &def_stmt, &def, &dt)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: unsupported use in stmt."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: unsupported use in stmt."); return false; } @@ -442,8 +449,8 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p, def_bb = gimple_bb (def_stmt); if (!flow_bb_inside_loop_p (loop, def_bb)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "def_stmt is out of loop."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "def_stmt is out of loop."); return true; } @@ -460,8 +467,9 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p, && STMT_VINFO_DEF_TYPE (dstmt_vinfo) == vect_reduction_def && bb->loop_father == def_bb->loop_father) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "reduc-stmt defining reduc-phi in the same nest."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "reduc-stmt defining reduc-phi in the same nest."); if (STMT_VINFO_IN_PATTERN_P (dstmt_vinfo)) dstmt_vinfo = vinfo_for_stmt (STMT_VINFO_RELATED_STMT (dstmt_vinfo)); gcc_assert (STMT_VINFO_RELEVANT (dstmt_vinfo) < vect_used_by_reduction); @@ -479,8 +487,9 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p, ... */ if (flow_loop_nested_p (def_bb->loop_father, bb->loop_father)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "outer-loop def-stmt defining inner-loop stmt."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "outer-loop def-stmt defining inner-loop stmt."); switch (relevant) { @@ -516,8 +525,9 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p, stmt # use (d) */ else if (flow_loop_nested_p (bb->loop_father, def_bb->loop_father)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "inner-loop def-stmt defining outer-loop stmt."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "inner-loop def-stmt defining outer-loop stmt."); switch (relevant) { @@ -579,8 +589,9 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) enum vect_relevant relevant, tmp_relevant; enum vect_def_type def_type; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vect_mark_stmts_to_be_vectorized ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vect_mark_stmts_to_be_vectorized ==="); worklist = VEC_alloc (gimple, heap, 64); @@ -591,10 +602,10 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si)) { phi = gsi_stmt (si); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "init: phi relevant? "); - print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "init: phi relevant? "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0); } if (vect_stmt_relevant_p (phi, loop_vinfo, &relevant, &live_p)) @@ -603,10 +614,10 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) { stmt = gsi_stmt (si); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "init: stmt relevant? "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "init: stmt relevant? "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); } if (vect_stmt_relevant_p (stmt, loop_vinfo, &relevant, &live_p)) @@ -621,10 +632,10 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) ssa_op_iter iter; stmt = VEC_pop (gimple, worklist); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "worklist: examine stmt: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "worklist: examine stmt: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); } /* Examine the USEs of STMT. For each USE, mark the stmt that defines it @@ -666,9 +677,9 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) /* fall through */ default: - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "unsupported use of reduction."); - + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unsupported use of reduction."); VEC_free (gimple, heap, worklist); return false; } @@ -681,8 +692,9 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) && tmp_relevant != vect_used_in_outer_by_reduction && tmp_relevant != vect_used_in_outer) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "unsupported use of nested cycle."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unsupported use of nested cycle."); VEC_free (gimple, heap, worklist); return false; @@ -695,8 +707,9 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) if (tmp_relevant != vect_unused_in_scope && tmp_relevant != vect_used_by_reduction) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "unsupported use of double reduction."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unsupported use of double reduction."); VEC_free (gimple, heap, worklist); return false; @@ -817,9 +830,10 @@ vect_model_simple_cost (stmt_vec_info stmt_info, int ncopies, inside_cost = record_stmt_cost (body_cost_vec, ncopies, vector_stmt, stmt_info, 0, vect_body); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_simple_cost: inside_cost = %d, " - "prologue_cost = %d .", inside_cost, prologue_cost); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_simple_cost: inside_cost = %d, " + "prologue_cost = %d .", inside_cost, prologue_cost); } @@ -862,9 +876,10 @@ vect_model_promotion_demotion_cost (stmt_vec_info stmt_info, prologue_cost += add_stmt_cost (target_cost_data, 1, vector_stmt, stmt_info, 0, vect_prologue); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_promotion_demotion_cost: inside_cost = %d, " - "prologue_cost = %d .", inside_cost, prologue_cost); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_promotion_demotion_cost: inside_cost = %d, " + "prologue_cost = %d .", inside_cost, prologue_cost); } /* Function vect_cost_group_size @@ -945,17 +960,19 @@ vect_model_store_cost (stmt_vec_info stmt_info, int ncopies, inside_cost = record_stmt_cost (body_cost_vec, nstmts, vec_perm, stmt_info, 0, vect_body); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_store_cost: strided group_size = %d .", - group_size); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_store_cost: strided group_size = %d .", + group_size); } /* Costs of the stores. */ vect_get_store_cost (first_dr, ncopies, &inside_cost, body_cost_vec); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_store_cost: inside_cost = %d, " - "prologue_cost = %d .", inside_cost, prologue_cost); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_store_cost: inside_cost = %d, " + "prologue_cost = %d .", inside_cost, prologue_cost); } @@ -977,9 +994,9 @@ vect_get_store_cost (struct data_reference *dr, int ncopies, vector_store, stmt_info, 0, vect_body); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_store_cost: aligned."); - + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_store_cost: aligned."); break; } @@ -989,11 +1006,10 @@ vect_get_store_cost (struct data_reference *dr, int ncopies, *inside_cost += record_stmt_cost (body_cost_vec, ncopies, unaligned_store, stmt_info, DR_MISALIGNMENT (dr), vect_body); - - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_store_cost: unaligned supported by " - "hardware."); - + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_store_cost: unaligned supported by " + "hardware."); break; } @@ -1001,9 +1017,9 @@ vect_get_store_cost (struct data_reference *dr, int ncopies, { *inside_cost = VECT_MAX_COST; - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_store_cost: unsupported access."); - + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "vect_model_store_cost: unsupported access."); break; } @@ -1060,9 +1076,10 @@ vect_model_load_cost (stmt_vec_info stmt_info, int ncopies, inside_cost += record_stmt_cost (body_cost_vec, nstmts, vec_perm, stmt_info, 0, vect_body); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_load_cost: strided group_size = %d .", - group_size); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_load_cost: strided group_size = %d .", + group_size); } /* The loads themselves. */ @@ -1083,9 +1100,10 @@ vect_model_load_cost (stmt_vec_info stmt_info, int ncopies, &inside_cost, &prologue_cost, prologue_cost_vec, body_cost_vec, true); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_load_cost: inside_cost = %d, " - "prologue_cost = %d .", inside_cost, prologue_cost); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_load_cost: inside_cost = %d, " + "prologue_cost = %d .", inside_cost, prologue_cost); } @@ -1109,8 +1127,9 @@ vect_get_load_cost (struct data_reference *dr, int ncopies, *inside_cost += record_stmt_cost (body_cost_vec, ncopies, vector_load, stmt_info, 0, vect_body); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_load_cost: aligned."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_load_cost: aligned."); break; } @@ -1121,9 +1140,10 @@ vect_get_load_cost (struct data_reference *dr, int ncopies, unaligned_load, stmt_info, DR_MISALIGNMENT (dr), vect_body); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_load_cost: unaligned supported by " - "hardware."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_load_cost: unaligned supported by " + "hardware."); break; } @@ -1141,16 +1161,18 @@ vect_get_load_cost (struct data_reference *dr, int ncopies, *inside_cost += record_stmt_cost (body_cost_vec, 1, vector_stmt, stmt_info, 0, vect_body); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_load_cost: explicit realign"); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_load_cost: explicit realign"); break; } case dr_explicit_realign_optimized: { - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_load_cost: unaligned software " - "pipelined."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_load_cost: unaligned software " + "pipelined."); /* Unaligned software pipeline has a load of an address, an initial load, and possibly a mask operation to "prime" the loop. However, @@ -1175,9 +1197,9 @@ vect_get_load_cost (struct data_reference *dr, int ncopies, *inside_cost += record_stmt_cost (body_cost_vec, ncopies, vec_perm, stmt_info, 0, vect_body); - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, - "vect_model_load_cost: explicit realign optimized"); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vect_model_load_cost: explicit realign optimized"); break; } @@ -1186,9 +1208,9 @@ vect_get_load_cost (struct data_reference *dr, int ncopies, { *inside_cost = VECT_MAX_COST; - if (vect_print_dump_info (REPORT_COST)) - fprintf (vect_dump, "vect_model_load_cost: unsupported access."); - + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "vect_model_load_cost: unsupported access."); break; } @@ -1236,10 +1258,11 @@ vect_init_vector_1 (gimple stmt, gimple new_stmt, gimple_stmt_iterator *gsi) } } - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "created new init_stmt: "); - print_gimple_stmt (vect_dump, new_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "created new init_stmt: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, new_stmt, 0); } } @@ -1317,26 +1340,32 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def) bool is_simple_use; tree vector_type; - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "vect_get_vec_def_for_operand: "); - print_generic_expr (vect_dump, op, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "vect_get_vec_def_for_operand: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, op); } is_simple_use = vect_is_simple_use (op, stmt, loop_vinfo, NULL, &def_stmt, &def, &dt); gcc_assert (is_simple_use); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { + int loc_printed = 0; if (def) { - fprintf (vect_dump, "def = "); - print_generic_expr (vect_dump, def, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "def = "); + loc_printed = 1; + dump_generic_expr (MSG_NOTE, TDF_SLIM, def); } if (def_stmt) { - fprintf (vect_dump, " def_stmt = "); - print_gimple_stmt (vect_dump, def_stmt, 0, TDF_SLIM); + if (loc_printed) + dump_printf (MSG_NOTE, " def_stmt = "); + else + dump_printf_loc (MSG_NOTE, vect_location, " def_stmt = "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, def_stmt, 0); } } @@ -1353,8 +1382,9 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def) *scalar_def = op; /* Create 'vect_cst_ = {cst,cst,...,cst}' */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Create vector_cst. nunits = %d", nunits); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Create vector_cst. nunits = %d", nunits); return vect_init_vector (stmt, op, vector_type, NULL); } @@ -1369,8 +1399,8 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def) *scalar_def = def; /* Create 'vec_inv = {inv,inv,..,inv}' */ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Create vector_inv."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "Create vector_inv."); return vect_init_vector (stmt, def, vector_type, NULL); } @@ -1631,10 +1661,10 @@ vect_finish_stmt_generation (gimple stmt, gimple vec_stmt, set_vinfo_for_stmt (vec_stmt, new_stmt_vec_info (vec_stmt, loop_vinfo, bb_vinfo)); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "add new stmt: "); - print_gimple_stmt (vect_dump, vec_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "add new stmt: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, vec_stmt, 0); } gimple_set_location (vec_stmt, gimple_location (stmt)); @@ -1734,8 +1764,9 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, if (rhs_type && !types_compatible_p (rhs_type, TREE_TYPE (op))) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "argument types differ."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "argument types differ."); return false; } if (!rhs_type) @@ -1744,8 +1775,9 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, if (!vect_is_simple_use_1 (op, stmt, loop_vinfo, bb_vinfo, &def_stmt, &def, &dt[i], &opvectype)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "use not simple."); return false; } @@ -1754,8 +1786,9 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, else if (opvectype && opvectype != vectype_in) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "argument vector types differ."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "argument vector types differ."); return false; } } @@ -1767,10 +1800,11 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, gcc_assert (vectype_in); if (!vectype_in) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "no vectype for scalar type "); - print_generic_expr (vect_dump, rhs_type, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "no vectype for scalar type "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, rhs_type); } return false; @@ -1795,8 +1829,9 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, fndecl = vectorizable_function (stmt, vectype_out, vectype_in); if (fndecl == NULL_TREE) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "function is not vectorizable."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "function is not vectorizable."); return false; } @@ -1817,16 +1852,16 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, if (!vec_stmt) /* transformation not required. */ { STMT_VINFO_TYPE (stmt_info) = call_vec_info_type; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vectorizable_call ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "=== vectorizable_call ==="); vect_model_simple_cost (stmt_info, ncopies, dt, NULL, NULL); return true; } /** Transform. **/ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "transform call."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "transform call."); /* Handle def. */ scalar_dest = gimple_call_lhs (stmt); @@ -2340,9 +2375,9 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi, && (TYPE_PRECISION (rhs_type) != GET_MODE_PRECISION (TYPE_MODE (rhs_type))))) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, - "type conversion to/from bit-precision unsupported."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "type conversion to/from bit-precision unsupported."); return false; } @@ -2350,8 +2385,9 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi, if (!vect_is_simple_use_1 (op0, stmt, loop_vinfo, bb_vinfo, &def_stmt, &def, &dt[0], &vectype_in)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "use not simple."); return false; } if (op_type == binary_op) @@ -2371,8 +2407,9 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi, if (!ok) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "use not simple."); return false; } } @@ -2385,10 +2422,11 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi, gcc_assert (vectype_in); if (!vectype_in) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "no vectype for scalar type "); - print_generic_expr (vect_dump, rhs_type, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "no vectype for scalar type "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, rhs_type); } return false; @@ -2428,8 +2466,9 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi, break; /* FALLTHRU */ unsupported: - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "conversion not supported by target."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "conversion not supported by target."); return false; case WIDEN: @@ -2526,8 +2565,9 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi, if (!vec_stmt) /* transformation not required. */ { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vectorizable_conversion ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vectorizable_conversion ==="); if (code == FIX_TRUNC_EXPR || code == FLOAT_EXPR) { STMT_VINFO_TYPE (stmt_info) = type_conversion_vec_info_type; @@ -2548,8 +2588,9 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi, } /** Transform. **/ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "transform conversion. ncopies = %d.", ncopies); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "transform conversion. ncopies = %d.", ncopies); if (op_type == binary_op) { @@ -2900,8 +2941,9 @@ vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi, if (!vect_is_simple_use_1 (op, stmt, loop_vinfo, bb_vinfo, &def_stmt, &def, &dt[0], &vectype_in)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "use not simple."); return false; } @@ -2928,24 +2970,26 @@ vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi, > TYPE_PRECISION (TREE_TYPE (op))) && TYPE_UNSIGNED (TREE_TYPE (op)))) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "type conversion to/from bit-precision " - "unsupported."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "type conversion to/from bit-precision " + "unsupported."); return false; } if (!vec_stmt) /* transformation not required. */ { STMT_VINFO_TYPE (stmt_info) = assignment_vec_info_type; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vectorizable_assignment ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vectorizable_assignment ==="); vect_model_simple_cost (stmt_info, ncopies, dt, NULL, NULL); return true; } /** Transform. **/ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "transform assignment."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "transform assignment."); /* Handle def. */ vec_dest = vect_create_destination_var (scalar_dest, vectype); @@ -3091,8 +3135,9 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi, if (TYPE_PRECISION (TREE_TYPE (scalar_dest)) != GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (scalar_dest)))) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bit-precision shifts not supported."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bit-precision shifts not supported."); return false; } @@ -3100,8 +3145,9 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi, if (!vect_is_simple_use_1 (op0, stmt, loop_vinfo, bb_vinfo, &def_stmt, &def, &dt[0], &vectype)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "use not simple."); return false; } /* If op0 is an external or constant def use a vector type with @@ -3112,12 +3158,9 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi, gcc_assert (vectype); if (!vectype) { - if (vect_print_dump_info (REPORT_DETAILS)) - { - fprintf (vect_dump, "no vectype for scalar type "); - print_generic_expr (vect_dump, TREE_TYPE (op0), TDF_SLIM); - } - + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "no vectype for scalar type "); return false; } @@ -3130,8 +3173,9 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi, if (!vect_is_simple_use_1 (op1, stmt, loop_vinfo, bb_vinfo, &def_stmt, &def, &dt[1], &op1_vectype)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "use not simple."); return false; } @@ -3174,8 +3218,9 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi, } else { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "operand mode requires invariant argument."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "operand mode requires invariant argument."); return false; } @@ -3183,16 +3228,19 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi, if (!scalar_shift_arg) { optab = optab_for_tree_code (code, vectype, optab_vector); - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vector/vector shift/rotate found."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vector/vector shift/rotate found."); + if (!op1_vectype) op1_vectype = get_same_sized_vectype (TREE_TYPE (op1), vectype_out); if (op1_vectype == NULL_TREE || TYPE_MODE (op1_vectype) != TYPE_MODE (vectype)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "unusable type for last operand in" - " vector/vector shift/rotate."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unusable type for last operand in" + " vector/vector shift/rotate."); return false; } } @@ -3204,8 +3252,9 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi, if (optab && optab_handler (optab, TYPE_MODE (vectype)) != CODE_FOR_nothing) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vector/scalar shift/rotate found."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vector/scalar shift/rotate found."); } else { @@ -3216,8 +3265,9 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi, { scalar_shift_arg = false; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vector/vector shift/rotate found."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "vector/vector shift/rotate found."); /* Unlike the other binary operators, shifts/rotates have the rhs being int, instead of the same type as the lhs, @@ -3232,9 +3282,10 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi, && TYPE_MODE (TREE_TYPE (vectype)) != TYPE_MODE (TREE_TYPE (op1))) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "unusable type for last operand in" - " vector/vector shift/rotate."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unusable type for last operand in" + " vector/vector shift/rotate."); return false; } if (vec_stmt && !slp_node) @@ -3251,23 +3302,25 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi, /* Supportable by target? */ if (!optab) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "no optab."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "no optab."); return false; } vec_mode = TYPE_MODE (vectype); icode = (int) optab_handler (optab, vec_mode); if (icode == CODE_FOR_nothing) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "op not supported by target."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "op not supported by target."); /* Check only during analysis. */ if (GET_MODE_SIZE (vec_mode) != UNITS_PER_WORD || (vf < vect_min_worthwhile_factor (code) && !vec_stmt)) return false; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "proceeding using word mode."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "proceeding using word mode."); } /* Worthwhile without SIMD support? Check only during analysis. */ @@ -3275,24 +3328,26 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi, && vf < vect_min_worthwhile_factor (code) && !vec_stmt) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "not worthwhile without SIMD support."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not worthwhile without SIMD support."); return false; } if (!vec_stmt) /* transformation not required. */ { STMT_VINFO_TYPE (stmt_info) = shift_vec_info_type; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vectorizable_shift ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "=== vectorizable_shift ==="); vect_model_simple_cost (stmt_info, ncopies, dt, NULL, NULL); return true; } /** Transform. **/ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "transform binary/unary operation."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "transform binary/unary operation."); /* Handle def. */ vec_dest = vect_create_destination_var (scalar_dest, vectype); @@ -3327,8 +3382,9 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi, optab_op2_mode = insn_data[icode].operand[2].mode; if (!VECTOR_MODE_P (optab_op2_mode)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "operand 1 using scalar mode."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "operand 1 using scalar mode."); vec_oprnd1 = op1; VEC_quick_push (tree, vec_oprnds1, vec_oprnd1); if (slp_node) @@ -3454,9 +3510,10 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi, op_type = TREE_CODE_LENGTH (code); if (op_type != unary_op && op_type != binary_op && op_type != ternary_op) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "num. args = %d (not unary/binary/ternary op).", - op_type); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "num. args = %d (not unary/binary/ternary op).", + op_type); return false; } @@ -3472,8 +3529,9 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi, && code != BIT_XOR_EXPR && code != BIT_AND_EXPR) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bit-precision arithmetic not supported."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bit-precision arithmetic not supported."); return false; } @@ -3481,8 +3539,9 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi, if (!vect_is_simple_use_1 (op0, stmt, loop_vinfo, bb_vinfo, &def_stmt, &def, &dt[0], &vectype)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "use not simple."); return false; } /* If op0 is an external or constant def use a vector type with @@ -3493,10 +3552,12 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi, gcc_assert (vectype); if (!vectype) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "no vectype for scalar type "); - print_generic_expr (vect_dump, TREE_TYPE (op0), TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "no vectype for scalar type "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + TREE_TYPE (op0)); } return false; @@ -3513,8 +3574,9 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi, if (!vect_is_simple_use (op1, stmt, loop_vinfo, bb_vinfo, &def_stmt, &def, &dt[1])) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "use not simple."); return false; } } @@ -3524,8 +3586,9 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi, if (!vect_is_simple_use (op2, stmt, loop_vinfo, bb_vinfo, &def_stmt, &def, &dt[2])) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "use not simple."); return false; } } @@ -3565,8 +3628,9 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi, optab = optab_for_tree_code (code, vectype, optab_default); if (!optab) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "no optab."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "no optab."); return false; } icode = (int) optab_handler (optab, vec_mode); @@ -3574,14 +3638,15 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi, if (icode == CODE_FOR_nothing) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "op not supported by target."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "op not supported by target."); /* Check only during analysis. */ if (GET_MODE_SIZE (vec_mode) != UNITS_PER_WORD || (!vec_stmt && vf < vect_min_worthwhile_factor (code))) return false; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "proceeding using word mode."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "proceeding using word mode."); } /* Worthwhile without SIMD support? Check only during analysis. */ @@ -3589,24 +3654,26 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi, && !vec_stmt && vf < vect_min_worthwhile_factor (code)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "not worthwhile without SIMD support."); - return false; + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not worthwhile without SIMD support."); } if (!vec_stmt) /* transformation not required. */ { STMT_VINFO_TYPE (stmt_info) = op_vec_info_type; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "=== vectorizable_operation ==="); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "=== vectorizable_operation ==="); vect_model_simple_cost (stmt_info, ncopies, dt, NULL, NULL); return true; } /** Transform. **/ - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "transform binary/unary operation."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "transform binary/unary operation."); /* Handle def. */ vec_dest = vect_create_destination_var (scalar_dest, vectype); @@ -3792,8 +3859,9 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, /* FORNOW. This restriction should be relaxed. */ if (loop && nested_in_vect_loop_p (loop, stmt) && ncopies > 1) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "multiple types in nested loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "multiple types in nested loop."); return false; } @@ -3825,8 +3893,9 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, if (!vect_is_simple_use (op, stmt, loop_vinfo, bb_vinfo, &def_stmt, &def, &dt)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "use not simple."); return false; } @@ -3845,8 +3914,9 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, ? STMT_VINFO_DR_STEP (stmt_info) : DR_STEP (dr), size_zero_node) < 0) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "negative step for store."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "negative step for store."); return false; } @@ -3875,8 +3945,9 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, if (!vect_is_simple_use (op, next_stmt, loop_vinfo, bb_vinfo, &def_stmt, &def, &dt)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "use not simple."); return false; } next_stmt = GROUP_NEXT_ELEMENT (vinfo_for_stmt (next_stmt)); @@ -3936,8 +4007,9 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, group_size = vec_num = 1; } - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "transform store. ncopies = %d",ncopies); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "transform store. ncopies = %d", ncopies); dr_chain = VEC_alloc (tree, heap, group_size); oprnds = VEC_alloc (tree, heap, group_size); @@ -4323,8 +4395,9 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, /* FORNOW. This restriction should be relaxed. */ if (nested_in_vect_loop && ncopies > 1) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "multiple types in nested loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "multiple types in nested loop."); return false; } @@ -4362,8 +4435,9 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, (e.g. - data copies). */ if (optab_handler (mov_optab, mode) == CODE_FOR_nothing) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Aligned load, but unsupported type."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Aligned load, but unsupported type."); return false; } @@ -4397,8 +4471,9 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, &def_stmt, &def, &gather_dt, &gather_off_vectype)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "gather index use not simple."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "gather index use not simple."); return false; } } @@ -4416,8 +4491,9 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, size_zero_node) < 0; if (negative && ncopies > 1) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "multiple types with negative step."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "multiple types with negative step."); return false; } @@ -4428,14 +4504,16 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, if (alignment_support_scheme != dr_aligned && alignment_support_scheme != dr_unaligned_supported) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "negative step but alignment required."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "negative step but alignment required."); return false; } if (!perm_mask_for_reverse (vectype)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "negative step and reversing not supported."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "negative step and reversing not supported."); return false; } } @@ -4448,8 +4526,9 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, return true; } - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "transform load. ncopies = %d", ncopies); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "transform load. ncopies = %d", ncopies); /** Transform. **/ @@ -5248,8 +5327,9 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi, /* FORNOW: not yet supported. */ if (STMT_VINFO_LIVE_P (stmt_info)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "value used after loop."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "value used after loop."); return false; } @@ -5447,16 +5527,17 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node) gimple pattern_stmt; gimple_seq pattern_def_seq; - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "==> examining statement: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "==> examining statement: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); } if (gimple_has_volatile_ops (stmt)) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) - fprintf (vect_dump, "not vectorized: stmt has volatile operands"); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: stmt has volatile operands"); return false; } @@ -5487,16 +5568,17 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node) /* Analyze PATTERN_STMT instead of the original stmt. */ stmt = pattern_stmt; stmt_info = vinfo_for_stmt (pattern_stmt); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "==> examining pattern statement: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "==> examining pattern statement: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); } } else { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "irrelevant."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "irrelevant."); return true; } @@ -5508,10 +5590,11 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node) || STMT_VINFO_LIVE_P (vinfo_for_stmt (pattern_stmt)))) { /* Analyze PATTERN_STMT too. */ - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "==> examining pattern statement: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "==> examining pattern statement: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); } if (!vect_analyze_stmt (pattern_stmt, need_to_vectorize, node)) @@ -5531,10 +5614,11 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node) || STMT_VINFO_LIVE_P (vinfo_for_stmt (pattern_def_stmt))) { /* Analyze def stmt of STMT if it's a pattern stmt. */ - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "==> examining pattern def statement: "); - print_gimple_stmt (vect_dump, pattern_def_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "==> examining pattern def statement: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, pattern_def_stmt, 0); } if (!vect_analyze_stmt (pattern_def_stmt, @@ -5569,27 +5653,30 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node) gcc_assert (PURE_SLP_STMT (stmt_info)); scalar_type = TREE_TYPE (gimple_get_lhs (stmt)); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "get vectype for scalar type: "); - print_generic_expr (vect_dump, scalar_type, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "get vectype for scalar type: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, scalar_type); } vectype = get_vectype_for_scalar_type (scalar_type); if (!vectype) { - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "not SLPed: unsupported data-type "); - print_generic_expr (vect_dump, scalar_type, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not SLPed: unsupported data-type "); + dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + scalar_type); } return false; } - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "vectype: "); - print_generic_expr (vect_dump, vectype, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "vectype: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, vectype); } STMT_VINFO_VECTYPE (stmt_info) = vectype; @@ -5630,11 +5717,12 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node) if (!ok) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "not vectorized: relevant stmt not "); - fprintf (vect_dump, "supported: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: relevant stmt not "); + dump_printf (MSG_MISSED_OPTIMIZATION, "supported: "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } return false; @@ -5651,11 +5739,12 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node) if (!ok) { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) { - fprintf (vect_dump, "not vectorized: live stmt not "); - fprintf (vect_dump, "supported: "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: live stmt not "); + dump_printf (MSG_MISSED_OPTIMIZATION, "supported: "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); } return false; @@ -5750,8 +5839,9 @@ vect_transform_stmt (gimple stmt, gimple_stmt_iterator *gsi, default: if (!STMT_VINFO_LIVE_P (stmt_info)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "stmt not supported."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "stmt not supported."); gcc_unreachable (); } } @@ -5774,8 +5864,9 @@ vect_transform_stmt (gimple stmt, gimple_stmt_iterator *gsi, tree scalar_dest; gimple exit_phi; - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Record the vdef for outer-loop vectorization."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, + "Record the vdef for outer-loop vectorization."); /* Find the relevant loop-exit phi-node, and reord the vec_stmt there (to be used when vectorizing outer-loop stmts that use the DEF of @@ -6005,26 +6096,28 @@ get_vectype_for_scalar_type_and_size (tree scalar_type, unsigned size) return NULL_TREE; vectype = build_vector_type (scalar_type, nunits); - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "get vectype with %d units of type ", nunits); - print_generic_expr (vect_dump, scalar_type, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "get vectype with %d units of type ", nunits); + dump_generic_expr (MSG_NOTE, TDF_SLIM, scalar_type); } if (!vectype) return NULL_TREE; - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "vectype: "); - print_generic_expr (vect_dump, vectype, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "vectype: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, vectype); } if (!VECTOR_MODE_P (TYPE_MODE (vectype)) && !INTEGRAL_MODE_P (TYPE_MODE (vectype))) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "mode not supported by target."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "mode not supported by target."); return NULL_TREE; } @@ -6093,10 +6186,11 @@ vect_is_simple_use (tree operand, gimple stmt, loop_vec_info loop_vinfo, *def_stmt = NULL; *def = NULL_TREE; - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "vect_is_simple_use: operand "); - print_generic_expr (vect_dump, operand, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, + "vect_is_simple_use: operand "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, operand); } if (CONSTANT_CLASS_P (operand)) @@ -6114,30 +6208,32 @@ vect_is_simple_use (tree operand, gimple stmt, loop_vec_info loop_vinfo, if (TREE_CODE (operand) == PAREN_EXPR) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "non-associatable copy."); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "non-associatable copy."); operand = TREE_OPERAND (operand, 0); } if (TREE_CODE (operand) != SSA_NAME) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "not ssa-name."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not ssa-name."); return false; } *def_stmt = SSA_NAME_DEF_STMT (operand); if (*def_stmt == NULL) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "no def_stmt."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "no def_stmt."); return false; } - if (vect_print_dump_info (REPORT_DETAILS)) + if (dump_kind_p (MSG_NOTE)) { - fprintf (vect_dump, "def_stmt: "); - print_gimple_stmt (vect_dump, *def_stmt, 0, TDF_SLIM); + dump_printf_loc (MSG_NOTE, vect_location, "def_stmt: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, *def_stmt, 0); } /* Empty stmt is expected only in case of a function argument. @@ -6166,13 +6262,14 @@ vect_is_simple_use (tree operand, gimple stmt, loop_vec_info loop_vinfo, && *dt == vect_double_reduction_def && gimple_code (stmt) != GIMPLE_PHI)) { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "Unsupported pattern."); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Unsupported pattern."); return false; } - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "type of def: %d.",*dt); + if (dump_kind_p (MSG_NOTE)) + dump_printf_loc (MSG_NOTE, vect_location, "type of def: %d.", *dt); switch (gimple_code (*def_stmt)) { @@ -6190,8 +6287,9 @@ vect_is_simple_use (tree operand, gimple stmt, loop_vec_info loop_vinfo, break; /* FALLTHRU */ default: - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "unsupported defining stmt: "); + if (dump_kind_p (MSG_MISSED_OPTIMIZATION)) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unsupported defining stmt: "); return false; } diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 8856a2c..777a126 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" +#include "dumpfile.h" #include "tm.h" #include "ggc.h" #include "tree.h" @@ -67,13 +68,6 @@ along with GCC; see the file COPYING3. If not see #include "tree-vectorizer.h" #include "tree-pass.h" -/* vect_dump will be set to stderr or dump_file if exist. */ -FILE *vect_dump; - -/* vect_verbosity_level set to an invalid value - to mark that it's uninitialized. */ -static enum vect_verbosity_levels vect_verbosity_level = MAX_VERBOSITY_LEVEL; - /* Loop or bb location. */ LOC vect_location; @@ -81,82 +75,6 @@ LOC vect_location; VEC(vec_void_p,heap) *stmt_vec_info_vec; - -/* Function vect_set_dump_settings. - - Fix the verbosity level of the vectorizer if the - requested level was not set explicitly using the flag - -ftree-vectorizer-verbose=N. - Decide where to print the debugging information (dump_file/stderr). - If the user defined the verbosity level, but there is no dump file, - print to stderr, otherwise print to the dump file. */ - -static void -vect_set_dump_settings (bool slp) -{ - vect_dump = dump_file; - - /* Check if the verbosity level was defined by the user: */ - if (user_vect_verbosity_level != MAX_VERBOSITY_LEVEL) - { - vect_verbosity_level = user_vect_verbosity_level; - /* Ignore user defined verbosity if dump flags require higher level of - verbosity. */ - if (dump_file) - { - if (((dump_flags & TDF_DETAILS) - && vect_verbosity_level >= REPORT_DETAILS) - || ((dump_flags & TDF_STATS) - && vect_verbosity_level >= REPORT_UNVECTORIZED_LOCATIONS)) - return; - } - else - { - /* If there is no dump file, print to stderr in case of loop - vectorization. */ - if (!slp) - vect_dump = stderr; - - return; - } - } - - /* User didn't specify verbosity level: */ - if (dump_file && (dump_flags & TDF_DETAILS)) - vect_verbosity_level = REPORT_DETAILS; - else if (dump_file && (dump_flags & TDF_STATS)) - vect_verbosity_level = REPORT_UNVECTORIZED_LOCATIONS; - else - vect_verbosity_level = REPORT_NONE; - - gcc_assert (dump_file || vect_verbosity_level == REPORT_NONE); -} - - -/* Function debug_loop_details. - - For vectorization debug dumps. */ - -bool -vect_print_dump_info (enum vect_verbosity_levels vl) -{ - if (vl > vect_verbosity_level) - return false; - - if (!current_function_decl || !vect_dump) - return false; - - if (vect_location == UNKNOWN_LOC) - fprintf (vect_dump, "\n%s:%d: note: ", - DECL_SOURCE_FILE (current_function_decl), - DECL_SOURCE_LINE (current_function_decl)); - else - fprintf (vect_dump, "\n%d: ", LOC_LINE (vect_location)); - - return true; -} - - /* Function vectorize_loops. Entry point to loop vectorization phase. */ @@ -176,9 +94,6 @@ vectorize_loops (void) if (vect_loops_num <= 1) return 0; - /* Fix the verbosity level if not defined explicitly by the user. */ - vect_set_dump_settings (false); - init_stmt_vec_info_vec (); /* ----------- Analyze loops. ----------- */ @@ -190,12 +105,10 @@ vectorize_loops (void) if (optimize_loop_nest_for_speed_p (loop)) { loop_vec_info loop_vinfo; - vect_location = find_loop_location (loop); - if (vect_location != UNKNOWN_LOC - && vect_verbosity_level > REPORT_NONE) - fprintf (vect_dump, "\nAnalyzing loop at %s:%d\n", - LOC_FILE (vect_location), LOC_LINE (vect_location)); + if (vect_location != UNKNOWN_LOC && dump_kind_p (MSG_ALL)) + dump_printf (MSG_ALL, "\nAnalyzing loop at %s:%d\n", + LOC_FILE (vect_location), LOC_LINE (vect_location)); loop_vinfo = vect_analyze_loop (loop); loop->aux = loop_vinfo; @@ -203,11 +116,9 @@ vectorize_loops (void) if (!loop_vinfo || !LOOP_VINFO_VECTORIZABLE_P (loop_vinfo)) continue; - if (vect_location != UNKNOWN_LOC - && vect_verbosity_level > REPORT_NONE) - fprintf (vect_dump, "\n\nVectorizing loop at %s:%d\n", - LOC_FILE (vect_location), LOC_LINE (vect_location)); - + if (vect_location != UNKNOWN_LOC && dump_kind_p (MSG_ALL)) + dump_printf (MSG_ALL, "\n\nVectorizing loop at %s:%d\n", + LOC_FILE (vect_location), LOC_LINE (vect_location)); vect_transform_loop (loop_vinfo); num_vectorized_loops++; } @@ -215,11 +126,11 @@ vectorize_loops (void) vect_location = UNKNOWN_LOC; statistics_counter_event (cfun, "Vectorized loops", num_vectorized_loops); - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS) - || (num_vectorized_loops > 0 - && vect_print_dump_info (REPORT_VECTORIZED_LOCATIONS))) - fprintf (vect_dump, "vectorized %u loops in function.\n", - num_vectorized_loops); + if (dump_kind_p (MSG_ALL) + || (num_vectorized_loops > 0 && dump_kind_p (MSG_ALL))) + dump_printf_loc (MSG_ALL, vect_location, + "vectorized %u loops in function.\n", + num_vectorized_loops); /* ----------- Finalize. ----------- */ @@ -248,9 +159,6 @@ execute_vect_slp (void) { basic_block bb; - /* Fix the verbosity level if not defined explicitly by the user. */ - vect_set_dump_settings (true); - init_stmt_vec_info_vec (); FOR_EACH_BB (bb) @@ -260,9 +168,9 @@ execute_vect_slp (void) if (vect_slp_analyze_bb (bb)) { vect_slp_transform_bb (bb); - - if (vect_print_dump_info (REPORT_VECTORIZED_LOCATIONS)) - fprintf (vect_dump, "basic block vectorized using SLP\n"); + if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "basic block vectorized using SLP\n"); } } @@ -335,12 +243,9 @@ increase_alignment (void) { DECL_ALIGN (decl) = TYPE_ALIGN (vectype); DECL_USER_ALIGN (decl) = 1; - if (dump_file) - { - fprintf (dump_file, "Increasing alignment of decl: "); - print_generic_expr (dump_file, decl, TDF_SLIM); - fprintf (dump_file, "\n"); - } + dump_printf (MSG_NOTE, "Increasing alignment of decl: "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, decl); + dump_printf (MSG_NOTE, "\n"); } } return 0; diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index bad0fa2..6c99776 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -848,9 +848,8 @@ known_alignment_for_access_p (struct data_reference *data_ref_info) return (DR_MISALIGNMENT (data_ref_info) != -1); } -/* vect_dump will be set to stderr or dump_file if exist. */ -extern FILE *vect_dump; -extern LOC vect_loop_location; +/* Source location */ +extern LOC vect_location; /*-----------------------------------------------------------------*/ /* Function prototypes. */ @@ -1012,7 +1011,5 @@ void vect_pattern_recog (loop_vec_info, bb_vec_info); /* In tree-vectorizer.c. */ unsigned vectorize_loops (void); -/* Vectorization debug information */ -extern bool vect_print_dump_info (enum vect_verbosity_levels); #endif /* GCC_TREE_VECTORIZER_H */ |