aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-10-11 13:28:40 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2010-10-11 13:28:40 +0100
commit128dc8e23075f70721ff1cbe3294021e7dd82834 (patch)
tree10941206f59ba4ef8b1a814126f81d1e02f511d4 /gcc
parent4907769827b246d80145601c6fa5caf84f04f941 (diff)
downloadgcc-128dc8e23075f70721ff1cbe3294021e7dd82834.zip
gcc-128dc8e23075f70721ff1cbe3294021e7dd82834.tar.gz
gcc-128dc8e23075f70721ff1cbe3294021e7dd82834.tar.bz2
params.c (set_param_value_internal): New.
* 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. From-SVN: r165303
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog46
-rw-r--r--gcc/config/arm/arm.c5
-rw-r--r--gcc/config/i386/i386.c14
-rw-r--r--gcc/config/ia64/ia64.c16
-rw-r--r--gcc/config/picochip/picochip.c8
-rw-r--r--gcc/config/rs6000/rs6000.c31
-rw-r--r--gcc/config/s390/s390.c24
-rw-r--r--gcc/config/sh/sh.c10
-rw-r--r--gcc/config/sparc/sparc.c28
-rw-r--r--gcc/config/spu/spu.c22
-rw-r--r--gcc/doc/tm.texi4
-rw-r--r--gcc/doc/tm.texi.in2
-rw-r--r--gcc/ggc-common.c4
-rw-r--r--gcc/opts.c25
-rw-r--r--gcc/params.c42
-rw-r--r--gcc/params.h21
-rw-r--r--gcc/target.def7
-rw-r--r--gcc/toplev.c1
18 files changed, 214 insertions, 96 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fd0bc367..19312f3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,49 @@
+2010-10-11 Joseph Myers <joseph@codesourcery.com>
+
+ * 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.
+
2010-10-11 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/45902
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 8ad312e..855f39e 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -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 ();
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index f6c4eb4..4db819e 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3632,15 +3632,11 @@ ix86_option_override_internal (bool main_args_p)
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
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index d272860..f7489f9 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -203,6 +203,7 @@ 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);
static void ia64_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
@@ -372,6 +373,8 @@ static const struct attribute_spec ia64_attribute_table[] =
#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 ATTRIBUTE_UNUSED,
#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.
diff --git a/gcc/config/picochip/picochip.c b/gcc/config/picochip/picochip.c
index 9656583..b3b3e3b 100644
--- a/gcc/config/picochip/picochip.c
+++ b/gcc/config/picochip/picochip.c
@@ -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,
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 91b2612..cd1c8cc 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1137,6 +1137,7 @@ static rtx altivec_expand_vec_ext_builtin (tree, rtx);
static int get_element_number (tree, tree);
static void rs6000_option_override (void);
static void rs6000_option_optimization (int, int);
+static 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 rs6000_attribute_table[] =
#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 char *default_cpu)
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 ATTRIBUTE_UNUSED,
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 ATTRIBUTE_UNUSED,
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)
{
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index e2d3851..04fcee2 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -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
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 1c201bb..53b70ec 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -184,6 +184,7 @@ 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_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_attribute_table[] =
#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 size)
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
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 44145ef..6807301 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -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. */
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 36c48ee..9bc78e8 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -151,6 +151,7 @@ char regs_ever_allocated[FIRST_PSEUDO_REGISTER];
/* Prototypes and external defs. */
static void spu_option_override (void);
static void spu_option_optimization (int, int);
+static void spu_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_attribute_table[] =
#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_INITIALIZER;
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;
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index faa7250..f98176a 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -812,6 +812,10 @@ this hook!} The debugging options are not supposed to alter the
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
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index cdd9a22..41d5aee 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -812,6 +812,8 @@ this hook!} The debugging options are not supposed to alter the
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
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 5b66bb4..cf38933 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -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
}
diff --git a/gcc/opts.c b/gcc/opts.c
index efee21e..38f2faa 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -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_options *opts,
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_options *opts,
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, struct gcc_options *opts_set)
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)
{
diff --git a/gcc/params.c b/gcc/params.c
index cec5751..666913a 100644
--- a/gcc/params.c
+++ b/gcc/params.c
@@ -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 <mark@codesourcery.com>.
@@ -51,6 +51,21 @@ add_params (const param_info params[], size_t n)
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 value)
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 value)
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. */
diff --git a/gcc/params.h b/gcc/params.h
index aa96c81..b924e78 100644
--- a/gcc/params.h
+++ b/gcc/params.h
@@ -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 <mark@codesourcery.com>.
@@ -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 \
diff --git a/gcc/target.def b/gcc/target.def
index 266870a..9d5fe32 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -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_"
diff --git a/gcc/toplev.c b/gcc/toplev.c
index a6c13f1..21d23fd 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -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();