This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/2] gcc/genrecog: Don't warn for missing mode on special predicates


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);
 	  }
 
 	if (dest != SET_DEST (pattern))
-- 
2.6.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]