enum Ref [src]
A reference to ZIR instruction, or to an InternPool index, or neither.
If the integer tag value is < InternPool.static_len, then it
corresponds to an InternPool index. Otherwise, this refers to a ZIR
instruction.
The tag type is specified so that it is safe to bitcast between []u32
and []Ref.
Fields
u0_type
i0_type
u1_type
u8_type
i8_type
u16_type
i16_type
u29_type
u32_type
i32_type
u64_type
i64_type
u80_type
u128_type
i128_type
usize_type
isize_type
c_char_type
c_short_type
c_ushort_type
c_int_type
c_uint_type
c_long_type
c_ulong_type
c_longlong_type
c_ulonglong_type
c_longdouble_type
f16_type
f32_type
f64_type
f80_type
f128_type
anyopaque_type
bool_type
void_type
type_type
anyerror_type
comptime_int_type
comptime_float_type
noreturn_type
anyframe_type
null_type
undefined_type
enum_literal_type
manyptr_u8_type
manyptr_const_u8_type
manyptr_const_u8_sentinel_0_type
single_const_pointer_to_comptime_int_type
slice_const_u8_type
slice_const_u8_sentinel_0_type
vector_16_i8_type
vector_32_i8_type
vector_1_u8_type
vector_2_u8_type
vector_4_u8_type
vector_8_u8_type
vector_16_u8_type
vector_32_u8_type
vector_8_i16_type
vector_16_i16_type
vector_8_u16_type
vector_16_u16_type
vector_4_i32_type
vector_8_i32_type
vector_4_u32_type
vector_8_u32_type
vector_2_i64_type
vector_4_i64_type
vector_2_u64_type
vector_4_u64_type
vector_4_f16_type
vector_8_f16_type
vector_2_f32_type
vector_4_f32_type
vector_8_f32_type
vector_2_f64_type
vector_4_f64_type
optional_noreturn_type
anyerror_void_error_union_type
adhoc_inferred_error_set_type
generic_poison_type
empty_tuple_type
undef
zero
zero_usize
zero_u8
one
one_usize
one_u8
four_u8
negative_one
void_value
unreachable_value
null_value
bool_true
bool_false
empty_tuple
none = std.math.maxInt(u32)This Ref does not correspond to any ZIR instruction or constant
value and may instead be used as a sentinel to indicate null.
_
Members
- toIndex (Function)
- toIndexAllowNone (Function)
Source
pub const Ref = enum(u32) {
u0_type,
i0_type,
u1_type,
u8_type,
i8_type,
u16_type,
i16_type,
u29_type,
u32_type,
i32_type,
u64_type,
i64_type,
u80_type,
u128_type,
i128_type,
usize_type,
isize_type,
c_char_type,
c_short_type,
c_ushort_type,
c_int_type,
c_uint_type,
c_long_type,
c_ulong_type,
c_longlong_type,
c_ulonglong_type,
c_longdouble_type,
f16_type,
f32_type,
f64_type,
f80_type,
f128_type,
anyopaque_type,
bool_type,
void_type,
type_type,
anyerror_type,
comptime_int_type,
comptime_float_type,
noreturn_type,
anyframe_type,
null_type,
undefined_type,
enum_literal_type,
manyptr_u8_type,
manyptr_const_u8_type,
manyptr_const_u8_sentinel_0_type,
single_const_pointer_to_comptime_int_type,
slice_const_u8_type,
slice_const_u8_sentinel_0_type,
vector_16_i8_type,
vector_32_i8_type,
vector_1_u8_type,
vector_2_u8_type,
vector_4_u8_type,
vector_8_u8_type,
vector_16_u8_type,
vector_32_u8_type,
vector_8_i16_type,
vector_16_i16_type,
vector_8_u16_type,
vector_16_u16_type,
vector_4_i32_type,
vector_8_i32_type,
vector_4_u32_type,
vector_8_u32_type,
vector_2_i64_type,
vector_4_i64_type,
vector_2_u64_type,
vector_4_u64_type,
vector_4_f16_type,
vector_8_f16_type,
vector_2_f32_type,
vector_4_f32_type,
vector_8_f32_type,
vector_2_f64_type,
vector_4_f64_type,
optional_noreturn_type,
anyerror_void_error_union_type,
adhoc_inferred_error_set_type,
generic_poison_type,
empty_tuple_type,
undef,
zero,
zero_usize,
zero_u8,
one,
one_usize,
one_u8,
four_u8,
negative_one,
void_value,
unreachable_value,
null_value,
bool_true,
bool_false,
empty_tuple,
/// This Ref does not correspond to any ZIR instruction or constant
/// value and may instead be used as a sentinel to indicate null.
none = std.math.maxInt(u32),
_,
pub fn toIndex(inst: Ref) ?Index {
assert(inst != .none);
const ref_int = @intFromEnum(inst);
if (ref_int >= @intFromEnum(Index.ref_start_index)) {
return @enumFromInt(ref_int - @intFromEnum(Index.ref_start_index));
} else {
return null;
}
}
pub fn toIndexAllowNone(inst: Ref) ?Index {
if (inst == .none) return null;
return toIndex(inst);
}
}