Commit 818b6b7f by Richard Henderson Committed by Richard Henderson

rtl.h (CC0_P): New.

        * rtl.h (CC0_P): New.
        * gcse.c (cprop_jump): Use it with single_set.  Tweak dump text.
        (cprop_insn): Allow any mode register; use CC0_P.  CSE out single_set.
        (bypass_block): Save old dest block for dump text.
        (bypass_conditional_jumps): Allow any mode register; use CC0_P.
        Allow only true SET insns, not single_set.

From-SVN: r54178
parent 61b78ce1
2002-06-02 Richard Henderson <rth@redhat.com>
* rtl.h (CC0_P): New.
* gcse.c (cprop_jump): Use it with single_set. Tweak dump text.
(cprop_insn): Allow any mode register; use CC0_P. CSE out single_set.
(bypass_block): Save old dest block for dump text.
(bypass_conditional_jumps): Allow any mode register; use CC0_P.
Allow only true SET insns, not single_set.
2002-06-02 Gabriel Dos Reis <gdr@codesourcery.com> 2002-06-02 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.c (diagnostic_finish): Rename to output_flush. * diagnostic.c (diagnostic_finish): Rename to output_flush.
...@@ -3338,7 +3347,6 @@ config/alpha: ...@@ -3338,7 +3347,6 @@ config/alpha:
(CPP_SPEC): Remove ieee defines. (CPP_SPEC): Remove ieee defines.
* freebsd.h, netbsd.h: Remove ieee defines and cpp_cpu. * freebsd.h, netbsd.h: Remove ieee defines and cpp_cpu.
>>>>>>> 1.14095
2002-05-14 Richard Henderson <rth@redhat.com> 2002-05-14 Richard Henderson <rth@redhat.com>
* config/i386/i386.c (ix86_save_reg): Make regno unsigned. * config/i386/i386.c (ix86_save_reg): Make regno unsigned.
......
...@@ -4079,7 +4079,7 @@ find_avail_set (regno, insn) ...@@ -4079,7 +4079,7 @@ find_avail_set (regno, insn)
/* Subroutine of cprop_insn that tries to propagate constants into /* Subroutine of cprop_insn that tries to propagate constants into
JUMP_INSNS. JUMP must be a conditional jump. If SETCC is non-NULL JUMP_INSNS. JUMP must be a conditional jump. If SETCC is non-NULL
it is the instruction that immediately preceeds JUMP, and must be a it is the instruction that immediately preceeds JUMP, and must be a
single SET of a CC_MODE register. FROM is what we will try to replace, single SET of a register. FROM is what we will try to replace,
SRC is the constant we will try to substitute for it. Returns nonzero SRC is the constant we will try to substitute for it. Returns nonzero
if a change was made. */ if a change was made. */
...@@ -4127,7 +4127,7 @@ cprop_jump (bb, setcc, jump, from, src) ...@@ -4127,7 +4127,7 @@ cprop_jump (bb, setcc, jump, from, src)
#ifdef HAVE_cc0 #ifdef HAVE_cc0
/* Delete the cc0 setter. */ /* Delete the cc0 setter. */
if (setcc != NULL && SET_DEST (PATTERN (setcc)) == cc0_rtx) if (setcc != NULL && CC0_P (SET_DEST (single_set (setcc))))
delete_insn (setcc); delete_insn (setcc);
#endif #endif
...@@ -4137,7 +4137,7 @@ cprop_jump (bb, setcc, jump, from, src) ...@@ -4137,7 +4137,7 @@ cprop_jump (bb, setcc, jump, from, src)
if (gcse_file != NULL) if (gcse_file != NULL)
{ {
fprintf (gcse_file, fprintf (gcse_file,
"CONST-PROP: Replacing reg %d in insn %d with constant ", "CONST-PROP: Replacing reg %d in jump_insn %d with constant ",
REGNO (from), INSN_UID (jump)); REGNO (from), INSN_UID (jump));
print_rtl (gcse_file, src); print_rtl (gcse_file, src);
fprintf (gcse_file, "\n"); fprintf (gcse_file, "\n");
...@@ -4205,20 +4205,19 @@ cprop_insn (bb, insn, alter_jumps) ...@@ -4205,20 +4205,19 @@ cprop_insn (bb, insn, alter_jumps)
/* Constant propagation. */ /* Constant propagation. */
if (CONSTANT_P (src)) if (CONSTANT_P (src))
{ {
/* Check for MODE_CC setting instructions followed by rtx sset;
/* Check for reg or cc0 setting instructions followed by
conditional branch instructions first. */ conditional branch instructions first. */
if (alter_jumps if (alter_jumps
&& single_set (insn) && (sset = single_set (insn)) != NULL
&& any_condjump_p (NEXT_INSN (insn)) && any_condjump_p (NEXT_INSN (insn))
&& onlyjump_p (NEXT_INSN (insn))) && onlyjump_p (NEXT_INSN (insn)))
{ {
rtx dest = SET_DEST (PATTERN (insn)); rtx dest = SET_DEST (sset);
if ((GET_MODE_CLASS (GET_MODE (dest)) == MODE_CC if ((REG_P (dest) || CC0_P (dest))
#ifdef HAVE_cc0 && cprop_jump (bb, insn, NEXT_INSN (insn),
|| dest == cc0_rtx reg_used->reg_rtx, src))
#endif
) && cprop_jump (bb, insn, NEXT_INSN (insn),
reg_used->reg_rtx, src))
{ {
changed = 1; changed = 1;
break; break;
...@@ -4430,7 +4429,7 @@ bypass_block (bb, setcc, jump) ...@@ -4430,7 +4429,7 @@ bypass_block (bb, setcc, jump)
{ {
rtx insn, note; rtx insn, note;
edge e, enext; edge e, enext;
int i,change; int i, change;
insn = (setcc != NULL) ? setcc : jump; insn = (setcc != NULL) ? setcc : jump;
...@@ -4449,7 +4448,7 @@ bypass_block (bb, setcc, jump) ...@@ -4449,7 +4448,7 @@ bypass_block (bb, setcc, jump)
{ {
struct reg_use *reg_used = &reg_use_table[i]; struct reg_use *reg_used = &reg_use_table[i];
unsigned int regno = REGNO (reg_used->reg_rtx); unsigned int regno = REGNO (reg_used->reg_rtx);
basic_block dest; basic_block dest, old_dest;
struct expr *set; struct expr *set;
rtx src, new; rtx src, new;
...@@ -4480,27 +4479,26 @@ bypass_block (bb, setcc, jump) ...@@ -4480,27 +4479,26 @@ bypass_block (bb, setcc, jump)
/* Once basic block indices are stable, we should be able /* Once basic block indices are stable, we should be able
to use redirect_edge_and_branch_force instead. */ to use redirect_edge_and_branch_force instead. */
if ((dest != NULL) && (dest != e->dest) old_dest = e->dest;
if (dest != NULL && dest != old_dest
&& redirect_edge_and_branch (e, dest)) && redirect_edge_and_branch (e, dest))
{ {
/* Copy the MODE_CC setter to the redirected edge. /* Copy the register setter to the redirected edge.
Don't copy CC0 setters, as CC0 is dead after jump. */ Don't copy CC0 setters, as CC0 is dead after jump. */
if (setcc) if (setcc)
{ {
rtx pat = PATTERN (setcc); rtx pat = PATTERN (setcc);
if (GET_MODE_CLASS (GET_MODE (SET_DEST (pat))) == MODE_CC) if (!CC0_P (SET_DEST (pat)))
insert_insn_on_edge (copy_insn (pat), e); insert_insn_on_edge (copy_insn (pat), e);
} }
if (gcse_file != NULL) if (gcse_file != NULL)
{ {
fprintf (gcse_file, "JUMP-BYPASS: Replacing reg %d in ", fprintf (gcse_file, "JUMP-BYPASS: Proved reg %d in jump_insn %d equals constant ",
regno); regno, INSN_UID (jump));
fprintf (gcse_file, "insn %d with constant ",
INSN_UID (jump));
print_rtl (gcse_file, SET_SRC (set->expr)); print_rtl (gcse_file, SET_SRC (set->expr));
fprintf (gcse_file, "\nBypass edge from %d->%d to %d\n", fprintf (gcse_file, "\nBypass edge from %d->%d to %d\n",
e->src->index, e->dest->index, dest->index); e->src->index, old_dest->index, dest->index);
} }
change = 1; change = 1;
break; break;
...@@ -4541,19 +4539,14 @@ bypass_conditional_jumps () ...@@ -4541,19 +4539,14 @@ bypass_conditional_jumps ()
insn = NEXT_INSN (insn)) insn = NEXT_INSN (insn))
if (GET_CODE (insn) == INSN) if (GET_CODE (insn) == INSN)
{ {
rtx set = single_set (insn);
if (setcc) if (setcc)
break; break;
if (!set) if (GET_CODE (PATTERN (setcc)) != SET)
break; break;
dest = SET_DEST (set); dest = SET_DEST (PATTERN (setcc));
if (GET_MODE_CLASS (GET_MODE (dest)) == MODE_CC) if (REG_P (dest) || CC0_P (dest))
setcc = insn;
#ifdef HAVE_cc0
else if (dest == cc0_rtx)
setcc = insn; setcc = insn;
#endif
else else
break; break;
} }
...@@ -4568,7 +4561,7 @@ bypass_conditional_jumps () ...@@ -4568,7 +4561,7 @@ bypass_conditional_jumps ()
} }
} }
/* If we bypassed any MODE_CC setting insns, we inserted a /* If we bypassed any register setting insns, we inserted a
copy on the redirected edge. These need to be commited. */ copy on the redirected edge. These need to be commited. */
if (changed) if (changed)
commit_edge_insertions(); commit_edge_insertions();
......
...@@ -237,6 +237,13 @@ struct rtvec_def { ...@@ -237,6 +237,13 @@ struct rtvec_def {
/* Predicate yielding nonzero iff X is a barrier insn. */ /* Predicate yielding nonzero iff X is a barrier insn. */
#define BARRIER_P(X) (GET_CODE (X) == BARRIER) #define BARRIER_P(X) (GET_CODE (X) == BARRIER)
/* Predicate yielding nonzero iff X is cc0. */
#ifdef HAVE_cc0
#define CC0_P(X) ((X) == cc0_rtx)
#else
#define CC0_P(X) 0
#endif
/* Predicate yielding nonzero iff X is a data for a jump table. */ /* Predicate yielding nonzero iff X is a data for a jump table. */
#define JUMP_TABLE_DATA_P(INSN) \ #define JUMP_TABLE_DATA_P(INSN) \
(JUMP_P (INSN) && (GET_CODE (PATTERN (INSN)) == ADDR_VEC || \ (JUMP_P (INSN) && (GET_CODE (PATTERN (INSN)) == ADDR_VEC || \
......
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