aboutsummaryrefslogtreecommitdiff
path: root/src/link.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2025-06-08 16:25:28 +0100
committermlugg <mlugg@mlugg.co.uk>2025-06-12 13:55:41 +0100
commitac745edbbd6687c5898bb3a50bf9d31d86e57b9e (patch)
treecca2d95cd7cbb1576e604ef9f4ad46a1b029c990 /src/link.zig
parentdb5d85b8c89b755bd8865def3bd7114d5d9d4867 (diff)
downloadzig-ac745edbbd6687c5898bb3a50bf9d31d86e57b9e.tar.gz
zig-ac745edbbd6687c5898bb3a50bf9d31d86e57b9e.zip
compiler: estimate totals for "Code Generation" and "Linking" progress nodes
Diffstat (limited to 'src/link.zig')
-rw-r--r--src/link.zig29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/link.zig b/src/link.zig
index 7d522b94d3..ce98ac8929 100644
--- a/src/link.zig
+++ b/src/link.zig
@@ -1290,7 +1290,10 @@ pub const ZcuTask = union(enum) {
pub fn doPrelinkTask(comp: *Compilation, task: PrelinkTask) void {
const diags = &comp.link_diags;
- const base = comp.bin_file orelse return;
+ const base = comp.bin_file orelse {
+ comp.link_prog_node.completeOne();
+ return;
+ };
switch (task) {
.load_explicitly_provided => {
const prog_node = comp.link_prog_node.start("Parse Inputs", comp.link_inputs.len);
@@ -1413,12 +1416,13 @@ pub fn doPrelinkTask(comp: *Compilation, task: PrelinkTask) void {
}
pub fn doZcuTask(comp: *Compilation, tid: usize, task: ZcuTask) void {
const diags = &comp.link_diags;
+ const zcu = comp.zcu.?;
+ const ip = &zcu.intern_pool;
+ const pt: Zcu.PerThread = .activate(zcu, @enumFromInt(tid));
+ defer pt.deactivate();
switch (task) {
.link_nav => |nav_index| {
- const zcu = comp.zcu.?;
- const pt: Zcu.PerThread = .activate(zcu, @enumFromInt(tid));
- defer pt.deactivate();
- const fqn_slice = zcu.intern_pool.getNav(nav_index).fqn.toSlice(&zcu.intern_pool);
+ const fqn_slice = ip.getNav(nav_index).fqn.toSlice(ip);
const nav_prog_node = comp.link_prog_node.start(fqn_slice, 0);
defer nav_prog_node.end();
if (zcu.llvm_object) |llvm_object| {
@@ -1440,11 +1444,8 @@ pub fn doZcuTask(comp: *Compilation, tid: usize, task: ZcuTask) void {
}
},
.link_func => |func| {
- const zcu = comp.zcu.?;
const nav = zcu.funcInfo(func.func).owner_nav;
- const pt: Zcu.PerThread = .activate(zcu, @enumFromInt(tid));
- defer pt.deactivate();
- const fqn_slice = zcu.intern_pool.getNav(nav).fqn.toSlice(&zcu.intern_pool);
+ const fqn_slice = ip.getNav(nav).fqn.toSlice(ip);
const nav_prog_node = comp.link_prog_node.start(fqn_slice, 0);
defer nav_prog_node.end();
switch (func.mir.status.load(.monotonic)) {
@@ -1468,9 +1469,9 @@ pub fn doZcuTask(comp: *Compilation, tid: usize, task: ZcuTask) void {
}
},
.link_type => |ty| {
- const zcu = comp.zcu.?;
- const pt: Zcu.PerThread = .activate(zcu, @enumFromInt(tid));
- defer pt.deactivate();
+ const name = Type.fromInterned(ty).containerTypeName(ip).toSlice(ip);
+ const nav_prog_node = comp.link_prog_node.start(name, 0);
+ defer nav_prog_node.end();
if (zcu.llvm_object == null) {
if (comp.bin_file) |lf| {
lf.updateContainerType(pt, ty) catch |err| switch (err) {
@@ -1481,8 +1482,8 @@ pub fn doZcuTask(comp: *Compilation, tid: usize, task: ZcuTask) void {
}
},
.update_line_number => |ti| {
- const pt: Zcu.PerThread = .activate(comp.zcu.?, @enumFromInt(tid));
- defer pt.deactivate();
+ const nav_prog_node = comp.link_prog_node.start("Update line number", 0);
+ defer nav_prog_node.end();
if (pt.zcu.llvm_object == null) {
if (comp.bin_file) |lf| {
lf.updateLineNumber(pt, ti) catch |err| switch (err) {