+ if (is_Phi(to_spill)) {
+ int i, arity;
+
+ /* create spillinfos for the phi arguments */
+ for (i = 0, arity = get_irn_arity(to_spill); i < arity; ++i) {
+ ir_node *arg = get_irn_n(to_spill, i);
+ get_spillinfo(env, arg);
+ }
+
+#if 1
+ /* hackery... sometimes the morgan algo spilled the value of a phi,
+ * the belady algo decides later to spill the whole phi, then sees the
+ * spill node and adds a reload for that spill node, problem is the
+ * reload gets attach to that same spill (and is totally unnecessary)
+ */
+ if (info->old_spill != NULL &&
+ (before == info->old_spill || value_dominates(before, info->old_spill)))
+ {
+ printf("spilledphi hack was needed...\n");
+ before = sched_next(info->old_spill);
+ }
+#endif
+ }
+
+ assert(!is_Proj(before) && !be_is_Keep(before));
+
+ /* put reload into list */
+ rel = obstack_alloc(&env->obst, sizeof(rel[0]));
+ rel->next = info->reloaders;
+ rel->reloader = before;
+ rel->rematted_node = NULL;
+ if(!allow_remat) {
+ rel->remat_cost_delta = REMAT_COST_INFINITE;
+ } else {
+ rel->remat_cost_delta = 0;
+ }
+
+ info->reloaders = rel;
+ assert(info->reload_cls == NULL || info->reload_cls == reload_cls);
+ info->reload_cls = reload_cls;
+
+ DBG((dbg, LEVEL_1, "creating spillinfo for %+F, will be reloaded before %+F, may%s be rematerialized\n",
+ to_spill, before, allow_remat ? "" : " not"));
+}
+
+ir_node *be_get_end_of_block_insertion_point(const ir_node *block)
+{
+ ir_node *last = sched_last(block);
+
+ /* we might have projs and keepanys behind the jump... */
+ while(is_Proj(last) || be_is_Keep(last)) {
+ last = sched_prev(last);
+ assert(!sched_is_end(last));