From 9e11785b7ca8a566d2caa154530d416bda7da2ec Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 20 Mar 2000 14:52:04 -0800 Subject: 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 --- gcc/regmove.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'gcc/regmove.c') diff --git a/gcc/regmove.c b/gcc/regmove.c index fa82f8f..8e59c69 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)) -- cgit v1.1