From e2e77b4b06e51c7f7d3ea187defaf1ad08e513c1 Mon Sep 17 00:00:00 2001 From: Mathias Magnusson Date: Mon, 2 Jun 2025 21:55:11 +0200 Subject: remove the need for explicit discard instructions by also considering an instruction's destination register(s) to be uses and when cleaning up registers, also cleaning up those from previous instructions (specifically this is the output of the last instruction if it is not used anywhere) --- src/main.zig | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index 15118d8..a9c77ac 100644 --- a/src/main.zig +++ b/src/main.zig @@ -62,6 +62,7 @@ pub fn main() !void { for (block.instrs) |instr| { std.debug.print(" {}\n", .{instr}); } + std.debug.print("Last use of each virtual register: {}\n", .{fmtHashMap(block.vreg_last_use)}); const elf = try codegen.create_elf(allocator, block); try output.writeAll(elf); std.debug.print("Run output:\n", .{}); -- cgit v1.2.3