+ /* Mark any registers dead after INSN as dead now. */
+
+ for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
+ if (REG_NOTE_KIND (link) == REG_DEAD)
+ mark_reg_death (XEXP (link, 0));
+
+ /* Mark any registers set in INSN as live,
+ and mark them as conflicting with all other live regs.
+ Clobbers are processed again, so they conflict with
+ the registers that are set. */
+
+ note_stores (PATTERN (insn), mark_reg_store, NULL);
+
+#ifdef AUTO_INC_DEC
+ for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
+ if (REG_NOTE_KIND (link) == REG_INC)
+ mark_reg_store (XEXP (link, 0), NULL_RTX, NULL);
+#endif
+ while (n_regs_set-- > 0)
+ {
+ rtx note = find_regno_note (insn, REG_UNUSED,
+ REGNO (regs_set[n_regs_set]));
+ if (! note)
+ continue;
+
+ mark_reg_death (XEXP (note, 0));
+ }
+ }
+ }
+ bitmap_clear (&curr_regs_live);
+ if (flag_ira_region == IRA_REGION_MIXED
+ || flag_ira_region == IRA_REGION_ALL)
+ FOR_EACH_LOOP (li, loop, 0)
+ {
+ EXECUTE_IF_SET_IN_BITMAP (&LOOP_DATA (loop)->regs_live, 0, j, bi)
+ if (! bitmap_bit_p (&LOOP_DATA (loop)->regs_ref, j))
+ {
+ enum reg_class pressure_class;
+ int nregs;
+
+ pressure_class = get_regno_pressure_class (j, &nregs);
+ LOOP_DATA (loop)->max_reg_pressure[pressure_class] -= nregs;
+ }
+ }
+ if (dump_file == NULL)
+ return;
+ FOR_EACH_LOOP (li, loop, 0)
+ {
+ parent = loop_outer (loop);
+ fprintf (dump_file, "\n Loop %d (parent %d, header bb%d, depth %d)\n",
+ loop->num, (parent == NULL ? -1 : parent->num),
+ loop->header->index, loop_depth (loop));
+ fprintf (dump_file, "\n ref. regnos:");
+ EXECUTE_IF_SET_IN_BITMAP (&LOOP_DATA (loop)->regs_ref, 0, j, bi)
+ fprintf (dump_file, " %d", j);
+ fprintf (dump_file, "\n live regnos:");
+ EXECUTE_IF_SET_IN_BITMAP (&LOOP_DATA (loop)->regs_live, 0, j, bi)
+ fprintf (dump_file, " %d", j);
+ fprintf (dump_file, "\n Pressure:");
+ for (i = 0; (int) i < ira_pressure_classes_num; i++)
+ {
+ enum reg_class pressure_class;
+
+ pressure_class = ira_pressure_classes[i];
+ if (LOOP_DATA (loop)->max_reg_pressure[pressure_class] == 0)
+ continue;
+ fprintf (dump_file, " %s=%d", reg_class_names[pressure_class],
+ LOOP_DATA (loop)->max_reg_pressure[pressure_class]);
+ }
+ fprintf (dump_file, "\n");
+ }
+}
+
+\f
+
+/* Move the invariants out of the loops. */
+
+void
+move_loop_invariants (void)
+{
+ struct loop *loop;
+ loop_iterator li;
+
+ if (flag_ira_loop_pressure)
+ {
+ df_analyze ();
+ regstat_init_n_sets_and_refs ();
+ ira_set_pseudo_classes (dump_file);
+ calculate_loop_reg_pressure ();
+ regstat_free_n_sets_and_refs ();
+ }
+ df_set_flags (DF_EQ_NOTES + DF_DEFER_INSN_RESCAN);
+ /* Process the loops, innermost first. */
+ FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
+ {
+ curr_loop = loop;
+ /* move_single_loop_invariants for very large loops
+ is time consuming and might need a lot of memory. */
+ if (loop->num_nodes <= (unsigned) LOOP_INVARIANT_MAX_BBS_IN_LOOP)
+ move_single_loop_invariants (loop);
+ }
+
+ FOR_EACH_LOOP (li, loop, 0)
+ {
+ free_loop_data (loop);
+ }