diff options
Diffstat (limited to 'gcc')
58 files changed, 351 insertions, 281 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2194182..1f4770c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,102 @@ 2010-09-16 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. + +2010-09-16 Joseph Myers <joseph@codesourcery.com> + * doc/tm.texi.in (OVERRIDE_OPTIONS): Remove documentation. (C_COMMON_OVERRIDE_OPTIONS): Don't refer to OVERRIDE_OPTIONS. * doc/tm.texi: Regenerate. diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 1f95485..59e1c502 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -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 --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index acbaee6..206e06c 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -216,6 +216,7 @@ static tree arm_build_builtin_va_list (void); static void arm_expand_builtin_va_start (tree, rtx); static tree arm_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); static void arm_option_override (void); +static 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); @@ -321,6 +322,8 @@ static const struct attribute_spec arm_attribute_table[] = #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 @@ -22627,8 +22630,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 --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 9e7e504..8727305 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -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 --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index 6e04212..52367c2 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -130,6 +130,7 @@ static int cris_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode, 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_VERSION; #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 char *arg ATTRIBUTE_UNUSED, 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 --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index b767b23..d302c9f 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -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 --git a/gcc/config/crx/crx.c b/gcc/config/crx/crx.c index e8b750c..8ae552f 100644 --- a/gcc/config/crx/crx.c +++ b/gcc/config/crx/crx.c @@ -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_tree type, const_tree fntype ATTRIBUTE_U 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_attribute_table[] = { {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 --git a/gcc/config/crx/crx.h b/gcc/config/crx/crx.h index a6260f4..d4bf274 100644 --- a/gcc/config/crx/crx.h +++ b/gcc/config/crx/crx.h @@ -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 --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h index f2081fa..68c2a57 100644 --- a/gcc/config/frv/frv-protos.h +++ b/gcc/config/frv/frv-protos.h @@ -38,7 +38,6 @@ extern frv_cpu_t frv_cpu_type; /* value of -mcpu= */ /* 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 --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index 295610d..0730e32d 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -265,6 +265,7 @@ frv_cpu_t frv_cpu_type = CPU_TYPE; /* value of -mcpu= */ 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 (reg_class_t); #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. +/* Implement TARGET_OPTION_OPTIMIZATION. - 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. */ - -/* 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 --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h index 22200dc..463f6ad 100644 --- a/gcc/config/frv/frv.h +++ b/gcc/config/frv/frv.h @@ -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 --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 1400782..551e354 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -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 fndecl, rtx cxt) #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 --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 79469a0..7d7437f 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -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 --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index e35a15e..6f1d6f2 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -20,7 +20,6 @@ along with GCC; see the file COPYING3. If not see <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 --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index fd731c0..61c73c0 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4516,8 +4516,8 @@ x86_output_aligned_bss (FILE *file, tree decl ATTRIBUTE_UNUSED, 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. */ @@ -32504,6 +32504,8 @@ ix86_units_per_simd_word (enum machine_mode mode) #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 --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 8a9600c..22dd02b 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -506,10 +506,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 --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h index 4fc6a42..8a3ff4b 100644 --- a/gcc/config/ia64/ia64-protos.h +++ b/gcc/config/ia64/ia64-protos.h @@ -99,7 +99,6 @@ extern void ia64_hpux_handle_builtin_pragma (struct cpp_reader *); 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 --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index ab01a55..d02d2b8 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -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_attribute_table[] = #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_UNUSED, const_tree type1, const_tree ty } /* 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 --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 13aa2cd..dbb5ebd 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -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 --git a/gcc/config/ia64/vms.h b/gcc/config/ia64/vms.h index 3d678ce..e077e7d 100644 --- a/gcc/config/ia64/vms.h +++ b/gcc/config/ia64/vms.h @@ -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 --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 93030ad..7b8b8fc 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -64,6 +64,7 @@ enum m32r_sdata m32r_sdata = M32R_SDATA_DEFAULT; /* 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_attribute_table[] = #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 --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index ee867bf..c232a74 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -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 --git a/gcc/config/m68hc11/m68hc11-protos.h b/gcc/config/m68hc11/m68hc11-protos.h index a0c4941..e98c190 100644 --- a/gcc/config/m68hc11/m68hc11-protos.h +++ b/gcc/config/m68hc11/m68hc11-protos.h @@ -20,7 +20,6 @@ along with GCC; see the file COPYING3. If not see <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 --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 5556d7d..b81a8b9 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -150,6 +150,7 @@ static int mcore_arg_partial_bytes (CUMULATIVE_ARGS *, 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_attribute_table[] = #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 --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h index d703baf..5044811 100644 --- a/gcc/config/mcore/mcore.h +++ b/gcc/config/mcore/mcore.h @@ -85,31 +85,6 @@ extern char * mcore_current_function_name; /* 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 --git a/gcc/config/mep/mep-protos.h b/gcc/config/mep/mep-protos.h index d3e21bd..4ab86b5 100644 --- a/gcc/config/mep/mep-protos.h +++ b/gcc/config/mep/mep-protos.h @@ -20,7 +20,6 @@ along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ extern void mep_conditional_register_usage (void); -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 --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c index 0e6ce08..712abbe 100644 --- a/gcc/config/mep/mep.c +++ b/gcc/config/mep/mep.c @@ -291,8 +291,8 @@ mep_conditional_register_usage (void) 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. */ @@ -7411,6 +7411,8 @@ mep_asm_init_sections (void) #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 diff --git a/gcc/config/mep/mep.h b/gcc/config/mep/mep.h index 83a5582..1bebf3b 100644 --- a/gcc/config/mep/mep.h +++ b/gcc/config/mep/mep.h @@ -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 --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index ce10a1b..293a2f5 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -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, tree, rtx); #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 --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index 5672827..5908a75 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -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 --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index 5629718..2812e95 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -145,6 +145,7 @@ decode_pdp11_d (const struct real_format *fmt ATTRIBUTE_UNUSED, /* 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, tree, 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 char *arg ATTRIBUTE_UNUSED, } } +/* 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 --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h index 4ebd887..332e99d 100644 --- a/gcc/config/pdp11/pdp11.h +++ b/gcc/config/pdp11/pdp11.h @@ -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 --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index 38dc693..c188994 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -153,7 +153,6 @@ extern enum direction function_arg_padding (enum machine_mode, const_tree); #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 --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 0d95b39..4b87439 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1135,6 +1135,7 @@ static rtx altivec_expand_vec_set_builtin (tree); 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 *); @@ -1596,6 +1597,9 @@ static const struct attribute_spec rs6000_attribute_table[] = #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 @@ -3634,8 +3638,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 --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 1c2c391..b12ed81 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -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 --git a/gcc/config/rx/rx-protos.h b/gcc/config/rx/rx-protos.h index 3adce24..18bc64b 100644 --- a/gcc/config/rx/rx-protos.h +++ b/gcc/config/rx/rx-protos.h @@ -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 --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c index a5be690..2299273 100644 --- a/gcc/config/rx/rx.c +++ b/gcc/config/rx/rx.c @@ -2162,8 +2162,10 @@ rx_handle_option (size_t code, const char * arg ATTRIBUTE_UNUSED, int value) 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 mode, enum reg_class regclass, bool in) #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 --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h index 5e5167e..140d6d4 100644 --- a/gcc/config/rx/rx.h +++ b/gcc/config/rx/rx.h @@ -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 --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h index d3e5ec7..e3cc59c 100644 --- a/gcc/config/s390/s390-protos.h +++ b/gcc/config/s390/s390-protos.h @@ -34,7 +34,6 @@ extern bool s390_check_symref_alignment (rtx addr, HOST_WIDE_INT 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 --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index e07b1d6..11e9fe2 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -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 nunroll, struct loop *loop) #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 --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 8f5a3a0..fcc63b0 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -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 --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h index f6741ee..5a2fd2e 100644 --- a/gcc/config/sh/sh-protos.h +++ b/gcc/config/sh/sh-protos.h @@ -124,7 +124,6 @@ extern rtx sh_gen_truncate (enum machine_mode, rtx, int); 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 --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index d521437..1e8b141 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -183,6 +183,7 @@ static int noncall_uses_reg (rtx, rtx, rtx *); 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_attribute_table[] = #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 char *arg ATTRIBUTE_UNUSED, } /* 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 --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 7bcf9e9..2e9ee76 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -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 --git a/gcc/config/spu/spu-protos.h b/gcc/config/spu/spu-protos.h index d456979..f0ecd93 100644 --- a/gcc/config/spu/spu-protos.h +++ b/gcc/config/spu/spu-protos.h @@ -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 --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index dd4201f..8b462ec 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -150,6 +150,7 @@ char regs_ever_allocated[FIRST_PSEUDO_REGISTER]; /* 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_attribute_table[] = #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 --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h index 251e239..878cb63 100644 --- a/gcc/config/spu/spu.h +++ b/gcc/config/spu/spu.h @@ -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 --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 8f8cd14..49b8e75 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -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_attribute_table[] = #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 char *arg, int value ATTRIBUTE_UNUSED) } } +/* 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 --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 1fb87f3..9ae0784 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -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_memory[(int)SMALL_MEMORY_max]; /* 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 --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 0820ab7..7b261e3 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -119,6 +119,7 @@ const enum reg_class xtensa_regno_to_class[FIRST_PSEUDO_REGISTER] = }; 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[FIRST_PSEUDO_REGISTER] = #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 --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 4a213d0..1bc2fde 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -74,18 +74,6 @@ extern unsigned xtensa_current_frame_size; #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 --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 54f2d35..a5356eb 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -791,9 +791,9 @@ used to alter option flag variables which only exist in those 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 GCC optimize} or by using the @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 debugging output for VMS 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 override the hook 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 --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 3f64388..2fcd979 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -791,9 +791,9 @@ used to alter option flag variables which only exist in those 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 GCC optimize} or by using the @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 debugging output for VMS 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 override the hook 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 --git a/gcc/hooks.c b/gcc/hooks.c index 4d5be73..9969bce 100644 --- a/gcc/hooks.c +++ b/gcc/hooks.c @@ -181,6 +181,11 @@ hook_void_tree_treeptr (tree a ATTRIBUTE_UNUSED, tree *b ATTRIBUTE_UNUSED) { } +void +hook_void_int_int (int a ATTRIBUTE_UNUSED, int b ATTRIBUTE_UNUSED) +{ +} + bool hook_bool_tree_false (tree a ATTRIBUTE_UNUSED) { diff --git a/gcc/hooks.h b/gcc/hooks.h index 9e4a0ae..de18b86 100644 --- a/gcc/hooks.h +++ b/gcc/hooks.h @@ -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); @@ -37,7 +37,6 @@ along with GCC; see the file COPYING3. If not see #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 char **argv, 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 char **argv, 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 --git a/gcc/system.h b/gcc/system.h index 460b8a8..8928ce6 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -715,7 +715,8 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; 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 UNITS_PER_SIMD_WORD OVERRIDE_OPTIONS + RETURN_POPS_ARGS UNITS_PER_SIMD_WORD 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 --git a/gcc/target.def b/gcc/target.def index 61aae90..35c9799 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -2313,6 +2313,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_" |