Beispiel #1
0
def h5_create_dset(context, builder, sig, args):
    fg_id, dset_name, counts, dtype_str = args

    dset_name = gen_get_unicode_chars(context, builder, dset_name)
    dtype_str = gen_get_unicode_chars(context, builder, dtype_str)

    # extra last arg type for type enum
    arg_typs = [h5file_lir_type, lir.IntType(8).as_pointer(), lir.IntType(32),
                lir.IntType(64).as_pointer(),
                lir.IntType(32)]
    fnty = lir.FunctionType(h5file_lir_type, arg_typs)

    fn = builder.module.get_or_insert_function(
        fnty, name="hpat_h5_create_dset")

    ndims = sig.args[2].count
    ndims_arg = lir.Constant(lir.IntType(32), ndims)

    # store size vars array struct to pointer
    count_ptr = cgutils.alloca_once(builder, counts.type)
    builder.store(counts, count_ptr)

    t_fnty = lir.FunctionType(lir.IntType(32), [lir.IntType(8).as_pointer()])
    t_fn = builder.module.get_or_insert_function(
        t_fnty, name="hpat_h5_get_type_enum")
    typ_arg = builder.call(t_fn, [dtype_str])

    call_args = [fg_id, dset_name, ndims_arg,
                 builder.bitcast(count_ptr, lir.IntType(64).as_pointer()),
                 typ_arg]

    return builder.call(fn, call_args)
Beispiel #2
0
    def h5_open(context, builder, sig, args):
        fname = args[0]
        mode = args[1]
        fname = gen_get_unicode_chars(context, builder, fname)
        mode = gen_get_unicode_chars(context, builder, mode)

        is_parallel = context.get_constant(types.int64, 0) if len(args) < 3 else args[2]
        fnty = lir.FunctionType(h5file_lir_type, [lir.IntType(
            8).as_pointer(), lir.IntType(8).as_pointer(), lir.IntType(64)])
        fn = builder.module.get_or_insert_function(fnty, name="hpat_h5_open")
        return builder.call(fn, [fname, mode, is_parallel])
Beispiel #3
0
def h5_open_dset_lower(context, builder, sig, args):
    fg_id, dset_name = args
    dset_name = gen_get_unicode_chars(context, builder, dset_name)

    fnty = lir.FunctionType(h5file_lir_type, [h5file_lir_type, lir.IntType(8).as_pointer()])
    fn = builder.module.get_or_insert_function(fnty, name="hpat_h5_open_dset_or_group_obj")
    return builder.call(fn, [fg_id, dset_name])
Beispiel #4
0
def lower_dict_in_op(context, builder, sig, args):
    set_str, unicode_str = args
    char_str = gen_get_unicode_chars(context, builder, unicode_str)
    fnty = lir.FunctionType(
        lir.IntType(1),
        [lir.IntType(8).as_pointer(),
         lir.IntType(8).as_pointer()])
    fn = builder.module.get_or_insert_function(fnty, name="set_in_string")
    return builder.call(fn, [char_str, set_str])