Commit 7b1a644d6e
Changed files (2)
src/main.zig
@@ -6492,6 +6492,7 @@ pub fn cmdDumpZir(
.mod = undefined,
.root_decl = .none,
};
+ defer file.zir.deinit(gpa);
{
const instruction_bytes = file.zir.instructions.len *
src/print_zir.zig
@@ -2456,20 +2456,15 @@ const Writer = struct {
const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].save_err_ret_index;
try self.writeInstRef(stream, inst_data.operand);
+
try stream.writeAll(")");
}
fn writeRestoreErrRetIndex(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].restore_err_ret_index;
- if (inst_data.block != .none) {
- try self.writeInstRef(stream, inst_data.block);
- }
-
- if (inst_data.operand != .none) {
- if (inst_data.block != .none) try stream.writeAll(", ");
- try self.writeInstRef(stream, inst_data.operand);
- }
+ try self.writeInstRef(stream, inst_data.block);
+ try self.writeInstRef(stream, inst_data.operand);
try stream.writeAll(")");
}
@@ -2615,7 +2610,9 @@ const Writer = struct {
}
fn writeInstRef(self: *Writer, stream: anytype, ref: Zir.Inst.Ref) !void {
- if (ref.toIndex()) |i| {
+ if (ref == .none) {
+ return stream.writeAll(".none");
+ } else if (ref.toIndex()) |i| {
return self.writeInstIndex(stream, i);
} else {
const val: InternPool.Index = @enumFromInt(@intFromEnum(ref));