} else { throw new OPT_OptimizingCompilerException("Unexpected case of trap_if"+s); }
  protected final void TRAP_IF_IMM(OPT_Instruction s) {    OPT_RegisterOperand gRes = TrapIf.getClearGuardResult(s);    OPT_RegisterOperand v1 =  (OPT_RegisterOperand)TrapIf.getClearVal1(s);    OPT_IntConstantOperand v2 = (OPT_IntConstantOperand)TrapIf.getClearVal2(s);    OPT_ConditionOperand cond = TrapIf.getClearCond(s);    OPT_TrapCodeOperand tc = TrapIf.getClearTCode(s);    switch(tc.getTrapCode()) {    case VM_Runtime.TRAP_ARRAY_BOUNDS:      {        if (cond.isLOWER_EQUAL()) {          EMIT(MIR_Trap.mutate(s, PPC_TWI, gRes,                                new OPT_PowerPCTrapOperand(cond),                               v1, v2, tc));        } else if (cond.isHIGHER_EQUAL()) {          // have flip the operands and use non-immediate so trap handler can recognize.          OPT_RegisterOperand tmp = regpool.makeTempInt();          IntConstant(tmp.register, v2.value);          EMIT(MIR_Trap.mutate(s, PPC_TW, gRes,                               new OPT_PowerPCTrapOperand(cond.flipOperands()),                               tmp, v1, tc));         } else {          throw new OPT_OptimizingCompilerException("Unexpected case of trap_if"+s);        }      }      break;    case VM_Runtime.TRAP_DIVIDE_BY_ZERO:      {        //-#if RVM_FOR_32_ADDR        // A slightly ugly matter, but we need to deal with combining        // the two pieces of a long register from a LONG_ZERO_CHECK.          // A little awkward, but probably the easiest workaround...        if (v1.type.isLongType()) {          OPT_RegisterOperand rr = regpool.makeTempInt();          EMIT(MIR_Binary.create(PPC_OR, rr, v1,                                  I(regpool.getSecondReg(v1.register))));          v1 = rr.copyD2U();        }                if (cond.isEQUAL() && v2.value == 0) {          EMIT(MIR_Trap.mutate(s, PPC_TWI, gRes,                                new OPT_PowerPCTrapOperand(cond),                               v1, v2, tc));        } else {          throw new OPT_OptimizingCompilerException("Unexpected case of trap_if"+s);        }        //-#endif        //-#if RVM_FOR_64_ADDR        if (cond.isEQUAL() && v2.value == 0) {          if (v1.type.isLongType()) {            EMIT(MIR_Trap.mutate(s, PPC64_TDI, gRes,                                 new OPT_PowerPCTrapOperand(cond),                                 v1, v2, tc));          } else {            EMIT(MIR_Trap.mutate(s, PPC_TWI, gRes,                                 new OPT_PowerPCTrapOperand(cond),                                 v1, v2, tc));          }        } else {          throw new OPT_OptimizingCompilerException("Unexpected case of trap_if"+s);        }        //-#endif      }      break;    default:      throw new OPT_OptimizingCompilerException("Unexpected case of trap_if"+s);    }  }