- if(is_Phi(node)) {
- sched_add_after(node, copy);
- goto placed;
- }
- if(value == node) {
- sched_add_after(node, copy);
- goto placed;
- }
- for(i = 0, arity = get_irn_arity(node); i < arity; ++i) {
- ir_node *arg = get_irn_n(node, i);
- if(arg == value) {
- sched_add_after(node, copy);
- goto placed;
- }
- }
+ /* Collect all values living at start of block */
+ starters = NEW_ARR_F(loc_t, 0);
+
+ /* rebuild schedule time information, because it seems to be broken */
+ sched_renumber(block);
+
+ DBG((dbg, DBG_START, "Living at start of %+F:\n", block));
+ first = sched_first(block);
+ sched_foreach(block, irn) {
+ if(!is_Phi(irn))
+ break;
+ if(!arch_irn_consider_in_reg_alloc(env->arch, env->cls, irn))
+ continue;
+
+ loc.irn = irn;
+ loc.time = get_distance(env, first, 0, irn, 0);
+ ARR_APP1(loc_t, starters, loc);
+ DBG((dbg, DBG_START, " %+F:\n", irn));
+ }
+
+ be_lv_foreach(env->cenv->lv, block, be_lv_state_in, i) {
+ ir_node *irn = be_lv_get_irn(env->cenv->lv, block, i);
+ if (!arch_irn_consider_in_reg_alloc(env->arch, env->cls, irn))
+ continue;
+
+ loc.irn = irn;
+ loc.time = get_distance(env, first, 0, irn, 0);
+ ARR_APP1(loc_t, starters, loc);
+ DBG((dbg, DBG_START, " %+F:\n", irn));