diff options
author | Joseph Myers <joseph@codesourcery.com> | 2010-09-30 14:53:12 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2010-09-30 14:53:12 +0100 |
commit | 46625112d2613f6573f307c99b8e10c970748e15 (patch) | |
tree | 9e8ddd32df9fcfb0446877af547d5a2daa89da8b /gcc/optc-gen.awk | |
parent | 37ccfc46e8f0005bb8a3e08c189b95ca9948059a (diff) | |
download | gcc-46625112d2613f6573f307c99b8e10c970748e15.tar.gz |
opt-functions.awk (static_var): Update comment.
* opt-functions.awk (static_var): Update comment.
(var_ref): Return offsetof expression or -1, not variable address.
* optc-gen.awk: Generate structure field initializers instead of
static variables. Expect -1 for missing variables instead of null
pointer. Add gcc_options parameters to generated functions.
* opth-gen.awk: Generate structure fields for static variables.
Add gcc_options parameters to generated functions.
* common.opt (optimize, optimize_size): Add variables.
* config/i386/i386-c.c (ix86_pragma_target_parse): Pass
&global_options to cl_target_option_restore.
* config/i386/i386.c (ix86_valid_target_attribute_p): Pass
&global_options to cl_optimization_restore, cl_target_option_save
and cl_target_option_restore.
(ix86_set_current_function): Pass &global_options to
cl_target_option_restore.
* config/pdp11/pdp11.h (optimize): Remove.
* config/rs6000/rs6000.h (optimize): Remove.
* config/sh/sh.h (optimize): Remove.
* config/xtensa/xtensa.h (optimize): Remove.
* coretypes.h (struct gcc_options): Declare.
* diagnostic.c (diagnostic_initialize): Initialize
context->option_state.
(diagnostic_report_diagnostic): Pass option_state to
option_enabled hook.
* diagnostic.h (diagnostic_context.option_enabled): Add void *
parameter.
(diagnostic_context.option_state): New field.
* final.c (final_start_function, final, final_scan_insn): Rename
optimize parameter to optimize_p.
* flags.h (optimize, optimize_size): Remove.
* function.c (invoke_set_current_function_hook): Pass
&global_options to cl_optimization_restore.
* gcc.c (driver_handle_option): Take gcc_options parameter.
Assert that it is &global_options.
(process_command): Pass &global_options to read_cmdline_option.
* ipa-pure-const.c (suggest_attribute): Pass &global_options to
option_enabled.
* lto-opts.c (lto_reissue_options): Use option_flag_var. Pass
&global_options to set_option.
* opts-common.c (handle_option, handle_generated_option,
read_cmdline_option, set_option): Take explicit gcc_options
parameters. Use option_flag_var.
(option_flag_var): New.
* opts.c (common_handle_option, lang_handle_option,
target_handle_option): Take gcc_options parameter. Assert that it
is &global_options.
(read_cmdline_options): Pass &global_options to
read_cmdline_option.
(print_filtered_help): Use option_flag_var. Pass &global_options
to option_enabled.
(common_handle_option): Use option_flag_var.
(option_enabled): Take opts parameter. Use option_flag_var.
(get_option_state): Take gcc_options parameter. Use
option_flag_var. Pass gcc_options parameter to option_enabled.
(enable_warning_as_error): Pass &global_options to
handle_generated_option.
* opts.h (struct cl_option): Change flag_var to flag_var_offset.
(cl_option_handler_func.handler): Take gcc_options parameter.
(option_enabled, get_option_state, set_option, handle_option,
handle_generated_option, read_cmdline_option): Take gcc_options
parameters.
* toplev.c (optimize, optimize_size): Remove.
(print_switch_values): Pass &global_options to option_enabled.
(option_affects_pch_p): Use option_flag_var. Pass &global_options
to get_option_state.
(general_init): Initialize global_dc->option_state.
* tree.c (build_optimization_node): Pass &global_options to
cl_optimization_save.
(build_target_option_node): Pass &global_options to
cl_target_option_save.
c-family:
* c-common.c (handle_optimize_attribute): Pass &global_options to
cl_optimization_save and cl_optimization_restore.
* c-opts.c (c_common_handle_option): Pass &global_options to
handle_generated_option.
* c-pragma.c (handle_pragma_diagnostic): Use option_flag_var.
(handle_pragma_pop_options, handle_pragma_reset_options): Pass
&global_options to cl_optimization_restore.
From-SVN: r164751
Diffstat (limited to 'gcc/optc-gen.awk')
-rw-r--r-- | gcc/optc-gen.awk | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk index c43557b1b03..bad055f0989 100644 --- a/gcc/optc-gen.awk +++ b/gcc/optc-gen.awk @@ -131,15 +131,14 @@ for (i = 0; i < n_opts; i++) { var_seen[name] = 1; } -print "};" - -print "" -print "/* Local state variables. */" for (i = 0; i < n_opts; i++) { name = static_var(opts[i], flags[i]); - if (name != "") - print "static " var_type(flags[i]) name ";" + if (name != "") { + print " 0, /* " name " (private state) */" + print "#undef x_" name + } } +print "};" print "" print "const char * const lang_names[] =\n{" @@ -235,7 +234,7 @@ for (i = 0; i < n_opts; i++) { alias_posarg = nth_arg(1, alias_arg) alias_negarg = nth_arg(2, alias_arg) - if (var_ref(opts[i], flags[i]) != "0") + if (var_ref(opts[i], flags[i]) != "-1") print "#error Alias setting variable" if (alias_posarg != "" && alias_negarg == "") { @@ -298,7 +297,7 @@ print "#if !defined(GCC_DRIVER) && !defined(IN_LIBGCC2) && !defined(IN_TARGET_LI print ""; print "/* Save optimization variables into a structure. */" print "void"; -print "cl_optimization_save (struct cl_optimization *ptr)"; +print "cl_optimization_save (struct cl_optimization *ptr, struct gcc_options *opts)"; print "{"; n_opt_char = 2; @@ -345,24 +344,24 @@ for (i = 0; i < n_opts; i++) { for (i = 0; i < n_opt_char; i++) { name = var_opt_char[i]; if (var_opt_range[name] != "") - print " gcc_assert (IN_RANGE (" name ", " var_opt_range[name] "));"; + print " gcc_assert (IN_RANGE (opts->x_" name ", " var_opt_range[name] "));"; } print ""; for (i = 0; i < n_opt_other; i++) { - print " ptr->x_" var_opt_other[i] " = " var_opt_other[i] ";"; + print " ptr->x_" var_opt_other[i] " = opts->x_" var_opt_other[i] ";"; } for (i = 0; i < n_opt_int; i++) { - print " ptr->x_" var_opt_int[i] " = " var_opt_int[i] ";"; + print " ptr->x_" var_opt_int[i] " = opts->x_" var_opt_int[i] ";"; } for (i = 0; i < n_opt_short; i++) { - print " ptr->x_" var_opt_short[i] " = " var_opt_short[i] ";"; + print " ptr->x_" var_opt_short[i] " = opts->x_" var_opt_short[i] ";"; } for (i = 0; i < n_opt_char; i++) { - print " ptr->x_" var_opt_char[i] " = " var_opt_char[i] ";"; + print " ptr->x_" var_opt_char[i] " = opts->x_" var_opt_char[i] ";"; } print "}"; @@ -370,23 +369,23 @@ print "}"; print ""; print "/* Restore optimization options from a structure. */"; print "void"; -print "cl_optimization_restore (struct cl_optimization *ptr)"; +print "cl_optimization_restore (struct gcc_options *opts, struct cl_optimization *ptr)"; print "{"; for (i = 0; i < n_opt_other; i++) { - print " " var_opt_other[i] " = ptr->x_" var_opt_other[i] ";"; + print " opts->x_" var_opt_other[i] " = ptr->x_" var_opt_other[i] ";"; } for (i = 0; i < n_opt_int; i++) { - print " " var_opt_int[i] " = ptr->x_" var_opt_int[i] ";"; + print " opts->x_" var_opt_int[i] " = ptr->x_" var_opt_int[i] ";"; } for (i = 0; i < n_opt_short; i++) { - print " " var_opt_short[i] " = ptr->x_" var_opt_short[i] ";"; + print " opts->x_" var_opt_short[i] " = ptr->x_" var_opt_short[i] ";"; } for (i = 0; i < n_opt_char; i++) { - print " " var_opt_char[i] " = ptr->x_" var_opt_char[i] ";"; + print " opts->x_" var_opt_char[i] " = ptr->x_" var_opt_char[i] ";"; } print " targetm.override_options_after_change ();"; @@ -442,7 +441,7 @@ print "}"; print ""; print "/* Save selected option variables into a structure. */" print "void"; -print "cl_target_option_save (struct cl_target_option *ptr)"; +print "cl_target_option_save (struct cl_target_option *ptr, struct gcc_options *opts)"; print "{"; n_target_char = 0; @@ -488,7 +487,7 @@ for (i = 0; i < n_target_char; i++) { name = var_target_char[i]; if (var_target_range[name] != "") { have_assert = 1; - print " gcc_assert (IN_RANGE (" name ", " var_target_range[name] "));"; + print " gcc_assert (IN_RANGE (opts->x_" name ", " var_target_range[name] "));"; } } @@ -500,19 +499,19 @@ print " targetm.target_option.save (ptr);"; print ""; for (i = 0; i < n_target_other; i++) { - print " ptr->x_" var_target_other[i] " = " var_target_other[i] ";"; + print " ptr->x_" var_target_other[i] " = opts->x_" var_target_other[i] ";"; } for (i = 0; i < n_target_int; i++) { - print " ptr->x_" var_target_int[i] " = " var_target_int[i] ";"; + print " ptr->x_" var_target_int[i] " = opts->x_" var_target_int[i] ";"; } for (i = 0; i < n_target_short; i++) { - print " ptr->x_" var_target_short[i] " = " var_target_short[i] ";"; + print " ptr->x_" var_target_short[i] " = opts->x_" var_target_short[i] ";"; } for (i = 0; i < n_target_char; i++) { - print " ptr->x_" var_target_char[i] " = " var_target_char[i] ";"; + print " ptr->x_" var_target_char[i] " = opts->x_" var_target_char[i] ";"; } print "}"; @@ -520,23 +519,23 @@ print "}"; print ""; print "/* Restore selected current options from a structure. */"; print "void"; -print "cl_target_option_restore (struct cl_target_option *ptr)"; +print "cl_target_option_restore (struct gcc_options *opts, struct cl_target_option *ptr)"; print "{"; for (i = 0; i < n_target_other; i++) { - print " " var_target_other[i] " = ptr->x_" var_target_other[i] ";"; + print " opts->x_" var_target_other[i] " = ptr->x_" var_target_other[i] ";"; } for (i = 0; i < n_target_int; i++) { - print " " var_target_int[i] " = ptr->x_" var_target_int[i] ";"; + print " opts->x_" var_target_int[i] " = ptr->x_" var_target_int[i] ";"; } for (i = 0; i < n_target_short; i++) { - print " " var_target_short[i] " = ptr->x_" var_target_short[i] ";"; + print " opts->x_" var_target_short[i] " = ptr->x_" var_target_short[i] ";"; } for (i = 0; i < n_target_char; i++) { - print " " var_target_char[i] " = ptr->x_" var_target_char[i] ";"; + print " opts->x_" var_target_char[i] " = ptr->x_" var_target_char[i] ";"; } # This must occur after the normal variables in case the code depends on those |