Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Namespace

TypeBlock

Public Namespace
std.zig.llvm.ir.ModuleBlock.TypeBlock
pub const TypeBlock = struct

TYPE blocks have codes for each type primitive they use.

Namespaces

Structs

Types

Values

File

zig/llvm/ir.zig:2026
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
    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,
        };
    }