aboutsummaryrefslogtreecommitdiff
path: root/src/Air.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-07-15 15:52:06 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-07-20 12:19:16 -0700
commiteadbee2041bba1cd03b24d8f30161025af8e3590 (patch)
treeaebad285c7cd852fcc1c9d62f3beeb4395c6d04e /src/Air.zig
parent12c10139e3e0166e91d2dbb1801c2054ca12d413 (diff)
downloadzig-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/Air.zig')
-rw-r--r--src/Air.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Air.zig b/src/Air.zig
index 60e6e9933d..a8b38b7659 100644
--- a/src/Air.zig
+++ b/src/Air.zig
@@ -374,8 +374,8 @@ pub const Asm = struct {
pub fn getMainBody(air: Air) []const Air.Inst.Index {
const body_index = air.extra[@enumToInt(ExtraIndex.main_block)];
- const body_len = air.extra[body_index];
- return air.extra[body_index..][0..body_len];
+ const extra = air.extraData(Block, body_index);
+ return air.extra[extra.end..][0..extra.data.body_len];
}
pub fn getType(air: Air, inst: Air.Inst.Index) Type {