Tag
These names are used directly as the instruction names in the text format.
See data_field_map for a list of which Data fields are used by each Tag.
Fields of this type
Fields
- add:add
- Arithmetic addition, asserts no integer overflow.
- addwrap:addwrap
- Twos complement wrapping integer addition.
- add_sat:add_sat
- Saturating addition.
- add_unsafe:add_unsafe
- The same as `add` except no safety check.
- sub:sub
- Arithmetic subtraction.
- subwrap:subwrap
- Twos complement wrapping integer subtraction.
- sub_sat:sub_sat
- Saturating subtraction.
- mul:mul
- Arithmetic multiplication.
- mulwrap:mulwrap
- Twos complement wrapping integer multiplication.
- mul_sat:mul_sat
- Saturating multiplication.
- div_exact:div_exact
- Implements the `@divExact` builtin.
- div_floor:div_floor
- Implements the `@divFloor` builtin.
- div_trunc:div_trunc
- Implements the `@divTrunc` builtin.
- mod:mod
- Implements the `@mod` builtin.
- rem:rem
- Implements the `@rem` builtin.
- mod_rem:mod_rem
- Ambiguously remainder division or modulus.
- shl:shl
- Integer shift-left.
- shl_exact:shl_exact
- Implements the `@shlExact` builtin.
- shl_sat:shl_sat
- Saturating shift-left.
- shr:shr
- Integer shift-right.
- shr_exact:shr_exact
- Implements the `@shrExact` builtin.
- param:param
- Declares a parameter of the current function.
- param_comptime:param_comptime
- Same as `param` except the parameter is marked comptime.
- param_anytype:param_anytype
- Same as `param` except the parameter is marked anytype.
- param_anytype_comptime:param_anytype_comptime
- Same as `param` except the parameter is marked both comptime and anytype.
- array_cat:array_cat
- Array concatenation.
- array_mul:array_mul
- Array multiplication `a ** b`
- array_type:array_type
- `[N]T` syntax.
- array_type_sentinel:array_type_sentinel
- `[N:S]T` syntax.
- vector_type:vector_type
- `@Vector` builtin.
- elem_type:elem_type
- Given a pointer type, returns its element type.
- indexable_ptr_elem_type:indexable_ptr_elem_type
- Given an indexable pointer (slice, many-ptr, single-ptr-to-array), returns its
- splat_op_result_ty:splat_op_result_ty
- Given a vector or array type, strips off any error unions or
- indexable_ptr_len:indexable_ptr_len
- Given a pointer to an indexable object, returns the len property.
- anyframe_type:anyframe_type
- Create a `anyframe->T` type.
- as_node:as_node
- Type coercion to the function's return type.
- as_shift_operand:as_shift_operand
- Same as `as_node` but ignores runtime to comptime int error.
- bit_and:bit_and
- Bitwise AND.
- bitcast:bitcast
- Reinterpret the memory representation of a value as a different type.
- bit_not:bit_not
- Bitwise NOT.
- bit_or:bit_or
- Bitwise OR.
- block:block
- A labeled block of code, which can return a value.
- block_comptime:block_comptime
- Like `block`, but forces full evaluation of its contents at compile-time.
- block_inline:block_inline
- A list of instructions which are analyzed in the parent context, without
- declaration:declaration
- This instruction may only ever appear in the list of declarations for a
- suspend_block:suspend_block
- Implements `suspend {...}`.
- bool_not:bool_not
- Boolean NOT.
- bool_br_and:bool_br_and
- Short-circuiting boolean `and`.
- bool_br_or:bool_br_or
- Short-circuiting boolean `or`.
- @"break":@"break"
- Return a value from a block.
- break_inline:break_inline
- Return a value from a block.
- switch_continue:switch_continue
- Branch from within a switch case to the case specified by the operand.
- check_comptime_control_flow:check_comptime_control_flow
- Checks that comptime control flow does not happen inside a runtime block.
- call:call
- Function call.
- field_call:field_call
- Function call using `a.b()` syntax.
- builtin_call:builtin_call
- Implements the `@call` builtin.
- cmp_lt:cmp_lt
- `<`
- cmp_lte:cmp_lte
- `<=`
- cmp_eq:cmp_eq
- `==`
- cmp_gte:cmp_gte
- `>=`
- cmp_gt:cmp_gt
- `>`
- cmp_neq:cmp_neq
- `!=`
- condbr:condbr
- Conditional branch.
- condbr_inline:condbr_inline
- Same as `condbr`, except the condition is coerced to a comptime value, and
- @"try":@"try"
- Given an operand which is an error union, splits control flow.
- try_ptr:try_ptr
- Same as `try` except the operand is a pointer and the result is a pointer.
- error_set_decl:error_set_decl
- An error set type definition.
- dbg_stmt:dbg_stmt
- Declares the beginning of a statement.
- dbg_var_ptr:dbg_var_ptr
- Marks a variable declaration.
- dbg_var_val:dbg_var_val
- Same as `dbg_var_ptr` but the local is always a const and the operand
- decl_ref:decl_ref
- Uses a name to identify a Decl and takes a pointer to it.
- decl_val:decl_val
- Uses a name to identify a Decl and uses it as a value.
- load:load
- Load the value from a pointer.
- div:div
- Arithmetic division.
- elem_ptr_node:elem_ptr_node
- Given a pointer to an array, slice, or pointer, returns a pointer to the element at
- elem_ptr:elem_ptr
- Same as `elem_ptr_node` but used only for for loop.
- elem_val_node:elem_val_node
- Given an array, slice, or pointer, returns the element at the provided index.
- elem_val:elem_val
- Same as `elem_val_node` but used only for for loop.
- elem_val_imm:elem_val_imm
- Same as `elem_val` but takes the index as an immediate value.
- ensure_result_used:ensure_result_used
- Emits a compile error if the operand is not `void`.
- ensure_result_non_error:ensure_result_non_error
- Emits a compile error if an error is ignored.
- ensure_err_union_payload_void:ensure_err_union_payload_void
- Emits a compile error error union payload is not void.
- error_union_type:error_union_type
- Create a `E!T` type.
- error_value:error_value
- `error.Foo` syntax.
- @"export":@"export"
- Implements the `@export` builtin function.
- field_ptr:field_ptr
- Given a pointer to a struct or object that contains virtual fields, returns a pointer
- field_val:field_val
- Given a struct or object that contains virtual fields, returns the named field.
- field_ptr_named:field_ptr_named
- Given a pointer to a struct or object that contains virtual fields, returns a pointer
- field_val_named:field_val_named
- Given a struct or object that contains virtual fields, returns the named field.
- func:func
- Returns a function type, or a function instance, depending on whether
- func_inferred:func_inferred
- Same as `func` but has an inferred error set.
- func_fancy:func_fancy
- Represents a function declaration or function prototype, depending on
- import:import
- Implements the `@import` builtin.
- int:int
- Integer literal that fits in a u64.
- int_big:int_big
- Arbitrary sized integer literal.
- float:float
- A float literal that fits in a f64.
- float128:float128
- A float literal that fits in a f128.
- int_type:int_type
- Make an integer type out of signedness and bit count.
- is_non_null:is_non_null
- Return a boolean false if an optional is null.
- is_non_null_ptr:is_non_null_ptr
- Return a boolean false if an optional is null.
- is_non_err:is_non_err
- Return a boolean false if value is an error
- is_non_err_ptr:is_non_err_ptr
- Return a boolean false if dereferenced pointer is an error
- ret_is_non_err:ret_is_non_err
- Same as `is_non_er` but doesn't validate that the type can be an error.
- loop:loop
- A labeled block of code that loops forever.
- repeat:repeat
- Sends runtime control flow back to the beginning of the current block.
- repeat_inline:repeat_inline
- Sends comptime control flow back to the beginning of the current block.
- for_len:for_len
- Asserts that all the lengths provided match.
- merge_error_sets:merge_error_sets
- Merge two error sets into one, `E1 || E2`.
- ref:ref
- Turns an R-Value into a const L-Value.
- ret_node:ret_node
- Sends control flow back to the function's callee.
- ret_load:ret_load
- Sends control flow back to the function's callee.
- ret_implicit:ret_implicit
- Sends control flow back to the function's callee.
- ret_err_value:ret_err_value
- Sends control flow back to the function's callee.
- ret_err_value_code:ret_err_value_code
- A string name is provided which is an anonymous error set value.
- ret_ptr:ret_ptr
- Obtains a pointer to the return value.
- ret_type:ret_type
- Obtains the return type of the in-scope function.
- ptr_type:ptr_type
- Create a pointer type which can have a sentinel, alignment, address space, and/or bit range.
- slice_start:slice_start
- Slice operation `lhs[rhs..]`.
- slice_end:slice_end
- Slice operation `array_ptr[start..end]`.
- slice_sentinel:slice_sentinel
- Slice operation `array_ptr[start..end:sentinel]`.
- slice_length:slice_length
- Slice operation `array_ptr[start..][0..len]`.
- slice_sentinel_ty:slice_sentinel_ty
- Given a value which is a pointer to the LHS of a slice operation, return the sentinel
- store_node:store_node
- Same as `store` except provides a source location.
- store_to_inferred_ptr:store_to_inferred_ptr
- Same as `store_node` but the type of the value being stored will be
- str:str
- String Literal.
- negate:negate
- Arithmetic negation.
- negate_wrap:negate_wrap
- Twos complement wrapping integer negation.
- typeof:typeof
- Returns the type of a value.
- typeof_builtin:typeof_builtin
- Implements `@TypeOf` for one operand.
- typeof_log2_int_type:typeof_log2_int_type
- Given a value, look at the type of it, which must be an integer type.
- @"unreachable":@"unreachable"
- Asserts control-flow will not reach this instruction (`unreachable`).
- xor:xor
- Bitwise XOR.
- optional_type:optional_type
- Create an optional type '?T'
- optional_payload_safe:optional_payload_safe
- ?T => T with safety.
- optional_payload_unsafe:optional_payload_unsafe
- ?T => T without safety.
- optional_payload_safe_ptr:optional_payload_safe_ptr
- *?T => *T with safety.
- optional_payload_unsafe_ptr:optional_payload_unsafe_ptr
- *?T => *T without safety.
- err_union_payload_unsafe:err_union_payload_unsafe
- E!T => T without safety.
- err_union_payload_unsafe_ptr:err_union_payload_unsafe_ptr
- *E!T => *T without safety.
- err_union_code:err_union_code
- E!T => E without safety.
- err_union_code_ptr:err_union_code_ptr
- *E!T => E without safety.
- enum_literal:enum_literal
- An enum literal.
- decl_literal:decl_literal
- A decl literal.
- decl_literal_no_coerce:decl_literal_no_coerce
- The same as `decl_literal`, but the coercion is omitted.
- switch_block:switch_block
- A switch expression.
- switch_block_ref:switch_block_ref
- A switch expression.
- switch_block_err_union:switch_block_err_union
- A switch on an error union `a catch |err| switch (err) {...}`.
- validate_deref:validate_deref
- Check that operand type supports the dereference operand (.*).
- validate_destructure:validate_destructure
- Check that the operand's type is an array or tuple with the given number of elements.
- field_type_ref:field_type_ref
- Given a struct or union, and a field name as a Ref,
- opt_eu_base_ptr_init:opt_eu_base_ptr_init
- Given a pointer, initializes all error unions and optionals in the pointee to payloads,
- coerce_ptr_elem_ty:coerce_ptr_elem_ty
- Coerce a given value such that when a reference is taken, the resulting pointer will be
- validate_ref_ty:validate_ref_ty
- Given a type, validate that it is a pointer type suitable for return from the address-of
- validate_const:validate_const
- Given a value, check whether it is a valid local constant in this scope.
- struct_init_empty:struct_init_empty
- A struct literal with a specified explicit type, with no fields.
- struct_init_empty_result:struct_init_empty_result
- An anonymous struct literal with a known result type, with no fields.
- struct_init_empty_ref_result:struct_init_empty_ref_result
- An anonymous struct literal with no fields, returned by reference, with a known result
- struct_init_anon:struct_init_anon
- Struct initialization without a type.
- struct_init:struct_init
- Finalizes a typed struct or union initialization, performs validation, and returns the
- struct_init_ref:struct_init_ref
- Struct initialization syntax, make the result a pointer.
- validate_struct_init_ty:validate_struct_init_ty
- Checks that the type supports struct init syntax.
- validate_struct_init_result_ty:validate_struct_init_result_ty
- Like `validate_struct_init_ty`, but additionally accepts types which structs coerce to.
- validate_ptr_struct_init:validate_ptr_struct_init
- Given a set of `struct_init_field_ptr` instructions, assumes they are all part of a
- struct_init_field_type:struct_init_field_type
- Given a type being used for a struct initialization expression, returns the type of the
- struct_init_field_ptr:struct_init_field_ptr
- Given a pointer being used as the result pointer of a struct initialization expression,
- array_init_anon:array_init_anon
- Array initialization without a type.
- array_init:array_init
- Array initialization syntax with a known type.
- array_init_ref:array_init_ref
- Array initialization syntax, make the result a pointer.
- validate_array_init_ty:validate_array_init_ty
- Checks that the type supports array init syntax.
- validate_array_init_result_ty:validate_array_init_result_ty
- Like `validate_array_init_ty`, but additionally accepts types which arrays coerce to.
- validate_array_init_ref_ty:validate_array_init_ref_ty
- Given a pointer or slice type and an element count, return the expected type of an array
- validate_ptr_array_init:validate_ptr_array_init
- Given a set of `array_init_elem_ptr` instructions, assumes they are all part of an array
- array_init_elem_type:array_init_elem_type
- Given a type being used for an array initialization expression, returns the type of the
- array_init_elem_ptr:array_init_elem_ptr
- Given a pointer being used as the result pointer of an array initialization expression,
- union_init:union_init
- Implements the `@unionInit` builtin.
- type_info:type_info
- Implements the `@typeInfo` builtin.
- size_of:size_of
- Implements the `@sizeOf` builtin.
- bit_size_of:bit_size_of
- Implements the `@bitSizeOf` builtin.
- int_from_ptr:int_from_ptr
- Implement builtin `@intFromPtr`.
- compile_error:compile_error
- Emit an error message and fail compilation.
- set_eval_branch_quota:set_eval_branch_quota
- Changes the maximum number of backwards branches that compile-time
- int_from_enum:int_from_enum
- Converts an enum value into an integer.
- align_of:align_of
- Implement builtin `@alignOf`.
- int_from_bool:int_from_bool
- Implement builtin `@intFromBool`.
- embed_file:embed_file
- Implement builtin `@embedFile`.
- error_name:error_name
- Implement builtin `@errorName`.
- panic:panic
- Implement builtin `@panic`.
- trap:trap
- Implements `@trap`.
- set_runtime_safety:set_runtime_safety
- Implement builtin `@setRuntimeSafety`.
- sqrt:sqrt
- Implement builtin `@sqrt`.
- sin:sin
- Implement builtin `@sin`.
- cos:cos
- Implement builtin `@cos`.
- tan:tan
- Implement builtin `@tan`.
- exp:exp
- Implement builtin `@exp`.
- exp2:exp2
- Implement builtin `@exp2`.
- log:log
- Implement builtin `@log`.
- log2:log2
- Implement builtin `@log2`.
- log10:log10
- Implement builtin `@log10`.
- abs:abs
- Implement builtin `@abs`.
- floor:floor
- Implement builtin `@floor`.
- ceil:ceil
- Implement builtin `@ceil`.
- trunc:trunc
- Implement builtin `@trunc`.
- round:round
- Implement builtin `@round`.
- tag_name:tag_name
- Implement builtin `@tagName`.
- type_name:type_name
- Implement builtin `@typeName`.
- frame_type:frame_type
- Implement builtin `@Frame`.
- int_from_float:int_from_float
- Implements the `@intFromFloat` builtin.
- float_from_int:float_from_int
- Implements the `@floatFromInt` builtin.
- ptr_from_int:ptr_from_int
- Implements the `@ptrFromInt` builtin.
- enum_from_int:enum_from_int
- Converts an integer into an enum value.
- float_cast:float_cast
- Convert a larger float type to any other float type, possibly causing
- int_cast:int_cast
- Implements the `@intCast` builtin.
- ptr_cast:ptr_cast
- Implements the `@ptrCast` builtin.
- truncate:truncate
- Implements the `@truncate` builtin.
- has_decl:has_decl
- Implements the `@hasDecl` builtin.
- has_field:has_field
- Implements the `@hasField` builtin.
- clz:clz
- Implements the `@clz` builtin.
- ctz:ctz
- Implements the `@ctz` builtin.
- pop_count:pop_count
- Implements the `@popCount` builtin.
- byte_swap:byte_swap
- Implements the `@byteSwap` builtin.
- bit_reverse:bit_reverse
- Implements the `@bitReverse` builtin.
- bit_offset_of:bit_offset_of
- Implements the `@bitOffsetOf` builtin.
- offset_of:offset_of
- Implements the `@offsetOf` builtin.
- splat:splat
- Implements the `@splat` builtin.
- reduce:reduce
- Implements the `@reduce` builtin.
- shuffle:shuffle
- Implements the `@shuffle` builtin.
- atomic_load:atomic_load
- Implements the `@atomicLoad` builtin.
- atomic_rmw:atomic_rmw
- Implements the `@atomicRmw` builtin.
- atomic_store:atomic_store
- Implements the `@atomicStore` builtin.
- mul_add:mul_add
- Implements the `@mulAdd` builtin.
- memcpy:memcpy
- Implements the `@memcpy` builtin.
- memmove:memmove
- Implements the `@memmove` builtin.
- memset:memset
- Implements the `@memset` builtin.
- min:min
- Implements the `@min` builtin for 2 args.
- max:max
- Implements the `@max` builtin for 2 args.
- c_import:c_import
- Implements the `@cImport` builtin.
- alloc:alloc
- Allocates stack local memory.
- alloc_mut:alloc_mut
- Same as `alloc` except mutable.
- alloc_comptime_mut:alloc_comptime_mut
- Allocates comptime-mutable memory.
- alloc_inferred:alloc_inferred
- Same as `alloc` except the type is inferred.
- alloc_inferred_mut:alloc_inferred_mut
- Same as `alloc_inferred` except mutable.
- alloc_inferred_comptime:alloc_inferred_comptime
- Allocates comptime const memory.
- alloc_inferred_comptime_mut:alloc_inferred_comptime_mut
- Same as `alloc_comptime_mut` except the type is inferred.
- resolve_inferred_alloc:resolve_inferred_alloc
- Each `store_to_inferred_ptr` puts the type of the stored value into a set,
- make_ptr_const:make_ptr_const
- Turns a pointer coming from an `alloc` or `Extended.alloc` into a constant
- @"resume":@"resume"
- Implements `resume` syntax.
- @"defer":@"defer"
- A defer statement.
- defer_err_code:defer_err_code
- An errdefer statement with a code.
- save_err_ret_index:save_err_ret_index
- Requests that Sema update the saved error return trace index for the enclosing
- restore_err_ret_index_unconditional:restore_err_ret_index_unconditional
- Specialized form of `Extended.restore_err_ret_index`.
- restore_err_ret_index_fn_entry:restore_err_ret_index_fn_entry
- Specialized form of `Extended.restore_err_ret_index`.
- extended:extended
- The ZIR instruction tag is one of the `Extended` ones.
Returns whether the instruction is one of the control flow "noreturn" types.
Functions
- isNoReturn
- Returns whether the instruction is one of the control flow "noreturn" types.
- isAlwaysVoid
- AstGen uses this to find out if `Ref.void_value` should be used in place
Used by debug safety-checking code.
Values
- data_tags
- Used by debug safety-checking code.