aboutsummaryrefslogtreecommitdiff
path: root/src/link/SpirV.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2024-06-15 16:10:53 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2024-07-07 22:59:52 -0400
commit525f341f33af9b8aad53931fd5511f00a82cb090 (patch)
treecec3280498c1122858580946ac5e31f8feb807ce /src/link/SpirV.zig
parent8f20e81b8816aadd8ceb1b04bd3727cc1d124464 (diff)
downloadzig-525f341f33af9b8aad53931fd5511f00a82cb090.tar.gz
zig-525f341f33af9b8aad53931fd5511f00a82cb090.zip
Zcu: introduce `PerThread` and pass to all the functions
Diffstat (limited to 'src/link/SpirV.zig')
-rw-r--r--src/link/SpirV.zig32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/link/SpirV.zig b/src/link/SpirV.zig
index d1a8ff96c6..14020433bf 100644
--- a/src/link/SpirV.zig
+++ b/src/link/SpirV.zig
@@ -28,8 +28,6 @@ const assert = std.debug.assert;
const log = std.log.scoped(.link);
const Zcu = @import("../Zcu.zig");
-/// Deprecated.
-const Module = Zcu;
const InternPool = @import("../InternPool.zig");
const Compilation = @import("../Compilation.zig");
const link = @import("../link.zig");
@@ -125,35 +123,36 @@ pub fn deinit(self: *SpirV) void {
self.object.deinit();
}
-pub fn updateFunc(self: *SpirV, module: *Module, func_index: InternPool.Index, air: Air, liveness: Liveness) !void {
+pub fn updateFunc(self: *SpirV, pt: Zcu.PerThread, func_index: InternPool.Index, air: Air, liveness: Liveness) !void {
if (build_options.skip_non_native) {
@panic("Attempted to compile for architecture that was disabled by build configuration");
}
- const func = module.funcInfo(func_index);
- const decl = module.declPtr(func.owner_decl);
- log.debug("lowering function {}", .{decl.name.fmt(&module.intern_pool)});
+ const func = pt.zcu.funcInfo(func_index);
+ const decl = pt.zcu.declPtr(func.owner_decl);
+ log.debug("lowering function {}", .{decl.name.fmt(&pt.zcu.intern_pool)});
- try self.object.updateFunc(module, func_index, air, liveness);
+ try self.object.updateFunc(pt, func_index, air, liveness);
}
-pub fn updateDecl(self: *SpirV, module: *Module, decl_index: InternPool.DeclIndex) !void {
+pub fn updateDecl(self: *SpirV, pt: Zcu.PerThread, decl_index: InternPool.DeclIndex) !void {
if (build_options.skip_non_native) {
@panic("Attempted to compile for architecture that was disabled by build configuration");
}
- const decl = module.declPtr(decl_index);
- log.debug("lowering declaration {}", .{decl.name.fmt(&module.intern_pool)});
+ const decl = pt.zcu.declPtr(decl_index);
+ log.debug("lowering declaration {}", .{decl.name.fmt(&pt.zcu.intern_pool)});
- try self.object.updateDecl(module, decl_index);
+ try self.object.updateDecl(pt, decl_index);
}
pub fn updateExports(
self: *SpirV,
- mod: *Module,
- exported: Module.Exported,
+ pt: Zcu.PerThread,
+ exported: Zcu.Exported,
export_indices: []const u32,
) !void {
+ const mod = pt.zcu;
const decl_index = switch (exported) {
.decl_index => |i| i,
.value => |val| {
@@ -196,11 +195,11 @@ pub fn freeDecl(self: *SpirV, decl_index: InternPool.DeclIndex) void {
_ = decl_index;
}
-pub fn flush(self: *SpirV, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void {
- return self.flushModule(arena, prog_node);
+pub fn flush(self: *SpirV, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Progress.Node) link.File.FlushError!void {
+ return self.flushModule(arena, tid, prog_node);
}
-pub fn flushModule(self: *SpirV, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void {
+pub fn flushModule(self: *SpirV, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Progress.Node) link.File.FlushError!void {
if (build_options.skip_non_native) {
@panic("Attempted to compile for architecture that was disabled by build configuration");
}
@@ -216,6 +215,7 @@ pub fn flushModule(self: *SpirV, arena: Allocator, prog_node: std.Progress.Node)
const comp = self.base.comp;
const gpa = comp.gpa;
const target = comp.getTarget();
+ _ = tid;
try writeCapabilities(spv, target);
try writeMemoryModel(spv, target);