Commit c1bc6ca8 by James E Wilson Committed by Jim Wilson

Fix issues brought up by Nathan's assertify patch for the ia64 backend.

* config/ia64/ia64.c (update_set_flags): Delete ppred and pcond
parameters.  Replace conditional move code with assert checking for
ar.lc.  Delete obsolete comments.
(set_src_needs_barrier): Delete cond parameter, and code using it.
(rtx_needs_barrier): Delete initialization of cond.  Fix typo in
assert checking for PR_REGS.  Fix calls to update_set_flags and
set_src_needs_barrier.
(group_barrier_needed): Renamed from group_barrier_needed_p.  Fix all
callers.  Rewrite explanatory comment before the function.
(safe_group_barrier_needed): Renamed from safe_group_barrier_needed_p.
Fix all callers.

From-SVN: r98900
parent b23aee6c
2005-04-27 James E. Wilson <wilson@specifixinc.com>
* config/ia64/ia64.c (update_set_flags): Delete ppred and pcond
parameters. Replace conditional move code with assert checking for
ar.lc. Delete obsolete comments.
(set_src_needs_barrier): Delete cond parameter, and code using it.
(rtx_needs_barrier): Delete initialization of cond. Fix typo in
assert checking for PR_REGS. Fix calls to update_set_flags and
set_src_needs_barrier.
(group_barrier_needed): Renamed from group_barrier_needed_p. Fix all
callers. Rewrite explanatory comment before the function.
(safe_group_barrier_needed): Renamed from safe_group_barrier_needed_p.
Fix all callers.
2005-04-27 Mike Stump <mrs@apple.com> 2005-04-27 Mike Stump <mrs@apple.com>
* doc/cpp.texi: gcc now implements universal character names. * doc/cpp.texi: gcc now implements universal character names.
......
...@@ -4779,12 +4779,12 @@ struct reg_flags ...@@ -4779,12 +4779,12 @@ struct reg_flags
static void rws_update (struct reg_write_state *, int, struct reg_flags, int); static void rws_update (struct reg_write_state *, int, struct reg_flags, int);
static int rws_access_regno (int, struct reg_flags, int); static int rws_access_regno (int, struct reg_flags, int);
static int rws_access_reg (rtx, struct reg_flags, int); static int rws_access_reg (rtx, struct reg_flags, int);
static void update_set_flags (rtx, struct reg_flags *, int *, rtx *); static void update_set_flags (rtx, struct reg_flags *);
static int set_src_needs_barrier (rtx, struct reg_flags, int, rtx); static int set_src_needs_barrier (rtx, struct reg_flags, int);
static int rtx_needs_barrier (rtx, struct reg_flags, int); static int rtx_needs_barrier (rtx, struct reg_flags, int);
static void init_insn_group_barriers (void); static void init_insn_group_barriers (void);
static int group_barrier_needed_p (rtx); static int group_barrier_needed (rtx);
static int safe_group_barrier_needed_p (rtx); static int safe_group_barrier_needed (rtx);
/* Update *RWS for REGNO, which is being written by the current instruction, /* Update *RWS for REGNO, which is being written by the current instruction,
with predicate PRED, and associated register flags in FLAGS. */ with predicate PRED, and associated register flags in FLAGS. */
...@@ -4944,12 +4944,10 @@ rws_access_reg (rtx reg, struct reg_flags flags, int pred) ...@@ -4944,12 +4944,10 @@ rws_access_reg (rtx reg, struct reg_flags flags, int pred)
the condition, stored in *PFLAGS, *PPRED and *PCOND. */ the condition, stored in *PFLAGS, *PPRED and *PCOND. */
static void static void
update_set_flags (rtx x, struct reg_flags *pflags, int *ppred, rtx *pcond) update_set_flags (rtx x, struct reg_flags *pflags)
{ {
rtx src = SET_SRC (x); rtx src = SET_SRC (x);
*pcond = 0;
switch (GET_CODE (src)) switch (GET_CODE (src))
{ {
case CALL: case CALL:
...@@ -4961,40 +4959,16 @@ update_set_flags (rtx x, struct reg_flags *pflags, int *ppred, rtx *pcond) ...@@ -4961,40 +4959,16 @@ update_set_flags (rtx x, struct reg_flags *pflags, int *ppred, rtx *pcond)
return; return;
else else
{ {
int is_complemented = 0;
/* X is a conditional move. */ /* X is a conditional move. */
rtx cond = XEXP (src, 0); rtx cond = XEXP (src, 0);
if (GET_CODE (cond) == EQ)
is_complemented = 1;
cond = XEXP (cond, 0); cond = XEXP (cond, 0);
gcc_assert (GET_CODE (cond) == REG
|| REGNO_REG_CLASS (REGNO (cond)) == PR_REGS);
*pcond = cond;
if (XEXP (src, 1) == SET_DEST (x)
|| XEXP (src, 2) == SET_DEST (x))
{
/* X is a conditional move that conditionally writes the
destination. */
/* We need another complement in this case. */ /* We always split conditional moves into COND_EXEC patterns, so the
if (XEXP (src, 1) == SET_DEST (x)) only pattern that can reach here is doloop_end_internal. We don't
is_complemented = ! is_complemented; need to do anything special for this pattern. */
gcc_assert (GET_CODE (cond) == REG && REGNO (cond) == AR_LC_REGNUM);
*ppred = REGNO (cond); return;
if (is_complemented)
++*ppred;
}
/* ??? If this is a conditional write to the dest, then this
instruction does not actually read one source. This probably
doesn't matter, because that source is also the dest. */
/* ??? Multiple writes to predicate registers are allowed
if they are all AND type compares, or if they are all OR
type compares. We do not generate such instructions
currently. */
} }
/* ... fall through ... */
default: default:
if (COMPARISON_P (src) if (COMPARISON_P (src)
...@@ -5022,7 +4996,7 @@ update_set_flags (rtx x, struct reg_flags *pflags, int *ppred, rtx *pcond) ...@@ -5022,7 +4996,7 @@ update_set_flags (rtx x, struct reg_flags *pflags, int *ppred, rtx *pcond)
for this insn. */ for this insn. */
static int static int
set_src_needs_barrier (rtx x, struct reg_flags flags, int pred, rtx cond) set_src_needs_barrier (rtx x, struct reg_flags flags, int pred)
{ {
int need_barrier = 0; int need_barrier = 0;
rtx dst; rtx dst;
...@@ -5043,10 +5017,6 @@ set_src_needs_barrier (rtx x, struct reg_flags flags, int pred, rtx cond) ...@@ -5043,10 +5017,6 @@ set_src_needs_barrier (rtx x, struct reg_flags flags, int pred, rtx cond)
need_barrier = rtx_needs_barrier (src, flags, pred); need_barrier = rtx_needs_barrier (src, flags, pred);
/* This instruction unconditionally uses a predicate register. */
if (cond)
need_barrier |= rws_access_reg (cond, flags, 0);
dst = SET_DEST (x); dst = SET_DEST (x);
if (GET_CODE (dst) == ZERO_EXTRACT) if (GET_CODE (dst) == ZERO_EXTRACT)
{ {
...@@ -5069,7 +5039,7 @@ rtx_needs_barrier (rtx x, struct reg_flags flags, int pred) ...@@ -5069,7 +5039,7 @@ rtx_needs_barrier (rtx x, struct reg_flags flags, int pred)
int need_barrier = 0; int need_barrier = 0;
const char *format_ptr; const char *format_ptr;
struct reg_flags new_flags; struct reg_flags new_flags;
rtx cond = 0; rtx cond;
if (! x) if (! x)
return 0; return 0;
...@@ -5079,8 +5049,8 @@ rtx_needs_barrier (rtx x, struct reg_flags flags, int pred) ...@@ -5079,8 +5049,8 @@ rtx_needs_barrier (rtx x, struct reg_flags flags, int pred)
switch (GET_CODE (x)) switch (GET_CODE (x))
{ {
case SET: case SET:
update_set_flags (x, &new_flags, &pred, &cond); update_set_flags (x, &new_flags);
need_barrier = set_src_needs_barrier (x, new_flags, pred, cond); need_barrier = set_src_needs_barrier (x, new_flags, pred);
if (GET_CODE (SET_SRC (x)) != CALL) if (GET_CODE (SET_SRC (x)) != CALL)
{ {
new_flags.is_write = 1; new_flags.is_write = 1;
...@@ -5114,7 +5084,7 @@ rtx_needs_barrier (rtx x, struct reg_flags flags, int pred) ...@@ -5114,7 +5084,7 @@ rtx_needs_barrier (rtx x, struct reg_flags flags, int pred)
is_complemented = 1; is_complemented = 1;
cond = XEXP (cond, 0); cond = XEXP (cond, 0);
gcc_assert (GET_CODE (cond) == REG gcc_assert (GET_CODE (cond) == REG
|| REGNO_REG_CLASS (REGNO (cond)) == PR_REGS); && REGNO_REG_CLASS (REGNO (cond)) == PR_REGS);
pred = REGNO (cond); pred = REGNO (cond);
if (is_complemented) if (is_complemented)
++pred; ++pred;
...@@ -5161,9 +5131,8 @@ rtx_needs_barrier (rtx x, struct reg_flags flags, int pred) ...@@ -5161,9 +5131,8 @@ rtx_needs_barrier (rtx x, struct reg_flags flags, int pred)
switch (GET_CODE (pat)) switch (GET_CODE (pat))
{ {
case SET: case SET:
update_set_flags (pat, &new_flags, &pred, &cond); update_set_flags (pat, &new_flags);
need_barrier |= set_src_needs_barrier (pat, new_flags, need_barrier |= set_src_needs_barrier (pat, new_flags, pred);
pred, cond);
break; break;
case USE: case USE:
...@@ -5397,7 +5366,7 @@ rtx_needs_barrier (rtx x, struct reg_flags flags, int pred) ...@@ -5397,7 +5366,7 @@ rtx_needs_barrier (rtx x, struct reg_flags flags, int pred)
return need_barrier; return need_barrier;
} }
/* Clear out the state for group_barrier_needed_p at the start of a /* Clear out the state for group_barrier_needed at the start of a
sequence of insns. */ sequence of insns. */
static void static void
...@@ -5407,12 +5376,12 @@ init_insn_group_barriers (void) ...@@ -5407,12 +5376,12 @@ init_insn_group_barriers (void)
first_instruction = 1; first_instruction = 1;
} }
/* Given the current state, recorded by previous calls to this function, /* Given the current state, determine whether a group barrier (a stop bit) is
determine whether a group barrier (a stop bit) is necessary before INSN. necessary before INSN. Return nonzero if so. This modifies the state to
Return nonzero if so. */ include the effects of INSN as a side-effect. */
static int static int
group_barrier_needed_p (rtx insn) group_barrier_needed (rtx insn)
{ {
rtx pat; rtx pat;
int need_barrier = 0; int need_barrier = 0;
...@@ -5520,10 +5489,10 @@ group_barrier_needed_p (rtx insn) ...@@ -5520,10 +5489,10 @@ group_barrier_needed_p (rtx insn)
return need_barrier; return need_barrier;
} }
/* Like group_barrier_needed_p, but do not clobber the current state. */ /* Like group_barrier_needed, but do not clobber the current state. */
static int static int
safe_group_barrier_needed_p (rtx insn) safe_group_barrier_needed (rtx insn)
{ {
struct reg_write_state rws_saved[NUM_REGS]; struct reg_write_state rws_saved[NUM_REGS];
int saved_first_instruction; int saved_first_instruction;
...@@ -5532,7 +5501,7 @@ safe_group_barrier_needed_p (rtx insn) ...@@ -5532,7 +5501,7 @@ safe_group_barrier_needed_p (rtx insn)
memcpy (rws_saved, rws_sum, NUM_REGS * sizeof *rws_saved); memcpy (rws_saved, rws_sum, NUM_REGS * sizeof *rws_saved);
saved_first_instruction = first_instruction; saved_first_instruction = first_instruction;
t = group_barrier_needed_p (insn); t = group_barrier_needed (insn);
memcpy (rws_sum, rws_saved, NUM_REGS * sizeof *rws_saved); memcpy (rws_sum, rws_saved, NUM_REGS * sizeof *rws_saved);
first_instruction = saved_first_instruction; first_instruction = saved_first_instruction;
...@@ -5582,7 +5551,7 @@ emit_insn_group_barriers (FILE *dump) ...@@ -5582,7 +5551,7 @@ emit_insn_group_barriers (FILE *dump)
{ {
insns_since_last_label = 1; insns_since_last_label = 1;
if (group_barrier_needed_p (insn)) if (group_barrier_needed (insn))
{ {
if (last_label) if (last_label)
{ {
...@@ -5630,11 +5599,11 @@ emit_all_insn_group_barriers (FILE *dump ATTRIBUTE_UNUSED) ...@@ -5630,11 +5599,11 @@ emit_all_insn_group_barriers (FILE *dump ATTRIBUTE_UNUSED)
{ {
if (recog_memoized (insn) == CODE_FOR_insn_group_barrier) if (recog_memoized (insn) == CODE_FOR_insn_group_barrier)
init_insn_group_barriers (); init_insn_group_barriers ();
else if (group_barrier_needed_p (insn)) else if (group_barrier_needed (insn))
{ {
emit_insn_before (gen_insn_group_barrier (GEN_INT (3)), insn); emit_insn_before (gen_insn_group_barrier (GEN_INT (3)), insn);
init_insn_group_barriers (); init_insn_group_barriers ();
group_barrier_needed_p (insn); group_barrier_needed (insn);
} }
} }
} }
...@@ -5928,7 +5897,7 @@ ia64_dfa_sched_reorder (FILE *dump, int sched_verbose, rtx *ready, ...@@ -5928,7 +5897,7 @@ ia64_dfa_sched_reorder (FILE *dump, int sched_verbose, rtx *ready,
int nr_need_stop = 0; int nr_need_stop = 0;
for (insnp = ready; insnp < e_ready; insnp++) for (insnp = ready; insnp < e_ready; insnp++)
if (safe_group_barrier_needed_p (*insnp)) if (safe_group_barrier_needed (*insnp))
nr_need_stop++; nr_need_stop++;
if (reorder_type == 1 && n_ready == nr_need_stop) if (reorder_type == 1 && n_ready == nr_need_stop)
...@@ -5942,7 +5911,7 @@ ia64_dfa_sched_reorder (FILE *dump, int sched_verbose, rtx *ready, ...@@ -5942,7 +5911,7 @@ ia64_dfa_sched_reorder (FILE *dump, int sched_verbose, rtx *ready,
while (insnp >= ready + deleted) while (insnp >= ready + deleted)
{ {
rtx insn = *insnp; rtx insn = *insnp;
if (! safe_group_barrier_needed_p (insn)) if (! safe_group_barrier_needed (insn))
break; break;
memmove (ready + 1, ready, (insnp - ready) * sizeof (rtx)); memmove (ready + 1, ready, (insnp - ready) * sizeof (rtx));
*ready = insn; *ready = insn;
...@@ -5993,7 +5962,7 @@ ia64_variable_issue (FILE *dump ATTRIBUTE_UNUSED, ...@@ -5993,7 +5962,7 @@ ia64_variable_issue (FILE *dump ATTRIBUTE_UNUSED,
memcpy (prev_cycle_state, curr_state, dfa_state_size); memcpy (prev_cycle_state, curr_state, dfa_state_size);
if (reload_completed) if (reload_completed)
{ {
int needed = group_barrier_needed_p (insn); int needed = group_barrier_needed (insn);
gcc_assert (!needed); gcc_assert (!needed);
if (GET_CODE (insn) == CALL_INSN) if (GET_CODE (insn) == CALL_INSN)
...@@ -6012,7 +5981,7 @@ ia64_first_cycle_multipass_dfa_lookahead_guard (rtx insn) ...@@ -6012,7 +5981,7 @@ ia64_first_cycle_multipass_dfa_lookahead_guard (rtx insn)
{ {
gcc_assert (insn && INSN_P (insn)); gcc_assert (insn && INSN_P (insn));
return (!reload_completed return (!reload_completed
|| !safe_group_barrier_needed_p (insn)); || !safe_group_barrier_needed (insn));
} }
/* The following variable value is pseudo-insn used by the DFA insn /* The following variable value is pseudo-insn used by the DFA insn
...@@ -6032,7 +6001,7 @@ ia64_dfa_new_cycle (FILE *dump, int verbose, rtx insn, int last_clock, ...@@ -6032,7 +6001,7 @@ ia64_dfa_new_cycle (FILE *dump, int verbose, rtx insn, int last_clock,
int setup_clocks_p = FALSE; int setup_clocks_p = FALSE;
gcc_assert (insn && INSN_P (insn)); gcc_assert (insn && INSN_P (insn));
if ((reload_completed && safe_group_barrier_needed_p (insn)) if ((reload_completed && safe_group_barrier_needed (insn))
|| (last_scheduled_insn || (last_scheduled_insn
&& (GET_CODE (last_scheduled_insn) == CALL_INSN && (GET_CODE (last_scheduled_insn) == CALL_INSN
|| GET_CODE (PATTERN (last_scheduled_insn)) == ASM_INPUT || GET_CODE (PATTERN (last_scheduled_insn)) == ASM_INPUT
...@@ -7065,7 +7034,7 @@ final_emit_insn_group_barriers (FILE *dump ATTRIBUTE_UNUSED) ...@@ -7065,7 +7034,7 @@ final_emit_insn_group_barriers (FILE *dump ATTRIBUTE_UNUSED)
need_barrier_p = 0; need_barrier_p = 0;
prev_insn = NULL_RTX; prev_insn = NULL_RTX;
} }
else if (need_barrier_p || group_barrier_needed_p (insn)) else if (need_barrier_p || group_barrier_needed (insn))
{ {
if (TARGET_EARLY_STOP_BITS) if (TARGET_EARLY_STOP_BITS)
{ {
...@@ -7089,7 +7058,7 @@ final_emit_insn_group_barriers (FILE *dump ATTRIBUTE_UNUSED) ...@@ -7089,7 +7058,7 @@ final_emit_insn_group_barriers (FILE *dump ATTRIBUTE_UNUSED)
last != insn; last != insn;
last = NEXT_INSN (last)) last = NEXT_INSN (last))
if (INSN_P (last)) if (INSN_P (last))
group_barrier_needed_p (last); group_barrier_needed (last);
} }
else else
{ {
...@@ -7097,7 +7066,7 @@ final_emit_insn_group_barriers (FILE *dump ATTRIBUTE_UNUSED) ...@@ -7097,7 +7066,7 @@ final_emit_insn_group_barriers (FILE *dump ATTRIBUTE_UNUSED)
insn); insn);
init_insn_group_barriers (); init_insn_group_barriers ();
} }
group_barrier_needed_p (insn); group_barrier_needed (insn);
prev_insn = NULL_RTX; prev_insn = NULL_RTX;
} }
else if (recog_memoized (insn) >= 0) else if (recog_memoized (insn) >= 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