| ... | @@ -725,7 +725,7 @@ const Writer = struct { | ... | @@ -725,7 +725,7 @@ const Writer = struct { |
| 725 | | 725 | |
| 726 | fn writeExtNode(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { | 726 | fn writeExtNode(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { |
| 727 | try stream.writeAll(")) "); | 727 | try stream.writeAll(")) "); |
| 728 | const src_node: Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(extended.operand)))); | 728 | const src_node: Ast.Node.Offset = @fromBackingInt(@bitCast(extended.operand)); |
| 729 | try self.writeSrcNode(stream, src_node); | 729 | try self.writeSrcNode(stream, src_node); |
| 730 | } | 730 | } |
| 731 | | 731 | |
| ... | @@ -819,25 +819,25 @@ const Writer = struct { | ... | @@ -819,25 +819,25 @@ const Writer = struct { |
| 819 | var extra_index = extra.end; | 819 | var extra_index = extra.end; |
| 820 | if (inst_data.flags.has_sentinel) { | 820 | if (inst_data.flags.has_sentinel) { |
| 821 | try stream.writeAll(", "); | 821 | try stream.writeAll(", "); |
| 822 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index])))); | 822 | try self.writeInstRef(stream, @fromBackingInt(self.code.extra[extra_index])); |
| 823 | extra_index += 1; | 823 | extra_index += 1; |
| 824 | } | 824 | } |
| 825 | if (inst_data.flags.has_align) { | 825 | if (inst_data.flags.has_align) { |
| 826 | try stream.writeAll(", align("); | 826 | try stream.writeAll(", align("); |
| 827 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index])))); | 827 | try self.writeInstRef(stream, @fromBackingInt(self.code.extra[extra_index])); |
| 828 | extra_index += 1; | 828 | extra_index += 1; |
| 829 | if (inst_data.flags.has_bit_range) { | 829 | if (inst_data.flags.has_bit_range) { |
| 830 | const bit_start = extra_index + @intFromBool(inst_data.flags.has_addrspace); | 830 | const bit_start = extra_index + @intFromBool(inst_data.flags.has_addrspace); |
| 831 | try stream.writeAll(":"); | 831 | try stream.writeAll(":"); |
| 832 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[bit_start])))); | 832 | try self.writeInstRef(stream, @fromBackingInt(self.code.extra[bit_start])); |
| 833 | try stream.writeAll(":"); | 833 | try stream.writeAll(":"); |
| 834 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[bit_start + 1])))); | 834 | try self.writeInstRef(stream, @fromBackingInt(self.code.extra[bit_start + 1])); |
| 835 | } | 835 | } |
| 836 | try stream.writeAll(")"); | 836 | try stream.writeAll(")"); |
| 837 | } | 837 | } |
| 838 | if (inst_data.flags.has_addrspace) { | 838 | if (inst_data.flags.has_addrspace) { |
| 839 | try stream.writeAll(", addrspace("); | 839 | try stream.writeAll(", addrspace("); |
| 840 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index])))); | 840 | try self.writeInstRef(stream, @fromBackingInt(self.code.extra[extra_index])); |
| 841 | try stream.writeAll(")"); | 841 | try stream.writeAll(")"); |
| 842 | } | 842 | } |
| 843 | try stream.writeAll(") "); | 843 | try stream.writeAll(") "); |
| ... | @@ -1294,7 +1294,7 @@ const Writer = struct { | ... | @@ -1294,7 +1294,7 @@ const Writer = struct { |
| 1294 | | 1294 | |
| 1295 | try self.writeFlag(stream, "volatile, ", small.is_volatile); | 1295 | try self.writeFlag(stream, "volatile, ", small.is_volatile); |
| 1296 | if (tmpl_is_expr) { | 1296 | if (tmpl_is_expr) { |
| 1297 | try self.writeInstRef(stream, @fromBackingInt(@intCast(@backingInt(extra.data.asm_source)))); | 1297 | try self.writeInstRef(stream, @fromBackingInt(@backingInt(extra.data.asm_source))); |
| 1298 | } else { | 1298 | } else { |
| 1299 | const asm_source = self.code.nullTerminatedString(extra.data.asm_source); | 1299 | const asm_source = self.code.nullTerminatedString(extra.data.asm_source); |
| 1300 | try stream.print("\"{f}\"", .{std.zig.fmtString(asm_source)}); | 1300 | try stream.print("\"{f}\"", .{std.zig.fmtString(asm_source)}); |
| ... | @@ -1675,9 +1675,9 @@ const Writer = struct { | ... | @@ -1675,9 +1675,9 @@ const Writer = struct { |
| 1675 | extra_index += 2; | 1675 | extra_index += 2; |
| 1676 | | 1676 | |
| 1677 | try stream.print("@\"{d}\": ", .{field_idx}); | 1677 | try stream.print("@\"{d}\": ", .{field_idx}); |
| 1678 | try self.writeInstRef(stream, @fromBackingInt(@intCast(field_ty))); | 1678 | try self.writeInstRef(stream, @fromBackingInt(field_ty)); |
| 1679 | try stream.writeAll(" = "); | 1679 | try stream.writeAll(" = "); |
| 1680 | try self.writeInstRef(stream, @fromBackingInt(@intCast(field_init))); | 1680 | try self.writeInstRef(stream, @fromBackingInt(field_init)); |
| 1681 | } | 1681 | } |
| 1682 | | 1682 | |
| 1683 | try stream.writeAll(" }) "); | 1683 | try stream.writeAll(" }) "); |
| ... | @@ -1696,10 +1696,10 @@ const Writer = struct { | ... | @@ -1696,10 +1696,10 @@ const Writer = struct { |
| 1696 | try stream.writeAll("{\n"); | 1696 | try stream.writeAll("{\n"); |
| 1697 | self.indent += 2; | 1697 | self.indent += 2; |
| 1698 | | 1698 | |
| 1699 | var extra_index = @as(u32, @intCast(extra.end)); | 1699 | var extra_index: u32 = @intCast(extra.end); |
| 1700 | const extra_index_end = extra_index + extra.data.fields_len; | 1700 | const extra_index_end = extra_index + extra.data.fields_len; |
| 1701 | while (extra_index < extra_index_end) : (extra_index += 1) { | 1701 | while (extra_index < extra_index_end) : (extra_index += 1) { |
| 1702 | const name_index: Zir.NullTerminatedString = @fromBackingInt(@intCast(self.code.extra[extra_index])); | 1702 | const name_index: Zir.NullTerminatedString = @fromBackingInt(self.code.extra[extra_index]); |
| 1703 | const name = self.code.nullTerminatedString(name_index); | 1703 | const name = self.code.nullTerminatedString(name_index); |
| 1704 | try stream.splatByteAll(' ', self.indent); | 1704 | try stream.splatByteAll(' ', self.indent); |
| 1705 | try stream.print("{f},\n", .{std.zig.fmtIdP(name)}); | 1705 | try stream.print("{f},\n", .{std.zig.fmtIdP(name)}); |
| ... | @@ -1923,7 +1923,7 @@ const Writer = struct { | ... | @@ -1923,7 +1923,7 @@ const Writer = struct { |
| 1923 | ret_ty_ref = .void_type; | 1923 | ret_ty_ref = .void_type; |
| 1924 | }, | 1924 | }, |
| 1925 | 1 => { | 1925 | 1 => { |
| 1926 | ret_ty_ref = @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index]))); | 1926 | ret_ty_ref = @fromBackingInt(self.code.extra[extra_index]); |
| 1927 | extra_index += 1; | 1927 | extra_index += 1; |
| 1928 | }, | 1928 | }, |
| 1929 | else => { | 1929 | else => { |
| ... | @@ -1974,7 +1974,7 @@ const Writer = struct { | ... | @@ -1974,7 +1974,7 @@ const Writer = struct { |
| 1974 | cc_body = self.code.bodySlice(extra_index, body_len); | 1974 | cc_body = self.code.bodySlice(extra_index, body_len); |
| 1975 | extra_index += cc_body.len; | 1975 | extra_index += cc_body.len; |
| 1976 | } else if (extra.data.bits.has_cc_ref) { | 1976 | } else if (extra.data.bits.has_cc_ref) { |
| 1977 | cc_ref = @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index]))); | 1977 | cc_ref = @fromBackingInt(self.code.extra[extra_index]); |
| 1978 | extra_index += 1; | 1978 | extra_index += 1; |
| 1979 | } | 1979 | } |
| 1980 | if (extra.data.bits.has_ret_ty_body) { | 1980 | if (extra.data.bits.has_ret_ty_body) { |
| ... | @@ -1983,7 +1983,7 @@ const Writer = struct { | ... | @@ -1983,7 +1983,7 @@ const Writer = struct { |
| 1983 | ret_ty_body = self.code.bodySlice(extra_index, body_len); | 1983 | ret_ty_body = self.code.bodySlice(extra_index, body_len); |
| 1984 | extra_index += ret_ty_body.len; | 1984 | extra_index += ret_ty_body.len; |
| 1985 | } else if (extra.data.bits.has_ret_ty_ref) { | 1985 | } else if (extra.data.bits.has_ret_ty_ref) { |
| 1986 | ret_ty_ref = @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index]))); | 1986 | ret_ty_ref = @fromBackingInt(self.code.extra[extra_index]); |
| 1987 | extra_index += 1; | 1987 | extra_index += 1; |
| 1988 | } | 1988 | } |
| 1989 | | 1989 | |
| ... | @@ -2019,16 +2019,16 @@ const Writer = struct { | ... | @@ -2019,16 +2019,16 @@ const Writer = struct { |
| 2019 | | 2019 | |
| 2020 | fn writeAllocExtended(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { | 2020 | fn writeAllocExtended(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { |
| 2021 | const extra = self.code.extraData(Zir.Inst.AllocExtended, extended.operand); | 2021 | const extra = self.code.extraData(Zir.Inst.AllocExtended, extended.operand); |
| 2022 | const small = @as(Zir.Inst.AllocExtended.Small, @bitCast(extended.small)); | 2022 | const small: Zir.Inst.AllocExtended.Small = @bitCast(extended.small); |
| 2023 | | 2023 | |
| 2024 | var extra_index: usize = extra.end; | 2024 | var extra_index: usize = extra.end; |
| 2025 | const type_inst: Zir.Inst.Ref = if (!small.has_type) .none else blk: { | 2025 | const type_inst: Zir.Inst.Ref = if (!small.has_type) .none else blk: { |
| 2026 | const type_inst = @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index]))); | 2026 | const type_inst: Zir.Inst.Ref = @fromBackingInt(self.code.extra[extra_index]); |
| 2027 | extra_index += 1; | 2027 | extra_index += 1; |
| 2028 | break :blk type_inst; | 2028 | break :blk type_inst; |
| 2029 | }; | 2029 | }; |
| 2030 | const align_inst: Zir.Inst.Ref = if (!small.has_align) .none else blk: { | 2030 | const align_inst: Zir.Inst.Ref = if (!small.has_align) .none else blk: { |
| 2031 | const align_inst = @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index]))); | 2031 | const align_inst: Zir.Inst.Ref = @fromBackingInt(self.code.extra[extra_index]); |
| 2032 | extra_index += 1; | 2032 | extra_index += 1; |
| 2033 | break :blk align_inst; | 2033 | break :blk align_inst; |
| 2034 | }; | 2034 | }; |
| ... | @@ -2269,20 +2269,20 @@ const Writer = struct { | ... | @@ -2269,20 +2269,20 @@ const Writer = struct { |
| 2269 | | 2269 | |
| 2270 | fn writeClosureGet(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { | 2270 | fn writeClosureGet(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { |
| 2271 | try stream.print("{d})) ", .{extended.small}); | 2271 | try stream.print("{d})) ", .{extended.small}); |
| 2272 | const src_node: Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(extended.operand)))); | 2272 | const src_node: Ast.Node.Offset = @fromBackingInt(@bitCast(extended.operand)); |
| 2273 | try self.writeSrcNode(stream, src_node); | 2273 | try self.writeSrcNode(stream, src_node); |
| 2274 | } | 2274 | } |
| 2275 | | 2275 | |
| 2276 | fn writeStdLangValue(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { | 2276 | fn writeStdLangValue(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { |
| 2277 | const val: Zir.Inst.StdLangValue = @fromBackingInt(@intCast(extended.small)); | 2277 | const val: Zir.Inst.StdLangValue = @fromBackingInt(extended.small); |
| 2278 | try stream.print("{s})) ", .{@tagName(val)}); | 2278 | try stream.print("{s})) ", .{@tagName(val)}); |
| 2279 | const src_node: Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(extended.operand)))); | 2279 | const src_node: Ast.Node.Offset = @fromBackingInt(@bitCast(extended.operand)); |
| 2280 | try self.writeSrcNode(stream, src_node); | 2280 | try self.writeSrcNode(stream, src_node); |
| 2281 | } | 2281 | } |
| 2282 | | 2282 | |
| 2283 | fn writeInplaceArithResultTy(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { | 2283 | fn writeInplaceArithResultTy(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { |
| 2284 | const op: Zir.Inst.InplaceOp = @fromBackingInt(@intCast(extended.small)); | 2284 | const op: Zir.Inst.InplaceOp = @fromBackingInt(extended.small); |
| 2285 | try self.writeInstRef(stream, @fromBackingInt(@intCast(extended.operand))); | 2285 | try self.writeInstRef(stream, @fromBackingInt(extended.operand)); |
| 2286 | try stream.print(", {s}))", .{@tagName(op)}); | 2286 | try stream.print(", {s}))", .{@tagName(op)}); |
| 2287 | } | 2287 | } |
| 2288 | | 2288 | |
| ... | @@ -2292,7 +2292,7 @@ const Writer = struct { | ... | @@ -2292,7 +2292,7 @@ const Writer = struct { |
| 2292 | } else if (ref.toIndex()) |i| { | 2292 | } else if (ref.toIndex()) |i| { |
| 2293 | return self.writeInstIndex(stream, i); | 2293 | return self.writeInstIndex(stream, i); |
| 2294 | } else { | 2294 | } else { |
| 2295 | const val: InternPool.Index = @fromBackingInt(@intCast(@backingInt(ref))); | 2295 | const val: InternPool.Index = @fromBackingInt(@backingInt(ref)); |
| 2296 | return stream.print("@{s}", .{@tagName(val)}); | 2296 | return stream.print("@{s}", .{@tagName(val)}); |
| 2297 | } | 2297 | } |
| 2298 | } | 2298 | } |