Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions build.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -220,7 +220,6 @@ pub fn build(b: *Builder) !void {
}

const log_scopes = b.option([]const []const u8, "log", "Which log scopes to enable") orelse &[0][]const u8{};
const zir_dumps = b.option([]const []const u8, "dump-zir", "Which functions to dump ZIR for before codegen") orelse &[0][]const u8{};

const opt_version_string = b.option([]const u8, "version-string", "Override Zig version string. Default is to find out with git.");
const version = if (opt_version_string) |version| version else v: {
Expand DownExpand Up@@ -277,7 +276,6 @@ pub fn build(b: *Builder) !void {
exe.addBuildOption(std.SemanticVersion, "semver", semver);

exe.addBuildOption([]const []const u8, "log_scopes", log_scopes);
exe.addBuildOption([]const []const u8, "zir_dumps", zir_dumps);
exe.addBuildOption(bool, "enable_tracy", tracy != null);
exe.addBuildOption(bool, "is_stage1", is_stage1);
if (tracy) |tracy_path| {
Expand Down
15 changes: 10 additions & 5 deletions src/Compilation.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -1459,24 +1459,29 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor
const module = self.bin_file.options.module.?;
if (decl.typed_value.most_recent.typed_value.val.castTag(.function)) |payload| {
const func = payload.data;
switch (func.analysis) {
switch (func.state) {
.queued => module.analyzeFnBody(decl, func) catch |err| switch (err) {
error.AnalysisFail => {
assert(func.analysis != .in_progress);
assert(func.state != .in_progress);
continue;
},
error.OutOfMemory => return error.OutOfMemory,
},
.in_progress => unreachable,
.inline_only => unreachable, // don't queue work for this
.sema_failure, .dependency_failure => continue,
.success => {},
}
// Here we tack on additional allocations to the Decl's arena. The allocations are
// lifetime annotations in the ZIR.
// Here we tack on additional allocations to the Decl's arena. The allocations
// are lifetime annotations in the ZIR.
var decl_arena = decl.typed_value.most_recent.arena.?.promote(module.gpa);
defer decl.typed_value.most_recent.arena.?.* = decl_arena.state;
log.debug("analyze liveness of {s}\n", .{decl.name});
try liveness.analyze(module.gpa, &decl_arena.allocator, func.analysis.success);
try liveness.analyze(module.gpa, &decl_arena.allocator, func.body);

if (std.builtin.mode == .Debug and self.verbose_ir) {
func.dump(module.*);
}
}

assert(decl.typed_value.most_recent.typed_value.ty.hasCodeGenBits());
Expand Down
Loading