aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/type.zig b/src/type.zig
index 53aee5051a..64702509dc 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -748,6 +748,8 @@ pub const Type = extern union {
return false;
if (info_a.host_size != info_b.host_size)
return false;
+ if (info_a.vector_index != info_b.vector_index)
+ return false;
if (info_a.@"allowzero" != info_b.@"allowzero")
return false;
if (info_a.mutable != info_b.mutable)
@@ -1126,6 +1128,7 @@ pub const Type = extern union {
std.hash.autoHash(hasher, info.@"addrspace");
std.hash.autoHash(hasher, info.bit_offset);
std.hash.autoHash(hasher, info.host_size);
+ std.hash.autoHash(hasher, info.vector_index);
std.hash.autoHash(hasher, info.@"allowzero");
std.hash.autoHash(hasher, info.mutable);
std.hash.autoHash(hasher, info.@"volatile");
@@ -1467,6 +1470,7 @@ pub const Type = extern union {
.@"addrspace" = payload.@"addrspace",
.bit_offset = payload.bit_offset,
.host_size = payload.host_size,
+ .vector_index = payload.vector_index,
.@"allowzero" = payload.@"allowzero",
.mutable = payload.mutable,
.@"volatile" = payload.@"volatile",
@@ -1855,12 +1859,17 @@ pub const Type = extern union {
.C => try writer.writeAll("[*c]"),
.Slice => try writer.writeAll("[]"),
}
- if (payload.@"align" != 0 or payload.host_size != 0) {
+ if (payload.@"align" != 0 or payload.host_size != 0 or payload.vector_index != .none) {
try writer.print("align({d}", .{payload.@"align"});
if (payload.bit_offset != 0 or payload.host_size != 0) {
try writer.print(":{d}:{d}", .{ payload.bit_offset, payload.host_size });
}
+ if (payload.vector_index == .runtime) {
+ try writer.writeAll(":?");
+ } else if (payload.vector_index != .none) {
+ try writer.print(":{d}", .{@enumToInt(payload.vector_index)});
+ }
try writer.writeAll(") ");
}
if (payload.@"addrspace" != .generic) {
@@ -2185,12 +2194,17 @@ pub const Type = extern union {
.C => try writer.writeAll("[*c]"),
.Slice => try writer.writeAll("[]"),
}
- if (info.@"align" != 0 or info.host_size != 0) {
+ if (info.@"align" != 0 or info.host_size != 0 or info.vector_index != .none) {
try writer.print("align({d}", .{info.@"align"});
if (info.bit_offset != 0 or info.host_size != 0) {
try writer.print(":{d}:{d}", .{ info.bit_offset, info.host_size });
}
+ if (info.vector_index == .runtime) {
+ try writer.writeAll(":?");
+ } else if (info.vector_index != .none) {
+ try writer.print(":{d}", .{@enumToInt(info.vector_index)});
+ }
try writer.writeAll(") ");
}
if (info.@"addrspace" != .generic) {
@@ -3865,6 +3879,7 @@ pub const Type = extern union {
payload.@"addrspace" != .generic or
payload.bit_offset != 0 or
payload.host_size != 0 or
+ payload.vector_index != .none or
payload.@"allowzero" or
payload.@"volatile")
{
@@ -3877,6 +3892,7 @@ pub const Type = extern union {
.@"addrspace" = payload.@"addrspace",
.bit_offset = payload.bit_offset,
.host_size = payload.host_size,
+ .vector_index = payload.vector_index,
.@"allowzero" = payload.@"allowzero",
.mutable = payload.mutable,
.@"volatile" = payload.@"volatile",
@@ -6365,11 +6381,18 @@ pub const Type = extern union {
/// When host_size=pointee_abi_size and bit_offset=0, this must be
/// represented with host_size=0 instead.
host_size: u16 = 0,
+ vector_index: VectorIndex = .none,
@"allowzero": bool = false,
mutable: bool = true, // TODO rename this to const, not mutable
@"volatile": bool = false,
size: std.builtin.Type.Pointer.Size = .One,
+ pub const VectorIndex = enum(u32) {
+ none = std.math.maxInt(u32),
+ runtime = std.math.maxInt(u32) - 1,
+ _,
+ };
+
pub fn alignment(data: Data, target: Target) u32 {
if (data.@"align" != 0) return data.@"align";
return abiAlignment(data.pointee_type, target);
@@ -6524,7 +6547,8 @@ pub const Type = extern union {
}
if (d.@"align" == 0 and d.@"addrspace" == .generic and
- d.bit_offset == 0 and d.host_size == 0 and !d.@"allowzero" and !d.@"volatile")
+ d.bit_offset == 0 and d.host_size == 0 and d.vector_index == .none and
+ !d.@"allowzero" and !d.@"volatile")
{
if (d.sentinel) |sent| {
if (!d.mutable and d.pointee_type.eql(Type.u8, mod)) {