aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-01-02 13:40:23 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-01-02 19:11:55 -0700
commit006e7f68056af62ae7713d7ef228841d11874735 (patch)
tree0d64585b1d78040506a898140ddc619e002b2147 /src/codegen
parent9362f382ab7023592cc1d71044217b847b122406 (diff)
downloadzig-006e7f68056af62ae7713d7ef228841d11874735.tar.gz
zig-006e7f68056af62ae7713d7ef228841d11874735.zip
stage2: re-use ZIR for comptime and inline calls
Instead of freeing ZIR after semantic analysis, we keep it around so that it can be used for comptime calls, inline calls, and generic function calls. ZIR memory is now managed by the Decl arena. Debug dump() functions are conditionally compiled; only available in Debug builds of the compiler. Add a test for an inline function call.
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/c.zig2
-rw-r--r--src/codegen/wasm.zig2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 712d663af0..1a89e22d48 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -275,7 +275,7 @@ pub fn generate(file: *C, module: *Module, decl: *Decl) !void {
try writer.writeAll(" {");
const func: *Module.Fn = func_payload.data;
- const instructions = func.data.body.instructions;
+ const instructions = func.body.instructions;
if (instructions.len > 0) {
try writer.writeAll("\n");
for (instructions) |inst| {
diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig
index 1eb4f5bc29..036243dcca 100644
--- a/src/codegen/wasm.zig
+++ b/src/codegen/wasm.zig
@@ -63,7 +63,7 @@ pub fn genCode(buf: *ArrayList(u8), decl: *Decl) !void {
// TODO: check for and handle death of instructions
const tv = decl.typed_value.most_recent.typed_value;
const mod_fn = tv.val.castTag(.function).?.data;
- for (mod_fn.data.body.instructions) |inst| try genInst(buf, decl, inst);
+ for (mod_fn.body.instructions) |inst| try genInst(buf, decl, inst);
// Write 'end' opcode
try writer.writeByte(0x0B);