Mimic the behaviour of its counterpart, mono_op_to_op_imm, since crashing limits the usage of the function and it is the responsability of the upper layer.
case OP_IOR_IMM:
case OP_IXOR_IMM:
if ((imm8 = mono_arm_is_rotated_imm8 (ins->inst_imm, &rot_amount)) < 0) {
+ int opcode2 = mono_op_imm_to_op (ins->opcode);
ADD_NEW_INS (cfg, temp, OP_ICONST);
temp->inst_c0 = ins->inst_imm;
temp->dreg = mono_alloc_ireg (cfg);
ins->sreg2 = temp->dreg;
- ins->opcode = mono_op_imm_to_op (ins->opcode);
+ if (opcode2 == -1)
+ g_error ("mono_op_imm_to_op failed for %s\n", mono_inst_name (ins->opcode));
+ ins->opcode = opcode2;
}
if (ins->opcode == OP_SBB || ins->opcode == OP_ISBB || ins->opcode == OP_SUBCC)
goto loop_start;
case OP_IDIV_IMM:
case OP_IDIV_UN_IMM:
case OP_IREM_IMM:
- case OP_IREM_UN_IMM:
+ case OP_IREM_UN_IMM: {
+ int opcode2 = mono_op_imm_to_op (ins->opcode);
ADD_NEW_INS (cfg, temp, OP_ICONST);
temp->inst_c0 = ins->inst_imm;
temp->dreg = mono_alloc_ireg (cfg);
ins->sreg2 = temp->dreg;
- ins->opcode = mono_op_imm_to_op (ins->opcode);
+ if (opcode2 == -1)
+ g_error ("mono_op_imm_to_op failed for %s\n", mono_inst_name (ins->opcode));
+ ins->opcode = opcode2;
break;
+ }
case OP_LOCALLOC_IMM:
ADD_NEW_INS (cfg, temp, OP_ICONST);
temp->inst_c0 = ins->inst_imm;
break;
}
+ if (mono_op_imm_to_op (ins->opcode) == -1)
+ g_error ("mono_op_imm_to_op failed for %s\n", mono_inst_name (ins->opcode));
ins->opcode = mono_op_imm_to_op (ins->opcode);
if (ins->inst_imm == 0)
case OP_STOREI8_MEMBASE_IMM:
return OP_STOREI8_MEMBASE_REG;
}
+ if (mono_op_imm_to_op (op) == -1)
+ g_error ("mono_op_imm_to_op failed for %s\n", mono_inst_name (op));
return mono_op_imm_to_op (op);
}
case OP_STOREI8_MEMBASE_IMM:
return OP_STOREI8_MEMBASE_REG;
}
+ if (mono_op_imm_to_op (op) == -1)
+ g_error ("mono_op_imm_to_op failed for %s\n", mono_inst_name (op));
return mono_op_imm_to_op (op);
}
return OP_ICOMPARE;
case OP_LOCALLOC_IMM:
return OP_LOCALLOC;
- default:
- printf ("%s\n", mono_inst_name (opcode));
- g_assert_not_reached ();
- return -1;
}
+
+ return -1;
}
/*
void
mono_decompose_op_imm (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins)
{
+ int opcode2 = mono_op_imm_to_op (ins->opcode);
MonoInst *temp;
MONO_INST_NEW (cfg, temp, OP_ICONST);
temp->inst_c0 = ins->inst_imm;
temp->dreg = mono_alloc_ireg (cfg);
mono_bblock_insert_before_ins (bb, ins, temp);
- ins->opcode = mono_op_imm_to_op (ins->opcode);
+
+ if (opcode2 == -1)
+ g_error ("mono_op_imm_to_op failed for %s\n", mono_inst_name (ins->opcode));
+ ins->opcode = opcode2;
+
if (ins->opcode == OP_LOCALLOC)
ins->sreg1 = temp->dreg;
else