Skip to content
Standard libraryZig 0.17.1Official documentation
Sourcestd/zig/llvm/ir.zig

Source line 1

std.zig.llvm.ir.AbbrevOp

alias

Source line 5

Alias of std.zig.llvm.bitcode_writer.AbbrevOp

std.zig.llvm.ir.bitcode_writer

alias

Source line 3

Alias of std.zig.llvm.bitcode_writer

std.zig.llvm.ir.BlockAbbrev

constant

Source line 21

std.zig.llvm.ir.BlockArrayAbbrev

constant

Source line 22

std.zig.llvm.ir.BlockId

container

Source line 27

All bitcode files can optionally include a BLOCKINFO block, which contains metadata about other blocks in the file. The only top-level block types are MODULE, IDENTIFICATION, STRTAB and SYMTAB.

Fields

BLOCKINFO = 0

BLOCKINFO_BLOCK is used to define metadata about blocks, for example, standard abbrevs that should be available to all blocks of a specified ID.

MODULE = FIRST_APPLICATION

Blocks

PARAMATTR

Module sub-block id's.

PARAMATTR_GROUP
CONSTANTS
FUNCTION
IDENTIFICATION

Block intended to contains information on the bitcode versioning. Can be used to provide better error messages when we fail to parse a bitcode file.

VALUE_SYMTAB
METADATA
METADATA_ATTACHMENT
TYPE
USELIST
MODULE_STRTAB
GLOBALVAL_SUMMARY
OPERAND_BUNDLE_TAGS
METADATA_KIND
STRTAB
FULL_LTO_GLOBALVAL_SUMMARY
SYMTAB
SYNC_SCOPE_NAMES

std.zig.llvm.ir.BlockId.FIRST_APPLICATION

constant

Source line 72

Block IDs 1-7 are reserved for future expansion.

std.zig.llvm.ir.BlockInfoBlock

namespace

Source line 120

std.zig.llvm.ir.BlockInfoBlock.abbrevs

constant

Source line 125

std.zig.llvm.ir.BlockInfoBlock.id

constant

Source line 121

BlockId

std.zig.llvm.ir.BlockInfoBlock.set_block_id

constant

Source line 123

std.zig.llvm.ir.Builder

alias

Source line 2

Alias of std.zig.llvm.Builder

std.zig.llvm.ir.ColumnAbbrev

constant

Source line 19

std.zig.llvm.ir.ConstantAbbrev

constant

Source line 12

std.zig.llvm.ir.ConstantArrayAbbrev

constant

Source line 13

std.zig.llvm.ir.FixedMetadataKind

container

Source line 77

Unused tags are commented out so that they are omitted in the generated bitcode, which scans over this enum using reflection.

Fields

dbg = 0
prof = 2
unpredictable = 15

std.zig.llvm.ir.IdentificationBlock

namespace

Source line 2269

Identification block contains a string that describes the producer details, and an epoch that defines the auto-upgrade capability.

std.zig.llvm.ir.IdentificationBlock.abbrevs

constant

Source line 2272

std.zig.llvm.ir.IdentificationBlock.Code

container

Source line 2277

Fields

STRING = 1

IDENTIFICATION: [strchr x N]

EPOCH = 2

EPOCH: [epoch#]

std.zig.llvm.ir.IdentificationBlock.Epoch

container

Source line 2292

Fields

epoch: u32

std.zig.llvm.ir.IdentificationBlock.Epoch.ops

constant

Source line 2293

std.zig.llvm.ir.IdentificationBlock.id

constant

Source line 2270

BlockId

std.zig.llvm.ir.IdentificationBlock.Version

container

Source line 2284

Fields

string: []const u8

std.zig.llvm.ir.IdentificationBlock.Version.ops

constant

Source line 2285

std.zig.llvm.ir.LineAbbrev

constant

Source line 18

std.zig.llvm.ir.MAGIC

constant

Source line 7

u32

std.zig.llvm.ir.MetadataAbbrev

constant

Source line 15

std.zig.llvm.ir.MetadataArrayAbbrev

constant

Source line 16

std.zig.llvm.ir.ModuleBlock

namespace

Source line 129

MODULE blocks have a number of optional fields and subblocks.

std.zig.llvm.ir.ModuleBlock.abbrevs

constant

Source line 132

std.zig.llvm.ir.ModuleBlock.Alias

container

Source line 287

Fields

strtab_offset: usize
strtab_size: usize
type_index: Builder.Type
addr_space: Builder.AddrSpace
aliasee: u32
linkage: Builder.Linkage
visibility: Builder.Visibility
dllstorageclass: Builder.DllStorageClass
thread_local: Builder.ThreadLocal
unnamed_addr: Builder.UnnamedAddr
preemption: Builder.Preemption

std.zig.llvm.ir.ModuleBlock.Alias.ops

constant

Source line 288

std.zig.llvm.ir.ModuleBlock.Code

container

Source line 140

Fields

VERSION = 1

VERSION: [version#]

TRIPLE = 2

TRIPLE: [strchr x N]

DATALAYOUT = 3

DATALAYOUT: [strchr x N]

ASM = 4

ASM: [strchr x N]

SECTIONNAME = 5

SECTIONNAME: [strchr x N]

DEPLIB = 6

Deprecated, but still needed to read old bitcode files. DEPLIB: [strchr x N]

GLOBALVAR = 7

GLOBALVAR: [pointer type, isconst, initid, linkage, alignment, section, visibility, threadlocal]

FUNCTION = 8

FUNCTION: [type, callingconv, isproto, linkage, paramattrs, alignment, section, visibility, gc, unnamed_addr]

ALIAS_OLD = 9

ALIAS: [alias type, aliasee val#, linkage, visibility]

GCNAME = 11

GCNAME: [strchr x N]

COMDAT = 12

COMDAT: [selection_kind, name]

VSTOFFSET = 13

VSTOFFSET: [offset]

ALIAS = 14

ALIAS: [alias value type, addrspace, aliasee val#, linkage, visibility]

METADATA_VALUES_UNUSED = 15
SOURCE_FILENAME = 16

SOURCE_FILENAME: [namechar x N]

HASH = 17

HASH: [5*i32]

IFUNC = 18

IFUNC: [ifunc value type, addrspace, resolver val#, linkage, visibility]

std.zig.llvm.ir.ModuleBlock.ConstantsBlock

namespace

Source line 353

The constants block (CONSTANTS_BLOCK_ID) describes emission for each constant and maintains an implicit current type value.

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.abbrevs

constant

Source line 356

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Aggregate

container

Source line 530

Fields

values: []const Builder.Constant

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Aggregate.ops

constant

Source line 531

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Binary

container

Source line 568

Fields

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Binary.BinaryOpcode

alias

Source line 569

Alias of std.zig.llvm.Builder.BinaryOpcode

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Binary.ops

constant

Source line 570

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.BlockAddress

container

Source line 655

Fields

type_id: Builder.Type
function: u32
block: u32

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.BlockAddress.ops

constant

Source line 656

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Cast

container

Source line 554

Fields

opcode: CastOpcode
type_index: Builder.Type
val: Builder.Constant

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Cast.CastOpcode

alias

Source line 555

Alias of std.zig.llvm.Builder.CastOpcode

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Cast.ops

constant

Source line 556

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Cmp

container

Source line 582

Fields

ty: Builder.Type
lhs: Builder.Constant
rhs: Builder.Constant
pred: u32

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Cmp.ops

constant

Source line 583

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Code

container

Source line 381

Fields

SETTYPE = 1

SETTYPE: [typeid]

NULL = 2

NULL

UNDEF = 3

UNDEF

INTEGER = 4

INTEGER: [intval]

WIDE_INTEGER = 5

WIDE_INTEGER: [n x intval]

FLOAT = 6

FLOAT: [fpval]

AGGREGATE = 7

AGGREGATE: [n x value number]

STRING = 8

STRING: [values]

CSTRING = 9

CSTRING: [values]

CE_BINOP = 10

CE_BINOP: [opcode, opval, opval]

CE_CAST = 11

CE_CAST: [opcode, opty, opval]

CE_GEP_OLD = 12

CE_GEP: [n x operands]

CE_SELECT = 13

CE_SELECT: [opval, opval, opval]

CE_EXTRACTELT = 14

CE_EXTRACTELT: [opty, opval, opval]

CE_INSERTELT = 15

CE_INSERTELT: [opval, opval, opval]

CE_SHUFFLEVEC = 16

CE_SHUFFLEVEC: [opval, opval, opval]

CE_CMP = 17

CE_CMP: [opty, opval, opval, pred]

INLINEASM_OLD = 18

INLINEASM: [sideeffect|alignstack,asmstr,conststr]

CE_SHUFVEC_EX = 19

SHUFVEC_EX: [opty, opval, opval, opval]

CE_INBOUNDS_GEP = 20

INBOUNDS_GEP: [n x operands]

BLOCKADDRESS = 21

BLOCKADDRESS: [fnty, fnval, bb#]

DATA = 22

DATA: [n x elements]

INLINEASM_OLD2 = 23

INLINEASM: [sideeffect|alignstack|asmdialect,asmstr,conststr]

CE_GEP_WITH_INRANGE_INDEX_OLD = 24

[opty, flags, n x operands]

CE_UNOP = 25

CE_UNOP: [opcode, opval]

POISON = 26

POISON

DSO_LOCAL_EQUIVALENT = 27

DSO_LOCAL_EQUIVALENT [gvty, gv]

INLINEASM_OLD3 = 28

INLINEASM: [sideeffect|alignstack|asmdialect|unwind,asmstr, conststr]

NO_CFI_VALUE = 29

NO_CFI [ fty, f ]

INLINEASM = 30

INLINEASM: [fnty,sideeffect|alignstack|asmdialect|unwind, asmstr,conststr]

CE_GEP_WITH_INRANGE = 31

[opty, flags, range, n x operands]

CE_GEP = 32

[opty, flags, n x operands]

PTRAUTH = 33

[ptr, key, disc, addrdisc]

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.CString

container

Source line 546

Fields

string: []const u8

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.CString.ops

constant

Source line 547

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Double

container

Source line 502

Fields

value: u64

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Double.ops

constant

Source line 503

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.DsoLocalEquivalentOrNoCfi

container

Source line 667

Fields

code: ModuleBlock.ConstantsBlock.Code
type_id: Builder.Type
function: u32

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.DsoLocalEquivalentOrNoCfi.ops

constant

Source line 668

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.ExtractElement

container

Source line 597

Fields

val_type: Builder.Type
val: Builder.Constant
index_type: Builder.Type
index: Builder.Constant

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.ExtractElement.ops

constant

Source line 598

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Float

container

Source line 494

Fields

value: u32

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Float.ops

constant

Source line 495

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Fp128

container

Source line 520

Fields

lo: u64
hi: u64

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Fp128.ops

constant

Source line 521

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Fp80

container

Source line 510

Fields

hi: u64
lo: u16

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Fp80.ops

constant

Source line 511

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Half

container

Source line 486

Fields

value: u16

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Half.ops

constant

Source line 487

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.id

constant

Source line 354

BlockId

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.InsertElement

container

Source line 612

Fields

val: Builder.Constant
elem: Builder.Constant
index_type: Builder.Type
index: Builder.Constant

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.InsertElement.ops

constant

Source line 613

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Integer

container

Source line 478

Fields

value: u64

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Integer.ops

constant

Source line 479

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Null

namespace

Source line 460

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Null.ops

constant

Source line 461

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Poison

namespace

Source line 472

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Poison.ops

constant

Source line 473

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.SetType

container

Source line 452

Fields

type_id: Builder.Type

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.SetType.ops

constant

Source line 453

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.ShuffleVector

container

Source line 627

Fields

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.ShuffleVector.ops

constant

Source line 628

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.ShuffleVectorEx

container

Source line 640

Fields

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.ShuffleVectorEx.ops

constant

Source line 641

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.String

container

Source line 538

Fields

string: []const u8

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.String.ops

constant

Source line 539

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Undef

namespace

Source line 466

std.zig.llvm.ir.ModuleBlock.ConstantsBlock.Undef.ops

constant

Source line 467

std.zig.llvm.ir.ModuleBlock.Function

container

Source line 248

Fields

strtab_offset: usize
strtab_size: usize
type_index: Builder.Type
call_conv: Builder.CallConv
is_proto: bool
linkage: Builder.Linkage
paramattr: usize
alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment))
section: usize
visibility: Builder.Visibility
unnamed_addr: Builder.UnnamedAddr
dllstorageclass: Builder.DllStorageClass
preemption: Builder.Preemption
addr_space: Builder.AddrSpace

std.zig.llvm.ir.ModuleBlock.Function.ops

constant

Source line 249

std.zig.llvm.ir.ModuleBlock.FunctionBlock

namespace

Source line 681

The function body block (FUNCTION_BLOCK_ID) describes function bodies. It can contain a constant block (CONSTANTS_BLOCK_ID).

std.zig.llvm.ir.ModuleBlock.FunctionBlock.abbrevs

constant

Source line 684

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Alloca

container

Source line 1108

Fields

inst_type: Builder.Type
len_type: Builder.Type
len_value: u32
flags: Flags

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Alloca.Flags

container

Source line 1109

Fields

align_lower: u5
inalloca: bool
explicit_type: bool
swift_error: bool
align_upper: u3

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Alloca.ops

constant

Source line 1116

std.zig.llvm.ir.ModuleBlock.FunctionBlock.AtomicRmw

container

Source line 1322

Fields

ptr: u32
val: u32
operation: Builder.Function.Instruction.AtomicRmw.Operation
is_volatile: bool
success_ordering: Builder.AtomicOrdering
sync_scope: Builder.SyncScope
alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment))

std.zig.llvm.ir.ModuleBlock.FunctionBlock.AtomicRmw.ops

constant

Source line 1323

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Binary

container

Source line 954

Fields

lhs: u32
rhs: u32
opcode: BinaryOpcode

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Binary.BinaryOpcode

alias

Source line 955

Alias of std.zig.llvm.Builder.BinaryOpcode

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Binary.ops

constant

Source line 956

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BinaryExact

container

Source line 987

Fields

lhs: u32
rhs: u32
opcode: BinaryOpcode

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BinaryExact.BinaryOpcode

alias

Source line 988

Alias of std.zig.llvm.Builder.BinaryOpcode

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BinaryExact.ops

constant

Source line 989

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BinaryFast

container

Source line 1002

Fields

lhs: u32
rhs: u32
opcode: BinaryOpcode
fast_math: Builder.FastMath

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BinaryFast.BinaryOpcode

alias

Source line 1003

Alias of std.zig.llvm.Builder.BinaryOpcode

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BinaryFast.ops

constant

Source line 1004

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BinaryNoWrap

container

Source line 968

Fields

lhs: u32
rhs: u32
opcode: BinaryOpcode
flags: packed struct(u2) {
    no_unsigned_wrap: bool,
    no_signed_wrap: bool,
}

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BinaryNoWrap.BinaryOpcode

alias

Source line 969

Alias of std.zig.llvm.Builder.BinaryOpcode

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BinaryNoWrap.ops

constant

Source line 970

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BrConditional

container

Source line 1298

Fields

then_block: u32
else_block: u32
condition: u32

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BrConditional.ops

constant

Source line 1299

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BrUnconditional

container

Source line 1290

Fields

block: u32

std.zig.llvm.ir.ModuleBlock.FunctionBlock.BrUnconditional.ops

constant

Source line 1291

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Call

container

Source line 876

Fields

attributes: Builder.FunctionAttributes
call_type: CallType
type_id: Builder.Type
callee: Builder.Value
args: []const Builder.Value

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Call.CallType

container

Source line 877

Fields

tail: bool = false
call_conv: Builder.CallConv
reserved: u3 = 0
must_tail: bool = false
explicit_type: bool = true
no_tail: bool = false

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Call.ops

constant

Source line 886

std.zig.llvm.ir.ModuleBlock.FunctionBlock.CallFast

container

Source line 902

Fields

attributes: Builder.FunctionAttributes
call_type: CallType
fast_math: Builder.FastMath
type_id: Builder.Type
callee: Builder.Value
args: []const Builder.Value

std.zig.llvm.ir.ModuleBlock.FunctionBlock.CallFast.CallType

container

Source line 903

Fields

tail: bool = false
call_conv: Builder.CallConv
reserved: u3 = 0
must_tail: bool = false
explicit_type: bool = true
no_tail: bool = false
fast: bool = true

std.zig.llvm.ir.ModuleBlock.FunctionBlock.CallFast.ops

constant

Source line 914

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Cast

container

Source line 1076

Fields

val: u32
type_index: Builder.Type
opcode: CastOpcode

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Cast.CastOpcode

alias

Source line 1077

Alias of std.zig.llvm.Builder.CastOpcode

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Cast.ops

constant

Source line 1078

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Cmp

container

Source line 1018

Fields

lhs: u32
rhs: u32
pred: CmpPredicate

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Cmp.CmpPredicate

alias

Source line 1019

Alias of std.zig.llvm.Builder.CmpPredicate

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Cmp.ops

constant

Source line 1020

std.zig.llvm.ir.ModuleBlock.FunctionBlock.CmpFast

container

Source line 1032

Fields

lhs: u32
rhs: u32
pred: CmpPredicate
fast_math: Builder.FastMath

std.zig.llvm.ir.ModuleBlock.FunctionBlock.CmpFast.CmpPredicate

alias

Source line 1033

Alias of std.zig.llvm.Builder.CmpPredicate

std.zig.llvm.ir.ModuleBlock.FunctionBlock.CmpFast.ops

constant

Source line 1034

std.zig.llvm.ir.ModuleBlock.FunctionBlock.CmpXchg

container

Source line 1342

Fields

ptr: u32
cmp: u32
new: u32
is_volatile: bool
success_ordering: Builder.AtomicOrdering
sync_scope: Builder.SyncScope
failure_ordering: Builder.AtomicOrdering
is_weak: bool
alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment))

