diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-22 12:14:45 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-22 12:14:45 +0000 |
commit | c17f64ccf22e11f747dec2fb47d1176c80398942 (patch) | |
tree | 1f0b71dcd99544ab6999d99dbfef93415004de5f | |
parent | 80ec5af58fae7a812aafc8b55a97c531c6ff9864 (diff) | |
download | gcc-c17f64ccf22e11f747dec2fb47d1176c80398942.tar.gz |
* target.h (enum opt_levels, struct default_options): New.
* target.def (handle_ofast): Remove hook.
(target_option.optimization): Change to
target_option.optimization_table.
* doc/tm.texi.in (TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
(CAN_DEBUG_WITHOUT_FP): Remove.
* doc/tm.texi: Regenerate.
* opts.c (maybe_default_option, maybe_default_options,
default_options_table): New.
(default_options_optimization): Take extra parameters. Don't
assert that global_options and global_options_set are in use. Use
maybe_default_options.
(decode_options): Pass extra parameters to
default_options_optimization.
* common.opt (falign-loops): Use value 0 with Var.
(frerun-cse-after-loop, ftree-ter): Remove Init.
* system.h (CAN_DEBUG_WITHOUT_FP, TARGET_HANDLE_OFAST,
TARGET_OPTION_OPTIMIZATION): Remove.
* targhooks.c (empty_optimization_table): New.
* targhooks.h (empty_optimization_table): Declare.
* toplev.c (process_options): Don't set flag_rerun_cse_after_loop.
* config/alpha/alpha.c (alpha_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/alpha/alpha.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/arm/arm.c (arm_option_optimization: Change to
arm_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/arm/arm.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/avr/avr.c (avr_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/avr/avr.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/cris/cris.c (cris_option_optimization): Change to
cris_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/crx/crx.c (crx_option_optimization): Change to
crx_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/crx/crx.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/fr30/fr30.c (fr30_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/fr30/fr30.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/frv/frv.c (frv_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/frv/frv.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/h8300/h8300.c (h8300_option_optimization): Change to
h8300_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/h8300/h8300.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/i386/i386.c (ix86_option_optimization): Change to
ix86_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/i386/sol2-10.h (SUBTARGET_OPTIMIZATION_OPTIONS): Define
as initializer.
* config/ia64/ia64.c (ia64_option_optimization): Change to
ia64_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/ia64/ia64.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/ia64/vms.h (SUBTARGET_OPTIMIZATION_OPTIONS): Define as
initializer.
* config/iq2000/iq2000.c (iq2000_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/iq2000/iq2000.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/lm32/lm32.c (lm32_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/lm32/lm32.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/m32r/m32r.c (m32r_option_optimization): Change to
m32r_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/m32r/m32r.h (SUBTARGET_OPTIMIZATION_OPTIONS,
CAN_DEBUG_WITHOUT_FP): Remove.
* config/mcore/mcore.c (mcore_option_optimization): Change to
mcore_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/mep/mep.c (mep_option_optimization): Change to
mep_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/mep/mep.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/microblaze/microblaze.c
(microblaze_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/microblaze/microblaze.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/mips/mips.c (mips_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/mips/mips.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/mmix/mmix.c (mmix_option_optimization): Change to
mmix_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/mmix/mmix.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/mn10300/mn10300.c (mn10300_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/mn10300/mn10300.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/pa/pa.c (pa_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/pa/pa.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/pdp11/pdp11.c (pdp11_option_optimization): Change to
pdp11_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/picochip/picochip.c (picochip_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/picochip/picochip.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/rs6000/rs6000.c (rs6000_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/rs6000/rs6000.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/rx/rx.c (rx_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/rx/rx.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/s390/s390.c (s390_option_optimization): Change to
s390_option_optimization_table.
(s390_option_override): Update comment.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/s390/s390.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/score/score.c (score_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/score/score.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/sh/sh.c (sh_option_optimization): Change to
sh_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
(sh_option_override): Set MASK_SAVE_ALL_TARGET_REGS here.
(sh_option_override, expand_block_move, multcosts, find_barrier,
barrier_align): Use optimize_size instead of TARGET_SMALLCODE.
* config/sh/sh.h (CAN_DEBUG_WITHOUT_FP): Remove.
(LOOP_ALIGN, TRAMPOLINE_ALIGNMENT, MOVE_BY_PIECES_P,
STORE_BY_PIECES_P, SH_DYNAMIC_SHIFT_COST): Use optimize_size
instead of TARGET_SMALLCODE.
* config/sh/sh.opt (mspace): Make into an alias for -Os.
* config/sparc/sparc.c (sparc_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/sparc/sparc.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/stormy16/stormy16.c (xstorym16_option_optimization_table,
TARGET_OPTION_OPTIMIZATION_TABLE): New.
* config/stormy16/stormy16.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/v850/v850.c (v850_option_optimization): Change to
v850_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/v850/v850.h (CAN_DEBUG_WITHOUT_FP): Remove.
* config/xtensa/xtensa.c (xtensa_option_optimization): Change to
xtensa_option_optimization_table.
(TARGET_OPTION_OPTIMIZATION): Change to
TARGET_OPTION_OPTIMIZATION_TABLE.
* config/xtensa/xtensa.h (CAN_DEBUG_WITHOUT_FP): Remove.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165823 138bc75d-0d04-0410-961f-82ee72b054a4
72 files changed, 806 insertions, 539 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1fa0b1b77d3..32dc3d3c1d8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,161 @@ +2010-10-22 Joseph Myers <joseph@codesourcery.com> + + * target.h (enum opt_levels, struct default_options): New. + * target.def (handle_ofast): Remove hook. + (target_option.optimization): Change to + target_option.optimization_table. + * doc/tm.texi.in (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + (CAN_DEBUG_WITHOUT_FP): Remove. + * doc/tm.texi: Regenerate. + * opts.c (maybe_default_option, maybe_default_options, + default_options_table): New. + (default_options_optimization): Take extra parameters. Don't + assert that global_options and global_options_set are in use. Use + maybe_default_options. + (decode_options): Pass extra parameters to + default_options_optimization. + * common.opt (falign-loops): Use value 0 with Var. + (frerun-cse-after-loop, ftree-ter): Remove Init. + * system.h (CAN_DEBUG_WITHOUT_FP, TARGET_HANDLE_OFAST, + TARGET_OPTION_OPTIMIZATION): Remove. + * targhooks.c (empty_optimization_table): New. + * targhooks.h (empty_optimization_table): Declare. + * toplev.c (process_options): Don't set flag_rerun_cse_after_loop. + * config/alpha/alpha.c (alpha_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/alpha/alpha.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/arm/arm.c (arm_option_optimization: Change to + arm_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/arm/arm.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/avr/avr.c (avr_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/avr/avr.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/cris/cris.c (cris_option_optimization): Change to + cris_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/crx/crx.c (crx_option_optimization): Change to + crx_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/crx/crx.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/fr30/fr30.c (fr30_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/fr30/fr30.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/frv/frv.c (frv_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/frv/frv.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/h8300/h8300.c (h8300_option_optimization): Change to + h8300_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/h8300/h8300.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/i386/i386.c (ix86_option_optimization): Change to + ix86_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/i386/sol2-10.h (SUBTARGET_OPTIMIZATION_OPTIONS): Define + as initializer. + * config/ia64/ia64.c (ia64_option_optimization): Change to + ia64_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/ia64/ia64.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/ia64/vms.h (SUBTARGET_OPTIMIZATION_OPTIONS): Define as + initializer. + * config/iq2000/iq2000.c (iq2000_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/iq2000/iq2000.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/lm32/lm32.c (lm32_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/lm32/lm32.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/m32r/m32r.c (m32r_option_optimization): Change to + m32r_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/m32r/m32r.h (SUBTARGET_OPTIMIZATION_OPTIONS, + CAN_DEBUG_WITHOUT_FP): Remove. + * config/mcore/mcore.c (mcore_option_optimization): Change to + mcore_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/mep/mep.c (mep_option_optimization): Change to + mep_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/mep/mep.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/microblaze/microblaze.c + (microblaze_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/microblaze/microblaze.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/mips/mips.c (mips_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/mips/mips.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/mmix/mmix.c (mmix_option_optimization): Change to + mmix_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/mmix/mmix.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/mn10300/mn10300.c (mn10300_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/mn10300/mn10300.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/pa/pa.c (pa_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/pa/pa.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/pdp11/pdp11.c (pdp11_option_optimization): Change to + pdp11_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/picochip/picochip.c (picochip_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/picochip/picochip.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/rs6000/rs6000.c (rs6000_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/rs6000/rs6000.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/rx/rx.c (rx_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/rx/rx.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/s390/s390.c (s390_option_optimization): Change to + s390_option_optimization_table. + (s390_option_override): Update comment. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/s390/s390.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/score/score.c (score_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/score/score.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/sh/sh.c (sh_option_optimization): Change to + sh_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + (sh_option_override): Set MASK_SAVE_ALL_TARGET_REGS here. + (sh_option_override, expand_block_move, multcosts, find_barrier, + barrier_align): Use optimize_size instead of TARGET_SMALLCODE. + * config/sh/sh.h (CAN_DEBUG_WITHOUT_FP): Remove. + (LOOP_ALIGN, TRAMPOLINE_ALIGNMENT, MOVE_BY_PIECES_P, + STORE_BY_PIECES_P, SH_DYNAMIC_SHIFT_COST): Use optimize_size + instead of TARGET_SMALLCODE. + * config/sh/sh.opt (mspace): Make into an alias for -Os. + * config/sparc/sparc.c (sparc_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/sparc/sparc.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/stormy16/stormy16.c (xstorym16_option_optimization_table, + TARGET_OPTION_OPTIMIZATION_TABLE): New. + * config/stormy16/stormy16.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/v850/v850.c (v850_option_optimization): Change to + v850_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/v850/v850.h (CAN_DEBUG_WITHOUT_FP): Remove. + * config/xtensa/xtensa.c (xtensa_option_optimization): Change to + xtensa_option_optimization_table. + (TARGET_OPTION_OPTIMIZATION): Change to + TARGET_OPTION_OPTIMIZATION_TABLE. + * config/xtensa/xtensa.h (CAN_DEBUG_WITHOUT_FP): Remove. + 2010-10-21 Iain Sandoe <iains@gcc.gnu.org> Based on the CFString implementation in FSF apple/trunk branch. diff --git a/gcc/common.opt b/gcc/common.opt index 8fe796f8020..a74d60da620 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -589,7 +589,7 @@ falign-labels= Common RejectNegative Joined UInteger falign-loops -Common Report Var(align_loops) Optimization UInteger +Common Report Var(align_loops,0) Optimization UInteger Align the start of loops falign-loops= @@ -1318,7 +1318,7 @@ Common Report Var(flag_reorder_functions) Optimization Reorder functions to improve code placement frerun-cse-after-loop -Common Report Var(flag_rerun_cse_after_loop) Init(2) Optimization +Common Report Var(flag_rerun_cse_after_loop) Optimization Add a common subexpression elimination pass after loop optimizations frerun-loop-opt @@ -1681,7 +1681,7 @@ Common Report Var(flag_tree_sra) Optimization Perform scalar replacement of aggregates ftree-ter -Common Report Var(flag_tree_ter) Init(1) Optimization +Common Report Var(flag_tree_ter) Optimization Replace temporary expressions in the SSA->normal pass ftree-lrs diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index e5ca7ca2588..78c54123ab1 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -208,6 +208,13 @@ static void unicosmk_gen_dsib (unsigned long *); static void unicosmk_output_ssib (FILE *, const char *); static int unicosmk_need_dex (rtx); +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options alpha_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + /* Implement TARGET_HANDLE_OPTION. */ static bool @@ -11140,6 +11147,9 @@ alpha_init_libfuncs (void) #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE alpha_option_override +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE alpha_option_optimization_table + #ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING #undef TARGET_MANGLE_TYPE #define TARGET_MANGLE_TYPE alpha_mangle_type diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 66e215a5b36..21db01c8ec5 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for DEC Alpha. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009 + 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) @@ -223,10 +223,6 @@ extern enum alpha_fp_trap_mode alpha_fptm; for (i = 32; i < 63; i++) \ fixed_regs[i] = call_used_regs[i] = 1; \ } - - -/* Show we can debug even without a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP /* target machine storage layout */ diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 4f6bea1c0f6..ea72bebd06f 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -217,7 +217,6 @@ 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); @@ -286,6 +285,15 @@ static const struct attribute_spec arm_attribute_table[] = #endif { NULL, 0, 0, false, false, false, NULL } }; + +/* Set default optimization options. */ +static const struct default_options arm_option_optimization_table[] = + { + /* Enable section anchors by default at -O1 or higher. */ + { OPT_LEVELS_1_PLUS, OPT_fsection_anchors, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Initialize the GCC target structure. */ #if TARGET_DLLIMPORT_DECL_ATTRIBUTES @@ -333,8 +341,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_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE arm_option_optimization_table #undef TARGET_COMP_TYPE_ATTRIBUTES #define TARGET_COMP_TYPE_ATTRIBUTES arm_comp_type_attributes @@ -22819,15 +22827,6 @@ arm_order_regs_for_local_alloc (void) sizeof (thumb_core_reg_alloc_order)); } -/* Set default optimization options. */ -static void -arm_option_optimization (int level, int size ATTRIBUTE_UNUSED) -{ - /* Enable section anchors by default at -O1 or higher. */ - if (level > 0) - flag_section_anchors = 1; -} - /* Implement TARGET_FRAME_POINTER_REQUIRED. */ bool diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 1aa6e9b2cff..4b6717f2c3b 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -494,10 +494,6 @@ extern int arm_arch_hwdiv; #define TARGET_DEFAULT (MASK_APCS_FRAME) #endif -/* The frame pointer register used in gcc has nothing to do with debugging; - that is controlled by the APCS-FRAME option. */ -#define CAN_DEBUG_WITHOUT_FP - /* 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/avr/avr.c b/gcc/config/avr/avr.c index c55e43281ea..7016d483501 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -133,6 +133,13 @@ static const struct attribute_spec avr_attribute_table[] = { "OS_main", 0, 0, false, true, true, avr_handle_fntype_attribute }, { NULL, 0, 0, false, false, false, NULL } }; + +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options avr_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -208,6 +215,9 @@ static const struct attribute_spec avr_attribute_table[] = #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE avr_option_override +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE avr_option_optimization_table + struct gcc_target targetm = TARGET_INITIALIZER; static void diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index b0578d48947..9ad914e4e68 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -124,8 +124,6 @@ extern GTY(()) section *progmem_section; #define TARGET_VERSION fprintf (stderr, " (GNU assembler syntax)"); -#define CAN_DEBUG_WITHOUT_FP - #define BITS_BIG_ENDIAN 0 #define BYTES_BIG_ENDIAN 0 #define WORDS_BIG_ENDIAN 0 diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index 3163022b661..11e307138e4 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -132,7 +132,6 @@ 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); @@ -150,6 +149,14 @@ int cris_max_stackframe = 0; /* This is the parsed result of the "-march=" option, if given. */ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION; +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ + +static const struct default_options cris_option_optimization_table[] = + { + { OPT_LEVELS_2_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + #undef TARGET_ASM_ALIGNED_HI_OP #define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" #undef TARGET_ASM_ALIGNED_SI_OP @@ -218,8 +225,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_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE cris_option_optimization_table #undef TARGET_ASM_TRAMPOLINE_TEMPLATE #define TARGET_ASM_TRAMPOLINE_TEMPLATE cris_asm_trampoline_template @@ -2422,15 +2429,6 @@ 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/crx/crx.c b/gcc/config/crx/crx.c index 8ae552fe5db..3dd642d9025 100644 --- a/gcc/config/crx/crx.c +++ b/gcc/config/crx/crx.c @@ -130,7 +130,6 @@ 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 */ @@ -177,8 +176,17 @@ static const struct attribute_spec crx_attribute_table[] = { /* Option handling. */ -#undef TARGET_OPTION_OPTIMIZATION -#define TARGET_OPTION_OPTIMIZATION crx_option_optimization +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE crx_option_optimization_table + +static const struct default_options crx_option_optimization_table[] = + { + /* Put each function in its own section so that PAGE-instruction + relaxation can do its best. */ + { OPT_LEVELS_1_PLUS, OPT_ffunction_sections, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Initialize 'targetm' variable which contains pointers to functions and data * relating to the target machine. */ @@ -1447,13 +1455,3 @@ 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 b12c4283f46..6982eb2cdc4 100644 --- a/gcc/config/crx/crx.h +++ b/gcc/config/crx/crx.h @@ -54,9 +54,6 @@ do { \ #define TARGET_VERSION fputs (" (CRX/ELF)", stderr); -/* Show we can debug even without a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP - /*****************************************************************************/ /* STORAGE LAYOUT */ /*****************************************************************************/ diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c index 4700195f281..04e90f23fc2 100644 --- a/gcc/config/fr30/fr30.c +++ b/gcc/config/fr30/fr30.c @@ -1,6 +1,6 @@ /* FR30 specific functions. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009 - Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009, + 2010 Free Software Foundation, Inc. Contributed by Cygnus Solutions. This file is part of GCC. @@ -142,6 +142,13 @@ static void fr30_trampoline_init (rtx, tree, rtx); #if UNITS_PER_WORD == 4 #define WORD_ALIGN(SIZE) (((SIZE) + 3) & ~3) #endif + +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options fr30_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -175,6 +182,9 @@ static void fr30_trampoline_init (rtx, tree, rtx); #undef TARGET_EXCEPT_UNWIND_INFO #define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE fr30_option_optimization_table + struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/fr30/fr30.h b/gcc/config/fr30/fr30.h index 93e4e8dbbec..c5c405c159f 100644 --- a/gcc/config/fr30/fr30.h +++ b/gcc/config/fr30/fr30.h @@ -1,7 +1,7 @@ /*{{{ Comment. */ /* Definitions of FR30 target. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2007, 2008, 2009 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Cygnus Solutions. @@ -50,8 +50,6 @@ along with GCC; see the file COPYING3. If not see #define TARGET_VERSION fprintf (stderr, " (fr30)"); -#define CAN_DEBUG_WITHOUT_FP - #undef STARTFILE_SPEC #define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s" diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index 728c4d218fd..4cbcfcac8a1 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -397,6 +397,13 @@ static bool frv_frame_pointer_required (void); static bool frv_can_eliminate (const int, const int); static void frv_trampoline_init (rtx, tree, rtx); static bool frv_class_likely_spilled_p (reg_class_t); + +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options frv_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Allow us to easily change the default for -malloc-cc. */ #ifndef DEFAULT_NO_ALLOC_CC @@ -431,6 +438,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_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE frv_option_optimization_table #undef TARGET_INIT_BUILTINS #define TARGET_INIT_BUILTINS frv_init_builtins #undef TARGET_EXPAND_BUILTIN diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h index 9ce01f9dc62..99e66434a89 100644 --- a/gcc/config/frv/frv.h +++ b/gcc/config/frv/frv.h @@ -328,13 +328,6 @@ #endif */ #define TARGET_VERSION fprintf (stderr, _(" (frv)")) -/* 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. */ -/* Frv needs a specific frame layout that includes the frame pointer. */ - -#define CAN_DEBUG_WITHOUT_FP - #define LABEL_ALIGN_AFTER_BARRIER(LABEL) (TARGET_ALIGN_LABELS ? 3 : 0) /* Small Data Area Support. */ diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 551e354b849..b9bc95caccf 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -303,17 +303,16 @@ enum h8_cpu H8_S }; -/* Implement TARGET_OPTION_OPTIMIZATION. */ +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ -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; -} +static const struct default_options h8300_option_optimization_table[] = + { + /* Basic block reordering is only beneficial on targets with cache + and/or variable-cycle branches where (cycle count taken != + cycle count not taken). */ + { OPT_LEVELS_ALL, OPT_freorder_blocks, NULL, 0 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Initialize various cpu specific globals at start up. */ @@ -5937,7 +5936,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 +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE h8300_option_optimization_table struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 12fbe63f95c..593106b960d 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -125,9 +125,6 @@ extern const char * const *h8_reg_names; #define TARGET_DEFAULT (MASK_QUICKCALL) #endif -/* Show we can debug even without a frame pointer. */ -/* #define CAN_DEBUG_WITHOUT_FP */ - /* We want dwarf2 info available to gdb... */ #define DWARF2_DEBUGGING_INFO 1 /* ... but we don't actually support full dwarf2 EH. */ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index e07283eb39a..199550d2672 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4529,20 +4529,19 @@ x86_output_aligned_bss (FILE *file, tree decl ATTRIBUTE_UNUSED, ASM_OUTPUT_SKIP (file, size ? size : 1); } -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. */ +static const struct default_options ix86_option_optimization_table[] = + { + /* Turn off -fschedule-insns by default. It tends to make the + problem with not enough registers even worse. */ #ifdef INSN_SCHEDULING - if (level > 1) - flag_schedule_insns = 0; + { OPT_LEVELS_ALL, OPT_fschedule_insns, NULL, 0 }, #endif #ifdef SUBTARGET_OPTIMIZATION_OPTIONS - SUBTARGET_OPTIMIZATION_OPTIONS; + SUBTARGET_OPTIMIZATION_OPTIONS, #endif -} + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Implement TARGET_OPTION_INIT_STRUCT. */ @@ -33241,8 +33240,8 @@ ix86_autovectorize_vector_sizes (void) #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE ix86_option_override -#undef TARGET_OPTION_OPTIMIZATION -#define TARGET_OPTION_OPTIMIZATION ix86_option_optimization +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE ix86_option_optimization_table #undef TARGET_OPTION_INIT_STRUCT #define TARGET_OPTION_INIT_STRUCT ix86_option_init_struct diff --git a/gcc/config/i386/sol2-10.h b/gcc/config/i386/sol2-10.h index 04ae700fb07..bd3416c29b2 100644 --- a/gcc/config/i386/sol2-10.h +++ b/gcc/config/i386/sol2-10.h @@ -91,13 +91,8 @@ along with GCC; see the file COPYING3. If not see #define TARGET_SUBTARGET_DEFAULT \ (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS) -#define SUBTARGET_OPTIMIZATION_OPTIONS \ - do \ - { \ - if (optimize >= 1) \ - target_flags |= MASK_OMIT_LEAF_FRAME_POINTER; \ - } \ - while (0) +#define SUBTARGET_OPTIMIZATION_OPTIONS \ + { OPT_LEVELS_1_PLUS, OPT_momit_leaf_frame_pointer, NULL, 1 } #define MULTILIB_DEFAULTS { "m32" } diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 801afa99e07..96031504f3f 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -202,7 +202,6 @@ 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 void ia64_option_default_params (void); static bool ia64_can_eliminate (const int, const int); static enum machine_mode hfa_element_mode (const_tree, bool); @@ -341,6 +340,16 @@ static const struct attribute_spec ia64_attribute_table[] = { NULL, 0, 0, false, false, false, NULL } }; +/* Implement overriding of the optimization options. */ +static const struct default_options ia64_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, +#ifdef SUBTARGET_OPTIMIZATION_OPTIONS + SUBTARGET_OPTIMIZATION_OPTIONS, +#endif + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + /* Initialize the GCC target structure. */ #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE ia64_attribute_table @@ -373,8 +382,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_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE ia64_option_optimization_table #undef TARGET_OPTION_DEFAULT_PARAMS #define TARGET_OPTION_DEFAULT_PARAMS ia64_option_default_params @@ -10835,16 +10844,6 @@ ia64_invalid_binary_op (int op ATTRIBUTE_UNUSED, const_tree type1, const_tree ty return NULL; } -/* Implement overriding of the optimization options. */ -static void -ia64_option_optimization (int level ATTRIBUTE_UNUSED, - int size ATTRIBUTE_UNUSED) -{ -#ifdef SUBTARGET_OPTIMIZATION_OPTIONS - SUBTARGET_OPTIMIZATION_OPTIONS; -#endif -} - /* Implement TARGET_OPTION_DEFAULT_PARAMS. */ static void ia64_option_default_params (void) diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 5ff206dc9b4..b4c3758f996 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -993,9 +993,6 @@ enum reg_class /* Eliminating the Frame Pointer and the Arg Pointer */ -/* Show we can debug even without a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP - /* If defined, this macro specifies a table of register pairs used to eliminate unneeded registers that point into the stack frame. */ diff --git a/gcc/config/ia64/vms.h b/gcc/config/ia64/vms.h index 103cc0e42eb..4ec816166fd 100644 --- a/gcc/config/ia64/vms.h +++ b/gcc/config/ia64/vms.h @@ -184,10 +184,8 @@ typedef struct crtl_name_spec } while (0) #undef SUBTARGET_OPTIMIZATION_OPTIONS -#define SUBTARGET_OPTIMIZATION_OPTIONS \ - do { \ - flag_merge_constants = 0; \ - } while (0) +#define SUBTARGET_OPTIMIZATION_OPTIONS \ + { OPT_LEVELS_ALL, OPT_fmerge_constants, NULL, 0 } /* Define this to be nonzero if static stack checking is supported. */ #define STACK_CHECK_STATIC_BUILTIN 1 diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index dd2c927108f..f6caf6084a1 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -175,6 +175,13 @@ static void iq2000_print_operand (FILE *, rtx, int); static void iq2000_print_operand_address (FILE *, rtx); static bool iq2000_print_operand_punct_valid_p (unsigned char code); +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options iq2000_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + #undef TARGET_INIT_BUILTINS #define TARGET_INIT_BUILTINS iq2000_init_builtins #undef TARGET_EXPAND_BUILTIN @@ -185,6 +192,8 @@ static bool iq2000_print_operand_punct_valid_p (unsigned char code); #define TARGET_HANDLE_OPTION iq2000_handle_option #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE iq2000_option_override +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE iq2000_option_optimization_table #undef TARGET_RTX_COSTS #define TARGET_RTX_COSTS iq2000_rtx_costs #undef TARGET_ADDRESS_COST diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h index 6e670badc58..d07bf31a755 100644 --- a/gcc/config/iq2000/iq2000.h +++ b/gcc/config/iq2000/iq2000.h @@ -68,8 +68,6 @@ #ifndef TARGET_VERSION #define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr) #endif - -#define CAN_DEBUG_WITHOUT_FP /* Storage Layout. */ diff --git a/gcc/config/lm32/lm32.c b/gcc/config/lm32/lm32.c index 671f0e16d27..bcab220613d 100644 --- a/gcc/config/lm32/lm32.c +++ b/gcc/config/lm32/lm32.c @@ -77,8 +77,17 @@ lm32_legitimate_address_p (enum machine_mode mode, rtx x, bool strict); static HOST_WIDE_INT lm32_compute_frame_size (int size); static void lm32_option_override (void); +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options lm32_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE lm32_option_override +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE lm32_option_optimization_table #undef TARGET_ADDRESS_COST #define TARGET_ADDRESS_COST hook_int_rtx_bool_0 #undef TARGET_RTX_COSTS diff --git a/gcc/config/lm32/lm32.h b/gcc/config/lm32/lm32.h index 52b492c656c..6800e0f0200 100644 --- a/gcc/config/lm32/lm32.h +++ b/gcc/config/lm32/lm32.h @@ -536,8 +536,6 @@ do { \ #define DBX_REGISTER_NUMBER(REGNO) (REGNO) -#define CAN_DEBUG_WITHOUT_FP - #define DEFAULT_GDB_EXTENSIONS 1 /*--------*/ diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 903f410a07d..f03df26b571 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -64,7 +64,6 @@ 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); @@ -113,6 +112,13 @@ static const struct attribute_spec m32r_attribute_table[] = { "model", 1, 1, true, false, false, m32r_handle_model_attribute }, { NULL, 0, 0, false, false, false, NULL } }; + +static const struct default_options m32r_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fregmove, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Initialize the GCC target structure. */ #undef TARGET_ATTRIBUTE_TABLE @@ -154,8 +160,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_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE m32r_option_optimization_table #undef TARGET_ENCODE_SECTION_INFO #define TARGET_ENCODE_SECTION_INFO m32r_encode_section_info @@ -278,18 +284,6 @@ 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 9522f571f38..3c0c85d7302 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -305,15 +305,6 @@ extern enum m32r_sdata m32r_sdata; #ifndef SUBTARGET_OVERRIDE_OPTIONS #define SUBTARGET_OVERRIDE_OPTIONS #endif - -#ifndef SUBTARGET_OPTIMIZATION_OPTIONS -#define SUBTARGET_OPTIMIZATION_OPTIONS -#endif - -/* 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. */ -#define CAN_DEBUG_WITHOUT_FP /* Target machine storage layout. */ diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 152c343964b..9bacc5caee0 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -145,7 +145,6 @@ 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. */ @@ -157,6 +156,23 @@ static const struct attribute_spec mcore_attribute_table[] = { "naked", 0, 0, true, false, false, mcore_handle_naked_attribute }, { NULL, 0, 0, false, false, false, NULL } }; + +/* 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 const struct default_options mcore_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_ffunction_cse, NULL, 0 }, + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_ALL, OPT_fcaller_saves, NULL, 0 }, + { OPT_LEVELS_ALL, OPT_fschedule_insns, NULL, 0 }, + { OPT_LEVELS_ALL, OPT_fschedule_insns2, NULL, 0 }, + { OPT_LEVELS_SIZE, OPT_mhardlit, NULL, 0 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Initialize the GCC target structure. */ #undef TARGET_ASM_EXTERNAL_LIBCALL @@ -224,8 +240,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 +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE mcore_option_optimization_table #undef TARGET_EXCEPT_UNWIND_INFO #define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info @@ -2692,33 +2708,6 @@ mcore_option_override (void) 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/mep/mep.c b/gcc/config/mep/mep.c index 3f50070df66..c55624b2eb1 100644 --- a/gcc/config/mep/mep.c +++ b/gcc/config/mep/mep.c @@ -295,16 +295,20 @@ mep_conditional_register_usage (void) global_regs[i] = 1; } -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. */ - flag_schedule_insns = 0; - /* Using $fp doesn't gain us much, even when debugging is important. */ - flag_omit_frame_pointer = 1; -} +static const struct default_options mep_option_optimization_table[] = + { + /* The first scheduling pass often increases register pressure and + tends to result in more spill code. Only run it when + specifically asked. */ + { OPT_LEVELS_ALL, OPT_fschedule_insns, NULL, 0 }, + + /* Using $fp doesn't gain us much, even when debugging is + important. */ + { OPT_LEVELS_ALL, OPT_fomit_frame_pointer, NULL, 1 }, + + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; static void mep_option_override (void) @@ -7426,8 +7430,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_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE mep_option_optimization_table #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 07f0c856af2..b6a64995827 100644 --- a/gcc/config/mep/mep.h +++ b/gcc/config/mep/mep.h @@ -159,8 +159,6 @@ crtbegin.o%s" #define COPROC_SELECTION_TABLE \ {"default", ISA_EXT1} /* end-coproc-selection-table */ - -#define CAN_DEBUG_WITHOUT_FP #define BITS_BIG_ENDIAN 0 diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c index 9975328e1c0..1c1d788dcfd 100644 --- a/gcc/config/microblaze/microblaze.c +++ b/gcc/config/microblaze/microblaze.c @@ -1423,6 +1423,13 @@ microblaze_option_override (void) } } +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options microblaze_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + /* Return true if FUNC is an interrupt function as specified by the "interrupt_handler" attribute. */ @@ -3028,6 +3035,9 @@ microblaze_adjust_cost (rtx insn ATTRIBUTE_UNUSED, rtx link, #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE microblaze_option_override +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE microblaze_option_optimization_table + #undef TARGET_EXCEPT_UNWIND_INFO #define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h index c7bf756034b..0145cb35952 100644 --- a/gcc/config/microblaze/microblaze.h +++ b/gcc/config/microblaze/microblaze.h @@ -61,9 +61,6 @@ extern enum pipeline_type microblaze_pipe; #define SWITCH_TAKES_ARG(CHAR) \ (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') -/* We can debug without having a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP - #define DRIVER_SELF_SPECS \ "%{mxl-soft-mul:%<mno-xl-soft-mul}", \ "%{mno-xl-barrel-shift:%<mxl-barrel-shift}", \ diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index b13d6481cd2..881bb783768 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -15876,6 +15876,13 @@ mips_option_override (void) mips_set_mips16_mode (false); } +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options mips_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + /* Swap the register information for registers I and I + 1, which currently have the wrong endianness. Note that the registers' fixedness and call-clobberedness might have been set on the @@ -16390,6 +16397,8 @@ mips_shift_truncation_mask (enum machine_mode mode) #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE mips_option_override +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE mips_option_optimization_table #undef TARGET_LEGITIMIZE_ADDRESS #define TARGET_LEGITIMIZE_ADDRESS mips_legitimize_address diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 23dba7c7153..1b4747f7b59 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -1082,9 +1082,6 @@ enum mips_code_readable_setting { (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') #define CONDITIONAL_REGISTER_USAGE mips_conditional_register_usage () - -/* Show we can debug even without a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP /* Tell collect what flags to pass to nm. */ #ifndef NM_FLAGS diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 91fa1fba60c..4944a390f24 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -114,7 +114,6 @@ 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); @@ -160,6 +159,15 @@ static bool mmix_frame_pointer_required (void); static void mmix_asm_trampoline_template (FILE *); static void mmix_trampoline_init (rtx, tree, rtx); +/* TARGET_OPTION_OPTIMIZATION_TABLE. */ + +static const struct default_options mmix_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fregmove, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + /* Target structure macros. Listed by node. See `Using and Porting GCC' for a general description. */ @@ -251,8 +259,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 +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE mmix_option_optimization_table struct gcc_target targetm = TARGET_INITIALIZER; @@ -276,18 +284,6 @@ 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 02d05284d33..251c88b938f 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -147,10 +147,6 @@ struct GTY(()) machine_function #define TARGET_VERSION \ fprintf (stderr, " (MMIX)") -/* 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 */ - /* Node: Per-Function Data */ #define INIT_EXPANDERS mmix_init_expanders () diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index a947366b0c9..2187463d083 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -71,6 +71,13 @@ enum processor_type mn10300_processor = PROCESSOR_DEFAULT; || df_regs_ever_live_p (17))) static int mn10300_address_cost (rtx, bool); + +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options mn10300_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Implement TARGET_HANDLE_OPTION. */ @@ -2280,6 +2287,8 @@ mn10300_select_cc_mode (rtx x) #define TARGET_HANDLE_OPTION mn10300_handle_option #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE mn10300_option_override +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE mn10300_option_optimization_table #undef TARGET_ENCODE_SECTION_INFO #define TARGET_ENCODE_SECTION_INFO mn10300_encode_section_info diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h index cf52f5b3d9b..96a07e8fcdf 100644 --- a/gcc/config/mn10300/mn10300.h +++ b/gcc/config/mn10300/mn10300.h @@ -493,10 +493,6 @@ enum reg_class #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ OFFSET = mn10300_initial_offset (FROM, TO) -/* We can debug without frame pointers on the mn10300, so eliminate - them whenever possible. */ -#define CAN_DEBUG_WITHOUT_FP - /* We use d0/d1 for passing parameters, so allocate 8 bytes of space for a register flushback area. */ #define REG_PARM_STACK_SPACE(DECL) 8 diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index a2a822c8713..076d2dec755 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -222,11 +222,20 @@ static GTY((length ("n_deferred_plabels"))) struct deferred_plabel * deferred_plabels; static size_t n_deferred_plabels = 0; +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options pa_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + /* Initialize the GCC target structure. */ #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE pa_option_override +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE pa_option_optimization_table #undef TARGET_ASM_ALIGNED_HI_OP #define TARGET_ASM_ALIGNED_HI_OP "\t.half\t" diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 47fc1366365..46c210ef7fb 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -226,9 +226,6 @@ do { \ #define PTRDIFF_TYPE "int" #define WCHAR_TYPE "unsigned int" #define WCHAR_TYPE_SIZE 32 - -/* Show we can debug even without a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP /* target machine storage layout */ typedef struct GTY(()) machine_function diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index 9fcdcd8b7a0..7bfc9e22e2c 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -145,7 +145,6 @@ 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 void pdp11_option_init_struct (struct gcc_options *); static rtx find_addr_reg (rtx); static const char *singlemove_string (rtx *); @@ -162,6 +161,14 @@ static rtx pdp11_function_arg (CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool); static void pdp11_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool); + +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ + +static const struct default_options pdp11_option_optimization_table[] = + { + { OPT_LEVELS_3_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Initialize the GCC target structure. */ #undef TARGET_ASM_BYTE_OP @@ -188,8 +195,8 @@ static void pdp11_function_arg_advance (CUMULATIVE_ARGS *, (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_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE pdp11_option_optimization_table #undef TARGET_OPTION_INIT_STRUCT #define TARGET_OPTION_INIT_STRUCT pdp11_option_init_struct @@ -233,18 +240,6 @@ 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) -{ - if (level >= 3) - { - flag_omit_frame_pointer = 1; - /* flag_unroll_loops = 1; */ - } -} - /* Implement TARGET_OPTION_INIT_STRUCT. */ static void diff --git a/gcc/config/picochip/picochip.c b/gcc/config/picochip/picochip.c index 37771dbc6e6..f8584f31c04 100644 --- a/gcc/config/picochip/picochip.c +++ b/gcc/config/picochip/picochip.c @@ -198,6 +198,13 @@ static struct recog_data picochip_saved_recog_data; /* Determine which ALU to use for the instruction in picochip_current_prescan_insn. */ static char picochip_get_vliw_alu_id (void); + +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options picochip_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Initialize the GCC target structure. */ @@ -326,6 +333,9 @@ static char picochip_get_vliw_alu_id (void); #undef TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE #define TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE picochip_option_override +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE picochip_option_optimization_table + #undef TARGET_EXCEPT_UNWIND_INFO #define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info diff --git a/gcc/config/picochip/picochip.h b/gcc/config/picochip/picochip.h index 95d9d376dd7..9584efac7ce 100644 --- a/gcc/config/picochip/picochip.h +++ b/gcc/config/picochip/picochip.h @@ -84,8 +84,6 @@ extern enum picochip_dfa_type picochip_schedule_type; #define TARGET_HAS_MAC_UNIT (picochip_has_mac_unit) #define TARGET_HAS_MULTIPLY (picochip_has_mac_unit || picochip_has_mul_unit) -#define CAN_DEBUG_WITHOUT_FP 1 - #define TARGET_VERSION fprintf(stderr, "(picoChip)"); /* Storage Layout */ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 193d58f2120..f265dce42fe 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1363,6 +1363,13 @@ static const struct attribute_spec rs6000_attribute_table[] = #endif { NULL, 0, 0, false, false, false, NULL } }; + +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options rs6000_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; #ifndef MASK_STRICT_ALIGN #define MASK_STRICT_ALIGN 0 @@ -1608,6 +1615,9 @@ static const struct attribute_spec rs6000_attribute_table[] = #undef TARGET_OPTION_DEFAULT_PARAMS #define TARGET_OPTION_DEFAULT_PARAMS rs6000_option_default_params +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE rs6000_option_optimization_table + #undef TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION #define TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION \ rs6000_builtin_vectorized_function diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index c2f47f2c12c..c3170257439 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -625,9 +625,6 @@ extern unsigned char rs6000_recip_bits[]; /* The default CPU for TARGET_OPTION_OVERRIDE. */ #define OPTION_TARGET_CPU_DEFAULT TARGET_CPU_DEFAULT -/* Show we can debug even without a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP - /* Target pragma. */ #define REGISTER_TARGET_PRAGMAS() do { \ c_register_pragma (0, "longcall", rs6000_pragma_longcall); \ diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c index 2ce5f5895bc..5348a661631 100644 --- a/gcc/config/rx/rx.c +++ b/gcc/config/rx/rx.c @@ -2253,6 +2253,13 @@ rx_option_override (void) rx_override_options_after_change (); } +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options rx_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + static bool rx_allocate_stack_slots_for_args (void) @@ -2850,6 +2857,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_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE rx_option_optimization_table + #undef TARGET_PROMOTE_FUNCTION_MODE #define TARGET_PROMOTE_FUNCTION_MODE rx_promote_function_mode diff --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h index 544ed621375..b39c1e5abca 100644 --- a/gcc/config/rx/rx.h +++ b/gcc/config/rx/rx.h @@ -609,8 +609,6 @@ extern int rx_float_compare_mode; /* Like REG_P except that this macro is true for SET expressions. */ #define SET_P(rtl) (GET_CODE (rtl) == SET) -#define CAN_DEBUG_WITHOUT_FP 1 - /* The AS100 assembler does not support .leb128 and .uleb128, but the compiler-build-time configure tests will have enabled their use because GAS supports them. So default to generating STABS diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 985d564618a..290ae693763 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -1490,23 +1490,20 @@ s390_init_machine_status (void) } /* Change optimizations to be performed, depending on the - optimization level. + optimization level. */ - LEVEL is the optimization level specified; 2 if `-O2' is - specified, 1 if `-O' is specified, and 0 if neither is specified. +static const struct default_options s390_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, - SIZE is nonzero if `-Os' is specified and zero otherwise. */ + /* ??? There are apparently still problems with -fcaller-saves. */ + { OPT_LEVELS_ALL, OPT_fcaller_saves, NULL, 0 }, -static void -s390_option_optimization (int level ATTRIBUTE_UNUSED, int size) -{ - /* ??? There are apparently still problems with -fcaller-saves. */ - flag_caller_saves = 0; + /* Use MVCLE instructions to decrease code size if requested. */ + { OPT_LEVELS_SIZE, OPT_mmvcle, NULL, 1 }, - /* Use MVCLE instructions to decrease code size if requested. */ - if (size != 0) - target_flags |= MASK_MVCLE; -} + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Implement TARGET_OPTION_INIT_STRUCT. */ @@ -1730,7 +1727,7 @@ s390_option_override (void) global_options.x_param_values, global_options_set.x_param_values); - /* This cannot reside in s390_option_optimization since HAVE_prefetch + /* This cannot reside in s390_option_optimization_table 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) @@ -10510,8 +10507,8 @@ 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_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE s390_option_optimization_table #undef TARGET_OPTION_INIT_STRUCT #define TARGET_OPTION_INIT_STRUCT s390_option_init_struct diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 2b181112996..3e9861458ed 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -158,9 +158,6 @@ extern int s390_arch_flags; #define TARGET_VERSION fprintf (stderr, " (S/390)"); #endif -/* Frame pointer is not used for debugging. */ -#define CAN_DEBUG_WITHOUT_FP - /* Constants needed to control the TEST DATA CLASS (TDC) instruction. */ #define S390_TDC_POSITIVE_ZERO (1 << 11) #define S390_TDC_NEGATIVE_ZERO (1 << 10) diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c index 7af8374cf26..210ebc3a58a 100644 --- a/gcc/config/score/score.c +++ b/gcc/config/score/score.c @@ -53,6 +53,13 @@ static void score_option_override (void); +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options score_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + #undef TARGET_ASM_FILE_START #define TARGET_ASM_FILE_START score_asm_file_start @@ -71,6 +78,8 @@ static void score_option_override (void); #define TARGET_HANDLE_OPTION score_handle_option #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE score_option_override +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE score_option_optimization_table #undef TARGET_LEGITIMIZE_ADDRESS #define TARGET_LEGITIMIZE_ADDRESS score_legitimize_address diff --git a/gcc/config/score/score.h b/gcc/config/score/score.h index 621f56ef3c2..0db4c6c10c6 100644 --- a/gcc/config/score/score.h +++ b/gcc/config/score/score.h @@ -98,9 +98,6 @@ #define TARGET_VERSION \ fprintf (stderr, "Sunplus S+core rev=%s", SCORE_GCC_VERSION); -/* Show we can debug even without a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP - /* Target machine storage layout. */ #define BITS_BIG_ENDIAN 0 #define BYTES_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0) diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index ff83c81f5ad..40587b5ab84 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -183,7 +183,6 @@ 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 sh_option_init_struct (struct gcc_options *); static void sh_option_default_params (void); static void output_stack_adjust (int, rtx, int, HARD_REG_SET *, bool); @@ -323,6 +322,23 @@ static const struct attribute_spec sh_attribute_table[] = #endif { NULL, 0, 0, false, false, false, NULL } }; + +/* Set default optimization options. */ +static const struct default_options sh_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_1_PLUS_SPEED_ONLY, OPT_mdiv_, "inv:minlat", 1 }, + { OPT_LEVELS_SIZE, OPT_mdiv_, SH_DIV_STR_FOR_SIZE, 1 }, + { OPT_LEVELS_0_ONLY, OPT_mdiv_, "", 1 }, + { OPT_LEVELS_SIZE, OPT_mcbranchdi, NULL, 0 }, + /* We can't meaningfully test TARGET_SHMEDIA here, because -m + options haven't been parsed yet, hence we'd read only the + default. sh_target_reg_class will return NO_REGS if this is + not SHMEDIA, so it's OK to always set + flag_branch_target_load_optimize. */ + { OPT_LEVELS_2_PLUS, OPT_fbranch_target_load_optimize, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Initialize the GCC target structure. */ #undef TARGET_ATTRIBUTE_TABLE @@ -342,8 +358,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_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE sh_option_optimization_table #undef TARGET_OPTION_INIT_STRUCT #define TARGET_OPTION_INIT_STRUCT sh_option_init_struct #undef TARGET_OPTION_DEFAULT_PARAMS @@ -702,34 +718,6 @@ sh_handle_option (size_t code, const char *arg ATTRIBUTE_UNUSED, } } -/* Set default optimization options. */ -static void -sh_option_optimization (int level, int size) -{ - if (level) - { - if (!size) - sh_div_str = "inv:minlat"; - } - if (size) - { - target_flags |= MASK_SMALLCODE; - sh_div_str = SH_DIV_STR_FOR_SIZE ; - } - else - TARGET_CBRANCHDI4 = 1; - /* We can't meaningfully test TARGET_SHMEDIA here, because -m options - haven't been parsed yet, hence we'd read only the default. - sh_target_reg_class will return NO_REGS if this is not SHMEDIA, so - it's OK to always set flag_branch_target_load_optimize. */ - if (level > 1) - { - flag_branch_target_load_optimize = 1; - if (!size) - target_flags |= MASK_SAVE_ALL_TARGET_REGS; - } -} - /* Implement TARGET_OPTION_INIT_STRUCT. */ static void sh_option_init_struct (struct gcc_options *opts) @@ -756,6 +744,8 @@ sh_option_override (void) int regno; SUBTARGET_OVERRIDE_OPTIONS; + if (optimize > 1 && !optimize_size) + target_flags |= MASK_SAVE_ALL_TARGET_REGS; if (flag_finite_math_only == 2) flag_finite_math_only = !flag_signaling_nans && TARGET_SH2E && ! TARGET_IEEE; @@ -991,7 +981,7 @@ sh_option_override (void) SH2 .. SH5 : align to cache line start. */ if (align_functions == 0) align_functions - = TARGET_SMALLCODE ? FUNCTION_BOUNDARY/8 : (1 << CACHE_LOG); + = optimize_size ? FUNCTION_BOUNDARY/8 : (1 << CACHE_LOG); /* The linker relaxation code breaks when a function contains alignments that are larger than that at the start of a compilation unit. */ @@ -1555,7 +1545,7 @@ expand_block_move (rtx *operands) emit_insn (gen_block_move_real_i4 (func_addr_rtx)); return 1; } - else if (! TARGET_SMALLCODE) + else if (! optimize_size) { const char *entry_name; rtx func_addr_rtx = gen_reg_rtx (Pmode); @@ -1594,7 +1584,7 @@ expand_block_move (rtx *operands) /* This is the same number of bytes as a memcpy call, but to a different less common function name, so this will occasionally use more space. */ - if (! TARGET_SMALLCODE) + if (! optimize_size) { rtx func_addr_rtx = gen_reg_rtx (Pmode); int final_switch, while_loop; @@ -2975,21 +2965,21 @@ multcosts (rtx x ATTRIBUTE_UNUSED) Using a multiply first and splitting it later if it's a loss doesn't work because of different sign / zero extension semantics of multiplies vs. shifts. */ - return TARGET_SMALLCODE ? 2 : 3; + return optimize_size ? 2 : 3; if (TARGET_SH2) { /* We have a mul insn, so we can never take more than the mul and the read of the mac reg, but count more because of the latency and extra reg usage. */ - if (TARGET_SMALLCODE) + if (optimize_size) return 2; return 3; } /* If we're aiming at small code, then just count the number of insns in a multiply call sequence. */ - if (TARGET_SMALLCODE) + if (optimize_size) return 5; /* Otherwise count all the insns in the routine we'd be calling too. */ @@ -4660,7 +4650,7 @@ find_barrier (int num_mova, rtx mova, rtx from) /* For the SH1, we generate alignments even after jumps-around-jumps. */ else if (JUMP_P (from) && ! TARGET_SH2 - && ! TARGET_SMALLCODE) + && ! optimize_size) new_align = 4; /* There is a possibility that a bf is transformed into a bf/s by the @@ -5258,13 +5248,13 @@ barrier_align (rtx barrier_or_label) pat = PATTERN (prev); /* If this is a very small table, we want to keep the alignment after the table to the minimum for proper code alignment. */ - return ((TARGET_SMALLCODE + return ((optimize_size || ((unsigned) XVECLEN (pat, 1) * GET_MODE_SIZE (GET_MODE (pat)) <= (unsigned) 1 << (CACHE_LOG - 2))) ? 1 << TARGET_SHMEDIA : align_jumps_log); } - if (TARGET_SMALLCODE) + if (optimize_size) return 0; if (! TARGET_SH2 || ! optimize) diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 8f149dc63a6..969636822da 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -98,8 +98,6 @@ do { \ ? "__LITTLE_ENDIAN__" : "__BIG_ENDIAN__"); \ } while (0) -#define CAN_DEBUG_WITHOUT_FP - /* Value should be nonzero if functions must have frame pointers. Zero means the frame pointer need not be set up (and parms may be accessed via the stack pointer) in functions that seem suitable. */ @@ -623,7 +621,7 @@ extern enum sh_divide_strategy_e sh_div_strategy; barrier_align (LABEL_AFTER_BARRIER) #define LOOP_ALIGN(A_LABEL) \ - ((! optimize || TARGET_HARD_SH4 || TARGET_SMALLCODE) \ + ((! optimize || TARGET_HARD_SH4 || optimize_size) \ ? 0 : sh_loop_align (A_LABEL)) #define LABEL_ALIGN(A_LABEL) \ @@ -1781,7 +1779,7 @@ struct sh_args { /* Alignment required for a trampoline in bits . */ #define TRAMPOLINE_ALIGNMENT \ - ((CACHE_LOG < 3 || (TARGET_SMALLCODE && ! TARGET_HARVARD)) ? 32 \ + ((CACHE_LOG < 3 || (optimize_size && ! TARGET_HARVARD)) ? 32 \ : TARGET_SHMEDIA ? 256 : 64) /* A C expression whose value is RTL representing the value of the return @@ -1813,11 +1811,11 @@ struct sh_args { #define MOVE_BY_PIECES_P(SIZE, ALIGN) \ (move_by_pieces_ninsns (SIZE, ALIGN, MOVE_MAX_PIECES + 1) \ - < (TARGET_SMALLCODE ? 2 : ((ALIGN >= 32) ? 16 : 2))) + < (optimize_size ? 2 : ((ALIGN >= 32) ? 16 : 2))) #define STORE_BY_PIECES_P(SIZE, ALIGN) \ (move_by_pieces_ninsns (SIZE, ALIGN, STORE_MAX_PIECES + 1) \ - < (TARGET_SMALLCODE ? 2 : ((ALIGN >= 32) ? 16 : 2))) + < (optimize_size ? 2 : ((ALIGN >= 32) ? 16 : 2))) #define SET_BY_PIECES_P(SIZE, ALIGN) STORE_BY_PIECES_P(SIZE, ALIGN) @@ -2597,7 +2595,7 @@ extern int current_function_interrupt; #define ACCUMULATE_OUTGOING_ARGS TARGET_ACCUMULATE_OUTGOING_ARGS #define SH_DYNAMIC_SHIFT_COST \ - (TARGET_HARD_SH4 ? 1 : TARGET_SH3 ? (TARGET_SMALLCODE ? 1 : 2) : 20) + (TARGET_HARD_SH4 ? 1 : TARGET_SH3 ? (optimize_size ? 1 : 2) : 20) #define NUM_MODES_FOR_MODE_SWITCHING { FP_MODE_NONE } diff --git a/gcc/config/sh/sh.opt b/gcc/config/sh/sh.opt index f10408fb02b..e94f53a5cbd 100644 --- a/gcc/config/sh/sh.opt +++ b/gcc/config/sh/sh.opt @@ -320,7 +320,7 @@ Target Mask(HITACHI) MaskExists Follow Renesas (formerly Hitachi) / SuperH calling conventions mspace -Target Report RejectNegative Mask(SMALLCODE) +Target RejectNegative Alias(Os) Deprecated. Use -Os instead multcost= diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 0cd3c8191e8..1898732308a 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -477,6 +477,13 @@ enum processor_type sparc_cpu; /* Whetheran FPU option was specified. */ static bool fpu_option_set = false; +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options sparc_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + /* Initialize the GCC target structure. */ /* The default is to use .half rather than .short for aligned HI objects. */ @@ -612,6 +619,8 @@ static bool fpu_option_set = false; #define TARGET_HANDLE_OPTION sparc_handle_option #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE sparc_option_override +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE sparc_option_optimization_table #if TARGET_GNU_TLS && defined(HAVE_AS_SPARC_UA_PCREL) #undef TARGET_ASM_OUTPUT_DWARF_DTPREL diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index ccb7dca353d..8919542e315 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -496,9 +496,6 @@ extern enum cmodel sparc_cmodel; /* ??? This should be 32 bits for v9 but what can we do? */ #define WCHAR_TYPE "short unsigned int" #define WCHAR_TYPE_SIZE 16 - -/* Show we can debug even without a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP /* Mask of all CPU selection flags. */ #define MASK_ISA \ diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 73f2a91a288..7143c178f1c 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -1,6 +1,6 @@ /* Xstormy16 target functions. Copyright (C) 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 Red Hat, Inc. This file is part of GCC. @@ -2623,6 +2623,13 @@ xstormy16_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) return (size == -1 || size > UNITS_PER_WORD * NUM_ARGUMENT_REGISTERS); } +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ +static const struct default_options xstorym16_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + #undef TARGET_ASM_ALIGNED_HI_OP #define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" #undef TARGET_ASM_ALIGNED_SI_OP @@ -2671,6 +2678,9 @@ xstormy16_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) #undef TARGET_TRAMPOLINE_INIT #define TARGET_TRAMPOLINE_INIT xstormy16_trampoline_init +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE xstorym16_option_optimization_table + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-stormy16.h" diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h index 4ea89a218db..24402133e20 100644 --- a/gcc/config/stormy16/stormy16.h +++ b/gcc/config/stormy16/stormy16.h @@ -53,8 +53,6 @@ while (0) #define TARGET_VERSION fprintf (stderr, " (xstormy16 cpu core)"); - -#define CAN_DEBUG_WITHOUT_FP /* Storage Layout. */ diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index dc047a2056c..560fe34a91f 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -141,20 +141,20 @@ v850_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED) } } -/* Implement TARGET_OPTION_OPTIMIZATION. */ +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ -static void -v850_option_optimization (int level, int size ATTRIBUTE_UNUSED) -{ - if (level) +static const struct default_options v850_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, /* 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; -} + { OPT_LEVELS_1_PLUS, OPT_mprolog_function, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Handle the TARGET_PASS_BY_REFERENCE target hook. Specify whether to pass the argument by reference. */ @@ -3202,8 +3202,8 @@ 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 +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE v850_option_optimization_table struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 56df96e5cd2..9c5b802727e 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -137,9 +137,6 @@ enum small_memory_type { }; 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 /* Target machine storage layout */ diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 9d846c5e6cc..a01fb0b3019 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -119,7 +119,6 @@ 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); @@ -160,6 +159,20 @@ static void xtensa_trampoline_init (rtx, tree, rtx); static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] = REG_ALLOC_ORDER; + +/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ + +static const struct default_options xtensa_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + /* 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. */ + { OPT_LEVELS_ALL, OPT_freorder_blocks, NULL, 0 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* This macro generates the assembly code for function exit, @@ -255,8 +268,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 +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE xtensa_option_optimization_table struct gcc_target targetm = TARGET_INITIALIZER; @@ -2171,20 +2184,6 @@ 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 expression. diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 7dc22a2a466..96173eebda3 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -100,9 +100,6 @@ extern unsigned xtensa_current_frame_size; #define LIBGCC2_WORDS_BIG_ENDIAN 0 #endif -/* Show we can debug even without a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP - /* Target machine storage layout */ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index b28da918e70..ca90d7d1c4a 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -795,26 +795,19 @@ used to alter option flag variables which only exist in those frontends. @end defmac -@deftypefn {Target Hook} void TARGET_OPTION_OPTIMIZATION (int @var{level}, int @var{size}) +@deftypevr {Target Hook} {const struct default_options *} TARGET_OPTION_OPTIMIZATION_TABLE Some machines may desire to change what optimizations are performed for -various optimization levels. This hook, if defined, is executed once +various optimization levels. This variable, if defined, describes +options to enable at particular sets of optimization levels. These +options are processed 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. +of the command options have been parsed, so may be overridden by other +options passed explicily. -@var{level} is the optimization level specified; 2 if @option{-O2} is -specified, 1 if @option{-O} is specified, and 0 if neither is specified. - -@var{size} is nonzero if @option{-Os} is specified and zero otherwise. - -This macro is run once at program startup and when the optimization +This processing is run once at program startup and when the optimization options are changed via @code{#pragma GCC optimize} or by using the @code{optimize} attribute. - -@strong{Do not examine @code{write_symbols} in -this hook!} The debugging options are not supposed to alter the -generated code. -@end deftypefn +@end deftypevr @deftypefn {Target Hook} void TARGET_OPTION_INIT_STRUCT (struct gcc_options *@var{opts}) Set target-dependent initial values of fields in @var{opts}. @@ -831,12 +824,6 @@ chance to display extra information on the target specific command line options found in its @file{.opt} file. @end deftypefn -@defmac CAN_DEBUG_WITHOUT_FP -Define this macro if debugging can be performed even without a frame -pointer. If this macro is defined, GCC will turn on the -@option{-fomit-frame-pointer} option whenever @option{-O} is specified. -@end defmac - @defmac SWITCHABLE_TARGET Some targets need to switch between substantially different subtargets during compilation. For example, the MIPS target has one subtarget for diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 0081e66c587..5bb1d9a4d5c 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -793,26 +793,19 @@ used to alter option flag variables which only exist in those frontends. @end defmac -@hook TARGET_OPTION_OPTIMIZATION +@hook TARGET_OPTION_OPTIMIZATION_TABLE Some machines may desire to change what optimizations are performed for -various optimization levels. This hook, if defined, is executed once +various optimization levels. This variable, if defined, describes +options to enable at particular sets of optimization levels. These +options are processed 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. +of the command options have been parsed, so may be overridden by other +options passed explicily. -@var{level} is the optimization level specified; 2 if @option{-O2} is -specified, 1 if @option{-O} is specified, and 0 if neither is specified. - -@var{size} is nonzero if @option{-Os} is specified and zero otherwise. - -This macro is run once at program startup and when the optimization +This processing is run once at program startup and when the optimization options are changed via @code{#pragma GCC optimize} or by using the @code{optimize} attribute. - -@strong{Do not examine @code{write_symbols} in -this hook!} The debugging options are not supposed to alter the -generated code. -@end deftypefn +@end deftypevr @hook TARGET_OPTION_INIT_STRUCT @@ -825,12 +818,6 @@ chance to display extra information on the target specific command line options found in its @file{.opt} file. @end deftypefn -@defmac CAN_DEBUG_WITHOUT_FP -Define this macro if debugging can be performed even without a frame -pointer. If this macro is defined, GCC will turn on the -@option{-fomit-frame-pointer} option whenever @option{-O} is specified. -@end defmac - @defmac SWITCHABLE_TARGET Some targets need to switch between substantially different subtargets during compilation. For example, the MIPS target has one subtarget for diff --git a/gcc/opts.c b/gcc/opts.c index 52f8c6d9340..1a39b628a86 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -717,24 +717,206 @@ decode_cmdline_options_to_array_default_mask (unsigned int argc, decoded_options, decoded_options_count); } +/* If indicated by the optimization level LEVEL (-Os if SIZE is set, + -Ofast if FAST is set), apply the option DEFAULT_OPT to OPTS and + OPTS_SET, diagnostic context DC, with language mask LANG_MASK and + option handlers HANDLERS. */ + +static void +maybe_default_option (struct gcc_options *opts, + struct gcc_options *opts_set, + const struct default_options *default_opt, + int level, bool size, bool fast, + unsigned int lang_mask, + const struct cl_option_handlers *handlers, + diagnostic_context *dc) +{ + const struct cl_option *option = &cl_options[default_opt->opt_index]; + bool enabled; + + if (size) + gcc_assert (level == 2); + if (fast) + gcc_assert (level == 3); + + switch (default_opt->levels) + { + case OPT_LEVELS_ALL: + enabled = true; + break; + + case OPT_LEVELS_0_ONLY: + enabled = (level == 0); + break; + + case OPT_LEVELS_1_PLUS: + enabled = (level >= 1); + break; + + case OPT_LEVELS_1_PLUS_SPEED_ONLY: + enabled = (level >= 1 && !size); + break; + + case OPT_LEVELS_2_PLUS: + enabled = (level >= 2); + break; + + case OPT_LEVELS_2_PLUS_SPEED_ONLY: + enabled = (level >= 2 && !size); + break; + + case OPT_LEVELS_3_PLUS: + enabled = (level >= 3); + break; + + case OPT_LEVELS_3_PLUS_AND_SIZE: + enabled = (level >= 3 || size); + break; + + case OPT_LEVELS_SIZE: + enabled = size; + break; + + case OPT_LEVELS_FAST: + enabled = fast; + break; + + case OPT_LEVELS_NONE: + default: + gcc_unreachable (); + } + + if (enabled) + handle_generated_option (opts, opts_set, default_opt->opt_index, + default_opt->arg, default_opt->value, + lang_mask, DK_UNSPECIFIED, handlers, dc); + else if (default_opt->arg == NULL + && !(option->flags & CL_REJECT_NEGATIVE)) + handle_generated_option (opts, opts_set, default_opt->opt_index, + default_opt->arg, !default_opt->value, + lang_mask, DK_UNSPECIFIED, handlers, dc); +} + +/* As indicated by the optimization level LEVEL (-Os if SIZE is set, + -Ofast if FAST is set), apply the options in array DEFAULT_OPTS to + OPTS and OPTS_SET, diagnostic context DC, with language mask + LANG_MASK and option handlers HANDLERS. */ + +static void +maybe_default_options (struct gcc_options *opts, + struct gcc_options *opts_set, + const struct default_options *default_opts, + int level, bool size, bool fast, + unsigned int lang_mask, + const struct cl_option_handlers *handlers, + diagnostic_context *dc) +{ + size_t i; + + for (i = 0; default_opts[i].levels != OPT_LEVELS_NONE; i++) + maybe_default_option (opts, opts_set, &default_opts[i], + level, size, fast, lang_mask, handlers, dc); +} + +/* Table of options enabled by default at different levels. */ + +static const struct default_options default_options_table[] = + { + /* -O1 optimizations. */ + { OPT_LEVELS_1_PLUS, OPT_fdefer_pop, NULL, 1 }, +#ifdef DELAY_SLOTS + { OPT_LEVELS_1_PLUS, OPT_fdelayed_branch, NULL, 1 }, +#endif + { OPT_LEVELS_1_PLUS, OPT_fguess_branch_probability, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fcprop_registers, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fforward_propagate, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fif_conversion, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fif_conversion2, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fipa_pure_const, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fipa_reference, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fipa_profile, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fmerge_constants, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fsplit_wide_types, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_ccp, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_bit_ccp, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_dce, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_dominator_opts, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_dse, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_ter, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_sra, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_copyrename, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_fre, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_copy_prop, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_sink, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_ch, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fcombine_stack_adjustments, NULL, 1 }, + + /* -O2 optimizations. */ + { OPT_LEVELS_2_PLUS, OPT_finline_small_functions, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_findirect_inlining, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fpartial_inlining, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fthread_jumps, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fcrossjumping, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_foptimize_sibling_calls, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fcse_follow_jumps, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fgcse, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fexpensive_optimizations, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_frerun_cse_after_loop, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fcaller_saves, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fpeephole2, NULL, 1 }, +#ifdef INSN_SCHEDULING + /* Only run the pre-regalloc scheduling pass if optimizing for speed. */ + { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_fschedule_insns, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 }, +#endif + { OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fstrict_aliasing, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fstrict_overflow, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_ftree_builtin_call_dce, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_ftree_pre, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_ftree_switch_conversion, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fipa_cp, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fipa_sra, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_falign_loops, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_falign_jumps, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_falign_labels, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_falign_functions, NULL, 1 }, + + /* -O3 optimizations. */ + { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 }, + /* Inlining of functions reducing size is a good idea with -Os + regardless of them being declared inline. */ + { OPT_LEVELS_3_PLUS_AND_SIZE, OPT_finline_functions, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_fgcse_after_reload, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_ftree_vectorize, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 }, + + /* -Ofast adds optimizations to -O3. */ + { OPT_LEVELS_FAST, OPT_ffast_math, NULL, 1 }, + + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + /* Default the options in OPTS and OPTS_SET based on the optimization settings in DECODED_OPTIONS and DECODED_OPTIONS_COUNT. */ static void default_options_optimization (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded_options, - unsigned int decoded_options_count) + unsigned int decoded_options_count, + unsigned int lang_mask, + const struct cl_option_handlers *handlers, + diagnostic_context *dc) { unsigned int i; - int opt1; int opt2; - int opt3; - int opt1_max; int ofast = 0; - gcc_assert (opts == &global_options); - gcc_assert (opts_set = &global_options_set); - /* Scan to see what optimization level has been specified. That will determine the default value of many flags. */ for (i = 1; i < decoded_options_count; i++) @@ -745,8 +927,8 @@ default_options_optimization (struct gcc_options *opts, case OPT_O: if (*opt->arg == '\0') { - optimize = 1; - optimize_size = 0; + opts->x_optimize = 1; + opts->x_optimize_size = 0; ofast = 0; } else @@ -757,27 +939,27 @@ default_options_optimization (struct gcc_options *opts, "-O"); else { - optimize = optimize_val; - if ((unsigned int) optimize > 255) - optimize = 255; - optimize_size = 0; + opts->x_optimize = optimize_val; + if ((unsigned int) opts->x_optimize > 255) + opts->x_optimize = 255; + opts->x_optimize_size = 0; ofast = 0; } } break; case OPT_Os: - optimize_size = 1; + opts->x_optimize_size = 1; /* Optimizing for size forces optimize to be 2. */ - optimize = 2; + opts->x_optimize = 2; ofast = 0; break; case OPT_Ofast: /* -Ofast only adds flags to -O3. */ - optimize_size = 0; - optimize = 3; + opts->x_optimize_size = 0; + opts->x_optimize = 3; ofast = 1; break; @@ -787,69 +969,12 @@ default_options_optimization (struct gcc_options *opts, } } - /* -O1 optimizations. */ - opt1 = (optimize >= 1); - flag_defer_pop = opt1; -#ifdef DELAY_SLOTS - flag_delayed_branch = opt1; -#endif -#ifdef CAN_DEBUG_WITHOUT_FP - flag_omit_frame_pointer = opt1; -#endif - flag_guess_branch_prob = opt1; - flag_cprop_registers = opt1; - flag_forward_propagate = opt1; - flag_if_conversion = opt1; - flag_if_conversion2 = opt1; - flag_ipa_pure_const = opt1; - flag_ipa_reference = opt1; - flag_ipa_profile = opt1; - flag_merge_constants = opt1; - flag_split_wide_types = opt1; - flag_tree_ccp = opt1; - flag_tree_bit_ccp = opt1; - flag_tree_dce = opt1; - flag_tree_dom = opt1; - flag_tree_dse = opt1; - flag_tree_ter = opt1; - flag_tree_sra = opt1; - flag_tree_copyrename = opt1; - flag_tree_fre = opt1; - flag_tree_copy_prop = opt1; - flag_tree_sink = opt1; - flag_tree_ch = opt1; - flag_combine_stack_adjustments = opt1; - - /* -O2 optimizations. */ - opt2 = (optimize >= 2); - flag_inline_small_functions = opt2; - flag_indirect_inlining = opt2; - flag_partial_inlining = opt2; - flag_thread_jumps = opt2; - flag_crossjumping = opt2; - flag_optimize_sibling_calls = opt2; - flag_cse_follow_jumps = opt2; - flag_gcse = opt2; - flag_expensive_optimizations = opt2; - flag_rerun_cse_after_loop = opt2; - flag_caller_saves = opt2; - flag_peephole2 = opt2; -#ifdef INSN_SCHEDULING - /* Only run the pre-regalloc scheduling pass if optimizing for speed. */ - flag_schedule_insns = opt2 && ! optimize_size; - flag_schedule_insns_after_reload = opt2; -#endif - flag_regmove = opt2; - flag_strict_aliasing = opt2; - flag_strict_overflow = opt2; - flag_reorder_blocks = opt2; - flag_reorder_functions = opt2; - flag_tree_vrp = opt2; - flag_tree_builtin_call_dce = opt2; - flag_tree_pre = opt2; - flag_tree_switch_conversion = opt2; - flag_ipa_cp = opt2; - flag_ipa_sra = opt2; + maybe_default_options (opts, opts_set, default_options_table, + opts->x_optimize, opts->x_optimize_size, + ofast, lang_mask, handlers, dc); + + /* -O2 param settings. */ + opt2 = (opts->x_optimize >= 2); /* Track fields in field-sensitive alias analysis. */ maybe_set_param_value @@ -863,58 +988,20 @@ default_options_optimization (struct gcc_options *opts, opt2 ? default_param_value (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP) : 1000, opts->x_param_values, opts_set->x_param_values); - /* -O3 optimizations. */ - opt3 = (optimize >= 3); - flag_tree_loop_distribute_patterns = opt3; - flag_predictive_commoning = opt3; - flag_inline_functions = opt3; - flag_unswitch_loops = opt3; - flag_gcse_after_reload = opt3; - flag_tree_vectorize = opt3; - flag_ipa_cp_clone = opt3; - if (flag_ipa_cp_clone) - flag_ipa_cp = 1; - - /* Just -O1/-O0 optimizations. */ - opt1_max = (optimize <= 1); - align_loops = opt1_max; - align_jumps = opt1_max; - align_labels = opt1_max; - align_functions = opt1_max; - - if (optimize_size) - { - /* Inlining of functions reducing size is a good idea regardless of them - being declared inline. */ - flag_inline_functions = 1; - - /* Basic optimization options. */ - optimize_size = 1; - if (optimize > 2) - optimize = 2; - - /* We want to crossjump as much as possible. */ - maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, 1, - opts->x_param_values, opts_set->x_param_values); - } + if (opts->x_optimize_size) + /* We want to crossjump as much as possible. */ + maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, 1, + opts->x_param_values, opts_set->x_param_values); else maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, default_param_value (PARAM_MIN_CROSSJUMP_INSNS), opts->x_param_values, opts_set->x_param_values); - /* -Ofast adds optimizations to -O3. */ - if (ofast) - { - /* Which is -ffast-math for now. */ - set_fast_math_flags (1); - /* Allow targets to enable extra options with -Ofast - before general options processing so disabling them - again afterwards works. */ - targetm.handle_ofast (); - } - /* Allow default optimizations to be specified on a per-machine basis. */ - targetm.target_option.optimization (optimize, optimize_size); + maybe_default_options (opts, opts_set, + targetm.target_option.optimization_table, + opts->x_optimize, opts->x_optimize_size, + ofast, lang_mask, handlers, dc); } static void finish_options (struct gcc_options *, struct gcc_options *); @@ -949,7 +1036,8 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set, global_dc); default_options_optimization (opts, opts_set, - decoded_options, decoded_options_count); + decoded_options, decoded_options_count, + lang_mask, &handlers, global_dc); #ifdef ENABLE_LTO /* Clear any options currently held for LTO. */ diff --git a/gcc/system.h b/gcc/system.h index 7e5b0484fb6..f67639c7721 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -719,7 +719,8 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; OPTIMIZATION_OPTIONS CLASS_LIKELY_SPILLED_P \ USING_SJLJ_EXCEPTIONS TARGET_UNWIND_INFO \ LABEL_ALIGN_MAX_SKIP LOOP_ALIGN_MAX_SKIP \ - LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP JUMP_ALIGN_MAX_SKIP + LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP JUMP_ALIGN_MAX_SKIP \ + CAN_DEBUG_WITHOUT_FP /* 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 @@ -784,7 +785,8 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; LANG_HOOKS_MAYBE_BUILD_CLEANUP LANG_HOOKS_UPDATE_DECL_AFTER_SAVING \ LANG_HOOKS_POPLEVEL LANG_HOOKS_TRUTHVALUE_CONVERSION \ TARGET_PROMOTE_FUNCTION_ARGS TARGET_PROMOTE_FUNCTION_RETURN \ - LANG_HOOKS_MISSING_ARGUMENT LANG_HOOKS_HASH_TYPES + LANG_HOOKS_MISSING_ARGUMENT LANG_HOOKS_HASH_TYPES \ + TARGET_HANDLE_OFAST TARGET_OPTION_OPTIMIZATION /* Hooks into libgcc2. */ #pragma GCC poison LIBGCC2_DOUBLE_TYPE_SIZE diff --git a/gcc/target.def b/gcc/target.def index 3567c81510c..cc69c9193d4 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -961,13 +961,6 @@ DEFHOOK bool, (size_t code, const char *arg, int value), hook_bool_size_t_constcharptr_int_true) -/* ??? Documenting this hook requires a GFDL license grant. */ -DEFHOOK_UNDOC -(handle_ofast, - "Handle target-specific parts of specifying -Ofast.", - void, (void), - hook_void_void) - /* Display extra, target specific information in response to a --target-help switch. */ DEFHOOK @@ -2384,11 +2377,10 @@ DEFHOOK hook_void_void) /* Set default optimizations for the target. */ -DEFHOOK -(optimization, +DEFHOOKPOD +(optimization_table, "", - void, (int level, int size), - hook_void_int_int) + const struct default_options *, empty_optimization_table) DEFHOOK (default_params, diff --git a/gcc/target.h b/gcc/target.h index 99dd1eea998..f93699ffb1b 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -128,6 +128,41 @@ enum vect_cost_for_stmt vec_perm }; +/* Sets of optimization levels at which an option may be enabled by + default_options_optimization. */ +enum opt_levels +{ + OPT_LEVELS_NONE, /* No levels (mark end of array). */ + OPT_LEVELS_ALL, /* All levels (used by targets to disable options + enabled in target-independent code). */ + OPT_LEVELS_0_ONLY, /* -O0 only. */ + OPT_LEVELS_1_PLUS, /* -O1 and above, including -Os. */ + OPT_LEVELS_1_PLUS_SPEED_ONLY, /* -O1 and above, but not -Os. */ + OPT_LEVELS_2_PLUS, /* -O2 and above, including -Os. */ + OPT_LEVELS_2_PLUS_SPEED_ONLY, /* -O2 and above, but not -Os. */ + OPT_LEVELS_3_PLUS, /* -O3 and above. */ + OPT_LEVELS_3_PLUS_AND_SIZE, /* -O3 and above and -Os. */ + OPT_LEVELS_SIZE, /* -Os only. */ + OPT_LEVELS_FAST /* -Ofast only. */ +}; + +/* Description of options to enable by default at given levels. */ +struct default_options +{ + /* The levels at which to enable the option. */ + enum opt_levels levels; + + /* The option index and argument or enabled/disabled sense of the + option, as passed to handle_generated_option. If ARG is NULL and + the option allows a negative form, the option is considered to be + passed in negative form when the optimization level is not one of + those in LEVELS (in order to handle changes to the optimization + level with the "optimize" attribute). */ + size_t opt_index; + const char *arg; + int value; +}; + /* The target structure. This holds all the backend hooks. */ #define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME; #define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NAME) PARAMS; diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 5948e3fcba4..b6aefdbe58f 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -1333,4 +1333,9 @@ sjlj_except_unwind_info (void) return UI_SJLJ; } +const struct default_options empty_optimization_table[] = + { + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; + #include "gt-targhooks.h" diff --git a/gcc/targhooks.h b/gcc/targhooks.h index 7b640cc91e2..e89ac8ec432 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -167,3 +167,5 @@ extern int default_label_align_after_barrier_max_skip (rtx); extern int default_loop_align_max_skip (rtx); extern int default_label_align_max_skip (rtx); extern int default_jump_align_max_skip (rtx); + +extern const struct default_options empty_optimization_table[]; diff --git a/gcc/toplev.c b/gcc/toplev.c index 808248bd3d2..596fb89832e 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1822,11 +1822,7 @@ process_options (void) if (flag_unroll_all_loops) flag_unroll_loops = 1; - /* The loop unrolling code assumes that cse will be run after loop. - web and rename-registers also help when run after loop unrolling. */ - if (flag_rerun_cse_after_loop == AUTODETECT_VALUE) - flag_rerun_cse_after_loop = flag_unroll_loops || flag_peel_loops; - + /* web and rename-registers help when run after loop unrolling. */ if (flag_web == AUTODETECT_VALUE) flag_web = flag_unroll_loops || flag_peel_loops; |