func_decl * float_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
                                            unsigned arity, sort * const * domain, sort * range) {
    switch (k) {
    case OP_TO_FLOAT:
        return mk_to_float(k, num_parameters, parameters, arity, domain, range);
    case OP_FLOAT_MINUS_INF:
    case OP_FLOAT_PLUS_INF:
    case OP_FLOAT_NAN:
        return mk_float_const_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_RM_NEAREST_TIES_TO_EVEN:
    case OP_RM_NEAREST_TIES_TO_AWAY:
    case OP_RM_TOWARD_POSITIVE:
    case OP_RM_TOWARD_NEGATIVE:
    case OP_RM_TOWARD_ZERO:
        return mk_rm_const_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FLOAT_EQ:
    case OP_FLOAT_LT:
    case OP_FLOAT_GT:
    case OP_FLOAT_LE:
    case OP_FLOAT_GE:
        return mk_bin_rel_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FLOAT_IS_ZERO:
    case OP_FLOAT_IS_NZERO:
    case OP_FLOAT_IS_PZERO:
    case OP_FLOAT_IS_SIGN_MINUS: 
        return mk_unary_rel_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FLOAT_ABS: 
    case OP_FLOAT_UMINUS:
        return mk_unary_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FLOAT_REM:
    case OP_FLOAT_MIN:
    case OP_FLOAT_MAX:
        return mk_binary_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FLOAT_ADD:
    case OP_FLOAT_MUL:
    case OP_FLOAT_DIV:
        return mk_rm_binary_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FLOAT_SUB:
        if (arity == 1) 
            return mk_unary_decl(OP_FLOAT_UMINUS, num_parameters, parameters, arity, domain, range);
        else
            return mk_rm_binary_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FLOAT_SQRT:
    case OP_FLOAT_ROUND_TO_INTEGRAL:
        return mk_rm_unary_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FLOAT_FUSED_MA:
        return mk_fused_ma(k, num_parameters, parameters, arity, domain, range);
    default:
        m_manager->raise_exception("unsupported floating point operator");
        return 0;
    }
}
Пример #2
0
func_decl * fpa_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
                                            unsigned arity, sort * const * domain, sort * range) {
    switch (k) {
    case OP_FPA_MINUS_INF:
    case OP_FPA_PLUS_INF:
    case OP_FPA_NAN:
    case OP_FPA_MINUS_ZERO:
    case OP_FPA_PLUS_ZERO:
        return mk_float_const_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_RM_NEAREST_TIES_TO_EVEN:
    case OP_FPA_RM_NEAREST_TIES_TO_AWAY:
    case OP_FPA_RM_TOWARD_POSITIVE:
    case OP_FPA_RM_TOWARD_NEGATIVE:
    case OP_FPA_RM_TOWARD_ZERO:
        return mk_rm_const_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_EQ:
    case OP_FPA_LT:
    case OP_FPA_GT:
    case OP_FPA_LE:
    case OP_FPA_GE:
        return mk_bin_rel_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_IS_ZERO:
    case OP_FPA_IS_NEGATIVE:
    case OP_FPA_IS_POSITIVE:
    case OP_FPA_IS_NAN:
    case OP_FPA_IS_INF:
    case OP_FPA_IS_NORMAL:
    case OP_FPA_IS_SUBNORMAL:
        return mk_unary_rel_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_ABS:
    case OP_FPA_NEG:
        return mk_unary_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_REM:
    case OP_FPA_MIN:
    case OP_FPA_MAX:
        return mk_binary_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_ADD:
    case OP_FPA_MUL:
    case OP_FPA_DIV:
        return mk_rm_binary_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_SUB:
        if (arity == 1)
            return mk_unary_decl(OP_FPA_NEG, num_parameters, parameters, arity, domain, range);
        else
            return mk_rm_binary_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_SQRT:
    case OP_FPA_ROUND_TO_INTEGRAL:
        return mk_rm_unary_decl(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_FMA:
        return mk_fma(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_FP:
        return mk_fp(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_TO_UBV:
        return mk_to_ubv(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_TO_SBV:
        return mk_to_sbv(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_TO_REAL:
        return mk_to_real(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_TO_FP:
        return mk_to_fp(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_TO_FP_UNSIGNED:
        return mk_to_fp_unsigned(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_TO_IEEE_BV:
        return mk_to_ieee_bv(k, num_parameters, parameters, arity, domain, range);

    case OP_FPA_BVWRAP:
        return mk_bv_wrap(k, num_parameters, parameters, arity, domain, range);
    case OP_FPA_BV2RM:
        return mk_bv2rm(k, num_parameters, parameters, arity, domain, range);

    default:
        m_manager->raise_exception("unsupported floating point operator");
        return nullptr;
    }
}