Makefile.in (TM_H): Include $(FLAGS_H) instead of options.h.

* 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:
	* gcc-interface/misc.c (gnat_init_options_struct): New.  Split out
	from gnat_init_options.
	(LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.

c-family:
	* 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:
	* cp-objcp-common.h (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.

fortran:
	* 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:
	* lang.c (java_init_options_struct): New.  Split out from
	java_init_options.
	(LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.

lto:
	* 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.

From-SVN: r165189
This commit is contained in:
Joseph Myers 2010-10-08 16:17:32 +01:00 committed by Joseph Myers
parent e899aa1613
commit a75bfaa6cd
34 changed files with 405 additions and 171 deletions

View File

@ -1,3 +1,58 @@
2010-10-08 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.
2010-10-08 Nathan Froyd <froydnj@codesourcery.com>
* config/rx/rx.c (TARGET_EXCEPT_UNWIND_INFO): Define.

View File

@ -823,7 +823,7 @@ CONFIG_H = config.h $(host_xm_file_list)
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-builtins.def omp-builtins.def
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 $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_H) $(
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) \

View File

@ -1,3 +1,9 @@
2010-10-08 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.
2010-10-08 Ed Schonberg <schonberg@adacore.com>
* sem_aux.adb: Cleanup Is_Immutably_Limited_Type.

View File

@ -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_options_count,
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

View File

@ -1,3 +1,12 @@
2010-10-08 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.
2010-10-06 Nicola Pero <nicola.pero@meta-innovation.com>
Implemented fast enumeration for Objective-C.

View File

@ -7802,8 +7802,11 @@ parse_optimize_options (tree args, bool attr_p)
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();

View File

@ -743,6 +743,7 @@ extern tree build_va_arg (location_t, tree, tree);
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);

View File

@ -273,6 +273,19 @@ c_common_complain_wrong_lang_p (const struct cl_option *option)
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 decoded_options_count,
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)

View File

@ -33,6 +33,8 @@ along with GCC; see the file COPYING3. If not see
#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

View File

@ -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

2
gcc/configure vendored
View File

@ -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
./* )

View File

@ -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
./* )

View File

@ -1,3 +1,7 @@
2010-10-08 Joseph Myers <joseph@codesourcery.com>
* cp-objcp-common.h (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
2010-10-07 Nicola Pero <nicola.pero@meta-innovation.com>
* cp-tree.def: Changed type of AT_ENCODE_EXPR from tcc_unary to

View File

@ -45,6 +45,8 @@ extern bool cp_function_decl_explicit_p (tree decl);
#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

View File

@ -23,7 +23,8 @@ along with GCC; see the file COPYING3. If not see
#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_target_flag_state;
#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 */

View File

@ -1,3 +1,10 @@
2010-10-08 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.
2010-10-07 Janus Weil <janus@gcc.gnu.org>
PR fortran/45933

View File

@ -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

View File

@ -2398,6 +2398,7 @@ int get_c_kind (const char *, CInteropKind_t *);
/* 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,

View File

@ -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_options_count,
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);
}

View File

@ -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,

View File

@ -1,3 +1,9 @@
2010-10-08 Joseph Myers <joseph@codesourcery.com>
* lang.c (java_init_options_struct): New. Split out from
java_init_options.
(LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
2010-10-04 Andi Kleen <ak@linux.intel.com>
* Make-lang.in (xgcj, jc1, jcf-dump, jvgenmain):

View File

@ -48,6 +48,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
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_struct (struct gcc_options *opts)
{
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. */
opts->x_flag_trapping_math = 0;
/* In Java arithmetic overflow always wraps around. */
opts->x_flag_wrapv = 1;
/* Java requires left-to-right evaluation of subexpressions. */
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)
{
flag_bounds_check = 1;
flag_exceptions = 1;
flag_non_call_exceptions = 1;
/* In Java floating point operations never trap. */
flag_trapping_math = 0;
/* In Java arithmetic overflow always wraps around. */
flag_wrapv = 1;
/* Java requires left-to-right evaluation of subexpressions. */
flag_evaluation_order = 1;
jcf_path_init ();
}

View File

@ -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_sizes (struct gimplify_omp_ctx *,
#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, \

View File

@ -337,6 +337,12 @@ lhd_initialize_diagnostics (diagnostic_context *ctx ATTRIBUTE_UNUSED)
{
}
/* 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,

View File

@ -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);

View File

@ -1,3 +1,10 @@
2010-10-08 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.
2010-10-06 Jan Hubicka <jh@suse.cz>
* lto.c (lto_balanced_map): Fix accounting of program size.

View File

@ -639,14 +639,13 @@ lto_complain_wrong_lang_p (const struct cl_option *option ATTRIBUTE_UNUSED)
}
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

View File

@ -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 ""

View File

@ -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.

View File

@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
#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. */

View File

@ -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 (tree fndecl)
}
/* 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_option *decoded_options,
{
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_option *decoded_options,
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. */
void
decode_options (unsigned int argc, const char **argv,
struct cl_decoded_option **decoded_options,
unsigned int *decoded_options_count)
{
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;
/* Language mask determined at initialization. */
static unsigned int initial_lang_mask;
unsigned int i, 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
init_options_once (void)
{
/* Perform language-specific options initialization. */
initial_lang_mask = lang_hooks.option_lang_mask ();
lang_hooks.initialize_diagnostics (global_dc);
/* 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;
}
/* Initialize OPTS and OPTS_SET before using them in parsing options. */
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,
initial_lang_mask | CL_COMMON | CL_TARGET,
decoded_options, decoded_options_count);
}
/* 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;
enum unwind_info_type ui_except;
if (first_time_p)
{
/* Perform language-specific options initialization. */
initial_lang_mask = lang_mask = lang_hooks.option_lang_mask ();
lang_hooks.initialize_diagnostics (global_dc);
/* 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;
decode_cmdline_options_to_array (argc, argv,
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;
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 char **argv,
}
}
/* 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 char **argv,
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

View File

@ -208,9 +208,17 @@ extern void decode_cmdline_options_to_array (unsigned int argc,
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 *);

View File

@ -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 ();

View File

@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "real.h"
#include "fixed-value.h"
#include "alias.h"
#include "options.h"
#include "flags.h"
/* Codes of tree nodes */