| ... | @@ -33,7 +33,7 @@ pub fn renderAsTextToFile( | ... | @@ -33,7 +33,7 @@ pub fn renderAsTextToFile( |
| 33 | const stream = raw_stream.writer(); | 33 | const stream = raw_stream.writer(); |
| 34 | | 34 | |
| 35 | const main_struct_inst: Zir.Inst.Index = .main_struct_inst; | 35 | const main_struct_inst: Zir.Inst.Index = .main_struct_inst; |
| 36 | try stream.print("%{d} ", .{main_struct_inst}); | 36 | try stream.print("%{d} ", .{@intFromEnum(main_struct_inst)}); |
| 37 | try writer.writeInstToStream(stream, main_struct_inst); | 37 | try writer.writeInstToStream(stream, main_struct_inst); |
| 38 | try stream.writeAll("\n"); | 38 | try stream.writeAll("\n"); |
| 39 | const imports_index = scope_file.zir.extra[@intFromEnum(Zir.ExtraIndex.imports)]; | 39 | const imports_index = scope_file.zir.extra[@intFromEnum(Zir.ExtraIndex.imports)]; |
| ... | @@ -85,7 +85,7 @@ pub fn renderInstructionContext( | ... | @@ -85,7 +85,7 @@ pub fn renderInstructionContext( |
| 85 | | 85 | |
| 86 | try writer.writeBody(stream, block[0..block_index]); | 86 | try writer.writeBody(stream, block[0..block_index]); |
| 87 | try stream.writeByteNTimes(' ', writer.indent - 2); | 87 | try stream.writeByteNTimes(' ', writer.indent - 2); |
| 88 | try stream.print("> %{d} ", .{block[block_index]}); | 88 | try stream.print("> %{d} ", .{@intFromEnum(block[block_index])}); |
| 89 | try writer.writeInstToStream(stream, block[block_index]); | 89 | try writer.writeInstToStream(stream, block[block_index]); |
| 90 | try stream.writeByte('\n'); | 90 | try stream.writeByte('\n'); |
| 91 | if (block_index + 1 < block.len) { | 91 | if (block_index + 1 < block.len) { |
| ... | @@ -115,7 +115,7 @@ pub fn renderSingleInstruction( | ... | @@ -115,7 +115,7 @@ pub fn renderSingleInstruction( |
| 115 | .recurse_blocks = false, | 115 | .recurse_blocks = false, |
| 116 | }; | 116 | }; |
| 117 | | 117 | |
| 118 | try stream.print("%{d} ", .{inst}); | 118 | try stream.print("%{d} ", .{@intFromEnum(inst)}); |
| 119 | try writer.writeInstToStream(stream, inst); | 119 | try writer.writeInstToStream(stream, inst); |
| 120 | } | 120 | } |
| 121 | | 121 | |
| ... | @@ -1811,7 +1811,7 @@ const Writer = struct { | ... | @@ -1811,7 +1811,7 @@ const Writer = struct { |
| 1811 | if (self.recurse_decls) { | 1811 | if (self.recurse_decls) { |
| 1812 | const tag = self.code.instructions.items(.tag)[@intFromEnum(decl_index)]; | 1812 | const tag = self.code.instructions.items(.tag)[@intFromEnum(decl_index)]; |
| 1813 | try stream.print(" line({d}) hash({}): %{d} = {s}(", .{ | 1813 | try stream.print(" line({d}) hash({}): %{d} = {s}(", .{ |
| 1814 | line, std.fmt.fmtSliceHexLower(&hash_bytes), decl_index, @tagName(tag), | 1814 | line, std.fmt.fmtSliceHexLower(&hash_bytes), @intFromEnum(decl_index), @tagName(tag), |
| 1815 | }); | 1815 | }); |
| 1816 | | 1816 | |
| 1817 | const decl_block_inst_data = self.code.instructions.items(.data)[@intFromEnum(decl_index)].pl_node; | 1817 | const decl_block_inst_data = self.code.instructions.items(.data)[@intFromEnum(decl_index)].pl_node; |
| ... | @@ -1823,7 +1823,7 @@ const Writer = struct { | ... | @@ -1823,7 +1823,7 @@ const Writer = struct { |
| 1823 | try stream.writeAll("\n"); | 1823 | try stream.writeAll("\n"); |
| 1824 | } else { | 1824 | } else { |
| 1825 | try stream.print(" line({d}) hash({}): %{d} = ...\n", .{ | 1825 | try stream.print(" line({d}) hash({}): %{d} = ...\n", .{ |
| 1826 | line, std.fmt.fmtSliceHexLower(&hash_bytes), decl_index, | 1826 | line, std.fmt.fmtSliceHexLower(&hash_bytes), @intFromEnum(decl_index), |
| 1827 | }); | 1827 | }); |
| 1828 | } | 1828 | } |
| 1829 | } | 1829 | } |
| ... | @@ -2462,9 +2462,15 @@ const Writer = struct { | ... | @@ -2462,9 +2462,15 @@ const Writer = struct { |
| 2462 | fn writeRestoreErrRetIndex(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void { | 2462 | fn writeRestoreErrRetIndex(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void { |
| 2463 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].restore_err_ret_index; | 2463 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].restore_err_ret_index; |
| 2464 | | 2464 | |
| 2465 | try self.writeInstRef(stream, inst_data.block); | 2465 | if (inst_data.block != .none) { |
| 2466 | try stream.writeAll(", "); | 2466 | try self.writeInstRef(stream, inst_data.block); |
| 2467 | try self.writeInstRef(stream, inst_data.operand); | 2467 | } |
| | 2468 | |
| | 2469 | if (inst_data.operand != .none) { |
| | 2470 | if (inst_data.block != .none) try stream.writeAll(", "); |
| | 2471 | try self.writeInstRef(stream, inst_data.operand); |
| | 2472 | } |
| | 2473 | |
| 2468 | try stream.writeAll(")"); | 2474 | try stream.writeAll(")"); |
| 2469 | } | 2475 | } |
| 2470 | | 2476 | |
| ... | @@ -2613,13 +2619,13 @@ const Writer = struct { | ... | @@ -2613,13 +2619,13 @@ const Writer = struct { |
| 2613 | return self.writeInstIndex(stream, i); | 2619 | return self.writeInstIndex(stream, i); |
| 2614 | } else { | 2620 | } else { |
| 2615 | const val: InternPool.Index = @enumFromInt(@intFromEnum(ref)); | 2621 | const val: InternPool.Index = @enumFromInt(@intFromEnum(ref)); |
| 2616 | return stream.print("@{}", .{val}); | 2622 | return stream.print("@{s}", .{@tagName(val)}); |
| 2617 | } | 2623 | } |
| 2618 | } | 2624 | } |
| 2619 | | 2625 | |
| 2620 | fn writeInstIndex(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void { | 2626 | fn writeInstIndex(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void { |
| 2621 | _ = self; | 2627 | _ = self; |
| 2622 | return stream.print("%{d}", .{inst}); | 2628 | return stream.print("%{d}", .{@intFromEnum(inst)}); |
| 2623 | } | 2629 | } |
| 2624 | | 2630 | |
| 2625 | fn writeOptionalInstRef( | 2631 | fn writeOptionalInstRef( |
| ... | @@ -2738,7 +2744,7 @@ const Writer = struct { | ... | @@ -2738,7 +2744,7 @@ const Writer = struct { |
| 2738 | fn writeBody(self: *Writer, stream: anytype, body: []const Zir.Inst.Index) !void { | 2744 | fn writeBody(self: *Writer, stream: anytype, body: []const Zir.Inst.Index) !void { |
| 2739 | for (body) |inst| { | 2745 | for (body) |inst| { |
| 2740 | try stream.writeByteNTimes(' ', self.indent); | 2746 | try stream.writeByteNTimes(' ', self.indent); |
| 2741 | try stream.print("%{d} ", .{inst}); | 2747 | try stream.print("%{d} ", .{@intFromEnum(inst)}); |
| 2742 | try self.writeInstToStream(stream, inst); | 2748 | try self.writeInstToStream(stream, inst); |
| 2743 | try stream.writeByte('\n'); | 2749 | try stream.writeByte('\n'); |
| 2744 | } | 2750 | } |