diff options
author | Richard Henderson <rth@gcc.gnu.org> | 1999-02-02 13:49:34 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 1999-02-02 13:49:34 -0800 |
commit | 777b1b71a3e541f546542705bd979d35be607ffe (patch) | |
tree | c7c03f0c59daa179abc1be58d4ac2c375ecb8047 /gcc/rtlanal.c | |
parent | 0daa67d1d652bafcfb4130b9b8ad4471bd89405d (diff) | |
download | gcc-777b1b71a3e541f546542705bd979d35be607ffe.tar.gz |
Missed from last commit.
From-SVN: r24987
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r-- | gcc/rtlanal.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 2d220a1e5cc..08858ad8d2f 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -2218,3 +2218,36 @@ insn_first_p (insn, reference) return 0; } } + + +/* Searches X for any reference to REGNO, returning the rtx of the + reference found if any. Otherwise, returns NULL_RTX. */ + +rtx +regno_use_in (regno, x) + int regno; + rtx x; +{ + register char *fmt; + int i, j; + rtx tem; + + if (GET_CODE (x) == REG && REGNO (x) == regno) + return x; + + fmt = GET_RTX_FORMAT (GET_CODE (x)); + for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--) + { + if (fmt[i] == 'e') + { + if ((tem = regno_use_in (regno, XEXP (x, i)))) + return tem; + } + else if (fmt[i] == 'E') + for (j = XVECLEN (x, i) - 1; j >= 0; j--) + if ((tem = regno_use_in (regno , XVECEXP (x, i, j)))) + return tem; + } + + return NULL_RTX; +} |