diff options
| author | Robin Voetter <robin@voetter.nl> | 2023-10-07 14:21:59 +0200 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2023-10-15 13:59:24 +0200 |
| commit | ab701c3d375b102bc291f80a791109cb109964ba (patch) | |
| tree | 59674ae05f842a378498ad86e4b84f070d7a4bdd /src/link | |
| parent | 08ea9a9ff6962c40eb87ab4951bc07a05b3831c9 (diff) | |
| download | zig-ab701c3d375b102bc291f80a791109cb109964ba.tar.gz zig-ab701c3d375b102bc291f80a791109cb109964ba.zip | |
spirv: anon decl refs
Diffstat (limited to 'src/link')
| -rw-r--r-- | src/link/SpirV.zig | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/link/SpirV.zig b/src/link/SpirV.zig index e3efc0f671..89aec81578 100644 --- a/src/link/SpirV.zig +++ b/src/link/SpirV.zig @@ -48,6 +48,7 @@ base: link.File, spv: SpvModule, spv_arena: ArenaAllocator, decl_link: codegen.DeclLinkMap, +anon_decl_link: codegen.AnonDeclLinkMap, pub fn createEmpty(gpa: Allocator, options: link.Options) !*SpirV { const self = try gpa.create(SpirV); @@ -61,6 +62,7 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*SpirV { .spv = undefined, .spv_arena = ArenaAllocator.init(gpa), .decl_link = codegen.DeclLinkMap.init(self.base.allocator), + .anon_decl_link = codegen.AnonDeclLinkMap.init(self.base.allocator), }; self.spv = SpvModule.init(gpa, self.spv_arena.allocator()); errdefer self.deinit(); @@ -102,6 +104,7 @@ pub fn deinit(self: *SpirV) void { self.spv.deinit(); self.spv_arena.deinit(); self.decl_link.deinit(); + self.anon_decl_link.deinit(); } pub fn updateFunc(self: *SpirV, module: *Module, func_index: InternPool.Index, air: Air, liveness: Liveness) !void { @@ -113,7 +116,7 @@ pub fn updateFunc(self: *SpirV, module: *Module, func_index: InternPool.Index, a const decl = module.declPtr(func.owner_decl); log.debug("lowering function {s}", .{module.intern_pool.stringToSlice(decl.name)}); - var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link); + var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link, &self.anon_decl_link); defer decl_gen.deinit(); if (try decl_gen.gen(func.owner_decl, air, liveness)) |msg| { @@ -129,7 +132,7 @@ pub fn updateDecl(self: *SpirV, module: *Module, decl_index: Module.Decl.Index) const decl = module.declPtr(decl_index); log.debug("lowering declaration {s}", .{module.intern_pool.stringToSlice(decl.name)}); - var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link); + var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link, &self.anon_decl_link); defer decl_gen.deinit(); if (try decl_gen.gen(decl_index, undefined, undefined)) |msg| { |
