diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-07-12 19:51:31 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-07-20 12:19:16 -0700 |
| commit | 0f38f686964664f68e013ec3c63cfe655001f165 (patch) | |
| tree | e8ed5924afcce0b9783c664e8e0c4c7d04e34d6f /src/codegen.zig | |
| parent | 0ffc6b5cc300e750029c9ff22f6a1ed0596496d6 (diff) | |
| download | zig-0f38f686964664f68e013ec3c63cfe655001f165.tar.gz zig-0f38f686964664f68e013ec3c63cfe655001f165.zip | |
stage2: Air and Liveness are passed ephemerally
to the link infrastructure, instead of being stored with Module.Fn. This
moves towards a strategy to make more efficient use of memory by not
storing Air or Liveness data in the Fn struct, but computing it on
demand, immediately sending it to the backend, and then immediately
freeing it.
Backends which want to defer codegen until flush() such as SPIR-V
must move the Air/Liveness data upon `updateFunc` being called and keep
track of that data in the backend implementation itself.
Diffstat (limited to 'src/codegen.zig')
| -rw-r--r-- | src/codegen.zig | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/codegen.zig b/src/codegen.zig index eaf910977e..a6c4b5ad3c 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -282,7 +282,8 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { return struct { gpa: *Allocator, - air: *const Air, + air: Air, + liveness: Liveness, bin_file: *link.File, target: *const std.Target, mod_fn: *const Module.Fn, @@ -468,8 +469,8 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { var function = Self{ .gpa = bin_file.allocator, - .air = &air, - .liveness = &liveness, + .air = air, + .liveness = liveness, .target = &bin_file.options.target, .bin_file = bin_file, .mod_fn = module_fn, |
