From: Richard Sandiford <rdsandiford@googlemail.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gcc-patches@gcc.gnu.org, Joern Wolfgang Rennecke <gnu@amylaar.uk>
Subject: Re: [PATCH 2/2] gcc/genrecog: Don't warn for missing mode on special predicates
Date: Wed, 15 Jun 2016 18:08:00 -0000 [thread overview]
Message-ID: <87bn32tjer.fsf@googlemail.com> (raw)
In-Reply-To: <65124582452f1e6ba9f95992684363b0ae5ef0be.1465946922.git.andrew.burgess@embecosm.com> (Andrew Burgess's message of "Wed, 15 Jun 2016 00:38:10 +0100")
Andrew Burgess <andrew.burgess@embecosm.com> writes:
> In md.texi it says:
>
> Predicates written with @code{define_special_predicate} do not get any
> automatic mode checks, and are treated as having special mode handling
> by @command{genrecog}.
>
> However, in genrecog, when validating a SET pattern, if either the
> source or destination is missing a mode then a warning is given, even if
> there's a predicate defined with define_special_predicate.
>
> This commit silences the warning for special predicates.
>
> gcc/ChangeLog:
>
> * genrecog.c (validate_pattern): Don't warn about missing mode for
> define_special_predicate predicates.
> Acked-by: Andrew Burgess <andrew.burgess@embecosm.com>
> ---
> gcc/ChangeLog | 5 +++++
> gcc/genrecog.c | 22 +++++++++++++++++++---
> 2 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/genrecog.c b/gcc/genrecog.c
> index a9f5a4a..7596552 100644
> --- a/gcc/genrecog.c
> +++ b/gcc/genrecog.c
> @@ -674,9 +674,25 @@ validate_pattern (rtx pattern, md_rtx_info *info, rtx set, int set_code)
> && !CONST_WIDE_INT_P (src)
> && GET_CODE (src) != CALL)
> {
> - const char *which;
> - which = (dmode == VOIDmode ? "destination" : "source");
> - message_at (info->loc, "warning: %s missing a mode?", which);
> + const char *which_msg;
> + rtx which;
> + const char *pred_name;
> + const struct pred_data *pred;
> +
> + which_msg = (dmode == VOIDmode ? "destination" : "source");
> + which = (dmode == VOIDmode ? dest : src);
> + pred_name = XSTR (which, 1);
> + if (pred_name[0] != 0)
> + {
> + pred = lookup_predicate (pred_name);
> + if (!pred)
> + error_at (info->loc, "unknown predicate '%s'", pred_name);
> + }
> + else
> + pred = 0;
> + if (!pred || !pred->special)
> + message_at (info->loc, "warning: %s missing a mode?",
> + which_msg);
There's no guarantee at this point that "which" is a match_operand.
Also, I think the earlier:
/* The operands of a SET must have the same mode unless one
is VOIDmode. */
else if (dmode != VOIDmode && smode != VOIDmode && dmode != smode)
error_at (info->loc, "mode mismatch in set: %smode vs %smode",
GET_MODE_NAME (dmode), GET_MODE_NAME (smode));
should be skipped for special predicates too.
How about generalising:
/* The mode of an ADDRESS_OPERAND is the mode of the memory
reference, not the mode of the address. */
if (GET_CODE (src) == MATCH_OPERAND
&& ! strcmp (XSTR (src, 1), "address_operand"))
;
to:
if (special_predicate_operand_p (src)
|| special_predicate_operand_p (dest))
;
with a new special_predicate_operand_p helper? I don't think we should
duplicate the "unknown predicate" error here; the helper can just return
false for unknown predicates.
Thanks,
Richard
next prev parent reply other threads:[~2016-06-15 18:08 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-04 13:25 [PATCH 00/10] ARC: Add support for NPS400 variant Andrew Burgess
2016-03-04 13:25 ` [PATCH 01/10] gcc: Add support for mellanox nps400 arc variant Andrew Burgess
2016-03-04 13:26 ` [PATCH 07/10] gcc/arc: Add nps400 bitops support Andrew Burgess
2016-03-04 13:26 ` [PATCH 10/10] gcc/arc: Add __NPS400__ define for nps400 targets Andrew Burgess
2016-03-04 13:26 ` [PATCH 02/10] gcc/arc: Add -munaligned-access option for nps400 Andrew Burgess
2016-03-04 13:26 ` [PATCH 08/10] gcc/arc: Mask integer 'L' operands to 32-bit Andrew Burgess
2016-03-04 13:26 ` [PATCH 03/10] gcc/arc: generate jump tables in code section for nps400 Andrew Burgess
2016-03-04 13:26 ` [PATCH 06/10] gcc/arc: Add support for nps400 cmem xld/xst instructions Andrew Burgess
2016-03-04 13:26 ` [PATCH 05/10] gcc/arc: convert some constraints to define_constraint Andrew Burgess
2016-03-04 13:26 ` [PATCH 04/10] gcc/arc: Replace rI constraint with r & Cm2 for ld and update insns Andrew Burgess
2016-03-04 13:26 ` [PATCH 09/10] gcc/arc: Add an nps400 specific testcase Andrew Burgess
2016-04-21 11:39 ` [PATCHv2 0/7] ARC: Add support for nps400 variant Andrew Burgess
2016-04-28 15:31 ` Joern Wolfgang Rennecke
2016-04-28 16:55 ` Joern Wolfgang Rennecke
2016-04-29 9:04 ` Claudiu Zissulescu
2016-04-29 10:22 ` Andrew Burgess
2016-04-29 22:17 ` Andrew Burgess
2016-05-02 9:02 ` Claudiu Zissulescu
2016-05-03 10:56 ` Andrew Burgess
2016-05-12 11:30 ` Claudiu Zissulescu
2016-06-14 18:46 ` Joern Wolfgang Rennecke
2016-06-14 23:38 ` [PATCH 2/2] gcc/genrecog: Don't warn for missing mode on special predicates Andrew Burgess
2016-06-15 18:08 ` Richard Sandiford [this message]
2016-06-30 13:38 ` Andrew Burgess
2016-07-04 8:47 ` Richard Sandiford
2016-07-06 19:43 ` Andrew Burgess
2016-07-13 22:19 ` Jeff Law
2016-06-14 23:38 ` [PATCH 1/2] gcc/arc: New peephole2 and little endian arc test fixes Andrew Burgess
2016-06-14 23:38 ` [PATCH 0/2] Arc fixes and genrecog warning fix Andrew Burgess
2016-11-16 11:44 ` [PATCHv2 0/7] ARC: Add support for nps400 variant Claudiu Zissulescu
2016-04-21 11:39 ` [PATCHv2 2/7] gcc/arc: Replace rI constraint with r & Cm2 for ld and update insns Andrew Burgess
2016-04-28 17:07 ` Joern Wolfgang Rennecke
2016-04-29 11:59 ` Andrew Burgess
2016-04-29 12:09 ` Joern Wolfgang Rennecke
2016-04-21 11:39 ` [PATCHv2 3/7] gcc/arc: convert some constraints to define_constraint Andrew Burgess
2016-04-28 17:16 ` Joern Wolfgang Rennecke
2016-04-21 11:40 ` [PATCHv2 4/7] gcc/arc: Add support for nps400 cmem xld/xst instructions Andrew Burgess
2016-04-28 18:23 ` Joern Wolfgang Rennecke
2016-04-21 11:40 ` [PATCHv2 1/7] gcc/arc: Add support for nps400 cpu type Andrew Burgess
2016-04-28 17:07 ` Joern Wolfgang Rennecke
2016-04-21 11:40 ` [PATCHv2 6/7] gcc/arc: Mask integer 'L' operands to 32-bit Andrew Burgess
2016-04-28 19:09 ` Joern Wolfgang Rennecke
2016-04-21 11:40 ` [PATCHv2 5/7] gcc/arc: Add nps400 bitops support Andrew Burgess
2016-04-28 18:50 ` Joern Wolfgang Rennecke
2016-04-21 11:40 ` [PATCHv2 7/7] gcc/arc: Add an nps400 specific testcase Andrew Burgess
2016-04-28 19:14 ` Joern Wolfgang Rennecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bn32tjer.fsf@googlemail.com \
--to=rdsandiford@googlemail.com \
--cc=andrew.burgess@embecosm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gnu@amylaar.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).