diff options
| author | Luuk de Gram <luuk@degram.dev> | 2021-07-19 21:50:15 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-07-20 12:19:17 -0700 |
| commit | caa0de545e2f45a96ac3136178f478dab1c89ebd (patch) | |
| tree | 4e4c2bbbcf4b17e629110fe4c5eb80d0f32aa242 /src/codegen/wasm.zig | |
| parent | 1150fc13dc779c91d54538304466cc068ccbf8ed (diff) | |
| download | zig-caa0de545e2f45a96ac3136178f478dab1c89ebd.tar.gz zig-caa0de545e2f45a96ac3136178f478dab1c89ebd.zip | |
Resolve regressions
- Get correct types in wasm backend.
- `arg` is already a `Ref`, therefore simply use `@intToEnum`.
- Fix regression in `zirBoolBr, where the order of insertion was incorrect.
Diffstat (limited to 'src/codegen/wasm.zig')
| -rw-r--r-- | src/codegen/wasm.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig index b6edfb7b20..e72140d826 100644 --- a/src/codegen/wasm.zig +++ b/src/codegen/wasm.zig @@ -871,7 +871,7 @@ pub const Context = struct { }; for (args) |arg| { - const arg_val = self.resolveInst(Air.indexToRef(arg)); + const arg_val = self.resolveInst(@intToEnum(Air.Inst.Ref, arg)); try self.emitWValue(arg_val); } @@ -959,7 +959,7 @@ pub const Context = struct { try self.emitWValue(lhs); try self.emitWValue(rhs); - const bin_ty = self.air.getRefType(bin_op.lhs); + const bin_ty = self.air.typeOf(bin_op.lhs); const opcode: wasm.Opcode = buildOpcode(.{ .op = op, .valtype1 = try self.typeToValtype(bin_ty), @@ -1179,7 +1179,7 @@ pub const Context = struct { const data: Air.Inst.Data = self.air.instructions.items(.data)[inst]; const lhs = self.resolveInst(data.bin_op.lhs); const rhs = self.resolveInst(data.bin_op.rhs); - const lhs_ty = self.air.getRefType(data.bin_op.lhs); + const lhs_ty = self.air.typeOf(data.bin_op.lhs); try self.emitWValue(lhs); try self.emitWValue(rhs); @@ -1211,7 +1211,7 @@ pub const Context = struct { const br = self.air.instructions.items(.data)[inst].br; // if operand has codegen bits we should break with a value - if (self.air.getRefType(br.operand).hasCodeGenBits()) { + if (self.air.typeOf(br.operand).hasCodeGenBits()) { try self.emitWValue(self.resolveInst(br.operand)); } @@ -1277,7 +1277,7 @@ pub const Context = struct { const else_body = self.air.extra[extra.end + cases.len ..][0..extra.data.else_body_len]; const target = self.resolveInst(pl_op.operand); - const target_ty = self.air.getRefType(pl_op.operand); + const target_ty = self.air.typeOf(pl_op.operand); const valtype = try self.typeToValtype(target_ty); // result type is always 'noreturn' const blocktype = wasm.block_empty; |
