aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-01-02 22:01:51 -0800
committerGitHub <noreply@github.com>2021-01-02 22:01:51 -0800
commitd8f3f14532c4b5d65377efaef015c3855137dccf (patch)
treed0927df77323d64bff52501b50ef8543a077d4d8 /src/Compilation.zig
parent3d151fbfc8db71f87ee84dd33c49910584708a04 (diff)
parent654832253a7857e78aab85e28ed09fb16b632dd2 (diff)
downloadzig-d8f3f14532c4b5d65377efaef015c3855137dccf.tar.gz
zig-d8f3f14532c4b5d65377efaef015c3855137dccf.zip
Merge pull request #7647 from ziglang/stage2-comptime-fn-call
stage2: comptime function calls and inline function calls
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index de115b9b40..9a06aee561 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -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());