Patchwork [4.7] Pass option structures to target handle_option hook

login
register
mail settings
Submitter Joseph S. Myers
Date Feb. 27, 2011, 10:28 p.m.
Message ID <Pine.LNX.4.64.1102272225300.9869@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/84705/
State New
Headers show

Comments

Joseph S. Myers - Feb. 27, 2011, 10:28 p.m.
This patch, for 4.7, changes the interface to TARGET_HANDLE_OPTION to
pass down pointers to gcc_options structures (along with other
information that should properly be available in the hook
implementations) in preparation for eliminating the use of global
state in those hooks (and in due course moving them to be shared by
the driver).

The changes in this patch are largely mechanical; it's preparing for
followup per-target patches that actually eliminate the global state
(and with it the assertions added by this patch that global_options
and global_options_set are passed in, and make diagnostics in these
functions use the newly passed-down location).  The followup patches
will, in addition to removing global state by direct changes to the
handlers and adding variables to .opt files as needed, replace custom
logic for handling particular options by use of .opt features where
possible; there are plenty of opportunities for this (and more once I
get on to TARGET_OPTION_OVERRIDE).

Bootstrapped with no regressions on x86_64-unknown-linux-gnu (on top
of <http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01486.html>).  Also
tested building cc1 and xgcc for crosses to: alpha-linux-gnu arm-eabi
bfin-elf cris-elf frv-elf ia64-elf iq2000-elf m32c-elf m32r-elf
m68k-elf mep-elf microblaze-elf mips-elf mn10300-elf hppa-linux-gnu
pdp11-none powerpc-eabi rx-elf s390-linux-gnu score-elf sh-elf
sparc-elf v850-elf.  Will commit to trunk after 4.6 branches (and
after I have removed all deprecated targets there has been no interest
in reviving - currently all except Interix and S+CORE - from trunk; I
ignored ARC when preparing this patch on the basis that it will be
removed for 4.7).

2011-02-27  Joseph Myers  <joseph@codesourcery.com>

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

Patch

Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	(revision 170411)
+++ gcc/doc/tm.texi	(working copy)
@@ -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})
Index: gcc/doc/tm.texi.in
===================================================================
--- gcc/doc/tm.texi.in	(revision 170411)
+++ gcc/doc/tm.texi.in	(working copy)
@@ -671,14 +671,11 @@  target-specific options described by the
 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
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c	(revision 170411)
+++ gcc/targhooks.c	(working copy)
@@ -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.
@@ -1514,6 +1514,17 @@  default_pch_valid_p (const void *data_p,
   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 }
Index: gcc/targhooks.h
===================================================================
--- gcc/targhooks.h	(revision 170411)
+++ gcc/targhooks.h	(working copy)
@@ -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
 
 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);
Index: gcc/hooks.c
===================================================================
--- gcc/hooks.c	(revision 170411)
+++ gcc/hooks.c	(working copy)
@@ -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
@@ -127,14 +127,6 @@  hook_bool_const_tree_hwi_hwi_const_tree_
 }
 
 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,
 				      HOST_WIDE_INT c,