std.zig.llvm.ir.ModuleBlock.FunctionBlock.CmpXchg.ops

constant

Source line 1343

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Code

container

Source line 726

Fields

DECLAREBLOCKS = 1

DECLAREBLOCKS: [n]

INST_BINOP = 2

BINOP: [opcode, ty, opval, opval]

INST_CAST = 3

CAST: [opcode, ty, opty, opval]

INST_GEP_OLD = 4

GEP: [n x operands]

INST_SELECT = 5

SELECT: [ty, opval, opval, opval]

INST_EXTRACTELT = 6

EXTRACTELT: [opty, opval, opval]

INST_INSERTELT = 7

INSERTELT: [ty, opval, opval, opval]

INST_SHUFFLEVEC = 8

SHUFFLEVEC: [ty, opval, opval, opval]

INST_CMP = 9

CMP: [opty, opval, opval, pred]

INST_RET = 10

RET: [opty,opval<both optional>]

INST_BR = 11

BR: [bb#, bb#, cond] or [bb#]

INST_SWITCH = 12

SWITCH: [opty, op0, op1, ...]

INST_INVOKE = 13

INVOKE: [attr, fnty, op0,op1, ...]

INST_UNREACHABLE = 15

UNREACHABLE

INST_PHI = 16

PHI: [ty, val0,bb0, ...]

INST_ALLOCA = 19

ALLOCA: [instty, opty, op, align]

INST_LOAD = 20

LOAD: [opty, op, align, vol]

INST_VAARG = 23

VAARG: [valistty, valist, instty] This store code encodes the pointer type, rather than the value type this is so information only available in the pointer type (e.g. address spaces) is retained.

INST_STORE_OLD = 24

STORE: [ptrty,ptr,val, align, vol]

INST_EXTRACTVAL = 26

EXTRACTVAL: [n x operands]

INST_INSERTVAL = 27

INSERTVAL: [n x operands]

INST_CMP2 = 28

fcmp/icmp returning Int1TY or vector of Int1Ty. Same as CMP, exists to support legacy vicmp/vfcmp instructions. CMP2: [opty, opval, opval, pred]

INST_VSELECT = 29

new select on i1 or [N x i1] VSELECT: [ty,opval,opval,predty,pred]

INST_INBOUNDS_GEP_OLD = 30

INBOUNDS_GEP: [n x operands]

INST_INDIRECTBR = 31

INDIRECTBR: [opty, op0, op1, ...]

DEBUG_LOC_AGAIN = 33

DEBUG_LOC_AGAIN

INST_CALL = 34

CALL: [attr, cc, fnty, fnid, args...]

DEBUG_LOC = 35

DEBUG_LOC: [Line,Col,ScopeVal, IAVal]

INST_FENCE = 36

FENCE: [ordering, synchscope]

INST_CMPXCHG_OLD = 37

CMPXCHG: [ptrty, ptr, cmp, val, vol, ordering, synchscope, failure_ordering?, weak?]

INST_ATOMICRMW_OLD = 38

ATOMICRMW: [ptrty,ptr,val, operation, align, vol, ordering, synchscope]

INST_RESUME = 39

RESUME: [opval]

INST_LANDINGPAD_OLD = 40

LANDINGPAD: [ty,val,val,num,id0,val0...]

INST_LOADATOMIC = 41

LOAD: [opty, op, align, vol, ordering, synchscope]

INST_STOREATOMIC_OLD = 42

STORE: [ptrty,ptr,val, align, vol ordering, synchscope]

INST_GEP = 43

GEP: [inbounds, n x operands]

INST_STORE = 44

STORE: [ptrty,ptr,valty,val, align, vol]

INST_STOREATOMIC = 45

STORE: [ptrty,ptr,val, align, vol

INST_CMPXCHG = 46

CMPXCHG: [ptrty, ptr, cmp, val, vol, success_ordering, synchscope, failure_ordering, weak]

INST_LANDINGPAD = 47

LANDINGPAD: [ty,val,num,id0,val0...]

INST_CLEANUPRET = 48

CLEANUPRET: [val] or [val,bb#]

INST_CATCHRET = 49

CATCHRET: [val,bb#]

INST_CATCHPAD = 50

CATCHPAD: [bb#,bb#,num,args...]

INST_CLEANUPPAD = 51

CLEANUPPAD: [num,args...]

INST_CATCHSWITCH = 52

CATCHSWITCH: [num,args...] or [num,args...,bb]

OPERAND_BUNDLE = 55

OPERAND_BUNDLE: [tag#, value...]

INST_UNOP = 56

UNOP: [opcode, ty, opval]

INST_CALLBR = 57

CALLBR: [attr, cc, norm, transfs, fnty, fnid, args...]

INST_FREEZE = 58

FREEZE: [opty, opval]

INST_ATOMICRMW = 59

ATOMICRMW: [ptrty, ptr, valty, val, operation, align, vol, ordering, synchscope]

BLOCKADDR_USERS = 60

BLOCKADDR_USERS: [value...]

DEBUG_RECORD_VALUE = 61

[DILocation, DILocalVariable, DIExpression, ValueAsMetadata]

DEBUG_RECORD_DECLARE = 62

[DILocation, DILocalVariable, DIExpression, ValueAsMetadata]

DEBUG_RECORD_ASSIGN = 63

[DILocation, DILocalVariable, DIExpression, ValueAsMetadata, DIAssignID, DIExpression (addr), ValueAsMetadata (addr)]

DEBUG_RECORD_VALUE_SIMPLE = 64

[DILocation, DILocalVariable, DIExpression, Value]

DEBUG_RECORD_LABEL = 65

[DILocation, DILabel]

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ColdOperandBundle

namespace

Source line 1397

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ColdOperandBundle.ops

constant

Source line 1398

std.zig.llvm.ir.ModuleBlock.FunctionBlock.DebugLoc

container

Source line 1376

Fields

line: u32
column: u32
scope: Builder.Metadata.Optional
inlined_at: Builder.Metadata.Optional

std.zig.llvm.ir.ModuleBlock.FunctionBlock.DebugLoc.ops

constant

Source line 1377

std.zig.llvm.ir.ModuleBlock.FunctionBlock.DebugLocAgain

namespace

Source line 1391

std.zig.llvm.ir.ModuleBlock.FunctionBlock.DebugLocAgain.ops

constant

Source line 1392

std.zig.llvm.ir.ModuleBlock.FunctionBlock.DeclareBlocks

container

Source line 868

Fields

num_blocks: usize

std.zig.llvm.ir.ModuleBlock.FunctionBlock.DeclareBlocks.ops

constant

Source line 869

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ExtractElement

container

Source line 1183

Fields

val: u32
index: u32

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ExtractElement.ops

constant

Source line 1184

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ExtractValue

container

Source line 1159

Fields

val: u32
indices: []const u32

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ExtractValue.ops

constant

Source line 1160

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Fence

container

Source line 1366

Fields

ordering: Builder.AtomicOrdering
sync_scope: Builder.SyncScope

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Fence.ops

constant

Source line 1367

std.zig.llvm.ir.ModuleBlock.FunctionBlock.FNeg

container

Source line 932

Fields

val: u32

std.zig.llvm.ir.ModuleBlock.FunctionBlock.FNeg.ops

constant

Source line 933

std.zig.llvm.ir.ModuleBlock.FunctionBlock.FNegFast

container

Source line 942

Fields

val: u32
fast_math: Builder.FastMath

std.zig.llvm.ir.ModuleBlock.FunctionBlock.FNegFast.ops

constant

Source line 943

std.zig.llvm.ir.ModuleBlock.FunctionBlock.GetElementPtr

container

Source line 1144

Fields

is_inbounds: bool
type_index: Builder.Type
base: Builder.Value
indices: []const Builder.Value

std.zig.llvm.ir.ModuleBlock.FunctionBlock.GetElementPtr.ops

constant

Source line 1145

std.zig.llvm.ir.ModuleBlock.FunctionBlock.id

constant

Source line 682

BlockId

std.zig.llvm.ir.ModuleBlock.FunctionBlock.IndirectBr

container

Source line 1404

Fields

ty: Builder.Type
addr: Builder.Value
targets: []const Builder.Function.Block.Index

std.zig.llvm.ir.ModuleBlock.FunctionBlock.IndirectBr.ops

constant

Source line 1405

std.zig.llvm.ir.ModuleBlock.FunctionBlock.InsertElement

container

Source line 1194

Fields

val: u32
elem: u32
index: u32

std.zig.llvm.ir.ModuleBlock.FunctionBlock.InsertElement.ops

constant

Source line 1195

std.zig.llvm.ir.ModuleBlock.FunctionBlock.InsertValue

container

Source line 1170

Fields

val: u32
elem: u32
indices: []const u32

std.zig.llvm.ir.ModuleBlock.FunctionBlock.InsertValue.ops

constant

Source line 1171

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Load

container

Source line 1226

Fields

ptr: u32
ty: Builder.Type
alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment))
is_volatile: bool

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Load.ops

constant

Source line 1227

std.zig.llvm.ir.ModuleBlock.FunctionBlock.LoadAtomic

container

Source line 1240

Fields

ptr: u32
ty: Builder.Type
alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment))
is_volatile: bool
success_ordering: Builder.AtomicOrdering
sync_scope: Builder.SyncScope

std.zig.llvm.ir.ModuleBlock.FunctionBlock.LoadAtomic.ops

constant

Source line 1241

std.zig.llvm.ir.ModuleBlock.FunctionBlock.MetadataAttachmentBlock

namespace

Source line 1465

std.zig.llvm.ir.ModuleBlock.FunctionBlock.MetadataAttachmentBlock.abbrevs

constant

Source line 1468

std.zig.llvm.ir.ModuleBlock.FunctionBlock.MetadataAttachmentBlock.AttachmentGlobalSingle

container

Source line 1473

Fields

std.zig.llvm.ir.ModuleBlock.FunctionBlock.MetadataAttachmentBlock.AttachmentGlobalSingle.ops

constant

Source line 1474

std.zig.llvm.ir.ModuleBlock.FunctionBlock.MetadataAttachmentBlock.AttachmentInstructionSingle

container

Source line 1483

Fields

inst: u32
kind: FixedMetadataKind
metadata: Builder.Metadata

std.zig.llvm.ir.ModuleBlock.FunctionBlock.MetadataAttachmentBlock.AttachmentInstructionSingle.ops

constant

Source line 1484

std.zig.llvm.ir.ModuleBlock.FunctionBlock.MetadataAttachmentBlock.id

constant

Source line 1466

BlockId

std.zig.llvm.ir.ModuleBlock.FunctionBlock.MetadataBlock

namespace

Source line 1446

std.zig.llvm.ir.ModuleBlock.FunctionBlock.MetadataBlock.abbrevs

constant

Source line 1449

std.zig.llvm.ir.ModuleBlock.FunctionBlock.MetadataBlock.id

constant

Source line 1447

BlockId

std.zig.llvm.ir.ModuleBlock.FunctionBlock.MetadataBlock.Value

container

Source line 1453

Fields

ty: Builder.Type
value: Builder.Value

std.zig.llvm.ir.ModuleBlock.FunctionBlock.MetadataBlock.Value.ops

constant

Source line 1454

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Ret

container

Source line 1136

Fields

val: u32

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Ret.ops

constant

Source line 1137

std.zig.llvm.ir.ModuleBlock.FunctionBlock.RetVoid

namespace

Source line 1130

std.zig.llvm.ir.ModuleBlock.FunctionBlock.RetVoid.ops

constant

Source line 1131

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Select

container

Source line 1048

Fields

lhs: u32
rhs: u32
cond: u32

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Select.ops

constant

Source line 1049

std.zig.llvm.ir.ModuleBlock.FunctionBlock.SelectFast

container

Source line 1061

Fields

lhs: u32
rhs: u32
cond: u32
fast_math: Builder.FastMath

std.zig.llvm.ir.ModuleBlock.FunctionBlock.SelectFast.ops

constant

Source line 1062

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ShuffleVector

container

Source line 1207

Fields

lhs: u32
rhs: u32
mask: u32

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ShuffleVector.ops

constant

Source line 1208

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Store

container

Source line 1258

Fields

ptr: u32
val: u32
alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment))
is_volatile: bool

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Store.ops

constant

Source line 1259

std.zig.llvm.ir.ModuleBlock.FunctionBlock.StoreAtomic

container

