Example #1
0
def run(wrap, call_wrapped, ty):
    engine, mod, pm = ctx = support.make_llvm_context()
    double_func = make_double_func(mod, ty)
    wrap(double_func, 'wrapper')

    pymod = support.make_mod(ctx)
    result = call_wrapped(pymod.wrapper, 5 + 6j)
    assert result == 10 + 12j, result
Example #2
0
def run(wrap, call_wrapped, ty):
    engine, mod, pm = ctx = support.make_llvm_context()
    double_func = make_double_func(mod, ty)
    wrap(double_func, 'wrapper')

    pymod = support.make_mod(ctx)
    result = call_wrapped(pymod.wrapper, 5+6j)
    assert result == 10+12j, result
Example #3
0
def get_llvm_lib(asmfile=None):
    "Test getting the llvm lib from a clean environment"
    lctx = make_llvm_context()
    kwds = {'asmfile': asmfile} if asmfile else {}
    lmod = build.load_llvm_asm(**kwds)
    mod = types.ModuleType('llvmmod')
    llvm_support.wrap_llvm_module(lmod, lctx.engine, mod)

    result = mod.npy_sin(ctypes.c_double(10.0))
    expect = math.sin(10.0)
    assert result == expect, (result, expect)
Example #4
0
def get_llvm_lib(asmfile=None):
    "Test getting the llvm lib from a clean environment"
    lctx = make_llvm_context()
    kwds = { 'asmfile': asmfile } if asmfile else {}
    lmod = build.load_llvm_asm(**kwds)
    mod = types.ModuleType('llvmmod')
    llvm_support.wrap_llvm_module(lmod, lctx.engine, mod)

    result = mod.npy_sin(ctypes.c_double(10.0))
    expect = math.sin(10.0)
    assert result == expect, (result, expect)
Example #5
0
def new_ctx(lib, linker):
    engine, mod, pm = support.make_llvm_context()
    return _Ctx(engine, mod, pm, lib, linker, all_replacements())
Example #6
0
def new_ctx(lib, linker):
    engine, mod, pm = support.make_llvm_context()
    return _Ctx(engine, mod, pm, lib, linker, all_replacements())