aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compile.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compile.zig b/src/compile.zig
index 0918d30..8cf61ca 100644
--- a/src/compile.zig
+++ b/src/compile.zig
@@ -66,6 +66,8 @@ pub const Instr = struct {
true: BlockRef,
false: BlockRef,
+ pub const may_end_block = {};
+
pub fn sources(self: Branch) Sources {
return Sources.fromSlice(&.{self.cond}) catch unreachable;
}
@@ -74,12 +76,16 @@ pub const Instr = struct {
pub const Jump = struct {
to: BlockRef,
+ pub const may_end_block = {};
+
pub fn sources(_: Jump) Sources {
return Sources.init(0) catch unreachable;
}
};
pub const Exit = struct {
+ pub const may_end_block = {};
+
pub fn sources(_: Exit) Sources {
return Sources.init(0) catch unreachable;
}
@@ -164,6 +170,9 @@ pub const BasicBlock = struct {
if (instr.dest()) |dest|
try self.vreg_last_use.put(allocator, dest, i);
}
+ std.debug.assert(switch (self.instrs.items[self.instrs.items.len - 1].type) {
+ inline else => |ty| @hasDecl(@TypeOf(ty), "may_end_block"),
+ });
}
};