summaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
authorsinghai <singhai@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-01 05:43:06 +0000
committersinghai <singhai@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-01 05:43:06 +0000
commit7bd765d4ede65c5e4895dfd9ea458b3f35b8483a (patch)
tree525ba5cb84f1f7d04874c56225d38fe09fea8455 /gcc/tree-vectorizer.c
parent769bf18a20ee2540ca7601cdafabd62b18b9751b (diff)
downloadgcc-7bd765d4ede65c5e4895dfd9ea458b3f35b8483a.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191883 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vectorizer.c')
-rw-r--r--gcc/tree-vectorizer.c131
1 files changed, 18 insertions, 113 deletions
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 8856a2c51e6..777a126bb2c 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;