summaryrefslogtreecommitdiff
path: root/gcc/opts-common.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2011-05-16 22:26:29 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2011-05-16 22:26:29 +0100
commit8023568eaa1a93e7782e6854d21520374862034c (patch)
tree6301f581d3bace8b34ccc8f95eae30bd0d14b784 /gcc/opts-common.c
parentc22cb03b643d263a60440a93c1b5fca3db600eae (diff)
opts-common.c (opt_enum_arg_to_value): New.
* opts-common.c (opt_enum_arg_to_value): New. * opts.h (opt_enum_arg_to_value): Declare. * config/i386/i386.opt (fpmath): Remove. (mfpmath=): Use Enum, Init and Save. (fpmath_unit): New Enum and EnumValue entries. * config/i386/i386-c.c (ix86_pragma_target_parse): Update field name for function fpmath state. * config/i386/i386-opts.h (enum fpmath_unit): Move from i386.h. * config/i386/i386.c: Include diagnostic.h. (ix86_fpmath, IX86_FUNCTION_SPECIFIC_FPMATH): Remove. (ix86_target_string): Take enum fpmath_unit value instead of string. (ix86_debug_options): Update call to ix86_target_string. (ix86_option_override_internal): Don't process fpmath strings here. (x86_function_specific_save, ix86_function_specific_restore): Don't handle fpmath state specially. (ix86_function_specific_print): Pass fpmath state to ix86_target_string instead of printing in this function. (ix86_valid_target_attribute_inner_p): Take gcc_options pointer. Handle enum attributes. (IX86_ATTR_ENUM, ix86_opt_enum): New. (ix86_valid_target_attribute_tree): Update option_strings handling. Handle fpmath as enum option. (ix86_can_inline_p): Update field names for function fpmath state. (ix86_expand_builtin): Update call to ix86_target_string. * config/i386/i386.h (enum fpmath_unit): Move to i386-opts.h. (ix86_fpmath): Remove. * config/i386/t-i386 (i386.o): Update dependencies. From-SVN: r173809
Diffstat (limited to 'gcc/opts-common.c')
-rw-r--r--gcc/opts-common.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 089d8199d50..973dd7e97e7 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -212,6 +212,22 @@ enum_arg_to_value (const struct cl_enum_arg *enum_args,
return false;
}
+/* Look up ARG in the enum used by option OPT_INDEX for language
+ LANG_MASK, returning true and storing the value in *VALUE if found,
+ and returning false without modifying *VALUE if not found. */
+
+bool
+opt_enum_arg_to_value (size_t opt_index, const char *arg, int *value,
+ unsigned int lang_mask)
+{
+ const struct cl_option *option = &cl_options[opt_index];
+
+ gcc_assert (option->var_type == CLVC_ENUM);
+
+ return enum_arg_to_value (cl_enums[option->var_enum].values, arg,
+ value, lang_mask);
+}
+
/* Look of VALUE in ENUM_ARGS for language LANG_MASK and store the
corresponding string in *ARGP, returning true if the found string
was marked as canonical, false otherwise. If VALUE is not found