Пример #1
0
 @Override
 protected void verify() {
   super.verify();
   assert (name().startsWith("I")
           && x.getKind() == Kind.Int
           && y.getKind().getStackKind() == Kind.Int)
       || (name().startsWith("L") && x.getKind() == Kind.Long && y.getKind() == Kind.Long)
       || (name().startsWith("A") && x.getKind() == Kind.Object && y.getKind() == Kind.Object)
       || (name().startsWith("F") && x.getKind() == Kind.Float && y.getKind() == Kind.Float)
       || (name().startsWith("D") && x.getKind() == Kind.Double && y.getKind() == Kind.Double);
 }
Пример #2
0
  private static void verifyKind(SPARCArithmetic opcode, Value result, Value x, Value y) {
    Kind rk;
    Kind xk;
    Kind yk;
    Kind xsk;
    Kind ysk;

    switch (opcode) {
      case IADD:
      case ISUB:
      case IMUL:
      case IDIV:
      case IREM:
      case IAND:
      case IOR:
      case IXOR:
      case ISHL:
      case ISHR:
      case IUSHR:
      case IUDIV:
      case IUREM:
        rk = result.getKind().getStackKind();
        xsk = x.getKind().getStackKind();
        ysk = y.getKind().getStackKind();
        boolean valid = false;
        for (Kind k : new Kind[] {Kind.Int, Kind.Short, Kind.Byte, Kind.Char}) {
          valid |= rk == k && xsk == k && ysk == k;
        }
        assert valid : "rk: " + rk + " xsk: " + xsk + " ysk: " + ysk;
        break;
      case LADD:
      case LSUB:
      case LMUL:
      case LDIV:
      case LREM:
      case LAND:
      case LOR:
      case LXOR:
      case LUDIV:
      case LUREM:
        rk = result.getKind();
        xk = x.getKind();
        yk = y.getKind();
        assert rk == Kind.Long && xk == Kind.Long && yk == Kind.Long;
        break;
      case LSHL:
      case LSHR:
      case LUSHR:
        rk = result.getKind();
        xk = x.getKind();
        yk = y.getKind();
        assert rk == Kind.Long && xk == Kind.Long && (yk == Kind.Int || yk == Kind.Long);
        break;
      case FADD:
      case FSUB:
      case FMUL:
      case FDIV:
      case FREM:
        rk = result.getKind();
        xk = x.getKind();
        yk = y.getKind();
        assert (rk == Kind.Float || rk == Kind.Double) && xk == Kind.Float && yk == Kind.Float;
        break;
      case DAND:
      case DADD:
      case DSUB:
      case DMUL:
      case DDIV:
      case DREM:
        rk = result.getKind();
        xk = x.getKind();
        yk = y.getKind();
        assert rk == Kind.Double && xk == Kind.Double && yk == Kind.Double
            : "opcode=" + opcode + ", result kind=" + rk + ", x kind=" + xk + ", y kind=" + yk;
        break;
      default:
        throw GraalInternalError.shouldNotReachHere("missing: " + opcode);
    }
  }