- if (arch_irn_is(env->arch_env, to_spill, dont_spill)) {
- if (env->chordal_env->opts->vrfy_option == BE_CH_VRFY_WARN)
- ir_fprintf(stderr, "Verify warning: spilling 'dont_spill' node %+F\n", to_spill);
- else if (env->chordal_env->opts->vrfy_option == BE_CH_VRFY_ASSERT)
- assert(0 && "Attempt to spill a node marked 'dont_spill'");
- }
-
- spillinfo->spill = be_spill(env->arch_env, to_spill);
- sched_add_after_insn(to_spill, spillinfo->spill);
-}
-
-static void spill_node(spill_env_t *env, spill_info_t *spillinfo);
-
-/**
- * If the first usage of a Phi result would be out of memory
- * there is no sense in allocating a register for it.
- * Thus we spill it and all its operands to the same spill slot.
- * Therefore the phi/dataB becomes a phi/Memory
- *
- * @param senv the spill environment
- * @param phi the Phi node that should be spilled
- * @param ctx_irn an user of the spilled node
- */
-static void spill_phi(spill_env_t *env, spill_info_t *spillinfo) {
- ir_node *phi = spillinfo->spilled_node;
- int i;
- int arity = get_irn_arity(phi);
- ir_node *block = get_nodes_block(phi);
- ir_node **ins;
-
- assert(is_Phi(phi));
-
- /* build a new PhiM */
- ins = alloca(sizeof(ir_node*) * arity);
- for(i = 0; i < arity; ++i) {
- ins[i] = get_irg_bad(env->chordal_env->irg);
- }
- spillinfo->spill = new_r_Phi(env->chordal_env->irg, block, arity, ins, mode_M);
-
- for(i = 0; i < arity; ++i) {
- ir_node *arg = get_irn_n(phi, i);
- spill_info_t *arg_info = get_spillinfo(env, arg);
+ /*
+ * insert copies for all constrained arguments living through the node
+ * and being constrained to a register which also occurs in out constraints.
+ */
+ rbitset_alloca(tmp, cls->n_regs);
+ for (i = 0; i < arity; ++i) {
+ const arch_register_req_t *req;
+ ir_node *in;
+ ir_node *copy;
+
+ /*
+ * Check, if
+ * 1) the operand is constrained.
+ * 2) lives through the node.
+ * 3) is constrained to a register occurring in out constraints.
+ */
+ req = arch_get_register_req(node, i);
+ if (req->cls != cls)
+ continue;
+ if (!(req->type & arch_register_req_type_limited))
+ continue;