| ... | @@ -21,7 +21,7 @@ air_values: std.ArrayListUnmanaged(Value) = .{}, | ... | @@ -21,7 +21,7 @@ air_values: std.ArrayListUnmanaged(Value) = .{}, |
| 21 | /// Maps ZIR to AIR. | 21 | /// Maps ZIR to AIR. |
| 22 | inst_map: InstMap = .{}, | 22 | inst_map: InstMap = .{}, |
| 23 | /// When analyzing an inline function call, owner_decl is the Decl of the caller | 23 | /// When analyzing an inline function call, owner_decl is the Decl of the caller |
| 24 | /// and `src_decl` of `Scope.Block` is the `Decl` of the callee. | 24 | /// and `src_decl` of `Block` is the `Decl` of the callee. |
| 25 | /// This `Decl` owns the arena memory of this `Sema`. | 25 | /// This `Decl` owns the arena memory of this `Sema`. |
| 26 | owner_decl: *Decl, | 26 | owner_decl: *Decl, |
| 27 | /// For an inline or comptime function call, this will be the root parent function | 27 | /// For an inline or comptime function call, this will be the root parent function |
| ... | @@ -75,7 +75,7 @@ const Air = @import("Air.zig"); | ... | @@ -75,7 +75,7 @@ const Air = @import("Air.zig"); |
| 75 | const Zir = @import("Zir.zig"); | 75 | const Zir = @import("Zir.zig"); |
| 76 | const Module = @import("Module.zig"); | 76 | const Module = @import("Module.zig"); |
| 77 | const trace = @import("tracy.zig").trace; | 77 | const trace = @import("tracy.zig").trace; |
| 78 | const Scope = Module.Scope; | 78 | const Namespace = Module.Namespace; |
| 79 | const CompileError = Module.CompileError; | 79 | const CompileError = Module.CompileError; |
| 80 | const SemaError = Module.SemaError; | 80 | const SemaError = Module.SemaError; |
| 81 | const Decl = Module.Decl; | 81 | const Decl = Module.Decl; |
| ... | @@ -89,6 +89,286 @@ const crash_report = @import("crash_report.zig"); | ... | @@ -89,6 +89,286 @@ const crash_report = @import("crash_report.zig"); |
| 89 | | 89 | |
| 90 | pub const InstMap = std.AutoHashMapUnmanaged(Zir.Inst.Index, Air.Inst.Ref); | 90 | pub const InstMap = std.AutoHashMapUnmanaged(Zir.Inst.Index, Air.Inst.Ref); |
| 91 | | 91 | |
| | 92 | /// This is the context needed to semantically analyze ZIR instructions and |
| | 93 | /// produce AIR instructions. |
| | 94 | /// This is a temporary structure stored on the stack; references to it are valid only |
| | 95 | /// during semantic analysis of the block. |
| | 96 | pub const Block = struct { |
| | 97 | parent: ?*Block, |
| | 98 | /// Shared among all child blocks. |
| | 99 | sema: *Sema, |
| | 100 | /// This Decl is the Decl according to the Zig source code corresponding to this Block. |
| | 101 | /// This can vary during inline or comptime function calls. See `Sema.owner_decl` |
| | 102 | /// for the one that will be the same for all Block instances. |
| | 103 | src_decl: *Decl, |
| | 104 | /// The namespace to use for lookups from this source block |
| | 105 | /// When analyzing fields, this is different from src_decl.src_namepsace. |
| | 106 | namespace: *Namespace, |
| | 107 | /// The AIR instructions generated for this block. |
| | 108 | instructions: std.ArrayListUnmanaged(Air.Inst.Index), |
| | 109 | // `param` instructions are collected here to be used by the `func` instruction. |
| | 110 | params: std.ArrayListUnmanaged(Param) = .{}, |
| | 111 | |
| | 112 | wip_capture_scope: *CaptureScope, |
| | 113 | |
| | 114 | label: ?*Label = null, |
| | 115 | inlining: ?*Inlining, |
| | 116 | /// If runtime_index is not 0 then one of these is guaranteed to be non null. |
| | 117 | runtime_cond: ?LazySrcLoc = null, |
| | 118 | runtime_loop: ?LazySrcLoc = null, |
| | 119 | /// Non zero if a non-inline loop or a runtime conditional have been encountered. |
| | 120 | /// Stores to to comptime variables are only allowed when var.runtime_index <= runtime_index. |
| | 121 | runtime_index: u32 = 0, |
| | 122 | |
| | 123 | is_comptime: bool, |
| | 124 | |
| | 125 | /// when null, it is determined by build mode, changed by @setRuntimeSafety |
| | 126 | want_safety: ?bool = null, |
| | 127 | |
| | 128 | c_import_buf: ?*std.ArrayList(u8) = null, |
| | 129 | |
| | 130 | const Param = struct { |
| | 131 | /// `noreturn` means `anytype`. |
| | 132 | ty: Type, |
| | 133 | is_comptime: bool, |
| | 134 | }; |
| | 135 | |
| | 136 | /// This `Block` maps a block ZIR instruction to the corresponding |
| | 137 | /// AIR instruction for break instruction analysis. |
| | 138 | pub const Label = struct { |
| | 139 | zir_block: Zir.Inst.Index, |
| | 140 | merges: Merges, |
| | 141 | }; |
| | 142 | |
| | 143 | /// This `Block` indicates that an inline function call is happening |
| | 144 | /// and return instructions should be analyzed as a break instruction |
| | 145 | /// to this AIR block instruction. |
| | 146 | /// It is shared among all the blocks in an inline or comptime called |
| | 147 | /// function. |
| | 148 | pub const Inlining = struct { |
| | 149 | comptime_result: Air.Inst.Ref, |
| | 150 | merges: Merges, |
| | 151 | }; |
| | 152 | |
| | 153 | pub const Merges = struct { |
| | 154 | block_inst: Air.Inst.Index, |
| | 155 | /// Separate array list from break_inst_list so that it can be passed directly |
| | 156 | /// to resolvePeerTypes. |
| | 157 | results: std.ArrayListUnmanaged(Air.Inst.Ref), |
| | 158 | /// Keeps track of the break instructions so that the operand can be replaced |
| | 159 | /// if we need to add type coercion at the end of block analysis. |
| | 160 | /// Same indexes, capacity, length as `results`. |
| | 161 | br_list: std.ArrayListUnmanaged(Air.Inst.Index), |
| | 162 | }; |
| | 163 | |
| | 164 | /// For debugging purposes. |
| | 165 | pub fn dump(block: *Block, mod: Module) void { |
| | 166 | Zir.dumpBlock(mod, block); |
| | 167 | } |
| | 168 | |
| | 169 | pub fn makeSubBlock(parent: *Block) Block { |
| | 170 | return .{ |
| | 171 | .parent = parent, |
| | 172 | .sema = parent.sema, |
| | 173 | .src_decl = parent.src_decl, |
| | 174 | .namespace = parent.namespace, |
| | 175 | .instructions = .{}, |
| | 176 | .wip_capture_scope = parent.wip_capture_scope, |
| | 177 | .label = null, |
| | 178 | .inlining = parent.inlining, |
| | 179 | .is_comptime = parent.is_comptime, |
| | 180 | .runtime_cond = parent.runtime_cond, |
| | 181 | .runtime_loop = parent.runtime_loop, |
| | 182 | .runtime_index = parent.runtime_index, |
| | 183 | .want_safety = parent.want_safety, |
| | 184 | .c_import_buf = parent.c_import_buf, |
| | 185 | }; |
| | 186 | } |
| | 187 | |
| | 188 | pub fn wantSafety(block: *const Block) bool { |
| | 189 | return block.want_safety orelse switch (block.sema.mod.optimizeMode()) { |
| | 190 | .Debug => true, |
| | 191 | .ReleaseSafe => true, |
| | 192 | .ReleaseFast => false, |
| | 193 | .ReleaseSmall => false, |
| | 194 | }; |
| | 195 | } |
| | 196 | |
| | 197 | pub fn getFileScope(block: *Block) *Module.File { |
| | 198 | return block.namespace.file_scope; |
| | 199 | } |
| | 200 | |
| | 201 | pub fn addTy( |
| | 202 | block: *Block, |
| | 203 | tag: Air.Inst.Tag, |
| | 204 | ty: Type, |
| | 205 | ) error{OutOfMemory}!Air.Inst.Ref { |
| | 206 | return block.addInst(.{ |
| | 207 | .tag = tag, |
| | 208 | .data = .{ .ty = ty }, |
| | 209 | }); |
| | 210 | } |
| | 211 | |
| | 212 | pub fn addTyOp( |
| | 213 | block: *Block, |
| | 214 | tag: Air.Inst.Tag, |
| | 215 | ty: Type, |
| | 216 | operand: Air.Inst.Ref, |
| | 217 | ) error{OutOfMemory}!Air.Inst.Ref { |
| | 218 | return block.addInst(.{ |
| | 219 | .tag = tag, |
| | 220 | .data = .{ .ty_op = .{ |
| | 221 | .ty = try block.sema.addType(ty), |
| | 222 | .operand = operand, |
| | 223 | } }, |
| | 224 | }); |
| | 225 | } |
| | 226 | |
| | 227 | pub fn addNoOp(block: *Block, tag: Air.Inst.Tag) error{OutOfMemory}!Air.Inst.Ref { |
| | 228 | return block.addInst(.{ |
| | 229 | .tag = tag, |
| | 230 | .data = .{ .no_op = {} }, |
| | 231 | }); |
| | 232 | } |
| | 233 | |
| | 234 | pub fn addUnOp( |
| | 235 | block: *Block, |
| | 236 | tag: Air.Inst.Tag, |
| | 237 | operand: Air.Inst.Ref, |
| | 238 | ) error{OutOfMemory}!Air.Inst.Ref { |
| | 239 | return block.addInst(.{ |
| | 240 | .tag = tag, |
| | 241 | .data = .{ .un_op = operand }, |
| | 242 | }); |
| | 243 | } |
| | 244 | |
| | 245 | pub fn addBr( |
| | 246 | block: *Block, |
| | 247 | target_block: Air.Inst.Index, |
| | 248 | operand: Air.Inst.Ref, |
| | 249 | ) error{OutOfMemory}!Air.Inst.Ref { |
| | 250 | return block.addInst(.{ |
| | 251 | .tag = .br, |
| | 252 | .data = .{ .br = .{ |
| | 253 | .block_inst = target_block, |
| | 254 | .operand = operand, |
| | 255 | } }, |
| | 256 | }); |
| | 257 | } |
| | 258 | |
| | 259 | pub fn addBinOp( |
| | 260 | block: *Block, |
| | 261 | tag: Air.Inst.Tag, |
| | 262 | lhs: Air.Inst.Ref, |
| | 263 | rhs: Air.Inst.Ref, |
| | 264 | ) error{OutOfMemory}!Air.Inst.Ref { |
| | 265 | return block.addInst(.{ |
| | 266 | .tag = tag, |
| | 267 | .data = .{ .bin_op = .{ |
| | 268 | .lhs = lhs, |
| | 269 | .rhs = rhs, |
| | 270 | } }, |
| | 271 | }); |
| | 272 | } |
| | 273 | |
| | 274 | pub fn addArg(block: *Block, ty: Type, name: u32) error{OutOfMemory}!Air.Inst.Ref { |
| | 275 | return block.addInst(.{ |
| | 276 | .tag = .arg, |
| | 277 | .data = .{ .ty_str = .{ |
| | 278 | .ty = try block.sema.addType(ty), |
| | 279 | .str = name, |
| | 280 | } }, |
| | 281 | }); |
| | 282 | } |
| | 283 | |
| | 284 | pub fn addStructFieldPtr( |
| | 285 | block: *Block, |
| | 286 | struct_ptr: Air.Inst.Ref, |
| | 287 | field_index: u32, |
| | 288 | ptr_field_ty: Type, |
| | 289 | ) !Air.Inst.Ref { |
| | 290 | const ty = try block.sema.addType(ptr_field_ty); |
| | 291 | const tag: Air.Inst.Tag = switch (field_index) { |
| | 292 | 0 => .struct_field_ptr_index_0, |
| | 293 | 1 => .struct_field_ptr_index_1, |
| | 294 | 2 => .struct_field_ptr_index_2, |
| | 295 | 3 => .struct_field_ptr_index_3, |
| | 296 | else => { |
| | 297 | return block.addInst(.{ |
| | 298 | .tag = .struct_field_ptr, |
| | 299 | .data = .{ .ty_pl = .{ |
| | 300 | .ty = ty, |
| | 301 | .payload = try block.sema.addExtra(Air.StructField{ |
| | 302 | .struct_operand = struct_ptr, |
| | 303 | .field_index = @intCast(u32, field_index), |
| | 304 | }), |
| | 305 | } }, |
| | 306 | }); |
| | 307 | }, |
| | 308 | }; |
| | 309 | return block.addInst(.{ |
| | 310 | .tag = tag, |
| | 311 | .data = .{ .ty_op = .{ |
| | 312 | .ty = ty, |
| | 313 | .operand = struct_ptr, |
| | 314 | } }, |
| | 315 | }); |
| | 316 | } |
| | 317 | |
| | 318 | pub fn addInst(block: *Block, inst: Air.Inst) error{OutOfMemory}!Air.Inst.Ref { |
| | 319 | return Air.indexToRef(try block.addInstAsIndex(inst)); |
| | 320 | } |
| | 321 | |
| | 322 | pub fn addInstAsIndex(block: *Block, inst: Air.Inst) error{OutOfMemory}!Air.Inst.Index { |
| | 323 | const sema = block.sema; |
| | 324 | const gpa = sema.gpa; |
| | 325 | |
| | 326 | try sema.air_instructions.ensureUnusedCapacity(gpa, 1); |
| | 327 | try block.instructions.ensureUnusedCapacity(gpa, 1); |
| | 328 | |
| | 329 | const result_index = @intCast(Air.Inst.Index, sema.air_instructions.len); |
| | 330 | sema.air_instructions.appendAssumeCapacity(inst); |
| | 331 | block.instructions.appendAssumeCapacity(result_index); |
| | 332 | return result_index; |
| | 333 | } |
| | 334 | |
| | 335 | pub fn startAnonDecl(block: *Block) !WipAnonDecl { |
| | 336 | return WipAnonDecl{ |
| | 337 | .block = block, |
| | 338 | .new_decl_arena = std.heap.ArenaAllocator.init(block.sema.gpa), |
| | 339 | .finished = false, |
| | 340 | }; |
| | 341 | } |
| | 342 | |
| | 343 | pub const WipAnonDecl = struct { |
| | 344 | block: *Block, |
| | 345 | new_decl_arena: std.heap.ArenaAllocator, |
| | 346 | finished: bool, |
| | 347 | |
| | 348 | pub fn arena(wad: *WipAnonDecl) *Allocator { |
| | 349 | return &wad.new_decl_arena.allocator; |
| | 350 | } |
| | 351 | |
| | 352 | pub fn deinit(wad: *WipAnonDecl) void { |
| | 353 | if (!wad.finished) { |
| | 354 | wad.new_decl_arena.deinit(); |
| | 355 | } |
| | 356 | wad.* = undefined; |
| | 357 | } |
| | 358 | |
| | 359 | pub fn finish(wad: *WipAnonDecl, ty: Type, val: Value) !*Decl { |
| | 360 | const new_decl = try wad.block.sema.mod.createAnonymousDecl(wad.block, .{ |
| | 361 | .ty = ty, |
| | 362 | .val = val, |
| | 363 | }); |
| | 364 | errdefer wad.block.sema.mod.abortAnonDecl(new_decl); |
| | 365 | try new_decl.finalizeNewArena(&wad.new_decl_arena); |
| | 366 | wad.finished = true; |
| | 367 | return new_decl; |
| | 368 | } |
| | 369 | }; |
| | 370 | }; |
| | 371 | |
| 92 | pub fn deinit(sema: *Sema) void { | 372 | pub fn deinit(sema: *Sema) void { |
| 93 | const gpa = sema.gpa; | 373 | const gpa = sema.gpa; |
| 94 | sema.air_instructions.deinit(gpa); | 374 | sema.air_instructions.deinit(gpa); |
| ... | @@ -102,7 +382,7 @@ pub fn deinit(sema: *Sema) void { | ... | @@ -102,7 +382,7 @@ pub fn deinit(sema: *Sema) void { |
| 102 | /// Returns only the result from the body that is specified. | 382 | /// Returns only the result from the body that is specified. |
| 103 | /// Only appropriate to call when it is determined at comptime that this body | 383 | /// Only appropriate to call when it is determined at comptime that this body |
| 104 | /// has no peers. | 384 | /// has no peers. |
| 105 | fn resolveBody(sema: *Sema, block: *Scope.Block, body: []const Zir.Inst.Index) CompileError!Air.Inst.Ref { | 385 | fn resolveBody(sema: *Sema, block: *Block, body: []const Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 106 | const break_inst = try sema.analyzeBody(block, body); | 386 | const break_inst = try sema.analyzeBody(block, body); |
| 107 | const operand_ref = sema.code.instructions.items(.data)[break_inst].@"break".operand; | 387 | const operand_ref = sema.code.instructions.items(.data)[break_inst].@"break".operand; |
| 108 | return sema.resolveInst(operand_ref); | 388 | return sema.resolveInst(operand_ref); |
| ... | @@ -125,7 +405,7 @@ const always_noreturn: CompileError!Zir.Inst.Index = @as(Zir.Inst.Index, undefin | ... | @@ -125,7 +405,7 @@ const always_noreturn: CompileError!Zir.Inst.Index = @as(Zir.Inst.Index, undefin |
| 125 | /// well as the operand. No block scope needs to be created for this strategy. | 405 | /// well as the operand. No block scope needs to be created for this strategy. |
| 126 | pub fn analyzeBody( | 406 | pub fn analyzeBody( |
| 127 | sema: *Sema, | 407 | sema: *Sema, |
| 128 | block: *Scope.Block, | 408 | block: *Block, |
| 129 | body: []const Zir.Inst.Index, | 409 | body: []const Zir.Inst.Index, |
| 130 | ) CompileError!Zir.Inst.Index { | 410 | ) CompileError!Zir.Inst.Index { |
| 131 | // No tracy calls here, to avoid interfering with the tail call mechanism. | 411 | // No tracy calls here, to avoid interfering with the tail call mechanism. |
| ... | @@ -142,9 +422,9 @@ pub fn analyzeBody( | ... | @@ -142,9 +422,9 @@ pub fn analyzeBody( |
| 142 | wip_captures.deinit(); | 422 | wip_captures.deinit(); |
| 143 | }; | 423 | }; |
| 144 | | 424 | |
| 145 | const map = &block.sema.inst_map; | 425 | const map = &sema.inst_map; |
| 146 | const tags = block.sema.code.instructions.items(.tag); | 426 | const tags = sema.code.instructions.items(.tag); |
| 147 | const datas = block.sema.code.instructions.items(.data); | 427 | const datas = sema.code.instructions.items(.data); |
| 148 | | 428 | |
| 149 | var orig_captures: usize = parent_capture_scope.captures.count(); | 429 | var orig_captures: usize = parent_capture_scope.captures.count(); |
| 150 | | 430 | |
| ... | @@ -667,7 +947,7 @@ pub fn analyzeBody( | ... | @@ -667,7 +947,7 @@ pub fn analyzeBody( |
| 667 | return result; | 947 | return result; |
| 668 | } | 948 | } |
| 669 | | 949 | |
| 670 | fn zirExtended(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 950 | fn zirExtended(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 671 | const extended = sema.code.instructions.items(.data)[inst].extended; | 951 | const extended = sema.code.instructions.items(.data)[inst].extended; |
| 672 | switch (extended.opcode) { | 952 | switch (extended.opcode) { |
| 673 | // zig fmt: off | 953 | // zig fmt: off |
| ... | @@ -719,7 +999,7 @@ pub fn resolveInst(sema: *Sema, zir_ref: Zir.Inst.Ref) Air.Inst.Ref { | ... | @@ -719,7 +999,7 @@ pub fn resolveInst(sema: *Sema, zir_ref: Zir.Inst.Ref) Air.Inst.Ref { |
| 719 | | 999 | |
| 720 | fn resolveConstBool( | 1000 | fn resolveConstBool( |
| 721 | sema: *Sema, | 1001 | sema: *Sema, |
| 722 | block: *Scope.Block, | 1002 | block: *Block, |
| 723 | src: LazySrcLoc, | 1003 | src: LazySrcLoc, |
| 724 | zir_ref: Zir.Inst.Ref, | 1004 | zir_ref: Zir.Inst.Ref, |
| 725 | ) !bool { | 1005 | ) !bool { |
| ... | @@ -732,7 +1012,7 @@ fn resolveConstBool( | ... | @@ -732,7 +1012,7 @@ fn resolveConstBool( |
| 732 | | 1012 | |
| 733 | fn resolveConstString( | 1013 | fn resolveConstString( |
| 734 | sema: *Sema, | 1014 | sema: *Sema, |
| 735 | block: *Scope.Block, | 1015 | block: *Block, |
| 736 | src: LazySrcLoc, | 1016 | src: LazySrcLoc, |
| 737 | zir_ref: Zir.Inst.Ref, | 1017 | zir_ref: Zir.Inst.Ref, |
| 738 | ) ![]u8 { | 1018 | ) ![]u8 { |
| ... | @@ -743,14 +1023,14 @@ fn resolveConstString( | ... | @@ -743,14 +1023,14 @@ fn resolveConstString( |
| 743 | return val.toAllocatedBytes(sema.arena); | 1023 | return val.toAllocatedBytes(sema.arena); |
| 744 | } | 1024 | } |
| 745 | | 1025 | |
| 746 | pub fn resolveType(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, zir_ref: Zir.Inst.Ref) !Type { | 1026 | pub fn resolveType(sema: *Sema, block: *Block, src: LazySrcLoc, zir_ref: Zir.Inst.Ref) !Type { |
| 747 | const air_inst = sema.resolveInst(zir_ref); | 1027 | const air_inst = sema.resolveInst(zir_ref); |
| 748 | return sema.analyzeAsType(block, src, air_inst); | 1028 | return sema.analyzeAsType(block, src, air_inst); |
| 749 | } | 1029 | } |
| 750 | | 1030 | |
| 751 | fn analyzeAsType( | 1031 | fn analyzeAsType( |
| 752 | sema: *Sema, | 1032 | sema: *Sema, |
| 753 | block: *Scope.Block, | 1033 | block: *Block, |
| 754 | src: LazySrcLoc, | 1034 | src: LazySrcLoc, |
| 755 | air_inst: Air.Inst.Ref, | 1035 | air_inst: Air.Inst.Ref, |
| 756 | ) !Type { | 1036 | ) !Type { |
| ... | @@ -767,7 +1047,7 @@ fn analyzeAsType( | ... | @@ -767,7 +1047,7 @@ fn analyzeAsType( |
| 767 | /// Value Tag `generic_poison` causes `error.GenericPoison` to be returned. | 1047 | /// Value Tag `generic_poison` causes `error.GenericPoison` to be returned. |
| 768 | fn resolveValue( | 1048 | fn resolveValue( |
| 769 | sema: *Sema, | 1049 | sema: *Sema, |
| 770 | block: *Scope.Block, | 1050 | block: *Block, |
| 771 | src: LazySrcLoc, | 1051 | src: LazySrcLoc, |
| 772 | air_ref: Air.Inst.Ref, | 1052 | air_ref: Air.Inst.Ref, |
| 773 | ) CompileError!Value { | 1053 | ) CompileError!Value { |
| ... | @@ -782,7 +1062,7 @@ fn resolveValue( | ... | @@ -782,7 +1062,7 @@ fn resolveValue( |
| 782 | /// Value Tag `undef` may be returned. | 1062 | /// Value Tag `undef` may be returned. |
| 783 | fn resolveConstMaybeUndefVal( | 1063 | fn resolveConstMaybeUndefVal( |
| 784 | sema: *Sema, | 1064 | sema: *Sema, |
| 785 | block: *Scope.Block, | 1065 | block: *Block, |
| 786 | src: LazySrcLoc, | 1066 | src: LazySrcLoc, |
| 787 | inst: Air.Inst.Ref, | 1067 | inst: Air.Inst.Ref, |
| 788 | ) CompileError!Value { | 1068 | ) CompileError!Value { |
| ... | @@ -800,7 +1080,7 @@ fn resolveConstMaybeUndefVal( | ... | @@ -800,7 +1080,7 @@ fn resolveConstMaybeUndefVal( |
| 800 | /// See `resolveValue` for an alternative. | 1080 | /// See `resolveValue` for an alternative. |
| 801 | fn resolveConstValue( | 1081 | fn resolveConstValue( |
| 802 | sema: *Sema, | 1082 | sema: *Sema, |
| 803 | block: *Scope.Block, | 1083 | block: *Block, |
| 804 | src: LazySrcLoc, | 1084 | src: LazySrcLoc, |
| 805 | air_ref: Air.Inst.Ref, | 1085 | air_ref: Air.Inst.Ref, |
| 806 | ) CompileError!Value { | 1086 | ) CompileError!Value { |
| ... | @@ -819,7 +1099,7 @@ fn resolveConstValue( | ... | @@ -819,7 +1099,7 @@ fn resolveConstValue( |
| 819 | /// Value Tag `undef` causes this function to return a compile error. | 1099 | /// Value Tag `undef` causes this function to return a compile error. |
| 820 | fn resolveDefinedValue( | 1100 | fn resolveDefinedValue( |
| 821 | sema: *Sema, | 1101 | sema: *Sema, |
| 822 | block: *Scope.Block, | 1102 | block: *Block, |
| 823 | src: LazySrcLoc, | 1103 | src: LazySrcLoc, |
| 824 | air_ref: Air.Inst.Ref, | 1104 | air_ref: Air.Inst.Ref, |
| 825 | ) CompileError!?Value { | 1105 | ) CompileError!?Value { |
| ... | @@ -837,7 +1117,7 @@ fn resolveDefinedValue( | ... | @@ -837,7 +1117,7 @@ fn resolveDefinedValue( |
| 837 | /// Value Tag `generic_poison` causes `error.GenericPoison` to be returned. | 1117 | /// Value Tag `generic_poison` causes `error.GenericPoison` to be returned. |
| 838 | fn resolveMaybeUndefVal( | 1118 | fn resolveMaybeUndefVal( |
| 839 | sema: *Sema, | 1119 | sema: *Sema, |
| 840 | block: *Scope.Block, | 1120 | block: *Block, |
| 841 | src: LazySrcLoc, | 1121 | src: LazySrcLoc, |
| 842 | inst: Air.Inst.Ref, | 1122 | inst: Air.Inst.Ref, |
| 843 | ) CompileError!?Value { | 1123 | ) CompileError!?Value { |
| ... | @@ -852,7 +1132,7 @@ fn resolveMaybeUndefVal( | ... | @@ -852,7 +1132,7 @@ fn resolveMaybeUndefVal( |
| 852 | /// Returns all Value tags including `variable` and `undef`. | 1132 | /// Returns all Value tags including `variable` and `undef`. |
| 853 | fn resolveMaybeUndefValAllowVariables( | 1133 | fn resolveMaybeUndefValAllowVariables( |
| 854 | sema: *Sema, | 1134 | sema: *Sema, |
| 855 | block: *Scope.Block, | 1135 | block: *Block, |
| 856 | src: LazySrcLoc, | 1136 | src: LazySrcLoc, |
| 857 | inst: Air.Inst.Ref, | 1137 | inst: Air.Inst.Ref, |
| 858 | ) CompileError!?Value { | 1138 | ) CompileError!?Value { |
| ... | @@ -879,19 +1159,19 @@ fn resolveMaybeUndefValAllowVariables( | ... | @@ -879,19 +1159,19 @@ fn resolveMaybeUndefValAllowVariables( |
| 879 | } | 1159 | } |
| 880 | } | 1160 | } |
| 881 | | 1161 | |
| 882 | fn failWithNeededComptime(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) CompileError { | 1162 | fn failWithNeededComptime(sema: *Sema, block: *Block, src: LazySrcLoc) CompileError { |
| 883 | return sema.fail(block, src, "unable to resolve comptime value", .{}); | 1163 | return sema.fail(block, src, "unable to resolve comptime value", .{}); |
| 884 | } | 1164 | } |
| 885 | | 1165 | |
| 886 | fn failWithUseOfUndef(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) CompileError { | 1166 | fn failWithUseOfUndef(sema: *Sema, block: *Block, src: LazySrcLoc) CompileError { |
| 887 | return sema.fail(block, src, "use of undefined value here causes undefined behavior", .{}); | 1167 | return sema.fail(block, src, "use of undefined value here causes undefined behavior", .{}); |
| 888 | } | 1168 | } |
| 889 | | 1169 | |
| 890 | fn failWithDivideByZero(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) CompileError { | 1170 | fn failWithDivideByZero(sema: *Sema, block: *Block, src: LazySrcLoc) CompileError { |
| 891 | return sema.fail(block, src, "division by zero here causes undefined behavior", .{}); | 1171 | return sema.fail(block, src, "division by zero here causes undefined behavior", .{}); |
| 892 | } | 1172 | } |
| 893 | | 1173 | |
| 894 | fn failWithModRemNegative(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, lhs_ty: Type, rhs_ty: Type) CompileError { | 1174 | fn failWithModRemNegative(sema: *Sema, block: *Block, src: LazySrcLoc, lhs_ty: Type, rhs_ty: Type) CompileError { |
| 895 | return sema.fail(block, src, "remainder division with '{}' and '{}': signed integers and floats must use @rem or @mod", .{ lhs_ty, rhs_ty }); | 1175 | return sema.fail(block, src, "remainder division with '{}' and '{}': signed integers and floats must use @rem or @mod", .{ lhs_ty, rhs_ty }); |
| 896 | } | 1176 | } |
| 897 | | 1177 | |
| ... | @@ -899,28 +1179,28 @@ fn failWithModRemNegative(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, lhs | ... | @@ -899,28 +1179,28 @@ fn failWithModRemNegative(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, lhs |
| 899 | /// becomes invalid when you add another one. | 1179 | /// becomes invalid when you add another one. |
| 900 | fn errNote( | 1180 | fn errNote( |
| 901 | sema: *Sema, | 1181 | sema: *Sema, |
| 902 | block: *Scope.Block, | 1182 | block: *Block, |
| 903 | src: LazySrcLoc, | 1183 | src: LazySrcLoc, |
| 904 | parent: *Module.ErrorMsg, | 1184 | parent: *Module.ErrorMsg, |
| 905 | comptime format: []const u8, | 1185 | comptime format: []const u8, |
| 906 | args: anytype, | 1186 | args: anytype, |
| 907 | ) error{OutOfMemory}!void { | 1187 | ) error{OutOfMemory}!void { |
| 908 | return sema.mod.errNoteNonLazy(src.toSrcLoc(block), parent, format, args); | 1188 | return sema.mod.errNoteNonLazy(src.toSrcLoc(block.src_decl), parent, format, args); |
| 909 | } | 1189 | } |
| 910 | | 1190 | |
| 911 | fn errMsg( | 1191 | fn errMsg( |
| 912 | sema: *Sema, | 1192 | sema: *Sema, |
| 913 | block: *Scope.Block, | 1193 | block: *Block, |
| 914 | src: LazySrcLoc, | 1194 | src: LazySrcLoc, |
| 915 | comptime format: []const u8, | 1195 | comptime format: []const u8, |
| 916 | args: anytype, | 1196 | args: anytype, |
| 917 | ) error{OutOfMemory}!*Module.ErrorMsg { | 1197 | ) error{OutOfMemory}!*Module.ErrorMsg { |
| 918 | return Module.ErrorMsg.create(sema.gpa, src.toSrcLoc(block), format, args); | 1198 | return Module.ErrorMsg.create(sema.gpa, src.toSrcLoc(block.src_decl), format, args); |
| 919 | } | 1199 | } |
| 920 | | 1200 | |
| 921 | pub fn fail( | 1201 | pub fn fail( |
| 922 | sema: *Sema, | 1202 | sema: *Sema, |
| 923 | block: *Scope.Block, | 1203 | block: *Block, |
| 924 | src: LazySrcLoc, | 1204 | src: LazySrcLoc, |
| 925 | comptime format: []const u8, | 1205 | comptime format: []const u8, |
| 926 | args: anytype, | 1206 | args: anytype, |
| ... | @@ -958,7 +1238,7 @@ fn failWithOwnedErrorMsg(sema: *Sema, err_msg: *Module.ErrorMsg) CompileError { | ... | @@ -958,7 +1238,7 @@ fn failWithOwnedErrorMsg(sema: *Sema, err_msg: *Module.ErrorMsg) CompileError { |
| 958 | /// TODO don't ever call this since we're migrating towards ResultLoc.coerced_ty. | 1238 | /// TODO don't ever call this since we're migrating towards ResultLoc.coerced_ty. |
| 959 | fn resolveAlreadyCoercedInt( | 1239 | fn resolveAlreadyCoercedInt( |
| 960 | sema: *Sema, | 1240 | sema: *Sema, |
| 961 | block: *Scope.Block, | 1241 | block: *Block, |
| 962 | src: LazySrcLoc, | 1242 | src: LazySrcLoc, |
| 963 | zir_ref: Zir.Inst.Ref, | 1243 | zir_ref: Zir.Inst.Ref, |
| 964 | comptime Int: type, | 1244 | comptime Int: type, |
| ... | @@ -974,7 +1254,7 @@ fn resolveAlreadyCoercedInt( | ... | @@ -974,7 +1254,7 @@ fn resolveAlreadyCoercedInt( |
| 974 | | 1254 | |
| 975 | fn resolveAlign( | 1255 | fn resolveAlign( |
| 976 | sema: *Sema, | 1256 | sema: *Sema, |
| 977 | block: *Scope.Block, | 1257 | block: *Block, |
| 978 | src: LazySrcLoc, | 1258 | src: LazySrcLoc, |
| 979 | zir_ref: Zir.Inst.Ref, | 1259 | zir_ref: Zir.Inst.Ref, |
| 980 | ) !u16 { | 1260 | ) !u16 { |
| ... | @@ -991,7 +1271,7 @@ fn resolveAlign( | ... | @@ -991,7 +1271,7 @@ fn resolveAlign( |
| 991 | | 1271 | |
| 992 | fn resolveInt( | 1272 | fn resolveInt( |
| 993 | sema: *Sema, | 1273 | sema: *Sema, |
| 994 | block: *Scope.Block, | 1274 | block: *Block, |
| 995 | src: LazySrcLoc, | 1275 | src: LazySrcLoc, |
| 996 | zir_ref: Zir.Inst.Ref, | 1276 | zir_ref: Zir.Inst.Ref, |
| 997 | dest_type: Type, | 1277 | dest_type: Type, |
| ... | @@ -1007,7 +1287,7 @@ fn resolveInt( | ... | @@ -1007,7 +1287,7 @@ fn resolveInt( |
| 1007 | // a function that does not. | 1287 | // a function that does not. |
| 1008 | pub fn resolveInstConst( | 1288 | pub fn resolveInstConst( |
| 1009 | sema: *Sema, | 1289 | sema: *Sema, |
| 1010 | block: *Scope.Block, | 1290 | block: *Block, |
| 1011 | src: LazySrcLoc, | 1291 | src: LazySrcLoc, |
| 1012 | zir_ref: Zir.Inst.Ref, | 1292 | zir_ref: Zir.Inst.Ref, |
| 1013 | ) CompileError!TypedValue { | 1293 | ) CompileError!TypedValue { |
| ... | @@ -1023,7 +1303,7 @@ pub fn resolveInstConst( | ... | @@ -1023,7 +1303,7 @@ pub fn resolveInstConst( |
| 1023 | // See `resolveInstConst` for an alternative. | 1303 | // See `resolveInstConst` for an alternative. |
| 1024 | pub fn resolveInstValue( | 1304 | pub fn resolveInstValue( |
| 1025 | sema: *Sema, | 1305 | sema: *Sema, |
| 1026 | block: *Scope.Block, | 1306 | block: *Block, |
| 1027 | src: LazySrcLoc, | 1307 | src: LazySrcLoc, |
| 1028 | zir_ref: Zir.Inst.Ref, | 1308 | zir_ref: Zir.Inst.Ref, |
| 1029 | ) CompileError!TypedValue { | 1309 | ) CompileError!TypedValue { |
| ... | @@ -1035,13 +1315,13 @@ pub fn resolveInstValue( | ... | @@ -1035,13 +1315,13 @@ pub fn resolveInstValue( |
| 1035 | }; | 1315 | }; |
| 1036 | } | 1316 | } |
| 1037 | | 1317 | |
| 1038 | fn zirBitcastResultPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 1318 | fn zirBitcastResultPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1039 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 1319 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 1040 | const src = inst_data.src(); | 1320 | const src = inst_data.src(); |
| 1041 | return sema.fail(block, src, "TODO implement zir_sema.zirBitcastResultPtr", .{}); | 1321 | return sema.fail(block, src, "TODO implement zir_sema.zirBitcastResultPtr", .{}); |
| 1042 | } | 1322 | } |
| 1043 | | 1323 | |
| 1044 | fn zirCoerceResultPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 1324 | fn zirCoerceResultPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1045 | const tracy = trace(@src()); | 1325 | const tracy = trace(@src()); |
| 1046 | defer tracy.end(); | 1326 | defer tracy.end(); |
| 1047 | | 1327 | |
| ... | @@ -1103,7 +1383,7 @@ pub fn analyzeStructDecl( | ... | @@ -1103,7 +1383,7 @@ pub fn analyzeStructDecl( |
| 1103 | | 1383 | |
| 1104 | fn zirStructDecl( | 1384 | fn zirStructDecl( |
| 1105 | sema: *Sema, | 1385 | sema: *Sema, |
| 1106 | block: *Scope.Block, | 1386 | block: *Block, |
| 1107 | extended: Zir.Inst.Extended.InstData, | 1387 | extended: Zir.Inst.Extended.InstData, |
| 1108 | inst: Zir.Inst.Index, | 1388 | inst: Zir.Inst.Index, |
| 1109 | ) CompileError!Air.Inst.Ref { | 1389 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -1120,7 +1400,7 @@ fn zirStructDecl( | ... | @@ -1120,7 +1400,7 @@ fn zirStructDecl( |
| 1120 | const struct_ty = try Type.Tag.@"struct".create(&new_decl_arena.allocator, struct_obj); | 1400 | const struct_ty = try Type.Tag.@"struct".create(&new_decl_arena.allocator, struct_obj); |
| 1121 | const struct_val = try Value.Tag.ty.create(&new_decl_arena.allocator, struct_ty); | 1401 | const struct_val = try Value.Tag.ty.create(&new_decl_arena.allocator, struct_ty); |
| 1122 | const type_name = try sema.createTypeName(block, small.name_strategy); | 1402 | const type_name = try sema.createTypeName(block, small.name_strategy); |
| 1123 | const new_decl = try sema.mod.createAnonymousDeclNamed(&block.base, .{ | 1403 | const new_decl = try sema.mod.createAnonymousDeclNamed(block, .{ |
| 1124 | .ty = Type.initTag(.type), | 1404 | .ty = Type.initTag(.type), |
| 1125 | .val = struct_val, | 1405 | .val = struct_val, |
| 1126 | }, type_name); | 1406 | }, type_name); |
| ... | @@ -1148,7 +1428,7 @@ fn zirStructDecl( | ... | @@ -1148,7 +1428,7 @@ fn zirStructDecl( |
| 1148 | return sema.analyzeDeclVal(block, src, new_decl); | 1428 | return sema.analyzeDeclVal(block, src, new_decl); |
| 1149 | } | 1429 | } |
| 1150 | | 1430 | |
| 1151 | fn createTypeName(sema: *Sema, block: *Scope.Block, name_strategy: Zir.Inst.NameStrategy) ![:0]u8 { | 1431 | fn createTypeName(sema: *Sema, block: *Block, name_strategy: Zir.Inst.NameStrategy) ![:0]u8 { |
| 1152 | switch (name_strategy) { | 1432 | switch (name_strategy) { |
| 1153 | .anon => { | 1433 | .anon => { |
| 1154 | // It would be neat to have "struct:line:column" but this name has | 1434 | // It would be neat to have "struct:line:column" but this name has |
| ... | @@ -1176,7 +1456,7 @@ fn createTypeName(sema: *Sema, block: *Scope.Block, name_strategy: Zir.Inst.Name | ... | @@ -1176,7 +1456,7 @@ fn createTypeName(sema: *Sema, block: *Scope.Block, name_strategy: Zir.Inst.Name |
| 1176 | | 1456 | |
| 1177 | fn zirEnumDecl( | 1457 | fn zirEnumDecl( |
| 1178 | sema: *Sema, | 1458 | sema: *Sema, |
| 1179 | block: *Scope.Block, | 1459 | block: *Block, |
| 1180 | extended: Zir.Inst.Extended.InstData, | 1460 | extended: Zir.Inst.Extended.InstData, |
| 1181 | ) CompileError!Air.Inst.Ref { | 1461 | ) CompileError!Air.Inst.Ref { |
| 1182 | const tracy = trace(@src()); | 1462 | const tracy = trace(@src()); |
| ... | @@ -1229,7 +1509,7 @@ fn zirEnumDecl( | ... | @@ -1229,7 +1509,7 @@ fn zirEnumDecl( |
| 1229 | const enum_ty = Type.initPayload(&enum_ty_payload.base); | 1509 | const enum_ty = Type.initPayload(&enum_ty_payload.base); |
| 1230 | const enum_val = try Value.Tag.ty.create(&new_decl_arena.allocator, enum_ty); | 1510 | const enum_val = try Value.Tag.ty.create(&new_decl_arena.allocator, enum_ty); |
| 1231 | const type_name = try sema.createTypeName(block, small.name_strategy); | 1511 | const type_name = try sema.createTypeName(block, small.name_strategy); |
| 1232 | const new_decl = try mod.createAnonymousDeclNamed(&block.base, .{ | 1512 | const new_decl = try mod.createAnonymousDeclNamed(block, .{ |
| 1233 | .ty = Type.initTag(.type), | 1513 | .ty = Type.initTag(.type), |
| 1234 | .val = enum_val, | 1514 | .val = enum_val, |
| 1235 | }, type_name); | 1515 | }, type_name); |
| ... | @@ -1287,7 +1567,7 @@ fn zirEnumDecl( | ... | @@ -1287,7 +1567,7 @@ fn zirEnumDecl( |
| 1287 | var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, new_decl.src_scope); | 1567 | var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, new_decl.src_scope); |
| 1288 | defer wip_captures.deinit(); | 1568 | defer wip_captures.deinit(); |
| 1289 | | 1569 | |
| 1290 | var enum_block: Scope.Block = .{ | 1570 | var enum_block: Block = .{ |
| 1291 | .parent = null, | 1571 | .parent = null, |
| 1292 | .sema = sema, | 1572 | .sema = sema, |
| 1293 | .src_decl = new_decl, | 1573 | .src_decl = new_decl, |
| ... | @@ -1377,7 +1657,7 @@ fn zirEnumDecl( | ... | @@ -1377,7 +1657,7 @@ fn zirEnumDecl( |
| 1377 | | 1657 | |
| 1378 | fn zirUnionDecl( | 1658 | fn zirUnionDecl( |
| 1379 | sema: *Sema, | 1659 | sema: *Sema, |
| 1380 | block: *Scope.Block, | 1660 | block: *Block, |
| 1381 | extended: Zir.Inst.Extended.InstData, | 1661 | extended: Zir.Inst.Extended.InstData, |
| 1382 | inst: Zir.Inst.Index, | 1662 | inst: Zir.Inst.Index, |
| 1383 | ) CompileError!Air.Inst.Ref { | 1663 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -1416,7 +1696,7 @@ fn zirUnionDecl( | ... | @@ -1416,7 +1696,7 @@ fn zirUnionDecl( |
| 1416 | const union_ty = Type.initPayload(&union_payload.base); | 1696 | const union_ty = Type.initPayload(&union_payload.base); |
| 1417 | const union_val = try Value.Tag.ty.create(&new_decl_arena.allocator, union_ty); | 1697 | const union_val = try Value.Tag.ty.create(&new_decl_arena.allocator, union_ty); |
| 1418 | const type_name = try sema.createTypeName(block, small.name_strategy); | 1698 | const type_name = try sema.createTypeName(block, small.name_strategy); |
| 1419 | const new_decl = try sema.mod.createAnonymousDeclNamed(&block.base, .{ | 1699 | const new_decl = try sema.mod.createAnonymousDeclNamed(block, .{ |
| 1420 | .ty = Type.initTag(.type), | 1700 | .ty = Type.initTag(.type), |
| 1421 | .val = union_val, | 1701 | .val = union_val, |
| 1422 | }, type_name); | 1702 | }, type_name); |
| ... | @@ -1448,7 +1728,7 @@ fn zirUnionDecl( | ... | @@ -1448,7 +1728,7 @@ fn zirUnionDecl( |
| 1448 | | 1728 | |
| 1449 | fn zirOpaqueDecl( | 1729 | fn zirOpaqueDecl( |
| 1450 | sema: *Sema, | 1730 | sema: *Sema, |
| 1451 | block: *Scope.Block, | 1731 | block: *Block, |
| 1452 | extended: Zir.Inst.Extended.InstData, | 1732 | extended: Zir.Inst.Extended.InstData, |
| 1453 | inst: Zir.Inst.Index, | 1733 | inst: Zir.Inst.Index, |
| 1454 | ) CompileError!Air.Inst.Ref { | 1734 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -1462,7 +1742,7 @@ fn zirOpaqueDecl( | ... | @@ -1462,7 +1742,7 @@ fn zirOpaqueDecl( |
| 1462 | | 1742 | |
| 1463 | fn zirErrorSetDecl( | 1743 | fn zirErrorSetDecl( |
| 1464 | sema: *Sema, | 1744 | sema: *Sema, |
| 1465 | block: *Scope.Block, | 1745 | block: *Block, |
| 1466 | inst: Zir.Inst.Index, | 1746 | inst: Zir.Inst.Index, |
| 1467 | name_strategy: Zir.Inst.NameStrategy, | 1747 | name_strategy: Zir.Inst.NameStrategy, |
| 1468 | ) CompileError!Air.Inst.Ref { | 1748 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -1482,7 +1762,7 @@ fn zirErrorSetDecl( | ... | @@ -1482,7 +1762,7 @@ fn zirErrorSetDecl( |
| 1482 | const error_set_ty = try Type.Tag.error_set.create(&new_decl_arena.allocator, error_set); | 1762 | const error_set_ty = try Type.Tag.error_set.create(&new_decl_arena.allocator, error_set); |
| 1483 | const error_set_val = try Value.Tag.ty.create(&new_decl_arena.allocator, error_set_ty); | 1763 | const error_set_val = try Value.Tag.ty.create(&new_decl_arena.allocator, error_set_ty); |
| 1484 | const type_name = try sema.createTypeName(block, name_strategy); | 1764 | const type_name = try sema.createTypeName(block, name_strategy); |
| 1485 | const new_decl = try sema.mod.createAnonymousDeclNamed(&block.base, .{ | 1765 | const new_decl = try sema.mod.createAnonymousDeclNamed(block, .{ |
| 1486 | .ty = Type.initTag(.type), | 1766 | .ty = Type.initTag(.type), |
| 1487 | .val = error_set_val, | 1767 | .val = error_set_val, |
| 1488 | }, type_name); | 1768 | }, type_name); |
| ... | @@ -1504,7 +1784,7 @@ fn zirErrorSetDecl( | ... | @@ -1504,7 +1784,7 @@ fn zirErrorSetDecl( |
| 1504 | | 1784 | |
| 1505 | fn zirRetPtr( | 1785 | fn zirRetPtr( |
| 1506 | sema: *Sema, | 1786 | sema: *Sema, |
| 1507 | block: *Scope.Block, | 1787 | block: *Block, |
| 1508 | extended: Zir.Inst.Extended.InstData, | 1788 | extended: Zir.Inst.Extended.InstData, |
| 1509 | ) CompileError!Air.Inst.Ref { | 1789 | ) CompileError!Air.Inst.Ref { |
| 1510 | const tracy = trace(@src()); | 1790 | const tracy = trace(@src()); |
| ... | @@ -1524,7 +1804,7 @@ fn zirRetPtr( | ... | @@ -1524,7 +1804,7 @@ fn zirRetPtr( |
| 1524 | return block.addTy(.alloc, ptr_type); | 1804 | return block.addTy(.alloc, ptr_type); |
| 1525 | } | 1805 | } |
| 1526 | | 1806 | |
| 1527 | fn zirRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 1807 | fn zirRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1528 | const tracy = trace(@src()); | 1808 | const tracy = trace(@src()); |
| 1529 | defer tracy.end(); | 1809 | defer tracy.end(); |
| 1530 | | 1810 | |
| ... | @@ -1535,7 +1815,7 @@ fn zirRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -1535,7 +1815,7 @@ fn zirRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A |
| 1535 | | 1815 | |
| 1536 | fn zirRetType( | 1816 | fn zirRetType( |
| 1537 | sema: *Sema, | 1817 | sema: *Sema, |
| 1538 | block: *Scope.Block, | 1818 | block: *Block, |
| 1539 | extended: Zir.Inst.Extended.InstData, | 1819 | extended: Zir.Inst.Extended.InstData, |
| 1540 | ) CompileError!Air.Inst.Ref { | 1820 | ) CompileError!Air.Inst.Ref { |
| 1541 | const tracy = trace(@src()); | 1821 | const tracy = trace(@src()); |
| ... | @@ -1546,7 +1826,7 @@ fn zirRetType( | ... | @@ -1546,7 +1826,7 @@ fn zirRetType( |
| 1546 | return sema.addType(sema.fn_ret_ty); | 1826 | return sema.addType(sema.fn_ret_ty); |
| 1547 | } | 1827 | } |
| 1548 | | 1828 | |
| 1549 | fn zirEnsureResultUsed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 1829 | fn zirEnsureResultUsed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 1550 | const tracy = trace(@src()); | 1830 | const tracy = trace(@src()); |
| 1551 | defer tracy.end(); | 1831 | defer tracy.end(); |
| 1552 | | 1832 | |
| ... | @@ -1559,7 +1839,7 @@ fn zirEnsureResultUsed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) C | ... | @@ -1559,7 +1839,7 @@ fn zirEnsureResultUsed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) C |
| 1559 | | 1839 | |
| 1560 | fn ensureResultUsed( | 1840 | fn ensureResultUsed( |
| 1561 | sema: *Sema, | 1841 | sema: *Sema, |
| 1562 | block: *Scope.Block, | 1842 | block: *Block, |
| 1563 | operand: Air.Inst.Ref, | 1843 | operand: Air.Inst.Ref, |
| 1564 | src: LazySrcLoc, | 1844 | src: LazySrcLoc, |
| 1565 | ) CompileError!void { | 1845 | ) CompileError!void { |
| ... | @@ -1570,7 +1850,7 @@ fn ensureResultUsed( | ... | @@ -1570,7 +1850,7 @@ fn ensureResultUsed( |
| 1570 | } | 1850 | } |
| 1571 | } | 1851 | } |
| 1572 | | 1852 | |
| 1573 | fn zirEnsureResultNonError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 1853 | fn zirEnsureResultNonError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 1574 | const tracy = trace(@src()); | 1854 | const tracy = trace(@src()); |
| 1575 | defer tracy.end(); | 1855 | defer tracy.end(); |
| 1576 | | 1856 | |
| ... | @@ -1584,7 +1864,7 @@ fn zirEnsureResultNonError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde | ... | @@ -1584,7 +1864,7 @@ fn zirEnsureResultNonError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde |
| 1584 | } | 1864 | } |
| 1585 | } | 1865 | } |
| 1586 | | 1866 | |
| 1587 | fn zirIndexablePtrLen(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 1867 | fn zirIndexablePtrLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1588 | const tracy = trace(@src()); | 1868 | const tracy = trace(@src()); |
| 1589 | defer tracy.end(); | 1869 | defer tracy.end(); |
| 1590 | | 1870 | |
| ... | @@ -1632,7 +1912,7 @@ fn zirIndexablePtrLen(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Co | ... | @@ -1632,7 +1912,7 @@ fn zirIndexablePtrLen(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Co |
| 1632 | | 1912 | |
| 1633 | fn zirAllocExtended( | 1913 | fn zirAllocExtended( |
| 1634 | sema: *Sema, | 1914 | sema: *Sema, |
| 1635 | block: *Scope.Block, | 1915 | block: *Block, |
| 1636 | extended: Zir.Inst.Extended.InstData, | 1916 | extended: Zir.Inst.Extended.InstData, |
| 1637 | ) CompileError!Air.Inst.Ref { | 1917 | ) CompileError!Air.Inst.Ref { |
| 1638 | const extra = sema.code.extraData(Zir.Inst.AllocExtended, extended.operand); | 1918 | const extra = sema.code.extraData(Zir.Inst.AllocExtended, extended.operand); |
| ... | @@ -1675,7 +1955,7 @@ fn zirAllocExtended( | ... | @@ -1675,7 +1955,7 @@ fn zirAllocExtended( |
| 1675 | return block.addTy(.alloc, ptr_type); | 1955 | return block.addTy(.alloc, ptr_type); |
| 1676 | } | 1956 | } |
| 1677 | | 1957 | |
| 1678 | fn zirAllocComptime(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 1958 | fn zirAllocComptime(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1679 | const tracy = trace(@src()); | 1959 | const tracy = trace(@src()); |
| 1680 | defer tracy.end(); | 1960 | defer tracy.end(); |
| 1681 | | 1961 | |
| ... | @@ -1695,7 +1975,7 @@ fn zirAllocInferredComptime(sema: *Sema, inst: Zir.Inst.Index) CompileError!Air. | ... | @@ -1695,7 +1975,7 @@ fn zirAllocInferredComptime(sema: *Sema, inst: Zir.Inst.Index) CompileError!Air. |
| 1695 | ); | 1975 | ); |
| 1696 | } | 1976 | } |
| 1697 | | 1977 | |
| 1698 | fn zirAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 1978 | fn zirAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1699 | const tracy = trace(@src()); | 1979 | const tracy = trace(@src()); |
| 1700 | defer tracy.end(); | 1980 | defer tracy.end(); |
| 1701 | | 1981 | |
| ... | @@ -1711,7 +1991,7 @@ fn zirAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError | ... | @@ -1711,7 +1991,7 @@ fn zirAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError |
| 1711 | return block.addTy(.alloc, ptr_type); | 1991 | return block.addTy(.alloc, ptr_type); |
| 1712 | } | 1992 | } |
| 1713 | | 1993 | |
| 1714 | fn zirAllocMut(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 1994 | fn zirAllocMut(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 1715 | const tracy = trace(@src()); | 1995 | const tracy = trace(@src()); |
| 1716 | defer tracy.end(); | 1996 | defer tracy.end(); |
| 1717 | | 1997 | |
| ... | @@ -1733,7 +2013,7 @@ fn zirAllocMut(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -1733,7 +2013,7 @@ fn zirAllocMut(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 1733 | | 2013 | |
| 1734 | fn zirAllocInferred( | 2014 | fn zirAllocInferred( |
| 1735 | sema: *Sema, | 2015 | sema: *Sema, |
| 1736 | block: *Scope.Block, | 2016 | block: *Block, |
| 1737 | inst: Zir.Inst.Index, | 2017 | inst: Zir.Inst.Index, |
| 1738 | inferred_alloc_ty: Type, | 2018 | inferred_alloc_ty: Type, |
| 1739 | ) CompileError!Air.Inst.Ref { | 2019 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -1764,7 +2044,7 @@ fn zirAllocInferred( | ... | @@ -1764,7 +2044,7 @@ fn zirAllocInferred( |
| 1764 | return result; | 2044 | return result; |
| 1765 | } | 2045 | } |
| 1766 | | 2046 | |
| 1767 | fn zirResolveInferredAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 2047 | fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 1768 | const tracy = trace(@src()); | 2048 | const tracy = trace(@src()); |
| 1769 | defer tracy.end(); | 2049 | defer tracy.end(); |
| 1770 | | 2050 | |
| ... | @@ -1823,7 +2103,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde | ... | @@ -1823,7 +2103,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde |
| 1823 | } | 2103 | } |
| 1824 | } | 2104 | } |
| 1825 | | 2105 | |
| 1826 | fn zirValidateStructInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 2106 | fn zirValidateStructInitPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 1827 | const tracy = trace(@src()); | 2107 | const tracy = trace(@src()); |
| 1828 | defer tracy.end(); | 2108 | defer tracy.end(); |
| 1829 | | 2109 | |
| ... | @@ -1855,7 +2135,7 @@ fn zirValidateStructInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Ind | ... | @@ -1855,7 +2135,7 @@ fn zirValidateStructInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Ind |
| 1855 | | 2135 | |
| 1856 | fn validateUnionInitPtr( | 2136 | fn validateUnionInitPtr( |
| 1857 | sema: *Sema, | 2137 | sema: *Sema, |
| 1858 | block: *Scope.Block, | 2138 | block: *Block, |
| 1859 | union_obj: *Module.Union, | 2139 | union_obj: *Module.Union, |
| 1860 | init_src: LazySrcLoc, | 2140 | init_src: LazySrcLoc, |
| 1861 | instrs: []const Zir.Inst.Index, | 2141 | instrs: []const Zir.Inst.Index, |
| ... | @@ -1894,7 +2174,7 @@ fn validateUnionInitPtr( | ... | @@ -1894,7 +2174,7 @@ fn validateUnionInitPtr( |
| 1894 | | 2174 | |
| 1895 | fn validateStructInitPtr( | 2175 | fn validateStructInitPtr( |
| 1896 | sema: *Sema, | 2176 | sema: *Sema, |
| 1897 | block: *Scope.Block, | 2177 | block: *Block, |
| 1898 | struct_obj: *Module.Struct, | 2178 | struct_obj: *Module.Struct, |
| 1899 | init_src: LazySrcLoc, | 2179 | init_src: LazySrcLoc, |
| 1900 | instrs: []const Zir.Inst.Index, | 2180 | instrs: []const Zir.Inst.Index, |
| ... | @@ -1956,7 +2236,7 @@ fn validateStructInitPtr( | ... | @@ -1956,7 +2236,7 @@ fn validateStructInitPtr( |
| 1956 | } | 2236 | } |
| 1957 | } | 2237 | } |
| 1958 | | 2238 | |
| 1959 | fn zirValidateArrayInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 2239 | fn zirValidateArrayInitPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 1960 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 2240 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 1961 | const src = inst_data.src(); | 2241 | const src = inst_data.src(); |
| 1962 | return sema.fail(block, src, "TODO implement Sema.zirValidateArrayInitPtr", .{}); | 2242 | return sema.fail(block, src, "TODO implement Sema.zirValidateArrayInitPtr", .{}); |
| ... | @@ -1964,7 +2244,7 @@ fn zirValidateArrayInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde | ... | @@ -1964,7 +2244,7 @@ fn zirValidateArrayInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde |
| 1964 | | 2244 | |
| 1965 | fn failWithBadFieldAccess( | 2245 | fn failWithBadFieldAccess( |
| 1966 | sema: *Sema, | 2246 | sema: *Sema, |
| 1967 | block: *Scope.Block, | 2247 | block: *Block, |
| 1968 | struct_obj: *Module.Struct, | 2248 | struct_obj: *Module.Struct, |
| 1969 | field_src: LazySrcLoc, | 2249 | field_src: LazySrcLoc, |
| 1970 | field_name: []const u8, | 2250 | field_name: []const u8, |
| ... | @@ -1990,7 +2270,7 @@ fn failWithBadFieldAccess( | ... | @@ -1990,7 +2270,7 @@ fn failWithBadFieldAccess( |
| 1990 | | 2270 | |
| 1991 | fn failWithBadUnionFieldAccess( | 2271 | fn failWithBadUnionFieldAccess( |
| 1992 | sema: *Sema, | 2272 | sema: *Sema, |
| 1993 | block: *Scope.Block, | 2273 | block: *Block, |
| 1994 | union_obj: *Module.Union, | 2274 | union_obj: *Module.Union, |
| 1995 | field_src: LazySrcLoc, | 2275 | field_src: LazySrcLoc, |
| 1996 | field_name: []const u8, | 2276 | field_name: []const u8, |
| ... | @@ -2014,7 +2294,7 @@ fn failWithBadUnionFieldAccess( | ... | @@ -2014,7 +2294,7 @@ fn failWithBadUnionFieldAccess( |
| 2014 | return sema.failWithOwnedErrorMsg(msg); | 2294 | return sema.failWithOwnedErrorMsg(msg); |
| 2015 | } | 2295 | } |
| 2016 | | 2296 | |
| 2017 | fn zirStoreToBlockPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 2297 | fn zirStoreToBlockPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2018 | const tracy = trace(@src()); | 2298 | const tracy = trace(@src()); |
| 2019 | defer tracy.end(); | 2299 | defer tracy.end(); |
| 2020 | | 2300 | |
| ... | @@ -2039,7 +2319,7 @@ fn zirStoreToBlockPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Co | ... | @@ -2039,7 +2319,7 @@ fn zirStoreToBlockPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Co |
| 2039 | return sema.storePtr(block, src, bitcasted_ptr, value); | 2319 | return sema.storePtr(block, src, bitcasted_ptr, value); |
| 2040 | } | 2320 | } |
| 2041 | | 2321 | |
| 2042 | fn zirStoreToInferredPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 2322 | fn zirStoreToInferredPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2043 | const tracy = trace(@src()); | 2323 | const tracy = trace(@src()); |
| 2044 | defer tracy.end(); | 2324 | defer tracy.end(); |
| 2045 | | 2325 | |
| ... | @@ -2087,7 +2367,7 @@ fn zirStoreToInferredPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) | ... | @@ -2087,7 +2367,7 @@ fn zirStoreToInferredPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) |
| 2087 | unreachable; | 2367 | unreachable; |
| 2088 | } | 2368 | } |
| 2089 | | 2369 | |
| 2090 | fn zirSetEvalBranchQuota(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 2370 | fn zirSetEvalBranchQuota(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2091 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 2371 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2092 | const src = inst_data.src(); | 2372 | const src = inst_data.src(); |
| 2093 | const quota = try sema.resolveAlreadyCoercedInt(block, src, inst_data.operand, u32); | 2373 | const quota = try sema.resolveAlreadyCoercedInt(block, src, inst_data.operand, u32); |
| ... | @@ -2095,7 +2375,7 @@ fn zirSetEvalBranchQuota(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) | ... | @@ -2095,7 +2375,7 @@ fn zirSetEvalBranchQuota(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) |
| 2095 | sema.branch_quota = quota; | 2375 | sema.branch_quota = quota; |
| 2096 | } | 2376 | } |
| 2097 | | 2377 | |
| 2098 | fn zirStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 2378 | fn zirStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2099 | const tracy = trace(@src()); | 2379 | const tracy = trace(@src()); |
| 2100 | defer tracy.end(); | 2380 | defer tracy.end(); |
| 2101 | | 2381 | |
| ... | @@ -2105,7 +2385,7 @@ fn zirStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError | ... | @@ -2105,7 +2385,7 @@ fn zirStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError |
| 2105 | return sema.storePtr(block, sema.src, ptr, value); | 2385 | return sema.storePtr(block, sema.src, ptr, value); |
| 2106 | } | 2386 | } |
| 2107 | | 2387 | |
| 2108 | fn zirStoreNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 2388 | fn zirStoreNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2109 | const tracy = trace(@src()); | 2389 | const tracy = trace(@src()); |
| 2110 | defer tracy.end(); | 2390 | defer tracy.end(); |
| 2111 | | 2391 | |
| ... | @@ -2117,7 +2397,7 @@ fn zirStoreNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE | ... | @@ -2117,7 +2397,7 @@ fn zirStoreNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE |
| 2117 | return sema.storePtr(block, src, ptr, value); | 2397 | return sema.storePtr(block, src, ptr, value); |
| 2118 | } | 2398 | } |
| 2119 | | 2399 | |
| 2120 | fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 2400 | fn zirStr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2121 | const tracy = trace(@src()); | 2401 | const tracy = trace(@src()); |
| 2122 | defer tracy.end(); | 2402 | defer tracy.end(); |
| 2123 | | 2403 | |
| ... | @@ -2136,7 +2416,7 @@ fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -2136,7 +2416,7 @@ fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A |
| 2136 | const decl_ty = try Type.Tag.array_u8_sentinel_0.create(&new_decl_arena.allocator, bytes.len); | 2416 | const decl_ty = try Type.Tag.array_u8_sentinel_0.create(&new_decl_arena.allocator, bytes.len); |
| 2137 | const decl_val = try Value.Tag.bytes.create(&new_decl_arena.allocator, bytes); | 2417 | const decl_val = try Value.Tag.bytes.create(&new_decl_arena.allocator, bytes); |
| 2138 | | 2418 | |
| 2139 | const new_decl = try sema.mod.createAnonymousDecl(&block.base, .{ | 2419 | const new_decl = try sema.mod.createAnonymousDecl(block, .{ |
| 2140 | .ty = decl_ty, | 2420 | .ty = decl_ty, |
| 2141 | .val = decl_val, | 2421 | .val = decl_val, |
| 2142 | }); | 2422 | }); |
| ... | @@ -2145,7 +2425,7 @@ fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -2145,7 +2425,7 @@ fn zirStr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A |
| 2145 | return sema.analyzeDeclRef(new_decl); | 2425 | return sema.analyzeDeclRef(new_decl); |
| 2146 | } | 2426 | } |
| 2147 | | 2427 | |
| 2148 | fn zirInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 2428 | fn zirInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2149 | _ = block; | 2429 | _ = block; |
| 2150 | const tracy = trace(@src()); | 2430 | const tracy = trace(@src()); |
| 2151 | defer tracy.end(); | 2431 | defer tracy.end(); |
| ... | @@ -2154,7 +2434,7 @@ fn zirInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -2154,7 +2434,7 @@ fn zirInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A |
| 2154 | return sema.addIntUnsigned(Type.initTag(.comptime_int), int); | 2434 | return sema.addIntUnsigned(Type.initTag(.comptime_int), int); |
| 2155 | } | 2435 | } |
| 2156 | | 2436 | |
| 2157 | fn zirIntBig(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 2437 | fn zirIntBig(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2158 | _ = block; | 2438 | _ = block; |
| 2159 | const tracy = trace(@src()); | 2439 | const tracy = trace(@src()); |
| 2160 | defer tracy.end(); | 2440 | defer tracy.end(); |
| ... | @@ -2172,7 +2452,7 @@ fn zirIntBig(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -2172,7 +2452,7 @@ fn zirIntBig(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro |
| 2172 | ); | 2452 | ); |
| 2173 | } | 2453 | } |
| 2174 | | 2454 | |
| 2175 | fn zirFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 2455 | fn zirFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2176 | _ = block; | 2456 | _ = block; |
| 2177 | const arena = sema.arena; | 2457 | const arena = sema.arena; |
| 2178 | const number = sema.code.instructions.items(.data)[inst].float; | 2458 | const number = sema.code.instructions.items(.data)[inst].float; |
| ... | @@ -2182,7 +2462,7 @@ fn zirFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError | ... | @@ -2182,7 +2462,7 @@ fn zirFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError |
| 2182 | ); | 2462 | ); |
| 2183 | } | 2463 | } |
| 2184 | | 2464 | |
| 2185 | fn zirFloat128(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 2465 | fn zirFloat128(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2186 | _ = block; | 2466 | _ = block; |
| 2187 | const arena = sema.arena; | 2467 | const arena = sema.arena; |
| 2188 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 2468 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| ... | @@ -2194,7 +2474,7 @@ fn zirFloat128(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -2194,7 +2474,7 @@ fn zirFloat128(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 2194 | ); | 2474 | ); |
| 2195 | } | 2475 | } |
| 2196 | | 2476 | |
| 2197 | fn zirCompileError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { | 2477 | fn zirCompileError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 2198 | const tracy = trace(@src()); | 2478 | const tracy = trace(@src()); |
| 2199 | defer tracy.end(); | 2479 | defer tracy.end(); |
| 2200 | | 2480 | |
| ... | @@ -2207,7 +2487,7 @@ fn zirCompileError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compi | ... | @@ -2207,7 +2487,7 @@ fn zirCompileError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compi |
| 2207 | | 2487 | |
| 2208 | fn zirCompileLog( | 2488 | fn zirCompileLog( |
| 2209 | sema: *Sema, | 2489 | sema: *Sema, |
| 2210 | block: *Scope.Block, | 2490 | block: *Block, |
| 2211 | extended: Zir.Inst.Extended.InstData, | 2491 | extended: Zir.Inst.Extended.InstData, |
| 2212 | ) CompileError!Air.Inst.Ref { | 2492 | ) CompileError!Air.Inst.Ref { |
| 2213 | var managed = sema.mod.compile_log_text.toManaged(sema.gpa); | 2493 | var managed = sema.mod.compile_log_text.toManaged(sema.gpa); |
| ... | @@ -2239,7 +2519,7 @@ fn zirCompileLog( | ... | @@ -2239,7 +2519,7 @@ fn zirCompileLog( |
| 2239 | return Air.Inst.Ref.void_value; | 2519 | return Air.Inst.Ref.void_value; |
| 2240 | } | 2520 | } |
| 2241 | | 2521 | |
| 2242 | fn zirPanic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { | 2522 | fn zirPanic(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 2243 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 2523 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2244 | const src: LazySrcLoc = inst_data.src(); | 2524 | const src: LazySrcLoc = inst_data.src(); |
| 2245 | const msg_inst = sema.resolveInst(inst_data.operand); | 2525 | const msg_inst = sema.resolveInst(inst_data.operand); |
| ... | @@ -2247,7 +2527,7 @@ fn zirPanic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError | ... | @@ -2247,7 +2527,7 @@ fn zirPanic(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError |
| 2247 | return sema.panicWithMsg(block, src, msg_inst); | 2527 | return sema.panicWithMsg(block, src, msg_inst); |
| 2248 | } | 2528 | } |
| 2249 | | 2529 | |
| 2250 | fn zirLoop(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 2530 | fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2251 | const tracy = trace(@src()); | 2531 | const tracy = trace(@src()); |
| 2252 | defer tracy.end(); | 2532 | defer tracy.end(); |
| 2253 | | 2533 | |
| ... | @@ -2275,7 +2555,7 @@ fn zirLoop(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) Compil | ... | @@ -2275,7 +2555,7 @@ fn zirLoop(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) Compil |
| 2275 | .payload = undefined, | 2555 | .payload = undefined, |
| 2276 | } }, | 2556 | } }, |
| 2277 | }); | 2557 | }); |
| 2278 | var label: Scope.Block.Label = .{ | 2558 | var label: Block.Label = .{ |
| 2279 | .zir_block = inst, | 2559 | .zir_block = inst, |
| 2280 | .merges = .{ | 2560 | .merges = .{ |
| 2281 | .results = .{}, | 2561 | .results = .{}, |
| ... | @@ -2310,7 +2590,7 @@ fn zirLoop(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) Compil | ... | @@ -2310,7 +2590,7 @@ fn zirLoop(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) Compil |
| 2310 | return sema.analyzeBlockBody(parent_block, src, &child_block, merges); | 2590 | return sema.analyzeBlockBody(parent_block, src, &child_block, merges); |
| 2311 | } | 2591 | } |
| 2312 | | 2592 | |
| 2313 | fn zirCImport(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 2593 | fn zirCImport(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2314 | const tracy = trace(@src()); | 2594 | const tracy = trace(@src()); |
| 2315 | defer tracy.end(); | 2595 | defer tracy.end(); |
| 2316 | | 2596 | |
| ... | @@ -2326,7 +2606,7 @@ fn zirCImport(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) Com | ... | @@ -2326,7 +2606,7 @@ fn zirCImport(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) Com |
| 2326 | var c_import_buf = std.ArrayList(u8).init(sema.gpa); | 2606 | var c_import_buf = std.ArrayList(u8).init(sema.gpa); |
| 2327 | defer c_import_buf.deinit(); | 2607 | defer c_import_buf.deinit(); |
| 2328 | | 2608 | |
| 2329 | var child_block: Scope.Block = .{ | 2609 | var child_block: Block = .{ |
| 2330 | .parent = parent_block, | 2610 | .parent = parent_block, |
| 2331 | .sema = sema, | 2611 | .sema = sema, |
| 2332 | .src_decl = parent_block.src_decl, | 2612 | .src_decl = parent_block.src_decl, |
| ... | @@ -2389,7 +2669,7 @@ fn zirCImport(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) Com | ... | @@ -2389,7 +2669,7 @@ fn zirCImport(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) Com |
| 2389 | return sema.addConstant(file_root_decl.ty, file_root_decl.val); | 2669 | return sema.addConstant(file_root_decl.ty, file_root_decl.val); |
| 2390 | } | 2670 | } |
| 2391 | | 2671 | |
| 2392 | fn zirSuspendBlock(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 2672 | fn zirSuspendBlock(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2393 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 2673 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 2394 | const src = inst_data.src(); | 2674 | const src = inst_data.src(); |
| 2395 | return sema.fail(parent_block, src, "TODO: implement Sema.zirSuspendBlock", .{}); | 2675 | return sema.fail(parent_block, src, "TODO: implement Sema.zirSuspendBlock", .{}); |
| ... | @@ -2397,7 +2677,7 @@ fn zirSuspendBlock(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index | ... | @@ -2397,7 +2677,7 @@ fn zirSuspendBlock(sema: *Sema, parent_block: *Scope.Block, inst: Zir.Inst.Index |
| 2397 | | 2677 | |
| 2398 | fn zirBlock( | 2678 | fn zirBlock( |
| 2399 | sema: *Sema, | 2679 | sema: *Sema, |
| 2400 | parent_block: *Scope.Block, | 2680 | parent_block: *Block, |
| 2401 | inst: Zir.Inst.Index, | 2681 | inst: Zir.Inst.Index, |
| 2402 | ) CompileError!Air.Inst.Ref { | 2682 | ) CompileError!Air.Inst.Ref { |
| 2403 | const tracy = trace(@src()); | 2683 | const tracy = trace(@src()); |
| ... | @@ -2418,7 +2698,7 @@ fn zirBlock( | ... | @@ -2418,7 +2698,7 @@ fn zirBlock( |
| 2418 | .data = undefined, | 2698 | .data = undefined, |
| 2419 | }); | 2699 | }); |
| 2420 | | 2700 | |
| 2421 | var label: Scope.Block.Label = .{ | 2701 | var label: Block.Label = .{ |
| 2422 | .zir_block = inst, | 2702 | .zir_block = inst, |
| 2423 | .merges = .{ | 2703 | .merges = .{ |
| 2424 | .results = .{}, | 2704 | .results = .{}, |
| ... | @@ -2427,7 +2707,7 @@ fn zirBlock( | ... | @@ -2427,7 +2707,7 @@ fn zirBlock( |
| 2427 | }, | 2707 | }, |
| 2428 | }; | 2708 | }; |
| 2429 | | 2709 | |
| 2430 | var child_block: Scope.Block = .{ | 2710 | var child_block: Block = .{ |
| 2431 | .parent = parent_block, | 2711 | .parent = parent_block, |
| 2432 | .sema = sema, | 2712 | .sema = sema, |
| 2433 | .src_decl = parent_block.src_decl, | 2713 | .src_decl = parent_block.src_decl, |
| ... | @@ -2451,11 +2731,11 @@ fn zirBlock( | ... | @@ -2451,11 +2731,11 @@ fn zirBlock( |
| 2451 | | 2731 | |
| 2452 | fn resolveBlockBody( | 2732 | fn resolveBlockBody( |
| 2453 | sema: *Sema, | 2733 | sema: *Sema, |
| 2454 | parent_block: *Scope.Block, | 2734 | parent_block: *Block, |
| 2455 | src: LazySrcLoc, | 2735 | src: LazySrcLoc, |
| 2456 | child_block: *Scope.Block, | 2736 | child_block: *Block, |
| 2457 | body: []const Zir.Inst.Index, | 2737 | body: []const Zir.Inst.Index, |
| 2458 | merges: *Scope.Block.Merges, | 2738 | merges: *Block.Merges, |
| 2459 | ) CompileError!Air.Inst.Ref { | 2739 | ) CompileError!Air.Inst.Ref { |
| 2460 | if (child_block.is_comptime) { | 2740 | if (child_block.is_comptime) { |
| 2461 | return sema.resolveBody(child_block, body); | 2741 | return sema.resolveBody(child_block, body); |
| ... | @@ -2467,10 +2747,10 @@ fn resolveBlockBody( | ... | @@ -2467,10 +2747,10 @@ fn resolveBlockBody( |
| 2467 | | 2747 | |
| 2468 | fn analyzeBlockBody( | 2748 | fn analyzeBlockBody( |
| 2469 | sema: *Sema, | 2749 | sema: *Sema, |
| 2470 | parent_block: *Scope.Block, | 2750 | parent_block: *Block, |
| 2471 | src: LazySrcLoc, | 2751 | src: LazySrcLoc, |
| 2472 | child_block: *Scope.Block, | 2752 | child_block: *Block, |
| 2473 | merges: *Scope.Block.Merges, | 2753 | merges: *Block.Merges, |
| 2474 | ) CompileError!Air.Inst.Ref { | 2754 | ) CompileError!Air.Inst.Ref { |
| 2475 | const tracy = trace(@src()); | 2755 | const tracy = trace(@src()); |
| 2476 | defer tracy.end(); | 2756 | defer tracy.end(); |
| ... | @@ -2568,7 +2848,7 @@ fn analyzeBlockBody( | ... | @@ -2568,7 +2848,7 @@ fn analyzeBlockBody( |
| 2568 | return Air.indexToRef(merges.block_inst); | 2848 | return Air.indexToRef(merges.block_inst); |
| 2569 | } | 2849 | } |
| 2570 | | 2850 | |
| 2571 | fn zirExport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 2851 | fn zirExport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2572 | const tracy = trace(@src()); | 2852 | const tracy = trace(@src()); |
| 2573 | defer tracy.end(); | 2853 | defer tracy.end(); |
| 2574 | | 2854 | |
| ... | @@ -2586,7 +2866,7 @@ fn zirExport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -2586,7 +2866,7 @@ fn zirExport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro |
| 2586 | try sema.analyzeExport(block, src, options, decl); | 2866 | try sema.analyzeExport(block, src, options, decl); |
| 2587 | } | 2867 | } |
| 2588 | | 2868 | |
| 2589 | fn zirExportValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 2869 | fn zirExportValue(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2590 | const tracy = trace(@src()); | 2870 | const tracy = trace(@src()); |
| 2591 | defer tracy.end(); | 2871 | defer tracy.end(); |
| 2592 | | 2872 | |
| ... | @@ -2606,7 +2886,7 @@ fn zirExportValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil | ... | @@ -2606,7 +2886,7 @@ fn zirExportValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil |
| 2606 | | 2886 | |
| 2607 | pub fn analyzeExport( | 2887 | pub fn analyzeExport( |
| 2608 | sema: *Sema, | 2888 | sema: *Sema, |
| 2609 | block: *Scope.Block, | 2889 | block: *Block, |
| 2610 | src: LazySrcLoc, | 2890 | src: LazySrcLoc, |
| 2611 | borrowed_options: std.builtin.ExportOptions, | 2891 | borrowed_options: std.builtin.ExportOptions, |
| 2612 | exported_decl: *Decl, | 2892 | exported_decl: *Decl, |
| ... | @@ -2682,7 +2962,7 @@ pub fn analyzeExport( | ... | @@ -2682,7 +2962,7 @@ pub fn analyzeExport( |
| 2682 | errdefer de_gop.value_ptr.* = gpa.shrink(de_gop.value_ptr.*, de_gop.value_ptr.len - 1); | 2962 | errdefer de_gop.value_ptr.* = gpa.shrink(de_gop.value_ptr.*, de_gop.value_ptr.len - 1); |
| 2683 | } | 2963 | } |
| 2684 | | 2964 | |
| 2685 | fn zirSetAlignStack(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 2965 | fn zirSetAlignStack(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2686 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 2966 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2687 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 2967 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 2688 | const src: LazySrcLoc = inst_data.src(); | 2968 | const src: LazySrcLoc = inst_data.src(); |
| ... | @@ -2714,7 +2994,7 @@ fn zirSetAlignStack(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Comp | ... | @@ -2714,7 +2994,7 @@ fn zirSetAlignStack(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Comp |
| 2714 | gop.value_ptr.* = .{ .alignment = alignment, .src = src }; | 2994 | gop.value_ptr.* = .{ .alignment = alignment, .src = src }; |
| 2715 | } | 2995 | } |
| 2716 | | 2996 | |
| 2717 | fn zirSetCold(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 2997 | fn zirSetCold(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2718 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 2998 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2719 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 2999 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 2720 | const is_cold = try sema.resolveConstBool(block, operand_src, inst_data.operand); | 3000 | const is_cold = try sema.resolveConstBool(block, operand_src, inst_data.operand); |
| ... | @@ -2722,19 +3002,19 @@ fn zirSetCold(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -2722,19 +3002,19 @@ fn zirSetCold(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 2722 | func.is_cold = is_cold; | 3002 | func.is_cold = is_cold; |
| 2723 | } | 3003 | } |
| 2724 | | 3004 | |
| 2725 | fn zirSetFloatMode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 3005 | fn zirSetFloatMode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2726 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 3006 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2727 | const src: LazySrcLoc = inst_data.src(); | 3007 | const src: LazySrcLoc = inst_data.src(); |
| 2728 | return sema.fail(block, src, "TODO: implement Sema.zirSetFloatMode", .{}); | 3008 | return sema.fail(block, src, "TODO: implement Sema.zirSetFloatMode", .{}); |
| 2729 | } | 3009 | } |
| 2730 | | 3010 | |
| 2731 | fn zirSetRuntimeSafety(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 3011 | fn zirSetRuntimeSafety(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2732 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 3012 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 2733 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 3013 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 2734 | block.want_safety = try sema.resolveConstBool(block, operand_src, inst_data.operand); | 3014 | block.want_safety = try sema.resolveConstBool(block, operand_src, inst_data.operand); |
| 2735 | } | 3015 | } |
| 2736 | | 3016 | |
| 2737 | fn zirFence(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 3017 | fn zirFence(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2738 | if (block.is_comptime) return; | 3018 | if (block.is_comptime) return; |
| 2739 | | 3019 | |
| 2740 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 3020 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| ... | @@ -2751,7 +3031,7 @@ fn zirFence(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError | ... | @@ -2751,7 +3031,7 @@ fn zirFence(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError |
| 2751 | }); | 3031 | }); |
| 2752 | } | 3032 | } |
| 2753 | | 3033 | |
| 2754 | fn zirBreak(sema: *Sema, start_block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { | 3034 | fn zirBreak(sema: *Sema, start_block: *Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 2755 | const tracy = trace(@src()); | 3035 | const tracy = trace(@src()); |
| 2756 | defer tracy.end(); | 3036 | defer tracy.end(); |
| 2757 | | 3037 | |
| ... | @@ -2773,7 +3053,7 @@ fn zirBreak(sema: *Sema, start_block: *Scope.Block, inst: Zir.Inst.Index) Compil | ... | @@ -2773,7 +3053,7 @@ fn zirBreak(sema: *Sema, start_block: *Scope.Block, inst: Zir.Inst.Index) Compil |
| 2773 | } | 3053 | } |
| 2774 | } | 3054 | } |
| 2775 | | 3055 | |
| 2776 | fn zirDbgStmt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 3056 | fn zirDbgStmt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 2777 | const tracy = trace(@src()); | 3057 | const tracy = trace(@src()); |
| 2778 | defer tracy.end(); | 3058 | defer tracy.end(); |
| 2779 | | 3059 | |
| ... | @@ -2793,7 +3073,7 @@ fn zirDbgStmt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -2793,7 +3073,7 @@ fn zirDbgStmt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 2793 | }); | 3073 | }); |
| 2794 | } | 3074 | } |
| 2795 | | 3075 | |
| 2796 | fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 3076 | fn zirDeclRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2797 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; | 3077 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; |
| 2798 | const src = inst_data.src(); | 3078 | const src = inst_data.src(); |
| 2799 | const decl_name = inst_data.get(sema.code); | 3079 | const decl_name = inst_data.get(sema.code); |
| ... | @@ -2801,7 +3081,7 @@ fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -2801,7 +3081,7 @@ fn zirDeclRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 2801 | return sema.analyzeDeclRef(decl); | 3081 | return sema.analyzeDeclRef(decl); |
| 2802 | } | 3082 | } |
| 2803 | | 3083 | |
| 2804 | fn zirDeclVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 3084 | fn zirDeclVal(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 2805 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; | 3085 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; |
| 2806 | const src = inst_data.src(); | 3086 | const src = inst_data.src(); |
| 2807 | const decl_name = inst_data.get(sema.code); | 3087 | const decl_name = inst_data.get(sema.code); |
| ... | @@ -2809,7 +3089,7 @@ fn zirDeclVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -2809,7 +3089,7 @@ fn zirDeclVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 2809 | return sema.analyzeDeclVal(block, src, decl); | 3089 | return sema.analyzeDeclVal(block, src, decl); |
| 2810 | } | 3090 | } |
| 2811 | | 3091 | |
| 2812 | fn lookupIdentifier(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, name: []const u8) !*Decl { | 3092 | fn lookupIdentifier(sema: *Sema, block: *Block, src: LazySrcLoc, name: []const u8) !*Decl { |
| 2813 | var namespace = block.namespace; | 3093 | var namespace = block.namespace; |
| 2814 | while (true) { | 3094 | while (true) { |
| 2815 | if (try sema.lookupInNamespace(block, src, namespace, name, false)) |decl| { | 3095 | if (try sema.lookupInNamespace(block, src, namespace, name, false)) |decl| { |
| ... | @@ -2824,9 +3104,9 @@ fn lookupIdentifier(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, name: []c | ... | @@ -2824,9 +3104,9 @@ fn lookupIdentifier(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, name: []c |
| 2824 | /// only for ones in the specified namespace. | 3104 | /// only for ones in the specified namespace. |
| 2825 | fn lookupInNamespace( | 3105 | fn lookupInNamespace( |
| 2826 | sema: *Sema, | 3106 | sema: *Sema, |
| 2827 | block: *Scope.Block, | 3107 | block: *Block, |
| 2828 | src: LazySrcLoc, | 3108 | src: LazySrcLoc, |
| 2829 | namespace: *Scope.Namespace, | 3109 | namespace: *Namespace, |
| 2830 | ident_name: []const u8, | 3110 | ident_name: []const u8, |
| 2831 | observe_usingnamespace: bool, | 3111 | observe_usingnamespace: bool, |
| 2832 | ) CompileError!?*Decl { | 3112 | ) CompileError!?*Decl { |
| ... | @@ -2842,7 +3122,7 @@ fn lookupInNamespace( | ... | @@ -2842,7 +3122,7 @@ fn lookupInNamespace( |
| 2842 | const src_file = block.namespace.file_scope; | 3122 | const src_file = block.namespace.file_scope; |
| 2843 | | 3123 | |
| 2844 | const gpa = sema.gpa; | 3124 | const gpa = sema.gpa; |
| 2845 | var checked_namespaces: std.AutoArrayHashMapUnmanaged(*Scope.Namespace, void) = .{}; | 3125 | var checked_namespaces: std.AutoArrayHashMapUnmanaged(*Namespace, void) = .{}; |
| 2846 | defer checked_namespaces.deinit(gpa); | 3126 | defer checked_namespaces.deinit(gpa); |
| 2847 | | 3127 | |
| 2848 | // Keep track of name conflicts for error notes. | 3128 | // Keep track of name conflicts for error notes. |
| ... | @@ -2914,7 +3194,7 @@ fn lookupInNamespace( | ... | @@ -2914,7 +3194,7 @@ fn lookupInNamespace( |
| 2914 | | 3194 | |
| 2915 | fn zirCall( | 3195 | fn zirCall( |
| 2916 | sema: *Sema, | 3196 | sema: *Sema, |
| 2917 | block: *Scope.Block, | 3197 | block: *Block, |
| 2918 | inst: Zir.Inst.Index, | 3198 | inst: Zir.Inst.Index, |
| 2919 | ) CompileError!Air.Inst.Ref { | 3199 | ) CompileError!Air.Inst.Ref { |
| 2920 | const tracy = trace(@src()); | 3200 | const tracy = trace(@src()); |
| ... | @@ -3016,7 +3296,7 @@ const GenericRemoveAdapter = struct { | ... | @@ -3016,7 +3296,7 @@ const GenericRemoveAdapter = struct { |
| 3016 | | 3296 | |
| 3017 | fn analyzeCall( | 3297 | fn analyzeCall( |
| 3018 | sema: *Sema, | 3298 | sema: *Sema, |
| 3019 | block: *Scope.Block, | 3299 | block: *Block, |
| 3020 | func: Air.Inst.Ref, | 3300 | func: Air.Inst.Ref, |
| 3021 | func_src: LazySrcLoc, | 3301 | func_src: LazySrcLoc, |
| 3022 | call_src: LazySrcLoc, | 3302 | call_src: LazySrcLoc, |
| ... | @@ -3097,7 +3377,7 @@ fn analyzeCall( | ... | @@ -3097,7 +3377,7 @@ fn analyzeCall( |
| 3097 | | 3377 | |
| 3098 | // Analyze the ZIR. The same ZIR gets analyzed into a runtime function | 3378 | // Analyze the ZIR. The same ZIR gets analyzed into a runtime function |
| 3099 | // or an inlined call depending on what union tag the `label` field is | 3379 | // or an inlined call depending on what union tag the `label` field is |
| 3100 | // set to in the `Scope.Block`. | 3380 | // set to in the `Block`. |
| 3101 | // This block instruction will be used to capture the return value from the | 3381 | // This block instruction will be used to capture the return value from the |
| 3102 | // inlined function. | 3382 | // inlined function. |
| 3103 | const block_inst = @intCast(Air.Inst.Index, sema.air_instructions.len); | 3383 | const block_inst = @intCast(Air.Inst.Index, sema.air_instructions.len); |
| ... | @@ -3107,7 +3387,7 @@ fn analyzeCall( | ... | @@ -3107,7 +3387,7 @@ fn analyzeCall( |
| 3107 | }); | 3387 | }); |
| 3108 | // This one is shared among sub-blocks within the same callee, but not | 3388 | // This one is shared among sub-blocks within the same callee, but not |
| 3109 | // shared among the entire inline/comptime call stack. | 3389 | // shared among the entire inline/comptime call stack. |
| 3110 | var inlining: Scope.Block.Inlining = .{ | 3390 | var inlining: Block.Inlining = .{ |
| 3111 | .comptime_result = undefined, | 3391 | .comptime_result = undefined, |
| 3112 | .merges = .{ | 3392 | .merges = .{ |
| 3113 | .results = .{}, | 3393 | .results = .{}, |
| ... | @@ -3135,7 +3415,7 @@ fn analyzeCall( | ... | @@ -3135,7 +3415,7 @@ fn analyzeCall( |
| 3135 | var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, module_fn.owner_decl.src_scope); | 3415 | var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, module_fn.owner_decl.src_scope); |
| 3136 | defer wip_captures.deinit(); | 3416 | defer wip_captures.deinit(); |
| 3137 | | 3417 | |
| 3138 | var child_block: Scope.Block = .{ | 3418 | var child_block: Block = .{ |
| 3139 | .parent = null, | 3419 | .parent = null, |
| 3140 | .sema = sema, | 3420 | .sema = sema, |
| 3141 | .src_decl = module_fn.owner_decl, | 3421 | .src_decl = module_fn.owner_decl, |
| ... | @@ -3437,7 +3717,7 @@ fn analyzeCall( | ... | @@ -3437,7 +3717,7 @@ fn analyzeCall( |
| 3437 | var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, new_decl.src_scope); | 3717 | var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, new_decl.src_scope); |
| 3438 | defer wip_captures.deinit(); | 3718 | defer wip_captures.deinit(); |
| 3439 | | 3719 | |
| 3440 | var child_block: Scope.Block = .{ | 3720 | var child_block: Block = .{ |
| 3441 | .parent = null, | 3721 | .parent = null, |
| 3442 | .sema = &child_sema, | 3722 | .sema = &child_sema, |
| 3443 | .src_decl = new_decl, | 3723 | .src_decl = new_decl, |
| ... | @@ -3598,7 +3878,7 @@ fn analyzeCall( | ... | @@ -3598,7 +3878,7 @@ fn analyzeCall( |
| 3598 | | 3878 | |
| 3599 | fn finishGenericCall( | 3879 | fn finishGenericCall( |
| 3600 | sema: *Sema, | 3880 | sema: *Sema, |
| 3601 | block: *Scope.Block, | 3881 | block: *Block, |
| 3602 | call_src: LazySrcLoc, | 3882 | call_src: LazySrcLoc, |
| 3603 | callee: *Module.Fn, | 3883 | callee: *Module.Fn, |
| 3604 | func_src: LazySrcLoc, | 3884 | func_src: LazySrcLoc, |
| ... | @@ -3665,7 +3945,7 @@ fn finishGenericCall( | ... | @@ -3665,7 +3945,7 @@ fn finishGenericCall( |
| 3665 | return func_inst; | 3945 | return func_inst; |
| 3666 | } | 3946 | } |
| 3667 | | 3947 | |
| 3668 | fn zirIntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 3948 | fn zirIntType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3669 | _ = block; | 3949 | _ = block; |
| 3670 | const tracy = trace(@src()); | 3950 | const tracy = trace(@src()); |
| 3671 | defer tracy.end(); | 3951 | defer tracy.end(); |
| ... | @@ -3676,7 +3956,7 @@ fn zirIntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -3676,7 +3956,7 @@ fn zirIntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 3676 | return sema.addType(ty); | 3956 | return sema.addType(ty); |
| 3677 | } | 3957 | } |
| 3678 | | 3958 | |
| 3679 | fn zirOptionalType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 3959 | fn zirOptionalType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3680 | const tracy = trace(@src()); | 3960 | const tracy = trace(@src()); |
| 3681 | defer tracy.end(); | 3961 | defer tracy.end(); |
| 3682 | | 3962 | |
| ... | @@ -3688,7 +3968,7 @@ fn zirOptionalType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compi | ... | @@ -3688,7 +3968,7 @@ fn zirOptionalType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compi |
| 3688 | return sema.addType(opt_type); | 3968 | return sema.addType(opt_type); |
| 3689 | } | 3969 | } |
| 3690 | | 3970 | |
| 3691 | fn zirElemType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 3971 | fn zirElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3692 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 3972 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 3693 | const src = inst_data.src(); | 3973 | const src = inst_data.src(); |
| 3694 | const array_type = try sema.resolveType(block, src, inst_data.operand); | 3974 | const array_type = try sema.resolveType(block, src, inst_data.operand); |
| ... | @@ -3696,7 +3976,7 @@ fn zirElemType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -3696,7 +3976,7 @@ fn zirElemType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 3696 | return sema.addType(elem_type); | 3976 | return sema.addType(elem_type); |
| 3697 | } | 3977 | } |
| 3698 | | 3978 | |
| 3699 | fn zirVectorType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 3979 | fn zirVectorType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3700 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 3980 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 3701 | const elem_type_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 3981 | const elem_type_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 3702 | const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 3982 | const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| ... | @@ -3710,7 +3990,7 @@ fn zirVectorType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile | ... | @@ -3710,7 +3990,7 @@ fn zirVectorType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile |
| 3710 | return sema.addType(vector_type); | 3990 | return sema.addType(vector_type); |
| 3711 | } | 3991 | } |
| 3712 | | 3992 | |
| 3713 | fn zirArrayType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 3993 | fn zirArrayType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3714 | const tracy = trace(@src()); | 3994 | const tracy = trace(@src()); |
| 3715 | defer tracy.end(); | 3995 | defer tracy.end(); |
| 3716 | | 3996 | |
| ... | @@ -3722,7 +4002,7 @@ fn zirArrayType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE | ... | @@ -3722,7 +4002,7 @@ fn zirArrayType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE |
| 3722 | return sema.addType(array_ty); | 4002 | return sema.addType(array_ty); |
| 3723 | } | 4003 | } |
| 3724 | | 4004 | |
| 3725 | fn zirArrayTypeSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4005 | fn zirArrayTypeSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3726 | const tracy = trace(@src()); | 4006 | const tracy = trace(@src()); |
| 3727 | defer tracy.end(); | 4007 | defer tracy.end(); |
| 3728 | | 4008 | |
| ... | @@ -3738,7 +4018,7 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) | ... | @@ -3738,7 +4018,7 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) |
| 3738 | return sema.addType(array_ty); | 4018 | return sema.addType(array_ty); |
| 3739 | } | 4019 | } |
| 3740 | | 4020 | |
| 3741 | fn zirAnyframeType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4021 | fn zirAnyframeType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3742 | const tracy = trace(@src()); | 4022 | const tracy = trace(@src()); |
| 3743 | defer tracy.end(); | 4023 | defer tracy.end(); |
| 3744 | | 4024 | |
| ... | @@ -3750,7 +4030,7 @@ fn zirAnyframeType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compi | ... | @@ -3750,7 +4030,7 @@ fn zirAnyframeType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compi |
| 3750 | return sema.addType(anyframe_type); | 4030 | return sema.addType(anyframe_type); |
| 3751 | } | 4031 | } |
| 3752 | | 4032 | |
| 3753 | fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4033 | fn zirErrorUnionType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3754 | const tracy = trace(@src()); | 4034 | const tracy = trace(@src()); |
| 3755 | defer tracy.end(); | 4035 | defer tracy.end(); |
| 3756 | | 4036 | |
| ... | @@ -3770,7 +4050,7 @@ fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Com | ... | @@ -3770,7 +4050,7 @@ fn zirErrorUnionType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Com |
| 3770 | return sema.addType(err_union_ty); | 4050 | return sema.addType(err_union_ty); |
| 3771 | } | 4051 | } |
| 3772 | | 4052 | |
| 3773 | fn zirErrorValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4053 | fn zirErrorValue(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3774 | _ = block; | 4054 | _ = block; |
| 3775 | const tracy = trace(@src()); | 4055 | const tracy = trace(@src()); |
| 3776 | defer tracy.end(); | 4056 | defer tracy.end(); |
| ... | @@ -3788,7 +4068,7 @@ fn zirErrorValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile | ... | @@ -3788,7 +4068,7 @@ fn zirErrorValue(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile |
| 3788 | ); | 4068 | ); |
| 3789 | } | 4069 | } |
| 3790 | | 4070 | |
| 3791 | fn zirErrorToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4071 | fn zirErrorToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3792 | const tracy = trace(@src()); | 4072 | const tracy = trace(@src()); |
| 3793 | defer tracy.end(); | 4073 | defer tracy.end(); |
| 3794 | | 4074 | |
| ... | @@ -3815,7 +4095,7 @@ fn zirErrorToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile | ... | @@ -3815,7 +4095,7 @@ fn zirErrorToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile |
| 3815 | return block.addTyOp(.bitcast, result_ty, op_coerced); | 4095 | return block.addTyOp(.bitcast, result_ty, op_coerced); |
| 3816 | } | 4096 | } |
| 3817 | | 4097 | |
| 3818 | fn zirIntToError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4098 | fn zirIntToError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3819 | const tracy = trace(@src()); | 4099 | const tracy = trace(@src()); |
| 3820 | defer tracy.end(); | 4100 | defer tracy.end(); |
| 3821 | | 4101 | |
| ... | @@ -3845,7 +4125,7 @@ fn zirIntToError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile | ... | @@ -3845,7 +4125,7 @@ fn zirIntToError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile |
| 3845 | return block.addTyOp(.bitcast, Type.initTag(.anyerror), op); | 4125 | return block.addTyOp(.bitcast, Type.initTag(.anyerror), op); |
| 3846 | } | 4126 | } |
| 3847 | | 4127 | |
| 3848 | fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4128 | fn zirMergeErrorSets(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3849 | const tracy = trace(@src()); | 4129 | const tracy = trace(@src()); |
| 3850 | defer tracy.end(); | 4130 | defer tracy.end(); |
| 3851 | | 4131 | |
| ... | @@ -3929,7 +4209,7 @@ fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Com | ... | @@ -3929,7 +4209,7 @@ fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Com |
| 3929 | return sema.addConstant(Type.initTag(.type), try Value.Tag.ty.create(sema.arena, error_set_ty)); | 4209 | return sema.addConstant(Type.initTag(.type), try Value.Tag.ty.create(sema.arena, error_set_ty)); |
| 3930 | } | 4210 | } |
| 3931 | | 4211 | |
| 3932 | fn zirEnumLiteral(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4212 | fn zirEnumLiteral(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3933 | _ = block; | 4213 | _ = block; |
| 3934 | const tracy = trace(@src()); | 4214 | const tracy = trace(@src()); |
| 3935 | defer tracy.end(); | 4215 | defer tracy.end(); |
| ... | @@ -3942,7 +4222,7 @@ fn zirEnumLiteral(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil | ... | @@ -3942,7 +4222,7 @@ fn zirEnumLiteral(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil |
| 3942 | ); | 4222 | ); |
| 3943 | } | 4223 | } |
| 3944 | | 4224 | |
| 3945 | fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4225 | fn zirEnumToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3946 | const arena = sema.arena; | 4226 | const arena = sema.arena; |
| 3947 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 4227 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 3948 | const src = inst_data.src(); | 4228 | const src = inst_data.src(); |
| ... | @@ -3988,7 +4268,7 @@ fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE | ... | @@ -3988,7 +4268,7 @@ fn zirEnumToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE |
| 3988 | return block.addTyOp(.bitcast, int_tag_ty, enum_tag); | 4268 | return block.addTyOp(.bitcast, int_tag_ty, enum_tag); |
| 3989 | } | 4269 | } |
| 3990 | | 4270 | |
| 3991 | fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4271 | fn zirIntToEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3992 | const target = sema.mod.getTarget(); | 4272 | const target = sema.mod.getTarget(); |
| 3993 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 4273 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 3994 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 4274 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | @@ -4038,7 +4318,7 @@ fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE | ... | @@ -4038,7 +4318,7 @@ fn zirIntToEnum(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE |
| 4038 | /// Pointer in, pointer out. | 4318 | /// Pointer in, pointer out. |
| 4039 | fn zirOptionalPayloadPtr( | 4319 | fn zirOptionalPayloadPtr( |
| 4040 | sema: *Sema, | 4320 | sema: *Sema, |
| 4041 | block: *Scope.Block, | 4321 | block: *Block, |
| 4042 | inst: Zir.Inst.Index, | 4322 | inst: Zir.Inst.Index, |
| 4043 | safety_check: bool, | 4323 | safety_check: bool, |
| 4044 | ) CompileError!Air.Inst.Ref { | 4324 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -4087,7 +4367,7 @@ fn zirOptionalPayloadPtr( | ... | @@ -4087,7 +4367,7 @@ fn zirOptionalPayloadPtr( |
| 4087 | /// Value in, value out. | 4367 | /// Value in, value out. |
| 4088 | fn zirOptionalPayload( | 4368 | fn zirOptionalPayload( |
| 4089 | sema: *Sema, | 4369 | sema: *Sema, |
| 4090 | block: *Scope.Block, | 4370 | block: *Block, |
| 4091 | inst: Zir.Inst.Index, | 4371 | inst: Zir.Inst.Index, |
| 4092 | safety_check: bool, | 4372 | safety_check: bool, |
| 4093 | ) CompileError!Air.Inst.Ref { | 4373 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -4124,7 +4404,7 @@ fn zirOptionalPayload( | ... | @@ -4124,7 +4404,7 @@ fn zirOptionalPayload( |
| 4124 | /// Value in, value out | 4404 | /// Value in, value out |
| 4125 | fn zirErrUnionPayload( | 4405 | fn zirErrUnionPayload( |
| 4126 | sema: *Sema, | 4406 | sema: *Sema, |
| 4127 | block: *Scope.Block, | 4407 | block: *Block, |
| 4128 | inst: Zir.Inst.Index, | 4408 | inst: Zir.Inst.Index, |
| 4129 | safety_check: bool, | 4409 | safety_check: bool, |
| 4130 | ) CompileError!Air.Inst.Ref { | 4410 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -4159,7 +4439,7 @@ fn zirErrUnionPayload( | ... | @@ -4159,7 +4439,7 @@ fn zirErrUnionPayload( |
| 4159 | /// Pointer in, pointer out. | 4439 | /// Pointer in, pointer out. |
| 4160 | fn zirErrUnionPayloadPtr( | 4440 | fn zirErrUnionPayloadPtr( |
| 4161 | sema: *Sema, | 4441 | sema: *Sema, |
| 4162 | block: *Scope.Block, | 4442 | block: *Block, |
| 4163 | inst: Zir.Inst.Index, | 4443 | inst: Zir.Inst.Index, |
| 4164 | safety_check: bool, | 4444 | safety_check: bool, |
| 4165 | ) CompileError!Air.Inst.Ref { | 4445 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -4203,7 +4483,7 @@ fn zirErrUnionPayloadPtr( | ... | @@ -4203,7 +4483,7 @@ fn zirErrUnionPayloadPtr( |
| 4203 | } | 4483 | } |
| 4204 | | 4484 | |
| 4205 | /// Value in, value out | 4485 | /// Value in, value out |
| 4206 | fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4486 | fn zirErrUnionCode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4207 | const tracy = trace(@src()); | 4487 | const tracy = trace(@src()); |
| 4208 | defer tracy.end(); | 4488 | defer tracy.end(); |
| 4209 | | 4489 | |
| ... | @@ -4226,7 +4506,7 @@ fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compi | ... | @@ -4226,7 +4506,7 @@ fn zirErrUnionCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compi |
| 4226 | } | 4506 | } |
| 4227 | | 4507 | |
| 4228 | /// Pointer in, value out | 4508 | /// Pointer in, value out |
| 4229 | fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4509 | fn zirErrUnionCodePtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4230 | const tracy = trace(@src()); | 4510 | const tracy = trace(@src()); |
| 4231 | defer tracy.end(); | 4511 | defer tracy.end(); |
| 4232 | | 4512 | |
| ... | @@ -4252,7 +4532,7 @@ fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Co | ... | @@ -4252,7 +4532,7 @@ fn zirErrUnionCodePtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Co |
| 4252 | return block.addTyOp(.unwrap_errunion_err_ptr, result_ty, operand); | 4532 | return block.addTyOp(.unwrap_errunion_err_ptr, result_ty, operand); |
| 4253 | } | 4533 | } |
| 4254 | | 4534 | |
| 4255 | fn zirEnsureErrPayloadVoid(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 4535 | fn zirEnsureErrPayloadVoid(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 4256 | const tracy = trace(@src()); | 4536 | const tracy = trace(@src()); |
| 4257 | defer tracy.end(); | 4537 | defer tracy.end(); |
| 4258 | | 4538 | |
| ... | @@ -4269,7 +4549,7 @@ fn zirEnsureErrPayloadVoid(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde | ... | @@ -4269,7 +4549,7 @@ fn zirEnsureErrPayloadVoid(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Inde |
| 4269 | | 4549 | |
| 4270 | fn zirFunc( | 4550 | fn zirFunc( |
| 4271 | sema: *Sema, | 4551 | sema: *Sema, |
| 4272 | block: *Scope.Block, | 4552 | block: *Block, |
| 4273 | inst: Zir.Inst.Index, | 4553 | inst: Zir.Inst.Index, |
| 4274 | inferred_error_set: bool, | 4554 | inferred_error_set: bool, |
| 4275 | ) CompileError!Air.Inst.Ref { | 4555 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -4312,7 +4592,7 @@ fn zirFunc( | ... | @@ -4312,7 +4592,7 @@ fn zirFunc( |
| 4312 | | 4592 | |
| 4313 | fn funcCommon( | 4593 | fn funcCommon( |
| 4314 | sema: *Sema, | 4594 | sema: *Sema, |
| 4315 | block: *Scope.Block, | 4595 | block: *Block, |
| 4316 | src_node_offset: i32, | 4596 | src_node_offset: i32, |
| 4317 | body_inst: Zir.Inst.Index, | 4597 | body_inst: Zir.Inst.Index, |
| 4318 | ret_ty_body: []const Zir.Inst.Index, | 4598 | ret_ty_body: []const Zir.Inst.Index, |
| ... | @@ -4511,7 +4791,7 @@ fn funcCommon( | ... | @@ -4511,7 +4791,7 @@ fn funcCommon( |
| 4511 | | 4791 | |
| 4512 | fn zirParam( | 4792 | fn zirParam( |
| 4513 | sema: *Sema, | 4793 | sema: *Sema, |
| 4514 | block: *Scope.Block, | 4794 | block: *Block, |
| 4515 | inst: Zir.Inst.Index, | 4795 | inst: Zir.Inst.Index, |
| 4516 | is_comptime: bool, | 4796 | is_comptime: bool, |
| 4517 | ) CompileError!void { | 4797 | ) CompileError!void { |
| ... | @@ -4581,7 +4861,7 @@ fn zirParam( | ... | @@ -4581,7 +4861,7 @@ fn zirParam( |
| 4581 | | 4861 | |
| 4582 | fn zirParamAnytype( | 4862 | fn zirParamAnytype( |
| 4583 | sema: *Sema, | 4863 | sema: *Sema, |
| 4584 | block: *Scope.Block, | 4864 | block: *Block, |
| 4585 | inst: Zir.Inst.Index, | 4865 | inst: Zir.Inst.Index, |
| 4586 | is_comptime: bool, | 4866 | is_comptime: bool, |
| 4587 | ) CompileError!void { | 4867 | ) CompileError!void { |
| ... | @@ -4616,7 +4896,7 @@ fn zirParamAnytype( | ... | @@ -4616,7 +4896,7 @@ fn zirParamAnytype( |
| 4616 | try sema.inst_map.put(sema.gpa, inst, .generic_poison); | 4896 | try sema.inst_map.put(sema.gpa, inst, .generic_poison); |
| 4617 | } | 4897 | } |
| 4618 | | 4898 | |
| 4619 | fn zirAs(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4899 | fn zirAs(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4620 | const tracy = trace(@src()); | 4900 | const tracy = trace(@src()); |
| 4621 | defer tracy.end(); | 4901 | defer tracy.end(); |
| 4622 | | 4902 | |
| ... | @@ -4624,7 +4904,7 @@ fn zirAs(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -4624,7 +4904,7 @@ fn zirAs(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Ai |
| 4624 | return sema.analyzeAs(block, .unneeded, bin_inst.lhs, bin_inst.rhs); | 4904 | return sema.analyzeAs(block, .unneeded, bin_inst.lhs, bin_inst.rhs); |
| 4625 | } | 4905 | } |
| 4626 | | 4906 | |
| 4627 | fn zirAsNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4907 | fn zirAsNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4628 | const tracy = trace(@src()); | 4908 | const tracy = trace(@src()); |
| 4629 | defer tracy.end(); | 4909 | defer tracy.end(); |
| 4630 | | 4910 | |
| ... | @@ -4636,7 +4916,7 @@ fn zirAsNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -4636,7 +4916,7 @@ fn zirAsNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro |
| 4636 | | 4916 | |
| 4637 | fn analyzeAs( | 4917 | fn analyzeAs( |
| 4638 | sema: *Sema, | 4918 | sema: *Sema, |
| 4639 | block: *Scope.Block, | 4919 | block: *Block, |
| 4640 | src: LazySrcLoc, | 4920 | src: LazySrcLoc, |
| 4641 | zir_dest_type: Zir.Inst.Ref, | 4921 | zir_dest_type: Zir.Inst.Ref, |
| 4642 | zir_operand: Zir.Inst.Ref, | 4922 | zir_operand: Zir.Inst.Ref, |
| ... | @@ -4646,7 +4926,7 @@ fn analyzeAs( | ... | @@ -4646,7 +4926,7 @@ fn analyzeAs( |
| 4646 | return sema.coerce(block, dest_type, operand, src); | 4926 | return sema.coerce(block, dest_type, operand, src); |
| 4647 | } | 4927 | } |
| 4648 | | 4928 | |
| 4649 | fn zirPtrToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4929 | fn zirPtrToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4650 | const tracy = trace(@src()); | 4930 | const tracy = trace(@src()); |
| 4651 | defer tracy.end(); | 4931 | defer tracy.end(); |
| 4652 | | 4932 | |
| ... | @@ -4663,7 +4943,7 @@ fn zirPtrToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -4663,7 +4943,7 @@ fn zirPtrToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 4663 | return block.addUnOp(.ptrtoint, ptr); | 4943 | return block.addUnOp(.ptrtoint, ptr); |
| 4664 | } | 4944 | } |
| 4665 | | 4945 | |
| 4666 | fn zirFieldVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4946 | fn zirFieldVal(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4667 | const tracy = trace(@src()); | 4947 | const tracy = trace(@src()); |
| 4668 | defer tracy.end(); | 4948 | defer tracy.end(); |
| 4669 | | 4949 | |
| ... | @@ -4682,7 +4962,7 @@ fn zirFieldVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -4682,7 +4962,7 @@ fn zirFieldVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 4682 | } | 4962 | } |
| 4683 | } | 4963 | } |
| 4684 | | 4964 | |
| 4685 | fn zirFieldPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4965 | fn zirFieldPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4686 | const tracy = trace(@src()); | 4966 | const tracy = trace(@src()); |
| 4687 | defer tracy.end(); | 4967 | defer tracy.end(); |
| 4688 | | 4968 | |
| ... | @@ -4695,7 +4975,7 @@ fn zirFieldPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -4695,7 +4975,7 @@ fn zirFieldPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 4695 | return sema.fieldPtr(block, src, object_ptr, field_name, field_name_src); | 4975 | return sema.fieldPtr(block, src, object_ptr, field_name, field_name_src); |
| 4696 | } | 4976 | } |
| 4697 | | 4977 | |
| 4698 | fn zirFieldCallBind(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4978 | fn zirFieldCallBind(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4699 | const tracy = trace(@src()); | 4979 | const tracy = trace(@src()); |
| 4700 | defer tracy.end(); | 4980 | defer tracy.end(); |
| 4701 | | 4981 | |
| ... | @@ -4708,7 +4988,7 @@ fn zirFieldCallBind(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Comp | ... | @@ -4708,7 +4988,7 @@ fn zirFieldCallBind(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Comp |
| 4708 | return sema.fieldCallBind(block, src, object_ptr, field_name, field_name_src); | 4988 | return sema.fieldCallBind(block, src, object_ptr, field_name, field_name_src); |
| 4709 | } | 4989 | } |
| 4710 | | 4990 | |
| 4711 | fn zirFieldValNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4991 | fn zirFieldValNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4712 | const tracy = trace(@src()); | 4992 | const tracy = trace(@src()); |
| 4713 | defer tracy.end(); | 4993 | defer tracy.end(); |
| 4714 | | 4994 | |
| ... | @@ -4721,7 +5001,7 @@ fn zirFieldValNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Comp | ... | @@ -4721,7 +5001,7 @@ fn zirFieldValNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Comp |
| 4721 | return sema.fieldVal(block, src, object, field_name, field_name_src); | 5001 | return sema.fieldVal(block, src, object, field_name, field_name_src); |
| 4722 | } | 5002 | } |
| 4723 | | 5003 | |
| 4724 | fn zirFieldPtrNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5004 | fn zirFieldPtrNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4725 | const tracy = trace(@src()); | 5005 | const tracy = trace(@src()); |
| 4726 | defer tracy.end(); | 5006 | defer tracy.end(); |
| 4727 | | 5007 | |
| ... | @@ -4734,7 +5014,7 @@ fn zirFieldPtrNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Comp | ... | @@ -4734,7 +5014,7 @@ fn zirFieldPtrNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Comp |
| 4734 | return sema.fieldPtr(block, src, object_ptr, field_name, field_name_src); | 5014 | return sema.fieldPtr(block, src, object_ptr, field_name, field_name_src); |
| 4735 | } | 5015 | } |
| 4736 | | 5016 | |
| 4737 | fn zirFieldCallBindNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5017 | fn zirFieldCallBindNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4738 | const tracy = trace(@src()); | 5018 | const tracy = trace(@src()); |
| 4739 | defer tracy.end(); | 5019 | defer tracy.end(); |
| 4740 | | 5020 | |
| ... | @@ -4747,7 +5027,7 @@ fn zirFieldCallBindNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) | ... | @@ -4747,7 +5027,7 @@ fn zirFieldCallBindNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) |
| 4747 | return sema.fieldCallBind(block, src, object_ptr, field_name, field_name_src); | 5027 | return sema.fieldCallBind(block, src, object_ptr, field_name, field_name_src); |
| 4748 | } | 5028 | } |
| 4749 | | 5029 | |
| 4750 | fn zirIntCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5030 | fn zirIntCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4751 | const tracy = trace(@src()); | 5031 | const tracy = trace(@src()); |
| 4752 | defer tracy.end(); | 5032 | defer tracy.end(); |
| 4753 | | 5033 | |
| ... | @@ -4773,7 +5053,7 @@ fn zirIntCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -4773,7 +5053,7 @@ fn zirIntCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 4773 | return block.addTyOp(.intcast, dest_type, operand); | 5053 | return block.addTyOp(.intcast, dest_type, operand); |
| 4774 | } | 5054 | } |
| 4775 | | 5055 | |
| 4776 | fn zirBitcast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5056 | fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4777 | const tracy = trace(@src()); | 5057 | const tracy = trace(@src()); |
| 4778 | defer tracy.end(); | 5058 | defer tracy.end(); |
| 4779 | | 5059 | |
| ... | @@ -4787,7 +5067,7 @@ fn zirBitcast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -4787,7 +5067,7 @@ fn zirBitcast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 4787 | return sema.bitcast(block, dest_type, operand, operand_src); | 5067 | return sema.bitcast(block, dest_type, operand, operand_src); |
| 4788 | } | 5068 | } |
| 4789 | | 5069 | |
| 4790 | fn zirFloatCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5070 | fn zirFloatCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4791 | const tracy = trace(@src()); | 5071 | const tracy = trace(@src()); |
| 4792 | defer tracy.end(); | 5072 | defer tracy.end(); |
| 4793 | | 5073 | |
| ... | @@ -4838,7 +5118,7 @@ fn zirFloatCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE | ... | @@ -4838,7 +5118,7 @@ fn zirFloatCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE |
| 4838 | return block.addTyOp(.fptrunc, dest_type, operand); | 5118 | return block.addTyOp(.fptrunc, dest_type, operand); |
| 4839 | } | 5119 | } |
| 4840 | | 5120 | |
| 4841 | fn zirElemVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5121 | fn zirElemVal(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4842 | const tracy = trace(@src()); | 5122 | const tracy = trace(@src()); |
| 4843 | defer tracy.end(); | 5123 | defer tracy.end(); |
| 4844 | | 5124 | |
| ... | @@ -4848,7 +5128,7 @@ fn zirElemVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -4848,7 +5128,7 @@ fn zirElemVal(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 4848 | return sema.elemVal(block, sema.src, array, elem_index, sema.src); | 5128 | return sema.elemVal(block, sema.src, array, elem_index, sema.src); |
| 4849 | } | 5129 | } |
| 4850 | | 5130 | |
| 4851 | fn zirElemValNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5131 | fn zirElemValNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4852 | const tracy = trace(@src()); | 5132 | const tracy = trace(@src()); |
| 4853 | defer tracy.end(); | 5133 | defer tracy.end(); |
| 4854 | | 5134 | |
| ... | @@ -4861,7 +5141,7 @@ fn zirElemValNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil | ... | @@ -4861,7 +5141,7 @@ fn zirElemValNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil |
| 4861 | return sema.elemVal(block, src, array, elem_index, elem_index_src); | 5141 | return sema.elemVal(block, src, array, elem_index, elem_index_src); |
| 4862 | } | 5142 | } |
| 4863 | | 5143 | |
| 4864 | fn zirElemPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5144 | fn zirElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4865 | const tracy = trace(@src()); | 5145 | const tracy = trace(@src()); |
| 4866 | defer tracy.end(); | 5146 | defer tracy.end(); |
| 4867 | | 5147 | |
| ... | @@ -4871,7 +5151,7 @@ fn zirElemPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -4871,7 +5151,7 @@ fn zirElemPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 4871 | return sema.elemPtr(block, sema.src, array_ptr, elem_index, sema.src); | 5151 | return sema.elemPtr(block, sema.src, array_ptr, elem_index, sema.src); |
| 4872 | } | 5152 | } |
| 4873 | | 5153 | |
| 4874 | fn zirElemPtrNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5154 | fn zirElemPtrNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4875 | const tracy = trace(@src()); | 5155 | const tracy = trace(@src()); |
| 4876 | defer tracy.end(); | 5156 | defer tracy.end(); |
| 4877 | | 5157 | |
| ... | @@ -4884,7 +5164,7 @@ fn zirElemPtrNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil | ... | @@ -4884,7 +5164,7 @@ fn zirElemPtrNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil |
| 4884 | return sema.elemPtr(block, src, array_ptr, elem_index, elem_index_src); | 5164 | return sema.elemPtr(block, src, array_ptr, elem_index, elem_index_src); |
| 4885 | } | 5165 | } |
| 4886 | | 5166 | |
| 4887 | fn zirSliceStart(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5167 | fn zirSliceStart(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4888 | const tracy = trace(@src()); | 5168 | const tracy = trace(@src()); |
| 4889 | defer tracy.end(); | 5169 | defer tracy.end(); |
| 4890 | | 5170 | |
| ... | @@ -4897,7 +5177,7 @@ fn zirSliceStart(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile | ... | @@ -4897,7 +5177,7 @@ fn zirSliceStart(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile |
| 4897 | return sema.analyzeSlice(block, src, array_ptr, start, .none, .none, .unneeded); | 5177 | return sema.analyzeSlice(block, src, array_ptr, start, .none, .none, .unneeded); |
| 4898 | } | 5178 | } |
| 4899 | | 5179 | |
| 4900 | fn zirSliceEnd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5180 | fn zirSliceEnd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4901 | const tracy = trace(@src()); | 5181 | const tracy = trace(@src()); |
| 4902 | defer tracy.end(); | 5182 | defer tracy.end(); |
| 4903 | | 5183 | |
| ... | @@ -4911,7 +5191,7 @@ fn zirSliceEnd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -4911,7 +5191,7 @@ fn zirSliceEnd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 4911 | return sema.analyzeSlice(block, src, array_ptr, start, end, .none, .unneeded); | 5191 | return sema.analyzeSlice(block, src, array_ptr, start, end, .none, .unneeded); |
| 4912 | } | 5192 | } |
| 4913 | | 5193 | |
| 4914 | fn zirSliceSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5194 | fn zirSliceSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4915 | const tracy = trace(@src()); | 5195 | const tracy = trace(@src()); |
| 4916 | defer tracy.end(); | 5196 | defer tracy.end(); |
| 4917 | | 5197 | |
| ... | @@ -4929,7 +5209,7 @@ fn zirSliceSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Comp | ... | @@ -4929,7 +5209,7 @@ fn zirSliceSentinel(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Comp |
| 4929 | | 5209 | |
| 4930 | fn zirSwitchCapture( | 5210 | fn zirSwitchCapture( |
| 4931 | sema: *Sema, | 5211 | sema: *Sema, |
| 4932 | block: *Scope.Block, | 5212 | block: *Block, |
| 4933 | inst: Zir.Inst.Index, | 5213 | inst: Zir.Inst.Index, |
| 4934 | is_multi: bool, | 5214 | is_multi: bool, |
| 4935 | is_ref: bool, | 5215 | is_ref: bool, |
| ... | @@ -4949,7 +5229,7 @@ fn zirSwitchCapture( | ... | @@ -4949,7 +5229,7 @@ fn zirSwitchCapture( |
| 4949 | | 5229 | |
| 4950 | fn zirSwitchCaptureElse( | 5230 | fn zirSwitchCaptureElse( |
| 4951 | sema: *Sema, | 5231 | sema: *Sema, |
| 4952 | block: *Scope.Block, | 5232 | block: *Block, |
| 4953 | inst: Zir.Inst.Index, | 5233 | inst: Zir.Inst.Index, |
| 4954 | is_ref: bool, | 5234 | is_ref: bool, |
| 4955 | ) CompileError!Air.Inst.Ref { | 5235 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -4967,7 +5247,7 @@ fn zirSwitchCaptureElse( | ... | @@ -4967,7 +5247,7 @@ fn zirSwitchCaptureElse( |
| 4967 | | 5247 | |
| 4968 | fn zirSwitchBlock( | 5248 | fn zirSwitchBlock( |
| 4969 | sema: *Sema, | 5249 | sema: *Sema, |
| 4970 | block: *Scope.Block, | 5250 | block: *Block, |
| 4971 | inst: Zir.Inst.Index, | 5251 | inst: Zir.Inst.Index, |
| 4972 | is_ref: bool, | 5252 | is_ref: bool, |
| 4973 | special_prong: Zir.SpecialProng, | 5253 | special_prong: Zir.SpecialProng, |
| ... | @@ -5000,7 +5280,7 @@ fn zirSwitchBlock( | ... | @@ -5000,7 +5280,7 @@ fn zirSwitchBlock( |
| 5000 | | 5280 | |
| 5001 | fn zirSwitchBlockMulti( | 5281 | fn zirSwitchBlockMulti( |
| 5002 | sema: *Sema, | 5282 | sema: *Sema, |
| 5003 | block: *Scope.Block, | 5283 | block: *Block, |
| 5004 | inst: Zir.Inst.Index, | 5284 | inst: Zir.Inst.Index, |
| 5005 | is_ref: bool, | 5285 | is_ref: bool, |
| 5006 | special_prong: Zir.SpecialProng, | 5286 | special_prong: Zir.SpecialProng, |
| ... | @@ -5033,7 +5313,7 @@ fn zirSwitchBlockMulti( | ... | @@ -5033,7 +5313,7 @@ fn zirSwitchBlockMulti( |
| 5033 | | 5313 | |
| 5034 | fn analyzeSwitch( | 5314 | fn analyzeSwitch( |
| 5035 | sema: *Sema, | 5315 | sema: *Sema, |
| 5036 | block: *Scope.Block, | 5316 | block: *Block, |
| 5037 | operand: Air.Inst.Ref, | 5317 | operand: Air.Inst.Ref, |
| 5038 | extra_end: usize, | 5318 | extra_end: usize, |
| 5039 | special_prong: Zir.SpecialProng, | 5319 | special_prong: Zir.SpecialProng, |
| ... | @@ -5451,7 +5731,7 @@ fn analyzeSwitch( | ... | @@ -5451,7 +5731,7 @@ fn analyzeSwitch( |
| 5451 | .tag = .block, | 5731 | .tag = .block, |
| 5452 | .data = undefined, | 5732 | .data = undefined, |
| 5453 | }); | 5733 | }); |
| 5454 | var label: Scope.Block.Label = .{ | 5734 | var label: Block.Label = .{ |
| 5455 | .zir_block = switch_inst, | 5735 | .zir_block = switch_inst, |
| 5456 | .merges = .{ | 5736 | .merges = .{ |
| 5457 | .results = .{}, | 5737 | .results = .{}, |
| ... | @@ -5460,7 +5740,7 @@ fn analyzeSwitch( | ... | @@ -5460,7 +5740,7 @@ fn analyzeSwitch( |
| 5460 | }, | 5740 | }, |
| 5461 | }; | 5741 | }; |
| 5462 | | 5742 | |
| 5463 | var child_block: Scope.Block = .{ | 5743 | var child_block: Block = .{ |
| 5464 | .parent = block, | 5744 | .parent = block, |
| 5465 | .sema = sema, | 5745 | .sema = sema, |
| 5466 | .src_decl = block.src_decl, | 5746 | .src_decl = block.src_decl, |
| ... | @@ -5771,7 +6051,7 @@ fn analyzeSwitch( | ... | @@ -5771,7 +6051,7 @@ fn analyzeSwitch( |
| 5771 | | 6051 | |
| 5772 | fn resolveSwitchItemVal( | 6052 | fn resolveSwitchItemVal( |
| 5773 | sema: *Sema, | 6053 | sema: *Sema, |
| 5774 | block: *Scope.Block, | 6054 | block: *Block, |
| 5775 | item_ref: Zir.Inst.Ref, | 6055 | item_ref: Zir.Inst.Ref, |
| 5776 | switch_node_offset: i32, | 6056 | switch_node_offset: i32, |
| 5777 | switch_prong_src: Module.SwitchProngSrc, | 6057 | switch_prong_src: Module.SwitchProngSrc, |
| ... | @@ -5798,7 +6078,7 @@ fn resolveSwitchItemVal( | ... | @@ -5798,7 +6078,7 @@ fn resolveSwitchItemVal( |
| 5798 | | 6078 | |
| 5799 | fn validateSwitchRange( | 6079 | fn validateSwitchRange( |
| 5800 | sema: *Sema, | 6080 | sema: *Sema, |
| 5801 | block: *Scope.Block, | 6081 | block: *Block, |
| 5802 | range_set: *RangeSet, | 6082 | range_set: *RangeSet, |
| 5803 | first_ref: Zir.Inst.Ref, | 6083 | first_ref: Zir.Inst.Ref, |
| 5804 | last_ref: Zir.Inst.Ref, | 6084 | last_ref: Zir.Inst.Ref, |
| ... | @@ -5814,7 +6094,7 @@ fn validateSwitchRange( | ... | @@ -5814,7 +6094,7 @@ fn validateSwitchRange( |
| 5814 | | 6094 | |
| 5815 | fn validateSwitchItem( | 6095 | fn validateSwitchItem( |
| 5816 | sema: *Sema, | 6096 | sema: *Sema, |
| 5817 | block: *Scope.Block, | 6097 | block: *Block, |
| 5818 | range_set: *RangeSet, | 6098 | range_set: *RangeSet, |
| 5819 | item_ref: Zir.Inst.Ref, | 6099 | item_ref: Zir.Inst.Ref, |
| 5820 | operand_ty: Type, | 6100 | operand_ty: Type, |
| ... | @@ -5828,7 +6108,7 @@ fn validateSwitchItem( | ... | @@ -5828,7 +6108,7 @@ fn validateSwitchItem( |
| 5828 | | 6108 | |
| 5829 | fn validateSwitchItemEnum( | 6109 | fn validateSwitchItemEnum( |
| 5830 | sema: *Sema, | 6110 | sema: *Sema, |
| 5831 | block: *Scope.Block, | 6111 | block: *Block, |
| 5832 | seen_fields: []?Module.SwitchProngSrc, | 6112 | seen_fields: []?Module.SwitchProngSrc, |
| 5833 | item_ref: Zir.Inst.Ref, | 6113 | item_ref: Zir.Inst.Ref, |
| 5834 | src_node_offset: i32, | 6114 | src_node_offset: i32, |
| ... | @@ -5862,7 +6142,7 @@ fn validateSwitchItemEnum( | ... | @@ -5862,7 +6142,7 @@ fn validateSwitchItemEnum( |
| 5862 | | 6142 | |
| 5863 | fn validateSwitchDupe( | 6143 | fn validateSwitchDupe( |
| 5864 | sema: *Sema, | 6144 | sema: *Sema, |
| 5865 | block: *Scope.Block, | 6145 | block: *Block, |
| 5866 | maybe_prev_src: ?Module.SwitchProngSrc, | 6146 | maybe_prev_src: ?Module.SwitchProngSrc, |
| 5867 | switch_prong_src: Module.SwitchProngSrc, | 6147 | switch_prong_src: Module.SwitchProngSrc, |
| 5868 | src_node_offset: i32, | 6148 | src_node_offset: i32, |
| ... | @@ -5893,7 +6173,7 @@ fn validateSwitchDupe( | ... | @@ -5893,7 +6173,7 @@ fn validateSwitchDupe( |
| 5893 | | 6173 | |
| 5894 | fn validateSwitchItemBool( | 6174 | fn validateSwitchItemBool( |
| 5895 | sema: *Sema, | 6175 | sema: *Sema, |
| 5896 | block: *Scope.Block, | 6176 | block: *Block, |
| 5897 | true_count: *u8, | 6177 | true_count: *u8, |
| 5898 | false_count: *u8, | 6178 | false_count: *u8, |
| 5899 | item_ref: Zir.Inst.Ref, | 6179 | item_ref: Zir.Inst.Ref, |
| ... | @@ -5916,7 +6196,7 @@ const ValueSrcMap = std.HashMap(Value, Module.SwitchProngSrc, Value.HashContext, | ... | @@ -5916,7 +6196,7 @@ const ValueSrcMap = std.HashMap(Value, Module.SwitchProngSrc, Value.HashContext, |
| 5916 | | 6196 | |
| 5917 | fn validateSwitchItemSparse( | 6197 | fn validateSwitchItemSparse( |
| 5918 | sema: *Sema, | 6198 | sema: *Sema, |
| 5919 | block: *Scope.Block, | 6199 | block: *Block, |
| 5920 | seen_values: *ValueSrcMap, | 6200 | seen_values: *ValueSrcMap, |
| 5921 | item_ref: Zir.Inst.Ref, | 6201 | item_ref: Zir.Inst.Ref, |
| 5922 | src_node_offset: i32, | 6202 | src_node_offset: i32, |
| ... | @@ -5929,7 +6209,7 @@ fn validateSwitchItemSparse( | ... | @@ -5929,7 +6209,7 @@ fn validateSwitchItemSparse( |
| 5929 | | 6209 | |
| 5930 | fn validateSwitchNoRange( | 6210 | fn validateSwitchNoRange( |
| 5931 | sema: *Sema, | 6211 | sema: *Sema, |
| 5932 | block: *Scope.Block, | 6212 | block: *Block, |
| 5933 | ranges_len: u32, | 6213 | ranges_len: u32, |
| 5934 | operand_ty: Type, | 6214 | operand_ty: Type, |
| 5935 | src_node_offset: i32, | 6215 | src_node_offset: i32, |
| ... | @@ -5960,7 +6240,7 @@ fn validateSwitchNoRange( | ... | @@ -5960,7 +6240,7 @@ fn validateSwitchNoRange( |
| 5960 | return sema.failWithOwnedErrorMsg(msg); | 6240 | return sema.failWithOwnedErrorMsg(msg); |
| 5961 | } | 6241 | } |
| 5962 | | 6242 | |
| 5963 | fn zirHasField(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 6243 | fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5964 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6244 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5965 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 6245 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 5966 | _ = extra; | 6246 | _ = extra; |
| ... | @@ -5969,7 +6249,7 @@ fn zirHasField(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -5969,7 +6249,7 @@ fn zirHasField(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 5969 | return sema.fail(block, src, "TODO implement zirHasField", .{}); | 6249 | return sema.fail(block, src, "TODO implement zirHasField", .{}); |
| 5970 | } | 6250 | } |
| 5971 | | 6251 | |
| 5972 | fn zirHasDecl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 6252 | fn zirHasDecl(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5973 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 6253 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 5974 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 6254 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 5975 | const src = inst_data.src(); | 6255 | const src = inst_data.src(); |
| ... | @@ -5985,14 +6265,14 @@ fn zirHasDecl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -5985,14 +6265,14 @@ fn zirHasDecl(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 5985 | .{container_type}, | 6265 | .{container_type}, |
| 5986 | ); | 6266 | ); |
| 5987 | if (try sema.lookupInNamespace(block, src, namespace, decl_name, true)) |decl| { | 6267 | if (try sema.lookupInNamespace(block, src, namespace, decl_name, true)) |decl| { |
| 5988 | if (decl.is_pub or decl.getFileScope() == block.base.namespace().file_scope) { | 6268 | if (decl.is_pub or decl.getFileScope() == block.getFileScope()) { |
| 5989 | return Air.Inst.Ref.bool_true; | 6269 | return Air.Inst.Ref.bool_true; |
| 5990 | } | 6270 | } |
| 5991 | } | 6271 | } |
| 5992 | return Air.Inst.Ref.bool_false; | 6272 | return Air.Inst.Ref.bool_false; |
| 5993 | } | 6273 | } |
| 5994 | | 6274 | |
| 5995 | fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 6275 | fn zirImport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5996 | const tracy = trace(@src()); | 6276 | const tracy = trace(@src()); |
| 5997 | defer tracy.end(); | 6277 | defer tracy.end(); |
| 5998 | | 6278 | |
| ... | @@ -6017,7 +6297,7 @@ fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -6017,7 +6297,7 @@ fn zirImport(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro |
| 6017 | return sema.addConstant(file_root_decl.ty, file_root_decl.val); | 6297 | return sema.addConstant(file_root_decl.ty, file_root_decl.val); |
| 6018 | } | 6298 | } |
| 6019 | | 6299 | |
| 6020 | fn zirRetErrValueCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 6300 | fn zirRetErrValueCode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6021 | _ = block; | 6301 | _ = block; |
| 6022 | _ = inst; | 6302 | _ = inst; |
| 6023 | return sema.fail(block, sema.src, "TODO implement zirRetErrValueCode", .{}); | 6303 | return sema.fail(block, sema.src, "TODO implement zirRetErrValueCode", .{}); |
| ... | @@ -6025,7 +6305,7 @@ fn zirRetErrValueCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Co | ... | @@ -6025,7 +6305,7 @@ fn zirRetErrValueCode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Co |
| 6025 | | 6305 | |
| 6026 | fn zirShl( | 6306 | fn zirShl( |
| 6027 | sema: *Sema, | 6307 | sema: *Sema, |
| 6028 | block: *Scope.Block, | 6308 | block: *Block, |
| 6029 | inst: Zir.Inst.Index, | 6309 | inst: Zir.Inst.Index, |
| 6030 | air_tag: Air.Inst.Tag, | 6310 | air_tag: Air.Inst.Tag, |
| 6031 | ) CompileError!Air.Inst.Ref { | 6311 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -6076,7 +6356,7 @@ fn zirShl( | ... | @@ -6076,7 +6356,7 @@ fn zirShl( |
| 6076 | return block.addBinOp(air_tag, lhs, rhs); | 6356 | return block.addBinOp(air_tag, lhs, rhs); |
| 6077 | } | 6357 | } |
| 6078 | | 6358 | |
| 6079 | fn zirShr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 6359 | fn zirShr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6080 | const tracy = trace(@src()); | 6360 | const tracy = trace(@src()); |
| 6081 | defer tracy.end(); | 6361 | defer tracy.end(); |
| 6082 | | 6362 | |
| ... | @@ -6109,7 +6389,7 @@ fn zirShr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -6109,7 +6389,7 @@ fn zirShr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A |
| 6109 | | 6389 | |
| 6110 | fn zirBitwise( | 6390 | fn zirBitwise( |
| 6111 | sema: *Sema, | 6391 | sema: *Sema, |
| 6112 | block: *Scope.Block, | 6392 | block: *Block, |
| 6113 | inst: Zir.Inst.Index, | 6393 | inst: Zir.Inst.Index, |
| 6114 | air_tag: Air.Inst.Tag, | 6394 | air_tag: Air.Inst.Tag, |
| 6115 | ) CompileError!Air.Inst.Ref { | 6395 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -6175,7 +6455,7 @@ fn zirBitwise( | ... | @@ -6175,7 +6455,7 @@ fn zirBitwise( |
| 6175 | return block.addBinOp(air_tag, casted_lhs, casted_rhs); | 6455 | return block.addBinOp(air_tag, casted_lhs, casted_rhs); |
| 6176 | } | 6456 | } |
| 6177 | | 6457 | |
| 6178 | fn zirBitNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 6458 | fn zirBitNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6179 | const tracy = trace(@src()); | 6459 | const tracy = trace(@src()); |
| 6180 | defer tracy.end(); | 6460 | defer tracy.end(); |
| 6181 | | 6461 | |
| ... | @@ -6183,7 +6463,7 @@ fn zirBitNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -6183,7 +6463,7 @@ fn zirBitNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro |
| 6183 | return sema.fail(block, sema.src, "TODO implement zirBitNot", .{}); | 6463 | return sema.fail(block, sema.src, "TODO implement zirBitNot", .{}); |
| 6184 | } | 6464 | } |
| 6185 | | 6465 | |
| 6186 | fn zirArrayCat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 6466 | fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6187 | const tracy = trace(@src()); | 6467 | const tracy = trace(@src()); |
| 6188 | defer tracy.end(); | 6468 | defer tracy.end(); |
| 6189 | | 6469 | |
| ... | @@ -6267,7 +6547,7 @@ fn getArrayCatInfo(t: Type) ?Type.ArrayInfo { | ... | @@ -6267,7 +6547,7 @@ fn getArrayCatInfo(t: Type) ?Type.ArrayInfo { |
| 6267 | }; | 6547 | }; |
| 6268 | } | 6548 | } |
| 6269 | | 6549 | |
| 6270 | fn zirArrayMul(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 6550 | fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 6271 | const tracy = trace(@src()); | 6551 | const tracy = trace(@src()); |
| 6272 | defer tracy.end(); | 6552 | defer tracy.end(); |
| 6273 | | 6553 | |
| ... | @@ -6321,7 +6601,7 @@ fn zirArrayMul(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -6321,7 +6601,7 @@ fn zirArrayMul(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 6321 | | 6601 | |
| 6322 | fn zirNegate( | 6602 | fn zirNegate( |
| 6323 | sema: *Sema, | 6603 | sema: *Sema, |
| 6324 | block: *Scope.Block, | 6604 | block: *Block, |
| 6325 | inst: Zir.Inst.Index, | 6605 | inst: Zir.Inst.Index, |
| 6326 | tag_override: Zir.Inst.Tag, | 6606 | tag_override: Zir.Inst.Tag, |
| 6327 | ) CompileError!Air.Inst.Ref { | 6607 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -6340,7 +6620,7 @@ fn zirNegate( | ... | @@ -6340,7 +6620,7 @@ fn zirNegate( |
| 6340 | | 6620 | |
| 6341 | fn zirArithmetic( | 6621 | fn zirArithmetic( |
| 6342 | sema: *Sema, | 6622 | sema: *Sema, |
| 6343 | block: *Scope.Block, | 6623 | block: *Block, |
| 6344 | inst: Zir.Inst.Index, | 6624 | inst: Zir.Inst.Index, |
| 6345 | zir_tag: Zir.Inst.Tag, | 6625 | zir_tag: Zir.Inst.Tag, |
| 6346 | ) CompileError!Air.Inst.Ref { | 6626 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -6360,7 +6640,7 @@ fn zirArithmetic( | ... | @@ -6360,7 +6640,7 @@ fn zirArithmetic( |
| 6360 | | 6640 | |
| 6361 | fn zirOverflowArithmetic( | 6641 | fn zirOverflowArithmetic( |
| 6362 | sema: *Sema, | 6642 | sema: *Sema, |
| 6363 | block: *Scope.Block, | 6643 | block: *Block, |
| 6364 | extended: Zir.Inst.Extended.InstData, | 6644 | extended: Zir.Inst.Extended.InstData, |
| 6365 | ) CompileError!Air.Inst.Ref { | 6645 | ) CompileError!Air.Inst.Ref { |
| 6366 | const tracy = trace(@src()); | 6646 | const tracy = trace(@src()); |
| ... | @@ -6374,7 +6654,7 @@ fn zirOverflowArithmetic( | ... | @@ -6374,7 +6654,7 @@ fn zirOverflowArithmetic( |
| 6374 | | 6654 | |
| 6375 | fn analyzeArithmetic( | 6655 | fn analyzeArithmetic( |
| 6376 | sema: *Sema, | 6656 | sema: *Sema, |
| 6377 | block: *Scope.Block, | 6657 | block: *Block, |
| 6378 | /// TODO performance investigation: make this comptime? | 6658 | /// TODO performance investigation: make this comptime? |
| 6379 | zir_tag: Zir.Inst.Tag, | 6659 | zir_tag: Zir.Inst.Tag, |
| 6380 | lhs: Air.Inst.Ref, | 6660 | lhs: Air.Inst.Ref, |
| ... | @@ -7035,7 +7315,7 @@ fn analyzeArithmetic( | ... | @@ -7035,7 +7315,7 @@ fn analyzeArithmetic( |
| 7035 | return block.addBinOp(rs.air_tag, casted_lhs, casted_rhs); | 7315 | return block.addBinOp(rs.air_tag, casted_lhs, casted_rhs); |
| 7036 | } | 7316 | } |
| 7037 | | 7317 | |
| 7038 | fn zirLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7318 | fn zirLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7039 | const tracy = trace(@src()); | 7319 | const tracy = trace(@src()); |
| 7040 | defer tracy.end(); | 7320 | defer tracy.end(); |
| 7041 | | 7321 | |
| ... | @@ -7048,7 +7328,7 @@ fn zirLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError! | ... | @@ -7048,7 +7328,7 @@ fn zirLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError! |
| 7048 | | 7328 | |
| 7049 | fn zirAsm( | 7329 | fn zirAsm( |
| 7050 | sema: *Sema, | 7330 | sema: *Sema, |
| 7051 | block: *Scope.Block, | 7331 | block: *Block, |
| 7052 | extended: Zir.Inst.Extended.InstData, | 7332 | extended: Zir.Inst.Extended.InstData, |
| 7053 | inst: Zir.Inst.Index, | 7333 | inst: Zir.Inst.Index, |
| 7054 | ) CompileError!Air.Inst.Ref { | 7334 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -7127,7 +7407,7 @@ fn zirAsm( | ... | @@ -7127,7 +7407,7 @@ fn zirAsm( |
| 7127 | /// Only called for equality operators. See also `zirCmp`. | 7407 | /// Only called for equality operators. See also `zirCmp`. |
| 7128 | fn zirCmpEq( | 7408 | fn zirCmpEq( |
| 7129 | sema: *Sema, | 7409 | sema: *Sema, |
| 7130 | block: *Scope.Block, | 7410 | block: *Block, |
| 7131 | inst: Zir.Inst.Index, | 7411 | inst: Zir.Inst.Index, |
| 7132 | op: std.math.CompareOperator, | 7412 | op: std.math.CompareOperator, |
| 7133 | air_tag: Air.Inst.Tag, | 7413 | air_tag: Air.Inst.Tag, |
| ... | @@ -7216,7 +7496,7 @@ fn zirCmpEq( | ... | @@ -7216,7 +7496,7 @@ fn zirCmpEq( |
| 7216 | | 7496 | |
| 7217 | fn analyzeCmpUnionTag( | 7497 | fn analyzeCmpUnionTag( |
| 7218 | sema: *Sema, | 7498 | sema: *Sema, |
| 7219 | block: *Scope.Block, | 7499 | block: *Block, |
| 7220 | un: Air.Inst.Ref, | 7500 | un: Air.Inst.Ref, |
| 7221 | un_src: LazySrcLoc, | 7501 | un_src: LazySrcLoc, |
| 7222 | tag: Air.Inst.Ref, | 7502 | tag: Air.Inst.Ref, |
| ... | @@ -7239,7 +7519,7 @@ fn analyzeCmpUnionTag( | ... | @@ -7239,7 +7519,7 @@ fn analyzeCmpUnionTag( |
| 7239 | /// Only called for non-equality operators. See also `zirCmpEq`. | 7519 | /// Only called for non-equality operators. See also `zirCmpEq`. |
| 7240 | fn zirCmp( | 7520 | fn zirCmp( |
| 7241 | sema: *Sema, | 7521 | sema: *Sema, |
| 7242 | block: *Scope.Block, | 7522 | block: *Block, |
| 7243 | inst: Zir.Inst.Index, | 7523 | inst: Zir.Inst.Index, |
| 7244 | op: std.math.CompareOperator, | 7524 | op: std.math.CompareOperator, |
| 7245 | ) CompileError!Air.Inst.Ref { | 7525 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -7258,7 +7538,7 @@ fn zirCmp( | ... | @@ -7258,7 +7538,7 @@ fn zirCmp( |
| 7258 | | 7538 | |
| 7259 | fn analyzeCmp( | 7539 | fn analyzeCmp( |
| 7260 | sema: *Sema, | 7540 | sema: *Sema, |
| 7261 | block: *Scope.Block, | 7541 | block: *Block, |
| 7262 | src: LazySrcLoc, | 7542 | src: LazySrcLoc, |
| 7263 | lhs: Air.Inst.Ref, | 7543 | lhs: Air.Inst.Ref, |
| 7264 | rhs: Air.Inst.Ref, | 7544 | rhs: Air.Inst.Ref, |
| ... | @@ -7289,7 +7569,7 @@ fn analyzeCmp( | ... | @@ -7289,7 +7569,7 @@ fn analyzeCmp( |
| 7289 | | 7569 | |
| 7290 | fn cmpSelf( | 7570 | fn cmpSelf( |
| 7291 | sema: *Sema, | 7571 | sema: *Sema, |
| 7292 | block: *Scope.Block, | 7572 | block: *Block, |
| 7293 | casted_lhs: Air.Inst.Ref, | 7573 | casted_lhs: Air.Inst.Ref, |
| 7294 | casted_rhs: Air.Inst.Ref, | 7574 | casted_rhs: Air.Inst.Ref, |
| 7295 | op: std.math.CompareOperator, | 7575 | op: std.math.CompareOperator, |
| ... | @@ -7347,7 +7627,7 @@ fn cmpSelf( | ... | @@ -7347,7 +7627,7 @@ fn cmpSelf( |
| 7347 | /// cmp_neq(x, true ) => not(x) | 7627 | /// cmp_neq(x, true ) => not(x) |
| 7348 | fn runtimeBoolCmp( | 7628 | fn runtimeBoolCmp( |
| 7349 | sema: *Sema, | 7629 | sema: *Sema, |
| 7350 | block: *Scope.Block, | 7630 | block: *Block, |
| 7351 | op: std.math.CompareOperator, | 7631 | op: std.math.CompareOperator, |
| 7352 | lhs: Air.Inst.Ref, | 7632 | lhs: Air.Inst.Ref, |
| 7353 | rhs: bool, | 7633 | rhs: bool, |
| ... | @@ -7361,7 +7641,7 @@ fn runtimeBoolCmp( | ... | @@ -7361,7 +7641,7 @@ fn runtimeBoolCmp( |
| 7361 | } | 7641 | } |
| 7362 | } | 7642 | } |
| 7363 | | 7643 | |
| 7364 | fn zirSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7644 | fn zirSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7365 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 7645 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 7366 | const src = inst_data.src(); | 7646 | const src = inst_data.src(); |
| 7367 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 7647 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| ... | @@ -7402,7 +7682,7 @@ fn zirSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -7402,7 +7682,7 @@ fn zirSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro |
| 7402 | return sema.addIntUnsigned(Type.initTag(.comptime_int), abi_size); | 7682 | return sema.addIntUnsigned(Type.initTag(.comptime_int), abi_size); |
| 7403 | } | 7683 | } |
| 7404 | | 7684 | |
| 7405 | fn zirBitSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7685 | fn zirBitSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7406 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 7686 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 7407 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 7687 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 7408 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); | 7688 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| ... | @@ -7413,17 +7693,17 @@ fn zirBitSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE | ... | @@ -7413,17 +7693,17 @@ fn zirBitSizeOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE |
| 7413 | | 7693 | |
| 7414 | fn zirThis( | 7694 | fn zirThis( |
| 7415 | sema: *Sema, | 7695 | sema: *Sema, |
| 7416 | block: *Scope.Block, | 7696 | block: *Block, |
| 7417 | extended: Zir.Inst.Extended.InstData, | 7697 | extended: Zir.Inst.Extended.InstData, |
| 7418 | ) CompileError!Air.Inst.Ref { | 7698 | ) CompileError!Air.Inst.Ref { |
| 7419 | const this_decl = block.base.namespace().getDecl(); | 7699 | const this_decl = block.namespace.getDecl(); |
| 7420 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; | 7700 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 7421 | return sema.analyzeDeclVal(block, src, this_decl); | 7701 | return sema.analyzeDeclVal(block, src, this_decl); |
| 7422 | } | 7702 | } |
| 7423 | | 7703 | |
| 7424 | fn zirClosureCapture( | 7704 | fn zirClosureCapture( |
| 7425 | sema: *Sema, | 7705 | sema: *Sema, |
| 7426 | block: *Scope.Block, | 7706 | block: *Block, |
| 7427 | inst: Zir.Inst.Index, | 7707 | inst: Zir.Inst.Index, |
| 7428 | ) CompileError!void { | 7708 | ) CompileError!void { |
| 7429 | // TODO: Compile error when closed over values are modified | 7709 | // TODO: Compile error when closed over values are modified |
| ... | @@ -7437,7 +7717,7 @@ fn zirClosureCapture( | ... | @@ -7437,7 +7717,7 @@ fn zirClosureCapture( |
| 7437 | | 7717 | |
| 7438 | fn zirClosureGet( | 7718 | fn zirClosureGet( |
| 7439 | sema: *Sema, | 7719 | sema: *Sema, |
| 7440 | block: *Scope.Block, | 7720 | block: *Block, |
| 7441 | inst: Zir.Inst.Index, | 7721 | inst: Zir.Inst.Index, |
| 7442 | ) CompileError!Air.Inst.Ref { | 7722 | ) CompileError!Air.Inst.Ref { |
| 7443 | // TODO CLOSURE: Test this with inline functions | 7723 | // TODO CLOSURE: Test this with inline functions |
| ... | @@ -7459,7 +7739,7 @@ fn zirClosureGet( | ... | @@ -7459,7 +7739,7 @@ fn zirClosureGet( |
| 7459 | | 7739 | |
| 7460 | fn zirRetAddr( | 7740 | fn zirRetAddr( |
| 7461 | sema: *Sema, | 7741 | sema: *Sema, |
| 7462 | block: *Scope.Block, | 7742 | block: *Block, |
| 7463 | extended: Zir.Inst.Extended.InstData, | 7743 | extended: Zir.Inst.Extended.InstData, |
| 7464 | ) CompileError!Air.Inst.Ref { | 7744 | ) CompileError!Air.Inst.Ref { |
| 7465 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; | 7745 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| ... | @@ -7468,14 +7748,14 @@ fn zirRetAddr( | ... | @@ -7468,14 +7748,14 @@ fn zirRetAddr( |
| 7468 | | 7748 | |
| 7469 | fn zirBuiltinSrc( | 7749 | fn zirBuiltinSrc( |
| 7470 | sema: *Sema, | 7750 | sema: *Sema, |
| 7471 | block: *Scope.Block, | 7751 | block: *Block, |
| 7472 | extended: Zir.Inst.Extended.InstData, | 7752 | extended: Zir.Inst.Extended.InstData, |
| 7473 | ) CompileError!Air.Inst.Ref { | 7753 | ) CompileError!Air.Inst.Ref { |
| 7474 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; | 7754 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 7475 | return sema.fail(block, src, "TODO: implement Sema.zirBuiltinSrc", .{}); | 7755 | return sema.fail(block, src, "TODO: implement Sema.zirBuiltinSrc", .{}); |
| 7476 | } | 7756 | } |
| 7477 | | 7757 | |
| 7478 | fn zirTypeInfo(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7758 | fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7479 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 7759 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 7480 | const src = inst_data.src(); | 7760 | const src = inst_data.src(); |
| 7481 | const ty = try sema.resolveType(block, src, inst_data.operand); | 7761 | const ty = try sema.resolveType(block, src, inst_data.operand); |
| ... | @@ -7680,7 +7960,7 @@ fn zirTypeInfo(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -7680,7 +7960,7 @@ fn zirTypeInfo(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 7680 | } | 7960 | } |
| 7681 | } | 7961 | } |
| 7682 | | 7962 | |
| 7683 | fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7963 | fn zirTypeof(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7684 | _ = block; | 7964 | _ = block; |
| 7685 | const zir_datas = sema.code.instructions.items(.data); | 7965 | const zir_datas = sema.code.instructions.items(.data); |
| 7686 | const inst_data = zir_datas[inst].un_node; | 7966 | const inst_data = zir_datas[inst].un_node; |
| ... | @@ -7689,7 +7969,7 @@ fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -7689,7 +7969,7 @@ fn zirTypeof(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro |
| 7689 | return sema.addType(operand_ty); | 7969 | return sema.addType(operand_ty); |
| 7690 | } | 7970 | } |
| 7691 | | 7971 | |
| 7692 | fn zirTypeofElem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7972 | fn zirTypeofElem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7693 | _ = block; | 7973 | _ = block; |
| 7694 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 7974 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 7695 | const operand_ptr = sema.resolveInst(inst_data.operand); | 7975 | const operand_ptr = sema.resolveInst(inst_data.operand); |
| ... | @@ -7697,7 +7977,7 @@ fn zirTypeofElem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile | ... | @@ -7697,7 +7977,7 @@ fn zirTypeofElem(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile |
| 7697 | return sema.addType(elem_ty); | 7977 | return sema.addType(elem_ty); |
| 7698 | } | 7978 | } |
| 7699 | | 7979 | |
| 7700 | fn zirTypeofLog2IntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7980 | fn zirTypeofLog2IntType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7701 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 7981 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 7702 | const src = inst_data.src(); | 7982 | const src = inst_data.src(); |
| 7703 | const operand = sema.resolveInst(inst_data.operand); | 7983 | const operand = sema.resolveInst(inst_data.operand); |
| ... | @@ -7705,14 +7985,14 @@ fn zirTypeofLog2IntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) | ... | @@ -7705,14 +7985,14 @@ fn zirTypeofLog2IntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) |
| 7705 | return sema.log2IntType(block, operand_ty, src); | 7985 | return sema.log2IntType(block, operand_ty, src); |
| 7706 | } | 7986 | } |
| 7707 | | 7987 | |
| 7708 | fn zirLog2IntType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7988 | fn zirLog2IntType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7709 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 7989 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 7710 | const src = inst_data.src(); | 7990 | const src = inst_data.src(); |
| 7711 | const operand = try sema.resolveType(block, src, inst_data.operand); | 7991 | const operand = try sema.resolveType(block, src, inst_data.operand); |
| 7712 | return sema.log2IntType(block, operand, src); | 7992 | return sema.log2IntType(block, operand, src); |
| 7713 | } | 7993 | } |
| 7714 | | 7994 | |
| 7715 | fn log2IntType(sema: *Sema, block: *Scope.Block, operand: Type, src: LazySrcLoc) CompileError!Air.Inst.Ref { | 7995 | fn log2IntType(sema: *Sema, block: *Block, operand: Type, src: LazySrcLoc) CompileError!Air.Inst.Ref { |
| 7716 | switch (operand.zigTypeTag()) { | 7996 | switch (operand.zigTypeTag()) { |
| 7717 | .ComptimeInt => return Air.Inst.Ref.comptime_int_type, | 7997 | .ComptimeInt => return Air.Inst.Ref.comptime_int_type, |
| 7718 | .Int => { | 7998 | .Int => { |
| ... | @@ -7735,7 +8015,7 @@ fn log2IntType(sema: *Sema, block: *Scope.Block, operand: Type, src: LazySrcLoc) | ... | @@ -7735,7 +8015,7 @@ fn log2IntType(sema: *Sema, block: *Scope.Block, operand: Type, src: LazySrcLoc) |
| 7735 | | 8015 | |
| 7736 | fn zirTypeofPeer( | 8016 | fn zirTypeofPeer( |
| 7737 | sema: *Sema, | 8017 | sema: *Sema, |
| 7738 | block: *Scope.Block, | 8018 | block: *Block, |
| 7739 | extended: Zir.Inst.Extended.InstData, | 8019 | extended: Zir.Inst.Extended.InstData, |
| 7740 | ) CompileError!Air.Inst.Ref { | 8020 | ) CompileError!Air.Inst.Ref { |
| 7741 | const tracy = trace(@src()); | 8021 | const tracy = trace(@src()); |
| ... | @@ -7756,7 +8036,7 @@ fn zirTypeofPeer( | ... | @@ -7756,7 +8036,7 @@ fn zirTypeofPeer( |
| 7756 | return sema.addType(result_type); | 8036 | return sema.addType(result_type); |
| 7757 | } | 8037 | } |
| 7758 | | 8038 | |
| 7759 | fn zirBoolNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8039 | fn zirBoolNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7760 | const tracy = trace(@src()); | 8040 | const tracy = trace(@src()); |
| 7761 | defer tracy.end(); | 8041 | defer tracy.end(); |
| 7762 | | 8042 | |
| ... | @@ -7780,7 +8060,7 @@ fn zirBoolNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -7780,7 +8060,7 @@ fn zirBoolNot(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 7780 | | 8060 | |
| 7781 | fn zirBoolBr( | 8061 | fn zirBoolBr( |
| 7782 | sema: *Sema, | 8062 | sema: *Sema, |
| 7783 | parent_block: *Scope.Block, | 8063 | parent_block: *Block, |
| 7784 | inst: Zir.Inst.Index, | 8064 | inst: Zir.Inst.Index, |
| 7785 | is_bool_or: bool, | 8065 | is_bool_or: bool, |
| 7786 | ) CompileError!Air.Inst.Ref { | 8066 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -7866,7 +8146,7 @@ fn zirBoolBr( | ... | @@ -7866,7 +8146,7 @@ fn zirBoolBr( |
| 7866 | | 8146 | |
| 7867 | fn zirIsNonNull( | 8147 | fn zirIsNonNull( |
| 7868 | sema: *Sema, | 8148 | sema: *Sema, |
| 7869 | block: *Scope.Block, | 8149 | block: *Block, |
| 7870 | inst: Zir.Inst.Index, | 8150 | inst: Zir.Inst.Index, |
| 7871 | ) CompileError!Air.Inst.Ref { | 8151 | ) CompileError!Air.Inst.Ref { |
| 7872 | const tracy = trace(@src()); | 8152 | const tracy = trace(@src()); |
| ... | @@ -7880,7 +8160,7 @@ fn zirIsNonNull( | ... | @@ -7880,7 +8160,7 @@ fn zirIsNonNull( |
| 7880 | | 8160 | |
| 7881 | fn zirIsNonNullPtr( | 8161 | fn zirIsNonNullPtr( |
| 7882 | sema: *Sema, | 8162 | sema: *Sema, |
| 7883 | block: *Scope.Block, | 8163 | block: *Block, |
| 7884 | inst: Zir.Inst.Index, | 8164 | inst: Zir.Inst.Index, |
| 7885 | ) CompileError!Air.Inst.Ref { | 8165 | ) CompileError!Air.Inst.Ref { |
| 7886 | const tracy = trace(@src()); | 8166 | const tracy = trace(@src()); |
| ... | @@ -7893,7 +8173,7 @@ fn zirIsNonNullPtr( | ... | @@ -7893,7 +8173,7 @@ fn zirIsNonNullPtr( |
| 7893 | return sema.analyzeIsNull(block, src, loaded, true); | 8173 | return sema.analyzeIsNull(block, src, loaded, true); |
| 7894 | } | 8174 | } |
| 7895 | | 8175 | |
| 7896 | fn zirIsNonErr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8176 | fn zirIsNonErr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7897 | const tracy = trace(@src()); | 8177 | const tracy = trace(@src()); |
| 7898 | defer tracy.end(); | 8178 | defer tracy.end(); |
| 7899 | | 8179 | |
| ... | @@ -7902,7 +8182,7 @@ fn zirIsNonErr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -7902,7 +8182,7 @@ fn zirIsNonErr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 7902 | return sema.analyzeIsNonErr(block, inst_data.src(), operand); | 8182 | return sema.analyzeIsNonErr(block, inst_data.src(), operand); |
| 7903 | } | 8183 | } |
| 7904 | | 8184 | |
| 7905 | fn zirIsNonErrPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8185 | fn zirIsNonErrPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7906 | const tracy = trace(@src()); | 8186 | const tracy = trace(@src()); |
| 7907 | defer tracy.end(); | 8187 | defer tracy.end(); |
| 7908 | | 8188 | |
| ... | @@ -7915,7 +8195,7 @@ fn zirIsNonErrPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil | ... | @@ -7915,7 +8195,7 @@ fn zirIsNonErrPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil |
| 7915 | | 8195 | |
| 7916 | fn zirCondbr( | 8196 | fn zirCondbr( |
| 7917 | sema: *Sema, | 8197 | sema: *Sema, |
| 7918 | parent_block: *Scope.Block, | 8198 | parent_block: *Block, |
| 7919 | inst: Zir.Inst.Index, | 8199 | inst: Zir.Inst.Index, |
| 7920 | ) CompileError!Zir.Inst.Index { | 8200 | ) CompileError!Zir.Inst.Index { |
| 7921 | const tracy = trace(@src()); | 8201 | const tracy = trace(@src()); |
| ... | @@ -7970,7 +8250,7 @@ fn zirCondbr( | ... | @@ -7970,7 +8250,7 @@ fn zirCondbr( |
| 7970 | return always_noreturn; | 8250 | return always_noreturn; |
| 7971 | } | 8251 | } |
| 7972 | | 8252 | |
| 7973 | fn zirUnreachable(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { | 8253 | fn zirUnreachable(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 7974 | const tracy = trace(@src()); | 8254 | const tracy = trace(@src()); |
| 7975 | defer tracy.end(); | 8255 | defer tracy.end(); |
| 7976 | | 8256 | |
| ... | @@ -7989,7 +8269,7 @@ fn zirUnreachable(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil | ... | @@ -7989,7 +8269,7 @@ fn zirUnreachable(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil |
| 7989 | | 8269 | |
| 7990 | fn zirRetErrValue( | 8270 | fn zirRetErrValue( |
| 7991 | sema: *Sema, | 8271 | sema: *Sema, |
| 7992 | block: *Scope.Block, | 8272 | block: *Block, |
| 7993 | inst: Zir.Inst.Index, | 8273 | inst: Zir.Inst.Index, |
| 7994 | ) CompileError!Zir.Inst.Index { | 8274 | ) CompileError!Zir.Inst.Index { |
| 7995 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; | 8275 | const inst_data = sema.code.instructions.items(.data)[inst].str_tok; |
| ... | @@ -8013,7 +8293,7 @@ fn zirRetErrValue( | ... | @@ -8013,7 +8293,7 @@ fn zirRetErrValue( |
| 8013 | | 8293 | |
| 8014 | fn zirRetCoerce( | 8294 | fn zirRetCoerce( |
| 8015 | sema: *Sema, | 8295 | sema: *Sema, |
| 8016 | block: *Scope.Block, | 8296 | block: *Block, |
| 8017 | inst: Zir.Inst.Index, | 8297 | inst: Zir.Inst.Index, |
| 8018 | ) CompileError!Zir.Inst.Index { | 8298 | ) CompileError!Zir.Inst.Index { |
| 8019 | const tracy = trace(@src()); | 8299 | const tracy = trace(@src()); |
| ... | @@ -8026,7 +8306,7 @@ fn zirRetCoerce( | ... | @@ -8026,7 +8306,7 @@ fn zirRetCoerce( |
| 8026 | return sema.analyzeRet(block, operand, src, true); | 8306 | return sema.analyzeRet(block, operand, src, true); |
| 8027 | } | 8307 | } |
| 8028 | | 8308 | |
| 8029 | fn zirRetNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { | 8309 | fn zirRetNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 8030 | const tracy = trace(@src()); | 8310 | const tracy = trace(@src()); |
| 8031 | defer tracy.end(); | 8311 | defer tracy.end(); |
| 8032 | | 8312 | |
| ... | @@ -8041,7 +8321,7 @@ fn zirRetNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -8041,7 +8321,7 @@ fn zirRetNode(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 8041 | return sema.analyzeRet(block, operand, src, false); | 8321 | return sema.analyzeRet(block, operand, src, false); |
| 8042 | } | 8322 | } |
| 8043 | | 8323 | |
| 8044 | fn zirRetLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { | 8324 | fn zirRetLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| 8045 | const tracy = trace(@src()); | 8325 | const tracy = trace(@src()); |
| 8046 | defer tracy.end(); | 8326 | defer tracy.end(); |
| 8047 | | 8327 | |
| ... | @@ -8058,7 +8338,7 @@ fn zirRetLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -8058,7 +8338,7 @@ fn zirRetLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 8058 | | 8338 | |
| 8059 | fn analyzeRet( | 8339 | fn analyzeRet( |
| 8060 | sema: *Sema, | 8340 | sema: *Sema, |
| 8061 | block: *Scope.Block, | 8341 | block: *Block, |
| 8062 | uncasted_operand: Air.Inst.Ref, | 8342 | uncasted_operand: Air.Inst.Ref, |
| 8063 | src: LazySrcLoc, | 8343 | src: LazySrcLoc, |
| 8064 | need_coercion: bool, | 8344 | need_coercion: bool, |
| ... | @@ -8091,7 +8371,7 @@ fn floatOpAllowed(tag: Zir.Inst.Tag) bool { | ... | @@ -8091,7 +8371,7 @@ fn floatOpAllowed(tag: Zir.Inst.Tag) bool { |
| 8091 | }; | 8371 | }; |
| 8092 | } | 8372 | } |
| 8093 | | 8373 | |
| 8094 | fn zirPtrTypeSimple(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8374 | fn zirPtrTypeSimple(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8095 | const tracy = trace(@src()); | 8375 | const tracy = trace(@src()); |
| 8096 | defer tracy.end(); | 8376 | defer tracy.end(); |
| 8097 | | 8377 | |
| ... | @@ -8108,7 +8388,7 @@ fn zirPtrTypeSimple(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Comp | ... | @@ -8108,7 +8388,7 @@ fn zirPtrTypeSimple(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Comp |
| 8108 | return sema.addType(ty); | 8388 | return sema.addType(ty); |
| 8109 | } | 8389 | } |
| 8110 | | 8390 | |
| 8111 | fn zirPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8391 | fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8112 | const tracy = trace(@src()); | 8392 | const tracy = trace(@src()); |
| 8113 | defer tracy.end(); | 8393 | defer tracy.end(); |
| 8114 | | 8394 | |
| ... | @@ -8168,7 +8448,7 @@ fn zirPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -8168,7 +8448,7 @@ fn zirPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 8168 | return sema.addType(ty); | 8448 | return sema.addType(ty); |
| 8169 | } | 8449 | } |
| 8170 | | 8450 | |
| 8171 | fn zirStructInitEmpty(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8451 | fn zirStructInitEmpty(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8172 | const tracy = trace(@src()); | 8452 | const tracy = trace(@src()); |
| 8173 | defer tracy.end(); | 8453 | defer tracy.end(); |
| 8174 | | 8454 | |
| ... | @@ -8179,13 +8459,13 @@ fn zirStructInitEmpty(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Co | ... | @@ -8179,13 +8459,13 @@ fn zirStructInitEmpty(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Co |
| 8179 | return sema.addConstant(struct_type, Value.initTag(.empty_struct_value)); | 8459 | return sema.addConstant(struct_type, Value.initTag(.empty_struct_value)); |
| 8180 | } | 8460 | } |
| 8181 | | 8461 | |
| 8182 | fn zirUnionInitPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8462 | fn zirUnionInitPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8183 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 8463 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8184 | const src = inst_data.src(); | 8464 | const src = inst_data.src(); |
| 8185 | return sema.fail(block, src, "TODO: Sema.zirUnionInitPtr", .{}); | 8465 | return sema.fail(block, src, "TODO: Sema.zirUnionInitPtr", .{}); |
| 8186 | } | 8466 | } |
| 8187 | | 8467 | |
| 8188 | fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { | 8468 | fn zirStructInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { |
| 8189 | const gpa = sema.gpa; | 8469 | const gpa = sema.gpa; |
| 8190 | const zir_datas = sema.code.instructions.items(.data); | 8470 | const zir_datas = sema.code.instructions.items(.data); |
| 8191 | const inst_data = zir_datas[inst].pl_node; | 8471 | const inst_data = zir_datas[inst].pl_node; |
| ... | @@ -8326,7 +8606,7 @@ fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: | ... | @@ -8326,7 +8606,7 @@ fn zirStructInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: |
| 8326 | unreachable; | 8606 | unreachable; |
| 8327 | } | 8607 | } |
| 8328 | | 8608 | |
| 8329 | fn zirStructInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { | 8609 | fn zirStructInitAnon(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { |
| 8330 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 8610 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8331 | const src = inst_data.src(); | 8611 | const src = inst_data.src(); |
| 8332 | | 8612 | |
| ... | @@ -8334,7 +8614,7 @@ fn zirStructInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ | ... | @@ -8334,7 +8614,7 @@ fn zirStructInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ |
| 8334 | return sema.fail(block, src, "TODO: Sema.zirStructInitAnon", .{}); | 8614 | return sema.fail(block, src, "TODO: Sema.zirStructInitAnon", .{}); |
| 8335 | } | 8615 | } |
| 8336 | | 8616 | |
| 8337 | fn zirArrayInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { | 8617 | fn zirArrayInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { |
| 8338 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 8618 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8339 | const src = inst_data.src(); | 8619 | const src = inst_data.src(); |
| 8340 | | 8620 | |
| ... | @@ -8386,7 +8666,7 @@ fn zirArrayInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: | ... | @@ -8386,7 +8666,7 @@ fn zirArrayInit(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: |
| 8386 | try sema.analyzeLoad(block, .unneeded, alloc, .unneeded); | 8666 | try sema.analyzeLoad(block, .unneeded, alloc, .unneeded); |
| 8387 | } | 8667 | } |
| 8388 | | 8668 | |
| 8389 | fn zirArrayInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { | 8669 | fn zirArrayInitAnon(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is_ref: bool) CompileError!Air.Inst.Ref { |
| 8390 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 8670 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8391 | const src = inst_data.src(); | 8671 | const src = inst_data.src(); |
| 8392 | | 8672 | |
| ... | @@ -8394,13 +8674,13 @@ fn zirArrayInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_r | ... | @@ -8394,13 +8674,13 @@ fn zirArrayInitAnon(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index, is_r |
| 8394 | return sema.fail(block, src, "TODO: Sema.zirArrayInitAnon", .{}); | 8674 | return sema.fail(block, src, "TODO: Sema.zirArrayInitAnon", .{}); |
| 8395 | } | 8675 | } |
| 8396 | | 8676 | |
| 8397 | fn zirFieldTypeRef(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8677 | fn zirFieldTypeRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8398 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 8678 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8399 | const src = inst_data.src(); | 8679 | const src = inst_data.src(); |
| 8400 | return sema.fail(block, src, "TODO: Sema.zirFieldTypeRef", .{}); | 8680 | return sema.fail(block, src, "TODO: Sema.zirFieldTypeRef", .{}); |
| 8401 | } | 8681 | } |
| 8402 | | 8682 | |
| 8403 | fn zirFieldType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8683 | fn zirFieldType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8404 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 8684 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8405 | const extra = sema.code.extraData(Zir.Inst.FieldType, inst_data.payload_index).data; | 8685 | const extra = sema.code.extraData(Zir.Inst.FieldType, inst_data.payload_index).data; |
| 8406 | const src = inst_data.src(); | 8686 | const src = inst_data.src(); |
| ... | @@ -8428,7 +8708,7 @@ fn zirFieldType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE | ... | @@ -8428,7 +8708,7 @@ fn zirFieldType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE |
| 8428 | | 8708 | |
| 8429 | fn zirErrorReturnTrace( | 8709 | fn zirErrorReturnTrace( |
| 8430 | sema: *Sema, | 8710 | sema: *Sema, |
| 8431 | block: *Scope.Block, | 8711 | block: *Block, |
| 8432 | extended: Zir.Inst.Extended.InstData, | 8712 | extended: Zir.Inst.Extended.InstData, |
| 8433 | ) CompileError!Air.Inst.Ref { | 8713 | ) CompileError!Air.Inst.Ref { |
| 8434 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; | 8714 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| ... | @@ -8437,7 +8717,7 @@ fn zirErrorReturnTrace( | ... | @@ -8437,7 +8717,7 @@ fn zirErrorReturnTrace( |
| 8437 | | 8717 | |
| 8438 | fn zirFrame( | 8718 | fn zirFrame( |
| 8439 | sema: *Sema, | 8719 | sema: *Sema, |
| 8440 | block: *Scope.Block, | 8720 | block: *Block, |
| 8441 | extended: Zir.Inst.Extended.InstData, | 8721 | extended: Zir.Inst.Extended.InstData, |
| 8442 | ) CompileError!Air.Inst.Ref { | 8722 | ) CompileError!Air.Inst.Ref { |
| 8443 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; | 8723 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| ... | @@ -8446,14 +8726,14 @@ fn zirFrame( | ... | @@ -8446,14 +8726,14 @@ fn zirFrame( |
| 8446 | | 8726 | |
| 8447 | fn zirFrameAddress( | 8727 | fn zirFrameAddress( |
| 8448 | sema: *Sema, | 8728 | sema: *Sema, |
| 8449 | block: *Scope.Block, | 8729 | block: *Block, |
| 8450 | extended: Zir.Inst.Extended.InstData, | 8730 | extended: Zir.Inst.Extended.InstData, |
| 8451 | ) CompileError!Air.Inst.Ref { | 8731 | ) CompileError!Air.Inst.Ref { |
| 8452 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; | 8732 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 8453 | return sema.fail(block, src, "TODO: Sema.zirFrameAddress", .{}); | 8733 | return sema.fail(block, src, "TODO: Sema.zirFrameAddress", .{}); |
| 8454 | } | 8734 | } |
| 8455 | | 8735 | |
| 8456 | fn zirAlignOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8736 | fn zirAlignOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8457 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 8737 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8458 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 8738 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 8459 | const ty = try sema.resolveType(block, operand_src, inst_data.operand); | 8739 | const ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| ... | @@ -8462,7 +8742,7 @@ fn zirAlignOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -8462,7 +8742,7 @@ fn zirAlignOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 8462 | return sema.addIntUnsigned(Type.comptime_int, abi_align); | 8742 | return sema.addIntUnsigned(Type.comptime_int, abi_align); |
| 8463 | } | 8743 | } |
| 8464 | | 8744 | |
| 8465 | fn zirBoolToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8745 | fn zirBoolToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8466 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 8746 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8467 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 8747 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 8468 | const operand = sema.resolveInst(inst_data.operand); | 8748 | const operand = sema.resolveInst(inst_data.operand); |
| ... | @@ -8474,31 +8754,31 @@ fn zirBoolToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE | ... | @@ -8474,31 +8754,31 @@ fn zirBoolToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE |
| 8474 | return block.addUnOp(.bool_to_int, operand); | 8754 | return block.addUnOp(.bool_to_int, operand); |
| 8475 | } | 8755 | } |
| 8476 | | 8756 | |
| 8477 | fn zirEmbedFile(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8757 | fn zirEmbedFile(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8478 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 8758 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8479 | const src = inst_data.src(); | 8759 | const src = inst_data.src(); |
| 8480 | return sema.fail(block, src, "TODO: Sema.zirEmbedFile", .{}); | 8760 | return sema.fail(block, src, "TODO: Sema.zirEmbedFile", .{}); |
| 8481 | } | 8761 | } |
| 8482 | | 8762 | |
| 8483 | fn zirErrorName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8763 | fn zirErrorName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8484 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 8764 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8485 | const src = inst_data.src(); | 8765 | const src = inst_data.src(); |
| 8486 | return sema.fail(block, src, "TODO: Sema.zirErrorName", .{}); | 8766 | return sema.fail(block, src, "TODO: Sema.zirErrorName", .{}); |
| 8487 | } | 8767 | } |
| 8488 | | 8768 | |
| 8489 | fn zirUnaryMath(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8769 | fn zirUnaryMath(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8490 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 8770 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8491 | const src = inst_data.src(); | 8771 | const src = inst_data.src(); |
| 8492 | return sema.fail(block, src, "TODO: Sema.zirUnaryMath", .{}); | 8772 | return sema.fail(block, src, "TODO: Sema.zirUnaryMath", .{}); |
| 8493 | } | 8773 | } |
| 8494 | | 8774 | |
| 8495 | fn zirTagName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8775 | fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8496 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 8776 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8497 | const src = inst_data.src(); | 8777 | const src = inst_data.src(); |
| 8498 | return sema.fail(block, src, "TODO: Sema.zirTagName", .{}); | 8778 | return sema.fail(block, src, "TODO: Sema.zirTagName", .{}); |
| 8499 | } | 8779 | } |
| 8500 | | 8780 | |
| 8501 | fn zirReify(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8781 | fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8502 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 8782 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8503 | const src = inst_data.src(); | 8783 | const src = inst_data.src(); |
| 8504 | const type_info_ty = try sema.getBuiltinType(block, src, "TypeInfo"); | 8784 | const type_info_ty = try sema.getBuiltinType(block, src, "TypeInfo"); |
| ... | @@ -8551,32 +8831,32 @@ fn zirReify(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError | ... | @@ -8551,32 +8831,32 @@ fn zirReify(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError |
| 8551 | } | 8831 | } |
| 8552 | } | 8832 | } |
| 8553 | | 8833 | |
| 8554 | fn zirTypeName(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8834 | fn zirTypeName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8555 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 8835 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8556 | const src = inst_data.src(); | 8836 | const src = inst_data.src(); |
| 8557 | return sema.fail(block, src, "TODO: Sema.zirTypeName", .{}); | 8837 | return sema.fail(block, src, "TODO: Sema.zirTypeName", .{}); |
| 8558 | } | 8838 | } |
| 8559 | | 8839 | |
| 8560 | fn zirFrameType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8840 | fn zirFrameType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8561 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 8841 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8562 | const src = inst_data.src(); | 8842 | const src = inst_data.src(); |
| 8563 | return sema.fail(block, src, "TODO: Sema.zirFrameType", .{}); | 8843 | return sema.fail(block, src, "TODO: Sema.zirFrameType", .{}); |
| 8564 | } | 8844 | } |
| 8565 | | 8845 | |
| 8566 | fn zirFrameSize(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8846 | fn zirFrameSize(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8567 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 8847 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8568 | const src = inst_data.src(); | 8848 | const src = inst_data.src(); |
| 8569 | return sema.fail(block, src, "TODO: Sema.zirFrameSize", .{}); | 8849 | return sema.fail(block, src, "TODO: Sema.zirFrameSize", .{}); |
| 8570 | } | 8850 | } |
| 8571 | | 8851 | |
| 8572 | fn zirFloatToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8852 | fn zirFloatToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8573 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 8853 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8574 | const src = inst_data.src(); | 8854 | const src = inst_data.src(); |
| 8575 | // TODO don't forget the safety check! | 8855 | // TODO don't forget the safety check! |
| 8576 | return sema.fail(block, src, "TODO: Sema.zirFloatToInt", .{}); | 8856 | return sema.fail(block, src, "TODO: Sema.zirFloatToInt", .{}); |
| 8577 | } | 8857 | } |
| 8578 | | 8858 | |
| 8579 | fn zirIntToFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8859 | fn zirIntToFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8580 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 8860 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8581 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 8861 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 8582 | const ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 8862 | const ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| ... | @@ -8598,7 +8878,7 @@ fn zirIntToFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile | ... | @@ -8598,7 +8878,7 @@ fn zirIntToFloat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile |
| 8598 | return block.addTyOp(.int_to_float, dest_ty, operand); | 8878 | return block.addTyOp(.int_to_float, dest_ty, operand); |
| 8599 | } | 8879 | } |
| 8600 | | 8880 | |
| 8601 | fn zirIntToPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8881 | fn zirIntToPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8602 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 8882 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8603 | const src = inst_data.src(); | 8883 | const src = inst_data.src(); |
| 8604 | | 8884 | |
| ... | @@ -8654,13 +8934,13 @@ fn zirIntToPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -8654,13 +8934,13 @@ fn zirIntToPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 8654 | return block.addTyOp(.bitcast, type_res, operand_coerced); | 8934 | return block.addTyOp(.bitcast, type_res, operand_coerced); |
| 8655 | } | 8935 | } |
| 8656 | | 8936 | |
| 8657 | fn zirErrSetCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8937 | fn zirErrSetCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8658 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 8938 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8659 | const src = inst_data.src(); | 8939 | const src = inst_data.src(); |
| 8660 | return sema.fail(block, src, "TODO: Sema.zirErrSetCast", .{}); | 8940 | return sema.fail(block, src, "TODO: Sema.zirErrSetCast", .{}); |
| 8661 | } | 8941 | } |
| 8662 | | 8942 | |
| 8663 | fn zirPtrCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8943 | fn zirPtrCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8664 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 8944 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8665 | const dest_ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 8945 | const dest_ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 8666 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 8946 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| ... | @@ -8684,7 +8964,7 @@ fn zirPtrCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -8684,7 +8964,7 @@ fn zirPtrCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErr |
| 8684 | return block.addTyOp(.bitcast, dest_ty, operand); | 8964 | return block.addTyOp(.bitcast, dest_ty, operand); |
| 8685 | } | 8965 | } |
| 8686 | | 8966 | |
| 8687 | fn zirTruncate(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 8967 | fn zirTruncate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8688 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 8968 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8689 | const src = inst_data.src(); | 8969 | const src = inst_data.src(); |
| 8690 | const dest_ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 8970 | const dest_ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| ... | @@ -8744,13 +9024,13 @@ fn zirTruncate(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -8744,13 +9024,13 @@ fn zirTruncate(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileEr |
| 8744 | return block.addTyOp(.trunc, dest_ty, operand); | 9024 | return block.addTyOp(.trunc, dest_ty, operand); |
| 8745 | } | 9025 | } |
| 8746 | | 9026 | |
| 8747 | fn zirAlignCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9027 | fn zirAlignCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8748 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9028 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8749 | const src = inst_data.src(); | 9029 | const src = inst_data.src(); |
| 8750 | return sema.fail(block, src, "TODO: Sema.zirAlignCast", .{}); | 9030 | return sema.fail(block, src, "TODO: Sema.zirAlignCast", .{}); |
| 8751 | } | 9031 | } |
| 8752 | | 9032 | |
| 8753 | fn zirClz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9033 | fn zirClz(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8754 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 9034 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8755 | const ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 9035 | const ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 8756 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 9036 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| ... | @@ -8777,7 +9057,7 @@ fn zirClz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -8777,7 +9057,7 @@ fn zirClz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A |
| 8777 | return block.addTyOp(.clz, result_ty, operand); | 9057 | return block.addTyOp(.clz, result_ty, operand); |
| 8778 | } | 9058 | } |
| 8779 | | 9059 | |
| 8780 | fn zirCtz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9060 | fn zirCtz(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8781 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 9061 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8782 | const ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 9062 | const ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 8783 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 9063 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| ... | @@ -8804,62 +9084,62 @@ fn zirCtz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -8804,62 +9084,62 @@ fn zirCtz(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!A |
| 8804 | return block.addTyOp(.ctz, result_ty, operand); | 9084 | return block.addTyOp(.ctz, result_ty, operand); |
| 8805 | } | 9085 | } |
| 8806 | | 9086 | |
| 8807 | fn zirPopCount(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9087 | fn zirPopCount(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8808 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 9088 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8809 | const src = inst_data.src(); | 9089 | const src = inst_data.src(); |
| 8810 | return sema.fail(block, src, "TODO: Sema.zirPopCount", .{}); | 9090 | return sema.fail(block, src, "TODO: Sema.zirPopCount", .{}); |
| 8811 | } | 9091 | } |
| 8812 | | 9092 | |
| 8813 | fn zirByteSwap(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9093 | fn zirByteSwap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8814 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 9094 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8815 | const src = inst_data.src(); | 9095 | const src = inst_data.src(); |
| 8816 | return sema.fail(block, src, "TODO: Sema.zirByteSwap", .{}); | 9096 | return sema.fail(block, src, "TODO: Sema.zirByteSwap", .{}); |
| 8817 | } | 9097 | } |
| 8818 | | 9098 | |
| 8819 | fn zirBitReverse(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9099 | fn zirBitReverse(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8820 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 9100 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 8821 | const src = inst_data.src(); | 9101 | const src = inst_data.src(); |
| 8822 | return sema.fail(block, src, "TODO: Sema.zirBitReverse", .{}); | 9102 | return sema.fail(block, src, "TODO: Sema.zirBitReverse", .{}); |
| 8823 | } | 9103 | } |
| 8824 | | 9104 | |
| 8825 | fn zirDivExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9105 | fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8826 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9106 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8827 | const src = inst_data.src(); | 9107 | const src = inst_data.src(); |
| 8828 | return sema.fail(block, src, "TODO: Sema.zirDivExact", .{}); | 9108 | return sema.fail(block, src, "TODO: Sema.zirDivExact", .{}); |
| 8829 | } | 9109 | } |
| 8830 | | 9110 | |
| 8831 | fn zirDivFloor(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9111 | fn zirDivFloor(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8832 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9112 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8833 | const src = inst_data.src(); | 9113 | const src = inst_data.src(); |
| 8834 | return sema.fail(block, src, "TODO: Sema.zirDivFloor", .{}); | 9114 | return sema.fail(block, src, "TODO: Sema.zirDivFloor", .{}); |
| 8835 | } | 9115 | } |
| 8836 | | 9116 | |
| 8837 | fn zirDivTrunc(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9117 | fn zirDivTrunc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8838 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9118 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8839 | const src = inst_data.src(); | 9119 | const src = inst_data.src(); |
| 8840 | return sema.fail(block, src, "TODO: Sema.zirDivTrunc", .{}); | 9120 | return sema.fail(block, src, "TODO: Sema.zirDivTrunc", .{}); |
| 8841 | } | 9121 | } |
| 8842 | | 9122 | |
| 8843 | fn zirShrExact(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9123 | fn zirShrExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8844 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9124 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8845 | const src = inst_data.src(); | 9125 | const src = inst_data.src(); |
| 8846 | return sema.fail(block, src, "TODO: Sema.zirShrExact", .{}); | 9126 | return sema.fail(block, src, "TODO: Sema.zirShrExact", .{}); |
| 8847 | } | 9127 | } |
| 8848 | | 9128 | |
| 8849 | fn zirBitOffsetOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9129 | fn zirBitOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8850 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9130 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8851 | const src = inst_data.src(); | 9131 | const src = inst_data.src(); |
| 8852 | return sema.fail(block, src, "TODO: Sema.zirBitOffsetOf", .{}); | 9132 | return sema.fail(block, src, "TODO: Sema.zirBitOffsetOf", .{}); |
| 8853 | } | 9133 | } |
| 8854 | | 9134 | |
| 8855 | fn zirOffsetOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9135 | fn zirOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8856 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9136 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 8857 | const src = inst_data.src(); | 9137 | const src = inst_data.src(); |
| 8858 | return sema.fail(block, src, "TODO: Sema.zirOffsetOf", .{}); | 9138 | return sema.fail(block, src, "TODO: Sema.zirOffsetOf", .{}); |
| 8859 | } | 9139 | } |
| 8860 | | 9140 | |
| 8861 | /// Returns `true` if the type was a comptime_int. | 9141 | /// Returns `true` if the type was a comptime_int. |
| 8862 | fn checkIntType(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, ty: Type) CompileError!bool { | 9142 | fn checkIntType(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileError!bool { |
| 8863 | switch (ty.zigTypeTag()) { | 9143 | switch (ty.zigTypeTag()) { |
| 8864 | .ComptimeInt => return true, | 9144 | .ComptimeInt => return true, |
| 8865 | .Int => return false, | 9145 | .Int => return false, |
| ... | @@ -8869,7 +9149,7 @@ fn checkIntType(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, ty: Type) Com | ... | @@ -8869,7 +9149,7 @@ fn checkIntType(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, ty: Type) Com |
| 8869 | | 9149 | |
| 8870 | fn checkFloatType( | 9150 | fn checkFloatType( |
| 8871 | sema: *Sema, | 9151 | sema: *Sema, |
| 8872 | block: *Scope.Block, | 9152 | block: *Block, |
| 8873 | ty_src: LazySrcLoc, | 9153 | ty_src: LazySrcLoc, |
| 8874 | ty: Type, | 9154 | ty: Type, |
| 8875 | ) CompileError!void { | 9155 | ) CompileError!void { |
| ... | @@ -8883,7 +9163,7 @@ fn checkFloatType( | ... | @@ -8883,7 +9163,7 @@ fn checkFloatType( |
| 8883 | | 9163 | |
| 8884 | fn checkAtomicOperandType( | 9164 | fn checkAtomicOperandType( |
| 8885 | sema: *Sema, | 9165 | sema: *Sema, |
| 8886 | block: *Scope.Block, | 9166 | block: *Block, |
| 8887 | ty_src: LazySrcLoc, | 9167 | ty_src: LazySrcLoc, |
| 8888 | ty: Type, | 9168 | ty: Type, |
| 8889 | ) CompileError!void { | 9169 | ) CompileError!void { |
| ... | @@ -8930,7 +9210,7 @@ fn checkAtomicOperandType( | ... | @@ -8930,7 +9210,7 @@ fn checkAtomicOperandType( |
| 8930 | | 9210 | |
| 8931 | fn resolveExportOptions( | 9211 | fn resolveExportOptions( |
| 8932 | sema: *Sema, | 9212 | sema: *Sema, |
| 8933 | block: *Scope.Block, | 9213 | block: *Block, |
| 8934 | src: LazySrcLoc, | 9214 | src: LazySrcLoc, |
| 8935 | zir_ref: Zir.Inst.Ref, | 9215 | zir_ref: Zir.Inst.Ref, |
| 8936 | ) CompileError!std.builtin.ExportOptions { | 9216 | ) CompileError!std.builtin.ExportOptions { |
| ... | @@ -8955,7 +9235,7 @@ fn resolveExportOptions( | ... | @@ -8955,7 +9235,7 @@ fn resolveExportOptions( |
| 8955 | | 9235 | |
| 8956 | fn resolveAtomicOrder( | 9236 | fn resolveAtomicOrder( |
| 8957 | sema: *Sema, | 9237 | sema: *Sema, |
| 8958 | block: *Scope.Block, | 9238 | block: *Block, |
| 8959 | src: LazySrcLoc, | 9239 | src: LazySrcLoc, |
| 8960 | zir_ref: Zir.Inst.Ref, | 9240 | zir_ref: Zir.Inst.Ref, |
| 8961 | ) CompileError!std.builtin.AtomicOrder { | 9241 | ) CompileError!std.builtin.AtomicOrder { |
| ... | @@ -8968,7 +9248,7 @@ fn resolveAtomicOrder( | ... | @@ -8968,7 +9248,7 @@ fn resolveAtomicOrder( |
| 8968 | | 9248 | |
| 8969 | fn resolveAtomicRmwOp( | 9249 | fn resolveAtomicRmwOp( |
| 8970 | sema: *Sema, | 9250 | sema: *Sema, |
| 8971 | block: *Scope.Block, | 9251 | block: *Block, |
| 8972 | src: LazySrcLoc, | 9252 | src: LazySrcLoc, |
| 8973 | zir_ref: Zir.Inst.Ref, | 9253 | zir_ref: Zir.Inst.Ref, |
| 8974 | ) CompileError!std.builtin.AtomicRmwOp { | 9254 | ) CompileError!std.builtin.AtomicRmwOp { |
| ... | @@ -8981,7 +9261,7 @@ fn resolveAtomicRmwOp( | ... | @@ -8981,7 +9261,7 @@ fn resolveAtomicRmwOp( |
| 8981 | | 9261 | |
| 8982 | fn zirCmpxchg( | 9262 | fn zirCmpxchg( |
| 8983 | sema: *Sema, | 9263 | sema: *Sema, |
| 8984 | block: *Scope.Block, | 9264 | block: *Block, |
| 8985 | inst: Zir.Inst.Index, | 9265 | inst: Zir.Inst.Index, |
| 8986 | air_tag: Air.Inst.Tag, | 9266 | air_tag: Air.Inst.Tag, |
| 8987 | ) CompileError!Air.Inst.Ref { | 9267 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -9069,31 +9349,31 @@ fn zirCmpxchg( | ... | @@ -9069,31 +9349,31 @@ fn zirCmpxchg( |
| 9069 | }); | 9349 | }); |
| 9070 | } | 9350 | } |
| 9071 | | 9351 | |
| 9072 | fn zirSplat(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9352 | fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9073 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9353 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9074 | const src = inst_data.src(); | 9354 | const src = inst_data.src(); |
| 9075 | return sema.fail(block, src, "TODO: Sema.zirSplat", .{}); | 9355 | return sema.fail(block, src, "TODO: Sema.zirSplat", .{}); |
| 9076 | } | 9356 | } |
| 9077 | | 9357 | |
| 9078 | fn zirReduce(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9358 | fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9079 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9359 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9080 | const src = inst_data.src(); | 9360 | const src = inst_data.src(); |
| 9081 | return sema.fail(block, src, "TODO: Sema.zirReduce", .{}); | 9361 | return sema.fail(block, src, "TODO: Sema.zirReduce", .{}); |
| 9082 | } | 9362 | } |
| 9083 | | 9363 | |
| 9084 | fn zirShuffle(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9364 | fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9085 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9365 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9086 | const src = inst_data.src(); | 9366 | const src = inst_data.src(); |
| 9087 | return sema.fail(block, src, "TODO: Sema.zirShuffle", .{}); | 9367 | return sema.fail(block, src, "TODO: Sema.zirShuffle", .{}); |
| 9088 | } | 9368 | } |
| 9089 | | 9369 | |
| 9090 | fn zirSelect(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9370 | fn zirSelect(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9091 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9371 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9092 | const src = inst_data.src(); | 9372 | const src = inst_data.src(); |
| 9093 | return sema.fail(block, src, "TODO: Sema.zirSelect", .{}); | 9373 | return sema.fail(block, src, "TODO: Sema.zirSelect", .{}); |
| 9094 | } | 9374 | } |
| 9095 | | 9375 | |
| 9096 | fn zirAtomicLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9376 | fn zirAtomicLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9097 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9377 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9098 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 9378 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 9099 | // zig fmt: off | 9379 | // zig fmt: off |
| ... | @@ -9138,7 +9418,7 @@ fn zirAtomicLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile | ... | @@ -9138,7 +9418,7 @@ fn zirAtomicLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile |
| 9138 | }); | 9418 | }); |
| 9139 | } | 9419 | } |
| 9140 | | 9420 | |
| 9141 | fn zirAtomicRmw(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9421 | fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9142 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9422 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9143 | const extra = sema.code.extraData(Zir.Inst.AtomicRmw, inst_data.payload_index).data; | 9423 | const extra = sema.code.extraData(Zir.Inst.AtomicRmw, inst_data.payload_index).data; |
| 9144 | const src = inst_data.src(); | 9424 | const src = inst_data.src(); |
| ... | @@ -9216,7 +9496,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE | ... | @@ -9216,7 +9496,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileE |
| 9216 | }); | 9496 | }); |
| 9217 | } | 9497 | } |
| 9218 | | 9498 | |
| 9219 | fn zirAtomicStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 9499 | fn zirAtomicStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 9220 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9500 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9221 | const extra = sema.code.extraData(Zir.Inst.AtomicStore, inst_data.payload_index).data; | 9501 | const extra = sema.code.extraData(Zir.Inst.AtomicStore, inst_data.payload_index).data; |
| 9222 | const src = inst_data.src(); | 9502 | const src = inst_data.src(); |
| ... | @@ -9250,37 +9530,37 @@ fn zirAtomicStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil | ... | @@ -9250,37 +9530,37 @@ fn zirAtomicStore(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compil |
| 9250 | return sema.storePtr2(block, src, ptr, ptr_src, operand, operand_src, air_tag); | 9530 | return sema.storePtr2(block, src, ptr, ptr_src, operand, operand_src, air_tag); |
| 9251 | } | 9531 | } |
| 9252 | | 9532 | |
| 9253 | fn zirMulAdd(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9533 | fn zirMulAdd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9254 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9534 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9255 | const src = inst_data.src(); | 9535 | const src = inst_data.src(); |
| 9256 | return sema.fail(block, src, "TODO: Sema.zirMulAdd", .{}); | 9536 | return sema.fail(block, src, "TODO: Sema.zirMulAdd", .{}); |
| 9257 | } | 9537 | } |
| 9258 | | 9538 | |
| 9259 | fn zirBuiltinCall(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9539 | fn zirBuiltinCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9260 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9540 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9261 | const src = inst_data.src(); | 9541 | const src = inst_data.src(); |
| 9262 | return sema.fail(block, src, "TODO: Sema.zirBuiltinCall", .{}); | 9542 | return sema.fail(block, src, "TODO: Sema.zirBuiltinCall", .{}); |
| 9263 | } | 9543 | } |
| 9264 | | 9544 | |
| 9265 | fn zirFieldPtrType(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9545 | fn zirFieldPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9266 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9546 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9267 | const src = inst_data.src(); | 9547 | const src = inst_data.src(); |
| 9268 | return sema.fail(block, src, "TODO: Sema.zirFieldPtrType", .{}); | 9548 | return sema.fail(block, src, "TODO: Sema.zirFieldPtrType", .{}); |
| 9269 | } | 9549 | } |
| 9270 | | 9550 | |
| 9271 | fn zirFieldParentPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9551 | fn zirFieldParentPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9272 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9552 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9273 | const src = inst_data.src(); | 9553 | const src = inst_data.src(); |
| 9274 | return sema.fail(block, src, "TODO: Sema.zirFieldParentPtr", .{}); | 9554 | return sema.fail(block, src, "TODO: Sema.zirFieldParentPtr", .{}); |
| 9275 | } | 9555 | } |
| 9276 | | 9556 | |
| 9277 | fn zirMaximum(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9557 | fn zirMaximum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9278 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9558 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9279 | const src = inst_data.src(); | 9559 | const src = inst_data.src(); |
| 9280 | return sema.fail(block, src, "TODO: Sema.zirMaximum", .{}); | 9560 | return sema.fail(block, src, "TODO: Sema.zirMaximum", .{}); |
| 9281 | } | 9561 | } |
| 9282 | | 9562 | |
| 9283 | fn zirMemcpy(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 9563 | fn zirMemcpy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 9284 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9564 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9285 | const extra = sema.code.extraData(Zir.Inst.Memcpy, inst_data.payload_index).data; | 9565 | const extra = sema.code.extraData(Zir.Inst.Memcpy, inst_data.payload_index).data; |
| 9286 | const src = inst_data.src(); | 9566 | const src = inst_data.src(); |
| ... | @@ -9345,7 +9625,7 @@ fn zirMemcpy(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -9345,7 +9625,7 @@ fn zirMemcpy(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro |
| 9345 | }); | 9625 | }); |
| 9346 | } | 9626 | } |
| 9347 | | 9627 | |
| 9348 | fn zirMemset(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!void { | 9628 | fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 9349 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9629 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9350 | const extra = sema.code.extraData(Zir.Inst.Memset, inst_data.payload_index).data; | 9630 | const extra = sema.code.extraData(Zir.Inst.Memset, inst_data.payload_index).data; |
| 9351 | const src = inst_data.src(); | 9631 | const src = inst_data.src(); |
| ... | @@ -9391,19 +9671,19 @@ fn zirMemset(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -9391,19 +9671,19 @@ fn zirMemset(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro |
| 9391 | }); | 9671 | }); |
| 9392 | } | 9672 | } |
| 9393 | | 9673 | |
| 9394 | fn zirMinimum(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9674 | fn zirMinimum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9395 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9675 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9396 | const src = inst_data.src(); | 9676 | const src = inst_data.src(); |
| 9397 | return sema.fail(block, src, "TODO: Sema.zirMinimum", .{}); | 9677 | return sema.fail(block, src, "TODO: Sema.zirMinimum", .{}); |
| 9398 | } | 9678 | } |
| 9399 | | 9679 | |
| 9400 | fn zirBuiltinAsyncCall(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9680 | fn zirBuiltinAsyncCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9401 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 9681 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 9402 | const src = inst_data.src(); | 9682 | const src = inst_data.src(); |
| 9403 | return sema.fail(block, src, "TODO: Sema.zirBuiltinAsyncCall", .{}); | 9683 | return sema.fail(block, src, "TODO: Sema.zirBuiltinAsyncCall", .{}); |
| 9404 | } | 9684 | } |
| 9405 | | 9685 | |
| 9406 | fn zirResume(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9686 | fn zirResume(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9407 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 9687 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 9408 | const src = inst_data.src(); | 9688 | const src = inst_data.src(); |
| 9409 | return sema.fail(block, src, "TODO: Sema.zirResume", .{}); | 9689 | return sema.fail(block, src, "TODO: Sema.zirResume", .{}); |
| ... | @@ -9411,7 +9691,7 @@ fn zirResume(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -9411,7 +9691,7 @@ fn zirResume(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) CompileErro |
| 9411 | | 9691 | |
| 9412 | fn zirAwait( | 9692 | fn zirAwait( |
| 9413 | sema: *Sema, | 9693 | sema: *Sema, |
| 9414 | block: *Scope.Block, | 9694 | block: *Block, |
| 9415 | inst: Zir.Inst.Index, | 9695 | inst: Zir.Inst.Index, |
| 9416 | is_nosuspend: bool, | 9696 | is_nosuspend: bool, |
| 9417 | ) CompileError!Air.Inst.Ref { | 9697 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -9424,7 +9704,7 @@ fn zirAwait( | ... | @@ -9424,7 +9704,7 @@ fn zirAwait( |
| 9424 | | 9704 | |
| 9425 | fn zirVarExtended( | 9705 | fn zirVarExtended( |
| 9426 | sema: *Sema, | 9706 | sema: *Sema, |
| 9427 | block: *Scope.Block, | 9707 | block: *Block, |
| 9428 | extended: Zir.Inst.Extended.InstData, | 9708 | extended: Zir.Inst.Extended.InstData, |
| 9429 | ) CompileError!Air.Inst.Ref { | 9709 | ) CompileError!Air.Inst.Ref { |
| 9430 | const extra = sema.code.extraData(Zir.Inst.ExtendedVar, extended.operand); | 9710 | const extra = sema.code.extraData(Zir.Inst.ExtendedVar, extended.operand); |
| ... | @@ -9499,7 +9779,7 @@ fn zirVarExtended( | ... | @@ -9499,7 +9779,7 @@ fn zirVarExtended( |
| 9499 | | 9779 | |
| 9500 | fn zirFuncExtended( | 9780 | fn zirFuncExtended( |
| 9501 | sema: *Sema, | 9781 | sema: *Sema, |
| 9502 | block: *Scope.Block, | 9782 | block: *Block, |
| 9503 | extended: Zir.Inst.Extended.InstData, | 9783 | extended: Zir.Inst.Extended.InstData, |
| 9504 | inst: Zir.Inst.Index, | 9784 | inst: Zir.Inst.Index, |
| 9505 | ) CompileError!Air.Inst.Ref { | 9785 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -9566,7 +9846,7 @@ fn zirFuncExtended( | ... | @@ -9566,7 +9846,7 @@ fn zirFuncExtended( |
| 9566 | | 9846 | |
| 9567 | fn zirCUndef( | 9847 | fn zirCUndef( |
| 9568 | sema: *Sema, | 9848 | sema: *Sema, |
| 9569 | block: *Scope.Block, | 9849 | block: *Block, |
| 9570 | extended: Zir.Inst.Extended.InstData, | 9850 | extended: Zir.Inst.Extended.InstData, |
| 9571 | ) CompileError!Air.Inst.Ref { | 9851 | ) CompileError!Air.Inst.Ref { |
| 9572 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 9852 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| ... | @@ -9579,7 +9859,7 @@ fn zirCUndef( | ... | @@ -9579,7 +9859,7 @@ fn zirCUndef( |
| 9579 | | 9859 | |
| 9580 | fn zirCInclude( | 9860 | fn zirCInclude( |
| 9581 | sema: *Sema, | 9861 | sema: *Sema, |
| 9582 | block: *Scope.Block, | 9862 | block: *Block, |
| 9583 | extended: Zir.Inst.Extended.InstData, | 9863 | extended: Zir.Inst.Extended.InstData, |
| 9584 | ) CompileError!Air.Inst.Ref { | 9864 | ) CompileError!Air.Inst.Ref { |
| 9585 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 9865 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| ... | @@ -9592,7 +9872,7 @@ fn zirCInclude( | ... | @@ -9592,7 +9872,7 @@ fn zirCInclude( |
| 9592 | | 9872 | |
| 9593 | fn zirCDefine( | 9873 | fn zirCDefine( |
| 9594 | sema: *Sema, | 9874 | sema: *Sema, |
| 9595 | block: *Scope.Block, | 9875 | block: *Block, |
| 9596 | extended: Zir.Inst.Extended.InstData, | 9876 | extended: Zir.Inst.Extended.InstData, |
| 9597 | ) CompileError!Air.Inst.Ref { | 9877 | ) CompileError!Air.Inst.Ref { |
| 9598 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; | 9878 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; |
| ... | @@ -9610,7 +9890,7 @@ fn zirCDefine( | ... | @@ -9610,7 +9890,7 @@ fn zirCDefine( |
| 9610 | | 9890 | |
| 9611 | fn zirWasmMemorySize( | 9891 | fn zirWasmMemorySize( |
| 9612 | sema: *Sema, | 9892 | sema: *Sema, |
| 9613 | block: *Scope.Block, | 9893 | block: *Block, |
| 9614 | extended: Zir.Inst.Extended.InstData, | 9894 | extended: Zir.Inst.Extended.InstData, |
| 9615 | ) CompileError!Air.Inst.Ref { | 9895 | ) CompileError!Air.Inst.Ref { |
| 9616 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 9896 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| ... | @@ -9620,7 +9900,7 @@ fn zirWasmMemorySize( | ... | @@ -9620,7 +9900,7 @@ fn zirWasmMemorySize( |
| 9620 | | 9900 | |
| 9621 | fn zirWasmMemoryGrow( | 9901 | fn zirWasmMemoryGrow( |
| 9622 | sema: *Sema, | 9902 | sema: *Sema, |
| 9623 | block: *Scope.Block, | 9903 | block: *Block, |
| 9624 | extended: Zir.Inst.Extended.InstData, | 9904 | extended: Zir.Inst.Extended.InstData, |
| 9625 | ) CompileError!Air.Inst.Ref { | 9905 | ) CompileError!Air.Inst.Ref { |
| 9626 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; | 9906 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; |
| ... | @@ -9630,7 +9910,7 @@ fn zirWasmMemoryGrow( | ... | @@ -9630,7 +9910,7 @@ fn zirWasmMemoryGrow( |
| 9630 | | 9910 | |
| 9631 | fn zirBuiltinExtern( | 9911 | fn zirBuiltinExtern( |
| 9632 | sema: *Sema, | 9912 | sema: *Sema, |
| 9633 | block: *Scope.Block, | 9913 | block: *Block, |
| 9634 | extended: Zir.Inst.Extended.InstData, | 9914 | extended: Zir.Inst.Extended.InstData, |
| 9635 | ) CompileError!Air.Inst.Ref { | 9915 | ) CompileError!Air.Inst.Ref { |
| 9636 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; | 9916 | const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data; |
| ... | @@ -9638,13 +9918,13 @@ fn zirBuiltinExtern( | ... | @@ -9638,13 +9918,13 @@ fn zirBuiltinExtern( |
| 9638 | return sema.fail(block, src, "TODO: implement Sema.zirBuiltinExtern", .{}); | 9918 | return sema.fail(block, src, "TODO: implement Sema.zirBuiltinExtern", .{}); |
| 9639 | } | 9919 | } |
| 9640 | | 9920 | |
| 9641 | fn requireFunctionBlock(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) !void { | 9921 | fn requireFunctionBlock(sema: *Sema, block: *Block, src: LazySrcLoc) !void { |
| 9642 | if (sema.func == null) { | 9922 | if (sema.func == null) { |
| 9643 | return sema.fail(block, src, "instruction illegal outside function body", .{}); | 9923 | return sema.fail(block, src, "instruction illegal outside function body", .{}); |
| 9644 | } | 9924 | } |
| 9645 | } | 9925 | } |
| 9646 | | 9926 | |
| 9647 | fn requireRuntimeBlock(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) !void { | 9927 | fn requireRuntimeBlock(sema: *Sema, block: *Block, src: LazySrcLoc) !void { |
| 9648 | if (block.is_comptime) { | 9928 | if (block.is_comptime) { |
| 9649 | return sema.failWithNeededComptime(block, src); | 9929 | return sema.failWithNeededComptime(block, src); |
| 9650 | } | 9930 | } |
| ... | @@ -9654,7 +9934,7 @@ fn requireRuntimeBlock(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) !void | ... | @@ -9654,7 +9934,7 @@ fn requireRuntimeBlock(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) !void |
| 9654 | /// Emit a compile error if type cannot be used for a runtime variable. | 9934 | /// Emit a compile error if type cannot be used for a runtime variable. |
| 9655 | fn validateVarType( | 9935 | fn validateVarType( |
| 9656 | sema: *Sema, | 9936 | sema: *Sema, |
| 9657 | block: *Scope.Block, | 9937 | block: *Block, |
| 9658 | src: LazySrcLoc, | 9938 | src: LazySrcLoc, |
| 9659 | var_ty: Type, | 9939 | var_ty: Type, |
| 9660 | is_extern: bool, | 9940 | is_extern: bool, |
| ... | @@ -9713,13 +9993,13 @@ pub const PanicId = enum { | ... | @@ -9713,13 +9993,13 @@ pub const PanicId = enum { |
| 9713 | | 9993 | |
| 9714 | fn addSafetyCheck( | 9994 | fn addSafetyCheck( |
| 9715 | sema: *Sema, | 9995 | sema: *Sema, |
| 9716 | parent_block: *Scope.Block, | 9996 | parent_block: *Block, |
| 9717 | ok: Air.Inst.Ref, | 9997 | ok: Air.Inst.Ref, |
| 9718 | panic_id: PanicId, | 9998 | panic_id: PanicId, |
| 9719 | ) !void { | 9999 | ) !void { |
| 9720 | const gpa = sema.gpa; | 10000 | const gpa = sema.gpa; |
| 9721 | | 10001 | |
| 9722 | var fail_block: Scope.Block = .{ | 10002 | var fail_block: Block = .{ |
| 9723 | .parent = parent_block, | 10003 | .parent = parent_block, |
| 9724 | .sema = sema, | 10004 | .sema = sema, |
| 9725 | .src_decl = parent_block.src_decl, | 10005 | .src_decl = parent_block.src_decl, |
| ... | @@ -9783,7 +10063,7 @@ fn addSafetyCheck( | ... | @@ -9783,7 +10063,7 @@ fn addSafetyCheck( |
| 9783 | | 10063 | |
| 9784 | fn panicWithMsg( | 10064 | fn panicWithMsg( |
| 9785 | sema: *Sema, | 10065 | sema: *Sema, |
| 9786 | block: *Scope.Block, | 10066 | block: *Block, |
| 9787 | src: LazySrcLoc, | 10067 | src: LazySrcLoc, |
| 9788 | msg_inst: Air.Inst.Ref, | 10068 | msg_inst: Air.Inst.Ref, |
| 9789 | ) !Zir.Inst.Index { | 10069 | ) !Zir.Inst.Index { |
| ... | @@ -9817,7 +10097,7 @@ fn panicWithMsg( | ... | @@ -9817,7 +10097,7 @@ fn panicWithMsg( |
| 9817 | | 10097 | |
| 9818 | fn safetyPanic( | 10098 | fn safetyPanic( |
| 9819 | sema: *Sema, | 10099 | sema: *Sema, |
| 9820 | block: *Scope.Block, | 10100 | block: *Block, |
| 9821 | src: LazySrcLoc, | 10101 | src: LazySrcLoc, |
| 9822 | panic_id: PanicId, | 10102 | panic_id: PanicId, |
| 9823 | ) CompileError!Zir.Inst.Index { | 10103 | ) CompileError!Zir.Inst.Index { |
| ... | @@ -9845,7 +10125,7 @@ fn safetyPanic( | ... | @@ -9845,7 +10125,7 @@ fn safetyPanic( |
| 9845 | return sema.panicWithMsg(block, src, casted_msg_inst); | 10125 | return sema.panicWithMsg(block, src, casted_msg_inst); |
| 9846 | } | 10126 | } |
| 9847 | | 10127 | |
| 9848 | fn emitBackwardBranch(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) !void { | 10128 | fn emitBackwardBranch(sema: *Sema, block: *Block, src: LazySrcLoc) !void { |
| 9849 | sema.branch_count += 1; | 10129 | sema.branch_count += 1; |
| 9850 | if (sema.branch_count > sema.branch_quota) { | 10130 | if (sema.branch_count > sema.branch_quota) { |
| 9851 | // TODO show the "called from here" stack | 10131 | // TODO show the "called from here" stack |
| ... | @@ -9855,7 +10135,7 @@ fn emitBackwardBranch(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) !void { | ... | @@ -9855,7 +10135,7 @@ fn emitBackwardBranch(sema: *Sema, block: *Scope.Block, src: LazySrcLoc) !void { |
| 9855 | | 10135 | |
| 9856 | fn fieldVal( | 10136 | fn fieldVal( |
| 9857 | sema: *Sema, | 10137 | sema: *Sema, |
| 9858 | block: *Scope.Block, | 10138 | block: *Block, |
| 9859 | src: LazySrcLoc, | 10139 | src: LazySrcLoc, |
| 9860 | object: Air.Inst.Ref, | 10140 | object: Air.Inst.Ref, |
| 9861 | field_name: []const u8, | 10141 | field_name: []const u8, |
| ... | @@ -10036,7 +10316,7 @@ fn fieldVal( | ... | @@ -10036,7 +10316,7 @@ fn fieldVal( |
| 10036 | | 10316 | |
| 10037 | fn fieldPtr( | 10317 | fn fieldPtr( |
| 10038 | sema: *Sema, | 10318 | sema: *Sema, |
| 10039 | block: *Scope.Block, | 10319 | block: *Block, |
| 10040 | src: LazySrcLoc, | 10320 | src: LazySrcLoc, |
| 10041 | object_ptr: Air.Inst.Ref, | 10321 | object_ptr: Air.Inst.Ref, |
| 10042 | field_name: []const u8, | 10322 | field_name: []const u8, |
| ... | @@ -10227,7 +10507,7 @@ fn fieldPtr( | ... | @@ -10227,7 +10507,7 @@ fn fieldPtr( |
| 10227 | | 10507 | |
| 10228 | fn fieldCallBind( | 10508 | fn fieldCallBind( |
| 10229 | sema: *Sema, | 10509 | sema: *Sema, |
| 10230 | block: *Scope.Block, | 10510 | block: *Block, |
| 10231 | src: LazySrcLoc, | 10511 | src: LazySrcLoc, |
| 10232 | raw_ptr: Air.Inst.Ref, | 10512 | raw_ptr: Air.Inst.Ref, |
| 10233 | field_name: []const u8, | 10513 | field_name: []const u8, |
| ... | @@ -10368,9 +10648,9 @@ fn fieldCallBind( | ... | @@ -10368,9 +10648,9 @@ fn fieldCallBind( |
| 10368 | | 10648 | |
| 10369 | fn namespaceLookup( | 10649 | fn namespaceLookup( |
| 10370 | sema: *Sema, | 10650 | sema: *Sema, |
| 10371 | block: *Scope.Block, | 10651 | block: *Block, |
| 10372 | src: LazySrcLoc, | 10652 | src: LazySrcLoc, |
| 10373 | namespace: *Scope.Namespace, | 10653 | namespace: *Namespace, |
| 10374 | decl_name: []const u8, | 10654 | decl_name: []const u8, |
| 10375 | ) CompileError!?*Decl { | 10655 | ) CompileError!?*Decl { |
| 10376 | const gpa = sema.gpa; | 10656 | const gpa = sema.gpa; |
| ... | @@ -10393,9 +10673,9 @@ fn namespaceLookup( | ... | @@ -10393,9 +10673,9 @@ fn namespaceLookup( |
| 10393 | | 10673 | |
| 10394 | fn namespaceLookupRef( | 10674 | fn namespaceLookupRef( |
| 10395 | sema: *Sema, | 10675 | sema: *Sema, |
| 10396 | block: *Scope.Block, | 10676 | block: *Block, |
| 10397 | src: LazySrcLoc, | 10677 | src: LazySrcLoc, |
| 10398 | namespace: *Scope.Namespace, | 10678 | namespace: *Namespace, |
| 10399 | decl_name: []const u8, | 10679 | decl_name: []const u8, |
| 10400 | ) CompileError!?Air.Inst.Ref { | 10680 | ) CompileError!?Air.Inst.Ref { |
| 10401 | const decl = (try sema.namespaceLookup(block, src, namespace, decl_name)) orelse return null; | 10681 | const decl = (try sema.namespaceLookup(block, src, namespace, decl_name)) orelse return null; |
| ... | @@ -10404,7 +10684,7 @@ fn namespaceLookupRef( | ... | @@ -10404,7 +10684,7 @@ fn namespaceLookupRef( |
| 10404 | | 10684 | |
| 10405 | fn structFieldPtr( | 10685 | fn structFieldPtr( |
| 10406 | sema: *Sema, | 10686 | sema: *Sema, |
| 10407 | block: *Scope.Block, | 10687 | block: *Block, |
| 10408 | src: LazySrcLoc, | 10688 | src: LazySrcLoc, |
| 10409 | struct_ptr: Air.Inst.Ref, | 10689 | struct_ptr: Air.Inst.Ref, |
| 10410 | field_name: []const u8, | 10690 | field_name: []const u8, |
| ... | @@ -10444,7 +10724,7 @@ fn structFieldPtr( | ... | @@ -10444,7 +10724,7 @@ fn structFieldPtr( |
| 10444 | | 10724 | |
| 10445 | fn structFieldVal( | 10725 | fn structFieldVal( |
| 10446 | sema: *Sema, | 10726 | sema: *Sema, |
| 10447 | block: *Scope.Block, | 10727 | block: *Block, |
| 10448 | src: LazySrcLoc, | 10728 | src: LazySrcLoc, |
| 10449 | struct_byval: Air.Inst.Ref, | 10729 | struct_byval: Air.Inst.Ref, |
| 10450 | field_name: []const u8, | 10730 | field_name: []const u8, |
| ... | @@ -10482,7 +10762,7 @@ fn structFieldVal( | ... | @@ -10482,7 +10762,7 @@ fn structFieldVal( |
| 10482 | | 10762 | |
| 10483 | fn unionFieldPtr( | 10763 | fn unionFieldPtr( |
| 10484 | sema: *Sema, | 10764 | sema: *Sema, |
| 10485 | block: *Scope.Block, | 10765 | block: *Block, |
| 10486 | src: LazySrcLoc, | 10766 | src: LazySrcLoc, |
| 10487 | union_ptr: Air.Inst.Ref, | 10767 | union_ptr: Air.Inst.Ref, |
| 10488 | field_name: []const u8, | 10768 | field_name: []const u8, |
| ... | @@ -10524,7 +10804,7 @@ fn unionFieldPtr( | ... | @@ -10524,7 +10804,7 @@ fn unionFieldPtr( |
| 10524 | | 10804 | |
| 10525 | fn unionFieldVal( | 10805 | fn unionFieldVal( |
| 10526 | sema: *Sema, | 10806 | sema: *Sema, |
| 10527 | block: *Scope.Block, | 10807 | block: *Block, |
| 10528 | src: LazySrcLoc, | 10808 | src: LazySrcLoc, |
| 10529 | union_byval: Air.Inst.Ref, | 10809 | union_byval: Air.Inst.Ref, |
| 10530 | field_name: []const u8, | 10810 | field_name: []const u8, |
| ... | @@ -10555,7 +10835,7 @@ fn unionFieldVal( | ... | @@ -10555,7 +10835,7 @@ fn unionFieldVal( |
| 10555 | | 10835 | |
| 10556 | fn elemPtr( | 10836 | fn elemPtr( |
| 10557 | sema: *Sema, | 10837 | sema: *Sema, |
| 10558 | block: *Scope.Block, | 10838 | block: *Block, |
| 10559 | src: LazySrcLoc, | 10839 | src: LazySrcLoc, |
| 10560 | array_ptr: Air.Inst.Ref, | 10840 | array_ptr: Air.Inst.Ref, |
| 10561 | elem_index: Air.Inst.Ref, | 10841 | elem_index: Air.Inst.Ref, |
| ... | @@ -10584,7 +10864,7 @@ fn elemPtr( | ... | @@ -10584,7 +10864,7 @@ fn elemPtr( |
| 10584 | | 10864 | |
| 10585 | fn elemVal( | 10865 | fn elemVal( |
| 10586 | sema: *Sema, | 10866 | sema: *Sema, |
| 10587 | block: *Scope.Block, | 10867 | block: *Block, |
| 10588 | src: LazySrcLoc, | 10868 | src: LazySrcLoc, |
| 10589 | array_maybe_ptr: Air.Inst.Ref, | 10869 | array_maybe_ptr: Air.Inst.Ref, |
| 10590 | elem_index: Air.Inst.Ref, | 10870 | elem_index: Air.Inst.Ref, |
| ... | @@ -10673,7 +10953,7 @@ fn elemVal( | ... | @@ -10673,7 +10953,7 @@ fn elemVal( |
| 10673 | | 10953 | |
| 10674 | fn elemPtrArray( | 10954 | fn elemPtrArray( |
| 10675 | sema: *Sema, | 10955 | sema: *Sema, |
| 10676 | block: *Scope.Block, | 10956 | block: *Block, |
| 10677 | src: LazySrcLoc, | 10957 | src: LazySrcLoc, |
| 10678 | array_ptr: Air.Inst.Ref, | 10958 | array_ptr: Air.Inst.Ref, |
| 10679 | elem_index: Air.Inst.Ref, | 10959 | elem_index: Air.Inst.Ref, |
| ... | @@ -10713,7 +10993,7 @@ fn elemPtrArray( | ... | @@ -10713,7 +10993,7 @@ fn elemPtrArray( |
| 10713 | | 10993 | |
| 10714 | fn coerce( | 10994 | fn coerce( |
| 10715 | sema: *Sema, | 10995 | sema: *Sema, |
| 10716 | block: *Scope.Block, | 10996 | block: *Block, |
| 10717 | dest_type_unresolved: Type, | 10997 | dest_type_unresolved: Type, |
| 10718 | inst: Air.Inst.Ref, | 10998 | inst: Air.Inst.Ref, |
| 10719 | inst_src: LazySrcLoc, | 10999 | inst_src: LazySrcLoc, |
| ... | @@ -10985,7 +11265,7 @@ fn coerceInMemoryAllowed(dest_type: Type, src_type: Type, dest_is_mut: bool, tar | ... | @@ -10985,7 +11265,7 @@ fn coerceInMemoryAllowed(dest_type: Type, src_type: Type, dest_is_mut: bool, tar |
| 10985 | | 11265 | |
| 10986 | fn coerceNum( | 11266 | fn coerceNum( |
| 10987 | sema: *Sema, | 11267 | sema: *Sema, |
| 10988 | block: *Scope.Block, | 11268 | block: *Block, |
| 10989 | dest_type: Type, | 11269 | dest_type: Type, |
| 10990 | inst: Air.Inst.Ref, | 11270 | inst: Air.Inst.Ref, |
| 10991 | inst_src: LazySrcLoc, | 11271 | inst_src: LazySrcLoc, |
| ... | @@ -11053,7 +11333,7 @@ fn coerceNum( | ... | @@ -11053,7 +11333,7 @@ fn coerceNum( |
| 11053 | | 11333 | |
| 11054 | fn coerceVarArgParam( | 11334 | fn coerceVarArgParam( |
| 11055 | sema: *Sema, | 11335 | sema: *Sema, |
| 11056 | block: *Scope.Block, | 11336 | block: *Block, |
| 11057 | inst: Air.Inst.Ref, | 11337 | inst: Air.Inst.Ref, |
| 11058 | inst_src: LazySrcLoc, | 11338 | inst_src: LazySrcLoc, |
| 11059 | ) !Air.Inst.Ref { | 11339 | ) !Air.Inst.Ref { |
| ... | @@ -11069,7 +11349,7 @@ fn coerceVarArgParam( | ... | @@ -11069,7 +11349,7 @@ fn coerceVarArgParam( |
| 11069 | // TODO migrate callsites to use storePtr2 instead. | 11349 | // TODO migrate callsites to use storePtr2 instead. |
| 11070 | fn storePtr( | 11350 | fn storePtr( |
| 11071 | sema: *Sema, | 11351 | sema: *Sema, |
| 11072 | block: *Scope.Block, | 11352 | block: *Block, |
| 11073 | src: LazySrcLoc, | 11353 | src: LazySrcLoc, |
| 11074 | ptr: Air.Inst.Ref, | 11354 | ptr: Air.Inst.Ref, |
| 11075 | uncasted_operand: Air.Inst.Ref, | 11355 | uncasted_operand: Air.Inst.Ref, |
| ... | @@ -11079,7 +11359,7 @@ fn storePtr( | ... | @@ -11079,7 +11359,7 @@ fn storePtr( |
| 11079 | | 11359 | |
| 11080 | fn storePtr2( | 11360 | fn storePtr2( |
| 11081 | sema: *Sema, | 11361 | sema: *Sema, |
| 11082 | block: *Scope.Block, | 11362 | block: *Block, |
| 11083 | src: LazySrcLoc, | 11363 | src: LazySrcLoc, |
| 11084 | ptr: Air.Inst.Ref, | 11364 | ptr: Air.Inst.Ref, |
| 11085 | ptr_src: LazySrcLoc, | 11365 | ptr_src: LazySrcLoc, |
| ... | @@ -11116,7 +11396,7 @@ fn storePtr2( | ... | @@ -11116,7 +11396,7 @@ fn storePtr2( |
| 11116 | /// assert the store must be done at comptime. | 11396 | /// assert the store must be done at comptime. |
| 11117 | fn storePtrVal( | 11397 | fn storePtrVal( |
| 11118 | sema: *Sema, | 11398 | sema: *Sema, |
| 11119 | block: *Scope.Block, | 11399 | block: *Block, |
| 11120 | src: LazySrcLoc, | 11400 | src: LazySrcLoc, |
| 11121 | ptr_val: Value, | 11401 | ptr_val: Value, |
| 11122 | operand_val: Value, | 11402 | operand_val: Value, |
| ... | @@ -11161,7 +11441,7 @@ fn storePtrVal( | ... | @@ -11161,7 +11441,7 @@ fn storePtrVal( |
| 11161 | | 11441 | |
| 11162 | fn bitcast( | 11442 | fn bitcast( |
| 11163 | sema: *Sema, | 11443 | sema: *Sema, |
| 11164 | block: *Scope.Block, | 11444 | block: *Block, |
| 11165 | dest_type: Type, | 11445 | dest_type: Type, |
| 11166 | inst: Air.Inst.Ref, | 11446 | inst: Air.Inst.Ref, |
| 11167 | inst_src: LazySrcLoc, | 11447 | inst_src: LazySrcLoc, |
| ... | @@ -11177,7 +11457,7 @@ fn bitcast( | ... | @@ -11177,7 +11457,7 @@ fn bitcast( |
| 11177 | | 11457 | |
| 11178 | fn coerceArrayPtrToSlice( | 11458 | fn coerceArrayPtrToSlice( |
| 11179 | sema: *Sema, | 11459 | sema: *Sema, |
| 11180 | block: *Scope.Block, | 11460 | block: *Block, |
| 11181 | dest_type: Type, | 11461 | dest_type: Type, |
| 11182 | inst: Air.Inst.Ref, | 11462 | inst: Air.Inst.Ref, |
| 11183 | inst_src: LazySrcLoc, | 11463 | inst_src: LazySrcLoc, |
| ... | @@ -11192,7 +11472,7 @@ fn coerceArrayPtrToSlice( | ... | @@ -11192,7 +11472,7 @@ fn coerceArrayPtrToSlice( |
| 11192 | | 11472 | |
| 11193 | fn coerceArrayPtrToMany( | 11473 | fn coerceArrayPtrToMany( |
| 11194 | sema: *Sema, | 11474 | sema: *Sema, |
| 11195 | block: *Scope.Block, | 11475 | block: *Block, |
| 11196 | dest_type: Type, | 11476 | dest_type: Type, |
| 11197 | inst: Air.Inst.Ref, | 11477 | inst: Air.Inst.Ref, |
| 11198 | inst_src: LazySrcLoc, | 11478 | inst_src: LazySrcLoc, |
| ... | @@ -11207,7 +11487,7 @@ fn coerceArrayPtrToMany( | ... | @@ -11207,7 +11487,7 @@ fn coerceArrayPtrToMany( |
| 11207 | | 11487 | |
| 11208 | fn analyzeDeclVal( | 11488 | fn analyzeDeclVal( |
| 11209 | sema: *Sema, | 11489 | sema: *Sema, |
| 11210 | block: *Scope.Block, | 11490 | block: *Block, |
| 11211 | src: LazySrcLoc, | 11491 | src: LazySrcLoc, |
| 11212 | decl: *Decl, | 11492 | decl: *Decl, |
| 11213 | ) CompileError!Air.Inst.Ref { | 11493 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -11261,7 +11541,7 @@ fn analyzeDeclRef(sema: *Sema, decl: *Decl) CompileError!Air.Inst.Ref { | ... | @@ -11261,7 +11541,7 @@ fn analyzeDeclRef(sema: *Sema, decl: *Decl) CompileError!Air.Inst.Ref { |
| 11261 | | 11541 | |
| 11262 | fn analyzeRef( | 11542 | fn analyzeRef( |
| 11263 | sema: *Sema, | 11543 | sema: *Sema, |
| 11264 | block: *Scope.Block, | 11544 | block: *Block, |
| 11265 | src: LazySrcLoc, | 11545 | src: LazySrcLoc, |
| 11266 | operand: Air.Inst.Ref, | 11546 | operand: Air.Inst.Ref, |
| 11267 | ) CompileError!Air.Inst.Ref { | 11547 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -11296,7 +11576,7 @@ fn analyzeRef( | ... | @@ -11296,7 +11576,7 @@ fn analyzeRef( |
| 11296 | | 11576 | |
| 11297 | fn analyzeLoad( | 11577 | fn analyzeLoad( |
| 11298 | sema: *Sema, | 11578 | sema: *Sema, |
| 11299 | block: *Scope.Block, | 11579 | block: *Block, |
| 11300 | src: LazySrcLoc, | 11580 | src: LazySrcLoc, |
| 11301 | ptr: Air.Inst.Ref, | 11581 | ptr: Air.Inst.Ref, |
| 11302 | ptr_src: LazySrcLoc, | 11582 | ptr_src: LazySrcLoc, |
| ... | @@ -11318,7 +11598,7 @@ fn analyzeLoad( | ... | @@ -11318,7 +11598,7 @@ fn analyzeLoad( |
| 11318 | | 11598 | |
| 11319 | fn analyzeSliceLen( | 11599 | fn analyzeSliceLen( |
| 11320 | sema: *Sema, | 11600 | sema: *Sema, |
| 11321 | block: *Scope.Block, | 11601 | block: *Block, |
| 11322 | src: LazySrcLoc, | 11602 | src: LazySrcLoc, |
| 11323 | slice_inst: Air.Inst.Ref, | 11603 | slice_inst: Air.Inst.Ref, |
| 11324 | ) CompileError!Air.Inst.Ref { | 11604 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -11334,7 +11614,7 @@ fn analyzeSliceLen( | ... | @@ -11334,7 +11614,7 @@ fn analyzeSliceLen( |
| 11334 | | 11614 | |
| 11335 | fn analyzeIsNull( | 11615 | fn analyzeIsNull( |
| 11336 | sema: *Sema, | 11616 | sema: *Sema, |
| 11337 | block: *Scope.Block, | 11617 | block: *Block, |
| 11338 | src: LazySrcLoc, | 11618 | src: LazySrcLoc, |
| 11339 | operand: Air.Inst.Ref, | 11619 | operand: Air.Inst.Ref, |
| 11340 | invert_logic: bool, | 11620 | invert_logic: bool, |
| ... | @@ -11359,7 +11639,7 @@ fn analyzeIsNull( | ... | @@ -11359,7 +11639,7 @@ fn analyzeIsNull( |
| 11359 | | 11639 | |
| 11360 | fn analyzeIsNonErr( | 11640 | fn analyzeIsNonErr( |
| 11361 | sema: *Sema, | 11641 | sema: *Sema, |
| 11362 | block: *Scope.Block, | 11642 | block: *Block, |
| 11363 | src: LazySrcLoc, | 11643 | src: LazySrcLoc, |
| 11364 | operand: Air.Inst.Ref, | 11644 | operand: Air.Inst.Ref, |
| 11365 | ) CompileError!Air.Inst.Ref { | 11645 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -11385,7 +11665,7 @@ fn analyzeIsNonErr( | ... | @@ -11385,7 +11665,7 @@ fn analyzeIsNonErr( |
| 11385 | | 11665 | |
| 11386 | fn analyzeSlice( | 11666 | fn analyzeSlice( |
| 11387 | sema: *Sema, | 11667 | sema: *Sema, |
| 11388 | block: *Scope.Block, | 11668 | block: *Block, |
| 11389 | src: LazySrcLoc, | 11669 | src: LazySrcLoc, |
| 11390 | array_ptr: Air.Inst.Ref, | 11670 | array_ptr: Air.Inst.Ref, |
| 11391 | start: Air.Inst.Ref, | 11671 | start: Air.Inst.Ref, |
| ... | @@ -11460,7 +11740,7 @@ fn analyzeSlice( | ... | @@ -11460,7 +11740,7 @@ fn analyzeSlice( |
| 11460 | /// Asserts that lhs and rhs types are both numeric. | 11740 | /// Asserts that lhs and rhs types are both numeric. |
| 11461 | fn cmpNumeric( | 11741 | fn cmpNumeric( |
| 11462 | sema: *Sema, | 11742 | sema: *Sema, |
| 11463 | block: *Scope.Block, | 11743 | block: *Block, |
| 11464 | src: LazySrcLoc, | 11744 | src: LazySrcLoc, |
| 11465 | lhs: Air.Inst.Ref, | 11745 | lhs: Air.Inst.Ref, |
| 11466 | rhs: Air.Inst.Ref, | 11746 | rhs: Air.Inst.Ref, |
| ... | @@ -11648,7 +11928,7 @@ fn cmpNumeric( | ... | @@ -11648,7 +11928,7 @@ fn cmpNumeric( |
| 11648 | | 11928 | |
| 11649 | fn wrapOptional( | 11929 | fn wrapOptional( |
| 11650 | sema: *Sema, | 11930 | sema: *Sema, |
| 11651 | block: *Scope.Block, | 11931 | block: *Block, |
| 11652 | dest_type: Type, | 11932 | dest_type: Type, |
| 11653 | inst: Air.Inst.Ref, | 11933 | inst: Air.Inst.Ref, |
| 11654 | inst_src: LazySrcLoc, | 11934 | inst_src: LazySrcLoc, |
| ... | @@ -11663,7 +11943,7 @@ fn wrapOptional( | ... | @@ -11663,7 +11943,7 @@ fn wrapOptional( |
| 11663 | | 11943 | |
| 11664 | fn wrapErrorUnion( | 11944 | fn wrapErrorUnion( |
| 11665 | sema: *Sema, | 11945 | sema: *Sema, |
| 11666 | block: *Scope.Block, | 11946 | block: *Block, |
| 11667 | dest_type: Type, | 11947 | dest_type: Type, |
| 11668 | inst: Air.Inst.Ref, | 11948 | inst: Air.Inst.Ref, |
| 11669 | inst_src: LazySrcLoc, | 11949 | inst_src: LazySrcLoc, |
| ... | @@ -11739,7 +12019,7 @@ fn wrapErrorUnion( | ... | @@ -11739,7 +12019,7 @@ fn wrapErrorUnion( |
| 11739 | | 12019 | |
| 11740 | fn unionToTag( | 12020 | fn unionToTag( |
| 11741 | sema: *Sema, | 12021 | sema: *Sema, |
| 11742 | block: *Scope.Block, | 12022 | block: *Block, |
| 11743 | dest_type: Type, | 12023 | dest_type: Type, |
| 11744 | un: Air.Inst.Ref, | 12024 | un: Air.Inst.Ref, |
| 11745 | un_src: LazySrcLoc, | 12025 | un_src: LazySrcLoc, |
| ... | @@ -11753,7 +12033,7 @@ fn unionToTag( | ... | @@ -11753,7 +12033,7 @@ fn unionToTag( |
| 11753 | | 12033 | |
| 11754 | fn resolvePeerTypes( | 12034 | fn resolvePeerTypes( |
| 11755 | sema: *Sema, | 12035 | sema: *Sema, |
| 11756 | block: *Scope.Block, | 12036 | block: *Block, |
| 11757 | src: LazySrcLoc, | 12037 | src: LazySrcLoc, |
| 11758 | instructions: []Air.Inst.Ref, | 12038 | instructions: []Air.Inst.Ref, |
| 11759 | candidate_srcs: Module.PeerTypeCandidateSrc, | 12039 | candidate_srcs: Module.PeerTypeCandidateSrc, |
| ... | @@ -11867,7 +12147,7 @@ fn resolvePeerTypes( | ... | @@ -11867,7 +12147,7 @@ fn resolvePeerTypes( |
| 11867 | | 12147 | |
| 11868 | pub fn resolveTypeLayout( | 12148 | pub fn resolveTypeLayout( |
| 11869 | sema: *Sema, | 12149 | sema: *Sema, |
| 11870 | block: *Scope.Block, | 12150 | block: *Block, |
| 11871 | src: LazySrcLoc, | 12151 | src: LazySrcLoc, |
| 11872 | ty: Type, | 12152 | ty: Type, |
| 11873 | ) CompileError!void { | 12153 | ) CompileError!void { |
| ... | @@ -11892,7 +12172,7 @@ pub fn resolveTypeLayout( | ... | @@ -11892,7 +12172,7 @@ pub fn resolveTypeLayout( |
| 11892 | } | 12172 | } |
| 11893 | } | 12173 | } |
| 11894 | | 12174 | |
| 11895 | fn resolveTypeFields(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, ty: Type) CompileError!Type { | 12175 | fn resolveTypeFields(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileError!Type { |
| 11896 | switch (ty.tag()) { | 12176 | switch (ty.tag()) { |
| 11897 | .@"struct" => { | 12177 | .@"struct" => { |
| 11898 | const struct_obj = ty.castTag(.@"struct").?.data; | 12178 | const struct_obj = ty.castTag(.@"struct").?.data; |
| ... | @@ -11943,7 +12223,7 @@ fn resolveTypeFields(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, ty: Type | ... | @@ -11943,7 +12223,7 @@ fn resolveTypeFields(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, ty: Type |
| 11943 | | 12223 | |
| 11944 | fn resolveBuiltinTypeFields( | 12224 | fn resolveBuiltinTypeFields( |
| 11945 | sema: *Sema, | 12225 | sema: *Sema, |
| 11946 | block: *Scope.Block, | 12226 | block: *Block, |
| 11947 | src: LazySrcLoc, | 12227 | src: LazySrcLoc, |
| 11948 | name: []const u8, | 12228 | name: []const u8, |
| 11949 | ) CompileError!Type { | 12229 | ) CompileError!Type { |
| ... | @@ -12021,7 +12301,7 @@ fn semaStructFields( | ... | @@ -12021,7 +12301,7 @@ fn semaStructFields( |
| 12021 | var wip_captures = try WipCaptureScope.init(gpa, &decl_arena.allocator, decl.src_scope); | 12301 | var wip_captures = try WipCaptureScope.init(gpa, &decl_arena.allocator, decl.src_scope); |
| 12022 | defer wip_captures.deinit(); | 12302 | defer wip_captures.deinit(); |
| 12023 | | 12303 | |
| 12024 | var block_scope: Scope.Block = .{ | 12304 | var block_scope: Block = .{ |
| 12025 | .parent = null, | 12305 | .parent = null, |
| 12026 | .sema = &sema, | 12306 | .sema = &sema, |
| 12027 | .src_decl = decl, | 12307 | .src_decl = decl, |
| ... | @@ -12191,7 +12471,7 @@ fn semaUnionFields( | ... | @@ -12191,7 +12471,7 @@ fn semaUnionFields( |
| 12191 | var wip_captures = try WipCaptureScope.init(gpa, &decl_arena.allocator, decl.src_scope); | 12471 | var wip_captures = try WipCaptureScope.init(gpa, &decl_arena.allocator, decl.src_scope); |
| 12192 | defer wip_captures.deinit(); | 12472 | defer wip_captures.deinit(); |
| 12193 | | 12473 | |
| 12194 | var block_scope: Scope.Block = .{ | 12474 | var block_scope: Block = .{ |
| 12195 | .parent = null, | 12475 | .parent = null, |
| 12196 | .sema = &sema, | 12476 | .sema = &sema, |
| 12197 | .src_decl = decl, | 12477 | .src_decl = decl, |
| ... | @@ -12322,7 +12602,7 @@ fn semaUnionFields( | ... | @@ -12322,7 +12602,7 @@ fn semaUnionFields( |
| 12322 | | 12602 | |
| 12323 | fn generateUnionTagTypeNumbered( | 12603 | fn generateUnionTagTypeNumbered( |
| 12324 | sema: *Sema, | 12604 | sema: *Sema, |
| 12325 | block: *Scope.Block, | 12605 | block: *Block, |
| 12326 | fields_len: u32, | 12606 | fields_len: u32, |
| 12327 | int_ty: Type, | 12607 | int_ty: Type, |
| 12328 | ) !Type { | 12608 | ) !Type { |
| ... | @@ -12340,7 +12620,7 @@ fn generateUnionTagTypeNumbered( | ... | @@ -12340,7 +12620,7 @@ fn generateUnionTagTypeNumbered( |
| 12340 | const enum_ty = Type.initPayload(&enum_ty_payload.base); | 12620 | const enum_ty = Type.initPayload(&enum_ty_payload.base); |
| 12341 | const enum_val = try Value.Tag.ty.create(&new_decl_arena.allocator, enum_ty); | 12621 | const enum_val = try Value.Tag.ty.create(&new_decl_arena.allocator, enum_ty); |
| 12342 | // TODO better type name | 12622 | // TODO better type name |
| 12343 | const new_decl = try mod.createAnonymousDecl(&block.base, .{ | 12623 | const new_decl = try mod.createAnonymousDecl(block, .{ |
| 12344 | .ty = Type.initTag(.type), | 12624 | .ty = Type.initTag(.type), |
| 12345 | .val = enum_val, | 12625 | .val = enum_val, |
| 12346 | }); | 12626 | }); |
| ... | @@ -12361,7 +12641,7 @@ fn generateUnionTagTypeNumbered( | ... | @@ -12361,7 +12641,7 @@ fn generateUnionTagTypeNumbered( |
| 12361 | return enum_ty; | 12641 | return enum_ty; |
| 12362 | } | 12642 | } |
| 12363 | | 12643 | |
| 12364 | fn generateUnionTagTypeSimple(sema: *Sema, block: *Scope.Block, fields_len: u32) !Type { | 12644 | fn generateUnionTagTypeSimple(sema: *Sema, block: *Block, fields_len: u32) !Type { |
| 12365 | const mod = sema.mod; | 12645 | const mod = sema.mod; |
| 12366 | | 12646 | |
| 12367 | var new_decl_arena = std.heap.ArenaAllocator.init(sema.gpa); | 12647 | var new_decl_arena = std.heap.ArenaAllocator.init(sema.gpa); |
| ... | @@ -12376,7 +12656,7 @@ fn generateUnionTagTypeSimple(sema: *Sema, block: *Scope.Block, fields_len: u32) | ... | @@ -12376,7 +12656,7 @@ fn generateUnionTagTypeSimple(sema: *Sema, block: *Scope.Block, fields_len: u32) |
| 12376 | const enum_ty = Type.initPayload(&enum_ty_payload.base); | 12656 | const enum_ty = Type.initPayload(&enum_ty_payload.base); |
| 12377 | const enum_val = try Value.Tag.ty.create(&new_decl_arena.allocator, enum_ty); | 12657 | const enum_val = try Value.Tag.ty.create(&new_decl_arena.allocator, enum_ty); |
| 12378 | // TODO better type name | 12658 | // TODO better type name |
| 12379 | const new_decl = try mod.createAnonymousDecl(&block.base, .{ | 12659 | const new_decl = try mod.createAnonymousDecl(block, .{ |
| 12380 | .ty = Type.initTag(.type), | 12660 | .ty = Type.initTag(.type), |
| 12381 | .val = enum_val, | 12661 | .val = enum_val, |
| 12382 | }); | 12662 | }); |
| ... | @@ -12396,7 +12676,7 @@ fn generateUnionTagTypeSimple(sema: *Sema, block: *Scope.Block, fields_len: u32) | ... | @@ -12396,7 +12676,7 @@ fn generateUnionTagTypeSimple(sema: *Sema, block: *Scope.Block, fields_len: u32) |
| 12396 | | 12676 | |
| 12397 | fn getBuiltin( | 12677 | fn getBuiltin( |
| 12398 | sema: *Sema, | 12678 | sema: *Sema, |
| 12399 | block: *Scope.Block, | 12679 | block: *Block, |
| 12400 | src: LazySrcLoc, | 12680 | src: LazySrcLoc, |
| 12401 | name: []const u8, | 12681 | name: []const u8, |
| 12402 | ) CompileError!Air.Inst.Ref { | 12682 | ) CompileError!Air.Inst.Ref { |
| ... | @@ -12422,7 +12702,7 @@ fn getBuiltin( | ... | @@ -12422,7 +12702,7 @@ fn getBuiltin( |
| 12422 | | 12702 | |
| 12423 | fn getBuiltinType( | 12703 | fn getBuiltinType( |
| 12424 | sema: *Sema, | 12704 | sema: *Sema, |
| 12425 | block: *Scope.Block, | 12705 | block: *Block, |
| 12426 | src: LazySrcLoc, | 12706 | src: LazySrcLoc, |
| 12427 | name: []const u8, | 12707 | name: []const u8, |
| 12428 | ) CompileError!Type { | 12708 | ) CompileError!Type { |
| ... | @@ -12436,7 +12716,7 @@ fn getBuiltinType( | ... | @@ -12436,7 +12716,7 @@ fn getBuiltinType( |
| 12436 | /// that the types are already resolved. | 12716 | /// that the types are already resolved. |
| 12437 | fn typeHasOnePossibleValue( | 12717 | fn typeHasOnePossibleValue( |
| 12438 | sema: *Sema, | 12718 | sema: *Sema, |
| 12439 | block: *Scope.Block, | 12719 | block: *Block, |
| 12440 | src: LazySrcLoc, | 12720 | src: LazySrcLoc, |
| 12441 | starting_type: Type, | 12721 | starting_type: Type, |
| 12442 | ) CompileError!?Value { | 12722 | ) CompileError!?Value { |
| ... | @@ -12599,7 +12879,7 @@ fn typeHasOnePossibleValue( | ... | @@ -12599,7 +12879,7 @@ fn typeHasOnePossibleValue( |
| 12599 | }; | 12879 | }; |
| 12600 | } | 12880 | } |
| 12601 | | 12881 | |
| 12602 | fn getAstTree(sema: *Sema, block: *Scope.Block) CompileError!*const std.zig.Ast { | 12882 | fn getAstTree(sema: *Sema, block: *Block) CompileError!*const std.zig.Ast { |
| 12603 | return block.namespace.file_scope.getTree(sema.gpa) catch |err| { | 12883 | return block.namespace.file_scope.getTree(sema.gpa) catch |err| { |
| 12604 | log.err("unable to load AST to report compile error: {s}", .{@errorName(err)}); | 12884 | log.err("unable to load AST to report compile error: {s}", .{@errorName(err)}); |
| 12605 | return error.AnalysisFail; | 12885 | return error.AnalysisFail; |
| ... | @@ -12789,7 +13069,7 @@ fn getBreakBlock(sema: *Sema, inst_index: Air.Inst.Index) ?Air.Inst.Index { | ... | @@ -12789,7 +13069,7 @@ fn getBreakBlock(sema: *Sema, inst_index: Air.Inst.Index) ?Air.Inst.Index { |
| 12789 | | 13069 | |
| 12790 | fn isComptimeKnown( | 13070 | fn isComptimeKnown( |
| 12791 | sema: *Sema, | 13071 | sema: *Sema, |
| 12792 | block: *Scope.Block, | 13072 | block: *Block, |
| 12793 | src: LazySrcLoc, | 13073 | src: LazySrcLoc, |
| 12794 | inst: Air.Inst.Ref, | 13074 | inst: Air.Inst.Ref, |
| 12795 | ) !bool { | 13075 | ) !bool { |
| ... | @@ -12798,7 +13078,7 @@ fn isComptimeKnown( | ... | @@ -12798,7 +13078,7 @@ fn isComptimeKnown( |
| 12798 | | 13078 | |
| 12799 | fn analyzeComptimeAlloc( | 13079 | fn analyzeComptimeAlloc( |
| 12800 | sema: *Sema, | 13080 | sema: *Sema, |
| 12801 | block: *Scope.Block, | 13081 | block: *Block, |
| 12802 | var_type: Type, | 13082 | var_type: Type, |
| 12803 | ) CompileError!Air.Inst.Ref { | 13083 | ) CompileError!Air.Inst.Ref { |
| 12804 | const ptr_type = try Type.ptr(sema.arena, .{ | 13084 | const ptr_type = try Type.ptr(sema.arena, .{ |
| ... | @@ -12841,7 +13121,7 @@ pub const AddressSpaceContext = enum { | ... | @@ -12841,7 +13121,7 @@ pub const AddressSpaceContext = enum { |
| 12841 | | 13121 | |
| 12842 | pub fn analyzeAddrspace( | 13122 | pub fn analyzeAddrspace( |
| 12843 | sema: *Sema, | 13123 | sema: *Sema, |
| 12844 | block: *Scope.Block, | 13124 | block: *Block, |
| 12845 | src: LazySrcLoc, | 13125 | src: LazySrcLoc, |
| 12846 | zir_ref: Zir.Inst.Ref, | 13126 | zir_ref: Zir.Inst.Ref, |
| 12847 | ctx: AddressSpaceContext, | 13127 | ctx: AddressSpaceContext, |