diff options
author | Joseph Myers <joseph@codesourcery.com> | 2010-10-22 13:14:45 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2010-10-22 13:14:45 +0100 |
commit | 3020190e3e5014c78439d3f96abe1819b95f8fdd (patch) | |
tree | 1f0b71dcd99544ab6999d99dbfef93415004de5f /gcc/config/sh | |
parent | 26df19ce4f23305c36afaa49cce1aa88a7199eda (diff) | |
download | gcc-3020190e3e5014c78439d3f96abe1819b95f8fdd.zip gcc-3020190e3e5014c78439d3f96abe1819b95f8fdd.tar.gz gcc-3020190e3e5014c78439d3f96abe1819b95f8fdd.tar.bz2 |
target.h (enum opt_levels, [...]): New.
* 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.
From-SVN: r165823
Diffstat (limited to 'gcc/config/sh')
-rw-r--r-- | gcc/config/sh/sh.c | 70 | ||||
-rw-r--r-- | gcc/config/sh/sh.h | 12 | ||||
-rw-r--r-- | gcc/config/sh/sh.opt | 2 |
3 files changed, 36 insertions, 48 deletions
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index ff83c81..40587b5 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 8f149dc..9696368 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 f10408f..e94f53a 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= |