Source line 1272

Fields

ptr: u32
val: u32
alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment))
is_volatile: bool
success_ordering: Builder.AtomicOrdering
sync_scope: Builder.SyncScope

std.zig.llvm.ir.ModuleBlock.FunctionBlock.StoreAtomic.ops

constant

Source line 1273

std.zig.llvm.ir.ModuleBlock.FunctionBlock.TruncNoWrap

container

Source line 1090

Fields

val: u32
type_index: Builder.Type
flags: Flags

std.zig.llvm.ir.ModuleBlock.FunctionBlock.TruncNoWrap.Flags

container

Source line 1091

Fields

no_unsigned_wrap: bool
no_signed_wrap: bool

std.zig.llvm.ir.ModuleBlock.FunctionBlock.TruncNoWrap.ops

constant

Source line 1095

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Unreachable

namespace

Source line 1220

std.zig.llvm.ir.ModuleBlock.FunctionBlock.Unreachable.ops

constant

Source line 1221

std.zig.llvm.ir.ModuleBlock.FunctionBlock.VaArg

container

Source line 1310

Fields

list_type: Builder.Type
list: u32
type: Builder.Type

std.zig.llvm.ir.ModuleBlock.FunctionBlock.VaArg.ops

constant

Source line 1311

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ValueSymtabBlock

namespace

Source line 1416

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ValueSymtabBlock.abbrevs

constant

Source line 1419

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ValueSymtabBlock.BlockEntry

container

Source line 1435

Fields

value_id: u32
string: []const u8

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ValueSymtabBlock.BlockEntry.ops

constant

Source line 1436

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ValueSymtabBlock.Code

container

Source line 1424

Value symbol table codes.

Fields

ENTRY = 1

VST_ENTRY: [valueid, namechar x N]

BBENTRY = 2

VST_BBENTRY: [bbid, namechar x N]

FNENTRY = 3

VST_FNENTRY: [valueid, offset, namechar x N]

COMBINED_ENTRY = 5

VST_COMBINED_ENTRY: [valueid, refguid]

std.zig.llvm.ir.ModuleBlock.FunctionBlock.ValueSymtabBlock.id

constant

Source line 1417

BlockId

std.zig.llvm.ir.ModuleBlock.id

constant

Source line 130

BlockId

std.zig.llvm.ir.ModuleBlock.MetadataBlock

namespace

Source line 1497

std.zig.llvm.ir.ModuleBlock.MetadataBlock.abbrevs

constant

Source line 1500

std.zig.llvm.ir.ModuleBlock.MetadataBlock.BasicType

container

Source line 1748

Fields

name: Builder.Metadata.String.Optional
size_in_bits: u64
encoding: u32

std.zig.llvm.ir.ModuleBlock.MetadataBlock.BasicType.ops

constant

Source line 1749

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Code

container

Source line 1525

Fields

STRING_OLD = 1

MDSTRING: [values]

VALUE = 2

VALUE: [type num, value num]

NODE = 3

NODE: [n x md num]

NAME = 4

STRING: [values]

DISTINCT_NODE = 5

DISTINCT_NODE: [n x md num]

KIND = 6

[n x [id, name]]

LOCATION = 7

[distinct, line, col, scope, inlined-at?]

OLD_NODE = 8

OLD_NODE: [n x (type num, value num)]

OLD_FN_NODE = 9

OLD_FN_NODE: [n x (type num, value num)]

NAMED_NODE = 10

NAMED_NODE: [n x mdnodes]

ATTACHMENT = 11

[m x [value, [n x [id, mdnode]]]

GENERIC_DEBUG = 12

[distinct, tag, vers, header, n x md num]

SUBRANGE = 13

[distinct, count, lo]

ENUMERATOR = 14

[isUnsigned|distinct, value, name]

BASIC_TYPE = 15

[distinct, tag, name, size, align, enc]

FILE = 16

[distinct, filename, directory, checksumkind, checksum]

DERIVED_TYPE = 17

[distinct, ...]

COMPOSITE_TYPE = 18

[distinct, ...]

SUBROUTINE_TYPE = 19

[distinct, flags, types, cc]

COMPILE_UNIT = 20

[distinct, ...]

SUBPROGRAM = 21

[distinct, ...]

LEXICAL_BLOCK = 22

[distinct, scope, file, line, column]

LEXICAL_BLOCK_FILE = 23

[distinct, scope, file, discriminator]

NAMESPACE = 24

[distinct, scope, file, name, line, exportSymbols]

TEMPLATE_TYPE = 25

[distinct, scope, name, type, ...]

TEMPLATE_VALUE = 26

[distinct, scope, name, type, value, ...]

GLOBAL_VAR = 27

[distinct, ...]

LOCAL_VAR = 28

[distinct, ...]

EXPRESSION = 29

[distinct, n x element]

OBJC_PROPERTY = 30

[distinct, name, file, line, ...]

IMPORTED_ENTITY = 31

[distinct, tag, scope, entity, line, name]

MODULE = 32

[distinct, scope, name, ...]

MACRO = 33

[distinct, macinfo, line, name, value]

MACRO_FILE = 34

[distinct, macinfo, line, file, ...]

STRINGS = 35

[count, offset] blob([lengths][chars])

GLOBAL_DECL_ATTACHMENT = 36

[valueid, n x [id, mdnode]]

GLOBAL_VAR_EXPR = 37

[distinct, var, expr]

INDEX_OFFSET = 38

[offset]

INDEX = 39

[bitpos]

LABEL = 40

[distinct, scope, name, file, line]

STRING_TYPE = 41

[distinct, name, size, align,...]

COMMON_BLOCK = 44

[distinct, scope, name, variable,...]

GENERIC_SUBRANGE = 45

[distinct, count, lo, up, stride]

ARG_LIST = 46

[n x [type num, value num]]

ASSIGN_ID = 47

[distinct, ...]

std.zig.llvm.ir.ModuleBlock.MetadataBlock.CompileUnit

container

Source line 1644

Fields

std.zig.llvm.ir.ModuleBlock.MetadataBlock.CompileUnit.ops

constant

Source line 1645

std.zig.llvm.ir.ModuleBlock.MetadataBlock.CompositeType

container

Source line 1765

Fields

tag: u32
name: Builder.Metadata.String.Optional
file: Builder.Metadata.Optional
line: u32
scope: Builder.Metadata.Optional
underlying_type: Builder.Metadata.Optional
size_in_bits: u64
align_in_bits: u64
flags: Builder.Metadata.DIFlags
elements: Builder.Metadata.Optional

std.zig.llvm.ir.ModuleBlock.MetadataBlock.CompositeType.ops

constant

Source line 1766

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Constant

container

Source line 1982

Fields

ty: Builder.Type
constant: Builder.Constant

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Constant.ops

constant

Source line 1983

std.zig.llvm.ir.ModuleBlock.MetadataBlock.DerivedType

container

Source line 1804

Fields

tag: u32
name: Builder.Metadata.String.Optional
file: Builder.Metadata.Optional
line: u32
scope: Builder.Metadata.Optional
underlying_type: Builder.Metadata.Optional
size_in_bits: u64
align_in_bits: u64
offset_in_bits: u64

std.zig.llvm.ir.ModuleBlock.MetadataBlock.DerivedType.ops

constant

Source line 1805

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Enumerator

container

Source line 1844

Fields

flags: Flags
bit_width: u32
name: Builder.Metadata.String.Optional
value: u64

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Enumerator.Flags

container

Source line 1845

Fields

distinct: bool = false
unsigned: bool
bigint: bool = true

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Enumerator.ops

constant

Source line 1851

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Expression

container

Source line 1879

Fields

elements: []const u32

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Expression.ops

constant

Source line 1880

std.zig.llvm.ir.ModuleBlock.MetadataBlock.File

container

Source line 1630

Fields

std.zig.llvm.ir.ModuleBlock.MetadataBlock.File.ops

constant

Source line 1631

std.zig.llvm.ir.ModuleBlock.MetadataBlock.GlobalDeclAttachment

container

Source line 2011

Fields

std.zig.llvm.ir.ModuleBlock.MetadataBlock.GlobalDeclAttachment.ops

constant

Source line 2012

std.zig.llvm.ir.ModuleBlock.MetadataBlock.GlobalVar

container

Source line 1943

Fields

std.zig.llvm.ir.ModuleBlock.MetadataBlock.GlobalVar.ops

constant

Source line 1944

std.zig.llvm.ir.ModuleBlock.MetadataBlock.GlobalVarExpression

container

Source line 1970

Fields

std.zig.llvm.ir.ModuleBlock.MetadataBlock.GlobalVarExpression.ops

constant

Source line 1971

std.zig.llvm.ir.ModuleBlock.MetadataBlock.id

constant

Source line 1498

BlockId

std.zig.llvm.ir.ModuleBlock.MetadataBlock.LexicalBlock

container

Source line 1715

Fields

scope: Builder.Metadata.Optional
file: Builder.Metadata.Optional
line: u32
column: u32

std.zig.llvm.ir.ModuleBlock.MetadataBlock.LexicalBlock.ops

constant

Source line 1716

std.zig.llvm.ir.ModuleBlock.MetadataBlock.LocalVar

container

Source line 1898

Fields

std.zig.llvm.ir.ModuleBlock.MetadataBlock.LocalVar.ops

constant

Source line 1899

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Location

container

Source line 1731

Fields

line: u32
column: u32
scope: Builder.Metadata
inlined_at: Builder.Metadata.Optional

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Location.ops

constant

Source line 1732

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Name

container

Source line 1993

Fields

name: []const u8

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Name.ops

constant

Source line 1994

std.zig.llvm.ir.ModuleBlock.MetadataBlock.NamedNode

container

Source line 2002

Fields

elements: []const Builder.Metadata

std.zig.llvm.ir.ModuleBlock.MetadataBlock.NamedNode.ops

constant

Source line 2003

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Node

container

Source line 1889

Fields

elements: []const Builder.Metadata.Optional

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Node.ops

constant

Source line 1890

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Parameter

container

Source line 1920

Fields

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Parameter.ops

constant

Source line 1921

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Strings

container

Source line 1618

Fields

num_strings: u32
strings_offset: u32
blob: []const u8

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Strings.ops

constant

Source line 1619

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Subprogram

container

Source line 1678

Fields

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Subprogram.ops

constant

Source line 1679

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Subrange

container

Source line 1865

Fields

std.zig.llvm.ir.ModuleBlock.MetadataBlock.Subrange.ops

constant

Source line 1866

std.zig.llvm.ir.ModuleBlock.MetadataBlock.SubroutineType

container

Source line 1832

Fields

std.zig.llvm.ir.ModuleBlock.MetadataBlock.SubroutineType.ops

constant

Source line 1833

std.zig.llvm.ir.ModuleBlock.MetadataKindBlock

namespace

Source line 2248

std.zig.llvm.ir.ModuleBlock.MetadataKindBlock.abbrevs

constant

Source line 2251

std.zig.llvm.ir.ModuleBlock.MetadataKindBlock.id

constant

Source line 2249

BlockId

std.zig.llvm.ir.ModuleBlock.MetadataKindBlock.Kind

container

Source line 2255

Fields

id: u32
name: []const u8

std.zig.llvm.ir.ModuleBlock.MetadataKindBlock.Kind.ops

constant

Source line 2256

std.zig.llvm.ir.ModuleBlock.OperandBundleTagsBlock

namespace

Source line 2227

std.zig.llvm.ir.ModuleBlock.OperandBundleTagsBlock.abbrevs

constant

Source line 2230

std.zig.llvm.ir.ModuleBlock.OperandBundleTagsBlock.Code

container

Source line 2234

Fields

OPERAND_BUNDLE_TAG = 1

TAG: [strchr x N]

std.zig.llvm.ir.ModuleBlock.OperandBundleTagsBlock.id

constant

Source line 2228

BlockId

std.zig.llvm.ir.ModuleBlock.OperandBundleTagsBlock.OperandBundleTag

container

Source line 2239

Fields

tag: []const u8

std.zig.llvm.ir.ModuleBlock.OperandBundleTagsBlock.OperandBundleTag.ops

constant

Source line 2240

std.zig.llvm.ir.ModuleBlock.ParamattrBlock

namespace

Source line 316

PARAMATTR blocks have code for defining a parameter attribute set.

std.zig.llvm.ir.ModuleBlock.ParamattrBlock.abbrevs

constant

Source line 319

std.zig.llvm.ir.ModuleBlock.ParamattrBlock.Code

container

Source line 323

Fields

ENTRY_OLD = 1

Deprecated, but still needed to read old bitcode files. ENTRY: [paramidx0, attr0, paramidx1, attr1...]

ENTRY = 2

ENTRY: [attrgrp0, attrgrp1, ...]

std.zig.llvm.ir.ModuleBlock.ParamattrBlock.Entry

container

Source line 331

Fields

group_indices: []const u64

std.zig.llvm.ir.ModuleBlock.ParamattrBlock.Entry.ops

constant

Source line 332

std.zig.llvm.ir.ModuleBlock.ParamattrBlock.id

constant

Source line 317

BlockId

std.zig.llvm.ir.ModuleBlock.ParamattrGroupBlock

namespace

Source line 340

std.zig.llvm.ir.ModuleBlock.ParamattrGroupBlock.abbrevs

constant

Source line 343

std.zig.llvm.ir.ModuleBlock.ParamattrGroupBlock.Code

container

Source line 345

Fields

CODE_ENTRY = 3

ENTRY: [grpid, idx, attr0, attr1, ...]

std.zig.llvm.ir.ModuleBlock.ParamattrGroupBlock.id

constant

Source line 341

BlockId

std.zig.llvm.ir.ModuleBlock.String

container

Source line 197

Fields

code: u16
string: []const u8

std.zig.llvm.ir.ModuleBlock.String.ops

constant

Source line 198

std.zig.llvm.ir.ModuleBlock.TypeBlock

namespace

Source line 2026

TYPE blocks have codes for each type primitive they use.

std.zig.llvm.ir.ModuleBlock.TypeBlock.abbrevs

constant

Source line 2029

std.zig.llvm.ir.ModuleBlock.TypeBlock.Array

container

Source line 2174

Fields

len: u64
child: Builder.Type

std.zig.llvm.ir.ModuleBlock.TypeBlock.Array.ops

constant

Source line 2175

std.zig.llvm.ir.ModuleBlock.TypeBlock.Code

container

Source line 2044

Fields

NUMENTRY = 1

NUMENTRY: [numentries]

VOID = 2

VOID

FLOAT = 3

FLOAT

DOUBLE = 4

DOUBLE

LABEL = 5

LABEL

OPAQUE = 6

OPAQUE

INTEGER = 7

INTEGER: [width]

POINTER = 8

POINTER: [pointee type]

FUNCTION_OLD = 9

FUNCTION: [vararg, attrid, retty, paramty x N]

HALF = 10

HALF

ARRAY = 11

ARRAY: [numelts, eltty]

VECTOR = 12

VECTOR: [numelts, eltty]

X86_FP80 = 13

X86 LONG DOUBLE

FP128 = 14

LONG DOUBLE (112 bit mantissa)

PPC_FP128 = 15

PPC LONG DOUBLE (2 doubles)

METADATA = 16

METADATA

X86_MMX = 17

X86 MMX

STRUCT_ANON = 18

STRUCT_ANON: [ispacked, eltty x N]

STRUCT_NAME = 19

STRUCT_NAME: [strchr x N]

STRUCT_NAMED = 20

STRUCT_NAMED: [ispacked, eltty x N]

FUNCTION = 21

FUNCTION: [vararg, retty, paramty x N]

TOKEN = 22

TOKEN

BFLOAT = 23

BRAIN FLOATING POINT

X86_AMX = 24

X86 AMX

OPAQUE_POINTER = 25

OPAQUE_POINTER: [addrspace]

TARGET_TYPE = 26

TARGET_TYPE

std.zig.llvm.ir.ModuleBlock.TypeBlock.Function

container

Source line 2214

Fields

is_vararg: bool
return_type: Builder.Type
param_types: []const Builder.Type

std.zig.llvm.ir.ModuleBlock.TypeBlock.Function.ops

constant

Source line 2215

std.zig.llvm.ir.ModuleBlock.TypeBlock.id

constant

Source line 2027

BlockId

std.zig.llvm.ir.ModuleBlock.TypeBlock.Integer

container

Source line 2138

Fields

width: u28

std.zig.llvm.ir.ModuleBlock.TypeBlock.Integer.ops

constant

Source line 2139

std.zig.llvm.ir.ModuleBlock.TypeBlock.NumEntry

container

Source line 2116

Fields

num: u32

std.zig.llvm.ir.ModuleBlock.TypeBlock.NumEntry.ops

constant

Source line 2117

std.zig.llvm.ir.ModuleBlock.TypeBlock.Opaque

namespace

Source line 2131

std.zig.llvm.ir.ModuleBlock.TypeBlock.Opaque.ops

constant

Source line 2132

std.zig.llvm.ir.ModuleBlock.TypeBlock.Pointer

container

Source line 2194

Fields

addr_space: Builder.AddrSpace

std.zig.llvm.ir.ModuleBlock.TypeBlock.Pointer.ops

constant

Source line 2195

std.zig.llvm.ir.ModuleBlock.TypeBlock.Simple

container

Source line 2124

Fields

std.zig.llvm.ir.ModuleBlock.TypeBlock.Simple.ops

constant

Source line 2125

std.zig.llvm.ir.ModuleBlock.TypeBlock.StructAnon

container

Source line 2146

Fields

is_packed: bool
types: []const Builder.Type

std.zig.llvm.ir.ModuleBlock.TypeBlock.StructAnon.ops

constant

Source line 2147

std.zig.llvm.ir.ModuleBlock.TypeBlock.StructName

container

Source line 2166

Fields

string: []const u8

std.zig.llvm.ir.ModuleBlock.TypeBlock.StructName.ops

constant

Source line 2167

std.zig.llvm.ir.ModuleBlock.TypeBlock.StructNamed

container

Source line 2156

Fields

is_packed: bool
types: []const Builder.Type

std.zig.llvm.ir.ModuleBlock.TypeBlock.StructNamed.ops

constant

Source line 2157

std.zig.llvm.ir.ModuleBlock.TypeBlock.Target

container

Source line 2202

Fields

num_types: u32
types: []const Builder.Type
ints: []const u32

std.zig.llvm.ir.ModuleBlock.TypeBlock.Target.ops

constant

Source line 2203

std.zig.llvm.ir.ModuleBlock.TypeBlock.Vector

container

Source line 2184

Fields

len: u64
child: Builder.Type

std.zig.llvm.ir.ModuleBlock.TypeBlock.Vector.ops

constant

Source line 2185

std.zig.llvm.ir.ModuleBlock.Variable

container

Source line 206

Fields

strtab_offset: usize
strtab_size: usize
type_index: Builder.Type
is_const: AddrSpaceAndIsConst
initid: u32
linkage: Builder.Linkage
alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment))
section: usize
visibility: Builder.Visibility
thread_local: Builder.ThreadLocal
unnamed_addr: Builder.UnnamedAddr
externally_initialized: Builder.ExternallyInitialized
dllstorageclass: Builder.DllStorageClass
preemption: Builder.Preemption

