aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-05-03 16:33:16 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:40:04 -0700
commitbcd4bb8afbea84d86fd8758b581b141e7086b16b (patch)
tree51991831c5fe4a6ddccb2bf7297f33f72e990931 /src/codegen
parent4cd8a40b3b34d4e68853088dd637a9da9b6a8891 (diff)
downloadzig-bcd4bb8afbea84d86fd8758b581b141e7086b16b.tar.gz
zig-bcd4bb8afbea84d86fd8758b581b141e7086b16b.zip
stage2: move named int types to InternPool
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/c/type.zig24
-rw-r--r--src/codegen/spirv.zig2
2 files changed, 13 insertions, 13 deletions
diff --git a/src/codegen/c/type.zig b/src/codegen/c/type.zig
index b964d16bd9..d248753670 100644
--- a/src/codegen/c/type.zig
+++ b/src/codegen/c/type.zig
@@ -1359,18 +1359,18 @@ pub const CType = extern union {
self.* = undefined;
if (!ty.isFnOrHasRuntimeBitsIgnoreComptime(mod))
self.init(.void)
- else if (ty.isAbiInt(mod)) switch (ty.tag()) {
- .usize => self.init(.uintptr_t),
- .isize => self.init(.intptr_t),
- .c_char => self.init(.char),
- .c_short => self.init(.short),
- .c_ushort => self.init(.@"unsigned short"),
- .c_int => self.init(.int),
- .c_uint => self.init(.@"unsigned int"),
- .c_long => self.init(.long),
- .c_ulong => self.init(.@"unsigned long"),
- .c_longlong => self.init(.@"long long"),
- .c_ulonglong => self.init(.@"unsigned long long"),
+ else if (ty.isAbiInt(mod)) switch (ty.ip_index) {
+ .usize_type => self.init(.uintptr_t),
+ .isize_type => self.init(.intptr_t),
+ .c_char_type => self.init(.char),
+ .c_short_type => self.init(.short),
+ .c_ushort_type => self.init(.@"unsigned short"),
+ .c_int_type => self.init(.int),
+ .c_uint_type => self.init(.@"unsigned int"),
+ .c_long_type => self.init(.long),
+ .c_ulong_type => self.init(.@"unsigned long"),
+ .c_longlong_type => self.init(.@"long long"),
+ .c_ulonglong_type => self.init(.@"unsigned long long"),
else => switch (tagFromIntInfo(ty.intInfo(mod))) {
.void => unreachable,
else => |t| self.init(t),
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index 41abbde1a0..90c2d93458 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -2499,7 +2499,7 @@ pub const DeclGen = struct {
const elem_ty = ptr_ty.elemType2(mod); // use elemType() so that we get T for *[N]T.
const elem_ty_ref = try self.resolveType(elem_ty, .direct);
const elem_ptr_ty_ref = try self.spv.ptrType(elem_ty_ref, spvStorageClass(ptr_ty.ptrAddressSpace()));
- if (ptr_ty.isSinglePointer()) {
+ if (ptr_ty.isSinglePointer(mod)) {
// Pointer-to-array. In this case, the resulting pointer is not of the same type
// as the ptr_ty (we want a *T, not a *[N]T), and hence we need to use accessChain.
return try self.accessChain(elem_ptr_ty_ref, ptr_id, &.{index_id});