Example #1
0
def resolve_pow(env, restype, args):
    promote = env.crnt.typesystem.promote
    if restype.is_numeric:
        type = reduce(promote, [double, restype] + [a.type for a in args])
        signature = type(*[type] * len(args))
        result = nodes.MathCallNode(signature, args, None, name='pow')
    else:
        result = nodes.call_pyfunc(pow, args)
    return nodes.CoercionNode(result, restype)
Example #2
0
def resolve_libc_math(args, py_func, type):
    signature = intrinsic_signature(len(args), type)
    math_name = get_funcname(py_func)
    name = math_suffix(math_name, type)

    use_double_impl = not have_impl(name)
    if use_double_impl:
        assert have_double_impl(math_name)
        signature = double(*[double] * len(args))
        name = math_suffix(math_name, double)

    result = nodes.MathCallNode(signature, args, llvm_func=None,
                                py_func=py_func, name=name)
    return nodes.CoercionNode(result, type)
Example #3
0
def math_call(name, args, dst_type):
    signature = dst_type(*[a.type for a in args])
    return nodes.MathCallNode(signature, args, None, name=name)