diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-24 14:31:00 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-24 15:02:05 -0700 |
| commit | 93ae386f560e7a3464df31b7c9bc9acdc231bc3f (patch) | |
| tree | 4d279258d3812a47b5f5188c9304937c6133fa98 /src/Module.zig | |
| parent | be294e3744b221e7a7aad3ce8fbd1a30148487bc (diff) | |
| download | zig-93ae386f560e7a3464df31b7c9bc9acdc231bc3f.tar.gz zig-93ae386f560e7a3464df31b7c9bc9acdc231bc3f.zip | |
stage2: don't skip liveness or codegen if -femit-asm is supplied
Fixes Godbolt's CLI usage of Zig.
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/Module.zig b/src/Module.zig index fd97e5c948..c144c9acbd 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -4122,13 +4122,21 @@ pub fn ensureFuncBodyAnalyzed(mod: *Module, func: *Fn) SemaError!void { }; defer air.deinit(gpa); - if (mod.comp.bin_file.options.emit == null) return; + const comp = mod.comp; + + if (comp.bin_file.options.emit == null and + comp.emit_asm == null and + comp.emit_llvm_ir == null and + comp.emit_llvm_bc == null) + { + return; + } log.debug("analyze liveness of {s}", .{decl.name}); var liveness = try Liveness.analyze(gpa, air); defer liveness.deinit(gpa); - if (builtin.mode == .Debug and mod.comp.verbose_air) { + if (builtin.mode == .Debug and comp.verbose_air) { const fqn = try decl.getFullyQualifiedName(mod); defer mod.gpa.free(fqn); @@ -4137,7 +4145,7 @@ pub fn ensureFuncBodyAnalyzed(mod: *Module, func: *Fn) SemaError!void { std.debug.print("# End Function AIR: {s}\n\n", .{fqn}); } - mod.comp.bin_file.updateFunc(mod, func, air, liveness) catch |err| switch (err) { + comp.bin_file.updateFunc(mod, func, air, liveness) catch |err| switch (err) { error.OutOfMemory => return error.OutOfMemory, error.AnalysisFail => { decl.analysis = .codegen_failure; |
