aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/spirv.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-04-21 09:49:20 -0400
committerGitHub <noreply@github.com>2022-04-21 09:49:20 -0400
commitbd5831ce0e033662fed1adf98e81e7d058c6f883 (patch)
tree6d7f915268e23ae56e33a713b1be3ac7560a949e /src/codegen/spirv.zig
parent1a1b5ee264d8b2219c34d53cc9602692e6d2ba24 (diff)
parent31758f79db2c9e1122fd40bdda2243311830a5d4 (diff)
downloadzig-bd5831ce0e033662fed1adf98e81e7d058c6f883.tar.gz
zig-bd5831ce0e033662fed1adf98e81e7d058c6f883.zip
Merge pull request #11467 from ziglang/segmented-list-decls
stage2: use indexes for Decl objects
Diffstat (limited to 'src/codegen/spirv.zig')
-rw-r--r--src/codegen/spirv.zig16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index 6072c59845..791c2dc187 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -633,7 +633,13 @@ pub const DeclGen = struct {
return result_id.toRef();
}
- fn airArithOp(self: *DeclGen, inst: Air.Inst.Index, comptime fop: Opcode, comptime sop: Opcode, comptime uop: Opcode) !IdRef {
+ fn airArithOp(
+ self: *DeclGen,
+ inst: Air.Inst.Index,
+ comptime fop: Opcode,
+ comptime sop: Opcode,
+ comptime uop: Opcode,
+ ) !IdRef {
// LHS and RHS are guaranteed to have the same type, and AIR guarantees
// the result to be the same as the LHS and RHS, which matches SPIR-V.
const ty = self.air.typeOfIndex(inst);
@@ -644,10 +650,8 @@ pub const DeclGen = struct {
const result_id = self.spv.allocId();
const result_type_id = try self.resolveTypeId(ty);
- const target = self.getTarget();
-
- assert(self.air.typeOf(bin_op.lhs).eql(ty, target));
- assert(self.air.typeOf(bin_op.rhs).eql(ty, target));
+ assert(self.air.typeOf(bin_op.lhs).eql(ty, self.module));
+ assert(self.air.typeOf(bin_op.rhs).eql(ty, self.module));
// Binary operations are generally applicable to both scalar and vector operations
// in SPIR-V, but int and float versions of operations require different opcodes.
@@ -694,7 +698,7 @@ pub const DeclGen = struct {
const result_id = self.spv.allocId();
const result_type_id = try self.resolveTypeId(Type.initTag(.bool));
const op_ty = self.air.typeOf(bin_op.lhs);
- assert(op_ty.eql(self.air.typeOf(bin_op.rhs), self.getTarget()));
+ assert(op_ty.eql(self.air.typeOf(bin_op.rhs), self.module));
// Comparisons are generally applicable to both scalar and vector operations in SPIR-V,
// but int and float versions of operations require different opcodes.