Commit 8023568e by Joseph Myers Committed by Joseph Myers

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
parent c22cb03b
2011-05-16 Joseph Myers <joseph@codesourcery.com> 2011-05-16 Joseph Myers <joseph@codesourcery.com>
* 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.
2011-05-16 Joseph Myers <joseph@codesourcery.com>
PR preprocessor/48677 PR preprocessor/48677
* cppspec.c (lang_specific_driver): Set new_decoded_options[0] * cppspec.c (lang_specific_driver): Set new_decoded_options[0]
from decoded_options[0], not from itself. from decoded_options[0], not from itself.
......
...@@ -340,14 +340,14 @@ ix86_pragma_target_parse (tree args, tree pop_target) ...@@ -340,14 +340,14 @@ ix86_pragma_target_parse (tree args, tree pop_target)
ix86_target_macros_internal (prev_isa & diff_isa, ix86_target_macros_internal (prev_isa & diff_isa,
prev_arch, prev_arch,
prev_tune, prev_tune,
(enum fpmath_unit) prev_opt->fpmath, (enum fpmath_unit) prev_opt->x_ix86_fpmath,
cpp_undef); cpp_undef);
/* Define all of the macros for new options that were just turned on. */ /* Define all of the macros for new options that were just turned on. */
ix86_target_macros_internal (cur_isa & diff_isa, ix86_target_macros_internal (cur_isa & diff_isa,
cur_arch, cur_arch,
cur_tune, cur_tune,
(enum fpmath_unit) cur_opt->fpmath, (enum fpmath_unit) cur_opt->x_ix86_fpmath,
cpp_define); cpp_define);
return true; return true;
......
...@@ -47,6 +47,12 @@ enum calling_abi ...@@ -47,6 +47,12 @@ enum calling_abi
MS_ABI = 1 MS_ABI = 1
}; };
enum fpmath_unit
{
FPMATH_387 = 1,
FPMATH_SSE = 2
};
enum tls_dialect enum tls_dialect
{ {
TLS_DIALECT_GNU, TLS_DIALECT_GNU,
......
...@@ -2029,14 +2029,6 @@ enum processor_type ...@@ -2029,14 +2029,6 @@ enum processor_type
extern enum processor_type ix86_tune; extern enum processor_type ix86_tune;
extern enum processor_type ix86_arch; extern enum processor_type ix86_arch;
enum fpmath_unit
{
FPMATH_387 = 1,
FPMATH_SSE = 2
};
extern enum fpmath_unit ix86_fpmath;
/* Size of the RED_ZONE area. */ /* Size of the RED_ZONE area. */
#define RED_ZONE_SIZE 128 #define RED_ZONE_SIZE 128
/* Reserved area of the red zone for temporaries. */ /* Reserved area of the red zone for temporaries. */
......
...@@ -40,10 +40,6 @@ unsigned char arch ...@@ -40,10 +40,6 @@ unsigned char arch
TargetSave TargetSave
unsigned char tune unsigned char tune
;; -mfpath=
TargetSave
unsigned char fpmath
;; CPU schedule model ;; CPU schedule model
TargetSave TargetSave
unsigned char schedule unsigned char schedule
...@@ -170,9 +166,34 @@ Target Report Mask(FLOAT_RETURNS) Save ...@@ -170,9 +166,34 @@ Target Report Mask(FLOAT_RETURNS) Save
Return values of functions in FPU registers Return values of functions in FPU registers
mfpmath= mfpmath=
Target RejectNegative Joined Var(ix86_fpmath_string) Target RejectNegative Joined Var(ix86_fpmath) Enum(fpmath_unit) Init(FPMATH_387) Save
Generate floating point mathematics using given instruction set Generate floating point mathematics using given instruction set
Enum
Name(fpmath_unit) Type(enum fpmath_unit)
Valid arguments to -mfpmath=:
EnumValue
Enum(fpmath_unit) String(387) Value(FPMATH_387)
EnumValue
Enum(fpmath_unit) String(sse) Value(FPMATH_SSE)
EnumValue
Enum(fpmath_unit) String(387,sse) Value({(enum fpmath_unit) (FPMATH_SSE | FPMATH_387)})
EnumValue
Enum(fpmath_unit) String(387+sse) Value({(enum fpmath_unit) (FPMATH_SSE | FPMATH_387)})
EnumValue
Enum(fpmath_unit) String(sse,387) Value({(enum fpmath_unit) (FPMATH_SSE | FPMATH_387)})
EnumValue
Enum(fpmath_unit) String(sse+387) Value({(enum fpmath_unit) (FPMATH_SSE | FPMATH_387)})
EnumValue
Enum(fpmath_unit) String(both) Value({(enum fpmath_unit) (FPMATH_SSE | FPMATH_387)})
mhard-float mhard-float
Target RejectNegative Mask(80387) MaskExists Save Target RejectNegative Mask(80387) MaskExists Save
Use hardware fp Use hardware fp
......
...@@ -24,7 +24,7 @@ i386.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ ...@@ -24,7 +24,7 @@ i386.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(GGC_H) $(TARGET_H) $(TARGET_DEF_H) langhooks.h $(CGRAPH_H) \ $(GGC_H) $(TARGET_H) $(TARGET_DEF_H) langhooks.h $(CGRAPH_H) \
$(TREE_GIMPLE_H) $(DWARF2_H) $(DF_H) tm-constrs.h $(PARAMS_H) \ $(TREE_GIMPLE_H) $(DWARF2_H) $(DF_H) tm-constrs.h $(PARAMS_H) \
i386-builtin-types.inc debug.h dwarf2out.h sbitmap.h $(FIBHEAP_H) \ i386-builtin-types.inc debug.h dwarf2out.h sbitmap.h $(FIBHEAP_H) \
$(OPTS_H) $(OPTS_H) $(DIAGNOSTIC_H)
i386-c.o: $(srcdir)/config/i386/i386-c.c \ i386-c.o: $(srcdir)/config/i386/i386-c.c \
$(srcdir)/config/i386/i386-protos.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(srcdir)/config/i386/i386-protos.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \
......
...@@ -212,6 +212,22 @@ enum_arg_to_value (const struct cl_enum_arg *enum_args, ...@@ -212,6 +212,22 @@ enum_arg_to_value (const struct cl_enum_arg *enum_args,
return false; 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 /* Look of VALUE in ENUM_ARGS for language LANG_MASK and store the
corresponding string in *ARGP, returning true if the found string corresponding string in *ARGP, returning true if the found string
was marked as canonical, false otherwise. If VALUE is not found was marked as canonical, false otherwise. If VALUE is not found
......
...@@ -395,4 +395,6 @@ extern void default_options_optimization (struct gcc_options *opts, ...@@ -395,4 +395,6 @@ extern void default_options_optimization (struct gcc_options *opts,
extern void set_struct_debug_option (struct gcc_options *opts, extern void set_struct_debug_option (struct gcc_options *opts,
location_t loc, location_t loc,
const char *value); const char *value);
extern bool opt_enum_arg_to_value (size_t opt_index, const char *arg,
int *value, unsigned int lang_mask);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment