From 2f92d1a0264b6827cb67a55726c4c9a082337508 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 14 Mar 2022 21:11:49 -0700 Subject: stage2: fixups for topolarity-comptime-memory-reinterp branch * don't store `has_well_defined_layout` in memory. * remove struct `hasWellDefinedLayout` logic. it's just `layout != .Auto`. This means we only need one implementation, in Type. * fix some of the cases being wrong in `hasWellDefinedLayout`, such as optional pointers. * move `tag_ty_inferred` field into a position that makes it more obvious how the struct layout will be done. Also we don't have a compiler that intelligently moves fields around so this layout is better. * Sema: don't `resolveTypeLayout` in `zirCoerceResultPtr` unless necessary. * Rename `ComptimePtrLoadKit` `target` field to `pointee` to avoid confusion with `target`. --- src/codegen/llvm.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/codegen') diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 08cfe4a258..94dacf61e8 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -2829,7 +2829,10 @@ pub const DeclGen = struct { // (void) payload is the same. break :blk parent_llvm_ptr; } - const llvm_pl_index = if (layout.tag_size == 0) 0 else @boolToInt(layout.tag_align >= layout.payload_align); + const llvm_pl_index = if (layout.tag_size == 0) + 0 + else + @boolToInt(layout.tag_align >= layout.payload_align); const indices: [2]*const llvm.Value = .{ llvm_u32.constInt(0, .False), llvm_u32.constInt(llvm_pl_index, .False), -- cgit v1.2.3