diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2025-05-28 22:45:19 -0400 |
|---|---|---|
| committer | Jacob Young <15544577+jacobly0@users.noreply.github.com> | 2025-05-29 03:57:48 -0400 |
| commit | c04be630d996a0e01fd3cf05e6cade006e4226ce (patch) | |
| tree | edd9d55ad05435b91bd3cb95208a76ead2001094 /src/link.zig | |
| parent | f25212a479c4f26566b6b851e245e49c6f508b96 (diff) | |
| download | zig-c04be630d996a0e01fd3cf05e6cade006e4226ce.tar.gz zig-c04be630d996a0e01fd3cf05e6cade006e4226ce.zip | |
Legalize: introduce a new pass before liveness
Each target can opt into different sets of legalize features.
By performing these transformations before liveness, instructions
that become unreferenced will have up-to-date liveness information.
Diffstat (limited to 'src/link.zig')
| -rw-r--r-- | src/link.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/link.zig b/src/link.zig index cbc641a61a..8dfe3929a0 100644 --- a/src/link.zig +++ b/src/link.zig @@ -15,7 +15,6 @@ const Path = std.Build.Cache.Path; const Directory = std.Build.Cache.Directory; const Compilation = @import("Compilation.zig"); const LibCInstallation = std.zig.LibCInstallation; -const Liveness = @import("Liveness.zig"); const Zcu = @import("Zcu.zig"); const InternPool = @import("InternPool.zig"); const Type = @import("Type.zig"); @@ -738,7 +737,7 @@ pub const File = struct { pt: Zcu.PerThread, func_index: InternPool.Index, air: Air, - liveness: Liveness, + liveness: Air.Liveness, ) UpdateNavError!void { switch (base.tag) { inline else => |tag| { @@ -1601,8 +1600,9 @@ pub fn doTask(comp: *Compilation, tid: usize, task: Task) void { if (comp.remaining_prelink_tasks == 0) { const pt: Zcu.PerThread = .activate(comp.zcu.?, @enumFromInt(tid)); defer pt.deactivate(); - // This call takes ownership of `func.air`. - pt.linkerUpdateFunc(func.func, func.air) catch |err| switch (err) { + var air = func.air; + defer air.deinit(comp.gpa); + pt.linkerUpdateFunc(func.func, &air) catch |err| switch (err) { error.OutOfMemory => diags.setAllocFailure(), }; } else { |
