Commit 076963eb by Jan Hubicka Committed by Jan Hubicka

genrecog.c (find_operand): add extra argument stop.


	* genrecog.c (find_operand): add extra argument stop.
	(validate_pattern): Verify that mach_dup is duplicating operand
	defined lexically earlier.

From-SVN: r77461
parent 1197924d
2004-02-07 Jan Hubicka <jh@suse.cz>
* genrecog.c (find_operand): add extra argument stop.
(validate_pattern): Verify that mach_dup is duplicating operand
defined lexically earlier.
2004-02-07 Kazu Hirata <kazu@cs.umass.edu> 2004-02-07 Kazu Hirata <kazu@cs.umass.edu>
* config.gcc: Don't mention MAX_LONG_TYPE_SIZE. * config.gcc: Don't mention MAX_LONG_TYPE_SIZE.
......
...@@ -232,7 +232,7 @@ static struct decision *new_decision ...@@ -232,7 +232,7 @@ static struct decision *new_decision
static struct decision_test *new_decision_test static struct decision_test *new_decision_test
(enum decision_type, struct decision_test ***); (enum decision_type, struct decision_test ***);
static rtx find_operand static rtx find_operand
(rtx, int); (rtx, int, rtx);
static rtx find_matching_operand static rtx find_matching_operand
(rtx, int); (rtx, int);
static void validate_pattern static void validate_pattern
...@@ -346,16 +346,19 @@ new_decision_test (enum decision_type type, struct decision_test ***pplace) ...@@ -346,16 +346,19 @@ new_decision_test (enum decision_type type, struct decision_test ***pplace)
return test; return test;
} }
/* Search for and return operand N. */ /* Search for and return operand N, stop when reaching node STOP. */
static rtx static rtx
find_operand (rtx pattern, int n) find_operand (rtx pattern, int n, rtx stop)
{ {
const char *fmt; const char *fmt;
RTX_CODE code; RTX_CODE code;
int i, j, len; int i, j, len;
rtx r; rtx r;
if (pattern == stop)
return stop;
code = GET_CODE (pattern); code = GET_CODE (pattern);
if ((code == MATCH_SCRATCH if ((code == MATCH_SCRATCH
|| code == MATCH_INSN || code == MATCH_INSN
...@@ -372,7 +375,7 @@ find_operand (rtx pattern, int n) ...@@ -372,7 +375,7 @@ find_operand (rtx pattern, int n)
switch (fmt[i]) switch (fmt[i])
{ {
case 'e': case 'u': case 'e': case 'u':
if ((r = find_operand (XEXP (pattern, i), n)) != NULL_RTX) if ((r = find_operand (XEXP (pattern, i), n, stop)) != NULL_RTX)
return r; return r;
break; break;
...@@ -383,7 +386,8 @@ find_operand (rtx pattern, int n) ...@@ -383,7 +386,8 @@ find_operand (rtx pattern, int n)
case 'E': case 'E':
for (j = 0; j < XVECLEN (pattern, i); j++) for (j = 0; j < XVECLEN (pattern, i); j++)
if ((r = find_operand (XVECEXP (pattern, i, j), n)) != NULL_RTX) if ((r = find_operand (XVECEXP (pattern, i, j), n, stop))
!= NULL_RTX)
return r; return r;
break; break;
...@@ -467,7 +471,17 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code) ...@@ -467,7 +471,17 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code)
{ {
case MATCH_SCRATCH: case MATCH_SCRATCH:
return; return;
case MATCH_DUP:
case MATCH_OP_DUP:
case MATCH_PAR_DUP:
if (find_operand (insn, XINT (pattern, 0), pattern) == pattern)
{
message_with_line (pattern_lineno,
"operand %i duplicated before defined",
XINT (pattern, 0));
error_count++;
}
break;
case MATCH_INSN: case MATCH_INSN:
case MATCH_OPERAND: case MATCH_OPERAND:
case MATCH_OPERATOR: case MATCH_OPERATOR:
...@@ -639,12 +653,12 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code) ...@@ -639,12 +653,12 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code)
if (GET_CODE (dest) == MATCH_DUP if (GET_CODE (dest) == MATCH_DUP
|| GET_CODE (dest) == MATCH_OP_DUP || GET_CODE (dest) == MATCH_OP_DUP
|| GET_CODE (dest) == MATCH_PAR_DUP) || GET_CODE (dest) == MATCH_PAR_DUP)
dest = find_operand (insn, XINT (dest, 0)); dest = find_operand (insn, XINT (dest, 0), NULL);
if (GET_CODE (src) == MATCH_DUP if (GET_CODE (src) == MATCH_DUP
|| GET_CODE (src) == MATCH_OP_DUP || GET_CODE (src) == MATCH_OP_DUP
|| GET_CODE (src) == MATCH_PAR_DUP) || GET_CODE (src) == MATCH_PAR_DUP)
src = find_operand (insn, XINT (src, 0)); src = find_operand (insn, XINT (src, 0), NULL);
dmode = GET_MODE (dest); dmode = GET_MODE (dest);
smode = GET_MODE (src); smode = GET_MODE (src);
......
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