std.zig.llvm.ir.ModuleBlock.Variable.AddrSpaceAndIsConst

container

Source line 207

Fields

is_const: bool
one: u1 = 1
addr_space: Builder.AddrSpace

std.zig.llvm.ir.ModuleBlock.Variable.ops

constant

Source line 213

std.zig.llvm.ir.ModuleBlock.Version

namespace

Source line 190

std.zig.llvm.ir.ModuleBlock.Version.ops

constant

Source line 191

std.zig.llvm.ir.std

alias

Source line 1

Alias of std

std.zig.llvm.ir.StrtabBlock

namespace

Source line 2301

std.zig.llvm.ir.StrtabBlock.abbrevs

constant

Source line 2304

std.zig.llvm.ir.StrtabBlock.Blob

container

Source line 2310

Fields

blob: []const u8

std.zig.llvm.ir.StrtabBlock.Blob.ops

constant

Source line 2311

std.zig.llvm.ir.StrtabBlock.Code

container

Source line 2306

Fields

BLOB = 1

std.zig.llvm.ir.StrtabBlock.id

constant

Source line 2302

BlockId

std.zig.llvm.ir.ValueAbbrev

constant

Source line 9

std.zig.llvm.ir.ValueArrayAbbrev

constant

Source line 10

Source code

std/zig/llvm/ir.zig

const std = @import("../../std.zig");
const Builder = @import("Builder.zig");
const bitcode_writer = @import("bitcode_writer.zig");

const AbbrevOp = bitcode_writer.AbbrevOp;

pub const MAGIC: u32 = 0xdec04342;

const ValueAbbrev = AbbrevOp{ .vbr = 6 };
const ValueArrayAbbrev = AbbrevOp{ .array_vbr = 6 };

const ConstantAbbrev = AbbrevOp{ .vbr = 6 };
const ConstantArrayAbbrev = AbbrevOp{ .array_vbr = 6 };

const MetadataAbbrev = AbbrevOp{ .vbr = 16 };
const MetadataArrayAbbrev = AbbrevOp{ .array_vbr = 16 };

const LineAbbrev = AbbrevOp{ .vbr = 8 };
const ColumnAbbrev = AbbrevOp{ .vbr = 8 };

const BlockAbbrev = AbbrevOp{ .vbr = 6 };
const BlockArrayAbbrev = AbbrevOp{ .array_vbr = 6 };

/// All bitcode files can optionally include a BLOCKINFO block, which contains
/// metadata about other blocks in the file.
/// The only top-level block types are MODULE, IDENTIFICATION, STRTAB and SYMTAB.
pub const BlockId = enum(u5) {
    /// BLOCKINFO_BLOCK is used to define metadata about blocks, for example,
    /// standard abbrevs that should be available to all blocks of a specified
    /// ID.
    BLOCKINFO = 0,

    /// Blocks
    MODULE = FIRST_APPLICATION,

    /// Module sub-block id's.
    PARAMATTR,
    PARAMATTR_GROUP,

    CONSTANTS,
    FUNCTION,

    /// Block intended to contains information on the bitcode versioning.
    /// Can be used to provide better error messages when we fail to parse a
    /// bitcode file.
    IDENTIFICATION,

    VALUE_SYMTAB,
    METADATA,
    METADATA_ATTACHMENT,

    TYPE,

    USELIST,

    MODULE_STRTAB,
    GLOBALVAL_SUMMARY,

    OPERAND_BUNDLE_TAGS,

    METADATA_KIND,

    STRTAB,

    FULL_LTO_GLOBALVAL_SUMMARY,

    SYMTAB,

    SYNC_SCOPE_NAMES,

    /// Block IDs 1-7 are reserved for future expansion.
    pub const FIRST_APPLICATION = 8;
};

/// Unused tags are commented out so that they are omitted in the generated
/// bitcode, which scans over this enum using reflection.
pub const FixedMetadataKind = enum(u6) {
    dbg = 0,
    //tbaa = 1,
    prof = 2,
    //fpmath = 3,
    //range = 4,
    //@"tbaa.struct" = 5,
    //@"invariant.load" = 6,
    //@"alias.scope" = 7,
    //@"noalias" = 8,
    //nontemporal = 9,
    //@"llvm.mem.parallel_loop_access" = 10,
    //nonnull = 11,
    //dereferenceable = 12,
    //dereferenceable_or_null = 13,
    //@"make.implicit" = 14,
    unpredictable = 15,
    //@"invariant.group" = 16,
    //@"align" = 17,
    //@"llvm.loop" = 18,
    //type = 19,
    //section_prefix = 20,
    //absolute_symbol = 21,
    //associated = 22,
    //callees = 23,
    //irr_loop = 24,
    //@"llvm.access.group" = 25,
    //callback = 26,
    //@"llvm.preserve.access.index" = 27,
    //vcall_visibility = 28,
    //noundef = 29,
    //annotation = 30,
    //nosanitize = 31,
    //func_sanitize = 32,
    //exclude = 33,
    //memprof = 34,
    //callsite = 35,
    //kcfi_type = 36,
    //pcsections = 37,
    //DIAssignID = 38,
    //@"coro.outside.frame" = 39,
};

pub const BlockInfoBlock = struct {
    pub const id: BlockId = .BLOCKINFO;

    pub const set_block_id = 1;

    pub const abbrevs = [_]type{};
};

