Options initialization rearrangement

Richard Guenther richard.guenther@gmail.com
Fri Oct 8 09:25:00 GMT 2010


On Thu, Oct 7, 2010 at 5:21 PM, Joseph S. Myers <joseph@codesourcery.com> wrote:
> This patch (including changes to the various front ends) makes some
> changes to how options-related initialization is carried out, with a
> view to separating code that acts on a gcc_options structure (to be
> shared with the driver, except for the front-end parts) from code with
> other global effects (generally not to be shared with the driver).
>
> The general idea is that a gcc_options structure is initialized,
> updated in the course of processing options, then finalized, and other
> compiler state is configured either at an early point without using
> the structure, or after it is finalized.  As I noted in
> <http://gcc.gnu.org/ml/gcc-patches/2010-06/msg02689.html>, "target"
> and "optimize" attributes ought to work using a copy of the structure
> from *before* finalization in order to work reliably.
>
> This patch makes the first steps in that general direction rather than
> implementing it completely; subsequent patches will build on it.
>
> * The static initializers for options now go in a separate
>  global_options_init which is copied to global_options in the
>  initialization step, reflecting that there will be more than one
>  gcc_options structure to initialize in future.
>
> * There are explicit init_options_once, init_options_struct and
>  lang_hooks.init_options_struct steps, each of which has some parts
>  moved out from the previous functions.  Thus various parts of
>  initialization are reordered, but this is not intended to change the
>  behavior of the compiler.
>
> * The Fortran gfc_init_options hook set flag_short_enums to a
>  target-dependent default.  This was too early to set it, since the
>  target-dependent default may depend on command-line options; the
>  default is set in language-independent code in process_options,
>  which should suffice for all languages, so the front-end setting is
>  removed.  (I think that front-end setting was a relic of when
>  Fortran used its own short-enums flag instead of the
>  language-independent one.)
>
> * Several variables that are naturally set in the structure
>  initialization hooks are moved into the gcc_options structure.  Some
>  of these have enum types from flags.h.  This means that options.h
>  always has to be included after the enum declarations in flags.h.
>  Most files just include flags.h and get options.h from there; some
>  include options.h (unnecessarily) after flags.h; those that included
>  options.h only were changed to include flags.h instead.  Various
>  parts of flags.h and options.h were disabled for target libraries
>  because including flags.h instead of options.h in target code (via
>  tm.h) caused some problems there.  (I'm not sure what was being used
>  in target code, but probably some TARGET_* macro definitions from
>  options.h.)
>
> * The setting of options based on the optimization level was moved
>  into a new default_options_optimization function.  This is simply a
>  convenience separation of functions; it hasn't yet been modified to
>  work directly on options structures so asserts that global_options
>  and global_options_set are in use.  (It doesn't in fact use the _set
>  information at all - but if it (and the target_option.optimization
>  hooks) did so, that would provide 90% of a solution to PR 38716
>  regarding how optimize attributes work with explicitly overridden
>  options.  A full solution would require dealing with cases where a
>  -f option is implied by another -f option (which takes precedence
>  over implication by a -O option); that would involve _set storing
>  information about the closeness of an option that implied another
>  option, for the notion of closeness I mentioned in appendix 1 to my
>  original multilibs proposal, rather than just storing a binary
>  explicit/implicit state.)
>
> * Similarly, what decode_options does after calling option handlers is
>  moved into finish_options.  This also has yet to be converted to use
>  options structures explicitly, or to be separated into parts working
>  on options structures versus those using other state.  Also, there
>  is some initialization after decode_options, including in
>  process_options called from do_compile and in the target option
>  override hook, which again should be split up and moved into the two
>  parts of finish_options.
>
> * The rearrangements in this patch eliminate most checks on the
>  first_time_p variable that was in decode_options.  It is now in
>  finish_options and only checked for flag_pic/flag_shlib
>  initialization.  This variable serves to distinguish the initial
>  call from calls from "optimize" attributes.  If those attributes
>  worked with the options structure from before finish_options, it
>  would not be a problem for finish_options to be called more than
>  once without needing any checks there on first_time_p.
>
> Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
> commit?

Ok for the ME pieces.

Thanks,
Richard.

