This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Convert OPTIMIZATION_OPTIONS to a target hook


This patch, relative to a tree with my OVERRIDE_OPTIONS patch
<http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01176.html> applied,
converts OPTIMIZATION_OPTIONS to a target hook for all targets.  As
with the OVERRIDE_OPTIONS patch, I renamed the functions directly
implementing the hook to follow a standard *_option_optimization
pattern, but did not generally rename macros for subtargets.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  Also
tested building cc1 (or at least the relevant .o file in cc1, where a
complete cc1 build was broken for other reasons) for the following
targets: arm-eabi cris-elf crx-elf frv-elf h8300-elf i686-solaris2.10
ia64-linux-gnu ia64-hp-vms m32r-elf m68hc11-elf mcore-elf mep-elf
mmix-knuth-mmixware pdp11-none powerpc-linux-gnu rx-elf s390-linux-gnu
sh-elf spu-elf v850-elf xtensa-elf.  OK to commit?

2010-09-15  Joseph Myers  <joseph@codesourcery.com>

	* target.def (target_option.optimization): New hook.
	* doc/tm.texi.in (OPTIMIZATION_OPTIONS): Change to
	TARGET_OPTION_OPTIMIZATION hook.
	* doc/tm.texi: Regenerate.
	* hooks.c (hook_void_int_int): New.
	* hooks.h (hook_void_int_int): Declare.
	* opts.c: Don't include tm_p.h.
	(decode_options): Use targetm.target_option.optimization instead
	of OPTIMIZATION_OPTIONS.
	* system.h (OPTIMIZATION_OPTIONS): Poison.
	* config/arm/arm-protos.h (arm_optimization_options): Remove.
	* config/arm/arm.c (TARGET_OPTION_OPTIMIZATION): Define.
	(arm_optimization_options): Rename to arm_option_optimization.
	Make static.
	* config/arm/arm.h (OPTIMIZATION_OPTIONS): Remove.
	* config/cris/cris.c (TARGET_OPTION_OPTIMIZATION): Define.
	(cris_option_optimization): New.
	* config/cris/cris.h (OPTIMIZATION_OPTIONS): Remove.
	* config/crx/crx.c (TARGET_OPTION_OPTIMIZATION): Define.
	(crx_option_optimization): New.
	* config/crx/crx.h (OPTIMIZATION_OPTIONS): Remove.
	* config/frv/frv-protos.h (frv_optimization_options): Remove.
	* config/frv/frv.c (TARGET_OPTION_OPTIMIZATION): Define.
	(frv_optimization_options): Rename to frv_option_optimization.
	Make static.
	* config/frv/frv.h (OPTIMIZATION_OPTIONS): Remove.
	* config/h8300/h8300.c (h8300_option_optimization): New.
	(TARGET_OPTION_OPTIMIZATION): Define.
	* config/h8300/h8300.h (OPTIMIZATION_OPTIONS): Remove.
	* config/i386/i386-protos.h (optimization_options): Remove.
	* config/i386/i386.c (optimization_options): Rename to
	ix86_option_optimization.  Make static.
	(TARGET_OPTION_OPTIMIZATION): Define.
	* config/i386/i386.h (OPTIMIZATION_OPTIONS): Remove.
	* config/ia64/ia64-protos.h (ia64_optimization_options): Remove.
	* config/ia64/ia64.c (TARGET_OPTION_OPTIMIZATION): Define.
	(ia64_optimization_options): Rename to ia64_option_optimization.
	Make static.  Call SUBTARGET_OPTIMIZATION_OPTIONS.
	* config/ia64/ia64.h (OPTIMIZATION_OPTIONS): Remove.  Remove
	commented-out definition.
	* config/ia64/vms.h (SUBTARGET_OPTIMIZATION_OPTIONS): Define
	instead of OPTIMIZATION_OPTIONS.
	* config/m32r/m32r.c (TARGET_OPTION_OPTIMIZATION): Define.
	(m32r_option_optimization): New.
	* config/m32r/m32r.h (OPTIMIZATION_OPTIONS): Remove.
	* config/m68hc11/m68hc11-protos.h (m68hc11_optimization_options):
	Remove.
	* config/mcore/mcore.c (TARGET_OPTION_OPTIMIZATION): Define.
	(mcore_option_optimization): New.
	* config/mcore/mcore.h (OPTIMIZATION_OPTIONS): Remove.
	* config/mep/mep-protos.h (mep_optimization_options): Remove.
	* config/mep/mep.c (TARGET_OPTION_OPTIMIZATION): Define.
	(mep_optimization_options): Rename to mep_option_optimization.
	Make static.  Take unused level and size parameters.
	* config/mep/mep.h (OPTIMIZATION_OPTIONS): Remove.
	* config/mmix/mmix.c (TARGET_OPTION_OPTIMIZATION): Define.
	(mmix_option_optimization): New.
	* config/mmix/mmix.h (OPTIMIZATION_OPTIONS): Remove.
	* config/pdp11/pdp11.c (TARGET_OPTION_OPTIMIZATION): Define.
	(pdp11_option_optimization): New.
	* config/pdp11/pdp11.h (OPTIMIZATION_OPTIONS): Remove.
	* config/rs6000/rs6000-protos.h (optimization_options): Remove.
	* config/rs6000/rs6000.c (TARGET_OPTION_OPTIMIZATION): Define.
	(optimization_options): Rename to rs6000_option_optimization.
	Make static.
	* config/rs6000/rs6000.h (OPTIMIZATION_OPTIONS): Remove.
	* config/rx/rx-protos.h (rx_set_optimization_options): Remove.
	* config/rx/rx.c (rx_set_optimization_options): Rename to
	rx_option_optimization.  Make static.  Take unused level and size
	parameters.
	(TARGET_OPTION_OPTIMIZATION): Define.
	* config/rx/rx.h (OPTIMIZATION_OPTIONS): Remove.
	* config/s390/s390-protos.h (optimization_options): Remove.
	* config/s390/s390.c (optimization_options): Rename to
	s390_option_optimization.  Make static.  Don't mark size parameter
	unused.
	(TARGET_OPTION_OPTIMIZATION): Define.
	* config/s390/s390.h (OPTIMIZATION_OPTIONS): Remove.
	* config/sh/sh-protos.h (sh_optimization_options): Remove.
	* config/sh/sh.c (TARGET_OPTION_OPTIMIZATION): Define.
	(sh_optimization_options): Rename to sh_option_optimization.  Make
	static.  Don't mark parameters unused.
	* config/sh/sh.h (OPTIMIZATION_OPTIONS): Remove.
	* config/spu/spu-protos.h (spu_optimization_options): Remove.
	* config/spu/spu.c (TARGET_OPTION_OPTIMIZATION): Define.
	(spu_optimization_options): Rename to spu_option_optimization.
	Make static.
	* config/spu/spu.h (OPTIMIZATION_OPTIONS): Remove.
	* config/v850/v850.c (TARGET_OPTION_OPTIMIZATION): Define.
	(v850_option_optimization): New.
	* config/v850/v850.h (OPTIMIZATION_OPTIONS): Remove.
	* config/xtensa/xtensa.c (TARGET_OPTION_OPTIMIZATION): Define.
	(xtensa_option_optimization): New.
	* config/xtensa/xtensa.h (OPTIMIZATION_OPTIONS): Remove.

diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/arm/arm-protos.h gcc-mainline/gcc/config/arm/arm-protos.h
--- gcc-mainline-0override/gcc/config/arm/arm-protos.h	2010-09-13 08:11:50.000000000 -0700
+++ gcc-mainline/gcc/config/arm/arm-protos.h	2010-09-14 13:00:55.000000000 -0700
@@ -23,7 +23,6 @@
 #ifndef GCC_ARM_PROTOS_H
 #define GCC_ARM_PROTOS_H
 
-extern void arm_optimization_options (int, int);
 extern int use_return_insn (int, rtx);
 extern enum reg_class arm_regno_class (int);
 extern void arm_load_pic_register (unsigned long);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/arm/arm.c gcc-mainline/gcc/config/arm/arm.c
--- gcc-mainline-0override/gcc/config/arm/arm.c	2010-09-13 08:16:04.000000000 -0700
+++ gcc-mainline/gcc/config/arm/arm.c	2010-09-14 13:01:59.000000000 -0700
@@ -216,6 +216,7 @@ 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 void arm_option_optimization (int, int);
 static bool arm_handle_option (size_t, const char *, int);
 static void arm_target_help (void);
 static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode);
@@ -320,6 +321,8 @@ static const struct attribute_spec arm_a
 #define TARGET_HELP arm_target_help
 #undef  TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE arm_option_override
+#undef  TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION arm_option_optimization
 
 #undef  TARGET_COMP_TYPE_ATTRIBUTES
 #define TARGET_COMP_TYPE_ATTRIBUTES arm_comp_type_attributes
@@ -22613,8 +22616,8 @@ arm_order_regs_for_local_alloc (void)
 }
 
 /* Set default optimization options.  */
