diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-14 04:15:57 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-14 04:15:57 +0000 |
commit | 638987bd9ae31ce99637cbc536d6337c1629aedb (patch) | |
tree | ae31909c2478ff0944567441bd154b38631a8b6f /gcc/flow.c | |
parent | bdfb75b413d915f7179db17558924887fc6e606c (diff) | |
download | gcc-638987bd9ae31ce99637cbc536d6337c1629aedb.tar.gz |
* flow.c (invalidate_mems_from_autoinc): Rewrite to use for_each_rtx.
Update prototype and callers.
(propagate_one_insn): Stack pointer adjustments kill MEMs on
the mem_set_list which reference the stack pointer, as do
calls to constant functions as they may clobber outgoing
argument space.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53442 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/flow.c')
-rw-r--r-- | gcc/flow.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/gcc/flow.c b/gcc/flow.c index 380c3d3421d..8a9a9db1a45 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -338,8 +338,7 @@ void dump_flow_info PARAMS ((FILE *)); void debug_flow_info PARAMS ((void)); static void add_to_mem_set_list PARAMS ((struct propagate_block_info *, rtx)); -static void invalidate_mems_from_autoinc PARAMS ((struct propagate_block_info *, - rtx)); +static int invalidate_mems_from_autoinc PARAMS ((rtx *, void *)); static void invalidate_mems_from_set PARAMS ((struct propagate_block_info *, rtx)); static void clear_log_links PARAMS ((sbitmap)); @@ -1715,8 +1714,9 @@ propagate_one_insn (pbi, insn) /* We have an insn to pop a constant amount off the stack. (Such insns use PLUS regardless of the direction of the stack, and any insn to adjust the stack by a constant is always a pop.) - These insns, if not dead stores, have no effect on life. */ - ; + These insns, if not dead stores, have no effect on life, though + they do have an effect on the memory stores we are tracking. */ + invalidate_mems_from_set (pbi, stack_pointer_rtx); else { rtx note; @@ -1741,12 +1741,16 @@ propagate_one_insn (pbi, insn) if (GET_CODE (PATTERN (insn)) == COND_EXEC) cond = COND_EXEC_TEST (PATTERN (insn)); - /* Non-constant calls clobber memory. */ + /* Non-constant calls clobber memory, constant calls do not + clobber memory, though they may clobber outgoing arguments + on the stack. */ if (! CONST_OR_PURE_CALL_P (insn)) { free_EXPR_LIST_list (&pbi->mem_set_list); pbi->mem_set_list_len = 0; } + else + invalidate_mems_from_set (pbi, stack_pointer_rtx); /* There may be extra registers to be clobbered. */ for (note = CALL_INSN_FUNCTION_USAGE (insn); @@ -2415,15 +2419,21 @@ add_to_mem_set_list (pbi, mem) Find any entries on the mem_set_list that need to be invalidated due to an address change. */ -static void -invalidate_mems_from_autoinc (pbi, insn) - struct propagate_block_info *pbi; - rtx insn; +static int +invalidate_mems_from_autoinc (px, data) + rtx *px; + void *data; { - rtx note = REG_NOTES (insn); - for (note = REG_NOTES (insn); note; note = XEXP (note, 1)) - if (REG_NOTE_KIND (note) == REG_INC) - invalidate_mems_from_set (pbi, XEXP (note, 0)); + rtx x = *px; + struct propagate_block_info *pbi = data; + + if (GET_RTX_CLASS (GET_CODE (x)) == 'a') + { + invalidate_mems_from_set (pbi, XEXP (x, 0)); + return -1; + } + + return 0; } /* EXP is a REG. Remove any dependent entries from pbi->mem_set_list. */ @@ -2645,15 +2655,11 @@ mark_set_1 (pbi, code, reg, cond, insn, flags) address modes. Then we may need to kill some entries on the memory set list. */ if (insn && GET_CODE (reg) == MEM) - invalidate_mems_from_autoinc (pbi, insn); + for_each_rtx (&PATTERN (insn), invalidate_mems_from_autoinc, pbi); if (GET_CODE (reg) == MEM && ! side_effects_p (reg) /* ??? With more effort we could track conditional memory life. */ - && ! cond - /* There are no REG_INC notes for SP, so we can't assume we'll see - everything that invalidates it. To be safe, don't eliminate any - stores though SP; none of them should be redundant anyway. */ - && ! reg_mentioned_p (stack_pointer_rtx, reg)) + && ! cond) add_to_mem_set_list (pbi, canon_rtx (reg)); } @@ -3780,7 +3786,7 @@ mark_used_regs (pbi, x, cond, insn) address modes. Then we may need to kill some entries on the memory set list. */ if (insn) - invalidate_mems_from_autoinc (pbi, insn); + for_each_rtx (&PATTERN (insn), invalidate_mems_from_autoinc, pbi); } #ifdef AUTO_INC_DEC |