From: Joseph Myers Date: Tue, 28 Jun 2011 17:00:59 +0000 (+0100) Subject: common.opt (in_lto_p): New Variable entry. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a7d0d30f0b0257d66c13ea9bdd2418acc0e07830;p=gcc.git common.opt (in_lto_p): New Variable entry. * common.opt (in_lto_p): New Variable entry. * flags.h (in_lto_p): Move to common.opt. * gcc.c: Include params.h. (set_option_handlers): Also use common_handle_option and target_handle_option. (main): Call global_init_params, finish_params and init_options_struct. * opts.c (debug_type_names): Move from toplev.c. (print_filtered_help): Access quiet_flag through opts pointer. (common_handle_option): Return early in the driver for some options. Access in_lto_p, dwarf_version and warn_maybe_uninitialized through opts pointer. * toplev.c (in_lto_p): Move to common.opt. (debug_type_names): Move to opts.c. * Makefile.in (OBJS): Remove opts.o. (OBJS-libcommon-target): Add opts.o. (gcc.o): Update dependencies. From-SVN: r175591 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 60bc9c65b9a..2422d34c52c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2011-06-28 Joseph Myers + + * common.opt (in_lto_p): New Variable entry. + * flags.h (in_lto_p): Move to common.opt. + * gcc.c: Include params.h. + (set_option_handlers): Also use common_handle_option and + target_handle_option. + (main): Call global_init_params, finish_params and + init_options_struct. + * opts.c (debug_type_names): Move from toplev.c. + (print_filtered_help): Access quiet_flag through opts pointer. + (common_handle_option): Return early in the driver for some + options. Access in_lto_p, dwarf_version and + warn_maybe_uninitialized through opts pointer. + * toplev.c (in_lto_p): Move to common.opt. + (debug_type_names): Move to opts.c. + * Makefile.in (OBJS): Remove opts.o. + (OBJS-libcommon-target): Add opts.o. + (gcc.o): Update dependencies. + 2011-06-28 Kai Tietz * tree-ssa-forwprop.c (simplify_bitwise_binary): Improve diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 0a2d9275ad6..fc96ddafbfb 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1354,7 +1354,6 @@ OBJS = \ optabs.o \ options-save.o \ opts-global.o \ - opts.o \ passes.o \ plugin.o \ pointer-set.o \ @@ -1504,7 +1503,7 @@ OBJS-libcommon = diagnostic.o pretty-print.o intl.o input.o version.o # Objects in libcommon-target.a, used by drivers and by the core # compiler and containing target-dependent code. OBJS-libcommon-target = $(common_out_object_file) prefix.o params.o \ - opts-common.o options.o vec.o hooks.o common/common-targhooks.o + opts.o opts-common.o options.o vec.o hooks.o common/common-targhooks.o # This lists all host objects for the front ends. ALL_HOST_FRONTEND_OBJS = $(C_OBJS) \ @@ -2260,7 +2259,7 @@ DRIVER_DEFINES = \ gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h multilib.h \ Makefile $(lang_specs_files) specs.h prefix.h $(GCC_H) $(FLAGS_H) \ - configargs.h $(OBSTACK_H) $(OPTS_H) $(DIAGNOSTIC_H) $(VEC_H) + configargs.h $(OBSTACK_H) $(OPTS_H) $(DIAGNOSTIC_H) $(VEC_H) $(PARAMS_H) (SHLIB_LINK='$(SHLIB_LINK)'; \ $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \ $(DRIVER_DEFINES) \ diff --git a/gcc/common.opt b/gcc/common.opt index d1f286f164e..f1279369906 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -37,6 +37,13 @@ int optimize_size Variable int optimize_fast +; True if this is the lto front end. This is used to disable gimple +; generation and lowering passes that are normally run on the output +; of a front end. These passes must be bypassed for lto since they +; have already been done before the gimple was written. +Variable +bool in_lto_p = false + ; 0 means straightforward implementation of complex divide acceptable. ; 1 means wide ranges of inputs must work for complex divide. ; 2 means C99-like requirements for complex multiply and divide. diff --git a/gcc/flags.h b/gcc/flags.h index 41049557ea9..8cc6670ef1b 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -1,6 +1,6 @@ /* Compilation switch flag definitions for GCC. Copyright (C) 1987, 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -34,13 +34,6 @@ extern const char *const debug_type_names[]; extern void strip_off_ending (char *, int); extern int base_of_path (const char *path, const char **base_out); -/* True if this is the LTO front end (lto1). This is used to disable - gimple generation and lowering passes that are normally run on the - output of a front end. These passes must be bypassed for lto since - they have already been done before the gimple was written. */ - -extern bool in_lto_p; - /* Return true iff flags are set as if -ffast-math. */ extern bool fast_math_flags_set_p (const struct gcc_options *); extern bool fast_math_flags_struct_set_p (struct cl_optimization *); diff --git a/gcc/gcc.c b/gcc/gcc.c index eb917cdd995..2996de40d23 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -43,6 +43,7 @@ compilation is specified by a string called a "spec". */ #include "diagnostic.h" #include "flags.h" #include "opts.h" +#include "params.h" #include "vec.h" #include "filenames.h" @@ -3532,9 +3533,13 @@ set_option_handlers (struct cl_option_handlers *handlers) handlers->unknown_option_callback = driver_unknown_option_callback; handlers->wrong_lang_callback = driver_wrong_lang_callback; handlers->post_handling_callback = driver_post_handling_callback; - handlers->num_handlers = 1; + handlers->num_handlers = 3; handlers->handlers[0].handler = driver_handle_option; handlers->handlers[0].mask = CL_DRIVER; + handlers->handlers[1].handler = common_handle_option; + handlers->handlers[1].mask = CL_COMMON; + handlers->handlers[2].handler = target_handle_option; + handlers->handlers[2].mask = CL_TARGET; } /* Create the vector `switches' and its contents. @@ -6156,7 +6161,11 @@ main (int argc, char **argv) if (argv != old_argv) at_file_supplied = true; - global_options = global_options_init; + /* Register the language-independent parameters. */ + global_init_params (); + finish_params (); + + init_options_struct (&global_options, &global_options_set); decode_cmdline_options_to_array (argc, CONST_CAST2 (const char **, char **, argv), diff --git a/gcc/opts.c b/gcc/opts.c index c3e7bc7e3e1..aa85ae59df3 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -35,6 +35,12 @@ along with GCC; see the file COPYING3. If not see #include "insn-attr-common.h" #include "common/common-target.h" +/* Indexed by enum debug_info_type. */ +const char *const debug_type_names[] = +{ + "none", "stabs", "coff", "dwarf-2", "xcoff", "vms" +}; + /* Parse the -femit-struct-debug-detailed option value and set the flag variables. */ @@ -986,7 +992,7 @@ print_filtered_help (unsigned int include_flags, /* With the -Q option enabled we change the descriptive text associated with an option to be an indication of its current setting. */ - if (!quiet_flag) + if (!opts->x_quiet_flag) { void *flag_var = option_flag_var (i, opts); @@ -1246,6 +1252,9 @@ common_handle_option (struct gcc_options *opts, unsigned int undoc_mask; unsigned int i; + if (lang_mask == CL_DRIVER) + break;; + undoc_mask = ((opts->x_verbose_flag | opts->x_extra_warnings) ? 0 : CL_UNDOCUMENTED); @@ -1265,6 +1274,9 @@ common_handle_option (struct gcc_options *opts, } case OPT__target_help: + if (lang_mask == CL_DRIVER) + break; + print_specific_help (CL_TARGET, CL_UNDOCUMENTED, 0, opts, lang_mask); opts->x_exit_after_options = true; break; @@ -1280,6 +1292,9 @@ common_handle_option (struct gcc_options *opts, --help=target,^undocumented */ unsigned int exclude_flags = 0; + if (lang_mask == CL_DRIVER) + break; + /* Walk along the argument string, parsing each word in turn. The format is: arg = [^]{word}[,{arg}] @@ -1390,6 +1405,9 @@ common_handle_option (struct gcc_options *opts, } case OPT__version: + if (lang_mask == CL_DRIVER) + break; + opts->x_exit_after_options = true; break; @@ -1400,6 +1418,9 @@ common_handle_option (struct gcc_options *opts, break; case OPT_Werror_: + if (lang_mask == CL_DRIVER) + break; + enable_warning_as_error (arg, value, lang_mask, handlers, opts, opts_set, loc, dc); break; @@ -1576,7 +1597,7 @@ common_handle_option (struct gcc_options *opts, /* FIXME: Instrumentation we insert makes ipa-reference bitmaps quadratic. Disable the pass until better memory representation is done. */ - if (!opts_set->x_flag_ipa_reference && in_lto_p) + if (!opts_set->x_flag_ipa_reference && opts->x_in_lto_p) opts->x_flag_ipa_reference = false; break; @@ -1666,7 +1687,7 @@ common_handle_option (struct gcc_options *opts, if (value < 2 || value > 4) error_at (loc, "dwarf version %d is not supported", value); else - dwarf_version = value; + opts->x_dwarf_version = value; set_debug_level (DWARF2_DEBUG, false, "", opts, opts_set, loc); break; @@ -1713,7 +1734,7 @@ common_handle_option (struct gcc_options *opts, case OPT_Wuninitialized: /* Also turn on maybe uninitialized warning. */ - warn_maybe_uninitialized = value; + opts->x_warn_maybe_uninitialized = value; break; default: diff --git a/gcc/toplev.c b/gcc/toplev.c index 8b02b382d60..884994cb0e4 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -125,13 +125,6 @@ unsigned int save_decoded_options_count; const struct gcc_debug_hooks *debug_hooks; -/* True if this is the lto front end. This is used to disable - gimple generation and lowering passes that are normally run on the - output of a front end. These passes must be bypassed for lto since - they have already been done before the gimple was written. */ - -bool in_lto_p = false; - /* The FUNCTION_DECL for the function currently being compiled, or 0 if between functions. */ tree current_function_decl; @@ -658,12 +651,6 @@ compile_file (void) timevar_stop (TV_PHASE_GENERATE); } -/* Indexed by enum debug_info_type. */ -const char *const debug_type_names[] = -{ - "none", "stabs", "coff", "dwarf-2", "xcoff", "vms" -}; - /* Print version information to FILE. Each line begins with INDENT (for the case where FILE is the assembler output file). */