static void add_dependence_list_and_free (struct deps_desc *, rtx,
rtx *, int, enum reg_note);
static void delete_all_dependences (rtx);
-static void fixup_sched_groups (rtx);
+static void chain_to_prev_insn (rtx);
static void flush_pending_lists (struct deps_desc *, rtx, int, int);
static void sched_analyze_1 (struct deps_desc *, rtx, rtx);
the previous nonnote insn. */
static void
-fixup_sched_groups (rtx insn)
+chain_to_prev_insn (rtx insn)
{
sd_iterator_def sd_it;
dep_t dep;
instructions that follow seem like they should be part
of the call group.
- Also, if we did, fixup_sched_groups() would move the
+ Also, if we did, chain_to_prev_insn would move the
deps of the debug insn to the call insn, modifying
non-debug post-dependency counts of the debug insn
dependencies and otherwise messing with the scheduling
return true;
}
+/* Return true if INSN should be made dependent on the previous instruction
+ group, and if all INSN's dependencies should be moved to the first
+ instruction of that group. */
+
+static bool
+chain_to_prev_insn_p (rtx insn)
+{
+ rtx prev, x;
+
+ /* INSN forms a group with the previous instruction. */
+ if (SCHED_GROUP_P (insn))
+ return true;
+
+ /* If the previous instruction clobbers a register R and this one sets
+ part of R, the clobber was added specifically to help us track the
+ liveness of R. There's no point scheduling the clobber and leaving
+ INSN behind, especially if we move the clobber to another block. */
+ prev = prev_nonnote_nondebug_insn (insn);
+ if (prev
+ && INSN_P (prev)
+ && BLOCK_FOR_INSN (prev) == BLOCK_FOR_INSN (insn)
+ && GET_CODE (PATTERN (prev)) == CLOBBER)
+ {
+ x = XEXP (PATTERN (prev), 0);
+ if (set_of (x, insn))
+ return true;
+ }
+
+ return false;
+}
+
/* Analyze INSN with DEPS as a context. */
void
deps_analyze_insn (struct deps_desc *deps, rtx insn)
/* Fixup the dependencies in the sched group. */
if ((NONJUMP_INSN_P (insn) || JUMP_P (insn))
- && SCHED_GROUP_P (insn) && !sel_sched_p ())
- fixup_sched_groups (insn);
+ && chain_to_prev_insn_p (insn)
+ && !sel_sched_p ())
+ chain_to_prev_insn (insn);
}
/* Initialize DEPS for the new block beginning with HEAD. */