* target.def (target_option.init_struct): New hook.
* doc/tm.texi.in (TARGET_OPTION_INIT_STRUCT): New @hook.
* doc/tm.texi: Regenerate.
* hooks.c (hook_void_gcc_optionsp): New.
* hooks.h (hook_void_gcc_optionsp): Declare.
* langhooks-def.h (lhd_init_options_struct): Remove.
(LANG_HOOKS_INIT_OPTIONS_STRUCT): Define to
hook_void_gcc_optionsp.
* langhooks.c (lhd_init_options_struct): Remove.
* opts.c (init_options_struct): Also call
targetm.target_option.init_struct.
* config/i386/i386.c (ix86_option_init_struct,
TARGET_OPTION_INIT_STRUCT): New.
(ix86_option_optimization): Move some settings to
ix86_option_init_struct.
* config/pdp11/pdp11.c (pdp11_option_init_struct,
TARGET_OPTION_INIT_STRUCT): New.
(pdp11_option_optimization): Move some settings to
pdp11_option_init_struct.
* config/rs6000/rs6000.c (rs6000_option_optimization): Replace by
rs6000_option_init_struct. Use options structure pointer.
(TARGET_OPTION_OPTIMIZATION): Replace by
TARGET_OPTION_INIT_STRUCT.
* config/s390/s390.c (s390_option_init_struct,
TARGET_OPTION_INIT_STRUCT): New.
(s390_option_optimization): Don't set
flag_asynchronous_unwind_tables here.
* config/sh/sh.c (sh_option_init_struct,
TARGET_OPTION_INIT_STRUCT): New.
(sh_option_optimization): Don't set flag_finite_math_only here.
* config/spu/spu.c (spu_option_optimization): Replace by
spu_option_optimization. Use options structure pointer.
(TARGET_OPTION_OPTIMIZATION): Replace by
TARGET_OPTION_INIT_STRUCT.
From-SVN: r165519
+2010-10-15 Joseph Myers <joseph@codesourcery.com>
+
+ * target.def (target_option.init_struct): New hook.
+ * doc/tm.texi.in (TARGET_OPTION_INIT_STRUCT): New @hook.
+ * doc/tm.texi: Regenerate.
+ * hooks.c (hook_void_gcc_optionsp): New.
+ * hooks.h (hook_void_gcc_optionsp): Declare.
+ * langhooks-def.h (lhd_init_options_struct): Remove.
+ (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define to
+ hook_void_gcc_optionsp.
+ * langhooks.c (lhd_init_options_struct): Remove.
+ * opts.c (init_options_struct): Also call
+ targetm.target_option.init_struct.
+ * config/i386/i386.c (ix86_option_init_struct,
+ TARGET_OPTION_INIT_STRUCT): New.
+ (ix86_option_optimization): Move some settings to
+ ix86_option_init_struct.
+ * config/pdp11/pdp11.c (pdp11_option_init_struct,
+ TARGET_OPTION_INIT_STRUCT): New.
+ (pdp11_option_optimization): Move some settings to
+ pdp11_option_init_struct.
+ * config/rs6000/rs6000.c (rs6000_option_optimization): Replace by
+ rs6000_option_init_struct. Use options structure pointer.
+ (TARGET_OPTION_OPTIMIZATION): Replace by
+ TARGET_OPTION_INIT_STRUCT.
+ * config/s390/s390.c (s390_option_init_struct,
+ TARGET_OPTION_INIT_STRUCT): New.
+ (s390_option_optimization): Don't set
+ flag_asynchronous_unwind_tables here.
+ * config/sh/sh.c (sh_option_init_struct,
+ TARGET_OPTION_INIT_STRUCT): New.
+ (sh_option_optimization): Don't set flag_finite_math_only here.
+ * config/spu/spu.c (spu_option_optimization): Replace by
+ spu_option_optimization. Use options structure pointer.
+ (TARGET_OPTION_OPTIMIZATION): Replace by
+ TARGET_OPTION_INIT_STRUCT.
+
2010-10-14 Michael Meissner <meissner@linux.vnet.ibm.com>
* doc/md.texi (Standard Names): Add fma@var{m}4 documentation.
flag_schedule_insns = 0;
#endif
- if (TARGET_MACHO)
- /* The Darwin libraries never set errno, so we might as well
- avoid calling them when that's the only reason we would. */
- flag_errno_math = 0;
-
/* The default values of these switches depend on the TARGET_64BIT
that is not known at this moment. Mark these values with 2 and
let user the to override these. In case there is no command line
if (level > 1)
flag_zee = 2;
- flag_pcc_struct_return = 2;
- flag_asynchronous_unwind_tables = 2;
- flag_vect_cost_model = 1;
#ifdef SUBTARGET_OPTIMIZATION_OPTIONS
SUBTARGET_OPTIMIZATION_OPTIONS;
#endif
}
+/* Implement TARGET_OPTION_INIT_STRUCT. */
+
+static void
+ix86_option_init_struct (struct gcc_options *opts)
+{
+ if (TARGET_MACHO)
+ /* The Darwin libraries never set errno, so we might as well
+ avoid calling them when that's the only reason we would. */
+ opts->x_flag_errno_math = 0;
+
+ opts->x_flag_pcc_struct_return = 2;
+ opts->x_flag_asynchronous_unwind_tables = 2;
+ opts->x_flag_vect_cost_model = 1;
+}
+
/* Decide whether we must probe the stack before any space allocation
on this target. It's essentially TARGET_STACK_PROBE except when
-fstack-check causes the stack to be already probed differently. */
#define TARGET_OPTION_OVERRIDE ix86_option_override
#undef TARGET_OPTION_OPTIMIZATION
#define TARGET_OPTION_OPTIMIZATION ix86_option_optimization
+#undef TARGET_OPTION_INIT_STRUCT
+#define TARGET_OPTION_INIT_STRUCT ix86_option_init_struct
#undef TARGET_REGISTER_MOVE_COST
#define TARGET_REGISTER_MOVE_COST ix86_register_move_cost
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 *);
static bool pdp11_assemble_integer (rtx, unsigned int, int);
#define TARGET_HANDLE_OPTION pdp11_handle_option
#undef TARGET_OPTION_OPTIMIZATION
#define TARGET_OPTION_OPTIMIZATION pdp11_option_optimization
+#undef TARGET_OPTION_INIT_STRUCT
+#define TARGET_OPTION_INIT_STRUCT pdp11_option_init_struct
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS pdp11_rtx_costs
static void
pdp11_option_optimization (int level, int size ATTRIBUTE_UNUSED)
{
- flag_finite_math_only = 0;
- flag_trapping_math = 0;
- flag_signaling_nans = 0;
if (level >= 3)
{
flag_omit_frame_pointer = 1;
}
}
+/* Implement TARGET_OPTION_INIT_STRUCT. */
+
+static void
+pdp11_option_init_struct (struct gcc_options *opts)
+{
+ opts->x_flag_finite_math_only = 0;
+ opts->x_flag_trapping_math = 0;
+ opts->x_flag_signaling_nans = 0;
+}
+
/* Nonzero if OP is a valid second operand for an arithmetic insn. */
int
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_init_struct (struct gcc_options *);
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);
#undef TARGET_OPTION_OVERRIDE
#define TARGET_OPTION_OVERRIDE rs6000_option_override
-#undef TARGET_OPTION_OPTIMIZATION
-#define TARGET_OPTION_OPTIMIZATION rs6000_option_optimization
+#undef TARGET_OPTION_INIT_STRUCT
+#define TARGET_OPTION_INIT_STRUCT rs6000_option_init_struct
#undef TARGET_OPTION_DEFAULT_PARAMS
#define TARGET_OPTION_DEFAULT_PARAMS rs6000_option_default_params
error ("bad value %qs for -mtls-size switch", rs6000_tls_size_string);
}
+/* Implement TARGET_OPTION_INIT_STRUCT. */
+
static void
-rs6000_option_optimization (int level ATTRIBUTE_UNUSED,
- int size ATTRIBUTE_UNUSED)
+rs6000_option_init_struct (struct gcc_options *opts)
{
if (DEFAULT_ABI == ABI_DARWIN)
/* The Darwin libraries never set errno, so we might as well
avoid calling them when that's the only reason we would. */
- flag_errno_math = 0;
+ opts->x_flag_errno_math = 0;
/* Enable section anchors by default. */
if (!TARGET_MACHO)
- flag_section_anchors = 2;
+ opts->x_flag_section_anchors = 2;
}
/* Implement TARGET_OPTION_DEFAULT_PARAMS. */
/* ??? There are apparently still problems with -fcaller-saves. */
flag_caller_saves = 0;
- /* By default, always emit DWARF-2 unwind info. This allows debugging
- without maintaining a stack frame back-chain. */
- flag_asynchronous_unwind_tables = 1;
-
/* Use MVCLE instructions to decrease code size if requested. */
if (size != 0)
target_flags |= MASK_MVCLE;
}
+/* Implement TARGET_OPTION_INIT_STRUCT. */
+
+static void
+s390_option_init_struct (struct gcc_options *opts)
+{
+ /* By default, always emit DWARF-2 unwind info. This allows debugging
+ without maintaining a stack frame back-chain. */
+ opts->x_flag_asynchronous_unwind_tables = 1;
+}
+
/* Return true if ARG is the name of a processor. Set *TYPE and *FLAGS
to the associated processor_type and processor_flags if so. */
#undef TARGET_OPTION_OPTIMIZATION
#define TARGET_OPTION_OPTIMIZATION s390_option_optimization
+#undef TARGET_OPTION_INIT_STRUCT
+#define TARGET_OPTION_INIT_STRUCT s390_option_init_struct
+
#undef TARGET_ENCODE_SECTION_INFO
#define TARGET_ENCODE_SECTION_INFO s390_encode_section_info
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);
static rtx frame_insn (rtx);
#define TARGET_OPTION_OVERRIDE sh_option_override
#undef TARGET_OPTION_OPTIMIZATION
#define TARGET_OPTION_OPTIMIZATION sh_option_optimization
+#undef TARGET_OPTION_INIT_STRUCT
+#define TARGET_OPTION_INIT_STRUCT sh_option_init_struct
#undef TARGET_OPTION_DEFAULT_PARAMS
#define TARGET_OPTION_DEFAULT_PARAMS sh_option_default_params
if (!size)
target_flags |= MASK_SAVE_ALL_TARGET_REGS;
}
- /* Likewise, we can't meaningfully test TARGET_SH2E / TARGET_IEEE
- here, so leave it to TARGET_OPTION_OVERRIDE to set
- flag_finite_math_only. We set it to 2 here so we know if the user
- explicitly requested this to be on or off. */
- flag_finite_math_only = 2;
/* If flag_schedule_insns is 1, we set it to 2 here so we know if
the user explicitly requested this to be on or off. */
if (flag_schedule_insns > 0)
flag_schedule_insns = 2;
}
+/* Implement TARGET_OPTION_INIT_STRUCT. */
+static void
+sh_option_init_struct (struct gcc_options *opts)
+{
+ /* We can't meaningfully test TARGET_SH2E / TARGET_IEEE
+ here, so leave it to TARGET_OPTION_OVERRIDE to set
+ flag_finite_math_only. We set it to 2 here so we know if the user
+ explicitly requested this to be on or off. */
+ opts->x_flag_finite_math_only = 2;
+}
+
/* Implement TARGET_OPTION_DEFAULT_PARAMS. */
static void
sh_option_default_params (void)
/* Prototypes and external defs. */
static void spu_option_override (void);
-static void spu_option_optimization (int, int);
+static void spu_option_init_struct (struct gcc_options *opts);
static void spu_option_default_params (void);
static void spu_init_builtins (void);
static tree spu_builtin_decl (unsigned, bool);
#undef TARGET_OPTION_OVERRIDE
#define TARGET_OPTION_OVERRIDE spu_option_override
-#undef TARGET_OPTION_OPTIMIZATION
-#define TARGET_OPTION_OPTIMIZATION spu_option_optimization
+#undef TARGET_OPTION_INIT_STRUCT
+#define TARGET_OPTION_INIT_STRUCT spu_option_init_struct
#undef TARGET_OPTION_DEFAULT_PARAMS
#define TARGET_OPTION_DEFAULT_PARAMS spu_option_default_params
struct gcc_target targetm = TARGET_INITIALIZER;
static void
-spu_option_optimization (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
+spu_option_init_struct (struct gcc_options *opts)
{
/* With so many registers this is better on by default. */
- flag_rename_registers = 1;
+ opts->x_flag_rename_registers = 1;
}
/* Implement TARGET_OPTION_DEFAULT_PARAMS. */
generated code.
@end deftypefn
+@deftypefn {Target Hook} void TARGET_OPTION_INIT_STRUCT (struct gcc_options *@var{opts})
+Set target-dependent initial values of fields in @var{opts}.
+@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
generated code.
@end deftypefn
+@hook TARGET_OPTION_INIT_STRUCT
+
@hook TARGET_OPTION_DEFAULT_PARAMS
@hook TARGET_HELP
hook_void_rtx_int (rtx insn ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
}
+
+/* Generic hook that takes a struct gcc_options * and returns void. */
+
+void
+hook_void_gcc_optionsp (struct gcc_options *opts ATTRIBUTE_UNUSED)
+{
+}
extern void hook_void_tree (tree);
extern void hook_void_tree_treeptr (tree, tree *);
extern void hook_void_int_int (int, int);
+extern void hook_void_gcc_optionsp (struct gcc_options *);
extern int hook_int_const_tree_0 (const_tree);
extern int hook_int_const_tree_const_tree_1 (const_tree, const_tree);
/* Declarations of default tree inlining hooks. */
extern void lhd_initialize_diagnostics (diagnostic_context *);
-extern void lhd_init_options_struct (struct gcc_options *);
extern void lhd_init_options (unsigned int,
struct cl_decoded_option *);
extern bool lhd_complain_wrong_lang_p (const struct cl_option *);
#define LANG_HOOKS_FINISH lhd_do_nothing
#define LANG_HOOKS_PARSE_FILE lhd_do_nothing_i
#define LANG_HOOKS_OPTION_LANG_MASK hook_uint_void_0
-#define LANG_HOOKS_INIT_OPTIONS_STRUCT lhd_init_options_struct
+#define LANG_HOOKS_INIT_OPTIONS_STRUCT hook_void_gcc_optionsp
#define LANG_HOOKS_INIT_OPTIONS lhd_init_options
#define LANG_HOOKS_INITIALIZE_DIAGNOSTICS lhd_initialize_diagnostics
#define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lhd_complain_wrong_lang_p
{
}
-/* Called to perform language-specific options initialization of OPTS. */
-void
-lhd_init_options_struct (struct gcc_options *opts ATTRIBUTE_UNUSED)
-{
-}
-
/* Called to perform language-specific options initialization. */
void
lhd_init_options (unsigned int decoded_options_count ATTRIBUTE_UNUSED,
/* Some targets have ABI-specified unwind tables. */
opts->x_flag_unwind_tables = targetm.unwind_tables_default;
+
+ /* Some targets have other target-specific initialization. */
+ targetm.target_option.init_struct (opts);
}
/* Decode command-line options to an array, like
void, (void),
hook_void_void)
+DEFHOOK
+(init_struct,
+"Set target-dependent initial values of fields in @var{opts}.",
+ void, (struct gcc_options *opts),
+ hook_void_gcc_optionsp)
+
/* Function to determine if one function can inline another function. */
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_"