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
def impl_T_star_to_T_star(context, builder, fromty, toty, value): return builder.bitcast(value, Type.fromnumba(toty).tollvmir())
def impl_intp_to_T_star(context, builder, fromty, toty, value): return builder.inttoptr(value, Type.fromnumba(toty).tollvmir())
def fromnumba(t): return Type.fromnumba(t, target_info)
def fromnumba(t): return Type.fromnumba(t)