-static ir_node *spill_phi(spill_ilp_t *si, ir_node *phi, ir_node *ctx_irn)
-{
- int i, n;
- ir_mode *mode = get_irn_mode(phi);
- ir_node **ins;
- ir_node *bl = get_nodes_block(phi);
- ir_graph *irg = get_irn_irg(bl);
- spill_ctx_t *ctx;
-
- assert(is_Phi(phi));
-
- ctx = get_spill_ctx(si, phi, ctx_irn);
- if(ctx->spill)
- return ctx->spill;
-
- n = get_irn_arity(phi);
- ins = malloc(n * sizeof(ins[0]));
-
- for(i = 0; i < n; ++i)
- ins[i] = new_r_Unknown(irg, mode_M);
-
- ctx->spill = new_r_Phi(irg, bl, n, ins, mode_M);
- free(ins);
-
- for(i = 0; i < n; ++i) {
- ir_node *arg = get_irn_n(phi, i);
- ir_node *res;
-
- if(is_Phi(arg))
- res = spill_phi(si, arg, ctx_irn);
- else
- res = spill_irn(si, arg, ctx_irn);
-
- set_irn_n(ctx->spill, i, res);
- }
-
- return ctx->spill;
-}
-
-static ir_node *spill_live_range(spill_ilp_t *si, live_range_t *lr)
-{
- const live_range_t *closest = lr->use_head->closest_use;
-
- if(is_Phi(lr->irn) && closest && is_spilled(si, closest))
- return spill_phi(si, lr->irn, lr->irn);
- else
- return spill_irn(si, lr->irn, lr->irn);
-}
-
-