aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/spirv.zig
diff options
context:
space:
mode:
authorAli Chraghi <alichraghi@proton.me>2023-05-15 14:22:40 +0330
committerAli Chraghi <alichraghi@proton.me>2023-05-15 14:22:40 +0330
commitf8de4db8731e20995d16ec29bc0fb553e7d6f5bf (patch)
tree188a3e11471df9f7c31bdb3a23a232b38c810adb /src/codegen/spirv.zig
parent9c550721e40f50b2ee44a5b1bf633ebdd50d5fd2 (diff)
downloadzig-f8de4db8731e20995d16ec29bc0fb553e7d6f5bf.tar.gz
zig-f8de4db8731e20995d16ec29bc0fb553e7d6f5bf.zip
spirv: implement arithmeticTypeInfo for Enum (`@intToEnum`)
Diffstat (limited to 'src/codegen/spirv.zig')
-rw-r--r--src/codegen/spirv.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index d7ab7ed4e0..6e95db9a68 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -369,6 +369,17 @@ pub const DeclGen = struct {
.composite_integer,
};
},
+ .Enum => blk: {
+ var buffer: Type.Payload.Bits = undefined;
+ const int_ty = ty.intTagType(&buffer);
+ const int_info = int_ty.intInfo(target);
+ break :blk ArithmeticTypeInfo{
+ .bits = int_info.bits,
+ .is_vector = false,
+ .signedness = int_info.signedness,
+ .class = .integer,
+ };
+ },
// As of yet, there is no vector support in the self-hosted compiler.
.Vector => self.todo("implement arithmeticTypeInfo for Vector", .{}),
// TODO: For which types is this the case?