Index: gcc/hooks.h
===================================================================
--- gcc/hooks.h	(revision 170411)
+++ gcc/hooks.h	(working copy)
@@ -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);
Index: gcc/target.def
===================================================================
--- gcc/target.def	(revision 170411)
+++ gcc/target.def	(working copy)
@@ -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.  */
Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 170411)
+++ gcc/opts.c	(working copy)
@@ -225,21 +225,13 @@  target_handle_option (struct gcc_options
 		      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.  */
Index: gcc/lto-opts.c
===================================================================
--- gcc/lto-opts.c	(revision 170411)
+++ gcc/lto-opts.c	(working copy)
@@ -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 <simonb@google.com>
 
 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
Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c	(revision 170411)
+++ gcc/config/alpha/alpha.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* Subroutines used for code generation on the DEC Alpha.
    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 Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
 
@@ -57,6 +57,7 @@  along with GCC; see the file COPYING3.  
 #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 alph
 /* 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:
Index: gcc/config/frv/frv.c
===================================================================
--- gcc/config/frv/frv.c	(revision 170411)
+++ gcc/config/frv/frv.c	(working copy)
@@ -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.  
 #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;	/* va
 
 /* 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 ATTRIB
 /* 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_:
Index: gcc/config/s390/s390.c
===================================================================
--- gcc/config/s390/s390.c	(revision 170411)
+++ gcc/config/s390/s390.c	(working copy)
@@ -53,6 +53,7 @@  along with GCC; see the file COPYING3.  
 #include "df.h"
 #include "params.h"
 #include "cfgloop.h"
+#include "opts.h"
 
 
 /* Define the specific costs for a given cpu.  */
@@ -1562,8 +1563,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_:
Index: gcc/config/m32c/m32c.c
===================================================================
--- gcc/config/m32c/m32c.c	(revision 170411)
+++ gcc/config/m32c/m32c.c	(working copy)
@@ -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;
Index: gcc/config/sparc/sparc.c
===================================================================
--- gcc/config/sparc/sparc.c	(revision 170411)
+++ gcc/config/sparc/sparc.c	(working copy)
@@ -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.  
 #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 *);
@@ -676,8 +679,16 @@  struct gcc_target targetm = TARGET_INITI
 /* 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:
Index: gcc/config/mep/mep.c
===================================================================
--- gcc/config/mep/mep.c	(revision 170411)
+++ gcc/config/mep/mep.c	(working copy)
@@ -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.  
 #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_
 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);
@@ -7255,11 +7258,15 @@  mep_address_cost (rtx addr ATTRIBUTE_UNU
 }
 
 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)
     {
Index: gcc/config/m32r/m32r.c
===================================================================
--- gcc/config/m32r/m32r.c	(revision 170411)
+++ gcc/config/m32r/m32r.c	(working copy)
@@ -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_
 #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);
@@ -221,8 +223,17 @@  struct gcc_target targetm = TARGET_INITI
 /* 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:
Index: gcc/config/i386/t-i386
===================================================================
--- gcc/config/i386/t-i386	(revision 170411)
+++ gcc/config/i386/t-i386	(working copy)
@@ -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) coretype
   $(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 \
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	(revision 170411)
+++ gcc/config/i386/i386.c	(working copy)
@@ -58,6 +58,7 @@  along with GCC; see the file COPYING3.  
 #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 (tre
 	}
 
       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)
 	{
Index: gcc/config/rx/rx.c
===================================================================
--- gcc/config/rx/rx.c	(revision 170411)
+++ gcc/config/rx/rx.c	(working copy)
@@ -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);
 
@@ -2247,8 +2248,17 @@  const struct attribute_spec rx_attribute
 /* 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_:
Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c	(revision 170411)
+++ gcc/config/sh/sh.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* Output routines for GCC for Renesas / SuperH SH.
    Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Contributed by Steve Chamberlain (sac@cygnus.com).
    Improved by Jim Wilson (wilson@cygnus.com).
@@ -56,6 +56,7 @@  along with GCC; see the file COPYING3.  
 #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);
@@ -617,9 +619,15 @@  struct gcc_target targetm = TARGET_INITI
 /* 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:
Index: gcc/config/pdp11/pdp11.c
===================================================================
--- gcc/config/pdp11/pdp11.c	(revision 170411)
+++ gcc/config/pdp11/pdp11.c	(working copy)
@@ -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.  
 #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
 /* 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 pdp1
 /* 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:
Index: gcc/config/microblaze/microblaze.c
===================================================================
--- gcc/config/microblaze/microblaze.c	(revision 170411)
+++ gcc/config/microblaze/microblaze.c	(working copy)
@@ -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 <eager@eagercon.com>.
 
@@ -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)
 
@@ -1272,10 +1273,16 @@  microblaze_version_to_int (const char *v
 }
 
 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:
Index: gcc/config/cris/cris.c
===================================================================
--- gcc/config/cris/cris.c	(revision 170411)
+++ gcc/config/cris/cris.c	(working copy)
@@ -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.  
 #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 (C
 				       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, 
    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:
Index: gcc/config/iq2000/iq2000.c
===================================================================
--- gcc/config/iq2000/iq2000.c	(revision 170411)
+++ gcc/config/iq2000/iq2000.c	(working copy)
@@ -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.  
 #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_:
Index: gcc/config/mn10300/mn10300.c
===================================================================
--- gcc/config/mn10300/mn10300.c	(revision 170411)
+++ gcc/config/mn10300/mn10300.c	(working copy)
@@ -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_co
 /* 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:
Index: gcc/config/ia64/ia64.c
===================================================================
--- gcc/config/ia64/ia64.c	(revision 170411)
+++ gcc/config/ia64/ia64.c	(working copy)
@@ -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 <wilson@cygnus.com> and
 		  David Mosberger <davidm@hpl.hp.com>.
@@ -61,6 +61,7 @@  along with GCC; see the file COPYING3.  
 #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 m
 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 *);
@@ -5652,8 +5654,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_:
Index: gcc/config/ia64/t-ia64
===================================================================
--- gcc/config/ia64/t-ia64	(revision 170411)
+++ gcc/config/ia64/t-ia64	(working copy)
@@ -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
 # 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)
Index: gcc/config/m68k/m68k.c
===================================================================
--- gcc/config/m68k/m68k.c	(revision 170411)
+++ gcc/config/m68k/m68k.c	(working copy)
@@ -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.  
 #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_multip
 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 *);
@@ -471,8 +473,17 @@  m68k_find_selection (const struct m68k_t
 /* 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_:
Index: gcc/config/rs6000/t-rs6000
===================================================================
--- gcc/config/rs6000/t-rs6000	(revision 170411)
+++ gcc/config/rs6000/t-rs6000	(working copy)
@@ -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) corety
   $(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 \
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 170411)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -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
@@ -1069,7 +1070,9 @@  static int get_element_number (tree, tre
 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);
@@ -4194,11 +4197,19 @@  rs6000_builtin_vectorized_function (tree
 /* 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)
     {
Index: gcc/config/score/score.c
===================================================================
--- gcc/config/score/score.c	(revision 170411)
+++ gcc/config/score/score.c	(working copy)
@@ -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.
@@ -49,6 +50,7 @@ 
 #include "score7.h"
 #include "score3.h"
 #include "df.h"
+#include "opts.h"
 
 static void score_option_override (void);
 
@@ -307,8 +309,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:
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c	(revision 170411)
+++ gcc/config/arm/arm.c	(working copy)
@@ -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 (v
 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);
@@ -1333,8 +1335,16 @@  arm_find_cpu (const char *name, const st
 /* 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_:
Index: gcc/config/arm/t-arm
===================================================================
--- gcc/config/arm/t-arm	(revision 170411)
+++ gcc/config/arm/t-arm	(working copy)
@@ -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
   $(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)
Index: gcc/config/pa/pa.c
===================================================================
--- gcc/config/pa/pa.c	(revision 170411)
+++ gcc/config/pa/pa.c	(working copy)
@@ -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.  
 #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
 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:
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	(revision 170411)
+++ gcc/config/mips/mips.c	(working copy)
@@ -1,6 +1,7 @@ 
 /* Subroutines used for MIPS code generation.
    Copyright (C) 1989, 1990, 1991, 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 A. Lichnewsky, lich@inria.inria.fr.
    Changes by Michael Meissner, meissner@osf.org.
@@ -57,6 +58,7 @@  along with GCC; see the file COPYING3.  
 #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)					\
@@ -15457,8 +15459,16 @@  mips_set_tune (const struct mips_cpu_inf
 /* 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_:
Index: gcc/config/v850/v850.c
===================================================================
--- gcc/config/v850/v850.c	(revision 170411)
+++ gcc/config/v850/v850.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* Subroutines for insn-output.c for NEC V850 series
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
    Contributed by Jeff Law (law@cygnus.com).
 
    This file is part of GCC.
@@ -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_me
 /* 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:
Index: gcc/config/bfin/bfin.c
===================================================================
--- gcc/config/bfin/bfin.c	(revision 170411)
+++ gcc/config/bfin/bfin.c	(working copy)
@@ -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
 /* 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_: