From 5a421bb91780e74404d83df2e99d7469b3cb8b90 Mon Sep 17 00:00:00 2001 From: Mathias Magnusson Date: Tue, 3 Jun 2025 00:34:15 +0200 Subject: add { blocks } with scoped local variables --- src/codegen.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/codegen.zig') diff --git a/src/codegen.zig b/src/codegen.zig index f186304..dd484b0 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -548,7 +548,7 @@ const Context = struct { instructions: std.ArrayList(Instruction), // Current stuff that changes often, basically here to avoid prop drilling. - block: ?*const compile.Block = null, + block: ?*const compile.BasicBlock = null, current_instruction_index: ?usize = null, fn deinit(self: *Context) void { @@ -716,7 +716,7 @@ const Context = struct { } } - fn codegenBlock(self: *Context, block: compile.Block) !void { + fn codegenBlock(self: *Context, block: compile.BasicBlock) !void { self.block = █ defer self.block = null; for (block.instrs, 0..) |instr, i| { @@ -726,7 +726,7 @@ const Context = struct { } }; -pub fn create_elf(allocator: Allocator, block: compile.Block) ![]u8 { +pub fn create_elf(allocator: Allocator, block: compile.BasicBlock) ![]u8 { var ctx: Context = .{ .register_allocator = try .init(allocator), .instructions = .init(allocator) }; defer ctx.deinit(); -- cgit v1.2.3