aboutsummaryrefslogtreecommitdiff
path: root/gcc/haifa-sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/haifa-sched.c')
-rw-r--r--gcc/haifa-sched.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 150cb093e1c..686369d418f 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -1617,6 +1617,18 @@ move_insn (insn, last)
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. */
@@ -1625,7 +1637,6 @@ schedule_block (b, rgn_n_insns)
int b;
int rgn_n_insns;
{
- rtx last;
struct ready_list ready;
int can_issue_more;
@@ -1673,8 +1684,8 @@ schedule_block (b, rgn_n_insns)
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. */
@@ -1686,9 +1697,6 @@ schedule_block (b, rgn_n_insns)
/* 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) ())
{
@@ -1700,9 +1708,6 @@ schedule_block (b, rgn_n_insns)
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 ();
@@ -1725,6 +1730,10 @@ schedule_block (b, rgn_n_insns)
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);
@@ -1749,8 +1758,7 @@ schedule_block (b, rgn_n_insns)
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 =
@@ -1798,7 +1806,7 @@ schedule_block (b, rgn_n_insns)
/* 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