diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-07-15 15:52:06 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-07-20 12:19:16 -0700 |
| commit | eadbee2041bba1cd03b24d8f30161025af8e3590 (patch) | |
| tree | aebad285c7cd852fcc1c9d62f3beeb4395c6d04e /src/Sema.zig | |
| parent | 12c10139e3e0166e91d2dbb1801c2054ca12d413 (diff) | |
| download | zig-eadbee2041bba1cd03b24d8f30161025af8e3590.tar.gz zig-eadbee2041bba1cd03b24d8f30161025af8e3590.zip | |
stage2: first pass at printing AIR/Liveness to text
* some instructions are not implemented yet
* fix off-by-1 in Air.getMainBody
* Compilation: use `@import("builtin")` rather than `std.builtin`
for the values that are different for different build configurations.
* Sema: avoid calling `addType` in between
air_instructions.ensureUnusedCapacity and corresponding
appendAssumeCapacity because it can possibly add an instruction.
* Value: functions print their names
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index ac6755d24e..a144ce1d50 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -2028,6 +2028,7 @@ fn analyzeBlockBody( refToIndex(coerced_operand).?); // Convert the br operand to a block. + const br_operand_ty_ref = try sema.addType(br_operand_ty); try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len + coerce_block.instructions.items.len); try sema.air_instructions.ensureUnusedCapacity(gpa, 2); @@ -2037,7 +2038,7 @@ fn analyzeBlockBody( sema.air_instructions.appendAssumeCapacity(.{ .tag = .block, .data = .{ .ty_pl = .{ - .ty = try sema.addType(br_operand_ty), + .ty = br_operand_ty_ref, .payload = sema.addExtraAssumeCapacity(Air.Block{ .body_len = @intCast(u32, coerce_block.instructions.items.len), }), |
