From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69532 invoked by alias); 19 Jul 2018 07:20:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 69395 invoked by uid 89); 19 Jul 2018 07:20:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,SPF_PASS autolearn=ham version=3.3.2 spammy=contrary X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Jul 2018 07:20:49 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id AD2B4AD73; Thu, 19 Jul 2018 07:20:47 +0000 (UTC) Subject: Re: [PATCH] Show valid options for -march and -mtune in --help=target for arm32 (PR driver/83193). To: Thomas Preudhomme Cc: gcc-patches@gcc.gnu.org, Ramana Radhakrishnan , james.greenhalgh@arm.com, kyrylo.tkachov@foss.arm.com References: From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: Date: Thu, 19 Jul 2018 07:20:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------B21D6157A11F637ABC3F9116" X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg01042.txt.bz2 This is a multi-part message in MIME format. --------------B21D6157A11F637ABC3F9116 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-length: 2476 On 07/18/2018 06:28 PM, Thomas Preudhomme wrote: > Hi Martin, > > Why is this needed when -mfpu does not seem to need it for instance? Because the mfpu is an enum option type: mfpu= Target RejectNegative Joined Enum(arm_fpu) Var(arm_fpu_index) Init(TARGET_FPU_auto) Save Specify the name of the target floating point hardware/format. On the contrary mtune is a string option type: mtune= Target RejectNegative ToLower Joined Var(arm_tune_string) Tune code for the given processor. That's why mtune enum values are automatically printed in --help=target output. > Regarding the patch: > >> - print "Name(processor_type) Type(enum processor_type)" >> - print "Known ARM CPUs (for use with the -mcpu= and -mtune= options):\n" >> + print "Name(processor_type) Type(enum processor_type) ForceHelp" >> + print "Known ARM CPUs (for use with the -mtune= options):\n" > > Why changing the text beyond adding ForceHelp? That's probably wrong, do you accept the same values for -mcpu as for -mtune, right? > >> +@item ForceHelp >> +This property is optional. If present, enum values is printed >> +in @option{--help} output. >> + > > are printed Yep. I'm sending updated version of the patch. Martin > > Thanks, > > Thomas > On Wed, 18 Jul 2018 at 16:50, Martin Liška wrote: >> >> Hi. >> >> This introduces new ForceHelp option flag that helps to >> print valid option enum values that are not directly >> used as a type of an option. >> >> May I please ask ARM folks to test the patch? >> Thanks, >> Martin >> >> gcc/ChangeLog: >> >> 2018-07-18 Martin Liska >> >> PR driver/83193 >> * config/arm/arm-tables.opt: Add ForceHelp flag for >> processor_type and arch_name enum types. >> * config/arm/parsecpu.awk: Likewise. >> * doc/options.texi: Document new flag ForceHelp. >> * opt-read.awk: Parse ForceHelp and set it in construction. >> * optc-gen.awk: Likewise. >> * opts.c (print_filtered_help): Handle force_help option. >> * opts.h (struct cl_enum): New field force_help. >> --- >> gcc/config/arm/arm-tables.opt | 6 +++--- >> gcc/config/arm/parsecpu.awk | 6 +++--- >> gcc/doc/options.texi | 4 ++++ >> gcc/opt-read.awk | 3 +++ >> gcc/optc-gen.awk | 3 ++- >> gcc/opts.c | 3 ++- >> gcc/opts.h | 3 +++ >> 7 files changed, 20 insertions(+), 8 deletions(-) >> >> --------------B21D6157A11F637ABC3F9116 Content-Type: text/x-patch; name="0001-Show-valid-options-for-march-and-mtune-in-help-targe-v2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Show-valid-options-for-march-and-mtune-in-help-targe-v2"; filename*1=".patch" Content-length: 4864 >From af9140854ca089577a54cc12602d75b3cee6a3ad Mon Sep 17 00:00:00 2001 From: marxin Date: Tue, 20 Feb 2018 10:39:09 +0100 Subject: [PATCH] Show valid options for -march and -mtune in --help=target for arm32 (PR driver/83193). gcc/ChangeLog: 2018-07-18 Martin Liska PR driver/83193 * config/arm/arm-tables.opt: Add ForceHelp flag for processor_type and arch_name enum types. * config/arm/parsecpu.awk: Likewise. * doc/options.texi: Document new flag ForceHelp. * opt-read.awk: Parse ForceHelp and set it in construction. * optc-gen.awk: Likewise. * opts.c (print_filtered_help): Handle force_help option. * opts.h (struct cl_enum): New field force_help. --- gcc/config/arm/arm-tables.opt | 6 +++--- gcc/config/arm/parsecpu.awk | 4 ++-- gcc/doc/options.texi | 4 ++++ gcc/opt-read.awk | 3 +++ gcc/optc-gen.awk | 3 ++- gcc/opts.c | 3 ++- gcc/opts.h | 3 +++ 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/gcc/config/arm/arm-tables.opt b/gcc/config/arm/arm-tables.opt index eacee746a39..cbaa67385d7 100644 --- a/gcc/config/arm/arm-tables.opt +++ b/gcc/config/arm/arm-tables.opt @@ -21,8 +21,8 @@ ; . Enum -Name(processor_type) Type(enum processor_type) -Known ARM CPUs (for use with the -mcpu= and -mtune= options): +Name(processor_type) Type(enum processor_type) ForceHelp +Known ARM CPUs (for use with the -mtune= options): EnumValue Enum(processor_type) String(arm8) Value( TARGET_CPU_arm8) @@ -298,7 +298,7 @@ EnumValue Enum(processor_type) String(cortex-r52) Value( TARGET_CPU_cortexr52) Enum -Name(arm_arch) Type(int) +Name(arm_arch) Type(int) ForceHelp Known ARM architectures (for use with the -march= option): EnumValue diff --git a/gcc/config/arm/parsecpu.awk b/gcc/config/arm/parsecpu.awk index aabe1b0c64c..c499a5ed0ce 100644 --- a/gcc/config/arm/parsecpu.awk +++ b/gcc/config/arm/parsecpu.awk @@ -441,7 +441,7 @@ function gen_opt () { boilerplate("md") print "Enum" - print "Name(processor_type) Type(enum processor_type)" + print "Name(processor_type) Type(enum processor_type) ForceHelp" print "Known ARM CPUs (for use with the -mcpu= and -mtune= options):\n" ncpus = split (cpu_list, cpus) @@ -454,7 +454,7 @@ function gen_opt () { } print "Enum" - print "Name(arm_arch) Type(int)" + print "Name(arm_arch) Type(int) ForceHelp" print "Known ARM architectures (for use with the -march= option):\n" narchs = split (arch_list, archs) diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi index b3ca9f6fce6..af77ad78e8c 100644 --- a/gcc/doc/options.texi +++ b/gcc/doc/options.texi @@ -120,6 +120,10 @@ being described by this record. This property is required; it says what value (representable as @code{int}) should be used for the given string. +@item ForceHelp +This property is optional. If present, enum values are printed +in @option{--help} output. + @item Canonical This property is optional. If present, it says the present string is the canonical one among all those with the given value. Other strings diff --git a/gcc/opt-read.awk b/gcc/opt-read.awk index 2072958e6ba..6d2be9e99d7 100644 --- a/gcc/opt-read.awk +++ b/gcc/opt-read.awk @@ -89,6 +89,9 @@ BEGIN { enum_index[name] = n_enums enum_unknown_error[name] = unknown_error enum_help[name] = $3 + enum_force_help[name] = test_flag("ForceHelp", props, "true") + if (enum_force_help[name] == "") + enum_force_help[name] = "false" n_enums++ } else if ($1 == "EnumValue") { diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk index bf177e86330..5c4f4239db0 100644 --- a/gcc/optc-gen.awk +++ b/gcc/optc-gen.awk @@ -167,7 +167,8 @@ for (i = 0; i < n_enums; i++) { print " cl_enum_" name "_data," print " sizeof (" enum_type[name] ")," print " cl_enum_" name "_set," - print " cl_enum_" name "_get" + print " cl_enum_" name "_get," + print " " enum_force_help[name] print " }," } print "};" diff --git a/gcc/opts.c b/gcc/opts.c index b8ae8756b4f..214ef806cd5 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1337,7 +1337,8 @@ print_filtered_help (unsigned int include_flags, { unsigned int j, pos; - if (opts->x_help_enum_printed[i] != 1) + if (opts->x_help_enum_printed[i] != 1 + && !cl_enums[i].force_help) continue; if (cl_enums[i].help == NULL) continue; diff --git a/gcc/opts.h b/gcc/opts.h index 3723bdbf95b..c8777b3cd6a 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -193,6 +193,9 @@ struct cl_enum /* Function to get the value of a variable of this type. */ int (*get) (const void *var); + + /* Force enum to be printed in help. */ + bool force_help; }; extern const struct cl_enum cl_enums[]; -- 2.18.0 --------------B21D6157A11F637ABC3F9116--