Commit 7297e9fc by Richard Henderson Committed by Richard Henderson

genrecog.c (validate_pattern): Verify that ZERO_EXTRACT and STRICT_LOW_PART as…

genrecog.c (validate_pattern): Verify that ZERO_EXTRACT and STRICT_LOW_PART as SET_DEST have in-out constraints.

        * genrecog.c (validate_pattern): Verify that ZERO_EXTRACT and
        STRICT_LOW_PART as SET_DEST have in-out constraints.

From-SVN: r38164
parent e45046ae
2000-12-09 Richard Henderson <rth@redhat.com>
* genrecog.c (validate_pattern): Verify that ZERO_EXTRACT and
STRICT_LOW_PART as SET_DEST have in-out constraints.
2000-12-09 Joseph S. Myers <jsm28@cam.ac.uk> 2000-12-09 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.c (check_function_format): Don't suggest adding format * c-common.c (check_function_format): Don't suggest adding format
......
...@@ -231,7 +231,7 @@ static struct decision_test *new_decision_test ...@@ -231,7 +231,7 @@ static struct decision_test *new_decision_test
static rtx find_operand static rtx find_operand
PARAMS ((rtx, int)); PARAMS ((rtx, int));
static void validate_pattern static void validate_pattern
PARAMS ((rtx, rtx, rtx)); PARAMS ((rtx, rtx, rtx, int));
static struct decision *add_to_sequence static struct decision *add_to_sequence
PARAMS ((rtx, struct decision_head *, const char *, enum routine_type, int)); PARAMS ((rtx, struct decision_head *, const char *, enum routine_type, int));
...@@ -397,13 +397,15 @@ find_operand (pattern, n) ...@@ -397,13 +397,15 @@ find_operand (pattern, n)
} }
/* Check for various errors in patterns. SET is nonnull for a destination, /* Check for various errors in patterns. SET is nonnull for a destination,
and is the complete set pattern. */ and is the complete set pattern. SET_CODE is '=' for normal sets, and
'+' within a context that requires in-out constraints. */
static void static void
validate_pattern (pattern, insn, set) validate_pattern (pattern, insn, set, set_code)
rtx pattern; rtx pattern;
rtx insn; rtx insn;
rtx set; rtx set;
int set_code;
{ {
const char *fmt; const char *fmt;
RTX_CODE code; RTX_CODE code;
...@@ -482,16 +484,26 @@ validate_pattern (pattern, insn, set) ...@@ -482,16 +484,26 @@ validate_pattern (pattern, insn, set)
} }
/* A MATCH_OPERAND that is a SET should have an output reload. */ /* A MATCH_OPERAND that is a SET should have an output reload. */
if (set if (set && code == MATCH_OPERAND)
&& code == MATCH_OPERAND
&& XSTR (pattern, 2)[0] != '\0'
&& XSTR (pattern, 2)[0] != '='
&& XSTR (pattern, 2)[0] != '+')
{ {
message_with_line (pattern_lineno, if (set_code == '+'
"operand %d missing output reload", && XSTR (pattern, 2)[0] != '\0'
XINT (pattern, 0)); && XSTR (pattern, 2)[0] != '+')
error_count++; {
message_with_line (pattern_lineno,
"operand %d missing in-out reload",
XINT (pattern, 0));
error_count++;
}
else if (XSTR (pattern, 2)[0] != '\0'
&& 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 -- /* Allowing non-lvalues in destinations -- particularly CONST_INT --
...@@ -593,14 +605,25 @@ validate_pattern (pattern, insn, set) ...@@ -593,14 +605,25 @@ validate_pattern (pattern, insn, set)
} }
if (dest != SET_DEST (pattern)) if (dest != SET_DEST (pattern))
validate_pattern (dest, insn, pattern); validate_pattern (dest, insn, pattern, '=');
validate_pattern (SET_DEST (pattern), insn, pattern); validate_pattern (SET_DEST (pattern), insn, pattern, '=');
validate_pattern (SET_SRC (pattern), insn, NULL_RTX); validate_pattern (SET_SRC (pattern), insn, NULL_RTX, 0);
return; return;
} }
case CLOBBER: case CLOBBER:
validate_pattern (SET_DEST (pattern), insn, pattern); validate_pattern (SET_DEST (pattern), insn, pattern, '=');
return;
case ZERO_EXTRACT:
validate_pattern (XEXP (pattern, 0), insn, set, set ? '+' : 0);
validate_pattern (XEXP (pattern, 1), insn, NULL_RTX, 0);
validate_pattern (XEXP (pattern, 2), insn, NULL_RTX, 0);
return;
case STRICT_LOW_PART:
validate_pattern (XEXP (pattern, 0), insn, set, set ? '+' : 0);
validate_pattern (XEXP (pattern, 1), insn, NULL, 0);
return; return;
case LABEL_REF: case LABEL_REF:
...@@ -624,12 +647,12 @@ validate_pattern (pattern, insn, set) ...@@ -624,12 +647,12 @@ validate_pattern (pattern, insn, set)
switch (fmt[i]) switch (fmt[i])
{ {
case 'e': case 'u': case 'e': case 'u':
validate_pattern (XEXP (pattern, i), insn, NULL_RTX); validate_pattern (XEXP (pattern, i), insn, NULL_RTX, 0);
break; break;
case 'E': case 'E':
for (j = 0; j < XVECLEN (pattern, i); j++) for (j = 0; j < XVECLEN (pattern, i); j++)
validate_pattern (XVECEXP (pattern, i, j), insn, NULL_RTX); validate_pattern (XVECEXP (pattern, i, j), insn, NULL_RTX, 0);
break; break;
case 'i': case 'w': case '0': case 's': case 'i': case 'w': case '0': case 's':
...@@ -2337,7 +2360,7 @@ make_insn_sequence (insn, type) ...@@ -2337,7 +2360,7 @@ make_insn_sequence (insn, type)
PUT_MODE (x, VOIDmode); PUT_MODE (x, VOIDmode);
} }
validate_pattern (x, insn, NULL_RTX); validate_pattern (x, insn, NULL_RTX, 0);
memset(&head, 0, sizeof(head)); memset(&head, 0, sizeof(head));
last = add_to_sequence (x, &head, "", type, 1); last = add_to_sequence (x, &head, "", type, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment