aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-02-28 10:32:12 -0800
committerRichard Henderson <rth@gcc.gnu.org>2002-02-28 10:32:12 -0800
commit89076bb3656b393a738933a79ddfde1161b3485a (patch)
treea5565c15b0b052513a333444454a04a0102ff0ab /gcc
parente3aaacf47148d9853760c4adec1f93e41afc3bdb (diff)
downloadgcc-89076bb3656b393a738933a79ddfde1161b3485a.zip
gcc-89076bb3656b393a738933a79ddfde1161b3485a.tar.gz
gcc-89076bb3656b393a738933a79ddfde1161b3485a.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/ia64/ia64.c46
-rw-r--r--gcc/haifa-sched.c32
-rw-r--r--gcc/sched-int.h1
4 files changed, 42 insertions, 46 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 684c2d0..03f4421 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+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>
* config/sparc/sparc.c (sparc64_initialize_trampoline): Generate sign
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 8e975e0..0b1fb34 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -6074,12 +6074,6 @@ static int prev_cycle;
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. */
@@ -6095,8 +6089,7 @@ nop_cycles_until (clock_var, dump)
/* 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);
}
@@ -6116,12 +6109,9 @@ nop_cycles_until (clock_var, 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;
@@ -6133,12 +6123,9 @@ nop_cycles_until (clock_var, dump)
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;
@@ -6148,8 +6135,7 @@ nop_cycles_until (clock_var, dump)
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);
@@ -6158,22 +6144,16 @@ nop_cycles_until (clock_var, 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--;
}
@@ -6493,8 +6473,6 @@ ia64_variable_issue (dump, sched_verbose, insn, can_issue_more)
{
enum attr_type t = ia64_safe_type (insn);
- last_issued = insn;
-
if (sched_data.last_was_stop)
{
int t = sched_data.first_slot;
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 150cb093..686369d 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
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index 47910a0..f5a8808 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -294,6 +294,7 @@ extern void rm_other_notes PARAMS ((rtx, rtx));
extern int insn_issue_delay PARAMS ((rtx));
extern int set_priorities PARAMS ((rtx, rtx));
+extern rtx sched_emit_insn PARAMS ((rtx));
extern void schedule_block PARAMS ((int, int));
extern void sched_init PARAMS ((FILE *));
extern void sched_finish PARAMS ((void));