diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2001-02-17 19:50:58 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2001-02-17 14:50:58 -0500 |
commit | e2373f955520efba33f41b51e37be57899700422 (patch) | |
tree | 0f5631dc5eb3ec8aa8ef7d3ac0ae2a68b44d49bf /gcc/recog.c | |
parent | f5d3e93f974899f1fde4b015e925d25b908a666d (diff) | |
download | gcc-e2373f955520efba33f41b51e37be57899700422.tar.gz |
recog.c (validate_replace_src_1): New.
* recog.c (validate_replace_src_1): New.
(validate_replace_src_data): Likewise.
(validate_replace_src): Use note_uses.
* rtl.h (note_uses): Declare.
* rtlanal.c (note_uses): New.
Co-Authored-By: Jan Hubicka <jh@suse.cz>
From-SVN: r39804
Diffstat (limited to 'gcc/recog.c')
-rw-r--r-- | gcc/recog.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/gcc/recog.c b/gcc/recog.c index f778f60c509..d6cdf5450e4 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -1,6 +1,6 @@ /* Subroutines used by or related to instruction recognition. Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 - 1999, 2000 Free Software Foundation, Inc. + 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -59,6 +59,7 @@ static void validate_replace_rtx_1 PARAMS ((rtx *, rtx, rtx, rtx)); static rtx *find_single_use_1 PARAMS ((rtx, rtx *)); static rtx *find_constant_term_loc PARAMS ((rtx *)); static int insn_invalid_p PARAMS ((rtx)); +static void validate_replace_src_1 PARAMS ((rtx *, void *)); /* Nonzero means allow operands to be volatile. This should be 0 if you are generating rtl, such as if you are calling @@ -741,6 +742,23 @@ validate_replace_rtx_group (from, to, insn) validate_replace_rtx_1 (&PATTERN (insn), from, to, insn); } +/* Function called by note_uses to replace used subexpressions. */ +struct validate_replace_src_data + { + rtx from, to, insn; + }; + +static void +validate_replace_src_1 (x, data) + rtx *x; + void *data; +{ + struct validate_replace_src_data *d + = (struct validate_replace_src_data *) data; + + validate_replace_rtx_1 (x, d->from, d->to, d->insn); +} + /* Try replacing every occurrence of FROM in INSN with TO, avoiding SET_DESTs. After all changes have been made, validate by seeing if INSN is still valid. */ @@ -749,22 +767,12 @@ int validate_replace_src (from, to, insn) rtx from, to, insn; { - if ((GET_CODE (insn) != INSN && GET_CODE (insn) != JUMP_INSN) - || GET_CODE (PATTERN (insn)) != SET) - abort (); - - validate_replace_rtx_1 (&SET_SRC (PATTERN (insn)), from, to, insn); - if (GET_CODE (SET_DEST (PATTERN (insn))) == MEM) - validate_replace_rtx_1 (&XEXP (SET_DEST (PATTERN (insn)), 0), - from, to, insn); - else if (GET_CODE (SET_DEST (PATTERN (insn))) == ZERO_EXTRACT) - { - validate_replace_rtx_1 (&XEXP (SET_DEST (PATTERN (insn)), 1), - from, to, insn); - validate_replace_rtx_1 (&XEXP (SET_DEST (PATTERN (insn)), 2), - from, to, insn); - } + struct validate_replace_src_data d; + d.from = from; + d.to = to; + d.insn = insn; + note_uses (&PATTERN (insn), validate_replace_src_1, &d); return apply_change_group (); } |