aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
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 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;