+ DB((dbg, DBG_WSETS, "Start workset for %+F:\n", block));
+ workset_foreach(ws, irn, iter) {
+ DB((dbg, DBG_WSETS, " %+F (%u)\n", irn,
+ workset_get_time(ws, iter)));
+ }
+
+ block_info->start_workset = workset_clone(ws);
+
+ /* process the block from start to end */
+ DB((dbg, DBG_WSETS, "Processing...\n"));
+ ir_nodeset_init(&used);
+ instr_nr = 0;
+ /* TODO: this leaks (into the obstack)... */
+ new_vals = new_workset();
+
+ sched_foreach(block, irn) {
+ int i, arity;
+ assert(workset_get_length(ws) <= n_regs);
+
+ /* Phis are no real instr (see insert_starters()) */
+ if (is_Phi(irn)) {
+ continue;
+ }
+ DB((dbg, DBG_DECIDE, " ...%+F\n", irn));
+
+ /* set instruction in the workset */
+ instr = irn;
+
+ /* allocate all values _used_ by this instruction */
+ workset_clear(new_vals);
+ for(i = 0, arity = get_irn_arity(irn); i < arity; ++i) {
+ ir_node *in = get_irn_n(irn, i);
+ if (!arch_irn_consider_in_reg_alloc(arch_env, cls, in))
+ continue;
+
+ /* (note that "spilled" is irrelevant here) */
+ workset_insert(new_vals, in, false);
+ }
+ displace(new_vals, 1);
+
+ /* allocate all values _defined_ by this instruction */
+ workset_clear(new_vals);
+ if (get_irn_mode(irn) == mode_T) {
+ const ir_edge_t *edge;
+
+ foreach_out_edge(irn, edge) {
+ ir_node *proj = get_edge_src_irn(edge);
+ if (!arch_irn_consider_in_reg_alloc(arch_env, cls, proj))
+ continue;
+ workset_insert(new_vals, proj, false);
+ }
+ } else {
+ if (!arch_irn_consider_in_reg_alloc(arch_env, cls, irn))
+ continue;
+ workset_insert(new_vals, irn, false);
+ }
+ displace(new_vals, 0);
+
+ instr_nr++;
+ }
+ ir_nodeset_destroy(&used);
+
+ /* Remember end-workset for this block */
+ block_info->end_workset = workset_clone(ws);
+ DB((dbg, DBG_WSETS, "End workset for %+F:\n", block));
+ workset_foreach(ws, irn, iter)
+ DB((dbg, DBG_WSETS, " %+F (%u)\n", irn,
+ workset_get_time(ws, iter)));
+
+ /* add successor blocks into worklist */
+ foreach_block_succ(block, edge) {
+ ir_node *succ = get_edge_src_irn(edge);
+ pdeq_putr(worklist, succ);