summaryrefslogtreecommitdiff
path: root/gcc/genrecog.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2016-07-13 23:18:40 +0100
committerJeff Law <law@gcc.gnu.org>2016-07-13 16:18:40 -0600
commitb2a9e89771cf7514b80695411fcee6fcfa3e9805 (patch)
tree9e22df34eba7ed243a8221086e19425a71a62088 /gcc/genrecog.c
parent03ef0c6c55ab81002abef62cec430d0496c3a01c (diff)
genrecog.c (special_predicate_operand_p): New function.
* genrecog.c (special_predicate_operand_p): New function. (predicate_name): Move function. (validate_pattern): Don't warn about missing mode for all define_special_predicate predicates. From-SVN: r238314
Diffstat (limited to 'gcc/genrecog.c')
-rw-r--r--gcc/genrecog.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index a9f5a4a1300..056798c82f7 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -463,6 +463,38 @@ constraints_supported_in_insn_p (rtx insn)
|| GET_CODE (insn) == DEFINE_PEEPHOLE2);
}
+/* Return the name of the predicate matched by MATCH_RTX. */
+
+static const char *
+predicate_name (rtx match_rtx)
+{
+ if (GET_CODE (match_rtx) == MATCH_SCRATCH)
+ return "scratch_operand";
+ else
+ return XSTR (match_rtx, 1);
+}
+
+/* Return true if OPERAND is a MATCH_OPERAND using a special predicate
+ function. */
+
+static bool
+special_predicate_operand_p (rtx operand)
+{
+ if (GET_CODE (operand) == MATCH_OPERAND)
+ {
+ const char *pred_name = predicate_name (operand);
+ if (pred_name[0] != 0)
+ {
+ const struct pred_data *pred;
+
+ pred = lookup_predicate (pred_name);
+ return pred != NULL && pred->special;
+ }
+ }
+
+ return false;
+}
+
/* Check for various errors in PATTERN, which is part of INFO.
SET is nonnull for a destination, and is the complete set pattern.
SET_CODE is '=' for normal sets, and '+' within a context that
@@ -651,10 +683,9 @@ validate_pattern (rtx pattern, md_rtx_info *info, rtx set, int set_code)
dmode = GET_MODE (dest);
smode = GET_MODE (src);
- /* 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"))
+ /* Mode checking is not performed for special predicates. */
+ if (special_predicate_operand_p (src)
+ || special_predicate_operand_p (dest))
;
/* The operands of a SET must have the same mode unless one
@@ -3788,17 +3819,6 @@ operator < (const pattern_pos &e1, const pattern_pos &e2)
return diff < 0;
}
-/* Return the name of the predicate matched by MATCH_RTX. */
-
-static const char *
-predicate_name (rtx match_rtx)
-{
- if (GET_CODE (match_rtx) == MATCH_SCRATCH)
- return "scratch_operand";
- else
- return XSTR (match_rtx, 1);
-}
-
/* Add new decisions to S that check whether the rtx at position POS
matches PATTERN. Return the state that is reached in that case.
TOP_PATTERN is the overall pattern, as passed to match_pattern_1. */