/* Compute cost of dependence LINK.
This is the number of cycles between instruction issue and
- instruction results. */
+ instruction results.
+ ??? We also use this function to call recog_memoized on all insns. */
int
dep_cost_1 (dep_t link, dw_t dw)
{
+ rtx insn = DEP_PRO (link);
rtx used = DEP_CON (link);
int cost;
This allows the computation of a function's result and parameter
values to overlap the return and call. */
if (recog_memoized (used) < 0)
- cost = 0;
+ {
+ cost = 0;
+ recog_memoized (insn);
+ }
else
{
- rtx insn = DEP_PRO (link);
enum reg_note dep_type = DEP_TYPE (link);
cost = insn_cost (insn);
{
advance_state (curr_state);
if (sched_verbose >= 6)
- fprintf (sched_dump, "\n;;\tAdvanced a state.\n");
+ fprintf (sched_dump, ";;\tAdvanced a state.\n");
}
/* Clock at which the previous instruction was issued. */
/* Init max_points. */
max_points = 0;
more_issue = issue_rate - cycle_issued_insns;
- gcc_assert (more_issue >= 0);
+
+ /* ??? We used to assert here that we never issue more insns than issue_rate.
+ However, some targets (e.g. MIPS/SB1) claim lower issue rate than can be
+ achieved to get better performance. Until these targets are fixed to use
+ scheduler hooks to manipulate insns priority instead, the assert should
+ be disabled.
+
+ gcc_assert (more_issue >= 0); */
for (i = 0; i < n_ready; i++)
if (!ready_try [i])
{
insn = ready_element (ready, i);
+#ifdef ENABLE_CHECKING
+ /* If this insn is recognizable we should have already
+ recognized it earlier.
+ ??? Not very clear where this is supposed to be done.
+ See dep_cost_1. */
gcc_assert (INSN_CODE (insn) >= 0
|| recog_memoized (insn) < 0);
+#endif
ready_try [i]
= (/* INSN_CODE check can be omitted here as it is also done later
if (max_issue (ready, 1, curr_state, &index) == 0)
{
- if (sched_verbose >= 4)
- fprintf (sched_dump, ";;\t\tChosen none\n");
*insn_ptr = ready_remove_first (ready);
+ if (sched_verbose >= 4)
+ fprintf (sched_dump, ";;\t\tChosen insn (but can't issue) : %s \n",
+ (*current_sched_info->print_insn) (*insn_ptr, 0));
return 0;
}
else
todo_spec &= SPECULATIVE;
/* Create recovery block. */
- if (mutate_p || targetm.sched.needs_block_p (insn))
+ if (mutate_p || targetm.sched.needs_block_p (todo_spec))
{
rec = sched_create_recovery_block (NULL);
label = BB_HEAD (rec);
}
/* Emit CHECK. */
- check = targetm.sched.gen_spec_check (insn, label, mutate_p);
+ check = targetm.sched.gen_spec_check (insn, label, todo_spec);
if (rec != EXIT_BLOCK_PTR)
{
return create_empty_bb (after);
}
+/* Insert PAT as an INSN into the schedule and update the necessary data
+ structures to account for it. */
+rtx
+sched_emit_insn (rtx pat)
+{
+ rtx insn = emit_insn_after (pat, last_scheduled_insn);
+ last_scheduled_insn = insn;
+ haifa_init_insn (insn);
+ return insn;
+}
+
#endif /* INSN_SCHEDULING */