> 2010-10-07  Joseph Myers  <joseph@codesourcery.com>
>
>        * Makefile.in (TM_H): Include $(FLAGS_H) instead of options.h.
>        (TREE_H): Include $(FLAGS_H) instead of options.h.
>        (opts-common.o): Depend on $(FLAGS_H) instead of options.h.
>        * c-objc-common.h (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
>        * common.opt (flag_complex_method, flag_evaluation_order,
>        flag_ira_algorithm, flag_ira_region, flag_warn_unused_result): New
>        Variable declarations.
>        * configure.ac (tm_include_list): Include flags.h instead of
>        options.h.
>        * configure: Regenerate.
>        * flags.h: Condition out contents for target libraries.  Include
>        options.h at end of file.
>        (flag_complex_method, flag_ira_algorithm, flag_ira_region,
>        flag_evaluation_order, flag_warn_unused_result): Remove.
>        * gcc.c (main): Intialize global_options with global_options_init.
>        * langhooks-def.h (lhd_init_options_struct): Declare.
>        (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
>        (LANG_HOOKS_INITIALIZER): Include LANG_HOOKS_INIT_OPTIONS_STRUCT.
>        * langhooks.c (lhd_init_options_struct): New.
>        * langhooks.h (struct lang_hooks): Add init_options_struct.
>        Update comment on init_options.
>        * optc-gen.awk: Generate initializer for global_options_init, not
>        global_options.
>        * opth-gen.awk: Condition out structure declarations for target
>        libraries.  Declare global_options_init.
>        * opts-common.c: Include flags.h instead of options.h.
>        * opts.c (flag_warn_unused_result): Remove.
>        (read_cmdline_options): Take gcc_options parameters.  Pass them to
>        read_cmdline_option.
>        (initial_lang_mask, initial_min_crossjump_insns,
>        initial_max_fields_for_field_sensitive,
>        initial_loop_invariant_max_bbs_in_loop): Define at file scope.
>        (init_options_once): New.  Split out of decode_options.
>        (init_options_struct): New.  Split out of decode_options.
>        (decode_cmdline_options_to_array_default_mask): New.
>        (default_options_optimization): New.  Split out of decode_options.
>        (decode_options): Move most code to other functions.  Update call
>        to read_cmdline_options.
>        (finish_options): New.  Split out of decode_options.
>        * opts.h (decode_options): Add gcc_options parameters.
>        (init_options_once, init_options_struct,
>        decode_cmdline_options_to_array_default_mask): New.
>        * toplev.c (flag_complex_method, flag_ira_algorithm,
>        flag_ira_region, flag_evaluation_order): Remove.
>        (general_init): Use global_options_init for initial flag values
>        for global_dc.
>        (toplev_main): Call init_options_once, init_options_struct,
>        lang_hooks.init_options_struct,
>        decode_cmdline_options_to_array_default_mask and
>        lang_hooks.init_option before decode_options.  Update arguments to
>        decode_options.
>        * tree.h: Include flags.h instead of options.h.
>
> ada:
> 2010-10-07  Joseph Myers  <joseph@codesourcery.com>
>
>        * gcc-interface/misc.c (gnat_init_options_struct): New.  Split out
>        from gnat_init_options.
>        (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
>
> c-family:
> 2010-10-07  Joseph Myers  <joseph@codesourcery.com>
>
>        * c-common.c (parse_optimize_options): Call
>        decode_cmdline_options_to_array_default_mask before
>        decode_options.  Update arguments to decode_options.
>        * c-common.h (c_common_init_options_struct): Declare.
>        * c-opts.c (c_common_init_options_struct): New.  Split out from
>        c_common_init_options.
>
> cp:
> 2010-10-07  Joseph Myers  <joseph@codesourcery.com>
>
>        * cp-objcp-common.h (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
>
> fortran:
> 2010-10-07  Joseph Myers  <joseph@codesourcery.com>
>
>        * f95-lang.c (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
>        * gfortran.h (gfc_init_options_struct): Declare.
>        * options.c (gfc_init_options_struct): New.  Split out from
>        gfc_init_options.
>
> java:
> 2010-10-07  Joseph Myers  <joseph@codesourcery.com>
>
>        * lang.c (java_init_options_struct): New.  Split out from
>        java_init_options.
>        (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
>
> lto:
> 2010-10-07  Joseph Myers  <joseph@codesourcery.com>
>
>        * lto-lang.c (lto_init_options): Change to
>        lto_init_options_struct.  Update parameters.
>        (LANG_HOOKS_INIT_OPTIONS): Don't define.
>        (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
>
> Index: gcc/flags.h
> ===================================================================
> --- gcc/flags.h (revision 164991)
> +++ gcc/flags.h (working copy)
> @@ -23,7 +23,8 @@ along with GCC; see the file COPYING3.
>  #define GCC_FLAGS_H
>
>  #include "coretypes.h"
> -#include "options.h"
> +
> +#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)
>
>  enum debug_info_type
>  {
> @@ -147,12 +148,6 @@ extern int flag_print_asm_name;
>
>  /* Now the symbols that are set with `-f' switches.  */
>
> -/* 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.  */
> -
> -extern int flag_complex_method;
> -
>  /* Nonzero if we are only using compiler to check syntax errors.  */
>
>  extern int rtl_dump_and_exit;
> @@ -201,8 +196,6 @@ enum ira_algorithm
>   IRA_ALGORITHM_PRIORITY
>  };
>
> -extern enum ira_algorithm flag_ira_algorithm;
> -
>  /* The regions used for the integrated register allocator (IRA).  */
>  enum ira_region
>  {
> @@ -211,8 +204,6 @@ enum ira_region
>   IRA_REGION_MIXED
>  };
>
> -extern enum ira_region flag_ira_region;
> -
>  /* The options for excess precision.  */
>  enum excess_precision
>  {
> @@ -269,12 +260,6 @@ extern struct target_flag_state *this_ta
>  #define flag_excess_precision \
>   (this_target_flag_state->x_flag_excess_precision)
>
> -/* Nonzero if subexpressions must be evaluated from left-to-right.  */
> -extern int flag_evaluation_order;
> -
> -/* Whether to run the warn_unused_result attribute pass.  */
> -extern bool flag_warn_unused_result;
> -
>  /* Nonzero if we dump in VCG format, not plain text.  */
>  extern int dump_for_graph;
>
> @@ -369,4 +354,10 @@ enum warn_strict_overflow_code
>  /* Whether to emit an overflow warning whose code is C.  */
>  #define issue_strict_overflow_warning(c) (warn_strict_overflow >= (int) (c))
>
> +#endif
> +
> +/* This is included last because options may use types declared
> +   above.  */
> +#include "options.h"
> +
>  #endif /* ! GCC_FLAGS_H */
> Index: gcc/opts-common.c
> ===================================================================
> --- gcc/opts-common.c   (revision 164991)
> +++ gcc/opts-common.c   (working copy)
> @@ -22,7 +22,7 @@ along with GCC; see the file COPYING3.
>  #include "intl.h"
>  #include "coretypes.h"
>  #include "opts.h"
> -#include "options.h"
> +#include "flags.h"
>  #include "diagnostic.h"
>  #include "tm.h" /* For SWITCH_TAKES_ARG, WORD_SWITCH_TAKES_ARG and
>                   TARGET_OPTION_TRANSLATE_TABLE.  */
> Index: gcc/c-family/c-opts.c
> ===================================================================
> --- gcc/c-family/c-opts.c       (revision 164991)
> +++ gcc/c-family/c-opts.c       (working copy)
> @@ -273,6 +273,19 @@ c_common_complain_wrong_lang_p (const st
>   return true;
>  }
>
> +/* Initialize options structure OPTS.  */
> +void
> +c_common_init_options_struct (struct gcc_options *opts)
> +{
> +  opts->x_flag_exceptions = c_dialect_cxx ();
> +  opts->x_warn_pointer_arith = c_dialect_cxx ();
> +  opts->x_warn_write_strings = c_dialect_cxx ();
> +  opts->x_flag_warn_unused_result = true;
> +
> +  /* By default, C99-like requirements for complex multiply and divide.  */
> +  opts->x_flag_complex_method = 2;
> +}
> +
>  /* Common initialization before calling option handlers.  */
>  void
>  c_common_init_options (unsigned int decoded_options_count,
> @@ -294,14 +307,6 @@ c_common_init_options (unsigned int deco
>      before passing on command-line options to cpplib.  */
>   cpp_opts->warn_dollars = 0;
>
> -  flag_exceptions = c_dialect_cxx ();
> -  warn_pointer_arith = c_dialect_cxx ();
> -  warn_write_strings = c_dialect_cxx();
> -  flag_warn_unused_result = true;
> -
> -  /* By default, C99-like requirements for complex multiply and divide.  */
> -  flag_complex_method = 2;
> -
>   deferred_opts = XNEWVEC (struct deferred_opt, decoded_options_count);
>
>   if (c_language == clk_c)
> Index: gcc/c-family/c-common.c
> ===================================================================
> --- gcc/c-family/c-common.c     (revision 164991)
> +++ gcc/c-family/c-common.c     (working copy)
> @@ -7802,8 +7802,11 @@ parse_optimize_options (tree args, bool
>   saved_flag_strict_aliasing = flag_strict_aliasing;
>
>   /* Now parse the options.  */
> -  decode_options (opt_argc, opt_argv, &decoded_options,
> -                 &decoded_options_count);
> +  decode_cmdline_options_to_array_default_mask (opt_argc, opt_argv,
> +                                               &decoded_options,
> +                                               &decoded_options_count);
> +  decode_options (&global_options, &global_options_set,
> +                 decoded_options, decoded_options_count);
>
>   targetm.override_options_after_change();
>
> Index: gcc/c-family/c-common.h
> ===================================================================
> --- gcc/c-family/c-common.h     (revision 164991)
> +++ gcc/c-family/c-common.h     (working copy)
> @@ -743,6 +743,7 @@ extern tree build_va_arg (location_t, tr
>  extern unsigned int c_common_option_lang_mask (void);
>  extern void c_common_initialize_diagnostics (diagnostic_context *);
>  extern bool c_common_complain_wrong_lang_p (const struct cl_option *);
> +extern void c_common_init_options_struct (struct gcc_options *);
>  extern void c_common_init_options (unsigned int, struct cl_decoded_option *);
>  extern bool c_common_post_options (const char **);
>  extern bool c_common_init (void);
> Index: gcc/java/lang.c
> ===================================================================
> --- gcc/java/lang.c     (revision 164991)
> +++ gcc/java/lang.c     (working copy)
> @@ -48,6 +48,7 @@ The Free Software Foundation is independ
>  static bool java_init (void);
>  static void java_finish (void);
>  static unsigned int java_option_lang_mask (void);
> +static void java_init_options_struct (struct gcc_options *);
>  static void java_init_options (unsigned int, struct cl_decoded_option *);
>  static bool java_post_options (const char **);
>
> @@ -126,6 +127,8 @@ struct GTY(()) language_function {
>  #define LANG_HOOKS_FINISH java_finish
>  #undef LANG_HOOKS_OPTION_LANG_MASK
>  #define LANG_HOOKS_OPTION_LANG_MASK java_option_lang_mask
> +#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
> +#define LANG_HOOKS_INIT_OPTIONS_STRUCT java_init_options_struct
>  #undef LANG_HOOKS_INIT_OPTIONS
>  #define LANG_HOOKS_INIT_OPTIONS java_init_options
>  #undef LANG_HOOKS_HANDLE_OPTION
> @@ -535,23 +538,29 @@ java_option_lang_mask (void)
>   return CL_Java;
>  }
>
> +/* Initialize options structure OPTS.  */
> +
>  static void
> -java_init_options (unsigned int decoded_options_count ATTRIBUTE_UNUSED,
> -                  struct cl_decoded_option *decoded_options ATTRIBUTE_UNUSED)
> +java_init_options_struct (struct gcc_options *opts)
>  {
> -  flag_bounds_check = 1;
> -  flag_exceptions = 1;
> -  flag_non_call_exceptions = 1;
> +  opts->x_flag_bounds_check = 1;
> +  opts->x_flag_exceptions = 1;
> +  opts->x_flag_non_call_exceptions = 1;
>
>   /* In Java floating point operations never trap.  */
> -  flag_trapping_math = 0;
> +  opts->x_flag_trapping_math = 0;
>
>   /* In Java arithmetic overflow always wraps around.  */
> -  flag_wrapv = 1;
> +  opts->x_flag_wrapv = 1;
>
>   /* Java requires left-to-right evaluation of subexpressions.  */
> -  flag_evaluation_order = 1;
> +  opts->x_flag_evaluation_order = 1;
> +}
>
> +static void
> +java_init_options (unsigned int decoded_options_count ATTRIBUTE_UNUSED,
> +                  struct cl_decoded_option *decoded_options ATTRIBUTE_UNUSED)
> +{
>   jcf_path_init ();
>  }
>
> Index: gcc/tree.h
> ===================================================================
> --- gcc/tree.h  (revision 164991)
> +++ gcc/tree.h  (working copy)
> @@ -32,7 +32,7 @@ along with GCC; see the file COPYING3.
>  #include "real.h"
>  #include "fixed-value.h"
>  #include "alias.h"
> -#include "options.h"
> +#include "flags.h"
>
>  /* Codes of tree nodes */
>
> Index: gcc/configure
> ===================================================================
> --- gcc/configure       (revision 164991)
> +++ gcc/configure       (working copy)
> @@ -10843,7 +10843,7 @@ tmake_file="${tmake_file_}"
>  out_object_file=`basename $out_file .c`.o
>
>  tm_file_list="options.h"
> -tm_include_list="options.h insn-constants.h"
> +tm_include_list="flags.h insn-constants.h"
>  for f in $tm_file; do
>   case $f in
>     ./* )
> Index: gcc/gcc.c
> ===================================================================
> --- gcc/gcc.c   (revision 164991)
> +++ gcc/gcc.c   (working copy)
> @@ -6135,6 +6135,8 @@ main (int argc, char **argv)
>   if (argv != old_argv)
>     at_file_supplied = true;
>
> +  global_options = global_options_init;
> +
>   decode_cmdline_options_to_array (argc, CONST_CAST2 (const char **, char **,
>                                                      argv),
>                                   CL_DRIVER,
> Index: gcc/toplev.c
> ===================================================================
> --- gcc/toplev.c        (revision 164991)
> +++ gcc/toplev.c        (working copy)
> @@ -198,12 +198,6 @@ unsigned local_tick;
>
>  /* -f flags.  */
>
> -/* 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.  */
> -
> -int flag_complex_method = 1;
> -
>  /* Nonzero means we should be saving declaration info into a .X file.  */
>
>  int flag_gen_aux_info = 0;
> @@ -229,12 +223,6 @@ int flag_next_runtime = 0;
>
>  enum tls_model flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
>
> -/* Set the default region and algorithm for the integrated register
> -   allocator.  */
> -
> -enum ira_algorithm flag_ira_algorithm = IRA_ALGORITHM_CB;
> -enum ira_region flag_ira_region = IRA_REGION_MIXED;
> -
>  /* Set the default for excess precision.  */
>
>  enum excess_precision flag_excess_precision_cmdline = EXCESS_PRECISION_DEFAULT;
> @@ -293,9 +281,6 @@ typedef struct
>  }
>  lang_independent_options;
>
> -/* Nonzero if subexpressions must be evaluated from left-to-right.  */
> -int flag_evaluation_order = 0;
> -
>  /* The user symbol prefix after having resolved same.  */
>  const char *user_label_prefix;
>
> @@ -1661,8 +1646,10 @@ general_init (const char *argv0)
>   /* Set a default printer.  Language specific initializations will
>      override it later.  */
>   pp_format_decoder (global_dc->printer) = &default_tree_printer;
> -  global_dc->show_option_requested = flag_diagnostics_show_option;
> -  global_dc->show_column = flag_show_column;
> +  global_dc->show_option_requested
> +    = global_options_init.x_flag_diagnostics_show_option;
> +  global_dc->show_column
> +    = global_options_init.x_flag_show_column;
>   global_dc->internal_error = plugins_internal_error_function;
>   global_dc->option_enabled = option_enabled;
>   global_dc->option_state = &global_options;
> @@ -2395,10 +2382,29 @@ toplev_main (int argc, char **argv)
>   /* Initialization of GCC's environment, and diagnostics.  */
>   general_init (argv[0]);
>
> +  /* One-off initialization of options that does not need to be
> +     repeated when options are added for particular functions.  */
> +  init_options_once ();
> +
> +  /* Initialize global options structures; this must be repeated for
> +     each structure used for parsing options.  */
> +  init_options_struct (&global_options, &global_options_set);
> +  lang_hooks.init_options_struct (&global_options);
> +
> +  /* Convert the options to an array.  */
> +  decode_cmdline_options_to_array_default_mask (argc,
> +                                               CONST_CAST2 (const char **,
> +                                                            char **, argv),
> +                                               &save_decoded_options,
> +                                               &save_decoded_options_count);
> +
> +  /* Perform language-specific options initialization.  */
> +  lang_hooks.init_options (save_decoded_options_count, save_decoded_options);
> +
>   /* Parse the options and do minimal processing; basically just
>      enough to default flags appropriately.  */
> -  decode_options (argc, CONST_CAST2 (const char **, char **, argv),
> -                 &save_decoded_options, &save_decoded_options_count);
> +  decode_options (&global_options, &global_options_set,
> +                 save_decoded_options, save_decoded_options_count);
>
>   init_local_tick ();
>
> Index: gcc/cp/cp-objcp-common.h
> ===================================================================
> --- gcc/cp/cp-objcp-common.h    (revision 164991)
> +++ gcc/cp/cp-objcp-common.h    (working copy)
> @@ -45,6 +45,8 @@ extern bool cp_function_decl_explicit_p
>  #define LANG_HOOKS_OPTION_LANG_MASK c_common_option_lang_mask
>  #undef LANG_HOOKS_COMPLAIN_WRONG_LANG_P
>  #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P c_common_complain_wrong_lang_p
> +#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
> +#define LANG_HOOKS_INIT_OPTIONS_STRUCT c_common_init_options_struct
>  #undef LANG_HOOKS_INIT_OPTIONS
>  #define LANG_HOOKS_INIT_OPTIONS c_common_init_options
>  #undef LANG_HOOKS_INITIALIZE_DIAGNOSTICS
> Index: gcc/c-objc-common.h
> ===================================================================
> --- gcc/c-objc-common.h (revision 164991)
> +++ gcc/c-objc-common.h (working copy)
> @@ -33,6 +33,8 @@ along with GCC; see the file COPYING3.
>  #define LANG_HOOKS_OPTION_LANG_MASK c_common_option_lang_mask
>  #undef LANG_HOOKS_COMPLAIN_WRONG_LANG_P
>  #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P c_common_complain_wrong_lang_p
> +#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
> +#define LANG_HOOKS_INIT_OPTIONS_STRUCT c_common_init_options_struct
>  #undef LANG_HOOKS_INIT_OPTIONS
>  #define LANG_HOOKS_INIT_OPTIONS c_common_init_options
>  #undef LANG_HOOKS_INITIALIZE_DIAGNOSTICS
> Index: gcc/opts.c
> ===================================================================
> --- gcc/opts.c  (revision 164991)
> +++ gcc/opts.c  (working copy)
> @@ -353,9 +353,6 @@ DEF_VEC_ALLOC_P(const_char_p,heap);
>
>  static VEC(const_char_p,heap) *ignored_options;
>
> -/* Language specific warning pass for unused results.  */
> -bool flag_warn_unused_result = false;
> -
>  /* Input file names.  */
>  const char **in_fnames;
>  unsigned num_in_fnames;
> @@ -613,11 +610,14 @@ flag_instrument_functions_exclude_p (tre
>  }
>
>
> -/* Handle the vector of command line options.  LANG_MASK
> -   contains has a single bit set representing the current
> -   language.  HANDLERS describes what functions to call for the options.  */
> +/* Handle the vector of command line options, storing the results of
> +   processing DECODED_OPTIONS and DECODED_OPTIONS_COUNT in OPTS and
> +   OPTS_SET.  LANG_MASK contains has a single bit set representing the
> +   current language.  HANDLERS describes what functions to call for
> +   the options.  */
>  static void
> -read_cmdline_options (struct cl_decoded_option *decoded_options,
> +read_cmdline_options (struct gcc_options *opts, struct gcc_options *opts_set,
> +                     struct cl_decoded_option *decoded_options,
>                      unsigned int decoded_options_count,
>                      unsigned int lang_mask,
>                      const struct cl_option_handlers *handlers)
> @@ -628,6 +628,11 @@ read_cmdline_options (struct cl_decoded_
>     {
>       if (decoded_options[i].opt_index == OPT_SPECIAL_input_file)
>        {
> +         /* Input files should only ever appear on the main command
> +            line.  */
> +         gcc_assert (opts == &global_options);
> +         gcc_assert (opts_set == &global_options_set);
> +
>          if (main_input_filename == NULL)
>            {
>              main_input_filename = decoded_options[i].arg;
> @@ -638,76 +643,104 @@ read_cmdline_options (struct cl_decoded_
>          continue;
>        }
>
> -      read_cmdline_option (&global_options, &global_options_set,
> +      read_cmdline_option (opts, opts_set,
>                           decoded_options + i, lang_mask, handlers,
>                           global_dc);
>     }
>  }
>
> -/* Parse command line options and set default flag values.  Do minimal
> -   options processing.  The decoded options are placed in *DECODED_OPTIONS
> -   and *DECODED_OPTIONS_COUNT.  */
> +/* Language mask determined at initialization.  */
> +static unsigned int initial_lang_mask;
> +
> +/* Initial values of parameters we reset.  */
> +static int initial_min_crossjump_insns;
> +static int initial_max_fields_for_field_sensitive;
> +static int initial_loop_invariant_max_bbs_in_loop;
> +
> +/* Initialize global options-related settings at start-up.  */
> +
>  void
> -decode_options (unsigned int argc, const char **argv,
> -               struct cl_decoded_option **decoded_options,
> -               unsigned int *decoded_options_count)
> +init_options_once (void)
>  {
> -  static bool first_time_p = true;
> -  static int initial_min_crossjump_insns;
> -  static int initial_max_fields_for_field_sensitive;
> -  static int initial_loop_invariant_max_bbs_in_loop;
> -  static unsigned int initial_lang_mask;
> -  struct cl_option_handlers handlers;
> +  /* Perform language-specific options initialization.  */
> +  initial_lang_mask = lang_hooks.option_lang_mask ();
>
> -  unsigned int i, lang_mask;
> -  int opt1;
> -  int opt2;
> -  int opt3;
> -  int opt1_max;
> -  int ofast = 0;
> -  enum unwind_info_type ui_except;
> +  lang_hooks.initialize_diagnostics (global_dc);
>
> -  if (first_time_p)
> -    {
> -      /* Perform language-specific options initialization.  */
> -      initial_lang_mask = lang_mask = lang_hooks.option_lang_mask ();
> +  /* Save initial values of parameters we reset.  */
> +  initial_min_crossjump_insns
> +    = compiler_params[PARAM_MIN_CROSSJUMP_INSNS].value;
> +  initial_max_fields_for_field_sensitive
> +    = compiler_params[PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE].value;
> +  initial_loop_invariant_max_bbs_in_loop
> +    = compiler_params[PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP].value;
> +}
>
> -      lang_hooks.initialize_diagnostics (global_dc);
> +/* Initialize OPTS and OPTS_SET before using them in parsing options.  */
>
> -      /* Save initial values of parameters we reset.  */
> -      initial_min_crossjump_insns
> -       = compiler_params[PARAM_MIN_CROSSJUMP_INSNS].value;
> -      initial_max_fields_for_field_sensitive
> -       = compiler_params[PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE].value;
> -      initial_loop_invariant_max_bbs_in_loop
> -       = compiler_params[PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP].value;
> -    }
> -  else
> -    lang_mask = initial_lang_mask;
> +void
> +init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
> +{
> +  *opts = global_options_init;
> +  memset (opts_set, 0, sizeof (*opts_set));
> +
> +  /* Use priority coloring if cover classes is not defined for the
> +     target.  */
> +  if (targetm.ira_cover_classes == NULL)
> +    opts->x_flag_ira_algorithm = IRA_ALGORITHM_PRIORITY;
> +
> +  /* Initialize whether `char' is signed.  */
> +  opts->x_flag_signed_char = DEFAULT_SIGNED_CHAR;
> +  /* Set this to a special "uninitialized" value.  The actual default
> +     is set after target options have been processed.  */
> +  opts->x_flag_short_enums = 2;
>
> +  /* Initialize target_flags before targetm.target_option.optimization
> +     so the latter can modify it.  */
> +  opts->x_target_flags = targetm.default_target_flags;
> +
> +  /* Some targets have ABI-specified unwind tables.  */
> +  opts->x_flag_unwind_tables = targetm.unwind_tables_default;
> +}
> +
> +/* Decode command-line options to an array, like
> +   decode_cmdline_options_to_array and with the same arguments but
> +   using the default lang_mask.  */
> +
> +void
> +decode_cmdline_options_to_array_default_mask (unsigned int argc,
> +                                             const char **argv,
> +                                             struct cl_decoded_option **decoded_options,
> +                                             unsigned int *decoded_options_count)
> +{
>   decode_cmdline_options_to_array (argc, argv,
> -                                  lang_mask | CL_COMMON | CL_TARGET,
> +                                  initial_lang_mask | CL_COMMON | CL_TARGET,
>                                   decoded_options, decoded_options_count);
> -  if (first_time_p)
> -    /* Perform language-specific options initialization.  */
> -    lang_hooks.init_options (*decoded_options_count, *decoded_options);
> +}
>
> -  handlers.unknown_option_callback = unknown_option_callback;
> -  handlers.wrong_lang_callback = complain_wrong_lang;
> -  handlers.post_handling_callback = post_handling_callback;
> -  handlers.num_handlers = 3;
> -  handlers.handlers[0].handler = lang_handle_option;
> -  handlers.handlers[0].mask = lang_mask;
> -  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;
> +/* Default the options in OPTS and OPTS_SET based on the optimization
> +   settings in DECODED_OPTIONS and DECODED_OPTIONS_COUNT.  */
> +static void
> +default_options_optimization (struct gcc_options *opts,
> +                             struct gcc_options *opts_set,
> +                             struct cl_decoded_option *decoded_options,
> +                             unsigned int decoded_options_count)
> +{
> +  unsigned int i;
> +  int opt1;
> +  int opt2;
> +  int opt3;
> +  int opt1_max;
> +  int ofast = 0;
> +
> +  gcc_assert (opts == &global_options);
> +  gcc_assert (opts_set = &global_options_set);
>
>   /* Scan to see what optimization level has been specified.  That will
>      determine the default value of many flags.  */
> -  for (i = 1; i < *decoded_options_count; i++)
> +  for (i = 1; i < decoded_options_count; i++)
>     {
> -      struct cl_decoded_option *opt = &(*decoded_options)[i];
> +      struct cl_decoded_option *opt = &decoded_options[i];
>       switch (opt->opt_index)
>        {
>        case OPT_O:
> @@ -755,11 +788,6 @@ decode_options (unsigned int argc, const
>        }
>     }
>
> -  /* Use priority coloring if cover classes is not defined for the
> -     target.  */
> -  if (targetm.ira_cover_classes == NULL)
> -    flag_ira_algorithm = IRA_ALGORITHM_PRIORITY;
> -
>   /* -O1 optimizations.  */
>   opt1 = (optimize >= 1);
>   flag_defer_pop = opt1;
> @@ -879,38 +907,68 @@ decode_options (unsigned int argc, const
>       targetm.handle_ofast ();
>     }
>
> +  /* Allow default optimizations to be specified on a per-machine basis.  */
> +  targetm.target_option.optimization (optimize, optimize_size);
> +}
> +
> +static void finish_options (struct gcc_options *, struct gcc_options *);
> +
> +/* Parse command line options and set default flag values.  Do minimal
> +   options processing.  The decoded options are in *DECODED_OPTIONS
> +   and *DECODED_OPTIONS_COUNT.  */
> +void
> +decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
> +               struct cl_decoded_option *decoded_options,
> +               unsigned int decoded_options_count)
> +{
> +  struct cl_option_handlers handlers;
> +
> +  unsigned int lang_mask;
> +
> +  lang_mask = initial_lang_mask;
> +
> +  handlers.unknown_option_callback = unknown_option_callback;
> +  handlers.wrong_lang_callback = complain_wrong_lang;
> +  handlers.post_handling_callback = post_handling_callback;
> +  handlers.num_handlers = 3;
> +  handlers.handlers[0].handler = lang_handle_option;
> +  handlers.handlers[0].mask = lang_mask;
> +  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;
> +
>   /* Enable -Werror=coverage-mismatch by default */
>   enable_warning_as_error ("coverage-mismatch", 1, lang_mask, &handlers,
>                           global_dc);
>
> -  if (first_time_p)
> -    {
> -      /* Initialize whether `char' is signed.  */
> -      flag_signed_char = DEFAULT_SIGNED_CHAR;
> -      /* Set this to a special "uninitialized" value.  The actual default is
> -        set after target options have been processed.  */
> -      flag_short_enums = 2;
> -
> -      /* Initialize target_flags before
> -        targetm.target_option.optimization so the latter can modify
> -        it.  */
> -      target_flags = targetm.default_target_flags;
> -
> -      /* Some targets have ABI-specified unwind tables.  */
> -      flag_unwind_tables = targetm.unwind_tables_default;
> -    }
> +  default_options_optimization (opts, opts_set,
> +                               decoded_options, decoded_options_count);
>
>  #ifdef ENABLE_LTO
>   /* Clear any options currently held for LTO.  */
>   lto_clear_user_options ();
>  #endif
>
> -  /* Allow default optimizations to be specified on a per-machine basis.  */
> -  targetm.target_option.optimization (optimize, optimize_size);
> -
> -  read_cmdline_options (*decoded_options, *decoded_options_count, lang_mask,
> +  read_cmdline_options (opts, opts_set,
> +                       decoded_options, decoded_options_count, lang_mask,
>                        &handlers);
>
> +  finish_options (opts, opts_set);
> +}
> +
> +/* After all options have been read into OPTS and OPTS_SET, finalize
> +   settings of those options and diagnose incompatible
> +   combinations.  */
> +static void
> +finish_options (struct gcc_options *opts, struct gcc_options *opts_set)
> +{
> +  static bool first_time_p = true;
> +  enum unwind_info_type ui_except;
> +
> +  gcc_assert (opts == &global_options);
> +  gcc_assert (opts_set = &global_options_set);
> +
>   if (dump_base_name && ! IS_ABSOLUTE_PATH (dump_base_name))
>     {
>       /* First try to make DUMP_BASE_NAME relative to the DUMP_DIR_NAME
> Index: gcc/opts.h
> ===================================================================
> --- gcc/opts.h  (revision 164991)
> +++ gcc/opts.h  (working copy)
> @@ -208,9 +208,17 @@ extern void decode_cmdline_options_to_ar
>                                             unsigned int lang_mask,
>                                             struct cl_decoded_option **decoded_options,
>                                             unsigned int *decoded_options_count);
> -extern void decode_options (unsigned int argc, const char **argv,
> -                           struct cl_decoded_option **decoded_options,
> -                           unsigned int *decoded_options_count);
> +extern void init_options_once (void);
> +extern void init_options_struct (struct gcc_options *opts,
> +                                struct gcc_options *opts_set);
> +extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
> +                                                         const char **argv,
> +                                                         struct cl_decoded_option **decoded_options,
> +                                                         unsigned int *decoded_options_count);
> +extern void decode_options (struct gcc_options *opts,
> +                           struct gcc_options *opts_set,
> +                           struct cl_decoded_option *decoded_options,
> +                           unsigned int decoded_options_count);
>  extern int option_enabled (int opt_idx, void *opts);
>  extern bool get_option_state (struct gcc_options *, int,
>                              struct cl_option_state *);
> Index: gcc/optc-gen.awk
> ===================================================================
> --- gcc/optc-gen.awk    (revision 164991)
> +++ gcc/optc-gen.awk    (working copy)
> @@ -83,7 +83,7 @@ print "#endif /* GCC_DRIVER */"
>  print ""
>
>  have_save = 0;
> -print "struct gcc_options global_options =\n{"
> +print "const struct gcc_options global_options_init =\n{"
>  for (i = 0; i < n_extra_vars; i++) {
>        var = extra_vars[i]
>        init = extra_vars[i]
> @@ -138,6 +138,7 @@ for (i = 0; i < n_opts; i++) {
>  }
>  print "};"
>  print ""
> +print "struct gcc_options global_options;"
>  print "struct gcc_options global_options_set;"
>  print ""
>
> Index: gcc/ada/gcc-interface/misc.c
> ===================================================================
> --- gcc/ada/gcc-interface/misc.c        (revision 164991)
> +++ gcc/ada/gcc-interface/misc.c        (working copy)
> @@ -62,6 +62,7 @@
>
>  static bool gnat_init                  (void);
>  static unsigned int gnat_option_lang_mask (void);
> +static void gnat_init_options_struct   (struct gcc_options *);
>  static void gnat_init_options          (unsigned int,
>                                         struct cl_decoded_option *);
>  static bool gnat_handle_option         (size_t, const char *, int, int,
> @@ -91,6 +92,8 @@ static tree gnat_eh_personality               (void);
>  #define LANG_HOOKS_INIT                        gnat_init
>  #undef  LANG_HOOKS_OPTION_LANG_MASK
>  #define LANG_HOOKS_OPTION_LANG_MASK    gnat_option_lang_mask
> +#undef  LANG_HOOKS_INIT_OPTIONS_STRUCT
> +#define LANG_HOOKS_INIT_OPTIONS_STRUCT gnat_init_options_struct
>  #undef  LANG_HOOKS_INIT_OPTIONS
>  #define LANG_HOOKS_INIT_OPTIONS                gnat_init_options
>  #undef  LANG_HOOKS_HANDLE_OPTION
> @@ -256,6 +259,15 @@ gnat_option_lang_mask (void)
>   return CL_Ada;
>  }
>
> +/* Initialize options structure OPTS.  */
> +
> +static void
> +gnat_init_options_struct (struct gcc_options *opts)
> +{
> +  /* Uninitialized really means uninitialized in Ada.  */
> +  opts->x_flag_zero_initialized_in_bss = 0;
> +}
> +
>  /* Initialize for option processing.  */
>
>  static void
> @@ -298,9 +310,6 @@ gnat_init_options (unsigned int decoded_
>   gnat_argv = (char **) xmalloc (sizeof (save_argv[0]));
>   gnat_argv[0] = xstrdup (save_argv[0]);     /* name of the command */
>   gnat_argc = 1;
> -
> -  /* Uninitialized really means uninitialized in Ada.  */
> -  flag_zero_initialized_in_bss = 0;
>  }
>
>  /* Ada code requires variables for these settings rather than elements
> Index: gcc/fortran/gfortran.h
> ===================================================================
> --- gcc/fortran/gfortran.h      (revision 164991)
> +++ gcc/fortran/gfortran.h      (working copy)
> @@ -2398,6 +2398,7 @@ int get_c_kind (const char *, CInteropKi
>
>  /* options.c */
>  unsigned int gfc_option_lang_mask (void);
> +void gfc_init_options_struct (struct gcc_options *);
>  void gfc_init_options (unsigned int,
>                       struct cl_decoded_option *);
>  bool gfc_handle_option (size_t, const char *, int, int,
> Index: gcc/fortran/f95-lang.c
> ===================================================================
> --- gcc/fortran/f95-lang.c      (revision 164991)
> +++ gcc/fortran/f95-lang.c      (working copy)
> @@ -102,6 +102,7 @@ static void gfc_init_ts (void);
>  #undef LANG_HOOKS_FINISH
>  #undef LANG_HOOKS_WRITE_GLOBALS
>  #undef LANG_HOOKS_OPTION_LANG_MASK
> +#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
>  #undef LANG_HOOKS_INIT_OPTIONS
>  #undef LANG_HOOKS_HANDLE_OPTION
>  #undef LANG_HOOKS_POST_OPTIONS
> @@ -132,6 +133,7 @@ static void gfc_init_ts (void);
>  #define LANG_HOOKS_FINISH               gfc_finish
>  #define LANG_HOOKS_WRITE_GLOBALS       gfc_write_global_declarations
>  #define LANG_HOOKS_OPTION_LANG_MASK    gfc_option_lang_mask
> +#define LANG_HOOKS_INIT_OPTIONS_STRUCT  gfc_init_options_struct
>  #define LANG_HOOKS_INIT_OPTIONS         gfc_init_options
>  #define LANG_HOOKS_HANDLE_OPTION        gfc_handle_option
>  #define LANG_HOOKS_POST_OPTIONS                gfc_post_options
> Index: gcc/fortran/options.c
> ===================================================================
> --- gcc/fortran/options.c       (revision 164991)
> +++ gcc/fortran/options.c       (working copy)
> @@ -62,6 +62,14 @@ gfc_option_lang_mask (void)
>   return CL_Fortran;
>  }
>
> +/* Initialize options structure OPTS.  */
> +
> +void
> +gfc_init_options_struct (struct gcc_options *opts)
> +{
> +  opts->x_flag_errno_math = 0;
> +  opts->x_flag_associative_math = -1;
> +}
>
>  /* Get ready for options handling. Keep in sync with
>    libgfortran/runtime/compile_options.c (init_compile_options). */
> @@ -145,14 +153,8 @@ gfc_init_options (unsigned int decoded_o
>   gfc_option.rtcheck = 0;
>   gfc_option.coarray = GFC_FCOARRAY_NONE;
>
> -  flag_errno_math = 0;
> -  flag_associative_math = -1;
> -
>   set_default_std_flags ();
>
> -  /* -fshort-enums can be default on some targets.  */
> -  flag_short_enums = targetm.default_short_enums ();
> -
>   /* Initialize cpp-related options.  */
>   gfc_cpp_init_options (decoded_options_count, decoded_options);
>  }
> Index: gcc/configure.ac
> ===================================================================
> --- gcc/configure.ac    (revision 164991)
> +++ gcc/configure.ac    (working copy)
> @@ -1609,7 +1609,7 @@ tmake_file="${tmake_file_}"
>  out_object_file=`basename $out_file .c`.o
>
>  tm_file_list="options.h"
> -tm_include_list="options.h insn-constants.h"
> +tm_include_list="flags.h insn-constants.h"
>  for f in $tm_file; do
>   case $f in
>     ./* )
> Index: gcc/langhooks.c
> ===================================================================
> --- gcc/langhooks.c     (revision 164991)
> +++ gcc/langhooks.c     (working copy)
> @@ -337,6 +337,12 @@ lhd_initialize_diagnostics (diagnostic_c
>  {
>  }
>
> +/* Called to perform language-specific options initialization of OPTS.  */
> +void
> +lhd_init_options_struct (struct gcc_options *opts ATTRIBUTE_UNUSED)
> +{
> +}
> +
>  /* Called to perform language-specific options initialization.  */
>  void
>  lhd_init_options (unsigned int decoded_options_count ATTRIBUTE_UNUSED,
> Index: gcc/langhooks.h
> ===================================================================
> --- gcc/langhooks.h     (revision 164991)
> +++ gcc/langhooks.h     (working copy)
> @@ -267,8 +267,12 @@ struct lang_hooks
>      of options.  */
>   unsigned int (*option_lang_mask) (void);
>
> +  /* Initialize variables in an options structure.  */
> +  void (*init_options_struct) (struct gcc_options *opts);
> +
>   /* After the initialize_diagnostics hook is called, do any simple
> -     initialization needed before any calls to handle_option.  */
> +     initialization needed before any calls to handle_option, other
> +     than that done by the init_options_struct hook.  */
>   void (*init_options) (unsigned int decoded_options_count,
>                        struct cl_decoded_option *decoded_options);
>
> Index: gcc/lto/lto-lang.c
> ===================================================================
> --- gcc/lto/lto-lang.c  (revision 164991)
> +++ gcc/lto/lto-lang.c  (working copy)
> @@ -639,14 +639,13 @@ lto_complain_wrong_lang_p (const struct
>  }
>
>  static void
> -lto_init_options (unsigned int decoded_options_count ATTRIBUTE_UNUSED,
> -                 struct cl_decoded_option *decoded_options ATTRIBUTE_UNUSED)
> +lto_init_options_struct (struct gcc_options *opts)
>  {
>   /* By default, C99-like requirements for complex multiply and divide.
>      ???  Until the complex method is encoded in the IL this is the only
>      safe choice.  This will pessimize Fortran code with LTO unless
>      people specify a complex method manually or use -ffast-math.  */
> -  flag_complex_method = 2;
> +  opts->x_flag_complex_method = 2;
>  }
>
>  /* Handle command-line option SCODE.  If the option takes an argument, it is
> @@ -1162,8 +1161,8 @@ static void lto_init_ts (void)
>  #define LANG_HOOKS_OPTION_LANG_MASK lto_option_lang_mask
>  #undef LANG_HOOKS_COMPLAIN_WRONG_LANG_P
>  #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lto_complain_wrong_lang_p
> -#undef LANG_HOOKS_INIT_OPTIONS
> -#define LANG_HOOKS_INIT_OPTIONS lto_init_options
> +#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
> +#define LANG_HOOKS_INIT_OPTIONS_STRUCT lto_init_options_struct
>  #undef LANG_HOOKS_HANDLE_OPTION
>  #define LANG_HOOKS_HANDLE_OPTION lto_handle_option
>  #undef LANG_HOOKS_POST_OPTIONS
> Index: gcc/opth-gen.awk
> ===================================================================
> --- gcc/opth-gen.awk    (revision 164991)
> +++ gcc/opth-gen.awk    (working copy)
> @@ -73,6 +73,7 @@ print ""
>
>  have_save = 0;
>
> +print "#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)"
>  print "#ifndef GENERATOR_FILE"
>  print "struct gcc_options\n{"
>  print "#endif"
> @@ -125,9 +126,11 @@ for (i = 0; i < n_opts; i++) {
>  print "#ifndef GENERATOR_FILE"
>  print "};"
>  print "extern struct gcc_options global_options;"
> +print "extern const struct gcc_options global_options_init;"
>  print "extern struct gcc_options global_options_set;"
>  print "#define target_flags_explicit global_options_set.x_target_flags"
>  print "#endif"
> +print "#endif"
>  print ""
>
>  # All of the optimization switches gathered together so they can be saved and restored.
> Index: gcc/common.opt
> ===================================================================
> --- gcc/common.opt      (revision 164991)
> +++ gcc/common.opt      (working copy)
> @@ -32,6 +32,29 @@ int optimize
>  Variable
>  int optimize_size
>
> +; 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.
> +Variable
> +int flag_complex_method = 1
> +
> +; Nonzero if subexpressions must be evaluated from left-to-right.
> +Variable
> +int flag_evaluation_order = 0
> +
> +; Set the default region and algorithm for the integrated register
> +; allocator.
> +
> +Variable
> +enum ira_algorithm flag_ira_algorithm = IRA_ALGORITHM_CB
> +
> +Variable
> +enum ira_region flag_ira_region = IRA_REGION_MIXED
> +
> +; Language specific warning pass for unused results.
> +Variable
> +bool flag_warn_unused_result = false
> +
>  ###
>  Driver
>
> Index: gcc/Makefile.in
> ===================================================================
> --- gcc/Makefile.in     (revision 164991)
> +++ gcc/Makefile.in     (working copy)
> @@ -823,7 +823,7 @@ CONFIG_H  = config.h  $(host_xm_file_lis
>  TCONFIG_H = tconfig.h $(xm_file_list)
>  TM_P_H    = tm_p.h    $(tm_p_file_list)
>  GTM_H     = tm.h      $(tm_file_list) insn-constants.h
> -TM_H      = $(GTM_H) insn-flags.h options.h
> +TM_H      = $(GTM_H) insn-flags.h $(FLAGS_H)
>
>  # Variables for version information.
>  BASEVER     := $(srcdir)/BASE-VER  # 4.x.y
> @@ -884,7 +884,7 @@ BUILTINS_DEF = builtins.def sync-builtin
>  TREE_H = tree.h all-tree.def tree.def c-family/c-common.def \
>        $(lang_tree_files) $(MACHMODE_H) tree-check.h $(BUILTINS_DEF) \
>        $(INPUT_H) statistics.h $(VEC_H) treestruct.def $(HASHTAB_H) \
> -       double-int.h alias.h $(SYMTAB_H) options.h vecir.h \
> +       double-int.h alias.h $(SYMTAB_H) $(FLAGS_H) vecir.h \
>        $(REAL_H) $(FIXED_VALUE_H)
>  REGSET_H = regset.h $(BITMAP_H) hard-reg-set.h
>  BASIC_BLOCK_H = basic-block.h $(PREDICT_H) $(VEC_H) $(FUNCTION_H) cfghooks.h
> @@ -2821,7 +2821,7 @@ opts.o : opts.c opts.h options.h $(TOPLE
>    output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \
>    $(FLAGS_H) $(PARAMS_H) $(TREE_PASS_H) $(DBGCNT_H) debug.h \
>    $(PLUGIN_H) $(EXCEPT_H) $(LTO_STREAMER_H) opts-diagnostic.h
> -opts-common.o : opts-common.c opts.h options.h $(CONFIG_H) $(SYSTEM_H) \
> +opts-common.o : opts-common.c opts.h $(FLAGS_H) $(CONFIG_H) $(SYSTEM_H) \
>    coretypes.h intl.h $(DIAGNOSTIC_H) $(TM_H)
>  targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
>    $(EXPR_H) $(TM_H) $(RTL_H) $(TM_P_H) $(FUNCTION_H) output.h $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) \
> Index: gcc/langhooks-def.h
> ===================================================================
> --- gcc/langhooks-def.h (revision 164991)
> +++ gcc/langhooks-def.h (working copy)
> @@ -65,6 +65,7 @@ extern tree lhd_builtin_function (tree);
>
>  /* Declarations of default tree inlining hooks.  */
>  extern void lhd_initialize_diagnostics (diagnostic_context *);
> +extern void lhd_init_options_struct (struct gcc_options *);
>  extern void lhd_init_options (unsigned int,
>                              struct cl_decoded_option *);
>  extern bool lhd_complain_wrong_lang_p (const struct cl_option *);
> @@ -87,6 +88,7 @@ extern void lhd_omp_firstprivatize_type_
>  #define LANG_HOOKS_FINISH              lhd_do_nothing
>  #define LANG_HOOKS_PARSE_FILE          lhd_do_nothing_i
>  #define LANG_HOOKS_OPTION_LANG_MASK    hook_uint_void_0
> +#define LANG_HOOKS_INIT_OPTIONS_STRUCT lhd_init_options_struct
>  #define LANG_HOOKS_INIT_OPTIONS                lhd_init_options
>  #define LANG_HOOKS_INITIALIZE_DIAGNOSTICS lhd_initialize_diagnostics
>  #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lhd_complain_wrong_lang_p
> @@ -262,6 +264,7 @@ extern void lhd_end_section (void);
>   LANG_HOOKS_FREE_LANG_DATA, \
>   LANG_HOOKS_TREE_SIZE, \
>   LANG_HOOKS_OPTION_LANG_MASK, \
> +  LANG_HOOKS_INIT_OPTIONS_STRUCT, \
>   LANG_HOOKS_INIT_OPTIONS, \
>   LANG_HOOKS_INITIALIZE_DIAGNOSTICS, \
>   LANG_HOOKS_COMPLAIN_WRONG_LANG_P, \
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
>



More information about the Fortran mailing list