From patchwork Sat Oct 9 19:13:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 67327 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id CCC3FB70AE for ; Sun, 10 Oct 2010 06:13:51 +1100 (EST) Received: (qmail 8879 invoked by alias); 9 Oct 2010 19:13:50 -0000 Received: (qmail 8868 invoked by uid 22791); 9 Oct 2010 19:13:47 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 09 Oct 2010 19:13:40 +0000 Received: (qmail 9303 invoked from network); 9 Oct 2010 19:13:37 -0000 Received: from unknown (HELO digraph.polyomino.org.uk) (joseph@127.0.0.2) by mail.codesourcery.com with ESMTPA; 9 Oct 2010 19:13:37 -0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.69) (envelope-from ) id 1P4erQ-00030H-8W; Sat, 09 Oct 2010 19:13:36 +0000 Date: Sat, 9 Oct 2010 19:13:36 +0000 (UTC) From: "Joseph S. Myers" To: gcc-patches@gcc.gnu.org cc: hpenner@de.ibm.com, uweigand@de.ibm.com, Andreas.Krebbel@de.ibm.com Subject: Clean up --param handling Message-ID: MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch cleans up code setting --param values in preparation for putting --param settings in gcc_options structures. * Code directly accessing compiler_params is changed to use existing macros. * Some code used PARAM_VALUE macro expansions as lvalues (in one case via "MAX_PENDING_LIST_LENGTH = 128;"). This is changed to use functions for assigning to parameters; the macro no longer expands to an lvalue. * Although much code did check PARAM_SET_P before setting values of parameters, some did not and so would override values set by the user. In particular, this applied to picochip_option_override, and to default_options_optimization (if called a second or subsequent time from an optimize attribute). It also applied to the various TARGET_OPTION_OPTIMIZATION hooks that set parameters. The affected cases are generally changed to use maybe_set_param_value - or, in the case of the hooks setting a default value independent of optimization level, to use set_default_param_value in a new TARGET_OPTION_DEFAULT_PARAMS hook. However, some cases of set_param_value in s390_option_override are left unchanged; they could be deliberate because such unconditional uses are mixed with conditional ones. Perhaps the S390 maintainers could comment on whether the particular values set are indeed needed for correctness and so should override user-set values, or whether the remaining set_param_value cases should be using maybe_set_param_value. Bootstrapped with no regressions on x86_64-unknown-linux-gnu. Also tested building cc1 for the following targets: arm-eabi ia64-elf picochip-none powerpc-eabi s390-linux-gnu sh-elf sparc-elf spu-elf. OK to commit? 2010-10-09 Joseph Myers * params.c (set_param_value_internal): New. (set_param_value): Use set_param_value_internal. (maybe_set_param_value, set_default_param_value): New. * params.h (PARAM_VALUE, PARAM_SET_P): Make into rvalues. (maybe_set_param_value, set_default_param_value): Declare. * config/arm/arm.c (arm_option_override): Use maybe_set_param_value. * config/i386/i386.c (ix86_option_override_internal): Use maybe_set_param_value. * config/ia64/ia64.c (ia64_option_default_params, TARGET_OPTION_DEFAULT_PARAMS): New. (ia64_option_optimization): Move some code to ia64_option_default_params. * config/picochip/picochip.c (picochip_option_override): Use maybe_set_param_value. * config/rs6000/rs6000.c (rs6000_option_default_params, TARGET_OPTION_DEFAULT_PARAMS): New. (rs6000_option_override_internal): Use maybe_set_param_value. (rs6000_option_optimization): Move some code to rs6000_option_default_params. * config/s390/s390.c (s390_option_override): Use maybe_set_param_value. * config/sh/sh.c (sh_option_default_params, TARGET_OPTION_DEFAULT_PARAMS): New. (sh_option_optimization): Move some code to sh_option_default_params. * config/sparc/sparc.c (sparc_option_override): Use maybe_set_param_value. * config/spu/spu.c (spu_option_default_params, TARGET_OPTION_DEFAULT_PARAMS): New. (spu_option_optimization): Move some code to spu_option_default_params. (spu_option_override): Use maybe_set_param_value. * doc/tm.texi.in (TARGET_OPTION_DEFAULT_PARAMS): New @hook. * doc/tm.texi: Regenerate. * ggc-common.c (init_ggc_heuristics): Use set_default_param_value. * opts.c (init_options_once): Use PARAM_VALUE not direct access to compiler_params. (default_options_optimization): Use maybe_set_param_value. (finish_options): Use maybe_set_param_value. * target.def (target_option.default_params): New hook. * toplev.c (general_init): Call targetm.target_option.default_params. Index: doc/tm.texi =================================================================== --- doc/tm.texi (revision 165189) +++ doc/tm.texi (working copy) @@ -812,6 +812,10 @@ this hook!} The debugging options are n generated code. @end deftypefn +@deftypefn {Target Hook} void TARGET_OPTION_DEFAULT_PARAMS (void) +Set target-dependent default values for @option{--param} settings, using calls to @code{set_default_param_value}. +@end deftypefn + @deftypefn {Target Hook} void TARGET_HELP (void) This hook is called in response to the user invoking @option{--target-help} on the command line. It gives the target a Index: doc/tm.texi.in =================================================================== --- doc/tm.texi.in (revision 165189) +++ doc/tm.texi.in (working copy) @@ -812,6 +812,8 @@ this hook!} The debugging options are n generated code. @end deftypefn +@hook TARGET_OPTION_DEFAULT_PARAMS + @hook TARGET_HELP This hook is called in response to the user invoking @option{--target-help} on the command line. It gives the target a Index: target.def =================================================================== --- target.def (revision 165189) +++ target.def (working copy) @@ -2340,6 +2340,13 @@ DEFHOOK void, (int level, int size), hook_void_int_int) +DEFHOOK +(default_params, +"Set target-dependent default values for @option{--param} settings, using\ + calls to @code{set_default_param_value}.", + void, (void), + hook_void_void) + /* Function to determine if one function can inline another function. */ #undef HOOK_PREFIX #define HOOK_PREFIX "TARGET_" Index: params.c =================================================================== --- params.c (revision 165189) +++ params.c (working copy) @@ -1,5 +1,5 @@ /* params.c - Run-time parameters. - Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008 + Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Written by Mark Mitchell . @@ -51,6 +51,21 @@ add_params (const param_info params[], s num_compiler_params += n; } +/* Set the value of the parameter given by NUM to VALUE. If + EXPLICIT_P, this is being set by the user; otherwise it is being + set implicitly by the compiler. */ + +static void +set_param_value_internal (compiler_param num, int value, + bool explicit_p) +{ + size_t i = (size_t) num; + + compiler_params[i].value = value; + if (explicit_p) + compiler_params[i].set = true; +} + /* Set the VALUE associated with the parameter given by NAME. */ void @@ -75,10 +90,7 @@ set_param_value (const char *name, int v compiler_params[i].option, compiler_params[i].max_value); else - { - compiler_params[i].value = value; - compiler_params[i].set = true; - } + set_param_value_internal ((compiler_param) i, value, true); return; } @@ -86,6 +98,26 @@ set_param_value (const char *name, int v error ("invalid parameter %qs", name); } +/* Set the value of the parameter given by NUM to VALUE, implicitly, + if it has not been set explicitly by the user. */ + +void +maybe_set_param_value (compiler_param num, int value) +{ + if (!PARAM_SET_P (num)) + set_param_value_internal (num, value, false); +} + +/* Set the default value of a parameter given by NUM to VALUE, before + option processing. */ + +void +set_default_param_value (compiler_param num, int value) +{ + gcc_assert (!PARAM_SET_P (num)); + set_param_value_internal (num, value, false); +} + /* Return the current value of num_compiler_params, for the benefit of plugins that use parameters as features. */ Index: params.h =================================================================== --- params.h (revision 165189) +++ params.h (working copy) @@ -1,5 +1,5 @@ /* params.h - Run-time parameters. - Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2009 + Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Written by Mark Mitchell . @@ -88,13 +88,24 @@ typedef enum compiler_param LAST_PARAM } compiler_param; -/* The value of the parameter given by ENUM. */ +/* The value of the parameter given by ENUM. Not an lvalue. */ #define PARAM_VALUE(ENUM) \ - (compiler_params[(int) ENUM].value) + ((int) compiler_params[(int) ENUM].value) -/* True if the value of the parameter was explicitly changed. */ +/* Set the value of the parameter given by NUM to VALUE, implicitly, + if it has not been set explicitly by the user. */ + +extern void maybe_set_param_value (compiler_param num, int value); + +/* Set the default value of a parameter given by NUM to VALUE, before + option processing. */ + +extern void set_default_param_value (compiler_param num, int value); + +/* True if the value of the parameter was explicitly changed. Not an + lvalue. */ #define PARAM_SET_P(ENUM) \ - (compiler_params[(int) ENUM].set) + ((bool) compiler_params[(int) ENUM].set) /* Macros for the various parameters. */ #define STRUCT_REORG_COLD_STRUCT_RATIO \ Index: toplev.c =================================================================== --- toplev.c (revision 165189) +++ toplev.c (working copy) @@ -1692,6 +1692,7 @@ general_init (const char *argv0) /* Register the language-independent parameters. */ add_params (lang_independent_params, LAST_PARAM); + targetm.target_option.default_params (); /* This must be done after add_params but before argument processing. */ init_ggc_heuristics(); Index: opts.c =================================================================== --- opts.c (revision 165189) +++ opts.c (working copy) @@ -669,11 +669,11 @@ init_options_once (void) /* Save initial values of parameters we reset. */ initial_min_crossjump_insns - = compiler_params[PARAM_MIN_CROSSJUMP_INSNS].value; + = PARAM_VALUE (PARAM_MIN_CROSSJUMP_INSNS); initial_max_fields_for_field_sensitive - = compiler_params[PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE].value; + = PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE); initial_loop_invariant_max_bbs_in_loop - = compiler_params[PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP].value; + = PARAM_VALUE (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP); } /* Initialize OPTS and OPTS_SET before using them in parsing options. */ @@ -853,12 +853,12 @@ default_options_optimization (struct gcc flag_ipa_sra = opt2; /* Track fields in field-sensitive alias analysis. */ - set_param_value ("max-fields-for-field-sensitive", - (opt2) ? 100 : initial_max_fields_for_field_sensitive); + maybe_set_param_value (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE, + opt2 ? 100 : initial_max_fields_for_field_sensitive); /* For -O1 only do loop invariant motion for very small loops. */ - set_param_value ("loop-invariant-max-bbs-in-loop", - (opt2) ? initial_loop_invariant_max_bbs_in_loop : 1000); + maybe_set_param_value (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP, + opt2 ? initial_loop_invariant_max_bbs_in_loop : 1000); /* -O3 optimizations. */ opt3 = (optimize >= 3); @@ -891,10 +891,11 @@ default_options_optimization (struct gcc optimize = 2; /* We want to crossjump as much as possible. */ - set_param_value ("min-crossjump-insns", 1); + maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, 1); } else - set_param_value ("min-crossjump-insns", initial_min_crossjump_insns); + maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, + initial_min_crossjump_insns); /* -Ofast adds optimizations to -O3. */ if (ofast) @@ -1114,10 +1115,8 @@ finish_options (struct gcc_options *opts if (flag_conserve_stack) { - if (!PARAM_SET_P (PARAM_LARGE_STACK_FRAME)) - PARAM_VALUE (PARAM_LARGE_STACK_FRAME) = 100; - if (!PARAM_SET_P (PARAM_STACK_FRAME_GROWTH)) - PARAM_VALUE (PARAM_STACK_FRAME_GROWTH) = 40; + maybe_set_param_value (PARAM_LARGE_STACK_FRAME, 100); + maybe_set_param_value (PARAM_STACK_FRAME_GROWTH, 40); } if (flag_wpa || flag_ltrans) { Index: ggc-common.c =================================================================== --- ggc-common.c (revision 165189) +++ ggc-common.c (working copy) @@ -857,8 +857,8 @@ void init_ggc_heuristics (void) { #if !defined ENABLE_GC_CHECKING && !defined ENABLE_GC_ALWAYS_COLLECT - set_param_value ("ggc-min-expand", ggc_min_expand_heuristic ()); - set_param_value ("ggc-min-heapsize", ggc_min_heapsize_heuristic ()); + set_default_param_value (GGC_MIN_EXPAND, ggc_min_expand_heuristic ()); + set_default_param_value (GGC_MIN_HEAPSIZE, ggc_min_heapsize_heuristic ()); #endif } Index: config/s390/s390.c =================================================================== --- config/s390/s390.c (revision 165189) +++ config/s390/s390.c (working copy) @@ -1687,30 +1687,22 @@ s390_option_override (void) if (s390_tune == PROCESSOR_2097_Z10 || s390_tune == PROCESSOR_2817_Z196) { - if (!PARAM_SET_P (PARAM_MAX_UNROLLED_INSNS)) - set_param_value ("max-unrolled-insns", 100); - if (!PARAM_SET_P (PARAM_MAX_UNROLL_TIMES)) - set_param_value ("max-unroll-times", 32); - if (!PARAM_SET_P (PARAM_MAX_COMPLETELY_PEELED_INSNS)) - set_param_value ("max-completely-peeled-insns", 2000); - if (!PARAM_SET_P (PARAM_MAX_COMPLETELY_PEEL_TIMES)) - set_param_value ("max-completely-peel-times", 64); + maybe_set_param_value (PARAM_MAX_UNROLLED_INSNS, 100); + maybe_set_param_value (PARAM_MAX_UNROLL_TIMES, 32); + maybe_set_param_value (PARAM_MAX_COMPLETELY_PEELED_INSNS, 2000); + maybe_set_param_value (PARAM_MAX_COMPLETELY_PEEL_TIMES, 64); } set_param_value ("max-pending-list-length", 256); /* values for loop prefetching */ set_param_value ("l1-cache-line-size", 256); - if (!PARAM_SET_P (PARAM_L1_CACHE_SIZE)) - set_param_value ("l1-cache-size", 128); + maybe_set_param_value (PARAM_L1_CACHE_SIZE, 128); /* s390 has more than 2 levels and the size is much larger. Since we are always running virtualized assume that we only get a small part of the caches above l1. */ - if (!PARAM_SET_P (PARAM_L2_CACHE_SIZE)) - set_param_value ("l2-cache-size", 1500); - if (!PARAM_SET_P (PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO)) - set_param_value ("prefetch-min-insn-to-mem-ratio", 2); - if (!PARAM_SET_P (PARAM_SIMULTANEOUS_PREFETCHES)) - set_param_value ("simultaneous-prefetches", 6); + maybe_set_param_value (PARAM_L2_CACHE_SIZE, 1500); + maybe_set_param_value (PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO, 2); + maybe_set_param_value (PARAM_SIMULTANEOUS_PREFETCHES, 6); /* This cannot reside in s390_option_optimization since HAVE_prefetch requires the arch flags to be evaluated already. Since prefetching Index: config/spu/spu.c =================================================================== --- config/spu/spu.c (revision 165189) +++ config/spu/spu.c (working copy) @@ -151,6 +151,7 @@ char regs_ever_allocated[FIRST_PSEUDO_RE /* Prototypes and external defs. */ static void spu_option_override (void); static void spu_option_optimization (int, int); +static void spu_option_default_params (void); static void spu_init_builtins (void); static tree spu_builtin_decl (unsigned, bool); static bool spu_scalar_mode_supported_p (enum machine_mode mode); @@ -482,6 +483,9 @@ static const struct attribute_spec spu_a #undef TARGET_OPTION_OPTIMIZATION #define TARGET_OPTION_OPTIMIZATION spu_option_optimization +#undef TARGET_OPTION_DEFAULT_PARAMS +#define TARGET_OPTION_DEFAULT_PARAMS spu_option_default_params + #undef TARGET_EXCEPT_UNWIND_INFO #define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info @@ -490,23 +494,27 @@ struct gcc_target targetm = TARGET_INITI static void spu_option_optimization (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED) { - /* Override some of the default param values. With so many registers - larger values are better for these params. */ - MAX_PENDING_LIST_LENGTH = 128; - /* With so many registers this is better on by default. */ flag_rename_registers = 1; } +/* Implement TARGET_OPTION_DEFAULT_PARAMS. */ +static void +spu_option_default_params (void) +{ + /* Override some of the default param values. With so many registers + larger values are better for these params. */ + set_default_param_value (PARAM_MAX_PENDING_LIST_LENGTH, 128); +} + /* Implement TARGET_OPTION_OVERRIDE. */ static void spu_option_override (void) { /* Small loops will be unpeeled at -O3. For SPU it is more important to keep code small by default. */ - if (!flag_unroll_loops && !flag_peel_loops - && !PARAM_SET_P (PARAM_MAX_COMPLETELY_PEEL_TIMES)) - PARAM_VALUE (PARAM_MAX_COMPLETELY_PEEL_TIMES) = 1; + if (!flag_unroll_loops && !flag_peel_loops) + maybe_set_param_value (PARAM_MAX_COMPLETELY_PEEL_TIMES, 1); flag_omit_frame_pointer = 1; Index: config/sparc/sparc.c =================================================================== --- config/sparc/sparc.c (revision 165189) +++ config/sparc/sparc.c (working copy) @@ -916,21 +916,19 @@ sparc_option_override (void) target_flags |= MASK_LONG_DOUBLE_128; #endif - if (!PARAM_SET_P (PARAM_SIMULTANEOUS_PREFETCHES)) - set_param_value ("simultaneous-prefetches", - ((sparc_cpu == PROCESSOR_ULTRASPARC - || sparc_cpu == PROCESSOR_NIAGARA - || sparc_cpu == PROCESSOR_NIAGARA2) - ? 2 - : (sparc_cpu == PROCESSOR_ULTRASPARC3 - ? 8 : 3))); - if (!PARAM_SET_P (PARAM_L1_CACHE_LINE_SIZE)) - set_param_value ("l1-cache-line-size", - ((sparc_cpu == PROCESSOR_ULTRASPARC - || sparc_cpu == PROCESSOR_ULTRASPARC3 - || sparc_cpu == PROCESSOR_NIAGARA - || sparc_cpu == PROCESSOR_NIAGARA2) - ? 64 : 32)); + maybe_set_param_value (PARAM_SIMULTANEOUS_PREFETCHES, + ((sparc_cpu == PROCESSOR_ULTRASPARC + || sparc_cpu == PROCESSOR_NIAGARA + || sparc_cpu == PROCESSOR_NIAGARA2) + ? 2 + : (sparc_cpu == PROCESSOR_ULTRASPARC3 + ? 8 : 3))); + maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE, + ((sparc_cpu == PROCESSOR_ULTRASPARC + || sparc_cpu == PROCESSOR_ULTRASPARC3 + || sparc_cpu == PROCESSOR_NIAGARA + || sparc_cpu == PROCESSOR_NIAGARA2) + ? 64 : 32)); } /* Miscellaneous utilities. */ Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 165189) +++ config/i386/i386.c (working copy) @@ -3632,15 +3632,11 @@ ix86_option_override_internal (bool main if (!TARGET_SCHEDULE) flag_schedule_insns_after_reload = flag_schedule_insns = 0; - if (!PARAM_SET_P (PARAM_SIMULTANEOUS_PREFETCHES)) - set_param_value ("simultaneous-prefetches", - ix86_cost->simultaneous_prefetches); - if (!PARAM_SET_P (PARAM_L1_CACHE_LINE_SIZE)) - set_param_value ("l1-cache-line-size", ix86_cost->prefetch_block); - if (!PARAM_SET_P (PARAM_L1_CACHE_SIZE)) - set_param_value ("l1-cache-size", ix86_cost->l1_cache_size); - if (!PARAM_SET_P (PARAM_L2_CACHE_SIZE)) - set_param_value ("l2-cache-size", ix86_cost->l2_cache_size); + maybe_set_param_value (PARAM_SIMULTANEOUS_PREFETCHES, + ix86_cost->simultaneous_prefetches); + maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE, ix86_cost->prefetch_block); + maybe_set_param_value (PARAM_L1_CACHE_SIZE, ix86_cost->l1_cache_size); + maybe_set_param_value (PARAM_L2_CACHE_SIZE, ix86_cost->l2_cache_size); /* Enable sw prefetching at -O3 for CPUS that prefetching is helpful. */ if (flag_prefetch_loop_arrays < 0 Index: config/sh/sh.c =================================================================== --- config/sh/sh.c (revision 165189) +++ config/sh/sh.c (working copy) @@ -184,6 +184,7 @@ static rtx gen_block_redirect (rtx, int, static void sh_reorg (void); static void sh_option_override (void); static void sh_option_optimization (int, int); +static void sh_option_default_params (void); static void output_stack_adjust (int, rtx, int, HARD_REG_SET *, bool); static rtx frame_insn (rtx); static rtx push (int); @@ -342,6 +343,8 @@ static const struct attribute_spec sh_at #define TARGET_OPTION_OVERRIDE sh_option_override #undef TARGET_OPTION_OPTIMIZATION #define TARGET_OPTION_OPTIMIZATION sh_option_optimization +#undef TARGET_OPTION_DEFAULT_PARAMS +#define TARGET_OPTION_DEFAULT_PARAMS sh_option_default_params #undef TARGET_PRINT_OPERAND #define TARGET_PRINT_OPERAND sh_print_operand @@ -731,8 +734,13 @@ sh_option_optimization (int level, int s the user explicitly requested this to be on or off. */ if (flag_schedule_insns > 0) flag_schedule_insns = 2; +} - set_param_value ("simultaneous-prefetches", 2); +/* Implement TARGET_OPTION_DEFAULT_PARAMS. */ +static void +sh_option_default_params (void) +{ + set_default_param_value (PARAM_SIMULTANEOUS_PREFETCHES, 2); } /* Implement TARGET_OPTION_OVERRIDE macro. Validate and override Index: config/ia64/ia64.c =================================================================== --- config/ia64/ia64.c (revision 165189) +++ config/ia64/ia64.c (working copy) @@ -203,6 +203,7 @@ static rtx gen_fr_restore_x (rtx, rtx, r 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); static void ia64_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, @@ -372,6 +373,8 @@ static const struct attribute_spec ia64_ #define TARGET_OPTION_OVERRIDE ia64_option_override #undef TARGET_OPTION_OPTIMIZATION #define TARGET_OPTION_OPTIMIZATION ia64_option_optimization +#undef TARGET_OPTION_DEFAULT_PARAMS +#define TARGET_OPTION_DEFAULT_PARAMS ia64_option_default_params #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE ia64_output_function_prologue @@ -10839,15 +10842,20 @@ ia64_option_optimization (int level ATTR #ifdef SUBTARGET_OPTIMIZATION_OPTIONS SUBTARGET_OPTIMIZATION_OPTIONS; #endif +} +/* Implement TARGET_OPTION_DEFAULT_PARAMS. */ +static void +ia64_option_default_params (void) +{ /* Let the scheduler form additional regions. */ - set_param_value ("max-sched-extend-regions-iters", 2); + set_default_param_value (PARAM_MAX_SCHED_EXTEND_REGIONS_ITERS, 2); /* Set the default values for cache-related parameters. */ - set_param_value ("simultaneous-prefetches", 6); - set_param_value ("l1-cache-line-size", 32); + set_default_param_value (PARAM_SIMULTANEOUS_PREFETCHES, 6); + set_default_param_value (PARAM_L1_CACHE_LINE_SIZE, 32); - set_param_value("sched-mem-true-dep-cost", 4); + set_default_param_value (PARAM_SCHED_MEM_TRUE_DEP_COST, 4); } /* HP-UX version_id attribute. Index: config/rs6000/rs6000.c =================================================================== --- config/rs6000/rs6000.c (revision 165189) +++ config/rs6000/rs6000.c (working copy) @@ -1137,6 +1137,7 @@ static rtx altivec_expand_vec_ext_builti static int get_element_number (tree, tree); static void rs6000_option_override (void); static void rs6000_option_optimization (int, int); +static void rs6000_option_default_params (void); static bool rs6000_handle_option (size_t, const char *, int); static void rs6000_parse_tls_size_option (void); static void rs6000_parse_yes_no_option (const char *, const char *, int *); @@ -1604,6 +1605,9 @@ static const struct attribute_spec rs600 #undef TARGET_OPTION_OPTIMIZATION #define TARGET_OPTION_OPTIMIZATION rs6000_option_optimization +#undef TARGET_OPTION_DEFAULT_PARAMS +#define TARGET_OPTION_DEFAULT_PARAMS rs6000_option_default_params + #undef TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION #define TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION \ rs6000_builtin_vectorized_function @@ -3154,15 +3158,12 @@ rs6000_option_override_internal (const c gcc_unreachable (); } - if (!PARAM_SET_P (PARAM_SIMULTANEOUS_PREFETCHES)) - set_param_value ("simultaneous-prefetches", - rs6000_cost->simultaneous_prefetches); - if (!PARAM_SET_P (PARAM_L1_CACHE_SIZE)) - set_param_value ("l1-cache-size", rs6000_cost->l1_cache_size); - if (!PARAM_SET_P (PARAM_L1_CACHE_LINE_SIZE)) - set_param_value ("l1-cache-line-size", rs6000_cost->cache_line_size); - if (!PARAM_SET_P (PARAM_L2_CACHE_SIZE)) - set_param_value ("l2-cache-size", rs6000_cost->l2_cache_size); + maybe_set_param_value (PARAM_SIMULTANEOUS_PREFETCHES, + rs6000_cost->simultaneous_prefetches); + maybe_set_param_value (PARAM_L1_CACHE_SIZE, rs6000_cost->l1_cache_size); + maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE, + rs6000_cost->cache_line_size); + maybe_set_param_value (PARAM_L2_CACHE_SIZE, rs6000_cost->l2_cache_size); /* If using typedef char *va_list, signal that __builtin_va_start (&ap, 0) can be optimized to ap = __builtin_next_arg (0). */ @@ -3681,9 +3682,6 @@ rs6000_option_optimization (int level AT avoid calling them when that's the only reason we would. */ flag_errno_math = 0; - /* Double growth factor to counter reduced min jump length. */ - set_param_value ("max-grow-copy-bb-insns", 16); - /* Enable section anchors by default. Skip section anchors for Objective C and Objective C++ until front-ends fixed. */ @@ -3691,6 +3689,15 @@ rs6000_option_optimization (int level AT flag_section_anchors = 2; } +/* Implement TARGET_OPTION_DEFAULT_PARAMS. */ + +static void +rs6000_option_default_params (void) +{ + /* Double growth factor to counter reduced min jump length. */ + set_default_param_value (PARAM_MAX_GROW_COPY_BB_INSNS, 16); +} + static enum fpu_type_t rs6000_parse_fpu_option (const char *option) { Index: config/picochip/picochip.c =================================================================== --- config/picochip/picochip.c (revision 165189) +++ config/picochip/picochip.c (working copy) @@ -342,10 +342,10 @@ picochip_option_override (void) /* If we are optimizing for stack, dont let inliner to inline functions that could potentially increase stack size.*/ if (flag_conserve_stack) - { - PARAM_VALUE (PARAM_LARGE_STACK_FRAME) = 0; - PARAM_VALUE (PARAM_STACK_FRAME_GROWTH) = 0; - } + { + maybe_set_param_value (PARAM_LARGE_STACK_FRAME, 0); + maybe_set_param_value (PARAM_STACK_FRAME_GROWTH, 0); + } /* Turn off the elimination of unused types. The elaborator generates various interesting types to represent constants, Index: config/arm/arm.c =================================================================== --- config/arm/arm.c (revision 165189) +++ config/arm/arm.c (working copy) @@ -1953,13 +1953,12 @@ arm_option_override (void) flag_reorder_blocks = 1; } - if (!PARAM_SET_P (PARAM_GCSE_UNRESTRICTED_COST) - && flag_pic) + if (flag_pic) /* Hoisting PIC address calculations more aggressively provides a small, but measurable, size reduction for PIC code. Therefore, we decrease the bar for unrestricted expression hoisting to the cost of PIC address calculation, which is 2 instructions. */ - set_param_value ("gcse-unrestricted-cost", 2); + maybe_set_param_value (PARAM_GCSE_UNRESTRICTED_COST, 2); /* Register global variables with the garbage collector. */ arm_add_gc_roots ();