stage2: redesign switchbr

Switchbr now only  handles single item prongs.
Ranges and multi item prongs are checked with
condbrs after the switchbr.
This commit is contained in:
Vexu
2020-10-16 17:01:05 +03:00
parent 95467f3249
commit 7db17a2d89
5 changed files with 139 additions and 153 deletions

View File

@@ -2122,18 +2122,16 @@ pub fn addSwitchBr(
src: usize,
target_ptr: *Inst,
cases: []Inst.SwitchBr.Case,
else_body: ?Module.Body,
) !*Inst {
const inst = try block.arena.create(Inst.SwitchBr);
inst.* = .{
.base = .{
.tag = .switchbr,
.ty = Type.initTag(.noreturn),
.ty = Type.initTag(.void),
.src = src,
},
.target_ptr = target_ptr,
.cases = cases,
.@"else" = else_body,
};
try block.instructions.append(self.gpa, &inst.base);
return &inst.base;