summaryrefslogtreecommitdiff
path: root/gcc/regmove.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>2000-03-20 14:52:04 -0800
committerRichard Henderson <rth@gcc.gnu.org>2000-03-20 14:52:04 -0800
commit9e11785b7ca8a566d2caa154530d416bda7da2ec (patch)
treec72f960fd860511bb5a9ff145b513ffeded56927 /gcc/regmove.c
parente245d3af6fd6a1362cc83eff738b2a59a3c636cc (diff)
downloadgcc-9e11785b7ca8a566d2caa154530d416bda7da2ec.tar.gz
regmove.c (stack_memref_p): Fix typo, reorg for readability.
* regmove.c (stack_memref_p): Fix typo, reorg for readability. (combine_stack_adjustments_for_block): Don't allow sp references in the side of a set we're not fixing up. * toplev.c (rest_of_compilation): Run combine_stack_adjustments after life_analysis. From-SVN: r32654
Diffstat (limited to 'gcc/regmove.c')
-rw-r--r--gcc/regmove.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/gcc/regmove.c b/gcc/regmove.c
index fa82f8f95e9..8e59c69ce77 100644
--- a/gcc/regmove.c
+++ b/gcc/regmove.c
@@ -2116,14 +2116,21 @@ combine_stack_adjustments ()
/* Recognize a MEM of the form (sp) or (plus sp const). */
static int
-stack_memref_p (mem)
- rtx mem;
+stack_memref_p (x)
+ rtx x;
{
- return (GET_CODE (mem) == MEM
- && (XEXP (mem, 0) == stack_pointer_rtx
- || (GET_CODE (XEXP (mem, 0)) == PLUS
- && XEXP (XEXP (mem, 0), 0) == stack_pointer_rtx
- && GET_CODE (XEXP (XEXP (mem, 0), 0)) == CONST_INT)));
+ if (GET_CODE (x) != MEM)
+ return 0;
+ x = XEXP (x, 0);
+
+ if (x == stack_pointer_rtx)
+ return 1;
+ if (GET_CODE (x) == PLUS
+ && XEXP (x, 0) == stack_pointer_rtx
+ && GET_CODE (XEXP (x, 1)) == CONST_INT)
+ return 1;
+
+ return 0;
}
/* Recognize either normal single_set or the hack in i386.md for
@@ -2330,14 +2337,16 @@ combine_stack_adjustments_for_block (bb)
}
/* Find loads from stack memory and record them. */
- if (last_sp_set && stack_memref_p (src))
+ if (last_sp_set && stack_memref_p (src)
+ && ! reg_mentioned_p (stack_pointer_rtx, dest))
{
memlist = record_one_stack_memref (insn, src, memlist);
goto processed;
}
/* Find stores to stack memory and record them. */
- if (last_sp_set && stack_memref_p (dest))
+ if (last_sp_set && stack_memref_p (dest)
+ && ! reg_mentioned_p (stack_pointer_rtx, src))
{
memlist = record_one_stack_memref (insn, dest, memlist);
goto processed;
@@ -2351,6 +2360,7 @@ combine_stack_adjustments_for_block (bb)
&& GET_CODE (dest) == MEM
&& GET_CODE (XEXP (dest, 0)) == PRE_DEC
&& XEXP (XEXP (dest, 0), 0) == stack_pointer_rtx
+ && ! reg_mentioned_p (stack_pointer_rtx, src)
&& validate_change (insn, &SET_DEST (set),
change_address (dest, VOIDmode,
stack_pointer_rtx), 0))