Commit cbfc3ad3 by Richard Kenner

(reload): Don't call reload_cse_regs here.

(reload_cse_mem_conflict_p): Remove MEM_OFFSET and MEM_MODE args.
(reload_cse_mem_conflict_p, case MEM): Call anti_dependence.
(reload_cse_invalidate_mem): Update call to reload_cse_mem_conflict_p.
(reload_cse_regs): No longer static.
Call init_alias_analysis.
Ignore CLOBBER in a PARALLEL.

From-SVN: r14479
parent c8ed219d
...@@ -394,11 +394,9 @@ static void inc_for_reload PROTO((rtx, rtx, int)); ...@@ -394,11 +394,9 @@ static void inc_for_reload PROTO((rtx, rtx, int));
static int constraint_accepts_reg_p PROTO((char *, rtx)); static int constraint_accepts_reg_p PROTO((char *, rtx));
static int count_occurrences PROTO((rtx, rtx)); static int count_occurrences PROTO((rtx, rtx));
static void reload_cse_invalidate_regno PROTO((int, enum machine_mode, int)); static void reload_cse_invalidate_regno PROTO((int, enum machine_mode, int));
static int reload_cse_mem_conflict_p PROTO((rtx, rtx, enum machine_mode, static int reload_cse_mem_conflict_p PROTO((rtx, rtx));
rtx));
static void reload_cse_invalidate_mem PROTO((rtx)); static void reload_cse_invalidate_mem PROTO((rtx));
static void reload_cse_invalidate_rtx PROTO((rtx, rtx)); static void reload_cse_invalidate_rtx PROTO((rtx, rtx));
static void reload_cse_regs PROTO((rtx));
static int reload_cse_regno_equal_p PROTO((int, rtx, enum machine_mode)); static int reload_cse_regno_equal_p PROTO((int, rtx, enum machine_mode));
static int reload_cse_noop_set_p PROTO((rtx, rtx)); static int reload_cse_noop_set_p PROTO((rtx, rtx));
static void reload_cse_simplify_set PROTO((rtx, rtx)); static void reload_cse_simplify_set PROTO((rtx, rtx));
...@@ -2137,10 +2135,6 @@ reload (first, global, dumpfile) ...@@ -2137,10 +2135,6 @@ reload (first, global, dumpfile)
} }
} }
/* Do a very simple CSE pass over just the hard registers. */
if (optimize > 0)
reload_cse_regs (first);
#ifdef PRESERVE_DEATH_INFO_REGNO_P #ifdef PRESERVE_DEATH_INFO_REGNO_P
/* Make a pass over all the insns and remove death notes for things that /* Make a pass over all the insns and remove death notes for things that
are no longer registers or no longer die in the insn (e.g., an input are no longer registers or no longer die in the insn (e.g., an input
...@@ -7674,15 +7668,12 @@ reload_cse_invalidate_regno (regno, mode, clobber) ...@@ -7674,15 +7668,12 @@ reload_cse_invalidate_regno (regno, mode, clobber)
} }
} }
/* The memory at address (plus MEM_BASE MEM_OFFSET), where MEM_OFFSET /* The memory at address MEM_BASE is being changed. MEM_MODE is the mode of
is a CONST_INT, is being changed. MEM_MODE is the mode of the the memory reference. Return whether this change will invalidate VAL. */
memory reference. Return whether this change will invalidate VAL. */
static int static int
reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode, val) reload_cse_mem_conflict_p (mem_base, val)
rtx mem_base; rtx mem_base;
rtx mem_offset;
enum machine_mode mem_mode;
rtx val; rtx val;
{ {
enum rtx_code code; enum rtx_code code;
...@@ -7705,37 +7696,7 @@ reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode, val) ...@@ -7705,37 +7696,7 @@ reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode, val)
return 0; return 0;
case MEM: case MEM:
{ return anti_dependence (val, mem_base);
rtx val_base, val_offset;
if (mem_mode == BLKmode || GET_MODE (val) == BLKmode)
return 1;
val_offset = const0_rtx;
val_base = eliminate_constant_term (XEXP (val, 0), &val_offset);
/* If MEM_BASE and VAL_BASE are the same, but the offsets do
not overlap, then we do not have a conflict on this MEM.
For complete safety, we still need to check that VAL_BASE
itself does not contain an overlapping MEM.
We can't simplify the check to just OFFSET + SIZE <=
OTHER_OFFSET, because SIZE might cause OFFSET to wrap from
positive to negative. If we used unsigned arithmetic, we
would have the same problem wrapping around zero. */
if (rtx_equal_p (mem_base, val_base)
&& ((INTVAL (mem_offset) < INTVAL (val_offset)
&& (INTVAL (mem_offset) + GET_MODE_SIZE (mem_mode)
<= INTVAL (val_offset)))
|| (INTVAL (val_offset) < INTVAL (mem_offset)
&& (INTVAL (val_offset) + GET_MODE_SIZE (GET_MODE (val))
<= INTVAL (mem_offset)))))
return reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode,
val_base);
return 1;
}
default: default:
break; break;
...@@ -7747,8 +7708,7 @@ reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode, val) ...@@ -7747,8 +7708,7 @@ reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode, val)
{ {
if (fmt[i] == 'e') if (fmt[i] == 'e')
{ {
if (reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode, if (reload_cse_mem_conflict_p (mem_base, XEXP (val, i)))
XEXP (val, i)))
return 1; return 1;
} }
else if (fmt[i] == 'E') else if (fmt[i] == 'E')
...@@ -7756,8 +7716,7 @@ reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode, val) ...@@ -7756,8 +7716,7 @@ reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode, val)
int j; int j;
for (j = 0; j < XVECLEN (val, i); j++) for (j = 0; j < XVECLEN (val, i); j++)
if (reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode, if (reload_cse_mem_conflict_p (mem_base, XVECEXP (val, i, j)))
XVECEXP (val, i, j)))
return 1; return 1;
} }
} }
...@@ -7774,15 +7733,6 @@ reload_cse_invalidate_mem (mem_rtx) ...@@ -7774,15 +7733,6 @@ reload_cse_invalidate_mem (mem_rtx)
rtx mem_rtx; rtx mem_rtx;
{ {
register int i; register int i;
rtx mem_base, mem_offset;
enum machine_mode mem_mode;
/* We detect certain cases where memory addresses can not conflict:
if they use the same register, and the offsets do not overlap. */
mem_offset = const0_rtx;
mem_base = eliminate_constant_term (XEXP (mem_rtx, 0), &mem_offset);
mem_mode = GET_MODE (mem_rtx);
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
{ {
...@@ -7791,8 +7741,7 @@ reload_cse_invalidate_mem (mem_rtx) ...@@ -7791,8 +7741,7 @@ reload_cse_invalidate_mem (mem_rtx)
for (x = reg_values[i]; x; x = XEXP (x, 1)) for (x = reg_values[i]; x; x = XEXP (x, 1))
{ {
if (XEXP (x, 0) != 0 if (XEXP (x, 0) != 0
&& reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode, && reload_cse_mem_conflict_p (mem_rtx, XEXP (x, 0)))
XEXP (x, 0)))
{ {
/* If this is the only entry on the list, clear /* If this is the only entry on the list, clear
reg_values[i]. Otherwise, just clear this entry on reg_values[i]. Otherwise, just clear this entry on
...@@ -7841,7 +7790,7 @@ reload_cse_invalidate_rtx (dest, ignore) ...@@ -7841,7 +7790,7 @@ reload_cse_invalidate_rtx (dest, ignore)
registers) changes it to simply copy the first register into the registers) changes it to simply copy the first register into the
second register. */ second register. */
static void void
reload_cse_regs (first) reload_cse_regs (first)
rtx first; rtx first;
{ {
...@@ -7850,6 +7799,8 @@ reload_cse_regs (first) ...@@ -7850,6 +7799,8 @@ reload_cse_regs (first)
register int i; register int i;
rtx insn; rtx insn;
init_alias_analysis ();
reg_values = (rtx *) alloca (FIRST_PSEUDO_REGISTER * sizeof (rtx)); reg_values = (rtx *) alloca (FIRST_PSEUDO_REGISTER * sizeof (rtx));
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
reg_values[i] = 0; reg_values[i] = 0;
...@@ -7931,8 +7882,9 @@ reload_cse_regs (first) ...@@ -7931,8 +7882,9 @@ reload_cse_regs (first)
/* If every action in a PARALLEL is a noop, we can delete /* If every action in a PARALLEL is a noop, we can delete
the entire PARALLEL. */ the entire PARALLEL. */
for (i = XVECLEN (body, 0) - 1; i >= 0; --i) for (i = XVECLEN (body, 0) - 1; i >= 0; --i)
if (GET_CODE (XVECEXP (body, 0, i)) != SET if ((GET_CODE (XVECEXP (body, 0, i)) != SET
|| ! reload_cse_noop_set_p (XVECEXP (body, 0, i), insn)) || ! reload_cse_noop_set_p (XVECEXP (body, 0, i), insn))
&& GET_CODE (XVECEXP (body, 0, i)) != CLOBBER)
break; break;
if (i < 0) if (i < 0)
{ {
......
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