diff options
| author | Rue <78876133+IOKG04@users.noreply.github.com> | 2025-07-28 14:54:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-28 14:54:52 +0200 |
| commit | 5381e7891dcdd7b6a9e74250cdcce221fe464cdc (patch) | |
| tree | 4c74744ed84120dccae6dc9811ce945911108a17 /src/codegen/llvm.zig | |
| parent | 84ae54fbe64a15301317716e7f901d81585332d5 (diff) | |
| parent | dea3ed7f59347e87a1b8fa237202873988084ae8 (diff) | |
| download | zig-5381e7891dcdd7b6a9e74250cdcce221fe464cdc.tar.gz zig-5381e7891dcdd7b6a9e74250cdcce221fe464cdc.zip | |
Merge branch 'ziglang:master' into some-documentation-updates-0
Diffstat (limited to 'src/codegen/llvm.zig')
| -rw-r--r-- | src/codegen/llvm.zig | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index a570dd5ec0..111fc6ec14 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -20,6 +20,7 @@ const Package = @import("../Package.zig"); const Air = @import("../Air.zig"); const Value = @import("../Value.zig"); const Type = @import("../Type.zig"); +const codegen = @import("../codegen.zig"); const x86_64_abi = @import("../arch/x86_64/abi.zig"); const wasm_c_abi = @import("wasm/abi.zig"); const aarch64_c_abi = @import("aarch64/abi.zig"); @@ -1131,7 +1132,7 @@ pub const Object = struct { pt: Zcu.PerThread, func_index: InternPool.Index, air: *const Air, - liveness: *const Air.Liveness, + liveness: *const ?Air.Liveness, ) !void { const zcu = pt.zcu; const comp = zcu.comp; @@ -1489,7 +1490,7 @@ pub const Object = struct { var fg: FuncGen = .{ .gpa = gpa, .air = air.*, - .liveness = liveness.*, + .liveness = liveness.*.?, .ng = &ng, .wip = wip, .is_naked = fn_info.cc == .naked, @@ -4210,7 +4211,7 @@ pub const Object = struct { .eu_payload => |eu_ptr| try o.lowerPtr( pt, eu_ptr, - offset + @import("../codegen.zig").errUnionPayloadOffset( + offset + codegen.errUnionPayloadOffset( Value.fromInterned(eu_ptr).typeOf(zcu).childType(zcu), zcu, ), @@ -6050,10 +6051,10 @@ pub const FuncGen = struct { const target_blocks = dispatch_info.case_blocks[0..target_blocks_len]; // Make sure to cast the index to a usize so it's not treated as negative! - const table_index = try self.wip.cast( - .zext, + const table_index = try self.wip.conv( + .unsigned, try self.wip.bin(.@"sub nuw", cond, jmp_table.min.toValue(), ""), - try o.lowerType(pt, Type.usize), + try o.lowerType(pt, .usize), "", ); const target_ptr_ptr = try self.wip.gep( @@ -6969,7 +6970,7 @@ pub const FuncGen = struct { .@"struct" => switch (struct_ty.containerLayout(zcu)) { .@"packed" => { const struct_type = zcu.typeToStruct(struct_ty).?; - const bit_offset = pt.structPackedFieldBitOffset(struct_type, field_index); + const bit_offset = zcu.structPackedFieldBitOffset(struct_type, field_index); const containing_int = struct_llvm_val; const shift_amt = try o.builder.intValue(containing_int.typeOfWip(&self.wip), bit_offset); @@ -11364,7 +11365,7 @@ pub const FuncGen = struct { // We have a pointer to a packed struct field that happens to be byte-aligned. // Offset our operand pointer by the correct number of bytes. - const byte_offset = @divExact(pt.structPackedFieldBitOffset(struct_type, field_index) + struct_ptr_ty_info.packed_offset.bit_offset, 8); + const byte_offset = @divExact(zcu.structPackedFieldBitOffset(struct_type, field_index) + struct_ptr_ty_info.packed_offset.bit_offset, 8); if (byte_offset == 0) return struct_ptr; const usize_ty = try o.lowerType(pt, Type.usize); const llvm_index = try o.builder.intValue(usize_ty, byte_offset); |
