Commit fe4b3c79 by Jeff Law Committed by Jeff Law

flow.c (invalidate_mems_from_autoinc): Rewrite to use for_each_rtx.

        * 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.

From-SVN: r53442
parent c297b764
...@@ -23,6 +23,13 @@ ...@@ -23,6 +23,13 @@
2002-05-13 Jeffrey A Law (law@redhat.com) 2002-05-13 Jeffrey A Law (law@redhat.com)
* 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.
* i386.c (ia32_multipass_dfa_lookahead): Prototype. * i386.c (ia32_multipass_dfa_lookahead): Prototype.
* i386.c (TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD): Define. * i386.c (TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD): Define.
......
...@@ -338,8 +338,7 @@ void dump_flow_info PARAMS ((FILE *)); ...@@ -338,8 +338,7 @@ void dump_flow_info PARAMS ((FILE *));
void debug_flow_info PARAMS ((void)); void debug_flow_info PARAMS ((void));
static void add_to_mem_set_list PARAMS ((struct propagate_block_info *, static void add_to_mem_set_list PARAMS ((struct propagate_block_info *,
rtx)); rtx));
static void invalidate_mems_from_autoinc PARAMS ((struct propagate_block_info *, static int invalidate_mems_from_autoinc PARAMS ((rtx *, void *));
rtx));
static void invalidate_mems_from_set PARAMS ((struct propagate_block_info *, static void invalidate_mems_from_set PARAMS ((struct propagate_block_info *,
rtx)); rtx));
static void clear_log_links PARAMS ((sbitmap)); static void clear_log_links PARAMS ((sbitmap));
...@@ -1715,8 +1714,9 @@ propagate_one_insn (pbi, insn) ...@@ -1715,8 +1714,9 @@ propagate_one_insn (pbi, insn)
/* We have an insn to pop a constant amount off the stack. /* We have an insn to pop a constant amount off the stack.
(Such insns use PLUS regardless of the direction of 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.) 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 else
{ {
rtx note; rtx note;
...@@ -1741,12 +1741,16 @@ propagate_one_insn (pbi, insn) ...@@ -1741,12 +1741,16 @@ propagate_one_insn (pbi, insn)
if (GET_CODE (PATTERN (insn)) == COND_EXEC) if (GET_CODE (PATTERN (insn)) == COND_EXEC)
cond = COND_EXEC_TEST (PATTERN (insn)); 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)) if (! CONST_OR_PURE_CALL_P (insn))
{ {
free_EXPR_LIST_list (&pbi->mem_set_list); free_EXPR_LIST_list (&pbi->mem_set_list);
pbi->mem_set_list_len = 0; pbi->mem_set_list_len = 0;
} }
else
invalidate_mems_from_set (pbi, stack_pointer_rtx);
/* There may be extra registers to be clobbered. */ /* There may be extra registers to be clobbered. */
for (note = CALL_INSN_FUNCTION_USAGE (insn); for (note = CALL_INSN_FUNCTION_USAGE (insn);
...@@ -2415,15 +2419,21 @@ add_to_mem_set_list (pbi, mem) ...@@ -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 Find any entries on the mem_set_list that need to be invalidated due
to an address change. */ to an address change. */
static void static int
invalidate_mems_from_autoinc (pbi, insn) invalidate_mems_from_autoinc (px, data)
struct propagate_block_info *pbi; rtx *px;
rtx insn; void *data;
{ {
rtx note = REG_NOTES (insn); rtx x = *px;
for (note = REG_NOTES (insn); note; note = XEXP (note, 1)) struct propagate_block_info *pbi = data;
if (REG_NOTE_KIND (note) == REG_INC)
invalidate_mems_from_set (pbi, XEXP (note, 0)); 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. */ /* 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) ...@@ -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 address modes. Then we may need to kill some entries on the
memory set list. */ memory set list. */
if (insn && GET_CODE (reg) == MEM) 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) if (GET_CODE (reg) == MEM && ! side_effects_p (reg)
/* ??? With more effort we could track conditional memory life. */ /* ??? With more effort we could track conditional memory life. */
&& ! cond && ! 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))
add_to_mem_set_list (pbi, canon_rtx (reg)); add_to_mem_set_list (pbi, canon_rtx (reg));
} }
...@@ -3780,7 +3786,7 @@ mark_used_regs (pbi, x, cond, insn) ...@@ -3780,7 +3786,7 @@ mark_used_regs (pbi, x, cond, insn)
address modes. Then we may need to kill some entries on the address modes. Then we may need to kill some entries on the
memory set list. */ memory set list. */
if (insn) if (insn)
invalidate_mems_from_autoinc (pbi, insn); for_each_rtx (&PATTERN (insn), invalidate_mems_from_autoinc, pbi);
} }
#ifdef AUTO_INC_DEC #ifdef AUTO_INC_DEC
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment