From: Joseph Myers Date: Wed, 30 Mar 2011 19:42:51 +0000 (+0100) Subject: options.texi (NegativeAlias): Document. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=666a21a2993b36e8c10f2d0759cd7f68811663fb;p=gcc.git options.texi (NegativeAlias): Document. * doc/options.texi (NegativeAlias): Document. (Alias): Mention NegativeAlias. * opt-functions.awk: Handle NegativeAlias. * optc-gen.awk: Disallow NegativeAlias with multiple Alias arguments. * opts-common.c (decode_cmdline_option): Handle CL_NEGATIVE_ALIAS. * opts.h (CL_NEGATIVE_ALIAS): Define. * config/rs6000/rs6000.c (rs6000_parse_yes_no_option): Remove. (rs6000_handle_option): Don't handle OPT_mvrsave_, OPT_misel_ and OPT_mspe_. * config/rs6000/rs6000.opt (mvrsave=, misel=, mspe=): Replace with Alias entries. * config/rs6000/t-spe (MULTILIB_OPTIONS, MULTILIB_EXCEPTIONS): Use mno-spe and mno-isel instead of mspe=no and -misel=no. From-SVN: r171745 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4a0ac4abd09..7c28457f7f8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2011-03-30 Joseph Myers + + * doc/options.texi (NegativeAlias): Document. + (Alias): Mention NegativeAlias. + * opt-functions.awk: Handle NegativeAlias. + * optc-gen.awk: Disallow NegativeAlias with multiple Alias + arguments. + * opts-common.c (decode_cmdline_option): Handle CL_NEGATIVE_ALIAS. + * opts.h (CL_NEGATIVE_ALIAS): Define. + * config/rs6000/rs6000.c (rs6000_parse_yes_no_option): Remove. + (rs6000_handle_option): Don't handle OPT_mvrsave_, OPT_misel_ and + OPT_mspe_. + * config/rs6000/rs6000.opt (mvrsave=, misel=, mspe=): Replace with + Alias entries. + * config/rs6000/t-spe (MULTILIB_OPTIONS, MULTILIB_EXCEPTIONS): Use + mno-spe and mno-isel instead of mspe=no and -misel=no. + 2011-03-29 Mark Wielaard * common.opt (fdebug-types-section): New flag. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 8b1d4122d87..47467c5ec69 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1082,7 +1082,6 @@ static bool rs6000_handle_option (struct gcc_options *, struct gcc_options *, const struct cl_decoded_option *, location_t); static int rs6000_loop_align_max_skip (rtx); -static void rs6000_parse_yes_no_option (const char *, const char *, int *); static int first_altivec_reg_to_save (void); static unsigned int compute_vrsave_mask (void); static void compute_save_world_info (rs6000_stack_t *info_ptr); @@ -3820,24 +3819,6 @@ rs6000_preferred_simd_mode (enum machine_mode mode) return word_mode; } -/* Handle generic options of the form -mfoo=yes/no. - NAME is the option name. - VALUE is the option value. - FLAG is the pointer to the flag where to store a 1 or 0, depending on - whether the option value is 'yes' or 'no' respectively. */ -static void -rs6000_parse_yes_no_option (const char *name, const char *value, int *flag) -{ - if (value == 0) - return; - else if (!strcmp (value, "yes")) - *flag = 1; - else if (!strcmp (value, "no")) - *flag = 0; - else - error ("unknown -m%s= option specified: '%s'", name, value); -} - /* Implement TARGET_OPTION_INIT_STRUCT. */ static void @@ -4337,31 +4318,11 @@ rs6000_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, TARGET_ALTIVEC_VRSAVE = value; break; - case OPT_mvrsave_: - rs6000_explicit_options.vrsave = true; - rs6000_parse_yes_no_option ("vrsave", arg, &(TARGET_ALTIVEC_VRSAVE)); - break; - - case OPT_misel_: - target_flags_explicit |= MASK_ISEL; - isel = 0; - rs6000_parse_yes_no_option ("isel", arg, &isel); - if (isel) - target_flags |= MASK_ISEL; - else - target_flags &= ~MASK_ISEL; - break; - case OPT_mspe: rs6000_explicit_options.spe = true; rs6000_spe = value; break; - case OPT_mspe_: - rs6000_explicit_options.spe = true; - rs6000_parse_yes_no_option ("spe", arg, &(rs6000_spe)); - break; - case OPT_mdebug_: p = ASTRDUP (arg); rs6000_debug = 0; diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index 02a60f8f365..d95f40a14f4 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -1,6 +1,6 @@ ; Options for the rs6000 port of the compiler ; -; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software +; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software ; Foundation, Inc. ; Contributed by Aldy Hernandez . ; @@ -353,9 +353,13 @@ mvrsave Target Report Var(TARGET_ALTIVEC_VRSAVE) Save Generate VRSAVE instructions when generating AltiVec code -mvrsave= -Target RejectNegative Joined --mvrsave=yes/no Deprecated option. Use -mvrsave/-mno-vrsave instead +mvrsave=no +Target RejectNegative Alias(mvrsave) NegativeAlias +Deprecated option. Use -mno-vrsave instead + +mvrsave=yes +Target RejectNegative Alias(mvrsave) +Deprecated option. Use -mvrsave instead mblock-move-inline-limit= Target Report Var(rs6000_block_move_inline_limit) Init(0) RejectNegative Joined UInteger Save @@ -365,9 +369,13 @@ misel Target Report Mask(ISEL) Save Generate isel instructions -misel= -Target RejectNegative Joined --misel=yes/no Deprecated option. Use -misel/-mno-isel instead +misel=no +Target RejectNegative Alias(misel) NegativeAlias +Deprecated option. Use -mno-isel instead + +misel=yes +Target RejectNegative Alias(misel) +Deprecated option. Use -misel instead mspe Target @@ -377,9 +385,13 @@ mpaired Target Var(rs6000_paired_float) Save Generate PPC750CL paired-single instructions -mspe= -Target RejectNegative Joined --mspe=yes/no Deprecated option. Use -mspe/-mno-spe instead +mspe=no +Target RejectNegative Alias(mspe) NegativeAlias +Deprecated option. Use -mno-spe instead + +mspe=yes +Target RejectNegative Alias(mspe) +Deprecated option. Use -mspe instead mdebug= Target RejectNegative Joined diff --git a/gcc/config/rs6000/t-spe b/gcc/config/rs6000/t-spe index 7c0c31506b3..480553c50ed 100644 --- a/gcc/config/rs6000/t-spe +++ b/gcc/config/rs6000/t-spe @@ -1,6 +1,6 @@ # Multilibs for e500 # -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2011 Free Software Foundation, Inc. # # This file is part of GCC. # @@ -36,51 +36,51 @@ INSTALL_LIBGCC = install-multilib # -mcpu=7400 -maltivec -mabi=altivec # -mcpu=7400 -msoft-float # -msoft-float -# -mspe=no -mabi=no-spe -misel=no +# -mno-spe -mabi=no-spe -mno-isel # so we'll need to create exceptions later below. MULTILIB_OPTIONS = mcpu=7400 \ maltivec \ mabi=altivec \ msoft-float \ - mspe=no \ + mno-spe \ mabi=no-spe \ - misel=no \ + mno-isel \ mlittle MULTILIB_DIRNAMES = mpc7400 altivec abi-altivec \ nof no-spe no-abi-spe no-isel le -MULTILIB_EXCEPTIONS = maltivec mabi=altivec mspe=no mabi=no-spe misel=no \ +MULTILIB_EXCEPTIONS = maltivec mabi=altivec mno-spe mabi=no-spe mno-isel \ maltivec/mabi=altivec \ mcpu=7400/maltivec \ mcpu=7400/mabi=altivec \ - *mcpu=7400/*mspe=no* \ + *mcpu=7400/*mno-spe* \ *mcpu=7400/*mabi=no-spe* \ - *mcpu=7400/*misel=no* \ + *mcpu=7400/*mno-isel* \ *maltivec/*msoft-float* \ - *maltivec/*mspe=no* \ + *maltivec/*mno-spe* \ *maltivec/*mabi=no-spe* \ - *maltivec/*misel=no* \ + *maltivec/*mno-isel* \ *mabi=altivec/*msoft-float* \ - *mabi=altivec/*mspe=no* \ + *mabi=altivec/*mno-spe* \ *mabi=altivec/*mabi=no-spe* \ - *mabi=altivec/*misel=no* \ - *msoft-float/*mspe=no* \ + *mabi=altivec/*mno-isel* \ + *msoft-float/*mno-spe* \ *msoft-float/*mabi=no-spe* \ - *msoft-float/*misel=no* \ - mspe=no/mabi=no-spe \ - mspe=no/misel=no \ - mabi=no-spe/misel=no \ - misel=no/mlittle \ - mabi=no-spe/misel=no/mlittle \ - mspe=no/mlittle \ + *msoft-float/*mno-isel* \ + mno-spe/mabi=no-spe \ + mno-spe/mno-isel \ + mabi=no-spe/mno-isel \ + mno-isel/mlittle \ + mabi=no-spe/mno-isel/mlittle \ + mno-spe/mlittle \ mabi=spe/mlittle \ mcpu=7400/mabi=altivec/mlittle \ mcpu=7400/maltivec/mlittle \ mabi=no-spe/mlittle \ - mspe=no/misel=no/mlittle \ - mspe=no/mabi=no-spe/mlittle \ + mno-spe/mno-isel/mlittle \ + mno-spe/mabi=no-spe/mlittle \ mabi=altivec/mlittle \ maltivec/mlittle \ maltivec/mabi=altivec/mlittle diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi index e39d79e1c8f..608afa2b1b9 100644 --- a/gcc/doc/options.texi +++ b/gcc/doc/options.texi @@ -364,7 +364,8 @@ for later processing. @item Alias(@var{opt}) @itemx Alias(@var{opt}, @var{arg}) @itemx Alias(@var{opt}, @var{posarg}, @var{negarg}) -The option is an alias for @option{-@var{opt}}. In the first form, +The option is an alias for @option{-@var{opt}} (or the negative form +of that option, depending on @code{NegativeAlias}). In the first form, any argument passed to the alias is considered to be passed to @option{-@var{opt}}, and @option{-@var{opt}} is considered to be negated if the alias is used in negated form. In the second form, the @@ -387,6 +388,13 @@ not need to handle it and no @samp{OPT_} enumeration value is defined for it; only the canonical form of the option will be seen in those places. +@item NegativeAlias +For an option marked with @code{Alias(@var{opt})}, the option is +considered to be an alias for the positive form of @option{-@var{opt}} +if negated and for the negative form of @option{-@var{opt}} if not +negated. @code{NegativeAlias} may not be used with the forms of +@code{Alias} taking more than one argument. + @item Ignore This option is ignored apart from printing any warning specified using @code{Warn}. The option will not be seen by specs and no @samp{OPT_} diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk index 9aff0e0046b..f5f5cd4656e 100644 --- a/gcc/opt-functions.awk +++ b/gcc/opt-functions.awk @@ -1,4 +1,4 @@ -# Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010 +# Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010, 2011 # Free Software Foundation, Inc. # Contributed by Kelley Cook, June 2004. # Original code from Neil Booth, May 2003. @@ -90,6 +90,7 @@ function switch_flags (flags) test_flag("RejectDriver", flags, " | CL_REJECT_DRIVER") \ test_flag("NoDriverArg", flags, " | CL_NO_DRIVER_ARG") \ test_flag("SeparateAlias", flags, " | CL_SEPARATE_ALIAS") \ + test_flag("NegativeAlias", flags, " | CL_NEGATIVE_ALIAS") \ test_flag("Save", flags, " | CL_SAVE") \ test_flag("Joined", flags, " | CL_JOINED") \ test_flag("JoinedOrMissing", flags, " | CL_JOINED | CL_MISSING_OK") \ diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk index 502b23bf6e0..24def356218 100644 --- a/gcc/optc-gen.awk +++ b/gcc/optc-gen.awk @@ -362,6 +362,11 @@ for (i = 0; i < n_opts; i++) { print "#error Alias with single argument " \ "allowing negative form" } + if (alias_posarg != "" \ + && flag_set_p("NegativeAlias", flags[i])) { + print "#error Alias with multiple arguments " \ + "used with NegativeAlias" + } alias_opt = opt_enum(alias_opt) if (alias_posarg == "") diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 345afe844d2..a88aed032d9 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -507,6 +507,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, { gcc_assert (option->alias_arg != NULL); gcc_assert (arg == NULL); + gcc_assert (!(option->flags & CL_NEGATIVE_ALIAS)); if (value) arg = option->alias_arg; else @@ -517,9 +518,13 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, { gcc_assert (value == 1); gcc_assert (arg == NULL); + gcc_assert (!(option->flags & CL_NEGATIVE_ALIAS)); arg = option->alias_arg; } + if (option->flags & CL_NEGATIVE_ALIAS) + value = !value; + opt_index = new_opt_index; option = new_option; diff --git a/gcc/opts.h b/gcc/opts.h index 0d58bae25f2..491177898c6 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -115,6 +115,7 @@ extern const unsigned int cl_lang_count; #define CL_MISSING_OK (1U << 28) /* Missing argument OK (joined). */ #define CL_UINTEGER (1U << 29) /* Argument is an integer >=0. */ #define CL_UNDOCUMENTED (1U << 30) /* Do not output with --help. */ +#define CL_NEGATIVE_ALIAS (1U << 31) /* Alias to negative form of option. */ /* Flags for an enumerated option argument. */ #define CL_ENUM_CANONICAL (1 << 0) /* Canonical for this value. */