aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/spirv.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-05-07 15:38:31 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:42:29 -0700
commit4d88f825bc5eb14aa00446f046ab4714a4fdce70 (patch)
tree4729946dff1e6ae200426418f4f6653003468d4f /src/codegen/spirv.zig
parenta5fb16959423005de999fb541d5d5e9aebb8e09e (diff)
downloadzig-4d88f825bc5eb14aa00446f046ab4714a4fdce70.tar.gz
zig-4d88f825bc5eb14aa00446f046ab4714a4fdce70.zip
stage2: implement intTagType logic
This commit changes a lot of `*const Module` to `*Module` to make it work, since accessing the integer tag type of an enum might need to mutate the InternPool by adding a new integer type into it. An alternate strategy would be to pre-heat the InternPool with the integer tag type when creating an enum type, which would make it so that intTagType could accept a const Module instead of a mutable one, asserting that the InternPool already had the integer tag type.
Diffstat (limited to 'src/codegen/spirv.zig')
-rw-r--r--src/codegen/spirv.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index 3842da5f7b..843b67e426 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -745,7 +745,7 @@ pub const DeclGen = struct {
.Enum => {
const int_val = try val.enumToInt(ty, mod);
- const int_ty = ty.intTagType();
+ const int_ty = try ty.intTagType(mod);
try self.lower(int_ty, int_val);
},
@@ -1195,7 +1195,7 @@ pub const DeclGen = struct {
return try self.intType(int_info.signedness, int_info.bits);
},
.Enum => {
- const tag_ty = ty.intTagType();
+ const tag_ty = try ty.intTagType(mod);
return self.resolveType(tag_ty, repr);
},
.Float => {
@@ -3090,7 +3090,7 @@ pub const DeclGen = struct {
break :blk if (backing_bits <= 32) @as(u32, 1) else 2;
},
.Enum => blk: {
- const int_ty = cond_ty.intTagType();
+ const int_ty = try cond_ty.intTagType(mod);
const int_info = int_ty.intInfo(mod);
const backing_bits = self.backingIntBits(int_info.bits) orelse {
return self.todo("implement composite int switch", .{});