diff options
author | amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-10 03:50:39 +0000 |
---|---|---|
committer | amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-10 03:50:39 +0000 |
commit | ef15379a9f713ff182ad985f5b8dd173c6e3a7fb (patch) | |
tree | 8f57737d03a2fc651bab26e059ff589511d75dfa /gcc/rtlanal.c | |
parent | a87d8cb5071e60e984ed60e995fd0f025ca996a5 (diff) | |
download | gcc-ef15379a9f713ff182ad985f5b8dd173c6e3a7fb.tar.gz |
PR optimization/6233
* rtlanal.c (pure_call_p): New function.
* rtl.h (pure_call_p): Declare.
* loop.c (prescan_loop): Use it to set has_nonconst_call.
* gcse.c (store_killed_in_insn): Use pure_call_p here too.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52110 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r-- | gcc/rtlanal.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 9348fd01d11..07cb6d8d6a7 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -2011,6 +2011,31 @@ find_regno_fusage (insn, code, regno) return 0; } + +/* Return true if INSN is a call to a pure function. */ + +int +pure_call_p (insn) + rtx insn; +{ + rtx link; + + if (GET_CODE (insn) != CALL_INSN || ! CONST_OR_PURE_CALL_P (insn)) + return 0; + + /* Look for the note that differentiates const and pure functions. */ + for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1)) + { + rtx u, m; + + if (GET_CODE (u = XEXP (link, 0)) == USE + && GET_CODE (m = XEXP (u, 0)) == MEM && GET_MODE (m) == BLKmode + && GET_CODE (XEXP (m, 0)) == SCRATCH) + return 1; + } + + return 0; +} /* Remove register note NOTE from the REG_NOTES of INSN. */ |