authorgravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2021-05-20 16:21:11+02:00
committergravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2021-05-20 16:21:11+02:00
logf8d0501f50985b2953dc0eec6a555e7bc91f7798
tree6e176570c762743850e098d07e915f4b4f9dc87c
parent81d8fe7558cdae829c30cba3c92dfc373336929c
signaturelock-open Commit is signed but in an unrecognized format.

Also support multi-prong branches


1 files changed, 9 insertions(+), 1 deletions(-)

src/codegen/wasm.zig+9-1
......@@ -862,6 +862,14 @@ pub const Context = struct {
862862 const lhs = self.resolveInst(inst.lhs);
863863 const rhs = self.resolveInst(inst.rhs);
864864
865 // it's possible for both lhs and/or rhs to return an offset as well,
866 // in which case we return the first offset occurance we find.
867 const offset = blk: {
868 if (lhs == .code_offset) break :blk lhs.code_offset;
869 if (rhs == .code_offset) break :blk rhs.code_offset;
870 break :blk self.code.items.len;
871 };
872
865873 try self.emitWValue(lhs);
866874 try self.emitWValue(rhs);
867875
......@@ -871,7 +879,7 @@ pub const Context = struct {
871879 .signedness = if (inst.base.ty.isSignedInt()) .signed else .unsigned,
872880 });
873881 try self.code.append(wasm.opcode(opcode));
874 return .none;
882 return WValue{ .code_offset = offset };
875883 }
876884
877885 fn emitConstant(self: *Context, src: LazySrcLoc, value: Value, ty: Type) InnerError!void {