-void
-arm_optimization_options (int level, int size ATTRIBUTE_UNUSED)
+static void
+arm_option_optimization (int level, int size ATTRIBUTE_UNUSED)
 {
   /* Enable section anchors by default at -O1 or higher.
      Use 2 to distinguish from an explicit -fsection-anchors
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/arm/arm.h gcc-mainline/gcc/config/arm/arm.h
--- gcc-mainline-0override/gcc/config/arm/arm.h	2010-09-13 08:12:26.000000000 -0700
+++ gcc-mainline/gcc/config/arm/arm.h	2010-09-14 13:00:49.000000000 -0700
@@ -498,9 +498,6 @@ extern int arm_arch_hwdiv;
    that is controlled by the APCS-FRAME option.  */
 #define CAN_DEBUG_WITHOUT_FP
 
-#define OPTIMIZATION_OPTIONS(LEVEL,SIZE)		\
-	arm_optimization_options ((LEVEL), (SIZE))
-
 /* Nonzero if PIC code requires explicit qualifiers to generate
    PLT and GOT relocs rather than the assembler doing so implicitly.
    Subtargets can override these if required.  */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/cris/cris.c gcc-mainline/gcc/config/cris/cris.c
--- gcc-mainline-0override/gcc/config/cris/cris.c	2010-09-13 08:46:58.000000000 -0700
+++ gcc-mainline/gcc/config/cris/cris.c	2010-09-14 13:09:25.000000000 -0700
@@ -130,6 +130,7 @@ static int cris_arg_partial_bytes (CUMUL
 static tree cris_md_asm_clobbers (tree, tree, tree);
 
 static bool cris_handle_option (size_t, const char *, int);
+static void cris_option_optimization (int, int);
 static void cris_option_override (void);
 
 static bool cris_frame_pointer_required (void);
@@ -211,6 +212,8 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_
 
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE cris_option_override
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION cris_option_optimization
 
 #undef TARGET_ASM_TRAMPOLINE_TEMPLATE
 #define TARGET_ASM_TRAMPOLINE_TEMPLATE cris_asm_trampoline_template
@@ -2396,6 +2399,15 @@ cris_handle_option (size_t code, const c
   return true;
 }
 
+/* Implement TARGET_OPTION_OPTIMIZATION.  */
+
+static void
+cris_option_optimization (int level, int size)
+{
+  if (level >= 2 || size)
+    flag_omit_frame_pointer = 1;
+}
+
 /* The TARGET_OPTION_OVERRIDE worker.
    As is the norm, this also parses -mfoo=bar type parameters.  */
 
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/cris/cris.h gcc-mainline/gcc/config/cris/cris.h
--- gcc-mainline-0override/gcc/config/cris/cris.h	2010-09-13 08:45:03.000000000 -0700
+++ gcc-mainline/gcc/config/cris/cris.h	2010-09-14 13:07:07.000000000 -0700
@@ -328,15 +328,6 @@ extern int target_flags;
 
 #define CRIS_SUBTARGET_HANDLE_OPTION(x, y, z)
 
-#define OPTIMIZATION_OPTIONS(OPTIMIZE, SIZE)	\
-  do						\
-    {						\
-      if ((OPTIMIZE) >= 2 || (SIZE))		\
-	flag_omit_frame_pointer = 1;		\
-    }						\
-  while (0)
-
-
 /* Node: Storage Layout */
 
 #define BITS_BIG_ENDIAN 0
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/crx/crx.c gcc-mainline/gcc/config/crx/crx.c
--- gcc-mainline-0override/gcc/config/crx/crx.c	2010-07-26 12:59:13.000000000 -0700
+++ gcc-mainline/gcc/config/crx/crx.c	2010-09-14 13:15:51.000000000 -0700
@@ -1,6 +1,6 @@
 /* Output routines for GCC for CRX.
    Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of GCC.
@@ -130,6 +130,7 @@ static bool crx_return_in_memory (const_
 static int crx_address_cost (rtx, bool);
 static bool crx_legitimate_address_p (enum machine_mode, rtx, bool);
 static bool crx_can_eliminate (const int, const int);
+static void crx_option_optimization (int, int);
 
 /*****************************************************************************/
 /* RTL VALIDITY								     */
@@ -174,6 +175,10 @@ static const struct attribute_spec crx_a
   {NULL, 0, 0, false, false, false, NULL}
 };
 
+/* Option handling.  */
+
+#undef	TARGET_OPTION_OPTIMIZATION
+#define	TARGET_OPTION_OPTIMIZATION	crx_option_optimization
 
 /* Initialize 'targetm' variable which contains pointers to functions and data
  * relating to the target machine.  */
@@ -1442,3 +1447,13 @@ crx_expand_epilogue (void)
   else
     emit_jump_insn (gen_pop_and_popret_return (GEN_INT (sum_regs)));
 }
+
+/* Implement TARGET_OPTION_OPTIMIZATION.  */
+static void
+crx_option_optimization (int level, int size)
+{
+  /* Put each function in its own section so that PAGE-instruction
+     relaxation can do its best.  */
+  if (level || size)
+    flag_function_sections = 1;
+}
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/crx/crx.h gcc-mainline/gcc/config/crx/crx.h
--- gcc-mainline-0override/gcc/config/crx/crx.h	2010-07-26 12:59:13.000000000 -0700
+++ gcc-mainline/gcc/config/crx/crx.h	2010-09-14 13:13:58.000000000 -0700
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler, for CRX.
    Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of GCC.
