summaryrefslogtreecommitdiff
path: root/gcc/genrecog.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-06 20:39:56 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-06 20:39:56 +0000
commitad9465d6a671856e3888d38f6b8be07ea9532718 (patch)
treef4511d063f1fd72d9ce1956384ae465e11f7a0c6 /gcc/genrecog.c
parent3f077767760c8d738953bb4d280dac87d179f222 (diff)
downloadgcc-ad9465d6a671856e3888d38f6b8be07ea9532718.tar.gz
* genrecog.c (validate_pattern): Warn for constraints in
define_{expand,split,peephole2}. Remove strict_low_part before looking up match_dup. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43821 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genrecog.c')
-rw-r--r--gcc/genrecog.c69
1 files changed, 43 insertions, 26 deletions
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index 44be087074c..8dfaa61f807 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -545,35 +545,52 @@ validate_pattern (pattern, insn, set, set_code)
}
}
- /* A MATCH_OPERAND that is a SET should have an output reload. */
- if (set && code == MATCH_OPERAND
- && XSTR (pattern, 2)[0] != '\0')
+ if (code == MATCH_OPERAND)
{
- if (set_code == '+')
+ const char constraints0 = XSTR (pattern, 2)[0];
+
+ /* In DEFINE_EXPAND, DEFINE_SPLIT, and DEFINE_PEEPHOLE2, we
+ don't use the MATCH_OPERAND constraint, only the predicate.
+ This is confusing to folks doing new ports, so help them
+ not make the mistake. */
+ if (GET_CODE (insn) == DEFINE_EXPAND
+ || GET_CODE (insn) == DEFINE_SPLIT
+ || GET_CODE (insn) == DEFINE_PEEPHOLE2)
{
- if (XSTR (pattern, 2)[0] == '+')
- ;
- /* If we've only got an output reload for this operand,
- we'd better have a matching input operand. */
- else if (XSTR (pattern, 2)[0] == '='
- && find_matching_operand (insn, XINT (pattern, 0)))
- ;
- else
+ if (constraints0)
+ message_with_line (pattern_lineno,
+ "warning: constraints not supported in %s",
+ rtx_name[GET_CODE (insn)]);
+ }
+
+ /* A MATCH_OPERAND that is a SET should have an output reload. */
+ else if (set && constraints0)
+ {
+ if (set_code == '+')
+ {
+ if (constraints0 == '+')
+ ;
+ /* If we've only got an output reload for this operand,
+ we'd better have a matching input operand. */
+ else if (constraints0 == '='
+ && find_matching_operand (insn, XINT (pattern, 0)))
+ ;
+ else
+ {
+ message_with_line (pattern_lineno,
+ "operand %d missing in-out reload",
+ XINT (pattern, 0));
+ error_count++;
+ }
+ }
+ else if (constraints0 != '=' && constraints0 != '+')
{
message_with_line (pattern_lineno,
- "operand %d missing in-out reload",
+ "operand %d missing output reload",
XINT (pattern, 0));
error_count++;
}
}
- else if (XSTR (pattern, 2)[0] != '='
- && XSTR (pattern, 2)[0] != '+')
- {
- message_with_line (pattern_lineno,
- "operand %d missing output reload",
- XINT (pattern, 0));
- error_count++;
- }
}
/* Allowing non-lvalues in destinations -- particularly CONST_INT --
@@ -623,6 +640,11 @@ validate_pattern (pattern, insn, set, set_code)
dest = SET_DEST (pattern);
src = SET_SRC (pattern);
+ /* STRICT_LOW_PART is a wrapper. Its argument is the real
+ destination, and it's mode should match the source. */
+ if (GET_CODE (dest) == STRICT_LOW_PART)
+ dest = XEXP (dest, 0);
+
/* Find the referant for a DUP. */
if (GET_CODE (dest) == MATCH_DUP
@@ -635,11 +657,6 @@ validate_pattern (pattern, insn, set, set_code)
|| GET_CODE (src) == MATCH_PAR_DUP)
src = find_operand (insn, XINT (src, 0));
- /* STRICT_LOW_PART is a wrapper. Its argument is the real
- destination, and it's mode should match the source. */
- if (GET_CODE (dest) == STRICT_LOW_PART)
- dest = XEXP (dest, 0);
-
dmode = GET_MODE (dest);
smode = GET_MODE (src);