diff options
author | Jan Hubicka <jh@suse.cz> | 2004-02-07 18:53:44 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2004-02-07 17:53:44 +0000 |
commit | 076963eb57db82bacc373d507b50459b40589c3e (patch) | |
tree | 59215c0944e7d80025d884907196865c13a3bd91 | |
parent | 1197924d2b6814fdf2f3d6b90432824ccef43855 (diff) | |
download | gcc-076963eb57db82bacc373d507b50459b40589c3e.zip gcc-076963eb57db82bacc373d507b50459b40589c3e.tar.gz gcc-076963eb57db82bacc373d507b50459b40589c3e.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/genrecog.c | 30 |
2 files changed, 28 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 31c19831..7ac0306 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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> * config.gcc: Don't mention MAX_LONG_TYPE_SIZE. diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 8673de3..7bdc526 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -232,7 +232,7 @@ static struct decision *new_decision static struct decision_test *new_decision_test (enum decision_type, struct decision_test ***); static rtx find_operand - (rtx, int); + (rtx, int, rtx); static rtx find_matching_operand (rtx, int); static void validate_pattern @@ -346,16 +346,19 @@ new_decision_test (enum decision_type type, struct decision_test ***pplace) return test; } -/* Search for and return operand N. */ +/* Search for and return operand N, stop when reaching node STOP. */ static rtx -find_operand (rtx pattern, int n) +find_operand (rtx pattern, int n, rtx stop) { const char *fmt; RTX_CODE code; int i, j, len; rtx r; + if (pattern == stop) + return stop; + code = GET_CODE (pattern); if ((code == MATCH_SCRATCH || code == MATCH_INSN @@ -372,7 +375,7 @@ find_operand (rtx pattern, int n) switch (fmt[i]) { 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; break; @@ -383,7 +386,8 @@ find_operand (rtx pattern, int n) case 'E': 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; break; @@ -467,7 +471,17 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code) { case MATCH_SCRATCH: 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_OPERAND: case MATCH_OPERATOR: @@ -639,12 +653,12 @@ validate_pattern (rtx pattern, rtx insn, rtx set, int set_code) if (GET_CODE (dest) == MATCH_DUP || GET_CODE (dest) == MATCH_OP_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 || GET_CODE (src) == MATCH_OP_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); smode = GET_MODE (src); |