@@ -54,14 +54,6 @@ do {								\
 
 #define TARGET_VERSION fputs (" (CRX/ELF)", stderr);
 
-/* Put each function in its own section so that PAGE-instruction
- * relaxation can do its best.  */
-#define OPTIMIZATION_OPTIONS(LEVEL, SIZEFLAG)	\
-    do {					\
-	if ((LEVEL) || (SIZEFLAG))		\
-	    flag_function_sections = 1;	\
-    } while (0)
-
 /* Show we can debug even without a frame pointer.  */
 #define CAN_DEBUG_WITHOUT_FP
 
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/frv/frv-protos.h gcc-mainline/gcc/config/frv/frv-protos.h
--- gcc-mainline-0override/gcc/config/frv/frv-protos.h	2010-09-13 09:47:48.000000000 -0700
+++ gcc-mainline/gcc/config/frv/frv-protos.h	2010-09-14 13:25:42.000000000 -0700
@@ -38,7 +38,6 @@ extern frv_cpu_t frv_cpu_type;			/* valu
 /* Define functions defined in frv.c */
 extern void frv_expand_prologue			(void);
 extern void frv_expand_epilogue			(bool);
-extern void frv_optimization_options		(int, int);
 extern void frv_conditional_register_usage	(void);
 extern frv_stack_t *frv_stack_info		(void);
 extern void frv_debug_stack			(frv_stack_t *);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/frv/frv.c gcc-mainline/gcc/config/frv/frv.c
--- gcc-mainline-0override/gcc/config/frv/frv.c	2010-09-13 09:49:50.000000000 -0700
+++ gcc-mainline/gcc/config/frv/frv.c	2010-09-14 13:27:42.000000000 -0700
@@ -265,6 +265,7 @@ frv_cpu_t frv_cpu_type = CPU_TYPE;	/* va
 
 static bool frv_handle_option			(size_t, const char *, int);
 static void frv_option_override			(void);
+static void frv_option_optimization		(int, int);
 static bool frv_legitimate_address_p		(enum machine_mode, rtx, bool);
 static int frv_default_flags_for_cpu		(void);
 static int frv_string_begins_with		(const_tree, const char *);
@@ -431,6 +432,8 @@ static bool frv_class_likely_spilled_p 	
 #define TARGET_HANDLE_OPTION frv_handle_option
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE frv_option_override
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION frv_option_optimization
 #undef TARGET_INIT_BUILTINS
 #define TARGET_INIT_BUILTINS frv_init_builtins
 #undef TARGET_EXPAND_BUILTIN
@@ -850,29 +853,12 @@ frv_option_override (void)
 }
 
 
-/* Some machines may desire to change what optimizations are performed for
-   various optimization levels.  This macro, if defined, is executed once just
-   after the optimization level is determined and before the remainder of the
-   command options have been parsed.  Values set in this macro are used as the
-   default values for the other command line options.
-
-   LEVEL is the optimization level specified; 2 if `-O2' is specified, 1 if
-   `-O' is specified, and 0 if neither is specified.
-
-   SIZE is nonzero if `-Os' is specified, 0 otherwise.
-
-   You should not use this macro to change options that are not
-   machine-specific.  These should uniformly selected by the same optimization
-   level on all supported machines.  Use this macro to enable machine-specific
-   optimizations.
+/* Implement TARGET_OPTION_OPTIMIZATION.
 
-   *Do not examine `write_symbols' in this macro!* The debugging options are
-   *not supposed to alter the generated code.  */
-
-/* On the FRV, possibly disable VLIW packing which is done by the 2nd
+   On the FRV, possibly disable VLIW packing which is done by the 2nd
    scheduling pass at the current time.  */
-void
-frv_optimization_options (int level, int size ATTRIBUTE_UNUSED)
+static void
+frv_option_optimization (int level, int size ATTRIBUTE_UNUSED)
 {
   if (level >= 2)
     {
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/frv/frv.h gcc-mainline/gcc/config/frv/frv.h
--- gcc-mainline-0override/gcc/config/frv/frv.h	2010-09-13 09:48:01.000000000 -0700
+++ gcc-mainline/gcc/config/frv/frv.h	2010-09-14 13:26:03.000000000 -0700
@@ -328,27 +328,6 @@
         #endif  */
 #define TARGET_VERSION fprintf (stderr, _(" (frv)"))
 
-/* Some machines may desire to change what optimizations are performed for
-   various optimization levels.  This macro, if defined, is executed once just
-   after the optimization level is determined and before the remainder of the
-   command options have been parsed.  Values set in this macro are used as the
-   default values for the other command line options.
-
-   LEVEL is the optimization level specified; 2 if `-O2' is specified, 1 if
-   `-O' is specified, and 0 if neither is specified.
-
-   SIZE is nonzero if `-Os' is specified, 0 otherwise.
-
-   You should not use this macro to change options that are not
-   machine-specific.  These should uniformly selected by the same optimization
-   level on all supported machines.  Use this macro to enable machine-specific
-   optimizations.
-
-   *Do not examine `write_symbols' in this macro!* The debugging options are
-   *not supposed to alter the generated code.  */
-#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) frv_optimization_options (LEVEL, SIZE)
-
-
 /* Define this macro if debugging can be performed even without a frame
    pointer.  If this macro is defined, GCC will turn on the
    `-fomit-frame-pointer' option whenever `-O' is specified.  */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/h8300/h8300.c gcc-mainline/gcc/config/h8300/h8300.c
--- gcc-mainline-0override/gcc/config/h8300/h8300.c	2010-09-13 09:54:32.000000000 -0700
+++ gcc-mainline/gcc/config/h8300/h8300.c	2010-09-14 13:30:30.000000000 -0700
@@ -303,6 +303,18 @@ enum h8_cpu
   H8_S
 };
 
+/* Implement TARGET_OPTION_OPTIMIZATION.  */
+
+static void
+h8300_option_optimization (int level ATTRIBUTE_UNUSED,
+			   int size ATTRIBUTE_UNUSED)
+{
+  /* Basic block reordering is only beneficial on targets with cache
+     and/or variable-cycle branches where (cycle count taken != cycle
+     count not taken).  */
+  flag_reorder_blocks = 0;
+}
+
 /* Initialize various cpu specific globals at start up.  */
 
 static void
@@ -5925,4 +5937,7 @@ h8300_trampoline_init (rtx m_tramp, tree
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE h8300_option_override
 
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION h8300_option_optimization
+
 struct gcc_target targetm = TARGET_INITIALIZER;
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/h8300/h8300.h gcc-mainline/gcc/config/h8300/h8300.h
--- gcc-mainline-0override/gcc/config/h8300/h8300.h	2010-09-13 09:51:21.000000000 -0700
+++ gcc-mainline/gcc/config/h8300/h8300.h	2010-09-14 13:28:47.000000000 -0700
@@ -82,16 +82,6 @@ extern const char * const *h8_reg_names;
 
 #define LIB_SPEC "%{mrelax:-relax} %{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
 
-#define OPTIMIZATION_OPTIONS(LEVEL, SIZE)				 \
-  do									 \
-    {									 \
-      /* Basic block reordering is only beneficial on targets with cache \
-	 and/or variable-cycle branches where (cycle count taken !=	 \
-	 cycle count not taken).  */					 \
-      flag_reorder_blocks = 0;						 \
-    }									 \
-  while (0)
-
 /* Print subsidiary information on the compiler version in use.  */
 
 #define TARGET_VERSION fprintf (stderr, " (Renesas H8/300)");
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/i386/i386-protos.h gcc-mainline/gcc/config/i386/i386-protos.h
--- gcc-mainline-0override/gcc/config/i386/i386-protos.h	2010-09-13 09:59:46.000000000 -0700
+++ gcc-mainline/gcc/config/i386/i386-protos.h	2010-09-14 12:19:59.000000000 -0700
@@ -20,7 +20,6 @@ along with GCC; see the file COPYING3.  
 <http://www.gnu.org/licenses/>.  */
 
 /* Functions in i386.c */
-extern void optimization_options (int, int);
 extern void ix86_conditional_register_usage (void);
 
 extern bool ix86_target_stack_probe (void);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/i386/i386.c gcc-mainline/gcc/config/i386/i386.c
--- gcc-mainline-0override/gcc/config/i386/i386.c	2010-09-13 10:04:56.000000000 -0700
+++ gcc-mainline/gcc/config/i386/i386.c	2010-09-14 12:21:28.000000000 -0700
@@ -4512,8 +4512,8 @@ x86_output_aligned_bss (FILE *file, tree
   ASM_OUTPUT_SKIP (file, size ? size : 1);
 }
 
-void
-optimization_options (int level, int size ATTRIBUTE_UNUSED)
+static void
+ix86_option_optimization (int level, int size ATTRIBUTE_UNUSED)
 {
   /* For -O2 and beyond, turn off -fschedule-insns by default.  It tends to
      make the problem with not enough registers even worse.  */
@@ -32474,6 +32474,8 @@ has_dispatch (rtx insn, int action)
 
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE ix86_option_override
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION ix86_option_optimization
 
 #undef TARGET_REGISTER_MOVE_COST
 #define TARGET_REGISTER_MOVE_COST ix86_register_move_cost
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/i386/i386.h gcc-mainline/gcc/config/i386/i386.h
--- gcc-mainline-0override/gcc/config/i386/i386.h	2010-09-13 10:00:01.000000000 -0700
+++ gcc-mainline/gcc/config/i386/i386.h	2010-09-14 12:20:11.000000000 -0700
@@ -503,10 +503,6 @@ extern enum calling_abi ix86_abi;
    with the rounding mode forced to 53 bits.  */
 #define TARGET_96_ROUND_53_LONG_DOUBLE 0
 
-/* Define this to change the optimizations performed by default.  */
-#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
-  optimization_options ((LEVEL), (SIZE))
-
 /* -march=native handling only makes sense with compiler running on
    an x86 or x86_64 chip.  If changing this condition, also change
    the condition in driver-i386.c.  */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/ia64/ia64-protos.h gcc-mainline/gcc/config/ia64/ia64-protos.h
--- gcc-mainline-0override/gcc/config/ia64/ia64-protos.h	2010-09-13 03:40:42.000000000 -0700
+++ gcc-mainline/gcc/config/ia64/ia64-protos.h	2010-09-14 13:38:52.000000000 -0700
@@ -99,7 +99,6 @@ extern void ia64_hpux_handle_builtin_pra
 extern void ia64_output_function_profiler (FILE *, int);
 extern void ia64_profile_hook (int);
 
-extern void ia64_optimization_options (int, int);
 extern void ia64_init_expanders (void);
 
 extern rtx ia64_dconst_0_5 (void);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/ia64/ia64.c gcc-mainline/gcc/config/ia64/ia64.c
--- gcc-mainline-0override/gcc/config/ia64/ia64.c	2010-09-13 10:11:30.000000000 -0700
+++ gcc-mainline/gcc/config/ia64/ia64.c	2010-09-14 13:42:00.000000000 -0700
@@ -202,6 +202,7 @@ static rtx gen_fr_spill_x (rtx, rtx, rtx
 static rtx gen_fr_restore_x (rtx, rtx, rtx);
 
 static void ia64_option_override (void);
+static void ia64_option_optimization (int, int);
 static bool ia64_can_eliminate (const int, const int);
 static enum machine_mode hfa_element_mode (const_tree, bool);
 static void ia64_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
@@ -361,6 +362,8 @@ static const struct attribute_spec ia64_
 
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE ia64_option_override
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION ia64_option_optimization
 
 #undef TARGET_ASM_FUNCTION_PROLOGUE
 #define TARGET_ASM_FUNCTION_PROLOGUE ia64_output_function_prologue
@@ -10719,10 +10722,14 @@ ia64_invalid_binary_op (int op ATTRIBUTE
 }
 
 /* Implement overriding of the optimization options.  */
-void
-ia64_optimization_options (int level ATTRIBUTE_UNUSED,
-                           int size ATTRIBUTE_UNUSED)
+static void
+ia64_option_optimization (int level ATTRIBUTE_UNUSED,
+			  int size ATTRIBUTE_UNUSED)
 {
+#ifdef SUBTARGET_OPTIMIZATION_OPTIONS
+  SUBTARGET_OPTIMIZATION_OPTIONS;
+#endif
+
   /* Let the scheduler form additional regions.  */
   set_param_value ("max-sched-extend-regions-iters", 2);
 
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/ia64/ia64.h gcc-mainline/gcc/config/ia64/ia64.h
--- gcc-mainline-0override/gcc/config/ia64/ia64.h	2010-08-30 03:29:37.000000000 -0700
+++ gcc-mainline/gcc/config/ia64/ia64.h	2010-09-14 13:39:17.000000000 -0700
@@ -118,14 +118,6 @@ enum processor_type
 };
 
 extern enum processor_type ia64_tune;
-
-/* Some machines may desire to change what optimizations are performed for
-   various optimization levels.  This macro, if defined, is executed once just
-   after the optimization level is determined and before the remainder of the
-   command options have been parsed.  Values set in this macro are used as the
-   default values for the other command line options.  */
-
-/* #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) */
 
 /* Driver configuration */
 
@@ -1897,8 +1889,4 @@ struct GTY(()) machine_function
 /* Switch on code for querying unit reservations.  */
 #define CPU_UNITS_QUERY 1
 
-/* Define this to change the optimizations performed by default.  */
-#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
-  ia64_optimization_options ((LEVEL), (SIZE))
-
 /* End of ia64.h */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/ia64/vms.h gcc-mainline/gcc/config/ia64/vms.h
--- gcc-mainline-0override/gcc/config/ia64/vms.h	2010-06-17 03:29:54.000000000 -0700
+++ gcc-mainline/gcc/config/ia64/vms.h	2010-09-14 13:40:27.000000000 -0700
@@ -183,11 +183,10 @@ typedef struct crtl_name_spec
 	  }                                                                \
     } while (0)
 
-#undef OPTIMIZATION_OPTIONS
-#define OPTIMIZATION_OPTIONS(LEVEL,SIZE)                   \
+#undef SUBTARGET_OPTIMIZATION_OPTIONS
+#define SUBTARGET_OPTIMIZATION_OPTIONS                     \
   do {                                                     \
        flag_merge_constants = 0;                           \
-       ia64_optimization_options ((LEVEL), (SIZE));        \
   } while (0)
 
 /* Define this to be nonzero if static stack checking is supported.  */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/m32r/m32r.c gcc-mainline/gcc/config/m32r/m32r.c
--- gcc-mainline-0override/gcc/config/m32r/m32r.c	2010-09-13 13:09:44.000000000 -0700
+++ gcc-mainline/gcc/config/m32r/m32r.c	2010-09-14 15:34:37.000000000 -0700
@@ -64,6 +64,7 @@ enum m32r_sdata m32r_sdata = M32R_SDATA_
 /* Forward declaration.  */
 static bool  m32r_handle_option (size_t, const char *, int);
 static void  m32r_option_override (void);
+static void  m32r_option_optimization (int, int);
 static void  init_reg_tables (void);
 static void  block_move_call (rtx, rtx, rtx);
 static int   m32r_is_insn (rtx);
@@ -153,6 +154,8 @@ static const struct attribute_spec m32r_
 #define TARGET_HANDLE_OPTION m32r_handle_option
 #undef  TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE m32r_option_override
+#undef  TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION m32r_option_optimization
 
 #undef  TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO m32r_encode_section_info
@@ -280,6 +283,18 @@ m32r_option_override (void)
   SUBTARGET_OVERRIDE_OPTIONS;
 }
 
+static void
+m32r_option_optimization (int level, int size)
+{
+  if (level == 1)
+    flag_regmove = 1;
+
+  if (size)
+    flag_omit_frame_pointer = 1;
+
+  SUBTARGET_OPTIMIZATION_OPTIONS;
+}
+
 /* Vectors to keep interesting information about registers where it can easily
    be got.  We use to use the actual mode value as the bit number, but there
    is (or may be) more than 32 modes now.  Instead we use two tables: one
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/m32r/m32r.h gcc-mainline/gcc/config/m32r/m32r.h
--- gcc-mainline-0override/gcc/config/m32r/m32r.h	2010-09-13 13:08:55.000000000 -0700
+++ gcc-mainline/gcc/config/m32r/m32r.h	2010-09-14 15:31:07.000000000 -0700
@@ -310,21 +310,6 @@ extern enum m32r_sdata m32r_sdata;
 #define SUBTARGET_OPTIMIZATION_OPTIONS
 #endif
 
-#define OPTIMIZATION_OPTIONS(LEVEL, SIZE)	\
-  do						\
-    {						\
-      if (LEVEL == 1)				\
-	flag_regmove = TRUE;			\
-      						\
-      if (SIZE)					\
-	{					\
-	  flag_omit_frame_pointer = TRUE;	\
-	}					\
-      						\
-      SUBTARGET_OPTIMIZATION_OPTIONS		\
-    }						\
-  while (0)
-
 /* Define this macro if debugging can be performed even without a
    frame pointer.  If this macro is defined, GCC will turn on the
    `-fomit-frame-pointer' option whenever `-O' is specified.  */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/m68hc11/m68hc11-protos.h gcc-mainline/gcc/config/m68hc11/m68hc11-protos.h
--- gcc-mainline-0override/gcc/config/m68hc11/m68hc11-protos.h	2010-09-13 13:19:04.000000000 -0700
+++ gcc-mainline/gcc/config/m68hc11/m68hc11-protos.h	2010-09-14 15:44:38.000000000 -0700
@@ -20,7 +20,6 @@ along with GCC; see the file COPYING3.  
 <http://www.gnu.org/licenses/>.  */
 
 
-extern int m68hc11_optimization_options (int,int);
 extern void m68hc11_conditional_register_usage (void);
 extern int hard_regno_mode_ok (int, enum machine_mode);
 extern int m68hc11_hard_regno_rename_ok (int, int);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/mcore/mcore.c gcc-mainline/gcc/config/mcore/mcore.c
--- gcc-mainline-0override/gcc/config/mcore/mcore.c	2010-09-13 13:31:13.000000000 -0700
+++ gcc-mainline/gcc/config/mcore/mcore.c	2010-09-14 15:56:35.000000000 -0700
@@ -150,6 +150,7 @@ static int        mcore_arg_partial_byte
 static void       mcore_asm_trampoline_template (FILE *);
 static void       mcore_trampoline_init		(rtx, tree, rtx);
 static void       mcore_option_override		(void);
+static void       mcore_option_optimization	(int, int);
 
 /* MCore specific attributes.  */
 
@@ -228,6 +229,8 @@ static const struct attribute_spec mcore
 
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE mcore_option_override
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION mcore_option_optimization
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -2690,6 +2693,34 @@ mcore_option_override (void)
   if (TARGET_LITTLE_END && ! TARGET_M340)
     target_flags |= MASK_M340;
 }
+
+/* What options are we going to default to specific settings when
+   -O* happens; the user can subsequently override these settings.
+  
+   Omitting the frame pointer is a very good idea on the MCore.
+   Scheduling isn't worth anything on the current MCore implementation.  */
+
+static void
+mcore_option_optimization (int level, int size)
+{
+  if (level)
+    {
+      flag_no_function_cse = 1;
+      flag_omit_frame_pointer = 1;
+
+      if (level >= 2)
+        {
+          flag_caller_saves = 0;
+          flag_schedule_insns = 0;
+          flag_schedule_insns_after_reload = 0;
+        }
+    }
+  if (size)
+    {
+      target_flags &= ~MASK_HARDLIT;
+    }
+}
+
 
 /* Compute the number of word sized registers needed to 
    hold a function argument of mode MODE and type TYPE.  */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/mcore/mcore.h gcc-mainline/gcc/config/mcore/mcore.h
--- gcc-mainline-0override/gcc/config/mcore/mcore.h	2010-09-13 13:30:05.000000000 -0700
+++ gcc-mainline/gcc/config/mcore/mcore.h	2010-09-14 15:54:00.000000000 -0700
@@ -85,31 +85,6 @@ extern char * mcore_current_function_nam
 /* The MCore ABI says that bitfields are unsigned by default.  */
 #define CC1_SPEC "-funsigned-bitfields"
 
-/* What options are we going to default to specific settings when
-   -O* happens; the user can subsequently override these settings.
-  
-   Omitting the frame pointer is a very good idea on the MCore.
-   Scheduling isn't worth anything on the current MCore implementation.  */
-#define OPTIMIZATION_OPTIONS(LEVEL,SIZE)	\
-{						\
-  if (LEVEL)					\
-    {						\
-      flag_no_function_cse = 1;			\
-      flag_omit_frame_pointer = 1;		\
-						\
-      if (LEVEL >= 2)				\
-        {					\
-          flag_caller_saves = 0;		\
-          flag_schedule_insns = 0;		\
-          flag_schedule_insns_after_reload = 0;	\
-        }					\
-    }						\
-  if (SIZE)					\
-    {						\
-      target_flags &= ~MASK_HARDLIT;		\
-    }						\
-}
-
 /* Target machine storage Layout.  */
 
 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE)  	\
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/mep/mep-protos.h gcc-mainline/gcc/config/mep/mep-protos.h
--- gcc-mainline-0override/gcc/config/mep/mep-protos.h	2010-09-13 13:39:19.000000000 -0700
+++ gcc-mainline/gcc/config/mep/mep-protos.h	2010-09-14 16:02:46.000000000 -0700
@@ -20,7 +20,6 @@ along with GCC; see the file COPYING3.  
 <http://www.gnu.org/licenses/>.  */
 
 extern void mep_conditional_register_usage (char *, char *);
