aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>2003-04-05 17:57:40 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2003-04-05 15:57:40 +0000
commit94f24ddce6d75529a8865f365df4b08c871c2c41 (patch)
tree127d24f867f773943f7024a7efa531258e061912
parent92441f839f6959476991c26bca3db09802dbcf6a (diff)
downloadgcc-94f24ddce6d75529a8865f365df4b08c871c2c41.zip
gcc-94f24ddce6d75529a8865f365df4b08c871c2c41.tar.gz
gcc-94f24ddce6d75529a8865f365df4b08c871c2c41.tar.bz2
alias.c (find_base_term): Export.
* 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. From-SVN: r65272
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/alias.c3
-rw-r--r--gcc/gcse.c30
-rw-r--r--gcc/rtl.h1
4 files changed, 24 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 02c2e4c..8e3c229 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2003-04-05 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * 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.
+
2003-04-05 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
PR bootstrap/10267
diff --git a/gcc/alias.c b/gcc/alias.c
index ba8fcee..49b53c9 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -98,7 +98,6 @@ rtx get_addr PARAMS ((rtx));
static int memrefs_conflict_p PARAMS ((int, rtx, int, rtx,
HOST_WIDE_INT));
static void record_set PARAMS ((rtx, rtx, void *));
-static rtx find_base_term PARAMS ((rtx));
static int base_alias_check PARAMS ((rtx, rtx, enum machine_mode,
enum machine_mode));
static rtx find_base_value PARAMS ((rtx));
@@ -1299,7 +1298,7 @@ find_symbolic_term (x)
return 0;
}
-static rtx
+rtx
find_base_term (x)
rtx x;
{
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 5cd55ad..3460a0c 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;
}
diff --git a/gcc/rtl.h b/gcc/rtl.h
index c03172b..b874d64 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2282,6 +2282,7 @@ extern void init_alias_analysis PARAMS ((void));
extern void end_alias_analysis PARAMS ((void));
extern rtx addr_side_effect_eval PARAMS ((rtx, int, int));
extern bool memory_modified_in_insn_p PARAMS ((rtx, rtx));
+extern rtx find_base_term PARAMS ((rtx));
/* In sibcall.c */
typedef enum {