value of sched_data.first_slot. */
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
pad out the delay between MM (shifts, etc.) and integer operations. */
/* Finish the previous cycle; pad it out with NOPs. */
if (sched_data.cur == 3)
{
- rtx t = gen_insn_group_barrier (GEN_INT (3));
- last_issued = emit_insn_after (t, last_issued);
+ sched_emit_insn (gen_insn_group_barrier (GEN_INT (3)));
did_stop = true;
maybe_rotate (dump);
}
int i;
for (i = sched_data.cur; i < split; i++)
{
- rtx t;
-
- t = gen_nop_type (sched_data.packet->t[i]);
- last_issued = emit_insn_after (t, last_issued);
+ rtx t = sched_emit_insn (gen_nop_type (sched_data.packet->t[i]));
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.cur = split;
int i;
for (i = sched_data.cur; i < 6; i++)
{
- rtx t;
-
- t = gen_nop_type (sched_data.packet->t[i]);
- last_issued = emit_insn_after (t, last_issued);
+ rtx t = sched_emit_insn (gen_nop_type (sched_data.packet->t[i]));
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.cur = 6;
if (need_stop || sched_data.cur == 6)
{
- rtx t = gen_insn_group_barrier (GEN_INT (3));
- last_issued = emit_insn_after (t, last_issued);
+ sched_emit_insn (gen_insn_group_barrier (GEN_INT (3)));
did_stop = true;
}
maybe_rotate (dump);
cycles_left--;
while (cycles_left > 0)
{
- rtx t = gen_bundle_selector (GEN_INT (0));
- last_issued = emit_insn_after (t, last_issued);
- t = gen_nop_type (TYPE_M);
- last_issued = emit_insn_after (t, last_issued);
- t = gen_nop_type (TYPE_I);
- last_issued = emit_insn_after (t, last_issued);
+ sched_emit_insn (gen_bundle_selector (GEN_INT (0)));
+ sched_emit_insn (gen_nop_type (TYPE_M));
+ sched_emit_insn (gen_nop_type (TYPE_I));
if (cycles_left > 1)
{
- t = gen_insn_group_barrier (GEN_INT (2));
- last_issued = emit_insn_after (t, last_issued);
+ sched_emit_insn (gen_insn_group_barrier (GEN_INT (2)));
cycles_left--;
}
- t = gen_nop_type (TYPE_I);
- last_issued = emit_insn_after (t, last_issued);
- t = gen_insn_group_barrier (GEN_INT (3));
- last_issued = emit_insn_after (t, last_issued);
+ sched_emit_insn (gen_nop_type (TYPE_I));
+ sched_emit_insn (gen_insn_group_barrier (GEN_INT (3)));
did_stop = true;
cycles_left--;
}
{
enum attr_type t = ia64_safe_type (insn);
- last_issued = insn;
-
if (sched_data.last_was_stop)
{
int t = sched_data.first_slot;
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,
possibly bringing insns from subsequent blocks in the same region. */
int b;
int rgn_n_insns;
{
- rtx last;
struct ready_list ready;
int can_issue_more;
if (targetm.sched.md_init)
(*targetm.sched.md_init) (sched_dump, sched_verbose, ready.veclen);
- /* No insns scheduled in this block yet. */
- last_scheduled_insn = 0;
+ /* We start inserting insns after PREV_HEAD. */
+ last_scheduled_insn = prev_head;
/* Initialize INSN_QUEUE. Q_SIZE is the total number of insns in the
queue. */
/* Start just before the beginning of time. */
clock_var = -1;
- /* We start inserting insns after PREV_HEAD. */
- last = prev_head;
-
/* Loop until all the insns in BB are scheduled. */
while ((*current_sched_info->schedule_more_p) ())
{
list. */
queue_to_ready (&ready);
- if (sched_verbose && targetm.sched.cycle_display)
- last = (*targetm.sched.cycle_display) (clock_var, last);
-
if (ready.n_ready == 0)
abort ();
else
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)
{
fprintf (sched_dump, "\n;;\tReady list (t =%3d): ", clock_var);
if (! (*current_sched_info->can_schedule_ready_p) (insn))
goto next;
- last_scheduled_insn = insn;
- last = move_insn (insn, last);
+ last_scheduled_insn = move_insn (insn, last_scheduled_insn);
if (targetm.sched.variable_issue)
can_issue_more =
/* Update head/tail boundaries. */
head = NEXT_INSN (prev_head);
- tail = last;
+ tail = last_scheduled_insn;
/* Restore-other-notes: NOTE_LIST is the end of a chain of notes
previously found among the insns. Insert them at the beginning