示例#1
0
def cast(typingctx, ptr, typ):
    """Cast pointer value to any pointer type."""
    if isinstance(typ, nb_types.StringLiteral):
        dtype = Type.fromstring(typ.literal_value)
    elif isinstance(typ, nb_types.TypeRef):
        dtype = Type.fromnumba(typ.key)
    else:
        return
    assert dtype.is_pointer
    sig = dtype.tonumba()(ptr, typ)

    def codegen(context, builder, signature, args):
        return builder.bitcast(args[0], dtype.tollvmir())

    return sig, codegen
示例#2
0
def impl_T_star_to_T_star(context, builder, fromty, toty, value):
    return builder.bitcast(value, Type.fromnumba(toty).tollvmir())
示例#3
0
def impl_intp_to_T_star(context, builder, fromty, toty, value):
    return builder.inttoptr(value, Type.fromnumba(toty).tollvmir())
示例#4
0
 def fromnumba(t):
     return Type.fromnumba(t, target_info)
示例#5
0
 def fromnumba(t):
     return Type.fromnumba(t)