diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-04-05 15:57:40 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-04-05 15:57:40 +0000 |
commit | 5a37abfd601a3c82ec615804f2854880a512b087 (patch) | |
tree | 127d24f867f773943f7024a7efa531258e061912 /gcc/gcse.c | |
parent | a5a389896925d61471bd0724e3471744be74cf33 (diff) | |
download | gcc-5a37abfd601a3c82ec615804f2854880a512b087.tar.gz |
* alias.c (find_base_term): Export.
* rtl.h (find_base_term): Declare.
* gcse.c (find_moveable_store): Test for flag_non_call_exceptions
instead of flag_exceptions. Move test for parameter passing ...
(store_killed_in_insn): ... here.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65272 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcse.c')
-rw-r--r-- | gcc/gcse.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/gcc/gcse.c b/gcc/gcse.c index 5cd55adbf17..3460a0c7cec 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -7148,19 +7148,9 @@ find_moveable_store (insn, regs_set_before, regs_set_after) /* If we are handling exceptions, we must be careful with memory references that may trap. If we are not, the behavior is undefined, so we may just continue. */ - if (flag_exceptions && may_trap_p (dest)) + if (flag_non_call_exceptions && may_trap_p (dest)) return; - /* Do not consider MEMs that mention stack pointer; in the following - we rely on that constant functions do not read memory, which of course - does not include their arguments if passed on stack. - - Note that this is not quite correct -- we may use other registers - to address stack. See store_killed_in_insn for handling of this - case. */ - if (reg_mentioned_p (stack_pointer_rtx, dest)) - return; - ptr = ldst_entry (dest); if (!ptr->pattern_regs) ptr->pattern_regs = extract_mentioned_regs (dest); @@ -7411,6 +7401,8 @@ static bool store_killed_in_insn (x, x_regs, insn) rtx x, x_regs, insn; { + rtx reg, base; + if (GET_RTX_CLASS (GET_CODE (insn)) != 'i') return false; @@ -7421,11 +7413,17 @@ store_killed_in_insn (x, x_regs, insn) if (! CONST_OR_PURE_CALL_P (insn) || pure_call_p (insn)) return true; - /* But even a const call reads its parameters. It is not trivial - check that base of the mem is not related to stack pointer, - so unless it contains no registers, just assume it may. */ - if (x_regs) - return true; + /* But even a const call reads its parameters. Check whether the + base of some of registers used in mem is stack pointer. */ + for (reg = x_regs; reg; reg = XEXP (reg, 1)) + { + base = find_base_term (reg); + if (!base + || (GET_CODE (base) == ADDRESS + && GET_MODE (base) == Pmode + && XEXP (base, 0) == stack_pointer_rtx)) + return true; + } return false; } |