- int new_dest;
- new_dest = alloc_int_reg (cfg, bb, tmp, ins, dreg_mask, ins->dreg, ®info [ins->dreg]);
- g_assert (new_dest >= 0);
- DEBUG (printf ("\tchanging dreg R%d to %s from %s\n", ins->dreg, mono_arch_regname (new_dest), mono_arch_regname (dest_sreg2)));
-
- prev_dreg = ins->dreg;
- assign_reg (cfg, rs, ins->dreg, new_dest, 0);
- clob_dreg = ins->dreg;
- create_copy_ins (cfg, bb, tmp, dest_sreg2, new_dest, ins, ip, 0);
- mono_regstate_free_int (rs, dest_sreg2);
- need_spill = FALSE;
- }
-
- if (is_global_ireg (ins->sreg2)) {
- MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sreg2, ins->sreg2, NULL, ip, 0);
- insert_before_ins (bb, ins, copy);
- need_assign = FALSE;
- }
- else {
- val = rs->vassign [ins->sreg2];
- if (val == dest_sreg2) {
- /* sreg2 is already assigned to the correct register */
- need_spill = FALSE;
- } else if (val < -1) {
- /* sreg2 is spilled, it can be assigned to dest_sreg2 */
- } else if (val >= 0) {
- /* sreg2 already assigned to another register */
- /*
- * We couldn't emit a copy from val to dest_sreg2, because
- * val might be spilled later while processing this
- * instruction. So we spill sreg2 so it can be allocated to
- * dest_sreg2.
+ val = rs->vassign [ins->dreg];
+ if (val == dest_sreg && ins->dreg != sreg) {
+ /*
+ * the destination register is already assigned to
+ * dest_sreg2: we need to allocate another register for it
+ * and then copy from this to dest_sreg2.