Commit 89076bb3 by Richard Henderson Committed by Richard Henderson

haifa-sched.c (sched_emit_insn): New.

        * haifa-sched.c (sched_emit_insn): New.
        (schedule_block): Use last_scheduled_insn to track last insn.
        * sched-int.h (sched_emit_insn): Prototype.
        * config/ia64/ia64.c (last_issued): Remove.
        (ia64_variable_issue): Don't set it.
        (nop_cycles_until): Use sched_emit_insn.

From-SVN: r50153
parent e3aaacf4
2002-02-28 Richard Henderson <rth@redhat.com>
* haifa-sched.c (sched_emit_insn): New.
(schedule_block): Use last_scheduled_insn to track last insn.
* sched-int.h (sched_emit_insn): Prototype.
* config/ia64/ia64.c (last_issued): Remove.
(ia64_variable_issue): Don't set it.
(nop_cycles_until): Use sched_emit_insn.
2002-02-28 Andrew MacLeod <amacleod@redhat.com> 2002-02-28 Andrew MacLeod <amacleod@redhat.com>
* config/sparc/sparc.c (sparc64_initialize_trampoline): Generate sign * config/sparc/sparc.c (sparc64_initialize_trampoline): Generate sign
......
...@@ -6074,12 +6074,6 @@ static int prev_cycle; ...@@ -6074,12 +6074,6 @@ static int prev_cycle;
value of sched_data.first_slot. */ value of sched_data.first_slot. */
static int prev_first; static int prev_first;
/* The last insn that has been scheduled. At the start of a new cycle
we know that we can emit new insns after it; the main scheduling code
has already emitted a cycle_display insn after it and is using that
as its current last insn. */
static rtx last_issued;
/* Emit NOPs to fill the delay between PREV_CYCLE and CLOCK_VAR. Used to /* Emit NOPs to fill the delay between PREV_CYCLE and CLOCK_VAR. Used to
pad out the delay between MM (shifts, etc.) and integer operations. */ pad out the delay between MM (shifts, etc.) and integer operations. */
...@@ -6095,8 +6089,7 @@ nop_cycles_until (clock_var, dump) ...@@ -6095,8 +6089,7 @@ nop_cycles_until (clock_var, dump)
/* Finish the previous cycle; pad it out with NOPs. */ /* Finish the previous cycle; pad it out with NOPs. */
if (sched_data.cur == 3) if (sched_data.cur == 3)
{ {
rtx t = gen_insn_group_barrier (GEN_INT (3)); sched_emit_insn (gen_insn_group_barrier (GEN_INT (3)));
last_issued = emit_insn_after (t, last_issued);
did_stop = true; did_stop = true;
maybe_rotate (dump); maybe_rotate (dump);
} }
...@@ -6116,12 +6109,9 @@ nop_cycles_until (clock_var, dump) ...@@ -6116,12 +6109,9 @@ nop_cycles_until (clock_var, dump)
int i; int i;
for (i = sched_data.cur; i < split; i++) for (i = sched_data.cur; i < split; i++)
{ {
rtx t; rtx t = sched_emit_insn (gen_nop_type (sched_data.packet->t[i]));
t = gen_nop_type (sched_data.packet->t[i]);
last_issued = emit_insn_after (t, last_issued);
sched_data.types[i] = sched_data.packet->t[sched_data.cur]; sched_data.types[i] = sched_data.packet->t[sched_data.cur];
sched_data.insns[i] = last_issued; sched_data.insns[i] = t;
sched_data.stopbit[i] = 0; sched_data.stopbit[i] = 0;
} }
sched_data.cur = split; sched_data.cur = split;
...@@ -6133,12 +6123,9 @@ nop_cycles_until (clock_var, dump) ...@@ -6133,12 +6123,9 @@ nop_cycles_until (clock_var, dump)
int i; int i;
for (i = sched_data.cur; i < 6; i++) for (i = sched_data.cur; i < 6; i++)
{ {
rtx t; rtx t = sched_emit_insn (gen_nop_type (sched_data.packet->t[i]));
t = gen_nop_type (sched_data.packet->t[i]);
last_issued = emit_insn_after (t, last_issued);
sched_data.types[i] = sched_data.packet->t[sched_data.cur]; sched_data.types[i] = sched_data.packet->t[sched_data.cur];
sched_data.insns[i] = last_issued; sched_data.insns[i] = t;
sched_data.stopbit[i] = 0; sched_data.stopbit[i] = 0;
} }
sched_data.cur = 6; sched_data.cur = 6;
...@@ -6148,8 +6135,7 @@ nop_cycles_until (clock_var, dump) ...@@ -6148,8 +6135,7 @@ nop_cycles_until (clock_var, dump)
if (need_stop || sched_data.cur == 6) if (need_stop || sched_data.cur == 6)
{ {
rtx t = gen_insn_group_barrier (GEN_INT (3)); sched_emit_insn (gen_insn_group_barrier (GEN_INT (3)));
last_issued = emit_insn_after (t, last_issued);
did_stop = true; did_stop = true;
} }
maybe_rotate (dump); maybe_rotate (dump);
...@@ -6158,22 +6144,16 @@ nop_cycles_until (clock_var, dump) ...@@ -6158,22 +6144,16 @@ nop_cycles_until (clock_var, dump)
cycles_left--; cycles_left--;
while (cycles_left > 0) while (cycles_left > 0)
{ {
rtx t = gen_bundle_selector (GEN_INT (0)); sched_emit_insn (gen_bundle_selector (GEN_INT (0)));
last_issued = emit_insn_after (t, last_issued); sched_emit_insn (gen_nop_type (TYPE_M));
t = gen_nop_type (TYPE_M); sched_emit_insn (gen_nop_type (TYPE_I));
last_issued = emit_insn_after (t, last_issued);
t = gen_nop_type (TYPE_I);
last_issued = emit_insn_after (t, last_issued);
if (cycles_left > 1) if (cycles_left > 1)
{ {
t = gen_insn_group_barrier (GEN_INT (2)); sched_emit_insn (gen_insn_group_barrier (GEN_INT (2)));
last_issued = emit_insn_after (t, last_issued);
cycles_left--; cycles_left--;
} }
t = gen_nop_type (TYPE_I); sched_emit_insn (gen_nop_type (TYPE_I));
last_issued = emit_insn_after (t, last_issued); sched_emit_insn (gen_insn_group_barrier (GEN_INT (3)));
t = gen_insn_group_barrier (GEN_INT (3));
last_issued = emit_insn_after (t, last_issued);
did_stop = true; did_stop = true;
cycles_left--; cycles_left--;
} }
...@@ -6493,8 +6473,6 @@ ia64_variable_issue (dump, sched_verbose, insn, can_issue_more) ...@@ -6493,8 +6473,6 @@ ia64_variable_issue (dump, sched_verbose, insn, can_issue_more)
{ {
enum attr_type t = ia64_safe_type (insn); enum attr_type t = ia64_safe_type (insn);
last_issued = insn;
if (sched_data.last_was_stop) if (sched_data.last_was_stop)
{ {
int t = sched_data.first_slot; int t = sched_data.first_slot;
......
...@@ -1617,6 +1617,18 @@ move_insn (insn, last) ...@@ -1617,6 +1617,18 @@ move_insn (insn, last)
return retval; return retval;
} }
/* Called from backends from targetm.sched.reorder to emit stuff into
the instruction stream. */
rtx
sched_emit_insn (pat)
rtx pat;
{
rtx insn = emit_insn_after (pat, last_scheduled_insn);
last_scheduled_insn = insn;
return insn;
}
/* Use forward list scheduling to rearrange insns of block B in region RGN, /* Use forward list scheduling to rearrange insns of block B in region RGN,
possibly bringing insns from subsequent blocks in the same region. */ possibly bringing insns from subsequent blocks in the same region. */
...@@ -1625,7 +1637,6 @@ schedule_block (b, rgn_n_insns) ...@@ -1625,7 +1637,6 @@ schedule_block (b, rgn_n_insns)
int b; int b;
int rgn_n_insns; int rgn_n_insns;
{ {
rtx last;
struct ready_list ready; struct ready_list ready;
int can_issue_more; int can_issue_more;
...@@ -1673,8 +1684,8 @@ schedule_block (b, rgn_n_insns) ...@@ -1673,8 +1684,8 @@ schedule_block (b, rgn_n_insns)
if (targetm.sched.md_init) if (targetm.sched.md_init)
(*targetm.sched.md_init) (sched_dump, sched_verbose, ready.veclen); (*targetm.sched.md_init) (sched_dump, sched_verbose, ready.veclen);
/* No insns scheduled in this block yet. */ /* We start inserting insns after PREV_HEAD. */
last_scheduled_insn = 0; last_scheduled_insn = prev_head;
/* Initialize INSN_QUEUE. Q_SIZE is the total number of insns in the /* Initialize INSN_QUEUE. Q_SIZE is the total number of insns in the
queue. */ queue. */
...@@ -1686,9 +1697,6 @@ schedule_block (b, rgn_n_insns) ...@@ -1686,9 +1697,6 @@ schedule_block (b, rgn_n_insns)
/* Start just before the beginning of time. */ /* Start just before the beginning of time. */
clock_var = -1; clock_var = -1;
/* We start inserting insns after PREV_HEAD. */
last = prev_head;
/* Loop until all the insns in BB are scheduled. */ /* Loop until all the insns in BB are scheduled. */
while ((*current_sched_info->schedule_more_p) ()) while ((*current_sched_info->schedule_more_p) ())
{ {
...@@ -1700,9 +1708,6 @@ schedule_block (b, rgn_n_insns) ...@@ -1700,9 +1708,6 @@ schedule_block (b, rgn_n_insns)
list. */ list. */
queue_to_ready (&ready); queue_to_ready (&ready);
if (sched_verbose && targetm.sched.cycle_display)
last = (*targetm.sched.cycle_display) (clock_var, last);
if (ready.n_ready == 0) if (ready.n_ready == 0)
abort (); abort ();
...@@ -1725,6 +1730,10 @@ schedule_block (b, rgn_n_insns) ...@@ -1725,6 +1730,10 @@ schedule_block (b, rgn_n_insns)
else else
can_issue_more = issue_rate; can_issue_more = issue_rate;
if (sched_verbose && targetm.sched.cycle_display)
last_scheduled_insn
= (*targetm.sched.cycle_display) (clock_var, last_scheduled_insn);
if (sched_verbose) if (sched_verbose)
{ {
fprintf (sched_dump, "\n;;\tReady list (t =%3d): ", clock_var); fprintf (sched_dump, "\n;;\tReady list (t =%3d): ", clock_var);
...@@ -1749,8 +1758,7 @@ schedule_block (b, rgn_n_insns) ...@@ -1749,8 +1758,7 @@ schedule_block (b, rgn_n_insns)
if (! (*current_sched_info->can_schedule_ready_p) (insn)) if (! (*current_sched_info->can_schedule_ready_p) (insn))
goto next; goto next;
last_scheduled_insn = insn; last_scheduled_insn = move_insn (insn, last_scheduled_insn);
last = move_insn (insn, last);
if (targetm.sched.variable_issue) if (targetm.sched.variable_issue)
can_issue_more = can_issue_more =
...@@ -1798,7 +1806,7 @@ schedule_block (b, rgn_n_insns) ...@@ -1798,7 +1806,7 @@ schedule_block (b, rgn_n_insns)
/* Update head/tail boundaries. */ /* Update head/tail boundaries. */
head = NEXT_INSN (prev_head); head = NEXT_INSN (prev_head);
tail = last; tail = last_scheduled_insn;
/* Restore-other-notes: NOTE_LIST is the end of a chain of notes /* Restore-other-notes: NOTE_LIST is the end of a chain of notes
previously found among the insns. Insert them at the beginning previously found among the insns. Insert them at the beginning
......
...@@ -294,6 +294,7 @@ extern void rm_other_notes PARAMS ((rtx, rtx)); ...@@ -294,6 +294,7 @@ extern void rm_other_notes PARAMS ((rtx, rtx));
extern int insn_issue_delay PARAMS ((rtx)); extern int insn_issue_delay PARAMS ((rtx));
extern int set_priorities PARAMS ((rtx, rtx)); extern int set_priorities PARAMS ((rtx, rtx));
extern rtx sched_emit_insn PARAMS ((rtx));
extern void schedule_block PARAMS ((int, int)); extern void schedule_block PARAMS ((int, int));
extern void sched_init PARAMS ((FILE *)); extern void sched_init PARAMS ((FILE *));
extern void sched_finish PARAMS ((void)); extern void sched_finish PARAMS ((void));
......
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