aboutsummaryrefslogtreecommitdiff
path: root/src/Type.zig
diff options
context:
space:
mode:
authorMatthew Lugg <mlugg@mlugg.co.uk>2025-11-12 23:14:02 +0000
committerGitHub <noreply@github.com>2025-11-12 23:14:02 +0000
commit181b25ce4fcebc32f6fdc7498148c0f5e131dda9 (patch)
treef5cfe981b1b158e8bac17cc3a3bc909ffb7b1aa1 /src/Type.zig
parentdfd7b7f2337d84ce660253a37079489f7780b055 (diff)
parent532aa3c5758f110eb7cf0992eb394088ab563899 (diff)
downloadzig-181b25ce4fcebc32f6fdc7498148c0f5e131dda9.tar.gz
zig-181b25ce4fcebc32f6fdc7498148c0f5e131dda9.zip
Merge pull request #25772 from mlugg/kill-dead-code
compiler: rewrite some legalizations, and remove a bunch of dead code
Diffstat (limited to 'src/Type.zig')
-rw-r--r--src/Type.zig10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Type.zig b/src/Type.zig
index f3f5c99491..b111650e34 100644
--- a/src/Type.zig
+++ b/src/Type.zig
@@ -198,9 +198,7 @@ pub fn print(ty: Type, writer: *std.Io.Writer, pt: Zcu.PerThread) std.Io.Writer.
info.packed_offset.bit_offset, info.packed_offset.host_size,
});
}
- if (info.flags.vector_index == .runtime) {
- try writer.writeAll(":?");
- } else if (info.flags.vector_index != .none) {
+ if (info.flags.vector_index != .none) {
try writer.print(":{d}", .{@intFromEnum(info.flags.vector_index)});
}
try writer.writeAll(") ");
@@ -3113,7 +3111,7 @@ pub fn enumTagFieldIndex(ty: Type, enum_tag: Value, zcu: *const Zcu) ?u32 {
pub fn structFieldName(ty: Type, index: usize, zcu: *const Zcu) InternPool.OptionalNullTerminatedString {
const ip = &zcu.intern_pool;
return switch (ip.indexToKey(ty.toIntern())) {
- .struct_type => ip.loadStructType(ty.toIntern()).fieldName(ip, index),
+ .struct_type => ip.loadStructType(ty.toIntern()).fieldName(ip, index).toOptional(),
.tuple_type => .none,
else => unreachable,
};
@@ -3558,7 +3556,7 @@ pub fn packedStructFieldPtrInfo(
} else .{
switch (zcu.comp.getZigBackend()) {
else => (running_bits + 7) / 8,
- .stage2_x86_64 => @intCast(struct_ty.abiSize(zcu)),
+ .stage2_x86_64, .stage2_c => @intCast(struct_ty.abiSize(zcu)),
},
bit_offset,
};
@@ -3985,7 +3983,7 @@ pub fn elemPtrType(ptr_ty: Type, offset: ?usize, pt: Zcu.PerThread) !Type {
break :blk .{
.host_size = @intCast(parent_ty.arrayLen(zcu)),
.alignment = parent_ty.abiAlignment(zcu),
- .vector_index = if (offset) |some| @enumFromInt(some) else .runtime,
+ .vector_index = @enumFromInt(offset.?),
};
} else .{};