This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Move vect_set_verbosity_level to opts.c, avoid global state


On Wed, Nov 24, 2010 at 3:37 AM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> This patch moves vect_set_verbosity_level to opts.c, makes it static,
> makes it use the gcc_options structure and uses a UInteger marker in
> the .opt file to handle converting the string operand to an integer.
> As part of the move of enum verbosity_levels to the widely-used
> flag-types.h header, I changed the enum name to something less generic
> (enum vect_verbosity_levels).
>
> Bootstrapped with no regressions on x86_64-unknown-linux-gnu. ?OK to
> commit?

Ok.

Thanks,
Richard.

> 2010-11-23 ?Joseph Myers ?<joseph@codesourcery.com>
>
> ? ? ? ?* common.opt (user_vect_verbosity_level): New Variable entry.
> ? ? ? ?(ftree-vectorizer-verbose=): Mark as UInteger.
> ? ? ? ?* flag-types.h (enum vect_verbosity_levels): Move from enum
> ? ? ? ?verbosity_levels in tree-vectorizer.h.
> ? ? ? ?* opts.c: Don't include tree.h.
> ? ? ? ?(vect_set_verbosity_level): Move from tree-vectorizer.c. ?Use
> ? ? ? ?gcc_options parameter; take integer option argument.
> ? ? ? ?(common_handle_option): Update call to vect_set_verbosity_level.
> ? ? ? ?* tree-vectorizer.c (user_vect_verbosity_level): Remove.
> ? ? ? ?(vect_set_verbosity_level): Move to opts.c.
> ? ? ? ?(vect_verbosity_level, vect_print_dump_info): Update for change of
> ? ? ? ?enum name.
> ? ? ? ?* tree-vectorizer.h (enum verbosity_levels): Move to flag-types.h.
> ? ? ? ?(vect_print_dump_info): Update for change of enum name.
> ? ? ? ?* tree.h (vect_set_verbosity_level): Remove.
> ? ? ? ?* Makefile.in (opts.o): Update dependencies.
>
> diff -rupN --exclude=.svn gcc-mainline-1/gcc/Makefile.in gcc-mainline/gcc/Makefile.in
> --- gcc-mainline-1/gcc/Makefile.in ? ? ?2010-11-23 14:28:47.000000000 -0800
> +++ gcc-mainline/gcc/Makefile.in ? ? ? ?2010-11-23 16:58:17.000000000 -0800
> @@ -2824,7 +2824,7 @@ fold-const.o : fold-const.c $(CONFIG_H)
> ?diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
> ? ?version.h $(INPUT_H) intl.h $(DIAGNOSTIC_H) diagnostic.def
> ?opts.o : opts.c $(OPTS_H) $(OPTIONS_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_H) $(SYSTEM_H) \
> - ? coretypes.h $(TREE_H) $(TM_H) $(RTL_H) \
> + ? coretypes.h $(TM_H) $(RTL_H) \
> ? ?$(DIAGNOSTIC_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \
> ? ?$(FLAGS_H) $(PARAMS_H) opts-diagnostic.h
> ?opts-global.o : opts-global.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
> diff -rupN --exclude=.svn gcc-mainline-1/gcc/common.opt gcc-mainline/gcc/common.opt
> --- gcc-mainline-1/gcc/common.opt ? ? ? 2010-11-23 14:37:11.000000000 -0800
> +++ gcc-mainline/gcc/common.opt 2010-11-23 16:40:19.000000000 -0800
> @@ -152,6 +152,9 @@ 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
> +
> ?; -dA causes debug commentary information to be produced in
> ?; the generated assembly code (to make it more readable). ?This option
> ?; is generally only of use to those who actually need to read the
> @@ -1952,7 +1955,7 @@ Common Report Var(flag_tree_vect_loop_ve
> ?Enable loop versioning when doing loop vectorization on trees
>
> ?ftree-vectorizer-verbose=
> -Common RejectNegative Joined
> +Common RejectNegative Joined UInteger
> ?-ftree-vectorizer-verbose=<number> ? ? Set the verbosity level of the vectorizer
>
> ?ftree-scev-cprop
> diff -rupN --exclude=.svn gcc-mainline-1/gcc/flag-types.h gcc-mainline/gcc/flag-types.h
> --- gcc-mainline-1/gcc/flag-types.h ? ? 2010-11-23 07:37:33.000000000 -0800
> +++ gcc-mainline/gcc/flag-types.h ? ? ? 2010-11-23 16:34:40.000000000 -0800
> @@ -188,4 +188,20 @@ 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 -rupN --exclude=.svn gcc-mainline-1/gcc/opts.c gcc-mainline/gcc/opts.c
> --- gcc-mainline-1/gcc/opts.c ? 2010-11-23 14:44:54.000000000 -0800
> +++ gcc-mainline/gcc/opts.c ? ? 2010-11-23 16:57:56.000000000 -0800
> @@ -32,7 +32,6 @@ along with GCC; see the file COPYING3.
> ?#include "coretypes.h"
> ?#include "tm.h" /* Needed by rtl.h and used for DWARF2_DEBUGGING_INFO
> ? ? ? ? ? ? ? ? ? and DBX_DEBUGGING_INFO. ?*/
> -#include "tree.h" /* For vect_set_verbosity_level. ?*/
> ?#include "rtl.h" /* Needed by insn-attr.h. ?*/
> ?#include "opts.h"
> ?#include "options.h"
> @@ -144,6 +143,19 @@ set_struct_debug_option (struct gcc_opti
> ? ? }
> ?}
>
> +/* 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
> @@ -1615,7 +1627,7 @@ common_handle_option (struct gcc_options
> ? ? ? break;
>
> ? ? case OPT_ftree_vectorizer_verbose_:
> - ? ? ?vect_set_verbosity_level (arg);
> + ? ? ?vect_set_verbosity_level (opts, value);
> ? ? ? break;
>
> ? ? case OPT_ftls_model_:
> diff -rupN --exclude=.svn gcc-mainline-1/gcc/tree-vectorizer.c gcc-mainline/gcc/tree-vectorizer.c
> --- gcc-mainline-1/gcc/tree-vectorizer.c ? ? ? ?2010-11-19 05:28:32.000000000 -0800
> +++ gcc-mainline/gcc/tree-vectorizer.c ?2010-11-23 16:37:36.000000000 -0800
> @@ -75,8 +75,7 @@ FILE *vect_dump;
>
> ?/* vect_verbosity_level set to an invalid value
> ? ?to mark that it's uninitialized. ?*/
> -static enum verbosity_levels vect_verbosity_level = MAX_VERBOSITY_LEVEL;
> -static enum verbosity_levels user_vect_verbosity_level = MAX_VERBOSITY_LEVEL;
> +static enum vect_verbosity_levels vect_verbosity_level = MAX_VERBOSITY_LEVEL;
>
> ?/* Loop or bb location. ?*/
> ?LOC vect_location;
> @@ -86,25 +85,6 @@ VEC(vec_void_p,heap) *stmt_vec_info_vec;
>
>
>
> -/* Function vect_set_verbosity_level.
> -
> - ? Called from opts.c upon detection of the
> - ? -ftree-vectorizer-verbose=N option. ?*/
> -
> -void
> -vect_set_verbosity_level (const char *val)
> -{
> - ? unsigned int vl;
> -
> - ? vl = atoi (val);
> - ? if (vl < MAX_VERBOSITY_LEVEL)
> - ? ? user_vect_verbosity_level = (enum verbosity_levels) vl;
> - ? else
> - ? ? user_vect_verbosity_level
> - ? ? ?= (enum verbosity_levels) (MAX_VERBOSITY_LEVEL - 1);
> -}
> -
> -
> ?/* Function vect_set_dump_settings.
>
> ? ?Fix the verbosity level of the vectorizer if the
> @@ -161,7 +141,7 @@ vect_set_dump_settings (bool slp)
> ? ?For vectorization debug dumps. ?*/
>
> ?bool
> -vect_print_dump_info (enum verbosity_levels vl)
> +vect_print_dump_info (enum vect_verbosity_levels vl)
> ?{
> ? if (vl > vect_verbosity_level)
> ? ? return false;
> diff -rupN --exclude=.svn gcc-mainline-1/gcc/tree-vectorizer.h gcc-mainline/gcc/tree-vectorizer.h
> --- gcc-mainline-1/gcc/tree-vectorizer.h ? ? ? ?2010-10-22 05:11:05.000000000 -0700
> +++ gcc-mainline/gcc/tree-vectorizer.h ?2010-11-23 16:34:56.000000000 -0800
> @@ -70,22 +70,6 @@ enum vect_def_type {
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|| ((D) == vect_double_reduction_def) \
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|| ((D) == vect_nested_cycle))
>
> -/* Define verbosity levels. ?*/
> -enum 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
> -};
> -
> ?/************************************************************************
> ? SLP
> ?************************************************************************/
> @@ -902,6 +886,6 @@ void vect_pattern_recog (loop_vec_info);
> ?/* In tree-vectorizer.c. ?*/
> ?unsigned vectorize_loops (void);
> ?/* Vectorization debug information */
> -extern bool vect_print_dump_info (enum verbosity_levels);
> +extern bool vect_print_dump_info (enum vect_verbosity_levels);
>
> ?#endif ?/* GCC_TREE_VECTORIZER_H ?*/
> diff -rupN --exclude=.svn gcc-mainline-1/gcc/tree.h gcc-mainline/gcc/tree.h
> --- gcc-mainline-1/gcc/tree.h ? 2010-11-23 14:13:51.000000000 -0800
> +++ gcc-mainline/gcc/tree.h ? ? 2010-11-23 16:35:56.000000000 -0800
> @@ -5418,9 +5418,6 @@ extern bool in_gimple_form;
> ?extern tree get_base_address (tree t);
> ?extern void mark_addressable (tree);
>
> -/* In tree-vectorizer.c. ?*/
> -extern void vect_set_verbosity_level (const char *);
> -
> ?/* In tree.c. ?*/
>
> ?struct GTY(()) tree_map_base {
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]