diff options
author | Mathias Magnusson <mathias@magnusson.space> | 2025-06-03 00:34:15 +0200 |
---|---|---|
committer | Mathias Magnusson <mathias@magnusson.space> | 2025-06-03 00:34:15 +0200 |
commit | 5a421bb91780e74404d83df2e99d7469b3cb8b90 (patch) | |
tree | e0b4fdf996701d7f143a59201f227c7013313e75 /src/codegen.zig | |
parent | e2e77b4b06e51c7f7d3ea187defaf1ad08e513c1 (diff) | |
download | huginn-5a421bb91780e74404d83df2e99d7469b3cb8b90.tar.gz |
add { blocks } with scoped local variables
Diffstat (limited to 'src/codegen.zig')
-rw-r--r-- | src/codegen.zig | 6 |
1 files changed, 3 insertions, 3 deletions
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(); |