+ /* check all Live-Ins */
+ be_lv_foreach(lv, block, be_lv_state_in, i) {
+ ir_node *node = be_lv_get_irn(lv, block, i);
+
+ loc = to_take_or_not_to_take(first, node, loop);
+
+ if (! USES_IS_INFINITE(loc.time)) {
+ if (USES_IS_PENDING(loc.time))
+ ARR_APP1(loc_t, delayed, loc);
+ else
+ ARR_APP1(loc_t, starters, loc);
+ }
+ }
+
+ pressure = be_get_loop_pressure(loop_ana, cls, loop);
+ assert(ARR_LEN(delayed) <= (signed)pressure);
+ free_slots = n_regs - ARR_LEN(starters);
+ free_pressure_slots = n_regs - (pressure - ARR_LEN(delayed));
+ free_slots = MIN(free_slots, free_pressure_slots);
+
+ /* so far we only put nodes into the starters list that are used inside
+ * the loop. If register pressure in the loop is low then we can take some
+ * values and let them live through the loop */
+ if(free_slots > 0) {
+ qsort(delayed, ARR_LEN(delayed), sizeof(delayed[0]), loc_compare);
+
+ for (i = 0; i < ARR_LEN(delayed) && i < free_slots; ++i) {
+ DB((dbg, DBG_START, " delayed %+F taken\n", delayed[i].node));
+ ARR_APP1(loc_t, starters, delayed[i]);
+ delayed[i].node = NULL;
+ }
+ }
+
+ /* spill phis (the actual phis not just their values) that are in this block
+ * but not in the start workset */
+ for (i = ARR_LEN(delayed) - 1; i >= 0; --i) {
+ ir_node *node = delayed[i].node;
+ if(node == NULL || !is_Phi(node) || get_nodes_block(node) != block)
+ continue;
+
+ DB((dbg, DBG_START, " spilling delayed phi %+F\n", node));
+ be_spill_phi(senv, node);
+ }
+ DEL_ARR_F(delayed);
+
+ /* Sort start values by first use */
+ qsort(starters, ARR_LEN(starters), sizeof(starters[0]), loc_compare);
+
+ /* Copy the best ones from starters to start workset */
+ ws_count = MIN(ARR_LEN(starters), n_regs);
+ workset_clear(ws);
+ workset_bulk_fill(ws, ws_count, starters);
+
+ /* spill phis (the actual phis not just their values) that are in this block
+ * but not in the start workset */
+ len = ARR_LEN(starters);
+ for (i = ws_count; i < len; ++i) {
+ ir_node *node = starters[i].node;
+ if (! is_Phi(node) || get_nodes_block(node) != block)