-extern void mep_optimization_options (void);
 extern int mep_regno_reg_class (int);
 extern int mep_reg_class_from_constraint (int, const char *);
 extern bool mep_const_ok_for_letter_p (HOST_WIDE_INT, int);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/mep/mep.c gcc-mainline/gcc/config/mep/mep.c
--- gcc-mainline-0override/gcc/config/mep/mep.c	2010-09-13 13:39:19.000000000 -0700
+++ gcc-mainline/gcc/config/mep/mep.c	2010-09-14 16:02:15.000000000 -0700
@@ -221,6 +221,7 @@ static bool mep_pass_by_reference (CUMUL
 static bool mep_vector_mode_supported_p (enum machine_mode);
 static bool mep_handle_option (size_t, const char *, int);
 static void mep_option_override (void);
+static void mep_option_optimization (int, int);
 static rtx  mep_allocate_initial_value (rtx);
 static void mep_asm_init_sections (void);
 static int mep_comp_type_attributes (const_tree, const_tree);
@@ -286,6 +287,8 @@ static void mep_trampoline_init (rtx, tr
 #define TARGET_HANDLE_OPTION            mep_handle_option
 #undef  TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE		mep_option_override
+#undef  TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION	mep_option_optimization
 #undef  TARGET_DEFAULT_TARGET_FLAGS
 #define TARGET_DEFAULT_TARGET_FLAGS	TARGET_DEFAULT
 #undef  TARGET_ALLOCATE_INITIAL_VALUE
@@ -373,8 +376,8 @@ mep_conditional_register_usage (char *fi
     global_regs[i] = 1;
 }
 
-void
-mep_optimization_options (void)
+static void
+mep_option_optimization (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
 {
   /* The first scheduling pass often increases register pressure and tends
      to result in more spill code.  Only run it when specifically asked.  */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/mep/mep.h gcc-mainline/gcc/config/mep/mep.h
--- gcc-mainline-0override/gcc/config/mep/mep.h	2010-09-13 13:39:19.000000000 -0700
+++ gcc-mainline/gcc/config/mep/mep.h	2010-09-14 16:02:15.000000000 -0700
@@ -163,8 +163,6 @@ extern int target_flags;
 /* end-coproc-selection-table */
 
 #define CAN_DEBUG_WITHOUT_FP
-
-#define OPTIMIZATION_OPTIONS(LEVEL, FOR_SIZE) mep_optimization_options ()
 
 
 #define BITS_BIG_ENDIAN 0
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/mmix/mmix.c gcc-mainline/gcc/config/mmix/mmix.c
--- gcc-mainline-0override/gcc/config/mmix/mmix.c	2010-09-13 13:45:39.000000000 -0700
+++ gcc-mainline/gcc/config/mmix/mmix.c	2010-09-14 16:10:56.000000000 -0700
@@ -114,6 +114,7 @@ rtx mmix_compare_op1;
 static int mmix_output_destination_register;
 
 static void mmix_option_override (void);
+static void mmix_option_optimization (int, int);
 static void mmix_asm_output_source_filename (FILE *, const char *);
 static void mmix_output_shiftvalue_op_from_str
   (FILE *, const char *, HOST_WIDEST_INT);
@@ -236,6 +237,8 @@ static void mmix_trampoline_init (rtx, t
 
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE mmix_option_override
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION mmix_option_optimization
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -259,6 +262,18 @@ mmix_option_override (void)
     }
 }
 
+/* TARGET_OPTION_OPTIMIZATION.  */
+
+static void
+mmix_option_optimization (int level, int size)
+{
+  if (level >= 1)
+    flag_regmove = 1;
+
+  if (size || level > 1)
+    flag_omit_frame_pointer = 1;
+}
+
 /* INIT_EXPANDERS.  */
 
 void
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/mmix/mmix.h gcc-mainline/gcc/config/mmix/mmix.h
--- gcc-mainline-0override/gcc/config/mmix/mmix.h	2010-09-13 13:44:13.000000000 -0700
+++ gcc-mainline/gcc/config/mmix/mmix.h	2010-09-14 16:08:54.000000000 -0700
@@ -149,19 +149,6 @@ extern int target_flags;
 #define TARGET_VERSION \
   fprintf (stderr, " (MMIX)")
 
-#define OPTIMIZATION_OPTIONS(LEVEL, SIZE)	\
-  do						\
-    {						\
-      if (LEVEL >= 1)				\
-	flag_regmove = TRUE;			\
-      						\
-      if (SIZE || LEVEL > 1)			\
-	{					\
-	  flag_omit_frame_pointer = TRUE;	\
-	}					\
-    }						\
-  while (0)
-
 /* This one will have to wait a little bit; right now we can't debug
    neither with or without a frame-pointer.  */
 /* #define CAN_DEBUG_WITHOUT_FP */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/pdp11/pdp11.c gcc-mainline/gcc/config/pdp11/pdp11.c
--- gcc-mainline-0override/gcc/config/pdp11/pdp11.c	2010-07-26 12:59:12.000000000 -0700
+++ gcc-mainline/gcc/config/pdp11/pdp11.c	2010-09-14 16:37:21.000000000 -0700
@@ -145,6 +145,7 @@ decode_pdp11_d (const struct real_format
 /* rtx cc0_reg_rtx; - no longer needed? */
 
 static bool pdp11_handle_option (size_t, const char *, int);
+static void pdp11_option_optimization (int, int);
 static rtx find_addr_reg (rtx); 
 static const char *singlemove_string (rtx *);
 static bool pdp11_assemble_integer (rtx, unsigned int, int);
@@ -182,6 +183,8 @@ static void pdp11_trampoline_init (rtx, 
   (MASK_FPU | MASK_45 | MASK_ABSHI_BUILTIN | TARGET_UNIX_ASM_DEFAULT)
 #undef TARGET_HANDLE_OPTION
 #define TARGET_HANDLE_OPTION pdp11_handle_option
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION pdp11_option_optimization
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS pdp11_rtx_costs
@@ -218,6 +221,21 @@ pdp11_handle_option (size_t code, const 
     }
 }
 
+/* Implement TARGET_OPTION_OPTIMIZATION.  */
+
+static void
+pdp11_option_optimization (int level, int size ATTRIBUTE_UNUSED)
+{
+  flag_finite_math_only = 0;
+  flag_trapping_math = 0;
+  flag_signaling_nans = 0;
+  if (level >= 3)
+    {
+      flag_omit_frame_pointer = 1;
+      /* flag_unroll_loops = 1; */
+    }
+}
+
 /* Nonzero if OP is a valid second operand for an arithmetic insn.  */
 
 int
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/pdp11/pdp11.h gcc-mainline/gcc/config/pdp11/pdp11.h
--- gcc-mainline-0override/gcc/config/pdp11/pdp11.h	2010-07-26 12:59:12.000000000 -0700
+++ gcc-mainline/gcc/config/pdp11/pdp11.h	2010-09-14 16:37:21.000000000 -0700
@@ -949,28 +949,6 @@ extern struct rtx_def *cc0_reg_rtx;
 #define TRAMPOLINE_SIZE 8
 #define TRAMPOLINE_ALIGNMENT 16
 
-/* Some machines may desire to change what optimizations are
-   performed for various optimization levels.   This macro, if
-   defined, is executed once just after the optimization level is
-   determined and before the remainder of the command options have
-   been parsed.  Values set in this macro are used as the default
-   values for the other command line options.
-
-   LEVEL is the optimization level specified; 2 if -O2 is
-   specified, 1 if -O is specified, and 0 if neither is specified.  */
-
-#define OPTIMIZATION_OPTIONS(LEVEL,SIZE)				\
-{									\
-  flag_finite_math_only		= 0;					\
-  flag_trapping_math		= 0;					\
-  flag_signaling_nans		= 0;					\
-  if (LEVEL >= 3)							\
-    {									\
-      flag_omit_frame_pointer		= 1;				\
-      /* flag_unroll_loops			= 1; */			\
-    }									\
-}
-
 /* there is no point in avoiding branches on a pdp, 
    since branches are really cheap - I just want to find out
    how much difference the BRANCH_COST macro makes in code */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/rs6000/rs6000-protos.h gcc-mainline/gcc/config/rs6000/rs6000-protos.h
--- gcc-mainline-0override/gcc/config/rs6000/rs6000-protos.h	2010-09-13 14:51:50.000000000 -0700
+++ gcc-mainline/gcc/config/rs6000/rs6000-protos.h	2010-09-14 16:27:52.000000000 -0700
@@ -153,7 +153,6 @@ extern enum direction function_arg_paddi
 
 #endif /* TREE_CODE */
 
-extern void optimization_options (int, int);
 extern int direct_return (void);
 extern int first_reg_to_save (void);
 extern int first_fp_reg_to_save (void);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/rs6000/rs6000.c gcc-mainline/gcc/config/rs6000/rs6000.c
--- gcc-mainline-0override/gcc/config/rs6000/rs6000.c	2010-09-13 15:00:59.000000000 -0700
+++ gcc-mainline/gcc/config/rs6000/rs6000.c	2010-09-14 16:29:13.000000000 -0700
@@ -1134,6 +1134,7 @@ static rtx altivec_expand_vec_set_builti
 static rtx altivec_expand_vec_ext_builtin (tree, rtx);
 static int get_element_number (tree, tree);
 static void rs6000_option_override (void);
+static void rs6000_option_optimization (int, int);
 static bool rs6000_handle_option (size_t, const char *, int);
 static void rs6000_parse_tls_size_option (void);
 static void rs6000_parse_yes_no_option (const char *, const char *, int *);
@@ -1592,6 +1593,9 @@ static const struct attribute_spec rs600
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE rs6000_option_override
 
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION rs6000_option_optimization
+
 #undef TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION
 #define TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION \
   rs6000_builtin_vectorized_function
@@ -3618,8 +3622,9 @@ rs6000_parse_tls_size_option (void)
     error ("bad value %qs for -mtls-size switch", rs6000_tls_size_string);
 }
 
-void
-optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
+static void
+rs6000_option_optimization (int level ATTRIBUTE_UNUSED,
+			    int size ATTRIBUTE_UNUSED)
 {
   if (DEFAULT_ABI == ABI_DARWIN)
     /* The Darwin libraries never set errno, so we might as well
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/rs6000/rs6000.h gcc-mainline/gcc/config/rs6000/rs6000.h
--- gcc-mainline-0override/gcc/config/rs6000/rs6000.h	2010-09-13 15:00:40.000000000 -0700
+++ gcc-mainline/gcc/config/rs6000/rs6000.h	2010-09-14 16:28:05.000000000 -0700
@@ -622,9 +622,6 @@ extern unsigned char rs6000_recip_bits[]
 /* The default CPU for TARGET_OPTION_OVERRIDE.  */
 #define OPTION_TARGET_CPU_DEFAULT TARGET_CPU_DEFAULT
 
-/* Define this to change the optimizations performed by default.  */
-#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) optimization_options(LEVEL,SIZE)
-
 /* Show we can debug even without a frame pointer.  */
 #define CAN_DEBUG_WITHOUT_FP
 
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/rx/rx-protos.h gcc-mainline/gcc/config/rx/rx-protos.h
--- gcc-mainline-0override/gcc/config/rx/rx-protos.h	2010-09-02 04:45:25.000000000 -0700
+++ gcc-mainline/gcc/config/rx/rx-protos.h	2010-09-14 16:38:51.000000000 -0700
@@ -28,7 +28,6 @@
 extern void		rx_conditional_register_usage (void);
 extern void		rx_expand_prologue (void);
 extern int		rx_initial_elimination_offset (int, int);
-extern void		rx_set_optimization_options (void);
 
 #ifdef RTX_CODE
 extern bool		rx_compare_redundant (rtx);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/rx/rx.c gcc-mainline/gcc/config/rx/rx.c
--- gcc-mainline-0override/gcc/config/rx/rx.c	2010-09-02 04:45:25.000000000 -0700
+++ gcc-mainline/gcc/config/rx/rx.c	2010-09-14 16:40:40.000000000 -0700
@@ -2162,8 +2162,10 @@ rx_handle_option (size_t code, const cha
   return true;
 }
 
-void
-rx_set_optimization_options (void)
+/* Implement TARGET_OPTION_OPTIMIZATION.  */
+
+static void
+rx_option_optimization (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
 {
   static bool first_time = TRUE;
   static bool saved_allow_rx_fpu = TRUE;
@@ -2803,6 +2805,9 @@ rx_memory_move_cost (enum machine_mode m
 #undef  TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE			rx_option_override
 
+#undef  TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION		rx_option_optimization
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* #include "gt-rx.h" */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/rx/rx.h gcc-mainline/gcc/config/rx/rx.h
--- gcc-mainline-0override/gcc/config/rx/rx.h	2010-09-02 04:45:25.000000000 -0700
+++ gcc-mainline/gcc/config/rx/rx.h	2010-09-14 16:38:57.000000000 -0700
@@ -632,9 +632,6 @@ extern int rx_float_compare_mode;
 #define TARGET_OPTION_TRANSLATE_TABLE \
   {"-nofpu", "-mnofpu" }
 
-#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
-  rx_set_optimization_options ()
-
 #define TARGET_USE_FPU		(! TARGET_NO_USE_FPU)
 
 /* This macro is used to decide when RX FPU instructions can be used.  */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/s390/s390-protos.h gcc-mainline/gcc/config/s390/s390-protos.h
--- gcc-mainline-0override/gcc/config/s390/s390-protos.h	2010-09-13 15:31:32.000000000 -0700
+++ gcc-mainline/gcc/config/s390/s390-protos.h	2010-09-14 16:56:54.000000000 -0700
@@ -34,7 +34,6 @@ extern bool s390_check_symref_alignment 
 
 /* Declare functions in s390.c.  */
 
-extern void optimization_options (int, int);
 extern HOST_WIDE_INT s390_initial_elimination_offset (int, int);
 extern void s390_emit_prologue (void);
 extern void s390_emit_epilogue (bool);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/s390/s390.c gcc-mainline/gcc/config/s390/s390.c
--- gcc-mainline-0override/gcc/config/s390/s390.c	2010-09-13 15:32:43.000000000 -0700
+++ gcc-mainline/gcc/config/s390/s390.c	2010-09-14 16:58:21.000000000 -0700
@@ -1465,8 +1465,8 @@ s390_init_machine_status (void)
 
    SIZE is nonzero if `-Os' is specified and zero otherwise.  */
 
-void
-optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
+static void
+s390_option_optimization (int level ATTRIBUTE_UNUSED, int size)
 {
   /* ??? There are apparently still problems with -fcaller-saves.  */
   flag_caller_saves = 0;
@@ -1675,7 +1675,7 @@ s390_option_override (void)
   if (!PARAM_SET_P (PARAM_SIMULTANEOUS_PREFETCHES))
     set_param_value ("simultaneous-prefetches", 6);
 
-  /* This cannot reside in optimization_options since HAVE_prefetch
+  /* This cannot reside in s390_option_optimization since HAVE_prefetch
      requires the arch flags to be evaluated already.  Since prefetching
      is beneficial on s390, we enable it if available.  */
   if (flag_prefetch_loop_arrays < 0 && HAVE_prefetch && optimize >= 3)
@@ -10426,6 +10426,9 @@ s390_loop_unroll_adjust (unsigned nunrol
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE s390_option_override
 
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION s390_option_optimization
+
 #undef	TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO s390_encode_section_info
 
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/s390/s390.h gcc-mainline/gcc/config/s390/s390.h
--- gcc-mainline-0override/gcc/config/s390/s390.h	2010-09-13 15:31:50.000000000 -0700
+++ gcc-mainline/gcc/config/s390/s390.h	2010-09-14 16:57:05.000000000 -0700
@@ -149,9 +149,6 @@ extern int s390_arch_flags;
 #define TARGET_VERSION fprintf (stderr, " (S/390)");
 #endif
 
-/* Hook to override options.  */
-#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) optimization_options(LEVEL, SIZE)
-
 /* Frame pointer is not used for debugging.  */
 #define CAN_DEBUG_WITHOUT_FP
 
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/sh/sh-protos.h gcc-mainline/gcc/config/sh/sh-protos.h
--- gcc-mainline-0override/gcc/config/sh/sh-protos.h	2010-09-13 03:40:42.000000000 -0700
+++ gcc-mainline/gcc/config/sh/sh-protos.h	2010-09-14 17:01:06.000000000 -0700
@@ -124,7 +124,6 @@ extern rtx sh_gen_truncate (enum machine
 extern bool sh_vector_mode_supported_p (enum machine_mode);
 #endif /* RTX_CODE */
 
-extern void sh_optimization_options (int, int);
 extern const char *output_jump_label_table (void);
 extern int sh_handle_pragma (int (*)(void), void (*)(int), const char *);
 extern struct rtx_def *get_fpscr_rtx (void);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/sh/sh.c gcc-mainline/gcc/config/sh/sh.c
--- gcc-mainline-0override/gcc/config/sh/sh.c	2010-09-13 15:42:05.000000000 -0700
+++ gcc-mainline/gcc/config/sh/sh.c	2010-09-14 17:02:26.000000000 -0700
@@ -183,6 +183,7 @@ static int noncall_uses_reg (rtx, rtx, r
 static rtx gen_block_redirect (rtx, int, int);
 static void sh_reorg (void);
 static void sh_option_override (void);
+static void sh_option_optimization (int, int);
 static void output_stack_adjust (int, rtx, int, HARD_REG_SET *, bool);
 static rtx frame_insn (rtx);
 static rtx push (int);
@@ -339,6 +340,8 @@ static const struct attribute_spec sh_at
 
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE sh_option_override
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION sh_option_optimization
 
 #undef TARGET_PRINT_OPERAND
 #define TARGET_PRINT_OPERAND sh_print_operand
@@ -694,8 +697,8 @@ sh_handle_option (size_t code, const cha
 }
 
 /* Set default optimization options.  */
-void
-sh_optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
+static void
+sh_option_optimization (int level, int size)
 {
   if (level)
     {
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/sh/sh.h gcc-mainline/gcc/config/sh/sh.h
--- gcc-mainline-0override/gcc/config/sh/sh.h	2010-09-13 03:40:42.000000000 -0700
+++ gcc-mainline/gcc/config/sh/sh.h	2010-09-14 17:01:13.000000000 -0700
@@ -470,8 +470,6 @@ do { \
 
 #define DRIVER_SELF_SPECS "%{m2a:%{ml:%eSH2a does not support little-endian}}"
 
-#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) sh_optimization_options (LEVEL, SIZE)
-
 #define ASSEMBLER_DIALECT assembler_dialect
 
 extern int assembler_dialect;
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/spu/spu-protos.h gcc-mainline/gcc/config/spu/spu-protos.h
--- gcc-mainline-0override/gcc/config/spu/spu-protos.h	2010-09-13 16:23:21.000000000 -0700
+++ gcc-mainline/gcc/config/spu/spu-protos.h	2010-09-14 17:06:35.000000000 -0700
@@ -20,7 +20,6 @@
 
 extern void spu_cpu_cpp_builtins (struct cpp_reader * pfile);
 extern void builtin_define_std (const char *);
-extern void spu_optimization_options (int level, int size);
 extern void spu_c_common_override_options (void);
 extern int valid_subreg (rtx op);
 extern void spu_expand_extv (rtx * ops, int unsignedp);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/spu/spu.c gcc-mainline/gcc/config/spu/spu.c
--- gcc-mainline-0override/gcc/config/spu/spu.c	2010-09-13 16:26:14.000000000 -0700
+++ gcc-mainline/gcc/config/spu/spu.c	2010-09-14 17:07:41.000000000 -0700
@@ -150,6 +150,7 @@ char regs_ever_allocated[FIRST_PSEUDO_RE
 
 /*  Prototypes and external defs.  */
 static void spu_option_override (void);
+static void spu_option_optimization (int, int);
 static void spu_init_builtins (void);
 static tree spu_builtin_decl (unsigned, bool);
 static bool spu_scalar_mode_supported_p (enum machine_mode mode);
@@ -468,10 +469,13 @@ static const struct attribute_spec spu_a
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE spu_option_override
 
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION spu_option_optimization
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
-void
-spu_optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
+static void
+spu_option_optimization (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
 {
   /* Override some of the default param values.  With so many registers
      larger values are better for these params.  */
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/spu/spu.h gcc-mainline/gcc/config/spu/spu.h
--- gcc-mainline-0override/gcc/config/spu/spu.h	2010-09-13 16:23:28.000000000 -0700
+++ gcc-mainline/gcc/config/spu/spu.h	2010-09-14 17:06:42.000000000 -0700
@@ -22,9 +22,6 @@
 
 #define C_COMMON_OVERRIDE_OPTIONS spu_c_common_override_options()
 
-#define OPTIMIZATION_OPTIONS(level,size) \
-	  spu_optimization_options(level,size)
-
 #define INIT_EXPANDERS spu_init_expanders()
 
 extern int target_flags;
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/v850/v850.c gcc-mainline/gcc/config/v850/v850.c
--- gcc-mainline-0override/gcc/config/v850/v850.c	2010-09-02 04:45:26.000000000 -0700
+++ gcc-mainline/gcc/config/v850/v850.c	2010-09-14 17:11:07.000000000 -0700
@@ -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 Free Software Foundation, Inc.
+   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    Contributed by Jeff Law (law@cygnus.com).
 
    This file is part of GCC.
@@ -50,6 +50,7 @@
 
 /* Function prototypes for stupid compilers:  */
 static bool v850_handle_option       (size_t, const char *, int);
+static void v850_option_optimization (int, int);
 static void const_double_split       (rtx, HOST_WIDE_INT *, HOST_WIDE_INT *);
 static int  const_costs_int          (HOST_WIDE_INT, int);
 static int  const_costs		     (rtx, enum rtx_code);
@@ -218,6 +219,9 @@ static const struct attribute_spec v850_
 #undef TARGET_STRICT_ARGUMENT_NAMING
 #define TARGET_STRICT_ARGUMENT_NAMING v850_strict_argument_naming
 
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION v850_option_optimization
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Set the maximum size of small memory area TYPE to the value given
@@ -279,6 +283,21 @@ v850_handle_option (size_t code, const c
     }
 }
 
+/* Implement TARGET_OPTION_OPTIMIZATION.  */
+
+static void
+v850_option_optimization (int level, int size ATTRIBUTE_UNUSED)
+{
+  if (level)
+    /* Note - we no longer enable MASK_EP when optimizing.  This is
+       because of a hardware bug which stops the SLD and SST instructions
+       from correctly detecting some hazards.  If the user is sure that
+       their hardware is fixed or that their program will not encounter
+       the conditions that trigger the bug then they can enable -mep by
+       hand.  */
+    target_flags |= MASK_PROLOG_FUNCTION;
+}
+
 /* Handle the TARGET_PASS_BY_REFERENCE target hook.
    Specify whether to pass the argument by reference.  */
 
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/v850/v850.h gcc-mainline/gcc/config/v850/v850.h
--- gcc-mainline-0override/gcc/config/v850/v850.h	2010-09-02 04:45:26.000000000 -0700
+++ gcc-mainline/gcc/config/v850/v850.h	2010-09-14 17:08:35.000000000 -0700
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler. NEC V850 series
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2007, 2008, 2009  Free Software Foundation, Inc.
+   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
    Contributed by Jeff Law (law@cygnus.com).
 
    This file is part of GCC.
@@ -140,39 +140,6 @@ extern struct small_memory_info small_me
 
 /* Show we can debug even without a frame pointer.  */
 #define CAN_DEBUG_WITHOUT_FP
-
-/* Some machines may desire to change what optimizations are
-   performed for various optimization levels.   This macro, if
-   defined, is executed once just after the optimization level is
-   determined and before the remainder of the command options have
-   been parsed.  Values set in this macro are used as the default
-   values for the other command line options.
-
-   LEVEL is the optimization level specified; 2 if `-O2' is
-   specified, 1 if `-O' is specified, and 0 if neither is specified.
-
-   SIZE is nonzero if `-Os' is specified, 0 otherwise.  
-
-   You should not use this macro to change options that are not
-   machine-specific.  These should uniformly selected by the same
-   optimization level on all supported machines.  Use this macro to
-   enable machine-specific optimizations.
-
-   *Do not examine `write_symbols' in this macro!* The debugging
-   options are not supposed to alter the generated code.  */
-
-#define OPTIMIZATION_OPTIONS(LEVEL,SIZE)				\
-{									\
-  if (LEVEL)								\
-    /* Note - we no longer enable MASK_EP when optimizing.  This is	\
-       because of a hardware bug which stops the SLD and SST instructions\
-       from correctly detecting some hazards.  If the user is sure that \
-       their hardware is fixed or that their program will not encounter \
-       the conditions that trigger the bug then they can enable -mep by \
-       hand.  */							\
-    target_flags |= MASK_PROLOG_FUNCTION;				\
-}
-
 
 /* Target machine storage layout */
 
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/xtensa/xtensa.c gcc-mainline/gcc/config/xtensa/xtensa.c
--- gcc-mainline-0override/gcc/config/xtensa/xtensa.c	2010-09-13 16:33:09.000000000 -0700
+++ gcc-mainline/gcc/config/xtensa/xtensa.c	2010-09-14 17:13:43.000000000 -0700
@@ -119,6 +119,7 @@ const enum reg_class xtensa_regno_to_cla
 };
 
 static void xtensa_option_override (void);
+static void xtensa_option_optimization (int, int);
 static enum internal_test map_test_to_internal_test (enum rtx_code);
 static rtx gen_int_relational (enum rtx_code, rtx, rtx, int *);
 static rtx gen_float_relational (enum rtx_code, rtx, rtx);
@@ -254,6 +255,8 @@ static const int reg_nonleaf_alloc_order
 
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE xtensa_option_override
+#undef TARGET_OPTION_OPTIMIZATION
+#define TARGET_OPTION_OPTIMIZATION xtensa_option_optimization
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -2168,6 +2171,19 @@ xtensa_option_override (void)
     }
 }
 
+/* Implement TARGET_OPTION_OPTIMIZATION.  */
+
+static void
+xtensa_option_optimization (int level ATTRIBUTE_UNUSED,
+			    int size ATTRIBUTE_UNUSED)
+{
+  /* Reordering blocks for Xtensa is not a good idea unless the
+     compiler understands the range of conditional branches.
+     Currently all branch relaxation for Xtensa is handled in the
+     assembler, so GCC cannot do a good job of reordering blocks.  Do
+     not enable reordering unless it is explicitly requested.  */
+  flag_reorder_blocks = 0;
+}
 
 /* A C compound statement to output to stdio stream STREAM the
    assembler syntax for an instruction operand X.  X is an RTL
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/config/xtensa/xtensa.h gcc-mainline/gcc/config/xtensa/xtensa.h
--- gcc-mainline-0override/gcc/config/xtensa/xtensa.h	2010-09-13 16:32:03.000000000 -0700
+++ gcc-mainline/gcc/config/xtensa/xtensa.h	2010-09-14 17:12:02.000000000 -0700
@@ -74,18 +74,6 @@ extern unsigned xtensa_current_frame_siz
 #define HAVE_AS_TLS 0
 #endif
 
-/* Reordering blocks for Xtensa is not a good idea unless the compiler
-   understands the range of conditional branches.  Currently all branch
-   relaxation for Xtensa is handled in the assembler, so GCC cannot do a
-   good job of reordering blocks.  Do not enable reordering unless it is
-   explicitly requested.  */
-#define OPTIMIZATION_OPTIONS(LEVEL, SIZE)				\
-  do									\
-    {									\
-      flag_reorder_blocks = 0;						\
-    }									\
-  while (0)
-
 
 /* Target CPU builtins.  */
 #define TARGET_CPU_CPP_BUILTINS()					\
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/doc/tm.texi gcc-mainline/gcc/doc/tm.texi
--- gcc-mainline-0override/gcc/doc/tm.texi	2010-09-13 08:02:37.000000000 -0700
+++ gcc-mainline/gcc/doc/tm.texi	2010-09-14 12:24:00.000000000 -0700
@@ -791,9 +791,9 @@ used to alter option flag variables whic
 frontends.
 @end defmac
 
-@defmac OPTIMIZATION_OPTIONS (@var{level}, @var{size})
+@deftypefn {Target Hook} void TARGET_OPTION_OPTIMIZATION (int @var{level}, int @var{size})
 Some machines may desire to change what optimizations are performed for
-various optimization levels.   This macro, if defined, is executed once
+various optimization levels.   This hook, if defined, is executed once
 just after the optimization level is determined and before the remainder
 of the command options have been parsed.  Values set in this macro are
 used as the default values for the other command line options.
@@ -808,9 +808,9 @@ options are changed via @code{#pragma GC
 @code{optimize} attribute.
 
 @strong{Do not examine @code{write_symbols} in
-this macro!} The debugging options are not supposed to alter the
+this hook!}  The debugging options are not supposed to alter the
 generated code.
-@end defmac
+@end deftypefn
 
 @deftypefn {Target Hook} void TARGET_HELP (void)
 This hook is called in response to the user invoking
@@ -9414,7 +9414,7 @@ Define this macro if GCC should produce 
 in response to the @option{-g} option.  The default behavior for VMS
 is to generate minimal debug info for a traceback in the absence of
 @option{-g} unless explicitly overridden with @option{-g0}.  This
-behavior is controlled by @code{OPTIMIZATION_OPTIONS} and
+behavior is controlled by @code{TARGET_OPTION_OPTIMIZATION} and
 @code{TARGET_OPTION_OVERRIDE}.
 @end defmac
 
@@ -9762,7 +9762,7 @@ a particular target machine.  You can ov
 once just after all the command options have been parsed.
 
 Don't use this hook to turn on various extra optimizations for
-@option{-O}.  That is what @code{OPTIMIZATION_OPTIONS} is for.
+@option{-O}.  That is what @code{TARGET_OPTION_OPTIMIZATION} is for.
 
 If you need to do something whenever the optimization level is
 changed via the optimize attribute or pragma, see
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/doc/tm.texi.in gcc-mainline/gcc/doc/tm.texi.in
--- gcc-mainline-0override/gcc/doc/tm.texi.in	2010-09-13 08:02:28.000000000 -0700
+++ gcc-mainline/gcc/doc/tm.texi.in	2010-09-14 12:23:54.000000000 -0700
@@ -791,9 +791,9 @@ used to alter option flag variables whic
 frontends.
 @end defmac
 
-@defmac OPTIMIZATION_OPTIONS (@var{level}, @var{size})
+@hook TARGET_OPTION_OPTIMIZATION
 Some machines may desire to change what optimizations are performed for
-various optimization levels.   This macro, if defined, is executed once
+various optimization levels.   This hook, if defined, is executed once
 just after the optimization level is determined and before the remainder
 of the command options have been parsed.  Values set in this macro are
 used as the default values for the other command line options.
@@ -808,9 +808,9 @@ options are changed via @code{#pragma GC
 @code{optimize} attribute.
 
 @strong{Do not examine @code{write_symbols} in
-this macro!} The debugging options are not supposed to alter the
+this hook!}  The debugging options are not supposed to alter the
 generated code.
-@end defmac
+@end deftypefn
 
 @hook TARGET_HELP
 This hook is called in response to the user invoking
@@ -9398,7 +9398,7 @@ Define this macro if GCC should produce 
 in response to the @option{-g} option.  The default behavior for VMS
 is to generate minimal debug info for a traceback in the absence of
 @option{-g} unless explicitly overridden with @option{-g0}.  This
-behavior is controlled by @code{OPTIMIZATION_OPTIONS} and
+behavior is controlled by @code{TARGET_OPTION_OPTIMIZATION} and
 @code{TARGET_OPTION_OVERRIDE}.
 @end defmac
 
@@ -9744,7 +9744,7 @@ a particular target machine.  You can ov
 once just after all the command options have been parsed.
 
 Don't use this hook to turn on various extra optimizations for
-@option{-O}.  That is what @code{OPTIMIZATION_OPTIONS} is for.
+@option{-O}.  That is what @code{TARGET_OPTION_OPTIMIZATION} is for.
 
 If you need to do something whenever the optimization level is
 changed via the optimize attribute or pragma, see
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/hooks.c gcc-mainline/gcc/hooks.c
--- gcc-mainline-0override/gcc/hooks.c	2010-09-13 03:40:43.000000000 -0700
+++ gcc-mainline/gcc/hooks.c	2010-09-14 12:04:21.000000000 -0700
@@ -181,6 +181,11 @@ hook_void_tree_treeptr (tree a ATTRIBUTE
 {
 }
 
+void
+hook_void_int_int (int a ATTRIBUTE_UNUSED, int b ATTRIBUTE_UNUSED)
+{
+}
+
 bool
 hook_bool_tree_false (tree a ATTRIBUTE_UNUSED)
 {
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/hooks.h gcc-mainline/gcc/hooks.h
--- gcc-mainline-0override/gcc/hooks.h	2010-09-13 03:40:43.000000000 -0700
+++ gcc-mainline/gcc/hooks.h	2010-09-14 12:03:45.000000000 -0700
@@ -60,6 +60,7 @@ extern void hook_void_rtx_int (rtx, int)
 extern void hook_void_FILEptr_constcharptr (FILE *, const char *);
 extern void hook_void_tree (tree);
 extern void hook_void_tree_treeptr (tree, tree *);
+extern void hook_void_int_int (int, int);
 
 extern int hook_int_const_tree_0 (const_tree);
 extern int hook_int_const_tree_const_tree_1 (const_tree, const_tree);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/opts.c gcc-mainline/gcc/opts.c
--- gcc-mainline-0override/gcc/opts.c	2010-09-13 03:40:01.000000000 -0700
+++ gcc-mainline/gcc/opts.c	2010-09-14 12:06:22.000000000 -0700
@@ -37,7 +37,6 @@ along with GCC; see the file COPYING3.  
 #include "params.h"
 #include "diagnostic.h"
 #include "opts-diagnostic.h"
-#include "tm_p.h"		/* For OPTIMIZATION_OPTIONS.  */
 #include "insn-attr.h"		/* For INSN_SCHEDULING.  */
 #include "target.h"
 #include "tree-pass.h"
@@ -888,8 +887,9 @@ decode_options (unsigned int argc, const
 	 set after target options have been processed.  */
       flag_short_enums = 2;
 
-      /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
-	 modify it.  */
+      /* Initialize target_flags before
+	 targetm.target_option.optimization so the latter can modify
+	 it.  */
       target_flags = targetm.default_target_flags;
 
       /* Some targets have ABI-specified unwind tables.  */
@@ -901,10 +901,8 @@ decode_options (unsigned int argc, const
   lto_clear_user_options ();
 #endif
 
-#ifdef OPTIMIZATION_OPTIONS
   /* Allow default optimizations to be specified on a per-machine basis.  */
-  OPTIMIZATION_OPTIONS (optimize, optimize_size);
-#endif
+  targetm.target_option.optimization (optimize, optimize_size);
 
   read_cmdline_options (*decoded_options, *decoded_options_count, lang_mask,
 			&handlers);
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/system.h gcc-mainline/gcc/system.h
--- gcc-mainline-0override/gcc/system.h	2010-09-13 08:08:34.000000000 -0700
+++ gcc-mainline/gcc/system.h	2010-09-14 12:09:11.000000000 -0700
@@ -715,7 +715,7 @@ extern void fancy_abort (const char *, i
 	ALLOCATE_INITIAL_VALUE LEGITIMIZE_ADDRESS FRAME_POINTER_REQUIRED \
 	CAN_ELIMINATE TRAMPOLINE_TEMPLATE INITIALIZE_TRAMPOLINE		\
 	TRAMPOLINE_ADJUST_ADDRESS STATIC_CHAIN STATIC_CHAIN_INCOMING	\
-	RETURN_POPS_ARGS OVERRIDE_OPTIONS
+	RETURN_POPS_ARGS OVERRIDE_OPTIONS OPTIMIZATION_OPTIONS
 
 /* Other obsolete target macros, or macros that used to be in target
    headers and were not used, and may be obsolete or may never have
diff -rupN --exclude=.svn gcc-mainline-0override/gcc/target.def gcc-mainline/gcc/target.def
--- gcc-mainline-0override/gcc/target.def	2010-09-13 08:04:45.000000000 -0700
+++ gcc-mainline/gcc/target.def	2010-09-14 12:03:13.000000000 -0700
@@ -2305,6 +2305,13 @@ DEFHOOK
  void, (void),
  hook_void_void)
 
+/* Set default optimizations for the target.  */
+DEFHOOK
+(optimization,
+ "",
+ void, (int level, int size),
+ hook_void_int_int)
+
 /* Function to determine if one function can inline another function.  */
 #undef HOOK_PREFIX
 #define HOOK_PREFIX "TARGET_"

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]