diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-09-19 22:47:00 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-09-19 22:47:56 -0700 |
| commit | c6ad4521c77372cb52adfb9a52b0854d830fed9c (patch) | |
| tree | 82ea66f7c40db3423e344bcbbf9295e8ee10fea6 /src/codegen/llvm.zig | |
| parent | 8b82a0e0fc5cac9a5376f06955ca4419b9a9923f (diff) | |
| parent | 075ec5555264b759035e7d607faf03704075af23 (diff) | |
| download | zig-c6ad4521c77372cb52adfb9a52b0854d830fed9c.tar.gz zig-c6ad4521c77372cb52adfb9a52b0854d830fed9c.zip | |
Merge branch 'llvm19'
Upgrades the LLVM, Clang, and LLD dependencies to LLVM 19.x
Related to #16270
Big thanks to Alex Rønne Petersen for doing the bulk of the upgrade work
in this branch.
Diffstat (limited to 'src/codegen/llvm.zig')
| -rw-r--r-- | src/codegen/llvm.zig | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index ec2ba4e4c1..c9cb79b4a0 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -129,6 +129,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { .hurd => "hurd", .wasi => "wasi", .emscripten => "emscripten", + .bridgeos => "bridgeos", .macos => "macosx", .ios => "ios", .tvos => "tvos", @@ -241,6 +242,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType { .shadermodel => .ShaderModel, .vulkan => .Vulkan, .serenity => .Serenity, + .bridgeos => .BridgeOS, .opengl, .plan9, @@ -3761,28 +3763,7 @@ pub const Object = struct { }, .ptr => return o.builder.convConst(try o.lowerPtr(arg_val, 0), llvm_int_ty), .aggregate => switch (ip.indexToKey(ty.toIntern())) { - .struct_type => { - const struct_type = ip.loadStructType(ty.toIntern()); - assert(struct_type.haveLayout(ip)); - assert(struct_type.layout == .@"packed"); - comptime assert(Type.packed_struct_layout_version == 2); - var running_int = try o.builder.intConst(llvm_int_ty, 0); - var running_bits: u16 = 0; - for (struct_type.field_types.get(ip), 0..) |field_ty, field_index| { - if (!Type.fromInterned(field_ty).hasRuntimeBitsIgnoreComptime(zcu)) continue; - - const shift_rhs = try o.builder.intConst(llvm_int_ty, running_bits); - const field_val = try o.lowerValueToInt(llvm_int_ty, (try val.fieldValue(pt, field_index)).toIntern()); - const shifted = try o.builder.binConst(.shl, field_val, shift_rhs); - - running_int = try o.builder.binConst(.xor, running_int, shifted); - - const ty_bit_size: u16 = @intCast(Type.fromInterned(field_ty).bitSize(zcu)); - running_bits += ty_bit_size; - } - return running_int; - }, - .vector_type => {}, + .struct_type, .vector_type => {}, else => unreachable, }, .un => |un| { @@ -6815,29 +6796,11 @@ pub const FuncGen = struct { const zcu = pt.zcu; const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; - const workaround_operand = try self.resolveInst(ty_op.operand); + const operand = try self.resolveInst(ty_op.operand); const operand_ty = self.typeOf(ty_op.operand); const operand_scalar_ty = operand_ty.scalarType(zcu); const is_signed_int = operand_scalar_ty.isSignedInt(zcu); - const operand = o: { - // Work around LLVM bug. See https://github.com/ziglang/zig/issues/17381. - const bit_size = operand_scalar_ty.bitSize(zcu); - for ([_]u8{ 8, 16, 32, 64, 128 }) |b| { - if (bit_size < b) { - break :o try self.wip.cast( - if (is_signed_int) .sext else .zext, - workaround_operand, - try o.builder.intType(b), - "", - ); - } else if (bit_size == b) { - break :o workaround_operand; - } - } - break :o workaround_operand; - }; - const dest_ty = self.typeOfIndex(inst); const dest_scalar_ty = dest_ty.scalarType(zcu); const dest_llvm_ty = try o.lowerType(dest_ty); |
