diff options
author | Richard Henderson <rth@cygnus.com> | 2000-05-18 20:44:58 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2000-05-18 20:44:58 -0700 |
commit | a8393d5dc2d2c4c7658aa53b5b679920b07741a3 (patch) | |
tree | d5333410ff7875c1b503f1494dbce8488dfa6e4d /gcc/rtlanal.c | |
parent | 14806ff142e7207cefc4c45196981df5a1d4fac3 (diff) | |
download | gcc-a8393d5dc2d2c4c7658aa53b5b679920b07741a3.zip gcc-a8393d5dc2d2c4c7658aa53b5b679920b07741a3.tar.gz gcc-a8393d5dc2d2c4c7658aa53b5b679920b07741a3.tar.bz2 |
rtlanal.c (insn_dependant_p, [...]): New.
* rtlanal.c (insn_dependant_p, insn_dependant_p_1): New.
* rtl.h (insn_dependant_p): Declare it.
* loop.c (strength_reduce): Use it.
From-SVN: r34010
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r-- | gcc/rtlanal.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 891799b..e9a9816 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA. */ static int rtx_addr_can_trap_p PARAMS ((rtx)); static void reg_set_p_1 PARAMS ((rtx, rtx, void *)); +static void insn_dependant_p_1 PARAMS ((rtx, rtx, void *)); static void reg_set_last_1 PARAMS ((rtx, rtx, void *)); @@ -687,6 +688,45 @@ modified_in_p (x, insn) return 0; } + +/* Return true if anything in insn X is (anti,output,true) dependant on + anything in insn Y. */ + +int +insn_dependant_p (x, y) + rtx x, y; +{ + rtx tmp; + + if (! INSN_P (x) || ! INSN_P (y)) + abort (); + + tmp = PATTERN (y); + note_stores (PATTERN (x), insn_dependant_p_1, &tmp); + if (tmp == NULL_RTX) + return 1; + + tmp = PATTERN (x); + note_stores (PATTERN (y), insn_dependant_p_1, &tmp); + if (tmp == NULL_RTX) + return 1; + + return 0; +} + +/* A helper routine for insn_dependant_p called through note_stores. */ + +static void +insn_dependant_p_1 (x, pat, data) + rtx x; + rtx pat ATTRIBUTE_UNUSED; + void *data; +{ + rtx * pinsn = (rtx *) data; + + if (*pinsn && reg_mentioned_p (x, *pinsn)) + *pinsn = NULL_RTX; +} /* Given an INSN, return a SET expression if this insn has only a single SET. It may also have CLOBBERs, USEs, or SET whose output |