/// MODULE blocks have a number of optional fields and subblocks.
pub const ModuleBlock = struct {
    pub const id: BlockId = .MODULE;

    pub const abbrevs = [_]type{
        ModuleBlock.Version,
        ModuleBlock.String,
        ModuleBlock.Variable,
        ModuleBlock.Function,
        ModuleBlock.Alias,
    };

    pub const Code = enum(u5) {
        /// VERSION:     [version#]
        VERSION = 1,
        /// TRIPLE:      [strchr x N]
        TRIPLE = 2,
        /// DATALAYOUT:  [strchr x N]
        DATALAYOUT = 3,
        /// ASM:         [strchr x N]
        ASM = 4,
        /// SECTIONNAME: [strchr x N]
        SECTIONNAME = 5,

        /// Deprecated, but still needed to read old bitcode files.
        /// DEPLIB:      [strchr x N]
        DEPLIB = 6,

        /// GLOBALVAR: [pointer type, isconst, initid,
        ///             linkage, alignment, section, visibility, threadlocal]
        GLOBALVAR = 7,

        /// FUNCTION:  [type, callingconv, isproto, linkage, paramattrs, alignment,
        ///             section, visibility, gc, unnamed_addr]
        FUNCTION = 8,

        /// ALIAS: [alias type, aliasee val#, linkage, visibility]
        ALIAS_OLD = 9,

        /// GCNAME: [strchr x N]
        GCNAME = 11,
        /// COMDAT: [selection_kind, name]
        COMDAT = 12,

        /// VSTOFFSET: [offset]
        VSTOFFSET = 13,

        /// ALIAS: [alias value type, addrspace, aliasee val#, linkage, visibility]
        ALIAS = 14,

        METADATA_VALUES_UNUSED = 15,

        /// SOURCE_FILENAME: [namechar x N]
        SOURCE_FILENAME = 16,

        /// HASH: [5*i32]
        HASH = 17,

        /// IFUNC: [ifunc value type, addrspace, resolver val#, linkage, visibility]
        IFUNC = 18,
    };

    pub const Version = struct {
        pub const ops = [_]AbbrevOp{
            .{ .literal = @backingInt(ModuleBlock.Code.VERSION) },
            .{ .literal = 2 },
        };
    };

    pub const String = struct {
        pub const ops = [_]AbbrevOp{
            .{ .vbr = 4 },
            .{ .array_fixed = 8 },
        };
        code: u16,
        string: []const u8,
    };

    pub const Variable = struct {
        const AddrSpaceAndIsConst = packed struct {
            is_const: bool,
            one: u1 = 1,
            addr_space: Builder.AddrSpace,
        };

        pub const ops = [_]AbbrevOp{
            .{ .literal = @backingInt(ModuleBlock.Code.GLOBALVAR) }, // Code
            .{ .vbr = 16 }, // strtab_offset
            .{ .vbr = 16 }, // strtab_size
            .{ .fixed_runtime = Builder.Type },
            .{ .fixed = @bitSizeOf(AddrSpaceAndIsConst) }, // isconst
            ConstantAbbrev, // initid
            .{ .fixed = @bitSizeOf(Builder.Linkage) },
            .{ .fixed = @bitSizeOf(Builder.Alignment) },
            .{ .vbr = 16 }, // section
            .{ .fixed = @bitSizeOf(Builder.Visibility) },
            .{ .fixed = @bitSizeOf(Builder.ThreadLocal) }, // threadlocal
            .{ .fixed = @bitSizeOf(Builder.UnnamedAddr) },
            .{ .fixed = @bitSizeOf(Builder.ExternallyInitialized) },
            .{ .fixed = @bitSizeOf(Builder.DllStorageClass) },
            .{ .literal = 0 }, // comdat
            .{ .literal = 0 }, // attributes
            .{ .fixed = @bitSizeOf(Builder.Preemption) },
        };
        strtab_offset: usize,
        strtab_size: usize,
        type_index: Builder.Type,
        is_const: AddrSpaceAndIsConst,
        initid: u32,
        linkage: Builder.Linkage,
        alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
        section: usize,
        visibility: Builder.Visibility,
        thread_local: Builder.ThreadLocal,
        unnamed_addr: Builder.UnnamedAddr,
        externally_initialized: Builder.ExternallyInitialized,
        dllstorageclass: Builder.DllStorageClass,
        preemption: Builder.Preemption,
    };

    pub const Function = struct {
        pub const ops = [_]AbbrevOp{
            .{ .literal = @backingInt(ModuleBlock.Code.FUNCTION) }, // Code
            .{ .vbr = 16 }, // strtab_offset
            .{ .vbr = 16 }, // strtab_size
            .{ .fixed_runtime = Builder.Type },
            .{ .fixed = @bitSizeOf(Builder.CallConv) },
            .{ .fixed = 1 }, // isproto
            .{ .fixed = @bitSizeOf(Builder.Linkage) },
            .{ .vbr = 16 }, // paramattr
            .{ .fixed = @bitSizeOf(Builder.Alignment) },
            .{ .vbr = 16 }, // section
            .{ .fixed = @bitSizeOf(Builder.Visibility) },
            .{ .literal = 0 }, // gc
            .{ .fixed = @bitSizeOf(Builder.UnnamedAddr) },
            .{ .literal = 0 }, // prologuedata
            .{ .fixed = @bitSizeOf(Builder.DllStorageClass) },
            .{ .literal = 0 }, // comdat
            .{ .literal = 0 }, // prefixdata
            .{ .literal = 0 }, // personalityfn
            .{ .fixed = @bitSizeOf(Builder.Preemption) },
            .{ .fixed = @bitSizeOf(Builder.AddrSpace) },
        };
        strtab_offset: usize,
        strtab_size: usize,
        type_index: Builder.Type,
        call_conv: Builder.CallConv,
        is_proto: bool,
        linkage: Builder.Linkage,
        paramattr: usize,
        alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
        section: usize,
        visibility: Builder.Visibility,
        unnamed_addr: Builder.UnnamedAddr,
        dllstorageclass: Builder.DllStorageClass,
        preemption: Builder.Preemption,
        addr_space: Builder.AddrSpace,
    };

    pub const Alias = struct {
        pub const ops = [_]AbbrevOp{
            .{ .literal = @backingInt(ModuleBlock.Code.ALIAS) }, // Code
            .{ .vbr = 16 }, // strtab_offset
            .{ .vbr = 16 }, // strtab_size
            .{ .fixed_runtime = Builder.Type },
            .{ .fixed = @bitSizeOf(Builder.AddrSpace) },
            ConstantAbbrev, // aliasee val
            .{ .fixed = @bitSizeOf(Builder.Linkage) },
            .{ .fixed = @bitSizeOf(Builder.Visibility) },
            .{ .fixed = @bitSizeOf(Builder.DllStorageClass) },
            .{ .fixed = @bitSizeOf(Builder.ThreadLocal) },
            .{ .fixed = @bitSizeOf(Builder.UnnamedAddr) },
            .{ .fixed = @bitSizeOf(Builder.Preemption) },
        };
        strtab_offset: usize,
        strtab_size: usize,
        type_index: Builder.Type,
        addr_space: Builder.AddrSpace,
        aliasee: u32,
        linkage: Builder.Linkage,
        visibility: Builder.Visibility,
        dllstorageclass: Builder.DllStorageClass,
        thread_local: Builder.ThreadLocal,
        unnamed_addr: Builder.UnnamedAddr,
        preemption: Builder.Preemption,
    };

    /// PARAMATTR blocks have code for defining a parameter attribute set.
    pub const ParamattrBlock = struct {
        pub const id: BlockId = .PARAMATTR;

        pub const abbrevs = [_]type{
            ModuleBlock.ParamattrBlock.Entry,
        };

        pub const Code = enum(u2) {
            /// Deprecated, but still needed to read old bitcode files.
            /// ENTRY: [paramidx0, attr0, paramidx1, attr1...]
            ENTRY_OLD = 1,
            /// ENTRY: [attrgrp0, attrgrp1, ...]
            ENTRY = 2,
        };

        pub const Entry = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ParamattrBlock.Code.ENTRY) },
                .{ .array_vbr = 8 },
            };
            group_indices: []const u64,
        };
    };

    pub const ParamattrGroupBlock = struct {
        pub const id: BlockId = .PARAMATTR_GROUP;

        pub const abbrevs = [_]type{};

        pub const Code = enum(u2) {
            /// ENTRY: [grpid, idx, attr0, attr1, ...]
            CODE_ENTRY = 3,
        };
    };

    /// The constants block (CONSTANTS_BLOCK_ID) describes emission for each
    /// constant and maintains an implicit current type value.
    pub const ConstantsBlock = struct {
        pub const id: BlockId = .CONSTANTS;

        pub const abbrevs = [_]type{
            ModuleBlock.ConstantsBlock.SetType,
            ModuleBlock.ConstantsBlock.Null,
            ModuleBlock.ConstantsBlock.Undef,
            ModuleBlock.ConstantsBlock.Poison,
            ModuleBlock.ConstantsBlock.Integer,
            ModuleBlock.ConstantsBlock.Half,
            ModuleBlock.ConstantsBlock.Float,
            ModuleBlock.ConstantsBlock.Double,
            ModuleBlock.ConstantsBlock.Fp80,
            ModuleBlock.ConstantsBlock.Fp128,
            ModuleBlock.ConstantsBlock.Aggregate,
            ModuleBlock.ConstantsBlock.String,
            ModuleBlock.ConstantsBlock.CString,
            ModuleBlock.ConstantsBlock.Cast,
            ModuleBlock.ConstantsBlock.Binary,
            ModuleBlock.ConstantsBlock.Cmp,
            ModuleBlock.ConstantsBlock.ExtractElement,
            ModuleBlock.ConstantsBlock.InsertElement,
            ModuleBlock.ConstantsBlock.ShuffleVector,
            ModuleBlock.ConstantsBlock.ShuffleVectorEx,
            ModuleBlock.ConstantsBlock.BlockAddress,
            ModuleBlock.ConstantsBlock.DsoLocalEquivalentOrNoCfi,
        };

        pub const Code = enum(u6) {
            /// SETTYPE:       [typeid]
            SETTYPE = 1,
            /// NULL
            NULL = 2,
            /// UNDEF
            UNDEF = 3,
            /// INTEGER:       [intval]
            INTEGER = 4,
            /// WIDE_INTEGER:  [n x intval]
            WIDE_INTEGER = 5,
            /// FLOAT:         [fpval]
            FLOAT = 6,
            /// AGGREGATE:     [n x value number]
            AGGREGATE = 7,
            /// STRING:        [values]
            STRING = 8,
            /// CSTRING:       [values]
            CSTRING = 9,
            /// CE_BINOP:      [opcode, opval, opval]
            CE_BINOP = 10,
            /// CE_CAST:       [opcode, opty, opval]
            CE_CAST = 11,
            /// CE_GEP:        [n x operands]
            CE_GEP_OLD = 12,
            /// CE_SELECT:     [opval, opval, opval]
            CE_SELECT = 13,
            /// CE_EXTRACTELT: [opty, opval, opval]
            CE_EXTRACTELT = 14,
            /// CE_INSERTELT:  [opval, opval, opval]
            CE_INSERTELT = 15,
            /// CE_SHUFFLEVEC: [opval, opval, opval]
            CE_SHUFFLEVEC = 16,
            /// CE_CMP:        [opty, opval, opval, pred]
            CE_CMP = 17,
            /// INLINEASM:     [sideeffect|alignstack,asmstr,conststr]
            INLINEASM_OLD = 18,
            /// SHUFVEC_EX:    [opty, opval, opval, opval]
            CE_SHUFVEC_EX = 19,
            /// INBOUNDS_GEP:  [n x operands]
            CE_INBOUNDS_GEP = 20,
            /// BLOCKADDRESS:  [fnty, fnval, bb#]
            BLOCKADDRESS = 21,
            /// DATA:          [n x elements]
            DATA = 22,
            /// INLINEASM:     [sideeffect|alignstack|asmdialect,asmstr,conststr]
            INLINEASM_OLD2 = 23,
            ///  [opty, flags, n x operands]
            CE_GEP_WITH_INRANGE_INDEX_OLD = 24,
            /// CE_UNOP:       [opcode, opval]
            CE_UNOP = 25,
            /// POISON
            POISON = 26,
            /// DSO_LOCAL_EQUIVALENT [gvty, gv]
            DSO_LOCAL_EQUIVALENT = 27,
            /// INLINEASM:     [sideeffect|alignstack|asmdialect|unwind,asmstr,
            ///                 conststr]
            INLINEASM_OLD3 = 28,
            /// NO_CFI [ fty, f ]
            NO_CFI_VALUE = 29,
            /// INLINEASM:     [fnty,sideeffect|alignstack|asmdialect|unwind,
            ///                 asmstr,conststr]
            INLINEASM = 30,
            /// [opty, flags, range, n x operands]
            CE_GEP_WITH_INRANGE = 31,
            /// [opty, flags, n x operands]
            CE_GEP = 32,
            /// [ptr, key, disc, addrdisc]
            PTRAUTH = 33,
        };

        pub const SetType = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.SETTYPE) },
                .{ .fixed_runtime = Builder.Type },
            };
            type_id: Builder.Type,
        };

        pub const Null = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.NULL) },
            };
        };

        pub const Undef = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.UNDEF) },
            };
        };

        pub const Poison = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.POISON) },
            };
        };

        pub const Integer = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.INTEGER) },
                .{ .vbr = 16 },
            };
            value: u64,
        };

        pub const Half = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) },
                .{ .fixed = 16 },
            };
            value: u16,
        };

        pub const Float = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) },
                .{ .fixed = 32 },
            };
            value: u32,
        };

        pub const Double = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) },
                .{ .vbr = 6 },
            };
            value: u64,
        };

        pub const Fp80 = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) },
                .{ .vbr = 6 },
                .{ .vbr = 6 },
            };
            hi: u64,
            lo: u16,
        };

        pub const Fp128 = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) },
                .{ .vbr = 6 },
                .{ .vbr = 6 },
            };
            lo: u64,
            hi: u64,
        };

        pub const Aggregate = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.AGGREGATE) },
                .{ .array_fixed = 32 },
            };
            values: []const Builder.Constant,
        };

        pub const String = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.STRING) },
                .{ .array_fixed = 8 },
            };
            string: []const u8,
        };

        pub const CString = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CSTRING) },
                .{ .array_fixed = 8 },
            };
            string: []const u8,
        };

        pub const Cast = struct {
            const CastOpcode = Builder.CastOpcode;
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_CAST) },
                .{ .fixed = @bitSizeOf(CastOpcode) },
                .{ .fixed_runtime = Builder.Type },
                ConstantAbbrev,
            };

            opcode: CastOpcode,
            type_index: Builder.Type,
            val: Builder.Constant,
        };

        pub const Binary = struct {
            const BinaryOpcode = Builder.BinaryOpcode;
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_BINOP) },
                .{ .fixed = @bitSizeOf(BinaryOpcode) },
                ConstantAbbrev,
                ConstantAbbrev,
            };

            opcode: BinaryOpcode,
            lhs: Builder.Constant,
            rhs: Builder.Constant,
        };

        pub const Cmp = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_CMP) },
                .{ .fixed_runtime = Builder.Type },
                ConstantAbbrev,
                ConstantAbbrev,
                .{ .vbr = 6 },
            };

            ty: Builder.Type,
            lhs: Builder.Constant,
            rhs: Builder.Constant,
            pred: u32,
        };

        pub const ExtractElement = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_EXTRACTELT) },
                .{ .fixed_runtime = Builder.Type },
                ConstantAbbrev,
                .{ .fixed_runtime = Builder.Type },
                ConstantAbbrev,
            };

            val_type: Builder.Type,
            val: Builder.Constant,
            index_type: Builder.Type,
            index: Builder.Constant,
        };

        pub const InsertElement = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_INSERTELT) },
                ConstantAbbrev,
                ConstantAbbrev,
                .{ .fixed_runtime = Builder.Type },
                ConstantAbbrev,
            };

            val: Builder.Constant,
            elem: Builder.Constant,
            index_type: Builder.Type,
            index: Builder.Constant,
        };

        pub const ShuffleVector = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_SHUFFLEVEC) },
                ValueAbbrev,
                ValueAbbrev,
                ValueAbbrev,
            };

            lhs: Builder.Constant,
            rhs: Builder.Constant,
            mask: Builder.Constant,
        };

        pub const ShuffleVectorEx = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_SHUFVEC_EX) },
                .{ .fixed_runtime = Builder.Type },
                ValueAbbrev,
                ValueAbbrev,
                ValueAbbrev,
            };

            ty: Builder.Type,
            lhs: Builder.Constant,
            rhs: Builder.Constant,
            mask: Builder.Constant,
        };

        pub const BlockAddress = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.BLOCKADDRESS) },
                .{ .fixed_runtime = Builder.Type },
                ConstantAbbrev,
                BlockAbbrev,
            };
            type_id: Builder.Type,
            function: u32,
            block: u32,
        };

        pub const DsoLocalEquivalentOrNoCfi = struct {
            pub const ops = [_]AbbrevOp{
                .{ .fixed = 5 },
                .{ .fixed_runtime = Builder.Type },
                ConstantAbbrev,
            };
            code: ModuleBlock.ConstantsBlock.Code,
            type_id: Builder.Type,
            function: u32,
        };
    };

    /// The function body block (FUNCTION_BLOCK_ID) describes function bodies.  It
    /// can contain a constant block (CONSTANTS_BLOCK_ID).
    pub const FunctionBlock = struct {
        pub const id: BlockId = .FUNCTION;

        pub const abbrevs = [_]type{
            ModuleBlock.FunctionBlock.DeclareBlocks,
            ModuleBlock.FunctionBlock.Call,
            ModuleBlock.FunctionBlock.CallFast,
            ModuleBlock.FunctionBlock.FNeg,
            ModuleBlock.FunctionBlock.FNegFast,
            ModuleBlock.FunctionBlock.Binary,
            ModuleBlock.FunctionBlock.BinaryNoWrap,
            ModuleBlock.FunctionBlock.BinaryExact,
            ModuleBlock.FunctionBlock.BinaryFast,
            ModuleBlock.FunctionBlock.Cmp,
            ModuleBlock.FunctionBlock.CmpFast,
            ModuleBlock.FunctionBlock.Select,
            ModuleBlock.FunctionBlock.SelectFast,
            ModuleBlock.FunctionBlock.Cast,
            ModuleBlock.FunctionBlock.TruncNoWrap,
            ModuleBlock.FunctionBlock.Alloca,
            ModuleBlock.FunctionBlock.GetElementPtr,
            ModuleBlock.FunctionBlock.ExtractValue,
            ModuleBlock.FunctionBlock.InsertValue,
            ModuleBlock.FunctionBlock.ExtractElement,
            ModuleBlock.FunctionBlock.InsertElement,
            ModuleBlock.FunctionBlock.ShuffleVector,
            ModuleBlock.FunctionBlock.RetVoid,
            ModuleBlock.FunctionBlock.Ret,
            ModuleBlock.FunctionBlock.Unreachable,
            ModuleBlock.FunctionBlock.Load,
            ModuleBlock.FunctionBlock.LoadAtomic,
            ModuleBlock.FunctionBlock.Store,
            ModuleBlock.FunctionBlock.StoreAtomic,
            ModuleBlock.FunctionBlock.BrUnconditional,
            ModuleBlock.FunctionBlock.BrConditional,
            ModuleBlock.FunctionBlock.VaArg,
            ModuleBlock.FunctionBlock.AtomicRmw,
            ModuleBlock.FunctionBlock.CmpXchg,
            ModuleBlock.FunctionBlock.Fence,
            ModuleBlock.FunctionBlock.DebugLoc,
            ModuleBlock.FunctionBlock.DebugLocAgain,
            ModuleBlock.FunctionBlock.ColdOperandBundle,
            ModuleBlock.FunctionBlock.IndirectBr,
        };

        pub const Code = enum(u7) {
            /// DECLAREBLOCKS: [n]
            DECLAREBLOCKS = 1,

            /// BINOP:      [opcode, ty, opval, opval]
            INST_BINOP = 2,
            /// CAST:       [opcode, ty, opty, opval]
            INST_CAST = 3,
            /// GEP:        [n x operands]
            INST_GEP_OLD = 4,
            /// SELECT:     [ty, opval, opval, opval]
            INST_SELECT = 5,
            /// EXTRACTELT: [opty, opval, opval]
            INST_EXTRACTELT = 6,
            /// INSERTELT:  [ty, opval, opval, opval]
            INST_INSERTELT = 7,
            /// SHUFFLEVEC: [ty, opval, opval, opval]
            INST_SHUFFLEVEC = 8,
            /// CMP:        [opty, opval, opval, pred]
            INST_CMP = 9,

            /// RET:        [opty,opval<both optional>]
            INST_RET = 10,
            /// BR:         [bb#, bb#, cond] or [bb#]
            INST_BR = 11,
            /// SWITCH:     [opty, op0, op1, ...]
            INST_SWITCH = 12,
            /// INVOKE:     [attr, fnty, op0,op1, ...]
            INST_INVOKE = 13,
            /// UNREACHABLE
            INST_UNREACHABLE = 15,

            /// PHI:        [ty, val0,bb0, ...]
            INST_PHI = 16,
            /// ALLOCA:     [instty, opty, op, align]
            INST_ALLOCA = 19,
            /// LOAD:       [opty, op, align, vol]
            INST_LOAD = 20,
            /// VAARG:      [valistty, valist, instty]
            /// This store code encodes the pointer type, rather than the value type
            /// this is so information only available in the pointer type (e.g. address
            /// spaces) is retained.
            INST_VAARG = 23,
            /// STORE:      [ptrty,ptr,val, align, vol]
            INST_STORE_OLD = 24,

            /// EXTRACTVAL: [n x operands]
            INST_EXTRACTVAL = 26,
            /// INSERTVAL:  [n x operands]
            INST_INSERTVAL = 27,
            /// fcmp/icmp returning Int1TY or vector of Int1Ty. Same as CMP, exists to
            /// support legacy vicmp/vfcmp instructions.
            /// CMP2:       [opty, opval, opval, pred]
            INST_CMP2 = 28,
            /// new select on i1 or [N x i1]
            /// VSELECT:    [ty,opval,opval,predty,pred]
            INST_VSELECT = 29,
            /// INBOUNDS_GEP: [n x operands]
            INST_INBOUNDS_GEP_OLD = 30,
            /// INDIRECTBR: [opty, op0, op1, ...]
            INST_INDIRECTBR = 31,

            /// DEBUG_LOC_AGAIN
            DEBUG_LOC_AGAIN = 33,

            /// CALL:    [attr, cc, fnty, fnid, args...]
            INST_CALL = 34,

            /// DEBUG_LOC:  [Line,Col,ScopeVal, IAVal]
            DEBUG_LOC = 35,
            /// FENCE: [ordering, synchscope]
            INST_FENCE = 36,
            /// CMPXCHG: [ptrty, ptr, cmp, val, vol,
            ///            ordering, synchscope,
            ///            failure_ordering?, weak?]
            INST_CMPXCHG_OLD = 37,
            /// ATOMICRMW: [ptrty,ptr,val, operation,
            ///             align, vol,
            ///             ordering, synchscope]
            INST_ATOMICRMW_OLD = 38,
            /// RESUME:     [opval]
            INST_RESUME = 39,
            /// LANDINGPAD: [ty,val,val,num,id0,val0...]
            INST_LANDINGPAD_OLD = 40,
            /// LOAD: [opty, op, align, vol,
            ///        ordering, synchscope]
            INST_LOADATOMIC = 41,
            /// STORE: [ptrty,ptr,val, align, vol
            ///         ordering, synchscope]
            INST_STOREATOMIC_OLD = 42,

            /// GEP:  [inbounds, n x operands]
            INST_GEP = 43,
            /// STORE: [ptrty,ptr,valty,val, align, vol]
            INST_STORE = 44,
            /// STORE: [ptrty,ptr,val, align, vol
            INST_STOREATOMIC = 45,
            /// CMPXCHG: [ptrty, ptr, cmp, val, vol,
            ///           success_ordering, synchscope,
            ///           failure_ordering, weak]
            INST_CMPXCHG = 46,
            /// LANDINGPAD: [ty,val,num,id0,val0...]
            INST_LANDINGPAD = 47,
            /// CLEANUPRET: [val] or [val,bb#]
            INST_CLEANUPRET = 48,
            /// CATCHRET: [val,bb#]
            INST_CATCHRET = 49,
            /// CATCHPAD: [bb#,bb#,num,args...]
            INST_CATCHPAD = 50,
            /// CLEANUPPAD: [num,args...]
            INST_CLEANUPPAD = 51,
            /// CATCHSWITCH: [num,args...] or [num,args...,bb]
            INST_CATCHSWITCH = 52,
            /// OPERAND_BUNDLE: [tag#, value...]
            OPERAND_BUNDLE = 55,
            /// UNOP:       [opcode, ty, opval]
            INST_UNOP = 56,
            /// CALLBR:     [attr, cc, norm, transfs,
            ///              fnty, fnid, args...]
            INST_CALLBR = 57,
            /// FREEZE: [opty, opval]
            INST_FREEZE = 58,
            /// ATOMICRMW: [ptrty, ptr, valty, val,
            ///             operation, align, vol,
            ///             ordering, synchscope]
            INST_ATOMICRMW = 59,
            /// BLOCKADDR_USERS: [value...]
            BLOCKADDR_USERS = 60,

            /// [DILocation, DILocalVariable, DIExpression, ValueAsMetadata]
            DEBUG_RECORD_VALUE = 61,
            /// [DILocation, DILocalVariable, DIExpression, ValueAsMetadata]
            DEBUG_RECORD_DECLARE = 62,
            /// [DILocation, DILocalVariable, DIExpression, ValueAsMetadata,
            ///  DIAssignID, DIExpression (addr), ValueAsMetadata (addr)]
            DEBUG_RECORD_ASSIGN = 63,
            /// [DILocation, DILocalVariable, DIExpression, Value]
            DEBUG_RECORD_VALUE_SIMPLE = 64,
            /// [DILocation, DILabel]
            DEBUG_RECORD_LABEL = 65,
        };

        pub const DeclareBlocks = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.DECLAREBLOCKS) },
                .{ .vbr = 8 },
            };
            num_blocks: usize,
        };

        pub const Call = struct {
            pub const CallType = packed struct(u17) {
                tail: bool = false,
                call_conv: Builder.CallConv,
                reserved: u3 = 0,
                must_tail: bool = false,
                // We always use the explicit type version as that is what LLVM does
                explicit_type: bool = true,
                no_tail: bool = false,
            };
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CALL) },
                .{ .fixed_runtime = Builder.FunctionAttributes },
                .{ .fixed = @bitSizeOf(CallType) },
                .{ .fixed_runtime = Builder.Type },
                ValueAbbrev, // Callee
                ValueArrayAbbrev, // Args
            };

            attributes: Builder.FunctionAttributes,
            call_type: CallType,
            type_id: Builder.Type,
            callee: Builder.Value,
            args: []const Builder.Value,
        };

        pub const CallFast = struct {
            const CallType = packed struct(u18) {
                tail: bool = false,
                call_conv: Builder.CallConv,
                reserved: u3 = 0,
                must_tail: bool = false,
                // We always use the explicit type version as that is what LLVM does
                explicit_type: bool = true,
                no_tail: bool = false,
                fast: bool = true,
            };

            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CALL) },
                .{ .fixed_runtime = Builder.FunctionAttributes },
                .{ .fixed = @bitSizeOf(CallType) },
                .{ .fixed = @bitSizeOf(Builder.FastMath) },
                .{ .fixed_runtime = Builder.Type },
                ValueAbbrev, // Callee
                ValueArrayAbbrev, // Args
            };

            attributes: Builder.FunctionAttributes,
            call_type: CallType,
            fast_math: Builder.FastMath,
            type_id: Builder.Type,
            callee: Builder.Value,
            args: []const Builder.Value,
        };

        pub const FNeg = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_UNOP) },
                ValueAbbrev,
                .{ .literal = 0 },
            };

            val: u32,
        };

        pub const FNegFast = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_UNOP) },
                ValueAbbrev,
                .{ .literal = 0 },
                .{ .fixed = @bitSizeOf(Builder.FastMath) },
            };

            val: u32,
            fast_math: Builder.FastMath,
        };

        pub const Binary = struct {
            const BinaryOpcode = Builder.BinaryOpcode;
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BINOP) },
                ValueAbbrev,
                ValueAbbrev,
                .{ .fixed = @bitSizeOf(BinaryOpcode) },
            };

            lhs: u32,
            rhs: u32,
            opcode: BinaryOpcode,
        };

        pub const BinaryNoWrap = struct {
            const BinaryOpcode = Builder.BinaryOpcode;
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BINOP) },
                ValueAbbrev,
                ValueAbbrev,
                .{ .fixed = @bitSizeOf(BinaryOpcode) },
                .{ .fixed = 2 },
            };

            lhs: u32,
            rhs: u32,
            opcode: BinaryOpcode,
            flags: packed struct(u2) {
                no_unsigned_wrap: bool,
                no_signed_wrap: bool,
            },
        };

        pub const BinaryExact = struct {
            const BinaryOpcode = Builder.BinaryOpcode;
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BINOP) },
                ValueAbbrev,
                ValueAbbrev,
                .{ .fixed = @bitSizeOf(BinaryOpcode) },
                .{ .literal = 1 },
            };

            lhs: u32,
            rhs: u32,
            opcode: BinaryOpcode,
        };

        pub const BinaryFast = struct {
            const BinaryOpcode = Builder.BinaryOpcode;
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BINOP) },
                ValueAbbrev,
                ValueAbbrev,
                .{ .fixed = @bitSizeOf(BinaryOpcode) },
                .{ .fixed = @bitSizeOf(Builder.FastMath) },
            };

            lhs: u32,
            rhs: u32,
            opcode: BinaryOpcode,
            fast_math: Builder.FastMath,
        };

        pub const Cmp = struct {
            const CmpPredicate = Builder.CmpPredicate;
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CMP2) },
                ValueAbbrev,
                ValueAbbrev,
                .{ .fixed = @bitSizeOf(CmpPredicate) },
            };

            lhs: u32,
            rhs: u32,
            pred: CmpPredicate,
        };

        pub const CmpFast = struct {
            const CmpPredicate = Builder.CmpPredicate;
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CMP2) },
                ValueAbbrev,
                ValueAbbrev,
                .{ .fixed = @bitSizeOf(CmpPredicate) },
                .{ .fixed = @bitSizeOf(Builder.FastMath) },
            };

            lhs: u32,
            rhs: u32,
            pred: CmpPredicate,
            fast_math: Builder.FastMath,
        };

        pub const Select = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_VSELECT) },
                ValueAbbrev,
                ValueAbbrev,
                ValueAbbrev,
            };

            lhs: u32,
            rhs: u32,
            cond: u32,
        };

        pub const SelectFast = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_VSELECT) },
                ValueAbbrev,
                ValueAbbrev,
                ValueAbbrev,
                .{ .fixed = @bitSizeOf(Builder.FastMath) },
            };

            lhs: u32,
            rhs: u32,
            cond: u32,
            fast_math: Builder.FastMath,
        };

        pub const Cast = struct {
            const CastOpcode = Builder.CastOpcode;
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CAST) },
                ValueAbbrev,
                .{ .fixed_runtime = Builder.Type },
                .{ .fixed = @bitSizeOf(CastOpcode) },
            };

            val: u32,
            type_index: Builder.Type,
            opcode: CastOpcode,
        };

        pub const TruncNoWrap = struct {
            pub const Flags = packed struct(u2) {
                no_unsigned_wrap: bool,
                no_signed_wrap: bool,
            };
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CAST) },
                ValueAbbrev,
                .{ .fixed_runtime = Builder.Type },
                .{ .literal = @backingInt(Builder.CastOpcode.trunc) },
                .{ .fixed = @bitSizeOf(Flags) },
            };

            val: u32,
            type_index: Builder.Type,
            flags: Flags,
        };

        pub const Alloca = struct {
            pub const Flags = packed struct(u11) {
                align_lower: u5,
                inalloca: bool,
                explicit_type: bool,
                swift_error: bool,
                align_upper: u3,
            };
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_ALLOCA) },
                .{ .fixed_runtime = Builder.Type },
                .{ .fixed_runtime = Builder.Type },
                ValueAbbrev,
                .{ .fixed = @bitSizeOf(Flags) },
            };

            inst_type: Builder.Type,
            len_type: Builder.Type,
            len_value: u32,
            flags: Flags,
        };

        pub const RetVoid = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_RET) },
            };
        };

        pub const Ret = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_RET) },
                ValueAbbrev,
            };
            val: u32,
        };

        pub const GetElementPtr = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_GEP) },
                .{ .fixed = 1 },
                .{ .fixed_runtime = Builder.Type },
                ValueAbbrev,
                ValueArrayAbbrev,
            };

            is_inbounds: bool,
            type_index: Builder.Type,
            base: Builder.Value,
            indices: []const Builder.Value,
        };

        pub const ExtractValue = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_EXTRACTVAL) },
                ValueAbbrev,
                ValueArrayAbbrev,
            };

            val: u32,
            indices: []const u32,
        };

        pub const InsertValue = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_INSERTVAL) },
                ValueAbbrev,
                ValueAbbrev,
                ValueArrayAbbrev,
            };

            val: u32,
            elem: u32,
            indices: []const u32,
        };

        pub const ExtractElement = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_EXTRACTELT) },
                ValueAbbrev,
                ValueAbbrev,
            };

            val: u32,
            index: u32,
        };

        pub const InsertElement = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_INSERTELT) },
                ValueAbbrev,
                ValueAbbrev,
                ValueAbbrev,
            };

            val: u32,
            elem: u32,
            index: u32,
        };

        pub const ShuffleVector = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_SHUFFLEVEC) },
                ValueAbbrev,
                ValueAbbrev,
                ValueAbbrev,
            };

            lhs: u32,
            rhs: u32,
            mask: u32,
        };

        pub const Unreachable = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_UNREACHABLE) },
            };
        };

        pub const Load = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_LOAD) },
                ValueAbbrev,
                .{ .fixed_runtime = Builder.Type },
                .{ .fixed = @bitSizeOf(Builder.Alignment) },
                .{ .fixed = 1 },
            };
            ptr: u32,
            ty: Builder.Type,
            alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
            is_volatile: bool,
        };

        pub const LoadAtomic = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_LOADATOMIC) },
                ValueAbbrev,
                .{ .fixed_runtime = Builder.Type },
                .{ .fixed = @bitSizeOf(Builder.Alignment) },
                .{ .fixed = 1 },
                .{ .fixed = @bitSizeOf(Builder.AtomicOrdering) },
                .{ .fixed = @bitSizeOf(Builder.SyncScope) },
            };
            ptr: u32,
            ty: Builder.Type,
            alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
            is_volatile: bool,
            success_ordering: Builder.AtomicOrdering,
            sync_scope: Builder.SyncScope,
        };

        pub const Store = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_STORE) },
                ValueAbbrev,
                ValueAbbrev,
                .{ .fixed = @bitSizeOf(Builder.Alignment) },
                .{ .fixed = 1 },
            };
            ptr: u32,
            val: u32,
            alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
            is_volatile: bool,
        };

        pub const StoreAtomic = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_STOREATOMIC) },
                ValueAbbrev,
                ValueAbbrev,
                .{ .fixed = @bitSizeOf(Builder.Alignment) },
                .{ .fixed = 1 },
                .{ .fixed = @bitSizeOf(Builder.AtomicOrdering) },
                .{ .fixed = @bitSizeOf(Builder.SyncScope) },
            };
            ptr: u32,
            val: u32,
            alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
            is_volatile: bool,
            success_ordering: Builder.AtomicOrdering,
            sync_scope: Builder.SyncScope,
        };

        pub const BrUnconditional = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BR) },
                BlockAbbrev,
            };
            block: u32,
        };

        pub const BrConditional = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BR) },
                BlockAbbrev,
                BlockAbbrev,
                BlockAbbrev,
            };
            then_block: u32,
            else_block: u32,
            condition: u32,
        };

        pub const VaArg = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_VAARG) },
                .{ .fixed_runtime = Builder.Type },
                ValueAbbrev,
                .{ .fixed_runtime = Builder.Type },
            };
            list_type: Builder.Type,
            list: u32,
            type: Builder.Type,
        };

        pub const AtomicRmw = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_ATOMICRMW) },
                ValueAbbrev,
                ValueAbbrev,
                .{ .fixed = @bitSizeOf(Builder.Function.Instruction.AtomicRmw.Operation) },
                .{ .fixed = 1 },
                .{ .fixed = @bitSizeOf(Builder.AtomicOrdering) },
                .{ .fixed = @bitSizeOf(Builder.SyncScope) },
                .{ .fixed = @bitSizeOf(Builder.Alignment) },
            };
            ptr: u32,
            val: u32,
            operation: Builder.Function.Instruction.AtomicRmw.Operation,
            is_volatile: bool,
            success_ordering: Builder.AtomicOrdering,
            sync_scope: Builder.SyncScope,
            alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
        };

        pub const CmpXchg = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CMPXCHG) },
                ValueAbbrev,
                ValueAbbrev,
                ValueAbbrev,
                .{ .fixed = 1 },
                .{ .fixed = @bitSizeOf(Builder.AtomicOrdering) },
                .{ .fixed = @bitSizeOf(Builder.SyncScope) },
                .{ .fixed = @bitSizeOf(Builder.AtomicOrdering) },
                .{ .fixed = 1 },
                .{ .fixed = @bitSizeOf(Builder.Alignment) },
            };
            ptr: u32,
            cmp: u32,
            new: u32,
            is_volatile: bool,
            success_ordering: Builder.AtomicOrdering,
            sync_scope: Builder.SyncScope,
            failure_ordering: Builder.AtomicOrdering,
            is_weak: bool,
            alignment: @Int(.unsigned, @bitSizeOf(Builder.Alignment)),
        };

        pub const Fence = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_FENCE) },
                .{ .fixed = @bitSizeOf(Builder.AtomicOrdering) },
                .{ .fixed = @bitSizeOf(Builder.SyncScope) },
            };
            ordering: Builder.AtomicOrdering,
            sync_scope: Builder.SyncScope,
        };

        pub const DebugLoc = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.DEBUG_LOC) },
                LineAbbrev,
                ColumnAbbrev,
                MetadataAbbrev,
                MetadataAbbrev,
                .{ .literal = 0 },
            };
            line: u32,
            column: u32,
            scope: Builder.Metadata.Optional,
            inlined_at: Builder.Metadata.Optional,
        };

        pub const DebugLocAgain = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.DEBUG_LOC_AGAIN) },
            };
        };

        pub const ColdOperandBundle = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.OPERAND_BUNDLE) },
                .{ .literal = 0 },
            };
        };

        pub const IndirectBr = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_INDIRECTBR) },
                .{ .fixed_runtime = Builder.Type },
                ValueAbbrev,
                BlockArrayAbbrev,
            };
            ty: Builder.Type,
            addr: Builder.Value,
            targets: []const Builder.Function.Block.Index,
        };

        pub const ValueSymtabBlock = struct {
            pub const id: BlockId = .VALUE_SYMTAB;

            pub const abbrevs = [_]type{
                ModuleBlock.FunctionBlock.ValueSymtabBlock.BlockEntry,
            };

            /// Value symbol table codes.
            pub const Code = enum(u3) {
                /// VST_ENTRY: [valueid, namechar x N]
                ENTRY = 1,
                /// VST_BBENTRY: [bbid, namechar x N]
                BBENTRY = 2,
                /// VST_FNENTRY: [valueid, offset, namechar x N]
                FNENTRY = 3,
                /// VST_COMBINED_ENTRY: [valueid, refguid]
                COMBINED_ENTRY = 5,
            };

            pub const BlockEntry = struct {
                pub const ops = [_]AbbrevOp{
                    .{ .literal = @backingInt(ModuleBlock.FunctionBlock.ValueSymtabBlock.Code.BBENTRY) },
                    ValueAbbrev,
                    .{ .array_fixed = 8 },
                };
                value_id: u32,
                string: []const u8,
            };
        };

        pub const MetadataBlock = struct {
            pub const id: BlockId = .METADATA;

            pub const abbrevs = [_]type{
                ModuleBlock.FunctionBlock.MetadataBlock.Value,
            };

            pub const Value = struct {
                pub const ops = [_]AbbrevOp{
                    .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.VALUE) },
                    .{ .fixed = 32 }, // variable
                    .{ .fixed = 32 }, // expression
                };

                ty: Builder.Type,
                value: Builder.Value,
            };
        };

        pub const MetadataAttachmentBlock = struct {
            pub const id: BlockId = .METADATA_ATTACHMENT;

            pub const abbrevs = [_]type{
                ModuleBlock.FunctionBlock.MetadataAttachmentBlock.AttachmentGlobalSingle,
                ModuleBlock.FunctionBlock.MetadataAttachmentBlock.AttachmentInstructionSingle,
            };

            pub const AttachmentGlobalSingle = struct {
                pub const ops = [_]AbbrevOp{
                    .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.ATTACHMENT) },
                    .{ .fixed = 1 },
                    MetadataAbbrev,
                };
                kind: FixedMetadataKind,
                metadata: Builder.Metadata,
            };

            pub const AttachmentInstructionSingle = struct {
                pub const ops = [_]AbbrevOp{
                    .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.ATTACHMENT) },
                    ValueAbbrev,
                    .{ .fixed = 5 },
                    MetadataAbbrev,
                };
                inst: u32,
                kind: FixedMetadataKind,
                metadata: Builder.Metadata,
            };
        };
    };

    pub const MetadataBlock = struct {
        pub const id: BlockId = .METADATA;

        pub const abbrevs = [_]type{
            ModuleBlock.MetadataBlock.Strings,
            ModuleBlock.MetadataBlock.File,
            ModuleBlock.MetadataBlock.CompileUnit,
            ModuleBlock.MetadataBlock.Subprogram,
            ModuleBlock.MetadataBlock.LexicalBlock,
            ModuleBlock.MetadataBlock.Location,
            ModuleBlock.MetadataBlock.BasicType,
            ModuleBlock.MetadataBlock.CompositeType,
            ModuleBlock.MetadataBlock.DerivedType,
            ModuleBlock.MetadataBlock.SubroutineType,
            ModuleBlock.MetadataBlock.Enumerator,
            ModuleBlock.MetadataBlock.Subrange,
            ModuleBlock.MetadataBlock.Expression,
            ModuleBlock.MetadataBlock.Node,
            ModuleBlock.MetadataBlock.LocalVar,
            ModuleBlock.MetadataBlock.Parameter,
            ModuleBlock.MetadataBlock.GlobalVar,
            ModuleBlock.MetadataBlock.GlobalVarExpression,
            ModuleBlock.MetadataBlock.Constant,
            ModuleBlock.MetadataBlock.Name,
            ModuleBlock.MetadataBlock.NamedNode,
            ModuleBlock.MetadataBlock.GlobalDeclAttachment,
        };

        pub const Code = enum(u6) {
            /// MDSTRING:      [values]
            STRING_OLD = 1,
            /// VALUE:         [type num, value num]
            VALUE = 2,
            /// NODE:          [n x md num]
            NODE = 3,
            /// STRING:        [values]
            NAME = 4,
            /// DISTINCT_NODE: [n x md num]
            DISTINCT_NODE = 5,
            /// [n x [id, name]]
            KIND = 6,
            /// [distinct, line, col, scope, inlined-at?]
            LOCATION = 7,
            /// OLD_NODE:      [n x (type num, value num)]
            OLD_NODE = 8,
            /// OLD_FN_NODE:   [n x (type num, value num)]
            OLD_FN_NODE = 9,
            /// NAMED_NODE:    [n x mdnodes]
            NAMED_NODE = 10,
            /// [m x [value, [n x [id, mdnode]]]
            ATTACHMENT = 11,
            /// [distinct, tag, vers, header, n x md num]
            GENERIC_DEBUG = 12,
            /// [distinct, count, lo]
            SUBRANGE = 13,
            /// [isUnsigned|distinct, value, name]
            ENUMERATOR = 14,
            /// [distinct, tag, name, size, align, enc]
            BASIC_TYPE = 15,
            /// [distinct, filename, directory, checksumkind, checksum]
            FILE = 16,
            /// [distinct, ...]
            DERIVED_TYPE = 17,
            /// [distinct, ...]
            COMPOSITE_TYPE = 18,
            /// [distinct, flags, types, cc]
            SUBROUTINE_TYPE = 19,
            /// [distinct, ...]
            COMPILE_UNIT = 20,
            /// [distinct, ...]
            SUBPROGRAM = 21,
            /// [distinct, scope, file, line, column]
            LEXICAL_BLOCK = 22,
            ///[distinct, scope, file, discriminator]
            LEXICAL_BLOCK_FILE = 23,
            /// [distinct, scope, file, name, line, exportSymbols]
            NAMESPACE = 24,
            /// [distinct, scope, name, type, ...]
            TEMPLATE_TYPE = 25,
            /// [distinct, scope, name, type, value, ...]
            TEMPLATE_VALUE = 26,
            /// [distinct, ...]
            GLOBAL_VAR = 27,
            /// [distinct, ...]
            LOCAL_VAR = 28,
            /// [distinct, n x element]
            EXPRESSION = 29,
            /// [distinct, name, file, line, ...]
            OBJC_PROPERTY = 30,
            /// [distinct, tag, scope, entity, line, name]
            IMPORTED_ENTITY = 31,
            /// [distinct, scope, name, ...]
            MODULE = 32,
            /// [distinct, macinfo, line, name, value]
            MACRO = 33,
            /// [distinct, macinfo, line, file, ...]
            MACRO_FILE = 34,
            /// [count, offset] blob([lengths][chars])
            STRINGS = 35,
            /// [valueid, n x [id, mdnode]]
            GLOBAL_DECL_ATTACHMENT = 36,
            /// [distinct, var, expr]
            GLOBAL_VAR_EXPR = 37,
            /// [offset]
            INDEX_OFFSET = 38,
            /// [bitpos]
            INDEX = 39,
            /// [distinct, scope, name, file, line]
            LABEL = 40,
            /// [distinct, name, size, align,...]
            STRING_TYPE = 41,
            /// [distinct, scope, name, variable,...]
            COMMON_BLOCK = 44,
            /// [distinct, count, lo, up, stride]
            GENERIC_SUBRANGE = 45,
            /// [n x [type num, value num]]
            ARG_LIST = 46,
            /// [distinct, ...]
            ASSIGN_ID = 47,
        };

        pub const Strings = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.STRINGS) },
                .{ .vbr = 6 },
                .{ .vbr = 6 },
                .blob,
            };
            num_strings: u32,
            strings_offset: u32,
            blob: []const u8,
        };

        pub const File = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.FILE) },
                .{ .literal = 0 }, // is distinct
                MetadataAbbrev, // filename
                MetadataAbbrev, // directory
                .{ .literal = 0 }, // checksum
                .{ .literal = 0 }, // checksum
            };

            filename: Builder.Metadata.String.Optional,
            directory: Builder.Metadata.String.Optional,
        };

        pub const CompileUnit = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.COMPILE_UNIT) },
                .{ .literal = 1 }, // is distinct
                .{ .literal = std.dwarf.LANG.C99 }, // source language
                MetadataAbbrev, // file
                MetadataAbbrev, // producer
                .{ .fixed = 1 }, // isOptimized
                .{ .literal = 0 }, // raw flags
                .{ .literal = 0 }, // runtime version
                .{ .literal = 0 }, // split debug file name
                .{ .literal = 1 }, // emission kind
                MetadataAbbrev, // enums
                .{ .literal = 0 }, // retained types
                .{ .literal = 0 }, // subprograms
                MetadataAbbrev, // globals
                .{ .literal = 0 }, // imported entities
                .{ .literal = 0 }, // DWO ID
                .{ .literal = 0 }, // macros
                .{ .literal = 0 }, // split debug inlining
                .{ .literal = 0 }, // debug info profiling
                .{ .literal = 0 }, // name table kind
                .{ .literal = 0 }, // ranges base address
                .{ .literal = 0 }, // raw sysroot
                .{ .literal = 0 }, // raw SDK
            };

            file: Builder.Metadata.Optional,
            producer: Builder.Metadata.String.Optional,
            is_optimized: bool,
            enums: Builder.Metadata.Optional,
            globals: Builder.Metadata.Optional,
        };

        pub const Subprogram = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.SUBPROGRAM) },
                .{ .literal = 0b111 }, // is distinct | has sp flags | has flags
                MetadataAbbrev, // scope
                MetadataAbbrev, // name
                MetadataAbbrev, // linkage name
                MetadataAbbrev, // file
                LineAbbrev, // line
                MetadataAbbrev, // type
                LineAbbrev, // scope line
                .{ .literal = 0 }, // containing type
                .{ .fixed = 32 }, // sp flags
                .{ .literal = 0 }, // virtual index
                .{ .fixed = 32 }, // flags
                MetadataAbbrev, // compile unit
                .{ .literal = 0 }, // template params
                .{ .literal = 0 }, // declaration
                .{ .literal = 0 }, // retained nodes
                .{ .literal = 0 }, // this adjustment
                .{ .literal = 0 }, // thrown types
                .{ .literal = 0 }, // annotations
                .{ .literal = 0 }, // target function name
            };

            scope: Builder.Metadata.Optional,
            name: Builder.Metadata.String.Optional,
            linkage_name: Builder.Metadata.String.Optional,
            file: Builder.Metadata.Optional,
            line: u32,
            ty: Builder.Metadata.Optional,
            scope_line: u32,
            sp_flags: Builder.Metadata.Subprogram.DISPFlags,
            flags: Builder.Metadata.DIFlags,
            compile_unit: Builder.Metadata.Optional,
        };

        pub const LexicalBlock = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.LEXICAL_BLOCK) },
                .{ .literal = 0 }, // is distinct
                MetadataAbbrev, // scope
                MetadataAbbrev, // file
                LineAbbrev, // line
                ColumnAbbrev, // column
            };

            scope: Builder.Metadata.Optional,
            file: Builder.Metadata.Optional,
            line: u32,
            column: u32,
        };

        pub const Location = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.LOCATION) },
                .{ .literal = 0 }, // is distinct
                LineAbbrev, // line
                ColumnAbbrev, // column
                MetadataAbbrev, // scope
                MetadataAbbrev, // inlined at
                .{ .literal = 0 }, // is implicit code
            };

            line: u32,
            column: u32,
            scope: Builder.Metadata,
            inlined_at: Builder.Metadata.Optional,
        };

        pub const BasicType = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.BASIC_TYPE) },
                .{ .literal = 0 }, // is distinct
                .{ .literal = std.dwarf.TAG.base_type }, // tag
                MetadataAbbrev, // name
                .{ .vbr = 6 }, // size in bits
                .{ .literal = 0 }, // align in bits
                .{ .vbr = 8 }, // encoding
                .{ .literal = 0 }, // flags
            };

            name: Builder.Metadata.String.Optional,
            size_in_bits: u64,
            encoding: u32,
        };

        pub const CompositeType = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.COMPOSITE_TYPE) },
                .{ .literal = 0 | 0x2 }, // is distinct | is not used in old type ref
                .{ .fixed = 32 }, // tag
                MetadataAbbrev, // name
                MetadataAbbrev, // file
                LineAbbrev, // line
                MetadataAbbrev, // scope
                MetadataAbbrev, // underlying type
                .{ .vbr = 6 }, // size in bits
                .{ .vbr = 6 }, // align in bits
                .{ .literal = 0 }, // offset in bits
                .{ .fixed = 32 }, // flags
                MetadataAbbrev, // elements
                .{ .literal = 0 }, // runtime lang
                .{ .literal = 0 }, // vtable holder
                .{ .literal = 0 }, // template params
                .{ .literal = 0 }, // raw id
                .{ .literal = 0 }, // discriminator
                .{ .literal = 0 }, // data location
                .{ .literal = 0 }, // associated
                .{ .literal = 0 }, // allocated
                .{ .literal = 0 }, // rank
                .{ .literal = 0 }, // annotations
            };

            tag: u32,
            name: Builder.Metadata.String.Optional,
            file: Builder.Metadata.Optional,
            line: u32,
            scope: Builder.Metadata.Optional,
            underlying_type: Builder.Metadata.Optional,
            size_in_bits: u64,
            align_in_bits: u64,
            flags: Builder.Metadata.DIFlags,
            elements: Builder.Metadata.Optional,
        };

        pub const DerivedType = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.DERIVED_TYPE) },
                .{ .literal = 0 }, // is distinct
                .{ .fixed = 32 }, // tag
                MetadataAbbrev, // name
                MetadataAbbrev, // file
                LineAbbrev, // line
                MetadataAbbrev, // scope
                MetadataAbbrev, // underlying type
                .{ .vbr = 6 }, // size in bits
                .{ .vbr = 6 }, // align in bits
                .{ .vbr = 6 }, // offset in bits
                .{ .literal = 0 }, // flags
                .{ .literal = 0 }, // extra data
            };

            tag: u32,
            name: Builder.Metadata.String.Optional,
            file: Builder.Metadata.Optional,
            line: u32,
            scope: Builder.Metadata.Optional,
            underlying_type: Builder.Metadata.Optional,
            size_in_bits: u64,
            align_in_bits: u64,
            offset_in_bits: u64,
        };

        pub const SubroutineType = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.SUBROUTINE_TYPE) },
                .{ .literal = 0 | 0x2 }, // is distinct | has no old type refs
                .{ .literal = 0 }, // flags
                MetadataAbbrev, // types
                .{ .literal = 0 }, // cc
            };

            types: Builder.Metadata.Optional,
        };

        pub const Enumerator = struct {
            pub const Flags = packed struct(u3) {
                distinct: bool = false,
                unsigned: bool,
                bigint: bool = true,
            };

            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.ENUMERATOR) },
                .{ .fixed = @bitSizeOf(Flags) }, // flags
                .{ .vbr = 6 }, // bit width
                MetadataAbbrev, // name
                .{ .vbr = 16 }, // integer value
            };

            flags: Flags,
            bit_width: u32,
            name: Builder.Metadata.String.Optional,
            value: u64,
        };

        pub const Subrange = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.SUBRANGE) },
                .{ .literal = 0 | (2 << 1) }, // is distinct | version
                MetadataAbbrev, // count
                MetadataAbbrev, // lower bound
                .{ .literal = 0 }, // upper bound
                .{ .literal = 0 }, // stride
            };

            count: Builder.Metadata.Optional,
            lower_bound: Builder.Metadata.Optional,
        };

        pub const Expression = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.EXPRESSION) },
                .{ .literal = 0 | (3 << 1) }, // is distinct | version
                MetadataArrayAbbrev, // elements
            };

            elements: []const u32,
        };

        pub const Node = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.NODE) },
                MetadataArrayAbbrev, // elements
            };

            elements: []const Builder.Metadata.Optional,
        };

        pub const LocalVar = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.LOCAL_VAR) },
                .{ .literal = 0b10 }, // is distinct | has alignment
                MetadataAbbrev, // scope
                MetadataAbbrev, // name
                MetadataAbbrev, // file
                LineAbbrev, // line
                MetadataAbbrev, // type
                .{ .literal = 0 }, // arg
                .{ .literal = 0 }, // flags
                .{ .literal = 0 }, // align bits
                .{ .literal = 0 }, // annotations
            };

            scope: Builder.Metadata.Optional,
            name: Builder.Metadata.String.Optional,
            file: Builder.Metadata.Optional,
            line: u32,
            ty: Builder.Metadata.Optional,
        };

        pub const Parameter = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.LOCAL_VAR) },
                .{ .literal = 0b10 }, // is distinct | has alignment
                MetadataAbbrev, // scope
                MetadataAbbrev, // name
                MetadataAbbrev, // file
                LineAbbrev, // line
                MetadataAbbrev, // type
                .{ .vbr = 4 }, // arg
                .{ .literal = 0 }, // flags
                .{ .literal = 0 }, // align bits
                .{ .literal = 0 }, // annotations
            };

            scope: Builder.Metadata.Optional,
            name: Builder.Metadata.String.Optional,
            file: Builder.Metadata.Optional,
            line: u32,
            ty: Builder.Metadata.Optional,
            arg: u32,
        };

        pub const GlobalVar = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.GLOBAL_VAR) },
                .{ .literal = 0b101 }, // is distinct | version
                MetadataAbbrev, // scope
                MetadataAbbrev, // name
                MetadataAbbrev, // linkage name
                MetadataAbbrev, // file
                LineAbbrev, // line
                MetadataAbbrev, // type
                .{ .fixed = 1 }, // local
                .{ .literal = 1 }, // defined
                .{ .literal = 0 }, // static data members declaration
                .{ .literal = 0 }, // template params
                .{ .literal = 0 }, // align in bits
                .{ .literal = 0 }, // annotations
            };

            scope: Builder.Metadata.Optional,
            name: Builder.Metadata.String.Optional,
            linkage_name: Builder.Metadata.String.Optional,
            file: Builder.Metadata.Optional,
            line: u32,
            ty: Builder.Metadata.Optional,
            local: bool,
        };

        pub const GlobalVarExpression = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.GLOBAL_VAR_EXPR) },
                .{ .literal = 0 }, // is distinct
                MetadataAbbrev, // variable
                MetadataAbbrev, // expression
            };

            variable: Builder.Metadata.Optional,
            expression: Builder.Metadata.Optional,
        };

        pub const Constant = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.VALUE) },
                MetadataAbbrev, // type
                MetadataAbbrev, // value
            };

            ty: Builder.Type,
            constant: Builder.Constant,
        };

        pub const Name = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.NAME) },
                .{ .array_fixed = 8 }, // name
            };

            name: []const u8,
        };

        pub const NamedNode = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.NAMED_NODE) },
                MetadataArrayAbbrev, // elements
            };

            elements: []const Builder.Metadata,
        };

        pub const GlobalDeclAttachment = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.GLOBAL_DECL_ATTACHMENT) },
                ValueAbbrev, // value id
                .{ .fixed = 1 }, // kind
                MetadataAbbrev, // elements
            };

            value: Builder.Constant,
            kind: FixedMetadataKind,
            metadata: Builder.Metadata,
        };
    };

    /// TYPE blocks have codes for each type primitive they use.
    pub const TypeBlock = struct {
        pub const id: BlockId = .TYPE;

        pub const abbrevs = [_]type{
            ModuleBlock.TypeBlock.NumEntry,
            ModuleBlock.TypeBlock.Simple,
            ModuleBlock.TypeBlock.Opaque,
            ModuleBlock.TypeBlock.Integer,
            ModuleBlock.TypeBlock.StructAnon,
            ModuleBlock.TypeBlock.StructNamed,
            ModuleBlock.TypeBlock.StructName,
            ModuleBlock.TypeBlock.Array,
            ModuleBlock.TypeBlock.Vector,
            ModuleBlock.TypeBlock.Pointer,
            ModuleBlock.TypeBlock.Target,
            ModuleBlock.TypeBlock.Function,
        };

        pub const Code = enum(u5) {
            /// NUMENTRY: [numentries]
            NUMENTRY = 1,

            // Type Codes
            /// VOID
            VOID = 2,
            /// FLOAT
            FLOAT = 3,
            /// DOUBLE
            DOUBLE = 4,
            /// LABEL
            LABEL = 5,
            /// OPAQUE
            OPAQUE = 6,
            /// INTEGER: [width]
            INTEGER = 7,
            /// POINTER: [pointee type]
            POINTER = 8,

            /// FUNCTION: [vararg, attrid, retty, paramty x N]
            FUNCTION_OLD = 9,

            /// HALF
            HALF = 10,

            /// ARRAY: [numelts, eltty]
            ARRAY = 11,
            /// VECTOR: [numelts, eltty]
            VECTOR = 12,

            // These are not with the other floating point types because they're
            // a late addition, and putting them in the right place breaks
            // binary compatibility.
            /// X86 LONG DOUBLE
            X86_FP80 = 13,
            /// LONG DOUBLE (112 bit mantissa)
            FP128 = 14,
            /// PPC LONG DOUBLE (2 doubles)
            PPC_FP128 = 15,

            /// METADATA
            METADATA = 16,

            /// X86 MMX
            X86_MMX = 17,

            /// STRUCT_ANON: [ispacked, eltty x N]
            STRUCT_ANON = 18,
            /// STRUCT_NAME: [strchr x N]
            STRUCT_NAME = 19,
            /// STRUCT_NAMED: [ispacked, eltty x N]
            STRUCT_NAMED = 20,

            /// FUNCTION: [vararg, retty, paramty x N]
            FUNCTION = 21,

            /// TOKEN
            TOKEN = 22,

            /// BRAIN FLOATING POINT
            BFLOAT = 23,
            /// X86 AMX
            X86_AMX = 24,

            /// OPAQUE_POINTER: [addrspace]
            OPAQUE_POINTER = 25,

            /// TARGET_TYPE
            TARGET_TYPE = 26,
        };

        pub const NumEntry = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.NUMENTRY) },
                .{ .fixed = 32 },
            };
            num: u32,
        };

        pub const Simple = struct {
            pub const ops = [_]AbbrevOp{
                .{ .vbr = 4 },
            };
            code: ModuleBlock.TypeBlock.Code,
        };

        pub const Opaque = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.OPAQUE) },
                .{ .literal = 0 },
            };
        };

        pub const Integer = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.INTEGER) },
                .{ .fixed = 28 },
            };
            width: u28,
        };

        pub const StructAnon = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.STRUCT_ANON) },
                .{ .fixed = 1 },
                .{ .array_fixed_runtime = Builder.Type },
            };
            is_packed: bool,
            types: []const Builder.Type,
        };

        pub const StructNamed = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.STRUCT_NAMED) },
                .{ .fixed = 1 },
                .{ .array_fixed_runtime = Builder.Type },
            };
            is_packed: bool,
            types: []const Builder.Type,
        };

        pub const StructName = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.STRUCT_NAME) },
                .{ .array_fixed = 8 },
            };
            string: []const u8,
        };

        pub const Array = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.ARRAY) },
                .{ .vbr = 16 },
                .{ .fixed_runtime = Builder.Type },
            };
            len: u64,
            child: Builder.Type,
        };

        pub const Vector = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.VECTOR) },
                .{ .vbr = 16 },
                .{ .fixed_runtime = Builder.Type },
            };
            len: u64,
            child: Builder.Type,
        };

        pub const Pointer = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.OPAQUE_POINTER) },
                .{ .vbr = 4 },
            };
            addr_space: Builder.AddrSpace,
        };

        pub const Target = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.TARGET_TYPE) },
                .{ .vbr = 4 },
                .{ .array_fixed_runtime = Builder.Type },
                .{ .array_fixed = 32 },
            };
            num_types: u32,
            types: []const Builder.Type,
            ints: []const u32,
        };

        pub const Function = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.FUNCTION) },
                .{ .fixed = 1 },
                .{ .fixed_runtime = Builder.Type },
                .{ .array_fixed_runtime = Builder.Type },
            };
            is_vararg: bool,
            return_type: Builder.Type,
            param_types: []const Builder.Type,
        };
    };

    pub const OperandBundleTagsBlock = struct {
        pub const id: BlockId = .OPERAND_BUNDLE_TAGS;

        pub const abbrevs = [_]type{
            ModuleBlock.OperandBundleTagsBlock.OperandBundleTag,
        };

        pub const Code = enum(u1) {
            /// TAG: [strchr x N]
            OPERAND_BUNDLE_TAG = 1,
        };

        pub const OperandBundleTag = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.OperandBundleTagsBlock.Code.OPERAND_BUNDLE_TAG) },
                .array_char6,
            };
            tag: []const u8,
        };
    };

    pub const MetadataKindBlock = struct {
        pub const id: BlockId = .METADATA_KIND;

        pub const abbrevs = [_]type{
            ModuleBlock.MetadataKindBlock.Kind,
        };

        pub const Kind = struct {
            pub const ops = [_]AbbrevOp{
                .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.KIND) },
                .{ .vbr = 4 },
                .{ .array_fixed = 8 },
            };
            id: u32,
            name: []const u8,
        };
    };
};

