From 96e4542172ff9a57b56370cdd65f1b1dacbdcdf8 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 22 Mar 2011 22:23:02 +0000 Subject: [PATCH] target.def (handle_option): Take gcc_options and cl_decoded_option pointers and location_t. * target.def (handle_option): Take gcc_options and cl_decoded_option pointers and location_t. * doc/tm.texi.in (TARGET_HANDLE_OPTION): Update documentation. * doc/tm.texi: Regenerate. * hooks.c (hook_bool_size_t_constcharptr_int_true): Remove. * hooks.h (hook_bool_size_t_constcharptr_int_true): Don't declare. * lto-opts.c (lto_reissue_options): Generate option structure for targetm.handle_option call. * opts.c (target_handle_option): Update call to targetm.handle_option. Remove assertions about values now passed down to hook. * targhooks.c (default_target_handle_option): New. * targhooks.h (default_target_handle_option): Declare. * config/alpha/alpha.c: Include opts.h. (alpha_handle_option): Update to new hook interface. * config/arm/arm.c: Include opts.h. (arm_handle_option): Update to new hook interface. * config/arm/t-arm (arm.o): Update dependencies. * config/bfin/bfin.c: Include opts.h. (bfin_handle_option): Update to new hook interface. * config/cris/cris.c: Include opts.h. (cris_handle_option): Update to new hook interface. * config/frv/frv.c: Include opts.h. (frv_handle_option): Update to new hook interface. * config/i386/i386.c: Include opts.h. (ix86_handle_option): Update to new hook interface. (ix86_valid_target_attribute_inner_p): Generate option structure for call to ix86_handle_option. * config/i386/t-i386 (i386.o): Update dependencies. * config/ia64/ia64.c: Include opts.h. (ia64_handle_option): Update to new hook interface. * config/ia64/t-ia64 (ia64.o): Update dependencies. * config/iq2000/iq2000.c: Include opts.h. (iq2000_handle_option): Update to new hook interface. * config/m32c/m32c.c: Include opts.h. (m32c_handle_option): Update to new hook interface. * config/m32r/m32r.c: Include opts.h. (m32r_handle_option): Update to new hook interface. * config/m68k/m68k.c: Include opts.h. (m68k_handle_option): Update to new hook interface. * config/mep/mep.c: Include opts.h. (mep_handle_option): Update to new hook interface. * config/microblaze/microblaze.c: Include opts.h. (microblaze_handle_option): Update to new hook interface. * config/mips/mips.c: Include opts.h. (mips_handle_option): Update to new hook interface. * config/mn10300/mn10300.c: Include opts.h. (mn10300_handle_option): Update to new hook interface. * config/pa/pa.c: Include opts.h. (pa_handle_option): Update to new hook interface. * config/pdp11/pdp11.c: Include opts.h. (pdp11_handle_option): Update to new hook interface. * config/rs6000/rs6000.c: Include opts.h. (rs6000_handle_option): Update to new hook interface. * config/rs6000/t-rs6000 (rs6000.o): Update dependencies. * config/rx/rx.c: Include opts.h. (rx_handle_option): Update to new hook interface. * config/s390/s390.c: Include opts.h. (s390_handle_option): Update to new hook interface. * config/score/score.c: Include opts.h. (score_handle_option): Update to new hook interface. * config/sh/sh.c: Include opts.h. (sh_handle_option): Update to new hook interface. * config/sparc/sparc.c: Include opts.h. (sparc_handle_option): Update to new hook interface. * config/v850/v850.c: Include opts.h. (v850_handle_option): Update to new hook interface. From-SVN: r171308 --- gcc/ChangeLog | 70 ++++++++++++++++++++++++++++++ gcc/config/alpha/alpha.c | 12 ++++- gcc/config/arm/arm.c | 14 +++++- gcc/config/arm/t-arm | 4 +- gcc/config/bfin/bfin.c | 14 +++++- gcc/config/cris/cris.c | 18 ++++++-- gcc/config/frv/frv.c | 18 ++++++-- gcc/config/i386/i386.c | 19 +++++++- gcc/config/i386/t-i386 | 5 ++- gcc/config/ia64/ia64.c | 17 ++++++-- gcc/config/ia64/t-ia64 | 4 +- gcc/config/iq2000/iq2000.c | 18 ++++++-- gcc/config/m32c/m32c.c | 15 +++++-- gcc/config/m32r/m32r.c | 15 ++++++- gcc/config/m68k/m68k.c | 17 ++++++-- gcc/config/mep/mep.c | 17 +++++--- gcc/config/microblaze/microblaze.c | 15 +++++-- gcc/config/mips/mips.c | 11 ++++- gcc/config/mn10300/mn10300.c | 14 ++++-- gcc/config/pa/pa.c | 16 +++++-- gcc/config/pdp11/pdp11.c | 16 +++++-- gcc/config/rs6000/rs6000.c | 15 ++++++- gcc/config/rs6000/t-rs6000 | 4 +- gcc/config/rx/rx.c | 12 ++++- gcc/config/s390/s390.c | 11 ++++- gcc/config/score/score.c | 14 +++++- gcc/config/sh/sh.c | 14 ++++-- gcc/config/sparc/sparc.c | 17 ++++++-- gcc/config/v850/v850.c | 11 ++++- gcc/doc/tm.texi | 15 +++---- gcc/doc/tm.texi.in | 13 +++--- gcc/hooks.c | 10 +---- gcc/hooks.h | 3 +- gcc/lto-opts.c | 9 +++- gcc/opts.c | 12 +---- gcc/target.def | 16 +++---- gcc/targhooks.c | 13 +++++- gcc/targhooks.h | 7 ++- 38 files changed, 425 insertions(+), 120 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9503e8b822af..97145c00652b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,73 @@ +2011-03-22 Joseph Myers + + * target.def (handle_option): Take gcc_options and + cl_decoded_option pointers and location_t. + * doc/tm.texi.in (TARGET_HANDLE_OPTION): Update documentation. + * doc/tm.texi: Regenerate. + * hooks.c (hook_bool_size_t_constcharptr_int_true): Remove. + * hooks.h (hook_bool_size_t_constcharptr_int_true): Don't declare. + * lto-opts.c (lto_reissue_options): Generate option structure for + targetm.handle_option call. + * opts.c (target_handle_option): Update call to + targetm.handle_option. Remove assertions about values now passed + down to hook. + * targhooks.c (default_target_handle_option): New. + * targhooks.h (default_target_handle_option): Declare. + * config/alpha/alpha.c: Include opts.h. + (alpha_handle_option): Update to new hook interface. + * config/arm/arm.c: Include opts.h. + (arm_handle_option): Update to new hook interface. + * config/arm/t-arm (arm.o): Update dependencies. + * config/bfin/bfin.c: Include opts.h. + (bfin_handle_option): Update to new hook interface. + * config/cris/cris.c: Include opts.h. + (cris_handle_option): Update to new hook interface. + * config/frv/frv.c: Include opts.h. + (frv_handle_option): Update to new hook interface. + * config/i386/i386.c: Include opts.h. + (ix86_handle_option): Update to new hook interface. + (ix86_valid_target_attribute_inner_p): Generate option structure + for call to ix86_handle_option. + * config/i386/t-i386 (i386.o): Update dependencies. + * config/ia64/ia64.c: Include opts.h. + (ia64_handle_option): Update to new hook interface. + * config/ia64/t-ia64 (ia64.o): Update dependencies. + * config/iq2000/iq2000.c: Include opts.h. + (iq2000_handle_option): Update to new hook interface. + * config/m32c/m32c.c: Include opts.h. + (m32c_handle_option): Update to new hook interface. + * config/m32r/m32r.c: Include opts.h. + (m32r_handle_option): Update to new hook interface. + * config/m68k/m68k.c: Include opts.h. + (m68k_handle_option): Update to new hook interface. + * config/mep/mep.c: Include opts.h. + (mep_handle_option): Update to new hook interface. + * config/microblaze/microblaze.c: Include opts.h. + (microblaze_handle_option): Update to new hook interface. + * config/mips/mips.c: Include opts.h. + (mips_handle_option): Update to new hook interface. + * config/mn10300/mn10300.c: Include opts.h. + (mn10300_handle_option): Update to new hook interface. + * config/pa/pa.c: Include opts.h. + (pa_handle_option): Update to new hook interface. + * config/pdp11/pdp11.c: Include opts.h. + (pdp11_handle_option): Update to new hook interface. + * config/rs6000/rs6000.c: Include opts.h. + (rs6000_handle_option): Update to new hook interface. + * config/rs6000/t-rs6000 (rs6000.o): Update dependencies. + * config/rx/rx.c: Include opts.h. + (rx_handle_option): Update to new hook interface. + * config/s390/s390.c: Include opts.h. + (s390_handle_option): Update to new hook interface. + * config/score/score.c: Include opts.h. + (score_handle_option): Update to new hook interface. + * config/sh/sh.c: Include opts.h. + (sh_handle_option): Update to new hook interface. + * config/sparc/sparc.c: Include opts.h. + (sparc_handle_option): Update to new hook interface. + * config/v850/v850.c: Include opts.h. + (v850_handle_option): Update to new hook interface. + 2011-03-22 Joseph Myers * gcc.c (driver_unknown_option_callback): Only permit and save diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index c9bafeb29031..ebdb37d861e2 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -57,6 +57,7 @@ along with GCC; see the file COPYING3. If not see #include "tm-constrs.h" #include "df.h" #include "libfuncs.h" +#include "opts.h" /* Specify which cpu to schedule for. */ enum processor_type alpha_tune; @@ -217,8 +218,17 @@ static const struct default_options alpha_option_optimization_table[] = /* Implement TARGET_HANDLE_OPTION. */ static bool -alpha_handle_option (size_t code, const char *arg, int value) +alpha_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + int value = decoded->value; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mfp_regs: diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index e863e8c19689..31a0726858e4 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -56,6 +56,7 @@ #include "intl.h" #include "libfuncs.h" #include "params.h" +#include "opts.h" /* Forward definitions of types. */ typedef struct minipool_node Mnode; @@ -218,7 +219,8 @@ static tree arm_build_builtin_va_list (void); static void arm_expand_builtin_va_start (tree, rtx); static tree arm_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); static void arm_option_override (void); -static bool arm_handle_option (size_t, const char *, int); +static bool arm_handle_option (struct gcc_options *, struct gcc_options *, + const struct cl_decoded_option *, location_t); static void arm_target_help (void); static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode); static bool arm_cannot_copy_insn_p (rtx); @@ -1340,8 +1342,16 @@ arm_find_cpu (const char *name, const struct processors *sel, const char *desc) /* Implement TARGET_HANDLE_OPTION. */ static bool -arm_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED) +arm_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_march_: diff --git a/gcc/config/arm/t-arm b/gcc/config/arm/t-arm index 33d7e19f79c3..993d3d20740a 100644 --- a/gcc/config/arm/t-arm +++ b/gcc/config/arm/t-arm @@ -1,6 +1,6 @@ # Rules common to all arm targets # -# Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010 +# Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010, 2011 # Free Software Foundation, Inc. # # This file is part of GCC. @@ -58,7 +58,7 @@ arm.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(EXPR_H) $(OPTABS_H) $(RECOG_H) $(CGRAPH_H) \ $(GGC_H) except.h $(C_PRAGMA_H) $(INTEGRATE_H) $(TM_P_H) \ $(TARGET_H) $(TARGET_DEF_H) debug.h langhooks.h $(DF_H) \ - intl.h libfuncs.h $(PARAMS_H) + intl.h libfuncs.h $(PARAMS_H) $(OPTS_H) arm-c.o: $(srcdir)/config/arm/arm-c.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) output.h $(C_COMMON_H) diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index 0e05e724788e..32f74cdb14e3 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -1,5 +1,5 @@ /* The Blackfin code generation auxiliary output file. - Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Analog Devices. @@ -56,6 +56,7 @@ #include "timevar.h" #include "df.h" #include "sel-sched.h" +#include "opts.h" /* A C structure for machine-specific, per-function data. This is added to the cfun structure. */ @@ -2558,8 +2559,17 @@ bfin_class_likely_spilled_p (reg_class_t rclass) /* Implement TARGET_HANDLE_OPTION. */ static bool -bfin_handle_option (size_t code, const char *arg, int value) +bfin_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + int value = decoded->value; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mshared_library_id_: diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index aec7cba63bb1..37ccde461a03 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -1,6 +1,6 @@ /* Definitions for GCC. Part of the machine description for CRIS. Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Axis Communications. Written by Hans-Peter Nilsson. This file is part of GCC. @@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. If not see #include "ggc.h" #include "optabs.h" #include "df.h" +#include "opts.h" /* Usable when we have an amount to add or subtract, and want the optimal size of the insn. */ @@ -136,7 +137,8 @@ static void cris_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool); static tree cris_md_asm_clobbers (tree, tree, tree); -static bool cris_handle_option (size_t, const char *, int); +static bool cris_handle_option (struct gcc_options *, struct gcc_options *, + const struct cl_decoded_option *, location_t); static void cris_option_override (void); static bool cris_frame_pointer_required (void); @@ -2338,9 +2340,17 @@ cris_asm_output_case_end (FILE *stream, int num, rtx table) cris_option_override. */ static bool -cris_handle_option (size_t code, const char *arg ATTRIBUTE_UNUSED, - int value ATTRIBUTE_UNUSED) +cris_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg ATTRIBUTE_UNUSED = decoded->arg; + int value ATTRIBUTE_UNUSED = decoded->value; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_metrax100: diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index 229b9feb7354..dac5323f10ea 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -1,5 +1,5 @@ /* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Red Hat, Inc. This file is part of GCC. @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see #include "integrate.h" #include "langhooks.h" #include "df.h" +#include "opts.h" #ifndef FRV_INLINE #define FRV_INLINE inline @@ -260,7 +261,10 @@ frv_cpu_t frv_cpu_type = CPU_TYPE; /* value of -mcpu= */ /* Forward references */ -static bool frv_handle_option (size_t, const char *, int); +static bool frv_handle_option (struct gcc_options *, + struct gcc_options *, + const struct cl_decoded_option *, + location_t); static void frv_option_override (void); static bool frv_legitimate_address_p (enum machine_mode, rtx, bool); static int frv_default_flags_for_cpu (void); @@ -630,8 +634,16 @@ frv_cannot_force_const_mem (rtx x ATTRIBUTE_UNUSED) /* Implement TARGET_HANDLE_OPTION. */ static bool -frv_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED) +frv_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mcpu_: diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index d158969eef34..a7f6fa3aa498 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see #include "sched-int.h" #include "sbitmap.h" #include "fibheap.h" +#include "opts.h" enum upper_128bits_state { @@ -2683,8 +2684,16 @@ ix86_using_red_zone (void) /* Implement TARGET_HANDLE_OPTION. */ static bool -ix86_handle_option (size_t code, const char *arg ATTRIBUTE_UNUSED, int value) +ix86_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + int value = decoded->value; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mmmx: @@ -4670,7 +4679,13 @@ ix86_valid_target_attribute_inner_p (tree args, char *p_strings[]) } else if (type == ix86_opt_isa) - ix86_handle_option (opt, p, opt_set_p); + { + struct cl_decoded_option decoded; + + generate_option (opt, NULL, opt_set_p, CL_TARGET, &decoded); + ix86_handle_option (&global_options, &global_options_set, + &decoded, input_location); + } else if (type == ix86_opt_yes || type == ix86_opt_no) { diff --git a/gcc/config/i386/t-i386 b/gcc/config/i386/t-i386 index 1c658a149dfe..e9fa3cd8d6f6 100644 --- a/gcc/config/i386/t-i386 +++ b/gcc/config/i386/t-i386 @@ -1,4 +1,4 @@ -# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # # This file is part of GCC. # @@ -23,7 +23,8 @@ i386.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RECOG_H) $(EXPR_H) $(OPTABS_H) toplev.h $(BASIC_BLOCK_H) \ $(GGC_H) $(TARGET_H) $(TARGET_DEF_H) langhooks.h $(CGRAPH_H) \ $(TREE_GIMPLE_H) $(DWARF2_H) $(DF_H) tm-constrs.h $(PARAMS_H) \ - i386-builtin-types.inc debug.h dwarf2out.h sbitmap.h $(FIBHEAP_H) + i386-builtin-types.inc debug.h dwarf2out.h sbitmap.h $(FIBHEAP_H) \ + $(OPTS_H) i386-c.o: $(srcdir)/config/i386/i386-c.c \ $(srcdir)/config/i386/i386-protos.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \ diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 55a55e8a593d..c3d6303665df 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler. Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010 + 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by James E. Wilson and David Mosberger . @@ -61,6 +61,7 @@ along with GCC; see the file COPYING3. If not see #include "sel-sched.h" #include "reload.h" #include "dwarf2out.h" +#include "opts.h" /* This is used for communication between ASM_OUTPUT_LABEL and ASM_OUTPUT_LABELREF. */ @@ -231,7 +232,8 @@ static int ia64_memory_move_cost (enum machine_mode mode, reg_class_t, static bool ia64_rtx_costs (rtx, int, int, int *, bool); static int ia64_unspec_may_trap_p (const_rtx, unsigned); static void fix_range (const char *); -static bool ia64_handle_option (size_t, const char *, int); +static bool ia64_handle_option (struct gcc_options *, struct gcc_options *, + const struct cl_decoded_option *, location_t); static struct machine_function * ia64_init_machine_status (void); static void emit_insn_group_barriers (FILE *); static void emit_all_insn_group_barriers (FILE *); @@ -5655,8 +5657,17 @@ fix_range (const char *const_str) /* Implement TARGET_HANDLE_OPTION. */ static bool -ia64_handle_option (size_t code, const char *arg, int value) +ia64_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + int value = decoded->value; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mfixed_range_: diff --git a/gcc/config/ia64/t-ia64 b/gcc/config/ia64/t-ia64 index 3e82d71e39da..4f013e2d591a 100644 --- a/gcc/config/ia64/t-ia64 +++ b/gcc/config/ia64/t-ia64 @@ -1,5 +1,5 @@ # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, -# 2010 +# 2010, 2011 # Free Software Foundation, Inc. # # This file is part of GCC. @@ -54,4 +54,4 @@ ia64-c.o: $(srcdir)/config/ia64/ia64-c.c $(CONFIG_H) $(SYSTEM_H) \ # genattrtab generates very long string literals. insn-attrtab.o-warn = -Wno-error -ia64.o: debug.h $(PARAMS_H) sel-sched.h reload.h +ia64.o: debug.h $(PARAMS_H) sel-sched.h reload.h $(OPTS_H) diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index b838fecb9f1a..ca949e23a13a 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -1,5 +1,5 @@ /* Subroutines used for code generation on Vitesse IQ2000 processors - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. If not see #include "target-def.h" #include "langhooks.h" #include "df.h" +#include "opts.h" /* Enumeration for all of the relational tests, so that we can build arrays indexed by the test type, and not worry about the order @@ -145,7 +146,10 @@ static enum machine_mode gpr_mode; /* Initialize the GCC target structure. */ static struct machine_function* iq2000_init_machine_status (void); -static bool iq2000_handle_option (size_t, const char *, int); +static bool iq2000_handle_option (struct gcc_options *, + struct gcc_options *, + const struct cl_decoded_option *, + location_t); static void iq2000_option_override (void); static section *iq2000_select_rtx_section (enum machine_mode, rtx, unsigned HOST_WIDE_INT); @@ -1437,8 +1441,16 @@ iq2000_init_machine_status (void) /* Implement TARGET_HANDLE_OPTION. */ static bool -iq2000_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED) +iq2000_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mcpu_: diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c index 56f9cf5ccca0..16f635770e74 100644 --- a/gcc/config/m32c/m32c.c +++ b/gcc/config/m32c/m32c.c @@ -1,5 +1,5 @@ /* Target Code for R8C/M16C/M32C - Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Red Hat. @@ -48,6 +48,7 @@ #include "langhooks.h" #include "gimple.h" #include "df.h" +#include "opts.h" /* Prototypes */ @@ -414,10 +415,16 @@ int ok_to_change_target_memregs = TRUE; #undef TARGET_HANDLE_OPTION #define TARGET_HANDLE_OPTION m32c_handle_option static bool -m32c_handle_option (size_t code, - const char *arg ATTRIBUTE_UNUSED, - int value ATTRIBUTE_UNUSED) +m32c_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + if (code == OPT_memregs_) { target_memregs_set = TRUE; diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 820aa8de1a1c..648afb975386 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -42,6 +42,7 @@ #include "target.h" #include "target-def.h" #include "tm-constrs.h" +#include "opts.h" /* Array of valid operand punctuation characters. */ static char m32r_punct_chars[256]; @@ -61,7 +62,8 @@ enum m32r_sdata m32r_sdata = M32R_SDATA_DEFAULT; #define LIT_NAME_P(NAME) ((NAME)[0] == '*' && (NAME)[1] == '.') /* Forward declaration. */ -static bool m32r_handle_option (size_t, const char *, int); +static bool m32r_handle_option (struct gcc_options *, struct gcc_options *, + const struct cl_decoded_option *, location_t); static void m32r_option_override (void); static void init_reg_tables (void); static void block_move_call (rtx, rtx, rtx); @@ -223,8 +225,17 @@ struct gcc_target targetm = TARGET_INITIALIZER; /* Implement TARGET_HANDLE_OPTION. */ static bool -m32r_handle_option (size_t code, const char *arg, int value) +m32r_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + int value = decoded->value; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_m32r: diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 5810aa43228d..3a753858626a 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -1,6 +1,6 @@ /* Subroutines for insn-output.c for Motorola 68000 family. Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see #include "sched-int.h" #include "insn-codes.h" #include "ggc.h" +#include "opts.h" enum reg_class regno_reg_class[] = { @@ -134,7 +135,8 @@ static int m68k_sched_first_cycle_multipass_dfa_lookahead (void); static bool m68k_can_eliminate (const int, const int); static void m68k_conditional_register_usage (void); static bool m68k_legitimate_address_p (enum machine_mode, rtx, bool); -static bool m68k_handle_option (size_t, const char *, int); +static bool m68k_handle_option (struct gcc_options *, struct gcc_options *, + const struct cl_decoded_option *, location_t); static void m68k_option_override (void); static rtx find_addr_reg (rtx); static const char *singlemove_string (rtx *); @@ -475,8 +477,17 @@ m68k_find_selection (const struct m68k_target_selection **entry, /* Implement TARGET_HANDLE_OPTION. */ static bool -m68k_handle_option (size_t code, const char *arg, int value) +m68k_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + int value = decoded->value; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_march_: diff --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c index 73bb45d6c66b..1d75777eb185 100644 --- a/gcc/config/mep/mep.c +++ b/gcc/config/mep/mep.c @@ -1,5 +1,6 @@ /* Definitions for Toshiba Media Processor - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, + 2011 Free Software Foundation, Inc. Contributed by Red Hat, Inc. @@ -50,6 +51,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "df.h" #include "gimple.h" +#include "opts.h" /* Structure of this file: @@ -220,7 +222,8 @@ static rtx mep_function_arg (CUMULATIVE_ARGS *, enum machine_mode, static void mep_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool); static bool mep_vector_mode_supported_p (enum machine_mode); -static bool mep_handle_option (size_t, const char *, int); +static bool mep_handle_option (struct gcc_options *, struct gcc_options *, + const struct cl_decoded_option *, location_t); static rtx mep_allocate_initial_value (rtx); static void mep_asm_init_sections (void); static int mep_comp_type_attributes (const_tree, const_tree); @@ -7257,11 +7260,15 @@ mep_address_cost (rtx addr ATTRIBUTE_UNUSED, bool ATTRIBUTE_UNUSED speed_p) } static bool -mep_handle_option (size_t code, - const char *arg ATTRIBUTE_UNUSED, - int value ATTRIBUTE_UNUSED) +mep_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { int i; + size_t code = decoded->opt_index; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); switch (code) { diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c index a38545f4a1b5..85295ef8f3b4 100644 --- a/gcc/config/microblaze/microblaze.c +++ b/gcc/config/microblaze/microblaze.c @@ -1,5 +1,5 @@ /* Subroutines used for code generation on Xilinx MicroBlaze. - Copyright 2009, 2010 Free Software Foundation, Inc. + Copyright 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Michael Eager . @@ -48,6 +48,7 @@ #include "df.h" #include "optabs.h" #include "diagnostic-core.h" +#include "opts.h" #define MICROBLAZE_VERSION_COMPARE(VA,VB) strcasecmp (VA, VB) @@ -1276,10 +1277,16 @@ microblaze_version_to_int (const char *version) } static bool -microblaze_handle_option (size_t code, - const char *arg ATTRIBUTE_UNUSED, - int value ATTRIBUTE_UNUSED) +microblaze_handle_option (struct gcc_options *opts, + struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mno_clearbss: diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 11d8ff0369a3..878d33e1fa6e 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see #include "bitmap.h" #include "diagnostic.h" #include "target-globals.h" +#include "opts.h" /* True if X is an UNSPEC wrapper around a SYMBOL_REF or LABEL_REF. */ #define UNSPEC_ADDRESS_P(X) \ @@ -15459,8 +15460,16 @@ mips_set_tune (const struct mips_cpu_info *info) /* Implement TARGET_HANDLE_OPTION. */ static bool -mips_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED) +mips_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mabi_: diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index 0b68f2d3e858..cae3ea1fb529 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -44,6 +44,7 @@ #include "target.h" #include "target-def.h" #include "df.h" +#include "opts.h" /* This is used in the am33_2.0-linux-gnu port, in which global symbol names are not prefixed by underscores, to tell whether to prefix a @@ -90,10 +91,17 @@ static int cc_flags_for_code(enum rtx_code); /* Implement TARGET_HANDLE_OPTION. */ static bool -mn10300_handle_option (size_t code, - const char *arg ATTRIBUTE_UNUSED, - int value) +mn10300_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + int value = decoded->value; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mam33: diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 98267b0ca63e..c5cd8712c669 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -1,6 +1,6 @@ /* Subroutines for insn-output.c for HPPA. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Tim Moore (moore@cs.utah.edu), based on sparc.c @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see #include "target-def.h" #include "langhooks.h" #include "df.h" +#include "opts.h" /* Return nonzero if there is a bypass for the output of OUT_INSN and the fp store IN_INSN. */ @@ -87,7 +88,8 @@ hppa_fpstore_bypass_p (rtx out_insn, rtx in_insn) static void pa_option_override (void); static void copy_reg_pointer (rtx, rtx); static void fix_range (const char *); -static bool pa_handle_option (size_t, const char *, int); +static bool pa_handle_option (struct gcc_options *, struct gcc_options *, + const struct cl_decoded_option *, location_t); static int hppa_register_move_cost (enum machine_mode mode, reg_class_t, reg_class_t); static int hppa_address_cost (rtx, bool); @@ -478,8 +480,16 @@ fix_range (const char *const_str) /* Implement TARGET_HANDLE_OPTION. */ static bool -pa_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED) +pa_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mnosnake: diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index b6ed97989fcf..a5f9c37ba6c4 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -1,6 +1,6 @@ /* Subroutines for gcc2 for pdp11. Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2004, 2005, - 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at). This file is part of GCC. @@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "target-def.h" #include "df.h" +#include "opts.h" /* this is the current value returned by the macro FIRST_PARM_OFFSET defined in tm.h */ @@ -138,7 +139,8 @@ decode_pdp11_d (const struct real_format *fmt ATTRIBUTE_UNUSED, /* This is where the condition code register lives. */ /* rtx cc0_reg_rtx; - no longer needed? */ -static bool pdp11_handle_option (size_t, const char *, int); +static bool pdp11_handle_option (struct gcc_options *, struct gcc_options *, + const struct cl_decoded_option *, location_t); static void pdp11_option_init_struct (struct gcc_options *); static const char *singlemove_string (rtx *); static bool pdp11_assemble_integer (rtx, unsigned int, int); @@ -245,9 +247,15 @@ static const struct default_options pdp11_option_optimization_table[] = /* Implement TARGET_HANDLE_OPTION. */ static bool -pdp11_handle_option (size_t code, const char *arg ATTRIBUTE_UNUSED, - int value ATTRIBUTE_UNUSED) +pdp11_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_m10: diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index eca1b44f4ec3..c3ca018d4845 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -58,6 +58,7 @@ #include "intl.h" #include "params.h" #include "tm-constrs.h" +#include "opts.h" #if TARGET_XCOFF #include "xcoffout.h" /* get declarations of xcoff_*_section_name */ #endif @@ -1077,7 +1078,9 @@ static int get_element_number (tree, tree); static void rs6000_option_override (void); static void rs6000_option_init_struct (struct gcc_options *); static void rs6000_option_default_params (void); -static bool rs6000_handle_option (size_t, const char *, int); +static bool rs6000_handle_option (struct gcc_options *, struct gcc_options *, + const struct cl_decoded_option *, + location_t); static int rs6000_loop_align_max_skip (rtx); static void rs6000_parse_yes_no_option (const char *, const char *, int *); static int first_altivec_reg_to_save (void); @@ -4208,11 +4211,19 @@ rs6000_builtin_vectorized_function (tree fndecl, tree type_out, /* Implement TARGET_HANDLE_OPTION. */ static bool -rs6000_handle_option (size_t code, const char *arg, int value) +rs6000_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { enum fpu_type_t fpu_type = FPU_NONE; int isel; char *p, *q; + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + int value = decoded->value; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); switch (code) { diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000 index 925870ee1c19..bfc793f489ea 100644 --- a/gcc/config/rs6000/t-rs6000 +++ b/gcc/config/rs6000/t-rs6000 @@ -1,7 +1,7 @@ # General rules that all rs6000/ targets must have. # # Copyright (C) 1995, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2008, 2009, -# 2010 Free Software Foundation, Inc. +# 2010, 2011 Free Software Foundation, Inc. # # This file is part of GCC. # @@ -27,7 +27,7 @@ rs6000.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(OBSTACK_H) $(TREE_H) $(EXPR_H) $(OPTABS_H) except.h function.h \ output.h $(BASIC_BLOCK_H) $(INTEGRATE_H) toplev.h $(GGC_H) $(HASHTAB_H) \ $(TM_P_H) $(TARGET_H) $(TARGET_DEF_H) langhooks.h reload.h gt-rs6000.h \ - cfglayout.h cfgloop.h + cfglayout.h cfgloop.h $(OPTS_H) rs6000-c.o: $(srcdir)/config/rs6000/rs6000-c.c \ $(srcdir)/config/rs6000/rs6000-protos.h \ diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c index 592f3118ddf8..bec921b1effc 100644 --- a/gcc/config/rx/rx.c +++ b/gcc/config/rx/rx.c @@ -50,6 +50,7 @@ #include "target.h" #include "target-def.h" #include "langhooks.h" +#include "opts.h" static void rx_print_operand (FILE *, rtx, int); @@ -2251,8 +2252,17 @@ const struct attribute_spec rx_attribute_table[] = /* Extra processing for target specific command line options. */ static bool -rx_handle_option (size_t code, const char * arg ATTRIBUTE_UNUSED, int value) +rx_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + int value = decoded->value; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mint_register_: diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index ab1005a6c8aa..33518be41d30 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see #include "df.h" #include "params.h" #include "cfgloop.h" +#include "opts.h" /* Define the specific costs for a given cpu. */ @@ -1588,8 +1589,16 @@ s390_handle_arch_option (const char *arg, /* Implement TARGET_HANDLE_OPTION. */ static bool -s390_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED) +s390_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_march_: diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c index 99695bfc5cbd..ddb04cb1451d 100644 --- a/gcc/config/score/score.c +++ b/gcc/config/score/score.c @@ -1,5 +1,6 @@ /* Output routines for Sunplus S+CORE processor - Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011 + Free Software Foundation, Inc. Contributed by Sunnorth. This file is part of GCC. @@ -48,6 +49,7 @@ #include "langhooks.h" #include "score7.h" #include "df.h" +#include "opts.h" static void score_option_override (void); @@ -281,8 +283,16 @@ score_asm_file_end (void) /* Implement TARGET_HANDLE_OPTION. */ static bool -score_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED) +score_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mscore7d: diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 70bff999fc75..bbeb7a258ddd 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -56,6 +56,7 @@ along with GCC; see the file COPYING3. If not see #include "cfgloop.h" #include "alloc-pool.h" #include "tm-constrs.h" +#include "opts.h" int code_for_indirect_jump_scratch = CODE_FOR_indirect_jump_scratch; @@ -167,7 +168,8 @@ int assembler_dialect; static bool shmedia_space_reserved_for_target_registers; -static bool sh_handle_option (size_t, const char *, int); +static bool sh_handle_option (struct gcc_options *, struct gcc_options *, + const struct cl_decoded_option *, location_t); static void split_branches (rtx); static int branch_dest (rtx); static void force_into (rtx, rtx); @@ -604,9 +606,15 @@ struct gcc_target targetm = TARGET_INITIALIZER; /* Implement TARGET_HANDLE_OPTION. */ static bool -sh_handle_option (size_t code, const char *arg ATTRIBUTE_UNUSED, - int value ATTRIBUTE_UNUSED) +sh_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_m1: diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 03edae50adf7..149990d825b4 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -1,6 +1,7 @@ /* Subroutines for insn-output.c for SPARC. Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, + 2011 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) 64-bit SPARC-V9 support by Michael Tiemann, Jim Wilson, and Doug Evans, @@ -54,6 +55,7 @@ along with GCC; see the file COPYING3. If not see #include "params.h" #include "df.h" #include "dwarf2out.h" +#include "opts.h" /* Processor costs */ static const @@ -365,7 +367,8 @@ static HOST_WIDE_INT frame_base_offset; /* 1 if the next opcode is to be specially indented. */ int sparc_indent_opcode = 0; -static bool sparc_handle_option (size_t, const char *, int); +static bool sparc_handle_option (struct gcc_options *, struct gcc_options *, + const struct cl_decoded_option *, location_t); static void sparc_option_override (void); static void sparc_init_modes (void); static void scan_record_type (const_tree, int *, int *, int *); @@ -677,8 +680,16 @@ struct gcc_target targetm = TARGET_INITIALIZER; /* Implement TARGET_HANDLE_OPTION. */ static bool -sparc_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED) +sparc_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mfpu: diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index e3a19ff5e581..4a87bff10e76 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -42,6 +42,7 @@ #include "target.h" #include "target-def.h" #include "df.h" +#include "opts.h" #ifndef streq #define streq(a,b) (strcmp (a, b) == 0) @@ -109,8 +110,16 @@ v850_handle_memory_option (enum small_memory_type type, const char *value) /* Implement TARGET_HANDLE_OPTION. */ static bool -v850_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED) +v850_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) { + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + + gcc_assert (opts == &global_options); + gcc_assert (opts_set == &global_options_set); + switch (code) { case OPT_mspace: diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 85e1d88eec91..2afb55b496f1 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -664,21 +664,18 @@ Its default setting is 0. @cindex optional hardware or system features @cindex features, optional, in system conventions -@deftypefn {Target Hook} bool TARGET_HANDLE_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value}) +@deftypefn {Target Hook} bool TARGET_HANDLE_OPTION (struct gcc_options *@var{opts}, struct gcc_options *@var{opts_set}, const struct cl_decoded_option *@var{decoded}, unsigned int @var{loc}) This hook is called whenever the user specifies one of the target-specific options described by the @file{.opt} definition files (@pxref{Options}). It has the opportunity to do some option-specific processing and should return true if the option is valid. The default definition does nothing but return true. -@var{code} specifies the @code{OPT_@var{name}} enumeration value -associated with the selected option; @var{name} is just a rendering of -the option name in which non-alphanumeric characters are replaced by -underscores. @var{arg} specifies the string argument and is null if -no argument was given. If the option is flagged as a @code{UInteger} -(@pxref{Option properties}), @var{value} is the numeric value of the -argument. Otherwise @var{value} is 1 if the positive form of the -option was used and 0 if the ``no-'' form was. +@var{decoded} specifies the option and its arguments. @var{opts} and +@var{opts_set} are the @code{gcc_options} structures to be used for +storing option state, and @var{loc} is the location at which the +option was passed (@code{UNKNOWN_LOCATION} except for options passed +via attributes). @end deftypefn @deftypefn {Target Hook} bool TARGET_HANDLE_C_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value}) diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index a799bc43564c..2ceefdc085c9 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -671,14 +671,11 @@ target-specific options described by the @file{.opt} definition files processing and should return true if the option is valid. The default definition does nothing but return true. -@var{code} specifies the @code{OPT_@var{name}} enumeration value -associated with the selected option; @var{name} is just a rendering of -the option name in which non-alphanumeric characters are replaced by -underscores. @var{arg} specifies the string argument and is null if -no argument was given. If the option is flagged as a @code{UInteger} -(@pxref{Option properties}), @var{value} is the numeric value of the -argument. Otherwise @var{value} is 1 if the positive form of the -option was used and 0 if the ``no-'' form was. +@var{decoded} specifies the option and its arguments. @var{opts} and +@var{opts_set} are the @code{gcc_options} structures to be used for +storing option state, and @var{loc} is the location at which the +option was passed (@code{UNKNOWN_LOCATION} except for options passed +via attributes). @end deftypefn @hook TARGET_HANDLE_C_OPTION diff --git a/gcc/hooks.c b/gcc/hooks.c index f859dd965071..594e34408bd7 100644 --- a/gcc/hooks.c +++ b/gcc/hooks.c @@ -1,5 +1,5 @@ /* General-purpose hooks. - Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 + Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -126,14 +126,6 @@ hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree a ATTRIBUTE_UNUSED, return true; } -bool -hook_bool_size_t_constcharptr_int_true (size_t a ATTRIBUTE_UNUSED, - const char *b ATTRIBUTE_UNUSED, - int c ATTRIBUTE_UNUSED) -{ - return true; -} - bool default_can_output_mi_thunk_no_vcall (const_tree a ATTRIBUTE_UNUSED, HOST_WIDE_INT b ATTRIBUTE_UNUSED, diff --git a/gcc/hooks.h b/gcc/hooks.h index 7962fe818ba0..90e3a14ae9a0 100644 --- a/gcc/hooks.h +++ b/gcc/hooks.h @@ -1,5 +1,5 @@ /* General-purpose hooks. - Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 + Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -50,7 +50,6 @@ extern bool hook_bool_rtx_false (rtx); extern bool hook_bool_rtx_int_false (rtx, int); extern bool hook_bool_uintp_uintp_false (unsigned int *, unsigned int *); extern bool hook_bool_rtx_int_int_intp_bool_false (rtx, int, int, int *, bool); -extern bool hook_bool_size_t_constcharptr_int_true (size_t, const char *, int); extern bool hook_bool_tree_tree_false (tree, tree); extern bool hook_bool_tree_tree_true (tree, tree); extern bool hook_bool_tree_bool_false (tree, bool); diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c index 3f80e91b5b13..ec4e78daf39b 100644 --- a/gcc/lto-opts.c +++ b/gcc/lto-opts.c @@ -1,6 +1,6 @@ /* LTO IL options. - Copyright 2009, 2010 Free Software Foundation, Inc. + Copyright 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Simon Baldwin This file is part of GCC. @@ -413,7 +413,12 @@ lto_reissue_options (void) DK_UNSPECIFIED, UNKNOWN_LOCATION, global_dc); if (o->type == CL_TARGET) - targetm.handle_option (o->code, o->arg, o->value); + { + struct cl_decoded_option decoded; + generate_option (o->code, o->arg, o->value, CL_TARGET, &decoded); + targetm.handle_option (&global_options, &global_options_set, + &decoded, UNKNOWN_LOCATION); + } else if (o->type == CL_COMMON) gcc_assert (flag_var); else diff --git a/gcc/opts.c b/gcc/opts.c index 9f93356539f5..5ea5fac47944 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -225,21 +225,13 @@ target_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, unsigned int lang_mask ATTRIBUTE_UNUSED, int kind, - location_t loc ATTRIBUTE_UNUSED, + location_t loc, const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED, diagnostic_context *dc) { - gcc_assert (opts == &global_options); - gcc_assert (opts_set == &global_options_set); gcc_assert (dc == global_dc); - gcc_assert (decoded->canonical_option_num_elements <= 2); gcc_assert (kind == DK_UNSPECIFIED); - /* Although the location is not passed down to - targetm.handle_option, do not make assertions about its value; - options may come from optimize attributes and having the correct - location in the handler is not generally important. */ - return targetm.handle_option (decoded->opt_index, decoded->arg, - decoded->value); + return targetm.handle_option (opts, opts_set, decoded, loc); } /* Add comma-separated strings to a char_p vector. */ diff --git a/gcc/target.def b/gcc/target.def index 57134cbc6115..75c821f23276 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -1,5 +1,6 @@ /* Target hook definitions. - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, + 2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -1072,16 +1073,15 @@ DEFHOOK void, (void), hook_void_void) -/* Handle target switch CODE (an OPT_* value). ARG is the argument - passed to the switch; it is NULL if no argument was. VALUE is the - value of ARG if CODE specifies a UInteger option, otherwise it is - 1 if the positive form of the switch was used and 0 if the negative - form was. Return true if the switch was valid. */ +/* Handle target switch DECODED for options structures OPTS and + OPTS_SET, at location LOC. Return true if the switch was valid. */ DEFHOOK (handle_option, "", - bool, (size_t code, const char *arg, int value), - hook_bool_size_t_constcharptr_int_true) + bool, (struct gcc_options *opts, struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + unsigned int /*location_t*/ loc), + default_target_handle_option) /* Display extra, target specific information in response to a --target-help switch. */ diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 6411973b8b98..7de00134429c 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -1,5 +1,5 @@ /* Default target hook functions. - Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 + Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -1513,6 +1513,17 @@ default_pch_valid_p (const void *data_p, size_t len) return NULL; } +/* Default version of TARGET_HANDLE_OPTION. */ + +bool +default_target_handle_option (struct gcc_options *opts ATTRIBUTE_UNUSED, + struct gcc_options *opts_set ATTRIBUTE_UNUSED, + const struct cl_decoded_option *decoded ATTRIBUTE_UNUSED, + location_t loc ATTRIBUTE_UNUSED) +{ + return true; +} + const struct default_options empty_optimization_table[] = { { OPT_LEVELS_NONE, 0, NULL, 0 } diff --git a/gcc/targhooks.h b/gcc/targhooks.h index a8dbb11e716e..a2d2075ea35a 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -1,5 +1,5 @@ /* Default target hook functions. - Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 + Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -181,5 +181,10 @@ extern enum machine_mode default_get_reg_raw_mode(int); extern const struct default_options empty_optimization_table[]; +extern bool default_target_handle_option (struct gcc_options *, + struct gcc_options *, + const struct cl_decoded_option *, + location_t); + extern void *default_get_pch_validity (size_t *); extern const char *default_pch_valid_p (const void *, size_t); -- 2.39.2