/// Identification block contains a string that describes the producer details,
/// and an epoch that defines the auto-upgrade capability.
pub const IdentificationBlock = struct {
    pub const id: BlockId = .IDENTIFICATION;

    pub const abbrevs = [_]type{
        IdentificationBlock.Version,
        IdentificationBlock.Epoch,
    };

    pub const Code = enum(u2) {
        /// IDENTIFICATION:      [strchr x N]
        STRING = 1,
        /// EPOCH:               [epoch#]
        EPOCH = 2,
    };

    pub const Version = struct {
        pub const ops = [_]AbbrevOp{
            .{ .literal = @backingInt(IdentificationBlock.Code.STRING) },
            .{ .array_fixed = 8 },
        };
        string: []const u8,
    };

    pub const Epoch = struct {
        pub const ops = [_]AbbrevOp{
            .{ .literal = @backingInt(IdentificationBlock.Code.EPOCH) },
            .{ .vbr = 6 },
        };
        epoch: u32,
    };
};

pub const StrtabBlock = struct {
    pub const id: BlockId = .STRTAB;

    pub const abbrevs = [_]type{Blob};

    pub const Code = enum(u1) {
        BLOB = 1,
    };

    pub const Blob = struct {
        pub const ops = [_]AbbrevOp{
            .{ .literal = @backingInt(StrtabBlock.Code.BLOB) },
            .blob,
        };
        blob: []const u8,
    };
};