| author | |
| committer | |
| log | 917640810e7f3e18daff9e75b5ecefe761a1896c |
| tree | 579e627d695f898d411a3cb1fbc0578d1a763cc2 |
| parent | 16d78bc0c024da307c7ab5f6b94622e6b4b37397 |
This struct is larger than 256 bytes and code that copies it
consistently shows up in profiles of the compiler.96 files changed, 400 insertions(+), 401 deletions(-)
build.zig+1-1| ... | ... | @@ -759,7 +759,7 @@ fn addCmakeCfgOptionsToExe( |
| 759 | 759 | use_zig_libcxx: bool, |
| 760 | 760 | ) !void { |
| 761 | 761 | const mod = exe.root_module; |
| 762 | const target = mod.resolved_target.?.result; | |
| 762 | const target = &mod.resolved_target.?.result; | |
| 763 | 763 | |
| 764 | 764 | if (target.os.tag.isDarwin()) { |
| 765 | 765 | // useful for package maintainers |
lib/compiler/resinator/main.zig+2-2| ... | ... | @@ -525,7 +525,7 @@ fn getIncludePaths(arena: std.mem.Allocator, auto_includes_option: cli.Options.A |
| 525 | 525 | }; |
| 526 | 526 | const target = std.zig.resolveTargetQueryOrFatal(target_query); |
| 527 | 527 | const is_native_abi = target_query.isNativeAbi(); |
| 528 | const detected_libc = std.zig.LibCDirs.detect(arena, zig_lib_dir, target, is_native_abi, true, null) catch { | |
| 528 | const detected_libc = std.zig.LibCDirs.detect(arena, zig_lib_dir, &target, is_native_abi, true, null) catch { | |
| 529 | 529 | if (includes == .any) { |
| 530 | 530 | // fall back to mingw |
| 531 | 531 | includes = .gnu; |
| ... | ... | @@ -550,7 +550,7 @@ fn getIncludePaths(arena: std.mem.Allocator, auto_includes_option: cli.Options.A |
| 550 | 550 | }; |
| 551 | 551 | const target = std.zig.resolveTargetQueryOrFatal(target_query); |
| 552 | 552 | const is_native_abi = target_query.isNativeAbi(); |
| 553 | const detected_libc = std.zig.LibCDirs.detect(arena, zig_lib_dir, target, is_native_abi, true, null) catch |err| switch (err) { | |
| 553 | const detected_libc = std.zig.LibCDirs.detect(arena, zig_lib_dir, &target, is_native_abi, true, null) catch |err| switch (err) { | |
| 554 | 554 | error.OutOfMemory => |e| return e, |
| 555 | 555 | else => return error.MingwIncludesNotFound, |
| 556 | 556 | }; |
lib/compiler_rt/divmodei4.zig+2-2| ... | ... | @@ -35,7 +35,7 @@ fn divmod(q: ?[]u32, r: ?[]u32, u: []u32, v: []u32) !void { |
| 35 | 35 | |
| 36 | 36 | pub fn __divei4(q_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) void { |
| 37 | 37 | @setRuntimeSafety(builtin.is_test); |
| 38 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 38 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 39 | 39 | const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size])); |
| 40 | 40 | const u: []u32 = @ptrCast(@alignCast(u_p[0..byte_size])); |
| 41 | 41 | const v: []u32 = @ptrCast(@alignCast(v_p[0..byte_size])); |
| ... | ... | @@ -44,7 +44,7 @@ pub fn __divei4(q_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) vo |
| 44 | 44 | |
| 45 | 45 | pub fn __modei4(r_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) void { |
| 46 | 46 | @setRuntimeSafety(builtin.is_test); |
| 47 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 47 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 48 | 48 | const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size])); |
| 49 | 49 | const u: []u32 = @ptrCast(@alignCast(u_p[0..byte_size])); |
| 50 | 50 | const v: []u32 = @ptrCast(@alignCast(v_p[0..byte_size])); |
lib/compiler_rt/fixdfei.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __fixdfei(r: [*]u8, bits: usize, a: f64) callconv(.c) void { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return bigIntFromFloat(.signed, @ptrCast(@alignCast(r[0..byte_size])), a); |
| 15 | 15 | } |
lib/compiler_rt/fixhfei.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __fixhfei(r: [*]u8, bits: usize, a: f16) callconv(.c) void { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return bigIntFromFloat(.signed, @ptrCast(@alignCast(r[0..byte_size])), a); |
| 15 | 15 | } |
lib/compiler_rt/fixsfei.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __fixsfei(r: [*]u8, bits: usize, a: f32) callconv(.c) void { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return bigIntFromFloat(.signed, @ptrCast(@alignCast(r[0..byte_size])), a); |
| 15 | 15 | } |
lib/compiler_rt/fixtfei.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __fixtfei(r: [*]u8, bits: usize, a: f128) callconv(.c) void { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return bigIntFromFloat(.signed, @ptrCast(@alignCast(r[0..byte_size])), a); |
| 15 | 15 | } |
lib/compiler_rt/fixunsdfei.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __fixunsdfei(r: [*]u8, bits: usize, a: f64) callconv(.c) void { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return bigIntFromFloat(.unsigned, @ptrCast(@alignCast(r[0..byte_size])), a); |
| 15 | 15 | } |
lib/compiler_rt/fixunshfei.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __fixunshfei(r: [*]u8, bits: usize, a: f16) callconv(.c) void { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return bigIntFromFloat(.unsigned, @ptrCast(@alignCast(r[0..byte_size])), a); |
| 15 | 15 | } |
lib/compiler_rt/fixunssfei.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __fixunssfei(r: [*]u8, bits: usize, a: f32) callconv(.c) void { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return bigIntFromFloat(.unsigned, @ptrCast(@alignCast(r[0..byte_size])), a); |
| 15 | 15 | } |
lib/compiler_rt/fixunstfei.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __fixunstfei(r: [*]u8, bits: usize, a: f128) callconv(.c) void { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return bigIntFromFloat(.unsigned, @ptrCast(@alignCast(r[0..byte_size])), a); |
| 15 | 15 | } |
lib/compiler_rt/fixunsxfei.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __fixunsxfei(r: [*]u8, bits: usize, a: f80) callconv(.c) void { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return bigIntFromFloat(.unsigned, @ptrCast(@alignCast(r[0..byte_size])), a); |
| 15 | 15 | } |
lib/compiler_rt/fixxfei.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __fixxfei(r: [*]u8, bits: usize, a: f80) callconv(.c) void { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return bigIntFromFloat(.signed, @ptrCast(@alignCast(r[0..byte_size])), a); |
| 15 | 15 | } |
lib/compiler_rt/floateidf.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __floateidf(a: [*]const u8, bits: usize) callconv(.c) f64 { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return floatFromBigInt(f64, .signed, @ptrCast(@alignCast(a[0..byte_size]))); |
| 15 | 15 | } |
lib/compiler_rt/floateihf.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __floateihf(a: [*]const u8, bits: usize) callconv(.c) f16 { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return floatFromBigInt(f16, .signed, @ptrCast(@alignCast(a[0..byte_size]))); |
| 15 | 15 | } |
lib/compiler_rt/floateisf.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __floateisf(a: [*]const u8, bits: usize) callconv(.c) f32 { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return floatFromBigInt(f32, .signed, @ptrCast(@alignCast(a[0..byte_size]))); |
| 15 | 15 | } |
lib/compiler_rt/floateitf.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __floateitf(a: [*]const u8, bits: usize) callconv(.c) f128 { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return floatFromBigInt(f128, .signed, @ptrCast(@alignCast(a[0..byte_size]))); |
| 15 | 15 | } |
lib/compiler_rt/floateixf.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __floateixf(a: [*]const u8, bits: usize) callconv(.c) f80 { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return floatFromBigInt(f80, .signed, @ptrCast(@alignCast(a[0..byte_size]))); |
| 15 | 15 | } |
lib/compiler_rt/floatuneidf.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __floatuneidf(a: [*]const u8, bits: usize) callconv(.c) f64 { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return floatFromBigInt(f64, .unsigned, @ptrCast(@alignCast(a[0..byte_size]))); |
| 15 | 15 | } |
lib/compiler_rt/floatuneihf.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __floatuneihf(a: [*]const u8, bits: usize) callconv(.c) f16 { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return floatFromBigInt(f16, .unsigned, @ptrCast(@alignCast(a[0..byte_size]))); |
| 15 | 15 | } |
lib/compiler_rt/floatuneisf.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __floatuneisf(a: [*]const u8, bits: usize) callconv(.c) f32 { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return floatFromBigInt(f32, .unsigned, @ptrCast(@alignCast(a[0..byte_size]))); |
| 15 | 15 | } |
lib/compiler_rt/floatuneitf.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __floatuneitf(a: [*]const u8, bits: usize) callconv(.c) f128 { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return floatFromBigInt(f128, .unsigned, @ptrCast(@alignCast(a[0..byte_size]))); |
| 15 | 15 | } |
lib/compiler_rt/floatuneixf.zig+1-1| ... | ... | @@ -10,6 +10,6 @@ comptime { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | pub fn __floatuneixf(a: [*]const u8, bits: usize) callconv(.c) f80 { |
| 13 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 13 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 14 | 14 | return floatFromBigInt(f80, .unsigned, @ptrCast(@alignCast(a[0..byte_size]))); |
| 15 | 15 | } |
lib/compiler_rt/udivmodei4.zig+2-2| ... | ... | @@ -114,7 +114,7 @@ pub fn divmod(q: ?[]u32, r: ?[]u32, u: []const u32, v: []const u32) !void { |
| 114 | 114 | |
| 115 | 115 | pub fn __udivei4(q_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) callconv(.c) void { |
| 116 | 116 | @setRuntimeSafety(builtin.is_test); |
| 117 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 117 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 118 | 118 | const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size])); |
| 119 | 119 | const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size])); |
| 120 | 120 | const v: []const u32 = @ptrCast(@alignCast(v_p[0..byte_size])); |
| ... | ... | @@ -123,7 +123,7 @@ pub fn __udivei4(q_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) ca |
| 123 | 123 | |
| 124 | 124 | pub fn __umodei4(r_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) callconv(.c) void { |
| 125 | 125 | @setRuntimeSafety(builtin.is_test); |
| 126 | const byte_size = std.zig.target.intByteSize(builtin.target, @intCast(bits)); | |
| 126 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); | |
| 127 | 127 | const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size])); |
| 128 | 128 | const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size])); |
| 129 | 129 | const v: []const u32 = @ptrCast(@alignCast(v_p[0..byte_size])); |
lib/std/Build/Fuzz/WebServer.zig+2-2| ... | ... | @@ -198,10 +198,10 @@ fn serveWasm( |
| 198 | 198 | const wasm_base_path = try buildWasmBinary(ws, arena, optimize_mode); |
| 199 | 199 | const bin_name = try std.zig.binNameAlloc(arena, .{ |
| 200 | 200 | .root_name = fuzzer_bin_name, |
| 201 | .target = std.zig.system.resolveTargetQuery(std.Build.parseTargetQuery(.{ | |
| 201 | .target = &(std.zig.system.resolveTargetQuery(std.Build.parseTargetQuery(.{ | |
| 202 | 202 | .arch_os_abi = fuzzer_arch_os_abi, |
| 203 | 203 | .cpu_features = fuzzer_cpu_features, |
| 204 | }) catch unreachable) catch unreachable, | |
| 204 | }) catch unreachable) catch unreachable), | |
| 205 | 205 | .output_mode = .Exe, |
| 206 | 206 | }); |
| 207 | 207 | // std.http.Server does not have a sendfile API yet. |
lib/std/Build/Module.zig+4-4| ... | ... | @@ -655,10 +655,10 @@ fn linkLibraryOrObject(m: *Module, other: *Step.Compile) void { |
| 655 | 655 | m.include_dirs.append(allocator, .{ .other_step = other }) catch @panic("OOM"); |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | fn requireKnownTarget(m: *Module) std.Target { | |
| 659 | const resolved_target = m.resolved_target orelse | |
| 660 | @panic("this API requires the Module to be created with a known 'target' field"); | |
| 661 | return resolved_target.result; | |
| 658 | fn requireKnownTarget(m: *Module) *const std.Target { | |
| 659 | const resolved_target = &(m.resolved_target orelse | |
| 660 | @panic("this API requires the Module to be created with a known 'target' field")); | |
| 661 | return &resolved_target.result; | |
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | /// Elements of `modules` and `names` are matched one-to-one. |
lib/std/Build/Step/Compile.zig+2-2| ... | ... | @@ -377,7 +377,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile { |
| 377 | 377 | |
| 378 | 378 | const resolved_target = options.root_module.resolved_target orelse |
| 379 | 379 | @panic("the root Module of a Compile step must be created with a known 'target' field"); |
| 380 | const target = resolved_target.result; | |
| 380 | const target = &resolved_target.result; | |
| 381 | 381 | |
| 382 | 382 | const step_name = owner.fmt("compile {s} {s} {s}", .{ |
| 383 | 383 | // Avoid the common case of the step name looking like "compile test test". |
| ... | ... | @@ -1866,7 +1866,7 @@ fn outputPath(c: *Compile, out_dir: std.Build.Cache.Path, ea: std.zig.EmitArtifa |
| 1866 | 1866 | const arena = c.step.owner.graph.arena; |
| 1867 | 1867 | const name = ea.cacheName(arena, .{ |
| 1868 | 1868 | .root_name = c.name, |
| 1869 | .target = c.root_module.resolved_target.?.result, | |
| 1869 | .target = &c.root_module.resolved_target.?.result, | |
| 1870 | 1870 | .output_mode = switch (c.kind) { |
| 1871 | 1871 | .lib => .Lib, |
| 1872 | 1872 | .obj, .test_obj => .Obj, |
lib/std/Build/Step/Run.zig+1-1| ... | ... | @@ -1108,7 +1108,7 @@ fn runCommand( |
| 1108 | 1108 | const need_cross_libc = exe.is_linking_libc and |
| 1109 | 1109 | (root_target.isGnuLibC() or (root_target.isMuslLibC() and exe.linkage == .dynamic)); |
| 1110 | 1110 | const other_target = exe.root_module.resolved_target.?.result; |
| 1111 | switch (std.zig.system.getExternalExecutor(b.graph.host.result, &other_target, .{ | |
| 1111 | switch (std.zig.system.getExternalExecutor(&b.graph.host.result, &other_target, .{ | |
| 1112 | 1112 | .qemu_fixes_dl = need_cross_libc and b.libc_runtimes_dir != null, |
| 1113 | 1113 | .link_libc = exe.is_linking_libc, |
| 1114 | 1114 | })) { |
lib/std/Target.zig+26-26| ... | ... | @@ -1074,7 +1074,7 @@ pub const ObjectFormat = enum { |
| 1074 | 1074 | } |
| 1075 | 1075 | }; |
| 1076 | 1076 | |
| 1077 | pub fn toElfMachine(target: Target) std.elf.EM { | |
| 1077 | pub fn toElfMachine(target: *const Target) std.elf.EM { | |
| 1078 | 1078 | return switch (target.cpu.arch) { |
| 1079 | 1079 | .amdgcn => .AMDGPU, |
| 1080 | 1080 | .arc => .ARC_COMPACT, |
| ... | ... | @@ -1115,7 +1115,7 @@ pub fn toElfMachine(target: Target) std.elf.EM { |
| 1115 | 1115 | }; |
| 1116 | 1116 | } |
| 1117 | 1117 | |
| 1118 | pub fn toCoffMachine(target: Target) std.coff.MachineType { | |
| 1118 | pub fn toCoffMachine(target: *const Target) std.coff.MachineType { | |
| 1119 | 1119 | return switch (target.cpu.arch) { |
| 1120 | 1120 | .arm => .ARM, |
| 1121 | 1121 | .thumb => .ARMNT, |
| ... | ... | @@ -1999,7 +1999,7 @@ pub const Cpu = struct { |
| 1999 | 1999 | } |
| 2000 | 2000 | }; |
| 2001 | 2001 | |
| 2002 | pub fn zigTriple(target: Target, allocator: Allocator) Allocator.Error![]u8 { | |
| 2002 | pub fn zigTriple(target: *const Target, allocator: Allocator) Allocator.Error![]u8 { | |
| 2003 | 2003 | return Query.fromTarget(target).zigTriple(allocator); |
| 2004 | 2004 | } |
| 2005 | 2005 | |
| ... | ... | @@ -2007,7 +2007,7 @@ pub fn hurdTupleSimple(allocator: Allocator, arch: Cpu.Arch, abi: Abi) ![]u8 { |
| 2007 | 2007 | return std.fmt.allocPrint(allocator, "{s}-{s}", .{ @tagName(arch), @tagName(abi) }); |
| 2008 | 2008 | } |
| 2009 | 2009 | |
| 2010 | pub fn hurdTuple(target: Target, allocator: Allocator) ![]u8 { | |
| 2010 | pub fn hurdTuple(target: *const Target, allocator: Allocator) ![]u8 { | |
| 2011 | 2011 | return hurdTupleSimple(allocator, target.cpu.arch, target.abi); |
| 2012 | 2012 | } |
| 2013 | 2013 | |
| ... | ... | @@ -2015,63 +2015,63 @@ pub fn linuxTripleSimple(allocator: Allocator, arch: Cpu.Arch, os_tag: Os.Tag, a |
| 2015 | 2015 | return std.fmt.allocPrint(allocator, "{s}-{s}-{s}", .{ @tagName(arch), @tagName(os_tag), @tagName(abi) }); |
| 2016 | 2016 | } |
| 2017 | 2017 | |
| 2018 | pub fn linuxTriple(target: Target, allocator: Allocator) ![]u8 { | |
| 2018 | pub fn linuxTriple(target: *const Target, allocator: Allocator) ![]u8 { | |
| 2019 | 2019 | return linuxTripleSimple(allocator, target.cpu.arch, target.os.tag, target.abi); |
| 2020 | 2020 | } |
| 2021 | 2021 | |
| 2022 | pub fn exeFileExt(target: Target) [:0]const u8 { | |
| 2022 | pub fn exeFileExt(target: *const Target) [:0]const u8 { | |
| 2023 | 2023 | return target.os.tag.exeFileExt(target.cpu.arch); |
| 2024 | 2024 | } |
| 2025 | 2025 | |
| 2026 | pub fn staticLibSuffix(target: Target) [:0]const u8 { | |
| 2026 | pub fn staticLibSuffix(target: *const Target) [:0]const u8 { | |
| 2027 | 2027 | return target.os.tag.staticLibSuffix(target.abi); |
| 2028 | 2028 | } |
| 2029 | 2029 | |
| 2030 | pub fn dynamicLibSuffix(target: Target) [:0]const u8 { | |
| 2030 | pub fn dynamicLibSuffix(target: *const Target) [:0]const u8 { | |
| 2031 | 2031 | return target.os.tag.dynamicLibSuffix(); |
| 2032 | 2032 | } |
| 2033 | 2033 | |
| 2034 | pub fn libPrefix(target: Target) [:0]const u8 { | |
| 2034 | pub fn libPrefix(target: *const Target) [:0]const u8 { | |
| 2035 | 2035 | return target.os.tag.libPrefix(target.abi); |
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | pub inline fn isMinGW(target: Target) bool { | |
| 2038 | pub inline fn isMinGW(target: *const Target) bool { | |
| 2039 | 2039 | return target.os.tag == .windows and target.abi.isGnu(); |
| 2040 | 2040 | } |
| 2041 | 2041 | |
| 2042 | pub inline fn isGnuLibC(target: Target) bool { | |
| 2042 | pub inline fn isGnuLibC(target: *const Target) bool { | |
| 2043 | 2043 | return switch (target.os.tag) { |
| 2044 | 2044 | .hurd, .linux => target.abi.isGnu(), |
| 2045 | 2045 | else => false, |
| 2046 | 2046 | }; |
| 2047 | 2047 | } |
| 2048 | 2048 | |
| 2049 | pub inline fn isMuslLibC(target: Target) bool { | |
| 2049 | pub inline fn isMuslLibC(target: *const Target) bool { | |
| 2050 | 2050 | return target.os.tag == .linux and target.abi.isMusl(); |
| 2051 | 2051 | } |
| 2052 | 2052 | |
| 2053 | pub inline fn isDarwinLibC(target: Target) bool { | |
| 2053 | pub inline fn isDarwinLibC(target: *const Target) bool { | |
| 2054 | 2054 | return switch (target.abi) { |
| 2055 | 2055 | .none, .macabi, .simulator => target.os.tag.isDarwin(), |
| 2056 | 2056 | else => false, |
| 2057 | 2057 | }; |
| 2058 | 2058 | } |
| 2059 | 2059 | |
| 2060 | pub inline fn isFreeBSDLibC(target: Target) bool { | |
| 2060 | pub inline fn isFreeBSDLibC(target: *const Target) bool { | |
| 2061 | 2061 | return switch (target.abi) { |
| 2062 | 2062 | .none, .eabihf => target.os.tag == .freebsd, |
| 2063 | 2063 | else => false, |
| 2064 | 2064 | }; |
| 2065 | 2065 | } |
| 2066 | 2066 | |
| 2067 | pub inline fn isNetBSDLibC(target: Target) bool { | |
| 2067 | pub inline fn isNetBSDLibC(target: *const Target) bool { | |
| 2068 | 2068 | return switch (target.abi) { |
| 2069 | 2069 | .none, .eabi, .eabihf => target.os.tag == .netbsd, |
| 2070 | 2070 | else => false, |
| 2071 | 2071 | }; |
| 2072 | 2072 | } |
| 2073 | 2073 | |
| 2074 | pub inline fn isWasiLibC(target: Target) bool { | |
| 2074 | pub inline fn isWasiLibC(target: *const Target) bool { | |
| 2075 | 2075 | return target.os.tag == .wasi and target.abi.isMusl(); |
| 2076 | 2076 | } |
| 2077 | 2077 | |
| ... | ... | @@ -2576,7 +2576,7 @@ pub const DynamicLinker = struct { |
| 2576 | 2576 | } |
| 2577 | 2577 | }; |
| 2578 | 2578 | |
| 2579 | pub fn standardDynamicLinkerPath(target: Target) DynamicLinker { | |
| 2579 | pub fn standardDynamicLinkerPath(target: *const Target) DynamicLinker { | |
| 2580 | 2580 | return DynamicLinker.standard(target.cpu, target.os, target.abi); |
| 2581 | 2581 | } |
| 2582 | 2582 | |
| ... | ... | @@ -2645,11 +2645,11 @@ pub fn ptrBitWidth_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) u16 { |
| 2645 | 2645 | }; |
| 2646 | 2646 | } |
| 2647 | 2647 | |
| 2648 | pub fn ptrBitWidth(target: Target) u16 { | |
| 2648 | pub fn ptrBitWidth(target: *const Target) u16 { | |
| 2649 | 2649 | return ptrBitWidth_cpu_abi(target.cpu, target.abi); |
| 2650 | 2650 | } |
| 2651 | 2651 | |
| 2652 | pub fn stackAlignment(target: Target) u16 { | |
| 2652 | pub fn stackAlignment(target: *const Target) u16 { | |
| 2653 | 2653 | // Overrides for when the stack alignment is not equal to the pointer width. |
| 2654 | 2654 | switch (target.cpu.arch) { |
| 2655 | 2655 | .m68k, |
| ... | ... | @@ -2697,7 +2697,7 @@ pub fn stackAlignment(target: Target) u16 { |
| 2697 | 2697 | /// Default signedness of `char` for the native C compiler for this target |
| 2698 | 2698 | /// Note that char signedness is implementation-defined and many compilers provide |
| 2699 | 2699 | /// an option to override the default signedness e.g. GCC's -funsigned-char / -fsigned-char |
| 2700 | pub fn cCharSignedness(target: Target) std.builtin.Signedness { | |
| 2700 | pub fn cCharSignedness(target: *const Target) std.builtin.Signedness { | |
| 2701 | 2701 | if (target.os.tag.isDarwin() or target.os.tag == .windows or target.os.tag == .uefi) return .signed; |
| 2702 | 2702 | |
| 2703 | 2703 | return switch (target.cpu.arch) { |
| ... | ... | @@ -2740,7 +2740,7 @@ pub const CType = enum { |
| 2740 | 2740 | longdouble, |
| 2741 | 2741 | }; |
| 2742 | 2742 | |
| 2743 | pub fn cTypeByteSize(t: Target, c_type: CType) u16 { | |
| 2743 | pub fn cTypeByteSize(t: *const Target, c_type: CType) u16 { | |
| 2744 | 2744 | return switch (c_type) { |
| 2745 | 2745 | .char, |
| 2746 | 2746 | .short, |
| ... | ... | @@ -2766,7 +2766,7 @@ pub fn cTypeByteSize(t: Target, c_type: CType) u16 { |
| 2766 | 2766 | }; |
| 2767 | 2767 | } |
| 2768 | 2768 | |
| 2769 | pub fn cTypeBitSize(target: Target, c_type: CType) u16 { | |
| 2769 | pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 { | |
| 2770 | 2770 | switch (target.os.tag) { |
| 2771 | 2771 | .freestanding, .other => switch (target.cpu.arch) { |
| 2772 | 2772 | .msp430 => switch (c_type) { |
| ... | ... | @@ -3077,7 +3077,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { |
| 3077 | 3077 | } |
| 3078 | 3078 | } |
| 3079 | 3079 | |
| 3080 | pub fn cTypeAlignment(target: Target, c_type: CType) u16 { | |
| 3080 | pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 { | |
| 3081 | 3081 | // Overrides for unusual alignments |
| 3082 | 3082 | switch (target.cpu.arch) { |
| 3083 | 3083 | .avr => return 1, |
| ... | ... | @@ -3172,7 +3172,7 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 { |
| 3172 | 3172 | ); |
| 3173 | 3173 | } |
| 3174 | 3174 | |
| 3175 | pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 { | |
| 3175 | pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 { | |
| 3176 | 3176 | // Overrides for unusual alignments |
| 3177 | 3177 | switch (target.cpu.arch) { |
| 3178 | 3178 | .arc => switch (c_type) { |
| ... | ... | @@ -3265,7 +3265,7 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 { |
| 3265 | 3265 | ); |
| 3266 | 3266 | } |
| 3267 | 3267 | |
| 3268 | pub fn cMaxIntAlignment(target: std.Target) u16 { | |
| 3268 | pub fn cMaxIntAlignment(target: *const Target) u16 { | |
| 3269 | 3269 | return switch (target.cpu.arch) { |
| 3270 | 3270 | .avr => 1, |
| 3271 | 3271 | |
| ... | ... | @@ -3328,7 +3328,7 @@ pub fn cMaxIntAlignment(target: std.Target) u16 { |
| 3328 | 3328 | }; |
| 3329 | 3329 | } |
| 3330 | 3330 | |
| 3331 | pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention { | |
| 3331 | pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention { | |
| 3332 | 3332 | return switch (target.cpu.arch) { |
| 3333 | 3333 | .x86_64 => switch (target.os.tag) { |
| 3334 | 3334 | .windows, .uefi => .{ .x86_64_win = .{} }, |
lib/std/Target/Query.zig+1-1| ... | ... | @@ -94,7 +94,7 @@ pub const OsVersion = union(enum) { |
| 94 | 94 | |
| 95 | 95 | pub const SemanticVersion = std.SemanticVersion; |
| 96 | 96 | |
| 97 | pub fn fromTarget(target: Target) Query { | |
| 97 | pub fn fromTarget(target: *const Target) Query { | |
| 98 | 98 | var result: Query = .{ |
| 99 | 99 | .cpu_arch = target.cpu.arch, |
| 100 | 100 | .cpu_model = .{ .explicit = target.cpu.model }, |
lib/std/debug/Dwarf/abi.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ const Arch = std.Target.Cpu.Arch; |
| 9 | 9 | /// |
| 10 | 10 | /// See also `std.debug.SelfInfo.supportsUnwinding` which tells whether the Zig |
| 11 | 11 | /// standard library has a working implementation of unwinding for this target. |
| 12 | pub fn supportsUnwinding(target: std.Target) bool { | |
| 12 | pub fn supportsUnwinding(target: *const std.Target) bool { | |
| 13 | 13 | return switch (target.cpu.arch) { |
| 14 | 14 | .amdgcn, |
| 15 | 15 | .nvptx, |
lib/std/debug/SelfInfo.zig+3-3| ... | ... | @@ -1795,10 +1795,10 @@ fn spRegNum(reg_context: Dwarf.abi.RegisterContext) u8 { |
| 1795 | 1795 | const ip_reg_num = Dwarf.abi.ipRegNum(native_arch).?; |
| 1796 | 1796 | |
| 1797 | 1797 | /// Tells whether unwinding for the host is implemented. |
| 1798 | pub const supports_unwinding = supportsUnwinding(builtin.target); | |
| 1798 | pub const supports_unwinding = supportsUnwinding(&builtin.target); | |
| 1799 | 1799 | |
| 1800 | 1800 | comptime { |
| 1801 | if (supports_unwinding) assert(Dwarf.abi.supportsUnwinding(builtin.target)); | |
| 1801 | if (supports_unwinding) assert(Dwarf.abi.supportsUnwinding(&builtin.target)); | |
| 1802 | 1802 | } |
| 1803 | 1803 | |
| 1804 | 1804 | /// Tells whether unwinding for this target is *implemented* here in the Zig |
| ... | ... | @@ -1806,7 +1806,7 @@ comptime { |
| 1806 | 1806 | /// |
| 1807 | 1807 | /// See also `Dwarf.abi.supportsUnwinding` which tells whether Dwarf supports |
| 1808 | 1808 | /// unwinding on that target *in theory*. |
| 1809 | pub fn supportsUnwinding(target: std.Target) bool { | |
| 1809 | pub fn supportsUnwinding(target: *const std.Target) bool { | |
| 1810 | 1810 | return switch (target.cpu.arch) { |
| 1811 | 1811 | .x86 => switch (target.os.tag) { |
| 1812 | 1812 | .linux, .netbsd, .solaris, .illumos => true, |
lib/std/zig.zig+1-1| ... | ... | @@ -141,7 +141,7 @@ pub fn lineDelta(source: []const u8, start: usize, end: usize) isize { |
| 141 | 141 | |
| 142 | 142 | pub const BinNameOptions = struct { |
| 143 | 143 | root_name: []const u8, |
| 144 | target: std.Target, | |
| 144 | target: *const std.Target, | |
| 145 | 145 | output_mode: std.builtin.OutputMode, |
| 146 | 146 | link_mode: ?std.builtin.LinkMode = null, |
| 147 | 147 | version: ?std.SemanticVersion = null, |
lib/std/zig/LibCDirs.zig+4-4| ... | ... | @@ -15,7 +15,7 @@ pub const DarwinSdkLayout = enum { |
| 15 | 15 | pub fn detect( |
| 16 | 16 | arena: Allocator, |
| 17 | 17 | zig_lib_dir: []const u8, |
| 18 | target: std.Target, | |
| 18 | target: *const std.Target, | |
| 19 | 19 | is_native_abi: bool, |
| 20 | 20 | link_libc: bool, |
| 21 | 21 | libc_installation: ?*const LibCInstallation, |
| ... | ... | @@ -88,7 +88,7 @@ pub fn detect( |
| 88 | 88 | }; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | fn detectFromInstallation(arena: Allocator, target: std.Target, lci: *const LibCInstallation) !LibCDirs { | |
| 91 | fn detectFromInstallation(arena: Allocator, target: *const std.Target, lci: *const LibCInstallation) !LibCDirs { | |
| 92 | 92 | var list = try std.ArrayList([]const u8).initCapacity(arena, 5); |
| 93 | 93 | var framework_list = std.ArrayList([]const u8).init(arena); |
| 94 | 94 | |
| ... | ... | @@ -146,7 +146,7 @@ fn detectFromInstallation(arena: Allocator, target: std.Target, lci: *const LibC |
| 146 | 146 | pub fn detectFromBuilding( |
| 147 | 147 | arena: Allocator, |
| 148 | 148 | zig_lib_dir: []const u8, |
| 149 | target: std.Target, | |
| 149 | target: *const std.Target, | |
| 150 | 150 | ) !LibCDirs { |
| 151 | 151 | const s = std.fs.path.sep_str; |
| 152 | 152 | |
| ... | ... | @@ -224,7 +224,7 @@ pub fn detectFromBuilding( |
| 224 | 224 | }; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | fn libCGenericName(target: std.Target) [:0]const u8 { | |
| 227 | fn libCGenericName(target: *const std.Target) [:0]const u8 { | |
| 228 | 228 | switch (target.os.tag) { |
| 229 | 229 | .windows => return "mingw", |
| 230 | 230 | .macos, .ios, .tvos, .watchos, .visionos => return "darwin", |
lib/std/zig/LibCInstallation.zig+4-4| ... | ... | @@ -26,7 +26,7 @@ pub const FindError = error{ |
| 26 | 26 | pub fn parse( |
| 27 | 27 | allocator: Allocator, |
| 28 | 28 | libc_file: []const u8, |
| 29 | target: std.Target, | |
| 29 | target: *const std.Target, | |
| 30 | 30 | ) !LibCInstallation { |
| 31 | 31 | var self: LibCInstallation = .{}; |
| 32 | 32 | |
| ... | ... | @@ -157,7 +157,7 @@ pub fn render(self: LibCInstallation, out: anytype) !void { |
| 157 | 157 | |
| 158 | 158 | pub const FindNativeOptions = struct { |
| 159 | 159 | allocator: Allocator, |
| 160 | target: std.Target, | |
| 160 | target: *const std.Target, | |
| 161 | 161 | |
| 162 | 162 | /// If enabled, will print human-friendly errors to stderr. |
| 163 | 163 | verbose: bool = false, |
| ... | ... | @@ -700,7 +700,7 @@ pub const CrtBasenames = struct { |
| 700 | 700 | crtn: ?[]const u8 = null, |
| 701 | 701 | |
| 702 | 702 | pub const GetArgs = struct { |
| 703 | target: std.Target, | |
| 703 | target: *const std.Target, | |
| 704 | 704 | link_libc: bool, |
| 705 | 705 | output_mode: std.builtin.OutputMode, |
| 706 | 706 | link_mode: std.builtin.LinkMode, |
| ... | ... | @@ -965,7 +965,7 @@ pub fn resolveCrtPaths( |
| 965 | 965 | lci: LibCInstallation, |
| 966 | 966 | arena: Allocator, |
| 967 | 967 | crt_basenames: CrtBasenames, |
| 968 | target: std.Target, | |
| 968 | target: *const std.Target, | |
| 969 | 969 | ) error{ OutOfMemory, LibCInstallationMissingCrtDir }!CrtPaths { |
| 970 | 970 | const crt_dir_path: Path = .{ |
| 971 | 971 | .root_dir = std.Build.Cache.Directory.cwd(), |
lib/std/zig/llvm/Builder.zig+1-1| ... | ... | @@ -66,7 +66,7 @@ pub const Options = struct { |
| 66 | 66 | allocator: Allocator, |
| 67 | 67 | strip: bool = true, |
| 68 | 68 | name: []const u8 = &.{}, |
| 69 | target: std.Target = builtin.target, | |
| 69 | target: *const std.Target = &builtin.target, | |
| 70 | 70 | triple: []const u8 = &.{}, |
| 71 | 71 | }; |
| 72 | 72 |
lib/std/zig/system.zig+1-1| ... | ... | @@ -28,7 +28,7 @@ pub const GetExternalExecutorOptions = struct { |
| 28 | 28 | /// Return whether or not the given host is capable of running executables of |
| 29 | 29 | /// the other target. |
| 30 | 30 | pub fn getExternalExecutor( |
| 31 | host: std.Target, | |
| 31 | host: *const std.Target, | |
| 32 | 32 | candidate: *const std.Target, |
| 33 | 33 | options: GetExternalExecutorOptions, |
| 34 | 34 | ) Executor { |
lib/std/zig/system/NativePaths.zig+1-1| ... | ... | @@ -13,7 +13,7 @@ framework_dirs: std.ArrayListUnmanaged([]const u8) = .empty, |
| 13 | 13 | rpaths: std.ArrayListUnmanaged([]const u8) = .empty, |
| 14 | 14 | warnings: std.ArrayListUnmanaged([]const u8) = .empty, |
| 15 | 15 | |
| 16 | pub fn detect(arena: Allocator, native_target: std.Target) !NativePaths { | |
| 16 | pub fn detect(arena: Allocator, native_target: *const std.Target) !NativePaths { | |
| 17 | 17 | var self: NativePaths = .{ .arena = arena }; |
| 18 | 18 | var is_nix = false; |
| 19 | 19 | if (process.getEnvVarOwned(arena, "NIX_CFLAGS_COMPILE")) |nix_cflags_compile| { |
lib/std/zig/system/darwin.zig+1-1| ... | ... | @@ -34,7 +34,7 @@ pub fn isSdkInstalled(allocator: Allocator) bool { |
| 34 | 34 | /// Caller owns the memory. |
| 35 | 35 | /// stderr from xcrun is ignored. |
| 36 | 36 | /// If error.OutOfMemory occurs in Allocator, this function returns null. |
| 37 | pub fn getSdk(allocator: Allocator, target: Target) ?[]const u8 { | |
| 37 | pub fn getSdk(allocator: Allocator, target: *const Target) ?[]const u8 { | |
| 38 | 38 | const is_simulator_abi = target.abi == .simulator; |
| 39 | 39 | const sdk = switch (target.os.tag) { |
| 40 | 40 | .ios => switch (target.abi) { |
lib/std/zig/target.zig+6-6| ... | ... | @@ -116,7 +116,7 @@ pub const freebsd_libc_version: std.SemanticVersion = .{ .major = 14, .minor = 0 |
| 116 | 116 | /// The version of Zig's bundled NetBSD libc used when linking libc statically. |
| 117 | 117 | pub const netbsd_libc_version: std.SemanticVersion = .{ .major = 10, .minor = 1, .patch = 0 }; |
| 118 | 118 | |
| 119 | pub fn canBuildLibC(target: std.Target) bool { | |
| 119 | pub fn canBuildLibC(target: *const std.Target) bool { | |
| 120 | 120 | for (available_libcs) |libc| { |
| 121 | 121 | if (target.cpu.arch == libc.arch and target.os.tag == libc.os and target.abi == libc.abi) { |
| 122 | 122 | if (libc.os_ver) |libc_os_ver| { |
| ... | ... | @@ -176,7 +176,7 @@ pub fn muslRuntimeTriple( |
| 176 | 176 | return std.Target.linuxTripleSimple(allocator, arch, .linux, abi); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | pub fn osArchName(target: std.Target) [:0]const u8 { | |
| 179 | pub fn osArchName(target: *const std.Target) [:0]const u8 { | |
| 180 | 180 | return switch (target.os.tag) { |
| 181 | 181 | .linux => switch (target.cpu.arch) { |
| 182 | 182 | .arm, .armeb, .thumb, .thumbeb => "arm", |
| ... | ... | @@ -276,7 +276,7 @@ pub fn netbsdAbiNameHeaders(abi: std.Target.Abi) [:0]const u8 { |
| 276 | 276 | }; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | pub fn isLibCLibName(target: std.Target, name: []const u8) bool { | |
| 279 | pub fn isLibCLibName(target: *const std.Target, name: []const u8) bool { | |
| 280 | 280 | const ignore_case = target.os.tag.isDarwin() or target.os.tag == .windows; |
| 281 | 281 | |
| 282 | 282 | if (eqlIgnoreCase(ignore_case, name, "c")) |
| ... | ... | @@ -453,7 +453,7 @@ pub fn isLibCLibName(target: std.Target, name: []const u8) bool { |
| 453 | 453 | return false; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | pub fn isLibCxxLibName(target: std.Target, name: []const u8) bool { | |
| 456 | pub fn isLibCxxLibName(target: *const std.Target, name: []const u8) bool { | |
| 457 | 457 | const ignore_case = target.os.tag.isDarwin() or target.os.tag == .windows; |
| 458 | 458 | |
| 459 | 459 | return eqlIgnoreCase(ignore_case, name, "c++") or |
| ... | ... | @@ -470,11 +470,11 @@ fn eqlIgnoreCase(ignore_case: bool, a: []const u8, b: []const u8) bool { |
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | pub fn intByteSize(target: std.Target, bits: u16) u19 { | |
| 473 | pub fn intByteSize(target: *const std.Target, bits: u16) u19 { | |
| 474 | 474 | return std.mem.alignForward(u19, @intCast((@as(u17, bits) + 7) / 8), intAlignment(target, bits)); |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | pub fn intAlignment(target: std.Target, bits: u16) u16 { | |
| 477 | pub fn intAlignment(target: *const std.Target, bits: u16) u16 { | |
| 478 | 478 | return switch (target.cpu.arch) { |
| 479 | 479 | .x86 => switch (bits) { |
| 480 | 480 | 0 => 0, |
src/Compilation.zig+19-21| ... | ... | @@ -1361,7 +1361,7 @@ pub const cache_helpers = struct { |
| 1361 | 1361 | hh: *Cache.HashHelper, |
| 1362 | 1362 | resolved_target: Package.Module.ResolvedTarget, |
| 1363 | 1363 | ) void { |
| 1364 | const target = resolved_target.result; | |
| 1364 | const target = &resolved_target.result; | |
| 1365 | 1365 | hh.add(target.cpu.arch); |
| 1366 | 1366 | hh.addBytes(target.cpu.model.name); |
| 1367 | 1367 | hh.add(target.cpu.features.ints); |
| ... | ... | @@ -1705,7 +1705,7 @@ pub const CreateOptions = struct { |
| 1705 | 1705 | assert(opts.cache_mode != .none); |
| 1706 | 1706 | return try ea.cacheName(arena, .{ |
| 1707 | 1707 | .root_name = opts.root_name, |
| 1708 | .target = opts.root_mod.resolved_target.result, | |
| 1708 | .target = &opts.root_mod.resolved_target.result, | |
| 1709 | 1709 | .output_mode = opts.config.output_mode, |
| 1710 | 1710 | .link_mode = opts.config.link_mode, |
| 1711 | 1711 | .version = opts.version, |
| ... | ... | @@ -1772,14 +1772,14 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1772 | 1772 | } |
| 1773 | 1773 | |
| 1774 | 1774 | const have_zcu = options.config.have_zcu; |
| 1775 | const use_llvm = options.config.use_llvm; | |
| 1776 | const target = &options.root_mod.resolved_target.result; | |
| 1775 | 1777 | |
| 1776 | 1778 | const comp: *Compilation = comp: { |
| 1777 | 1779 | // We put the `Compilation` itself in the arena. Freeing the arena will free the module. |
| 1778 | 1780 | // It's initialized later after we prepare the initialization options. |
| 1779 | 1781 | const root_name = try arena.dupeZ(u8, options.root_name); |
| 1780 | 1782 | |
| 1781 | const use_llvm = options.config.use_llvm; | |
| 1782 | ||
| 1783 | 1783 | // The "any" values provided by resolved config only account for |
| 1784 | 1784 | // explicitly-provided settings. We now make them additionally account |
| 1785 | 1785 | // for default setting resolution. |
| ... | ... | @@ -1804,7 +1804,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1804 | 1804 | const libc_dirs = try std.zig.LibCDirs.detect( |
| 1805 | 1805 | arena, |
| 1806 | 1806 | options.dirs.zig_lib.path.?, |
| 1807 | options.root_mod.resolved_target.result, | |
| 1807 | target, | |
| 1808 | 1808 | options.root_mod.resolved_target.is_native_abi, |
| 1809 | 1809 | link_libc, |
| 1810 | 1810 | options.libc_installation, |
| ... | ... | @@ -1846,7 +1846,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1846 | 1846 | // approach, since the ubsan runtime uses quite a lot of the standard library |
| 1847 | 1847 | // and this reduces unnecessary bloat. |
| 1848 | 1848 | const ubsan_rt_strat: RtStrat = s: { |
| 1849 | const can_build_ubsan_rt = target_util.canBuildLibUbsanRt(options.root_mod.resolved_target.result); | |
| 1849 | const can_build_ubsan_rt = target_util.canBuildLibUbsanRt(target); | |
| 1850 | 1850 | const want_ubsan_rt = options.want_ubsan_rt orelse (can_build_ubsan_rt and any_sanitize_c == .full and is_exe_or_dyn_lib); |
| 1851 | 1851 | if (!want_ubsan_rt) break :s .none; |
| 1852 | 1852 | if (options.skip_linker_dependencies) break :s .none; |
| ... | ... | @@ -1872,7 +1872,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1872 | 1872 | |
| 1873 | 1873 | if (options.verbose_llvm_cpu_features) { |
| 1874 | 1874 | if (options.root_mod.resolved_target.llvm_cpu_features) |cf| print: { |
| 1875 | const target = options.root_mod.resolved_target.result; | |
| 1876 | 1875 | std.debug.lockStdErr(); |
| 1877 | 1876 | defer std.debug.unlockStdErr(); |
| 1878 | 1877 | const stderr = std.io.getStdErr().writer(); |
| ... | ... | @@ -2244,8 +2243,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 2244 | 2243 | }; |
| 2245 | 2244 | errdefer comp.destroy(); |
| 2246 | 2245 | |
| 2247 | const target = comp.root_mod.resolved_target.result; | |
| 2248 | const can_build_compiler_rt = target_util.canBuildLibCompilerRt(target, comp.config.use_llvm, build_options.have_llvm); | |
| 2246 | const can_build_compiler_rt = target_util.canBuildLibCompilerRt(target, use_llvm, build_options.have_llvm); | |
| 2249 | 2247 | |
| 2250 | 2248 | // Add a `CObject` for each `c_source_files`. |
| 2251 | 2249 | try comp.c_object_table.ensureTotalCapacity(gpa, options.c_source_files.len); |
| ... | ... | @@ -2344,7 +2342,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 2344 | 2342 | comp.link_task_queue.pending_prelink_tasks += 1; |
| 2345 | 2343 | } |
| 2346 | 2344 | comp.queued_jobs.glibc_shared_objects = true; |
| 2347 | comp.link_task_queue.pending_prelink_tasks += glibc.sharedObjectsCount(&target); | |
| 2345 | comp.link_task_queue.pending_prelink_tasks += glibc.sharedObjectsCount(target); | |
| 2348 | 2346 | |
| 2349 | 2347 | comp.queued_jobs.glibc_crt_file[@intFromEnum(glibc.CrtFile.libc_nonshared_a)] = true; |
| 2350 | 2348 | comp.link_task_queue.pending_prelink_tasks += 1; |
| ... | ... | @@ -2571,8 +2569,8 @@ pub fn clearMiscFailures(comp: *Compilation) void { |
| 2571 | 2569 | comp.misc_failures = .{}; |
| 2572 | 2570 | } |
| 2573 | 2571 | |
| 2574 | pub fn getTarget(self: Compilation) Target { | |
| 2575 | return self.root_mod.resolved_target.result; | |
| 2572 | pub fn getTarget(self: *const Compilation) *const Target { | |
| 2573 | return &self.root_mod.resolved_target.result; | |
| 2576 | 2574 | } |
| 2577 | 2575 | |
| 2578 | 2576 | /// Only legal to call when cache mode is incremental and a link file is present. |
| ... | ... | @@ -3210,7 +3208,7 @@ fn addNonIncrementalStuffToCacheManifest( |
| 3210 | 3208 | man.hash.addOptional(opts.image_base); |
| 3211 | 3209 | man.hash.addOptional(opts.gc_sections); |
| 3212 | 3210 | man.hash.add(opts.emit_relocs); |
| 3213 | const target = comp.root_mod.resolved_target.result; | |
| 3211 | const target = &comp.root_mod.resolved_target.result; | |
| 3214 | 3212 | if (target.ofmt == .macho or target.ofmt == .coff) { |
| 3215 | 3213 | // TODO remove this, libraries need to be resolved by the frontend. this is already |
| 3216 | 3214 | // done by ELF. |
| ... | ... | @@ -6270,7 +6268,7 @@ pub fn addCCArgs( |
| 6270 | 6268 | out_dep_path: ?[]const u8, |
| 6271 | 6269 | mod: *Package.Module, |
| 6272 | 6270 | ) !void { |
| 6273 | const target = mod.resolved_target.result; | |
| 6271 | const target = &mod.resolved_target.result; | |
| 6274 | 6272 | |
| 6275 | 6273 | // As of Clang 16.x, it will by default read extra flags from /etc/clang. |
| 6276 | 6274 | // I'm sure the person who implemented this means well, but they have a lot |
| ... | ... | @@ -6944,7 +6942,7 @@ pub const FileExt = enum { |
| 6944 | 6942 | }; |
| 6945 | 6943 | } |
| 6946 | 6944 | |
| 6947 | pub fn canonicalName(ext: FileExt, target: Target) [:0]const u8 { | |
| 6945 | pub fn canonicalName(ext: FileExt, target: *const Target) [:0]const u8 { | |
| 6948 | 6946 | return switch (ext) { |
| 6949 | 6947 | .c => ".c", |
| 6950 | 6948 | .cpp => ".cpp", |
| ... | ... | @@ -7187,7 +7185,7 @@ pub fn dump_argv(argv: []const []const u8) void { |
| 7187 | 7185 | } |
| 7188 | 7186 | |
| 7189 | 7187 | pub fn getZigBackend(comp: Compilation) std.builtin.CompilerBackend { |
| 7190 | const target = comp.root_mod.resolved_target.result; | |
| 7188 | const target = &comp.root_mod.resolved_target.result; | |
| 7191 | 7189 | return target_util.zigBackend(target, comp.config.use_llvm); |
| 7192 | 7190 | } |
| 7193 | 7191 | |
| ... | ... | @@ -7371,7 +7369,7 @@ pub fn build_crt_file( |
| 7371 | 7369 | |
| 7372 | 7370 | const basename = try std.zig.binNameAlloc(gpa, .{ |
| 7373 | 7371 | .root_name = root_name, |
| 7374 | .target = comp.root_mod.resolved_target.result, | |
| 7372 | .target = &comp.root_mod.resolved_target.result, | |
| 7375 | 7373 | .output_mode = output_mode, |
| 7376 | 7374 | }); |
| 7377 | 7375 | |
| ... | ... | @@ -7523,13 +7521,13 @@ pub fn getCrtPaths( |
| 7523 | 7521 | comp: *Compilation, |
| 7524 | 7522 | arena: Allocator, |
| 7525 | 7523 | ) error{ OutOfMemory, LibCInstallationMissingCrtDir }!LibCInstallation.CrtPaths { |
| 7526 | const target = comp.root_mod.resolved_target.result; | |
| 7524 | const target = &comp.root_mod.resolved_target.result; | |
| 7527 | 7525 | return getCrtPathsInner(arena, target, comp.config, comp.libc_installation, &comp.crt_files); |
| 7528 | 7526 | } |
| 7529 | 7527 | |
| 7530 | 7528 | fn getCrtPathsInner( |
| 7531 | 7529 | arena: Allocator, |
| 7532 | target: std.Target, | |
| 7530 | target: *const std.Target, | |
| 7533 | 7531 | config: Config, |
| 7534 | 7532 | libc_installation: ?*const LibCInstallation, |
| 7535 | 7533 | crt_files: *std.StringHashMapUnmanaged(CrtFile), |
| ... | ... | @@ -7558,7 +7556,7 @@ pub fn addLinkLib(comp: *Compilation, lib_name: []const u8) !void { |
| 7558 | 7556 | // then when we create a sub-Compilation for zig libc, it also tries to |
| 7559 | 7557 | // build kernel32.lib. |
| 7560 | 7558 | if (comp.skip_linker_dependencies) return; |
| 7561 | const target = comp.root_mod.resolved_target.result; | |
| 7559 | const target = &comp.root_mod.resolved_target.result; | |
| 7562 | 7560 | if (target.os.tag != .windows or target.ofmt == .c) return; |
| 7563 | 7561 | |
| 7564 | 7562 | // This happens when an `extern "foo"` function is referenced. |
| ... | ... | @@ -7574,7 +7572,7 @@ pub fn compilerRtOptMode(comp: Compilation) std.builtin.OptimizeMode { |
| 7574 | 7572 | if (comp.debug_compiler_runtime_libs) { |
| 7575 | 7573 | return comp.root_mod.optimize_mode; |
| 7576 | 7574 | } |
| 7577 | const target = comp.root_mod.resolved_target.result; | |
| 7575 | const target = &comp.root_mod.resolved_target.result; | |
| 7578 | 7576 | switch (comp.root_mod.optimize_mode) { |
| 7579 | 7577 | .Debug, .ReleaseSafe => return target_util.defaultCompilerRtOptimizeMode(target), |
| 7580 | 7578 | .ReleaseFast => return .ReleaseFast, |
src/Compilation/Config.zig+1-1| ... | ... | @@ -150,7 +150,7 @@ pub const ResolveError = error{ |
| 150 | 150 | }; |
| 151 | 151 | |
| 152 | 152 | pub fn resolve(options: Options) ResolveError!Config { |
| 153 | const target = options.resolved_target.result; | |
| 153 | const target = &options.resolved_target.result; | |
| 154 | 154 | |
| 155 | 155 | // WASI-only. Resolve the optional exec-model option, defaults to command. |
| 156 | 156 | if (target.os.tag != .wasi and options.wasi_exec_model != null) |
src/Package/Module.zig+3-3| ... | ... | @@ -102,7 +102,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { |
| 102 | 102 | if (options.inherited.error_tracing == true) assert(options.global.any_error_tracing); |
| 103 | 103 | |
| 104 | 104 | const resolved_target = options.inherited.resolved_target orelse options.parent.?.resolved_target; |
| 105 | const target = resolved_target.result; | |
| 105 | const target = &resolved_target.result; | |
| 106 | 106 | |
| 107 | 107 | const optimize_mode = options.inherited.optimize_mode orelse |
| 108 | 108 | if (options.parent) |p| p.optimize_mode else options.global.root_optimize_mode; |
| ... | ... | @@ -363,7 +363,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { |
| 363 | 363 | .root_src_path = options.paths.root_src_path, |
| 364 | 364 | .fully_qualified_name = options.fully_qualified_name, |
| 365 | 365 | .resolved_target = .{ |
| 366 | .result = target, | |
| 366 | .result = target.*, | |
| 367 | 367 | .is_native_os = resolved_target.is_native_os, |
| 368 | 368 | .is_native_abi = resolved_target.is_native_abi, |
| 369 | 369 | .is_explicit_dynamic_linker = resolved_target.is_explicit_dynamic_linker, |
| ... | ... | @@ -474,7 +474,7 @@ pub fn getBuiltinOptions(m: Module, global: Compilation.Config) Builtin { |
| 474 | 474 | assert(global.have_zcu); |
| 475 | 475 | return .{ |
| 476 | 476 | .target = m.resolved_target.result, |
| 477 | .zig_backend = target_util.zigBackend(m.resolved_target.result, global.use_llvm), | |
| 477 | .zig_backend = target_util.zigBackend(&m.resolved_target.result, global.use_llvm), | |
| 478 | 478 | .output_mode = global.output_mode, |
| 479 | 479 | .link_mode = global.link_mode, |
| 480 | 480 | .unwind_tables = m.unwind_tables, |
src/Sema.zig+4-4| ... | ... | @@ -29912,7 +29912,7 @@ pub fn coerceInMemoryAllowed( |
| 29912 | 29912 | /// load from the `*Src` to effectively perform an in-memory coercion from `Dest` to `Src`. |
| 29913 | 29913 | /// Therefore, when `dest_is_mut`, the in-memory coercion must be valid in *both directions*. |
| 29914 | 29914 | dest_is_mut: bool, |
| 29915 | target: std.Target, | |
| 29915 | target: *const std.Target, | |
| 29916 | 29916 | dest_src: LazySrcLoc, |
| 29917 | 29917 | src_src: LazySrcLoc, |
| 29918 | 29918 | src_val: ?Value, |
| ... | ... | @@ -30271,7 +30271,7 @@ fn coerceInMemoryAllowedFns( |
| 30271 | 30271 | src_ty: Type, |
| 30272 | 30272 | /// If set, the coercion must be valid in both directions. |
| 30273 | 30273 | dest_is_mut: bool, |
| 30274 | target: std.Target, | |
| 30274 | target: *const std.Target, | |
| 30275 | 30275 | dest_src: LazySrcLoc, |
| 30276 | 30276 | src_src: LazySrcLoc, |
| 30277 | 30277 | ) !InMemoryCoercionResult { |
| ... | ... | @@ -30380,7 +30380,7 @@ fn coerceInMemoryAllowedFns( |
| 30380 | 30380 | } |
| 30381 | 30381 | |
| 30382 | 30382 | fn callconvCoerceAllowed( |
| 30383 | target: std.Target, | |
| 30383 | target: *const std.Target, | |
| 30384 | 30384 | src_cc: std.builtin.CallingConvention, |
| 30385 | 30385 | dest_cc: std.builtin.CallingConvention, |
| 30386 | 30386 | ) bool { |
| ... | ... | @@ -30426,7 +30426,7 @@ fn coerceInMemoryAllowedPtrs( |
| 30426 | 30426 | src_ptr_ty: Type, |
| 30427 | 30427 | /// If set, the coercion must be valid in both directions. |
| 30428 | 30428 | dest_is_mut: bool, |
| 30429 | target: std.Target, | |
| 30429 | target: *const std.Target, | |
| 30430 | 30430 | dest_src: LazySrcLoc, |
| 30431 | 30431 | src_src: LazySrcLoc, |
| 30432 | 30432 | ) !InMemoryCoercionResult { |
src/Type.zig+3-3| ... | ... | @@ -1602,7 +1602,7 @@ fn abiSizeInnerOptional( |
| 1602 | 1602 | }; |
| 1603 | 1603 | } |
| 1604 | 1604 | |
| 1605 | pub fn ptrAbiAlignment(target: Target) Alignment { | |
| 1605 | pub fn ptrAbiAlignment(target: *const Target) Alignment { | |
| 1606 | 1606 | return Alignment.fromNonzeroByteUnits(@divExact(target.ptrBitWidth(), 8)); |
| 1607 | 1607 | } |
| 1608 | 1608 | |
| ... | ... | @@ -2395,7 +2395,7 @@ pub fn isAnyFloat(ty: Type) bool { |
| 2395 | 2395 | |
| 2396 | 2396 | /// Asserts the type is a fixed-size float or comptime_float. |
| 2397 | 2397 | /// Returns 128 for comptime_float types. |
| 2398 | pub fn floatBits(ty: Type, target: Target) u16 { | |
| 2398 | pub fn floatBits(ty: Type, target: *const Target) u16 { | |
| 2399 | 2399 | return switch (ty.toIntern()) { |
| 2400 | 2400 | .f16_type => 16, |
| 2401 | 2401 | .f32_type => 32, |
| ... | ... | @@ -4188,6 +4188,6 @@ pub fn smallestUnsignedBits(max: u64) u16 { |
| 4188 | 4188 | /// to packed struct layout to find out all the places in the codebase you need to edit! |
| 4189 | 4189 | pub const packed_struct_layout_version = 2; |
| 4190 | 4190 | |
| 4191 | fn cTypeAlign(target: Target, c_type: Target.CType) Alignment { | |
| 4191 | fn cTypeAlign(target: *const Target, c_type: Target.CType) Alignment { | |
| 4192 | 4192 | return Alignment.fromByteUnits(target.cTypeAlignment(c_type)); |
| 4193 | 4193 | } |
src/Zcu.zig+3-3| ... | ... | @@ -3773,8 +3773,8 @@ pub fn errNote( |
| 3773 | 3773 | /// Deprecated. There is no global target for a Zig Compilation Unit. Instead, |
| 3774 | 3774 | /// look up the target based on the Module that contains the source code being |
| 3775 | 3775 | /// analyzed. |
| 3776 | pub fn getTarget(zcu: *const Zcu) Target { | |
| 3777 | return zcu.root_mod.resolved_target.result; | |
| 3776 | pub fn getTarget(zcu: *const Zcu) *const Target { | |
| 3777 | return &zcu.root_mod.resolved_target.result; | |
| 3778 | 3778 | } |
| 3779 | 3779 | |
| 3780 | 3780 | /// Deprecated. There is no global optimization mode for a Zig Compilation |
| ... | ... | @@ -3863,7 +3863,7 @@ pub const Feature = enum { |
| 3863 | 3863 | }; |
| 3864 | 3864 | |
| 3865 | 3865 | pub fn backendSupportsFeature(zcu: *const Zcu, comptime feature: Feature) bool { |
| 3866 | const backend = target_util.zigBackend(zcu.root_mod.resolved_target.result, zcu.comp.config.use_llvm); | |
| 3866 | const backend = target_util.zigBackend(&zcu.root_mod.resolved_target.result, zcu.comp.config.use_llvm); | |
| 3867 | 3867 | return target_util.backendSupportsFeature(backend, feature); |
| 3868 | 3868 | } |
| 3869 | 3869 |
src/Zcu/PerThread.zig+1-1| ... | ... | @@ -4382,7 +4382,7 @@ pub fn runCodegen(pt: Zcu.PerThread, func_index: InternPool.Index, air: *Air, ou |
| 4382 | 4382 | error.CodegenFail => zcu.assertCodegenFailed(zcu.funcInfo(func_index).owner_nav), |
| 4383 | 4383 | error.NoLinkFile => assert(zcu.comp.bin_file == null), |
| 4384 | 4384 | error.BackendDoesNotProduceMir => switch (target_util.zigBackend( |
| 4385 | zcu.root_mod.resolved_target.result, | |
| 4385 | &zcu.root_mod.resolved_target.result, | |
| 4386 | 4386 | zcu.comp.config.use_llvm, |
| 4387 | 4387 | )) { |
| 4388 | 4388 | else => unreachable, // assertion failure |
src/arch/aarch64/CodeGen.zig+2-2| ... | ... | @@ -6175,7 +6175,7 @@ fn genTypedValue(self: *Self, val: Value) InnerError!MCValue { |
| 6175 | 6175 | self.pt, |
| 6176 | 6176 | self.src_loc, |
| 6177 | 6177 | val, |
| 6178 | self.target.*, | |
| 6178 | self.target, | |
| 6179 | 6179 | )) { |
| 6180 | 6180 | .mcv => |mcv| switch (mcv) { |
| 6181 | 6181 | .none => .none, |
| ... | ... | @@ -6379,7 +6379,7 @@ fn registerAlias(self: *Self, reg: Register, ty: Type) Register { |
| 6379 | 6379 | }, |
| 6380 | 6380 | .stack_pointer => unreachable, // we can't store/load the sp |
| 6381 | 6381 | .floating_point => { |
| 6382 | return switch (ty.floatBits(self.target.*)) { | |
| 6382 | return switch (ty.floatBits(self.target)) { | |
| 6383 | 6383 | 16 => reg.toH(), |
| 6384 | 6384 | 32 => reg.toS(), |
| 6385 | 6385 | 64 => reg.toD(), |
src/arch/arm/CodeGen.zig+1-1| ... | ... | @@ -6148,7 +6148,7 @@ fn genTypedValue(self: *Self, val: Value) InnerError!MCValue { |
| 6148 | 6148 | pt, |
| 6149 | 6149 | self.src_loc, |
| 6150 | 6150 | val, |
| 6151 | self.target.*, | |
| 6151 | self.target, | |
| 6152 | 6152 | )) { |
| 6153 | 6153 | .mcv => |mcv| switch (mcv) { |
| 6154 | 6154 | .none => .none, |
src/arch/riscv64/CodeGen.zig+5-5| ... | ... | @@ -1881,7 +1881,7 @@ fn memSize(func: *Func, ty: Type) Memory.Size { |
| 1881 | 1881 | const pt = func.pt; |
| 1882 | 1882 | const zcu = pt.zcu; |
| 1883 | 1883 | return switch (ty.zigTypeTag(zcu)) { |
| 1884 | .float => Memory.Size.fromBitSize(ty.floatBits(func.target.*)), | |
| 1884 | .float => Memory.Size.fromBitSize(ty.floatBits(func.target)), | |
| 1885 | 1885 | else => Memory.Size.fromByteSize(ty.abiSize(zcu)), |
| 1886 | 1886 | }; |
| 1887 | 1887 | } |
| ... | ... | @@ -2401,7 +2401,7 @@ fn binOp( |
| 2401 | 2401 | const rhs_ty = func.typeOf(rhs_air); |
| 2402 | 2402 | |
| 2403 | 2403 | if (lhs_ty.isRuntimeFloat()) libcall: { |
| 2404 | const float_bits = lhs_ty.floatBits(func.target.*); | |
| 2404 | const float_bits = lhs_ty.floatBits(func.target); | |
| 2405 | 2405 | const type_needs_libcall = switch (float_bits) { |
| 2406 | 2406 | 16 => true, |
| 2407 | 2407 | 32, 64 => false, |
| ... | ... | @@ -5189,7 +5189,7 @@ fn airCmp(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 5189 | 5189 | } |
| 5190 | 5190 | }, |
| 5191 | 5191 | .float => { |
| 5192 | const float_bits = lhs_ty.floatBits(func.target.*); | |
| 5192 | const float_bits = lhs_ty.floatBits(func.target); | |
| 5193 | 5193 | const float_reg_size: u32 = if (func.hasFeature(.d)) 64 else 32; |
| 5194 | 5194 | if (float_bits > float_reg_size) { |
| 5195 | 5195 | return func.fail("TODO: airCmp float > 64/32 bits", .{}); |
| ... | ... | @@ -8195,7 +8195,7 @@ fn genTypedValue(func: *Func, val: Value) InnerError!MCValue { |
| 8195 | 8195 | const result = if (val.isUndef(pt.zcu)) |
| 8196 | 8196 | try lf.lowerUav(pt, val.toIntern(), .none, src_loc) |
| 8197 | 8197 | else |
| 8198 | try codegen.genTypedValue(lf, pt, src_loc, val, func.target.*); | |
| 8198 | try codegen.genTypedValue(lf, pt, src_loc, val, func.target); | |
| 8199 | 8199 | const mcv: MCValue = switch (result) { |
| 8200 | 8200 | .mcv => |mcv| switch (mcv) { |
| 8201 | 8201 | .none => .none, |
| ... | ... | @@ -8484,7 +8484,7 @@ fn promoteInt(func: *Func, ty: Type) Type { |
| 8484 | 8484 | |
| 8485 | 8485 | fn promoteVarArg(func: *Func, ty: Type) Type { |
| 8486 | 8486 | if (!ty.isRuntimeFloat()) return func.promoteInt(ty); |
| 8487 | switch (ty.floatBits(func.target.*)) { | |
| 8487 | switch (ty.floatBits(func.target)) { | |
| 8488 | 8488 | 32, 64 => return Type.f64, |
| 8489 | 8489 | else => |float_bits| { |
| 8490 | 8490 | assert(float_bits == func.target.cTypeBitSize(.longdouble)); |
src/arch/sparc64/CodeGen.zig+1-1| ... | ... | @@ -4088,7 +4088,7 @@ fn genTypedValue(self: *Self, val: Value) InnerError!MCValue { |
| 4088 | 4088 | pt, |
| 4089 | 4089 | self.src_loc, |
| 4090 | 4090 | val, |
| 4091 | self.target.*, | |
| 4091 | self.target, | |
| 4092 | 4092 | )) { |
| 4093 | 4093 | .mcv => |mcv| switch (mcv) { |
| 4094 | 4094 | .none => .none, |
src/arch/wasm/CodeGen.zig+15-15| ... | ... | @@ -982,7 +982,7 @@ fn addExtraAssumeCapacity(cg: *CodeGen, extra: anytype) error{OutOfMemory}!u32 { |
| 982 | 982 | pub fn typeToValtype(ty: Type, zcu: *const Zcu, target: *const std.Target) std.wasm.Valtype { |
| 983 | 983 | const ip = &zcu.intern_pool; |
| 984 | 984 | return switch (ty.zigTypeTag(zcu)) { |
| 985 | .float => switch (ty.floatBits(target.*)) { | |
| 985 | .float => switch (ty.floatBits(target)) { | |
| 986 | 986 | 16 => .i32, // stored/loaded as u16 |
| 987 | 987 | 32 => .f32, |
| 988 | 988 | 64 => .f64, |
| ... | ... | @@ -1715,7 +1715,7 @@ fn isByRef(ty: Type, zcu: *const Zcu, target: *const std.Target) bool { |
| 1715 | 1715 | .vector => return determineSimdStoreStrategy(ty, zcu, target) == .unrolled, |
| 1716 | 1716 | .int => return ty.intInfo(zcu).bits > 64, |
| 1717 | 1717 | .@"enum" => return ty.intInfo(zcu).bits > 64, |
| 1718 | .float => return ty.floatBits(target.*) > 64, | |
| 1718 | .float => return ty.floatBits(target) > 64, | |
| 1719 | 1719 | .error_union => { |
| 1720 | 1720 | const pl_ty = ty.errorUnionPayload(zcu); |
| 1721 | 1721 | if (!pl_ty.hasRuntimeBitsIgnoreComptime(zcu)) { |
| ... | ... | @@ -2904,7 +2904,7 @@ fn floatOp(cg: *CodeGen, float_op: FloatOp, ty: Type, args: []const WValue) Inne |
| 2904 | 2904 | return cg.fail("TODO: Implement floatOps for vectors", .{}); |
| 2905 | 2905 | } |
| 2906 | 2906 | |
| 2907 | const float_bits = ty.floatBits(cg.target.*); | |
| 2907 | const float_bits = ty.floatBits(cg.target); | |
| 2908 | 2908 | |
| 2909 | 2909 | if (float_op == .neg) { |
| 2910 | 2910 | return cg.floatNeg(ty, args[0]); |
| ... | ... | @@ -2931,7 +2931,7 @@ fn floatOp(cg: *CodeGen, float_op: FloatOp, ty: Type, args: []const WValue) Inne |
| 2931 | 2931 | |
| 2932 | 2932 | /// NOTE: The result value remains on top of the stack. |
| 2933 | 2933 | fn floatNeg(cg: *CodeGen, ty: Type, arg: WValue) InnerError!WValue { |
| 2934 | const float_bits = ty.floatBits(cg.target.*); | |
| 2934 | const float_bits = ty.floatBits(cg.target); | |
| 2935 | 2935 | switch (float_bits) { |
| 2936 | 2936 | 16 => { |
| 2937 | 2937 | try cg.emitWValue(arg); |
| ... | ... | @@ -3300,7 +3300,7 @@ fn emitUndefined(cg: *CodeGen, ty: Type) InnerError!WValue { |
| 3300 | 3300 | 33...64 => return .{ .imm64 = 0xaaaaaaaaaaaaaaaa }, |
| 3301 | 3301 | else => unreachable, |
| 3302 | 3302 | }, |
| 3303 | .float => switch (ty.floatBits(cg.target.*)) { | |
| 3303 | .float => switch (ty.floatBits(cg.target)) { | |
| 3304 | 3304 | 16 => return .{ .imm32 = 0xaaaaaaaa }, |
| 3305 | 3305 | 32 => return .{ .float32 = @as(f32, @bitCast(@as(u32, 0xaaaaaaaa))) }, |
| 3306 | 3306 | 64 => return .{ .float64 = @as(f64, @bitCast(@as(u64, 0xaaaaaaaaaaaaaaaa))) }, |
| ... | ... | @@ -3507,7 +3507,7 @@ fn cmp(cg: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: std.math.CompareOpe |
| 3507 | 3507 | /// Compares two floats. |
| 3508 | 3508 | /// NOTE: Leaves the result of the comparison on top of the stack. |
| 3509 | 3509 | fn cmpFloat(cg: *CodeGen, ty: Type, lhs: WValue, rhs: WValue, cmp_op: std.math.CompareOperator) InnerError!WValue { |
| 3510 | const float_bits = ty.floatBits(cg.target.*); | |
| 3510 | const float_bits = ty.floatBits(cg.target); | |
| 3511 | 3511 | |
| 3512 | 3512 | const op: Op = switch (cmp_op) { |
| 3513 | 3513 | .lt => .lt, |
| ... | ... | @@ -4919,7 +4919,7 @@ fn airIntFromFloat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4919 | 4919 | |
| 4920 | 4920 | const operand = try cg.resolveInst(ty_op.operand); |
| 4921 | 4921 | const op_ty = cg.typeOf(ty_op.operand); |
| 4922 | const op_bits = op_ty.floatBits(cg.target.*); | |
| 4922 | const op_bits = op_ty.floatBits(cg.target); | |
| 4923 | 4923 | |
| 4924 | 4924 | const dest_ty = cg.typeOfIndex(inst); |
| 4925 | 4925 | const dest_info = dest_ty.intInfo(zcu); |
| ... | ... | @@ -4973,7 +4973,7 @@ fn airFloatFromInt(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4973 | 4973 | const op_info = op_ty.intInfo(zcu); |
| 4974 | 4974 | |
| 4975 | 4975 | const dest_ty = cg.typeOfIndex(inst); |
| 4976 | const dest_bits = dest_ty.floatBits(cg.target.*); | |
| 4976 | const dest_bits = dest_ty.floatBits(cg.target); | |
| 4977 | 4977 | |
| 4978 | 4978 | if (op_info.bits > 128) { |
| 4979 | 4979 | return cg.fail("TODO: floatFromInt for integers/floats with bitsize {d} bits", .{op_info.bits}); |
| ... | ... | @@ -5567,8 +5567,8 @@ fn airFpext(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5567 | 5567 | /// Extends a float from a given `Type` to a larger wanted `Type`, leaving the |
| 5568 | 5568 | /// result on the stack. |
| 5569 | 5569 | fn fpext(cg: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerError!WValue { |
| 5570 | const given_bits = given.floatBits(cg.target.*); | |
| 5571 | const wanted_bits = wanted.floatBits(cg.target.*); | |
| 5570 | const given_bits = given.floatBits(cg.target); | |
| 5571 | const wanted_bits = wanted.floatBits(cg.target); | |
| 5572 | 5572 | |
| 5573 | 5573 | const intrinsic: Mir.Intrinsic = switch (given_bits) { |
| 5574 | 5574 | 16 => switch (wanted_bits) { |
| ... | ... | @@ -5621,8 +5621,8 @@ fn airFptrunc(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5621 | 5621 | /// Truncates a float from a given `Type` to its wanted `Type`, leaving the |
| 5622 | 5622 | /// result on the stack. |
| 5623 | 5623 | fn fptrunc(cg: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerError!WValue { |
| 5624 | const given_bits = given.floatBits(cg.target.*); | |
| 5625 | const wanted_bits = wanted.floatBits(cg.target.*); | |
| 5624 | const given_bits = given.floatBits(cg.target); | |
| 5625 | const wanted_bits = wanted.floatBits(cg.target); | |
| 5626 | 5626 | |
| 5627 | 5627 | const intrinsic: Mir.Intrinsic = switch (given_bits) { |
| 5628 | 5628 | 32 => switch (wanted_bits) { |
| ... | ... | @@ -6231,7 +6231,7 @@ fn airMaxMin( |
| 6231 | 6231 | |
| 6232 | 6232 | if (ty.zigTypeTag(zcu) == .float) { |
| 6233 | 6233 | const intrinsic = switch (op) { |
| 6234 | inline .fmin, .fmax => |ct_op| switch (ty.floatBits(cg.target.*)) { | |
| 6234 | inline .fmin, .fmax => |ct_op| switch (ty.floatBits(cg.target)) { | |
| 6235 | 6235 | inline 16, 32, 64, 80, 128 => |bits| @field( |
| 6236 | 6236 | Mir.Intrinsic, |
| 6237 | 6237 | libcFloatPrefix(bits) ++ @tagName(ct_op) ++ libcFloatSuffix(bits), |
| ... | ... | @@ -6268,7 +6268,7 @@ fn airMulAdd(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6268 | 6268 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 6269 | 6269 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 6270 | 6270 | |
| 6271 | const result = if (ty.floatBits(cg.target.*) == 16) fl_result: { | |
| 6271 | const result = if (ty.floatBits(cg.target) == 16) fl_result: { | |
| 6272 | 6272 | const rhs_ext = try cg.fpext(rhs, ty, Type.f32); |
| 6273 | 6273 | const lhs_ext = try cg.fpext(lhs, ty, Type.f32); |
| 6274 | 6274 | const addend_ext = try cg.fpext(addend, ty, Type.f32); |
| ... | ... | @@ -6667,7 +6667,7 @@ fn airDivFloor(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6667 | 6667 | _ = try cg.wrapOperand(.stack, ty); |
| 6668 | 6668 | } |
| 6669 | 6669 | } else { |
| 6670 | const float_bits = ty.floatBits(cg.target.*); | |
| 6670 | const float_bits = ty.floatBits(cg.target); | |
| 6671 | 6671 | if (float_bits > 64) { |
| 6672 | 6672 | return cg.fail("TODO: `@divFloor` for floats with bitsize: {d}", .{float_bits}); |
| 6673 | 6673 | } |
src/arch/x86_64/CodeGen.zig+51-51| ... | ... | @@ -163704,7 +163704,7 @@ fn allocRegOrMemAdvanced(self: *CodeGen, ty: Type, inst: ?Air.Inst.Index, reg_ok |
| 163704 | 163704 | |
| 163705 | 163705 | if (reg_ok) need_mem: { |
| 163706 | 163706 | if (std.math.isPowerOfTwo(abi_size) and abi_size <= @as(u32, max_abi_size: switch (ty.zigTypeTag(zcu)) { |
| 163707 | .float => switch (ty.floatBits(self.target.*)) { | |
| 163707 | .float => switch (ty.floatBits(self.target)) { | |
| 163708 | 163708 | 16, 32, 64, 128 => 16, |
| 163709 | 163709 | 80 => break :need_mem, |
| 163710 | 163710 | else => unreachable, |
| ... | ... | @@ -163993,9 +163993,9 @@ fn airRetPtr(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 163993 | 163993 | fn airFptrunc(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 163994 | 163994 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 163995 | 163995 | const dst_ty = self.typeOfIndex(inst); |
| 163996 | const dst_bits = dst_ty.floatBits(self.target.*); | |
| 163996 | const dst_bits = dst_ty.floatBits(self.target); | |
| 163997 | 163997 | const src_ty = self.typeOf(ty_op.operand); |
| 163998 | const src_bits = src_ty.floatBits(self.target.*); | |
| 163998 | const src_bits = src_ty.floatBits(self.target); | |
| 163999 | 163999 | |
| 164000 | 164000 | const result = result: { |
| 164001 | 164001 | if (switch (dst_bits) { |
| ... | ... | @@ -164095,10 +164095,10 @@ fn airFpext(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 164095 | 164095 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 164096 | 164096 | const dst_ty = self.typeOfIndex(inst); |
| 164097 | 164097 | const dst_scalar_ty = dst_ty.scalarType(zcu); |
| 164098 | const dst_bits = dst_scalar_ty.floatBits(self.target.*); | |
| 164098 | const dst_bits = dst_scalar_ty.floatBits(self.target); | |
| 164099 | 164099 | const src_ty = self.typeOf(ty_op.operand); |
| 164100 | 164100 | const src_scalar_ty = src_ty.scalarType(zcu); |
| 164101 | const src_bits = src_scalar_ty.floatBits(self.target.*); | |
| 164101 | const src_bits = src_scalar_ty.floatBits(self.target); | |
| 164102 | 164102 | |
| 164103 | 164103 | const result = result: { |
| 164104 | 164104 | if (switch (src_bits) { |
| ... | ... | @@ -168207,7 +168207,7 @@ fn floatSign(self: *CodeGen, inst: Air.Inst.Index, tag: Air.Inst.Tag, operand: A |
| 168207 | 168207 | const zcu = pt.zcu; |
| 168208 | 168208 | |
| 168209 | 168209 | const result = result: { |
| 168210 | const scalar_bits = ty.scalarType(zcu).floatBits(self.target.*); | |
| 168210 | const scalar_bits = ty.scalarType(zcu).floatBits(self.target); | |
| 168211 | 168211 | if (scalar_bits == 80) { |
| 168212 | 168212 | if (ty.zigTypeTag(zcu) != .float) return self.fail("TODO implement floatSign for {}", .{ |
| 168213 | 168213 | ty.fmt(pt), |
| ... | ... | @@ -168363,14 +168363,14 @@ fn getRoundTag(self: *CodeGen, ty: Type) ?Mir.Inst.FixedTag { |
| 168363 | 168363 | const pt = self.pt; |
| 168364 | 168364 | const zcu = pt.zcu; |
| 168365 | 168365 | return if (self.hasFeature(.sse4_1)) switch (ty.zigTypeTag(zcu)) { |
| 168366 | .float => switch (ty.floatBits(self.target.*)) { | |
| 168366 | .float => switch (ty.floatBits(self.target)) { | |
| 168367 | 168367 | 32 => if (self.hasFeature(.avx)) .{ .v_ss, .round } else .{ ._ss, .round }, |
| 168368 | 168368 | 64 => if (self.hasFeature(.avx)) .{ .v_sd, .round } else .{ ._sd, .round }, |
| 168369 | 168369 | 16, 80, 128 => null, |
| 168370 | 168370 | else => unreachable, |
| 168371 | 168371 | }, |
| 168372 | 168372 | .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) { |
| 168373 | .float => switch (ty.childType(zcu).floatBits(self.target.*)) { | |
| 168373 | .float => switch (ty.childType(zcu).floatBits(self.target)) { | |
| 168374 | 168374 | 32 => switch (ty.vectorLen(zcu)) { |
| 168375 | 168375 | 1 => if (self.hasFeature(.avx)) .{ .v_ss, .round } else .{ ._ss, .round }, |
| 168376 | 168376 | 2...4 => if (self.hasFeature(.avx)) .{ .v_ps, .round } else .{ ._ps, .round }, |
| ... | ... | @@ -168670,7 +168670,7 @@ fn airSqrt(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 168670 | 168670 | const result: MCValue = result: { |
| 168671 | 168671 | switch (ty.zigTypeTag(zcu)) { |
| 168672 | 168672 | .float => { |
| 168673 | const float_bits = ty.floatBits(self.target.*); | |
| 168673 | const float_bits = ty.floatBits(self.target); | |
| 168674 | 168674 | if (switch (float_bits) { |
| 168675 | 168675 | 16 => !self.hasFeature(.f16c), |
| 168676 | 168676 | 32, 64 => false, |
| ... | ... | @@ -168701,7 +168701,7 @@ fn airSqrt(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 168701 | 168701 | defer if (dst_lock) |lock| self.register_manager.unlockReg(lock); |
| 168702 | 168702 | |
| 168703 | 168703 | const mir_tag = @as(?Mir.Inst.FixedTag, switch (ty.zigTypeTag(zcu)) { |
| 168704 | .float => switch (ty.floatBits(self.target.*)) { | |
| 168704 | .float => switch (ty.floatBits(self.target)) { | |
| 168705 | 168705 | 16 => { |
| 168706 | 168706 | assert(self.hasFeature(.f16c)); |
| 168707 | 168707 | const mat_src_reg = if (src_mcv.isRegister()) |
| ... | ... | @@ -168723,7 +168723,7 @@ fn airSqrt(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 168723 | 168723 | else => unreachable, |
| 168724 | 168724 | }, |
| 168725 | 168725 | .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) { |
| 168726 | .float => switch (ty.childType(zcu).floatBits(self.target.*)) { | |
| 168726 | .float => switch (ty.childType(zcu).floatBits(self.target)) { | |
| 168727 | 168727 | 16 => if (self.hasFeature(.f16c)) switch (ty.vectorLen(zcu)) { |
| 168728 | 168728 | 1 => { |
| 168729 | 168729 | try self.asmRegisterRegister( |
| ... | ... | @@ -170904,7 +170904,7 @@ fn genBinOp( |
| 170904 | 170904 | const abi_size: u32 = @intCast(lhs_ty.abiSize(zcu)); |
| 170905 | 170905 | |
| 170906 | 170906 | if (lhs_ty.isRuntimeFloat()) libcall: { |
| 170907 | const float_bits = lhs_ty.floatBits(self.target.*); | |
| 170907 | const float_bits = lhs_ty.floatBits(self.target); | |
| 170908 | 170908 | const type_needs_libcall = switch (float_bits) { |
| 170909 | 170909 | 16 => !self.hasFeature(.f16c), |
| 170910 | 170910 | 32, 64 => false, |
| ... | ... | @@ -171083,7 +171083,7 @@ fn genBinOp( |
| 171083 | 171083 | }, |
| 171084 | 171084 | }; |
| 171085 | 171085 | if (sse_op and ((lhs_ty.scalarType(zcu).isRuntimeFloat() and |
| 171086 | lhs_ty.scalarType(zcu).floatBits(self.target.*) == 80) or | |
| 171086 | lhs_ty.scalarType(zcu).floatBits(self.target) == 80) or | |
| 171087 | 171087 | lhs_ty.abiSize(zcu) > self.vectorSize(.float))) |
| 171088 | 171088 | return self.fail("TODO implement genBinOp for {s} {}", .{ @tagName(air_tag), lhs_ty.fmt(pt) }); |
| 171089 | 171089 | |
| ... | ... | @@ -171474,7 +171474,7 @@ fn genBinOp( |
| 171474 | 171474 | const dst_reg = registerAlias(dst_mcv.getReg().?, abi_size); |
| 171475 | 171475 | const mir_tag = @as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) { |
| 171476 | 171476 | else => unreachable, |
| 171477 | .float => switch (lhs_ty.floatBits(self.target.*)) { | |
| 171477 | .float => switch (lhs_ty.floatBits(self.target)) { | |
| 171478 | 171478 | 16 => { |
| 171479 | 171479 | assert(self.hasFeature(.f16c)); |
| 171480 | 171480 | const lhs_reg = if (copied_to_dst) dst_reg else registerAlias(lhs_mcv.getReg().?, abi_size); |
| ... | ... | @@ -171917,7 +171917,7 @@ fn genBinOp( |
| 171917 | 171917 | }, |
| 171918 | 171918 | else => null, |
| 171919 | 171919 | }, |
| 171920 | .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) { | |
| 171920 | .float => switch (lhs_ty.childType(zcu).floatBits(self.target)) { | |
| 171921 | 171921 | 16 => tag: { |
| 171922 | 171922 | assert(self.hasFeature(.f16c)); |
| 171923 | 171923 | const lhs_reg = if (copied_to_dst) dst_reg else registerAlias(lhs_mcv.getReg().?, abi_size); |
| ... | ... | @@ -172336,14 +172336,14 @@ fn genBinOp( |
| 172336 | 172336 | |
| 172337 | 172337 | try self.asmRegisterRegisterRegisterImmediate( |
| 172338 | 172338 | @as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) { |
| 172339 | .float => switch (lhs_ty.floatBits(self.target.*)) { | |
| 172339 | .float => switch (lhs_ty.floatBits(self.target)) { | |
| 172340 | 172340 | 32 => .{ .v_ss, .cmp }, |
| 172341 | 172341 | 64 => .{ .v_sd, .cmp }, |
| 172342 | 172342 | 16, 80, 128 => null, |
| 172343 | 172343 | else => unreachable, |
| 172344 | 172344 | }, |
| 172345 | 172345 | .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) { |
| 172346 | .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) { | |
| 172346 | .float => switch (lhs_ty.childType(zcu).floatBits(self.target)) { | |
| 172347 | 172347 | 32 => switch (lhs_ty.vectorLen(zcu)) { |
| 172348 | 172348 | 1 => .{ .v_ss, .cmp }, |
| 172349 | 172349 | 2...8 => .{ .v_ps, .cmp }, |
| ... | ... | @@ -172370,14 +172370,14 @@ fn genBinOp( |
| 172370 | 172370 | ); |
| 172371 | 172371 | try self.asmRegisterRegisterRegisterRegister( |
| 172372 | 172372 | @as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) { |
| 172373 | .float => switch (lhs_ty.floatBits(self.target.*)) { | |
| 172373 | .float => switch (lhs_ty.floatBits(self.target)) { | |
| 172374 | 172374 | 32 => .{ .v_ps, .blendv }, |
| 172375 | 172375 | 64 => .{ .v_pd, .blendv }, |
| 172376 | 172376 | 16, 80, 128 => null, |
| 172377 | 172377 | else => unreachable, |
| 172378 | 172378 | }, |
| 172379 | 172379 | .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) { |
| 172380 | .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) { | |
| 172380 | .float => switch (lhs_ty.childType(zcu).floatBits(self.target)) { | |
| 172381 | 172381 | 32 => switch (lhs_ty.vectorLen(zcu)) { |
| 172382 | 172382 | 1...8 => .{ .v_ps, .blendv }, |
| 172383 | 172383 | else => null, |
| ... | ... | @@ -172404,14 +172404,14 @@ fn genBinOp( |
| 172404 | 172404 | const has_blend = self.hasFeature(.sse4_1); |
| 172405 | 172405 | try self.asmRegisterRegisterImmediate( |
| 172406 | 172406 | @as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) { |
| 172407 | .float => switch (lhs_ty.floatBits(self.target.*)) { | |
| 172407 | .float => switch (lhs_ty.floatBits(self.target)) { | |
| 172408 | 172408 | 32 => .{ ._ss, .cmp }, |
| 172409 | 172409 | 64 => .{ ._sd, .cmp }, |
| 172410 | 172410 | 16, 80, 128 => null, |
| 172411 | 172411 | else => unreachable, |
| 172412 | 172412 | }, |
| 172413 | 172413 | .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) { |
| 172414 | .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) { | |
| 172414 | .float => switch (lhs_ty.childType(zcu).floatBits(self.target)) { | |
| 172415 | 172415 | 32 => switch (lhs_ty.vectorLen(zcu)) { |
| 172416 | 172416 | 1 => .{ ._ss, .cmp }, |
| 172417 | 172417 | 2...4 => .{ ._ps, .cmp }, |
| ... | ... | @@ -172437,14 +172437,14 @@ fn genBinOp( |
| 172437 | 172437 | ); |
| 172438 | 172438 | if (has_blend) try self.asmRegisterRegisterRegister( |
| 172439 | 172439 | @as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) { |
| 172440 | .float => switch (lhs_ty.floatBits(self.target.*)) { | |
| 172440 | .float => switch (lhs_ty.floatBits(self.target)) { | |
| 172441 | 172441 | 32 => .{ ._ps, .blendv }, |
| 172442 | 172442 | 64 => .{ ._pd, .blendv }, |
| 172443 | 172443 | 16, 80, 128 => null, |
| 172444 | 172444 | else => unreachable, |
| 172445 | 172445 | }, |
| 172446 | 172446 | .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) { |
| 172447 | .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) { | |
| 172447 | .float => switch (lhs_ty.childType(zcu).floatBits(self.target)) { | |
| 172448 | 172448 | 32 => switch (lhs_ty.vectorLen(zcu)) { |
| 172449 | 172449 | 1...4 => .{ ._ps, .blendv }, |
| 172450 | 172450 | else => null, |
| ... | ... | @@ -172467,14 +172467,14 @@ fn genBinOp( |
| 172467 | 172467 | mask_reg, |
| 172468 | 172468 | ) else { |
| 172469 | 172469 | const mir_fixes = @as(?Mir.Inst.Fixes, switch (lhs_ty.zigTypeTag(zcu)) { |
| 172470 | .float => switch (lhs_ty.floatBits(self.target.*)) { | |
| 172470 | .float => switch (lhs_ty.floatBits(self.target)) { | |
| 172471 | 172471 | 32 => ._ps, |
| 172472 | 172472 | 64 => ._pd, |
| 172473 | 172473 | 16, 80, 128 => null, |
| 172474 | 172474 | else => unreachable, |
| 172475 | 172475 | }, |
| 172476 | 172476 | .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) { |
| 172477 | .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) { | |
| 172477 | .float => switch (lhs_ty.childType(zcu).floatBits(self.target)) { | |
| 172478 | 172478 | 32 => switch (lhs_ty.vectorLen(zcu)) { |
| 172479 | 172479 | 1...4 => ._ps, |
| 172480 | 172480 | else => null, |
| ... | ... | @@ -173832,7 +173832,7 @@ fn airCmp(self: *CodeGen, inst: Air.Inst.Index, op: std.math.CompareOperator) !v |
| 173832 | 173832 | |
| 173833 | 173833 | switch (ty.zigTypeTag(zcu)) { |
| 173834 | 173834 | .float => { |
| 173835 | const float_bits = ty.floatBits(self.target.*); | |
| 173835 | const float_bits = ty.floatBits(self.target); | |
| 173836 | 173836 | if (!switch (float_bits) { |
| 173837 | 173837 | 16 => self.hasFeature(.f16c), |
| 173838 | 173838 | 32 => self.hasFeature(.sse), |
| ... | ... | @@ -174188,7 +174188,7 @@ fn airCmp(self: *CodeGen, inst: Air.Inst.Index, op: std.math.CompareOperator) !v |
| 174188 | 174188 | defer if (dst_lock) |lock| self.register_manager.unlockReg(lock); |
| 174189 | 174189 | const src_mcv = if (flipped) lhs_mcv else rhs_mcv; |
| 174190 | 174190 | |
| 174191 | switch (ty.floatBits(self.target.*)) { | |
| 174191 | switch (ty.floatBits(self.target)) { | |
| 174192 | 174192 | 16 => { |
| 174193 | 174193 | assert(self.hasFeature(.f16c)); |
| 174194 | 174194 | const tmp1_reg = |
| ... | ... | @@ -176335,7 +176335,7 @@ fn moveStrategy(cg: *CodeGen, ty: Type, class: Register.Class, aligned: bool) !M |
| 176335 | 176335 | else => {}, |
| 176336 | 176336 | } |
| 176337 | 176337 | }, |
| 176338 | .float => switch (ty.floatBits(cg.target.*)) { | |
| 176338 | .float => switch (ty.floatBits(cg.target)) { | |
| 176339 | 176339 | 16 => return if (cg.hasFeature(.avx)) .{ .vex_insert_extract = .{ |
| 176340 | 176340 | .insert = .{ .vp_w, .insr }, |
| 176341 | 176341 | .extract = .{ .vp_w, .extr }, |
| ... | ... | @@ -176482,7 +176482,7 @@ fn moveStrategy(cg: *CodeGen, ty: Type, class: Register.Class, aligned: bool) !M |
| 176482 | 176482 | } |
| 176483 | 176483 | else |
| 176484 | 176484 | unreachable, |
| 176485 | .float => switch (ty.childType(zcu).floatBits(cg.target.*)) { | |
| 176485 | .float => switch (ty.childType(zcu).floatBits(cg.target)) { | |
| 176486 | 176486 | 16 => switch (ty.vectorLen(zcu)) { |
| 176487 | 176487 | 1...8 => return .{ .load_store = if (cg.hasFeature(.avx)) |
| 176488 | 176488 | .{ if (aligned) .v_dqa else .v_dqu, .mov } |
| ... | ... | @@ -177017,7 +177017,7 @@ fn genSetReg( |
| 177017 | 177017 | 17...32 => if (self.hasFeature(.avx)) .{ .v_dqa, .mov } else null, |
| 177018 | 177018 | else => null, |
| 177019 | 177019 | }, |
| 177020 | .float => switch (ty.scalarType(zcu).floatBits(self.target.*)) { | |
| 177020 | .float => switch (ty.scalarType(zcu).floatBits(self.target)) { | |
| 177021 | 177021 | 16, 128 => switch (abi_size) { |
| 177022 | 177022 | 2...16 => if (self.hasFeature(.avx)) |
| 177023 | 177023 | .{ .v_dqa, .mov } |
| ... | ... | @@ -177776,7 +177776,7 @@ fn airFloatFromInt(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 177776 | 177776 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 177777 | 177777 | |
| 177778 | 177778 | const dst_ty = self.typeOfIndex(inst); |
| 177779 | const dst_bits = dst_ty.floatBits(self.target.*); | |
| 177779 | const dst_bits = dst_ty.floatBits(self.target); | |
| 177780 | 177780 | |
| 177781 | 177781 | const src_ty = self.typeOf(ty_op.operand); |
| 177782 | 177782 | const src_bits: u32 = @intCast(src_ty.bitSize(zcu)); |
| ... | ... | @@ -177828,7 +177828,7 @@ fn airFloatFromInt(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 177828 | 177828 | defer self.register_manager.unlockReg(dst_lock); |
| 177829 | 177829 | |
| 177830 | 177830 | const mir_tag = @as(?Mir.Inst.FixedTag, switch (dst_ty.zigTypeTag(zcu)) { |
| 177831 | .float => switch (dst_ty.floatBits(self.target.*)) { | |
| 177831 | .float => switch (dst_ty.floatBits(self.target)) { | |
| 177832 | 177832 | 32 => if (self.hasFeature(.avx)) .{ .v_ss, .cvtsi2 } else .{ ._ss, .cvtsi2 }, |
| 177833 | 177833 | 64 => if (self.hasFeature(.avx)) .{ .v_sd, .cvtsi2 } else .{ ._sd, .cvtsi2 }, |
| 177834 | 177834 | 16, 80, 128 => null, |
| ... | ... | @@ -177865,7 +177865,7 @@ fn airIntFromFloat(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 177865 | 177865 | }, 32), 8) catch unreachable; |
| 177866 | 177866 | |
| 177867 | 177867 | const src_ty = self.typeOf(ty_op.operand); |
| 177868 | const src_bits = src_ty.floatBits(self.target.*); | |
| 177868 | const src_bits = src_ty.floatBits(self.target); | |
| 177869 | 177869 | |
| 177870 | 177870 | const result = result: { |
| 177871 | 177871 | if (switch (src_bits) { |
| ... | ... | @@ -178136,22 +178136,22 @@ fn atomicOp( |
| 178136 | 178136 | } |
| 178137 | 178137 | if (rmw_op) |op| if (use_sse) { |
| 178138 | 178138 | const mir_tag = @as(?Mir.Inst.FixedTag, switch (op) { |
| 178139 | .Add => switch (val_ty.floatBits(self.target.*)) { | |
| 178139 | .Add => switch (val_ty.floatBits(self.target)) { | |
| 178140 | 178140 | 32 => if (self.hasFeature(.avx)) .{ .v_ss, .add } else .{ ._ss, .add }, |
| 178141 | 178141 | 64 => if (self.hasFeature(.avx)) .{ .v_sd, .add } else .{ ._sd, .add }, |
| 178142 | 178142 | else => null, |
| 178143 | 178143 | }, |
| 178144 | .Sub => switch (val_ty.floatBits(self.target.*)) { | |
| 178144 | .Sub => switch (val_ty.floatBits(self.target)) { | |
| 178145 | 178145 | 32 => if (self.hasFeature(.avx)) .{ .v_ss, .sub } else .{ ._ss, .sub }, |
| 178146 | 178146 | 64 => if (self.hasFeature(.avx)) .{ .v_sd, .sub } else .{ ._sd, .sub }, |
| 178147 | 178147 | else => null, |
| 178148 | 178148 | }, |
| 178149 | .Min => switch (val_ty.floatBits(self.target.*)) { | |
| 178149 | .Min => switch (val_ty.floatBits(self.target)) { | |
| 178150 | 178150 | 32 => if (self.hasFeature(.avx)) .{ .v_ss, .min } else .{ ._ss, .min }, |
| 178151 | 178151 | 64 => if (self.hasFeature(.avx)) .{ .v_sd, .min } else .{ ._sd, .min }, |
| 178152 | 178152 | else => null, |
| 178153 | 178153 | }, |
| 178154 | .Max => switch (val_ty.floatBits(self.target.*)) { | |
| 178154 | .Max => switch (val_ty.floatBits(self.target)) { | |
| 178155 | 178155 | 32 => if (self.hasFeature(.avx)) .{ .v_ss, .max } else .{ ._ss, .max }, |
| 178156 | 178156 | 64 => if (self.hasFeature(.avx)) .{ .v_sd, .max } else .{ ._sd, .max }, |
| 178157 | 178157 | else => null, |
| ... | ... | @@ -178988,7 +178988,7 @@ fn airSplat(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 178988 | 178988 | ); |
| 178989 | 178989 | break :result .{ .register = dst_reg }; |
| 178990 | 178990 | }, |
| 178991 | .float => switch (scalar_ty.floatBits(self.target.*)) { | |
| 178991 | .float => switch (scalar_ty.floatBits(self.target)) { | |
| 178992 | 178992 | 32 => switch (vector_len) { |
| 178993 | 178993 | 1 => { |
| 178994 | 178994 | const src_mcv = try self.resolveInst(ty_op.operand); |
| ... | ... | @@ -179581,7 +179581,7 @@ fn airSelect(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 179581 | 179581 | null, |
| 179582 | 179582 | else => null, |
| 179583 | 179583 | }, |
| 179584 | .float => switch (elem_ty.floatBits(self.target.*)) { | |
| 179584 | .float => switch (elem_ty.floatBits(self.target)) { | |
| 179585 | 179585 | else => unreachable, |
| 179586 | 179586 | 16, 80, 128 => null, |
| 179587 | 179587 | 32 => switch (vec_len) { |
| ... | ... | @@ -180308,7 +180308,7 @@ fn airShuffle(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180308 | 180308 | defer self.register_manager.unlockReg(mask_lock); |
| 180309 | 180309 | |
| 180310 | 180310 | const mir_fixes: Mir.Inst.Fixes = if (elem_ty.isRuntimeFloat()) |
| 180311 | switch (elem_ty.floatBits(self.target.*)) { | |
| 180311 | switch (elem_ty.floatBits(self.target)) { | |
| 180312 | 180312 | 16, 80, 128 => .p_, |
| 180313 | 180313 | 32 => ._ps, |
| 180314 | 180314 | 64 => ._pd, |
| ... | ... | @@ -180414,7 +180414,7 @@ fn airShuffle(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180414 | 180414 | .{ switch (elem_ty.zigTypeTag(zcu)) { |
| 180415 | 180415 | else => break :result null, |
| 180416 | 180416 | .int => .vp_, |
| 180417 | .float => switch (elem_ty.floatBits(self.target.*)) { | |
| 180417 | .float => switch (elem_ty.floatBits(self.target)) { | |
| 180418 | 180418 | 32 => .v_ps, |
| 180419 | 180419 | 64 => .v_pd, |
| 180420 | 180420 | 16, 80, 128 => break :result null, |
| ... | ... | @@ -180428,7 +180428,7 @@ fn airShuffle(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180428 | 180428 | .{ switch (elem_ty.zigTypeTag(zcu)) { |
| 180429 | 180429 | else => break :result null, |
| 180430 | 180430 | .int => .p_, |
| 180431 | .float => switch (elem_ty.floatBits(self.target.*)) { | |
| 180431 | .float => switch (elem_ty.floatBits(self.target)) { | |
| 180432 | 180432 | 32 => ._ps, |
| 180433 | 180433 | 64 => ._pd, |
| 180434 | 180434 | 16, 80, 128 => break :result null, |
| ... | ... | @@ -180800,7 +180800,7 @@ fn airMulAdd(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180800 | 180800 | |
| 180801 | 180801 | const ops = [3]Air.Inst.Ref{ extra.lhs, extra.rhs, pl_op.operand }; |
| 180802 | 180802 | const result = result: { |
| 180803 | if (switch (ty.scalarType(zcu).floatBits(self.target.*)) { | |
| 180803 | if (switch (ty.scalarType(zcu).floatBits(self.target)) { | |
| 180804 | 180804 | 16, 80, 128 => true, |
| 180805 | 180805 | 32, 64 => !self.hasFeature(.fma), |
| 180806 | 180806 | else => unreachable, |
| ... | ... | @@ -180855,14 +180855,14 @@ fn airMulAdd(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180855 | 180855 | const mir_tag = @as(?Mir.Inst.FixedTag, if (std.mem.eql(u2, &order, &.{ 1, 3, 2 }) or |
| 180856 | 180856 | std.mem.eql(u2, &order, &.{ 3, 1, 2 })) |
| 180857 | 180857 | switch (ty.zigTypeTag(zcu)) { |
| 180858 | .float => switch (ty.floatBits(self.target.*)) { | |
| 180858 | .float => switch (ty.floatBits(self.target)) { | |
| 180859 | 180859 | 32 => .{ .v_ss, .fmadd132 }, |
| 180860 | 180860 | 64 => .{ .v_sd, .fmadd132 }, |
| 180861 | 180861 | 16, 80, 128 => null, |
| 180862 | 180862 | else => unreachable, |
| 180863 | 180863 | }, |
| 180864 | 180864 | .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) { |
| 180865 | .float => switch (ty.childType(zcu).floatBits(self.target.*)) { | |
| 180865 | .float => switch (ty.childType(zcu).floatBits(self.target)) { | |
| 180866 | 180866 | 32 => switch (ty.vectorLen(zcu)) { |
| 180867 | 180867 | 1 => .{ .v_ss, .fmadd132 }, |
| 180868 | 180868 | 2...8 => .{ .v_ps, .fmadd132 }, |
| ... | ... | @@ -180882,14 +180882,14 @@ fn airMulAdd(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180882 | 180882 | } |
| 180883 | 180883 | else if (std.mem.eql(u2, &order, &.{ 2, 1, 3 }) or std.mem.eql(u2, &order, &.{ 1, 2, 3 })) |
| 180884 | 180884 | switch (ty.zigTypeTag(zcu)) { |
| 180885 | .float => switch (ty.floatBits(self.target.*)) { | |
| 180885 | .float => switch (ty.floatBits(self.target)) { | |
| 180886 | 180886 | 32 => .{ .v_ss, .fmadd213 }, |
| 180887 | 180887 | 64 => .{ .v_sd, .fmadd213 }, |
| 180888 | 180888 | 16, 80, 128 => null, |
| 180889 | 180889 | else => unreachable, |
| 180890 | 180890 | }, |
| 180891 | 180891 | .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) { |
| 180892 | .float => switch (ty.childType(zcu).floatBits(self.target.*)) { | |
| 180892 | .float => switch (ty.childType(zcu).floatBits(self.target)) { | |
| 180893 | 180893 | 32 => switch (ty.vectorLen(zcu)) { |
| 180894 | 180894 | 1 => .{ .v_ss, .fmadd213 }, |
| 180895 | 180895 | 2...8 => .{ .v_ps, .fmadd213 }, |
| ... | ... | @@ -180909,14 +180909,14 @@ fn airMulAdd(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180909 | 180909 | } |
| 180910 | 180910 | else if (std.mem.eql(u2, &order, &.{ 2, 3, 1 }) or std.mem.eql(u2, &order, &.{ 3, 2, 1 })) |
| 180911 | 180911 | switch (ty.zigTypeTag(zcu)) { |
| 180912 | .float => switch (ty.floatBits(self.target.*)) { | |
| 180912 | .float => switch (ty.floatBits(self.target)) { | |
| 180913 | 180913 | 32 => .{ .v_ss, .fmadd231 }, |
| 180914 | 180914 | 64 => .{ .v_sd, .fmadd231 }, |
| 180915 | 180915 | 16, 80, 128 => null, |
| 180916 | 180916 | else => unreachable, |
| 180917 | 180917 | }, |
| 180918 | 180918 | .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) { |
| 180919 | .float => switch (ty.childType(zcu).floatBits(self.target.*)) { | |
| 180919 | .float => switch (ty.childType(zcu).floatBits(self.target)) { | |
| 180920 | 180920 | 32 => switch (ty.vectorLen(zcu)) { |
| 180921 | 180921 | 1 => .{ .v_ss, .fmadd231 }, |
| 180922 | 180922 | 2...8 => .{ .v_ps, .fmadd231 }, |
| ... | ... | @@ -181979,7 +181979,7 @@ fn promoteInt(self: *CodeGen, ty: Type) Type { |
| 181979 | 181979 | |
| 181980 | 181980 | fn promoteVarArg(self: *CodeGen, ty: Type) Type { |
| 181981 | 181981 | if (!ty.isRuntimeFloat()) return self.promoteInt(ty); |
| 181982 | switch (ty.floatBits(self.target.*)) { | |
| 181982 | switch (ty.floatBits(self.target)) { | |
| 181983 | 181983 | 32, 64 => return .f64, |
| 181984 | 181984 | else => |float_bits| { |
| 181985 | 181985 | assert(float_bits == self.target.cTypeBitSize(.longdouble)); |
| ... | ... | @@ -182080,7 +182080,7 @@ fn intInfo(cg: *CodeGen, ty: Type) ?std.builtin.Type.Int { |
| 182080 | 182080 | } |
| 182081 | 182081 | |
| 182082 | 182082 | fn floatBits(cg: *CodeGen, ty: Type) ?u16 { |
| 182083 | return if (ty.isRuntimeFloat()) ty.floatBits(cg.target.*) else null; | |
| 182083 | return if (ty.isRuntimeFloat()) ty.floatBits(cg.target) else null; | |
| 182084 | 182084 | } |
| 182085 | 182085 | |
| 182086 | 182086 | const Temp = struct { |
src/arch/x86_64/Emit.zig+2-2| ... | ... | @@ -105,7 +105,7 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 105 | 105 | emit.pt, |
| 106 | 106 | emit.lower.src_loc, |
| 107 | 107 | nav, |
| 108 | emit.lower.target.*, | |
| 108 | emit.lower.target, | |
| 109 | 109 | )) { |
| 110 | 110 | .mcv => |mcv| mcv.lea_symbol, |
| 111 | 111 | .fail => |em| { |
| ... | ... | @@ -542,7 +542,7 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 542 | 542 | emit.pt, |
| 543 | 543 | emit.lower.src_loc, |
| 544 | 544 | nav, |
| 545 | emit.lower.target.*, | |
| 545 | emit.lower.target, | |
| 546 | 546 | ) catch |err| switch (err) { |
| 547 | 547 | error.CodegenFail, |
| 548 | 548 | => return emit.fail("unable to codegen: {s}", .{@errorName(err)}), |
src/arch/x86_64/abi.zig+1-1| ... | ... | @@ -148,7 +148,7 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: *const std.Target, ctx: Cont |
| 148 | 148 | result[0] = .integer; |
| 149 | 149 | return result; |
| 150 | 150 | }, |
| 151 | .float => switch (ty.floatBits(target.*)) { | |
| 151 | .float => switch (ty.floatBits(target)) { | |
| 152 | 152 | 16 => { |
| 153 | 153 | if (ctx == .field) { |
| 154 | 154 | result[0] = .memory; |
src/codegen.zig+11-11| ... | ... | @@ -65,7 +65,7 @@ fn importBackend(comptime backend: std.builtin.CompilerBackend) type { |
| 65 | 65 | pub fn legalizeFeatures(pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) ?*const Air.Legalize.Features { |
| 66 | 66 | const zcu = pt.zcu; |
| 67 | 67 | const target = &zcu.navFileScope(nav_index).mod.?.resolved_target.result; |
| 68 | switch (target_util.zigBackend(target.*, zcu.comp.config.use_llvm)) { | |
| 68 | switch (target_util.zigBackend(target, zcu.comp.config.use_llvm)) { | |
| 69 | 69 | else => unreachable, |
| 70 | 70 | inline .stage2_llvm, |
| 71 | 71 | .stage2_c, |
| ... | ... | @@ -114,7 +114,7 @@ pub const AnyMir = union { |
| 114 | 114 | |
| 115 | 115 | pub fn deinit(mir: *AnyMir, zcu: *const Zcu) void { |
| 116 | 116 | const gpa = zcu.gpa; |
| 117 | const backend = target_util.zigBackend(zcu.root_mod.resolved_target.result, zcu.comp.config.use_llvm); | |
| 117 | const backend = target_util.zigBackend(&zcu.root_mod.resolved_target.result, zcu.comp.config.use_llvm); | |
| 118 | 118 | switch (backend) { |
| 119 | 119 | else => unreachable, |
| 120 | 120 | inline .stage2_aarch64, |
| ... | ... | @@ -145,7 +145,7 @@ pub fn generateFunction( |
| 145 | 145 | ) CodeGenError!AnyMir { |
| 146 | 146 | const zcu = pt.zcu; |
| 147 | 147 | const func = zcu.funcInfo(func_index); |
| 148 | const target = zcu.navFileScope(func.owner_nav).mod.?.resolved_target.result; | |
| 148 | const target = &zcu.navFileScope(func.owner_nav).mod.?.resolved_target.result; | |
| 149 | 149 | switch (target_util.zigBackend(target, false)) { |
| 150 | 150 | else => unreachable, |
| 151 | 151 | inline .stage2_aarch64, |
| ... | ... | @@ -183,7 +183,7 @@ pub fn emitFunction( |
| 183 | 183 | ) CodeGenError!void { |
| 184 | 184 | const zcu = pt.zcu; |
| 185 | 185 | const func = zcu.funcInfo(func_index); |
| 186 | const target = zcu.navFileScope(func.owner_nav).mod.?.resolved_target.result; | |
| 186 | const target = &zcu.navFileScope(func.owner_nav).mod.?.resolved_target.result; | |
| 187 | 187 | switch (target_util.zigBackend(target, zcu.comp.config.use_llvm)) { |
| 188 | 188 | else => unreachable, |
| 189 | 189 | inline .stage2_aarch64, |
| ... | ... | @@ -210,7 +210,7 @@ pub fn generateLazyFunction( |
| 210 | 210 | ) CodeGenError!void { |
| 211 | 211 | const zcu = pt.zcu; |
| 212 | 212 | const target = if (Type.fromInterned(lazy_sym.ty).typeDeclInstAllowGeneratedTag(zcu)) |inst_index| |
| 213 | zcu.fileByIndex(inst_index.resolveFile(&zcu.intern_pool)).mod.?.resolved_target.result | |
| 213 | &zcu.fileByIndex(inst_index.resolveFile(&zcu.intern_pool)).mod.?.resolved_target.result | |
| 214 | 214 | else |
| 215 | 215 | zcu.getTarget(); |
| 216 | 216 | switch (target_util.zigBackend(target, zcu.comp.config.use_llvm)) { |
| ... | ... | @@ -225,7 +225,7 @@ pub fn generateLazyFunction( |
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | fn writeFloat(comptime F: type, f: F, target: std.Target, endian: std.builtin.Endian, code: []u8) void { | |
| 228 | fn writeFloat(comptime F: type, f: F, target: *const std.Target, endian: std.builtin.Endian, code: []u8) void { | |
| 229 | 229 | _ = target; |
| 230 | 230 | const bits = @typeInfo(F).float.bits; |
| 231 | 231 | const Int = @Type(.{ .int = .{ .signedness = .unsigned, .bits = bits } }); |
| ... | ... | @@ -253,7 +253,7 @@ pub fn generateLazySymbol( |
| 253 | 253 | const gpa = comp.gpa; |
| 254 | 254 | const zcu = pt.zcu; |
| 255 | 255 | const ip = &zcu.intern_pool; |
| 256 | const target = comp.root_mod.resolved_target.result; | |
| 256 | const target = &comp.root_mod.resolved_target.result; | |
| 257 | 257 | const endian = target.cpu.arch.endian(); |
| 258 | 258 | |
| 259 | 259 | log.debug("generateLazySymbol: kind = {s}, ty = {}", .{ |
| ... | ... | @@ -839,7 +839,7 @@ fn lowerNavRef( |
| 839 | 839 | const zcu = pt.zcu; |
| 840 | 840 | const gpa = zcu.gpa; |
| 841 | 841 | const ip = &zcu.intern_pool; |
| 842 | const target = zcu.navFileScope(nav_index).mod.?.resolved_target.result; | |
| 842 | const target = &zcu.navFileScope(nav_index).mod.?.resolved_target.result; | |
| 843 | 843 | const ptr_width_bytes = @divExact(target.ptrBitWidth(), 8); |
| 844 | 844 | const is_obj = lf.comp.config.output_mode == .Obj; |
| 845 | 845 | const nav_ty = Type.fromInterned(ip.getNav(nav_index).typeOf(ip)); |
| ... | ... | @@ -956,7 +956,7 @@ pub fn genNavRef( |
| 956 | 956 | pt: Zcu.PerThread, |
| 957 | 957 | src_loc: Zcu.LazySrcLoc, |
| 958 | 958 | nav_index: InternPool.Nav.Index, |
| 959 | target: std.Target, | |
| 959 | target: *const std.Target, | |
| 960 | 960 | ) CodeGenError!GenResult { |
| 961 | 961 | const zcu = pt.zcu; |
| 962 | 962 | const ip = &zcu.intern_pool; |
| ... | ... | @@ -1040,9 +1040,9 @@ pub fn genTypedValue( |
| 1040 | 1040 | pt: Zcu.PerThread, |
| 1041 | 1041 | src_loc: Zcu.LazySrcLoc, |
| 1042 | 1042 | val: Value, |
| 1043 | target: std.Target, | |
| 1043 | target: *const std.Target, | |
| 1044 | 1044 | ) CodeGenError!GenResult { |
| 1045 | return switch (try lowerValue(pt, val, &target)) { | |
| 1045 | return switch (try lowerValue(pt, val, target)) { | |
| 1046 | 1046 | .none => .{ .mcv = .none }, |
| 1047 | 1047 | .undef => .{ .mcv = .undef }, |
| 1048 | 1048 | .immediate => |imm| .{ .mcv = .{ .immediate = imm } }, |
src/codegen/c.zig+6-6| ... | ... | @@ -1080,7 +1080,7 @@ pub const DeclGen = struct { |
| 1080 | 1080 | }, |
| 1081 | 1081 | .enum_tag => |enum_tag| try dg.renderValue(writer, Value.fromInterned(enum_tag.int), location), |
| 1082 | 1082 | .float => { |
| 1083 | const bits = ty.floatBits(target.*); | |
| 1083 | const bits = ty.floatBits(target); | |
| 1084 | 1084 | const f128_val = val.toFloat(f128, zcu); |
| 1085 | 1085 | |
| 1086 | 1086 | // All unsigned ints matching float types are pre-allocated. |
| ... | ... | @@ -1608,7 +1608,7 @@ pub const DeclGen = struct { |
| 1608 | 1608 | .f80_type, |
| 1609 | 1609 | .f128_type, |
| 1610 | 1610 | => { |
| 1611 | const bits = ty.floatBits(target.*); | |
| 1611 | const bits = ty.floatBits(target); | |
| 1612 | 1612 | // All unsigned ints matching float types are pre-allocated. |
| 1613 | 1613 | const repr_ty = dg.pt.intType(.unsigned, bits) catch unreachable; |
| 1614 | 1614 | |
| ... | ... | @@ -6543,7 +6543,7 @@ fn airFloatCast(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6543 | 6543 | const scalar_ty = operand_ty.scalarType(zcu); |
| 6544 | 6544 | const target = &f.object.dg.mod.resolved_target.result; |
| 6545 | 6545 | const operation = if (inst_scalar_ty.isRuntimeFloat() and scalar_ty.isRuntimeFloat()) |
| 6546 | if (inst_scalar_ty.floatBits(target.*) < scalar_ty.floatBits(target.*)) "trunc" else "extend" | |
| 6546 | if (inst_scalar_ty.floatBits(target) < scalar_ty.floatBits(target)) "trunc" else "extend" | |
| 6547 | 6547 | else if (inst_scalar_ty.isInt(zcu) and scalar_ty.isRuntimeFloat()) |
| 6548 | 6548 | if (inst_scalar_ty.isSignedInt(zcu)) "fix" else "fixuns" |
| 6549 | 6549 | else if (inst_scalar_ty.isRuntimeFloat() and scalar_ty.isInt(zcu)) |
| ... | ... | @@ -6565,8 +6565,8 @@ fn airFloatCast(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6565 | 6565 | } |
| 6566 | 6566 | try writer.writeAll("zig_"); |
| 6567 | 6567 | try writer.writeAll(operation); |
| 6568 | try writer.writeAll(compilerRtAbbrev(scalar_ty, zcu, target.*)); | |
| 6569 | try writer.writeAll(compilerRtAbbrev(inst_scalar_ty, zcu, target.*)); | |
| 6568 | try writer.writeAll(compilerRtAbbrev(scalar_ty, zcu, target)); | |
| 6569 | try writer.writeAll(compilerRtAbbrev(inst_scalar_ty, zcu, target)); | |
| 6570 | 6570 | try writer.writeByte('('); |
| 6571 | 6571 | try f.writeCValue(writer, operand, .FunctionArgument); |
| 6572 | 6572 | try v.elem(f, writer); |
| ... | ... | @@ -8073,7 +8073,7 @@ fn signAbbrev(signedness: std.builtin.Signedness) u8 { |
| 8073 | 8073 | }; |
| 8074 | 8074 | } |
| 8075 | 8075 | |
| 8076 | fn compilerRtAbbrev(ty: Type, zcu: *Zcu, target: std.Target) []const u8 { | |
| 8076 | fn compilerRtAbbrev(ty: Type, zcu: *Zcu, target: *const std.Target) []const u8 { | |
| 8077 | 8077 | return if (ty.isInt(zcu)) switch (ty.intInfo(zcu).bits) { |
| 8078 | 8078 | 1...32 => "si", |
| 8079 | 8079 | 33...64 => "di", |
src/codegen/c/Type.zig+7-7| ... | ... | @@ -1319,9 +1319,9 @@ pub const Pool = struct { |
| 1319 | 1319 | }, |
| 1320 | 1320 | else => { |
| 1321 | 1321 | const target = &mod.resolved_target.result; |
| 1322 | const abi_align_bytes = std.zig.target.intAlignment(target.*, int_info.bits); | |
| 1322 | const abi_align_bytes = std.zig.target.intAlignment(target, int_info.bits); | |
| 1323 | 1323 | const array_ctype = try pool.getArray(allocator, .{ |
| 1324 | .len = @divExact(std.zig.target.intByteSize(target.*, int_info.bits), abi_align_bytes), | |
| 1324 | .len = @divExact(std.zig.target.intByteSize(target, int_info.bits), abi_align_bytes), | |
| 1325 | 1325 | .elem_ctype = try pool.fromIntInfo(allocator, .{ |
| 1326 | 1326 | .signedness = .unsigned, |
| 1327 | 1327 | .bits = @intCast(abi_align_bytes * 8), |
| ... | ... | @@ -1438,13 +1438,13 @@ pub const Pool = struct { |
| 1438 | 1438 | .elem_ctype = .u8, |
| 1439 | 1439 | .@"const" = true, |
| 1440 | 1440 | }), |
| 1441 | .alignas = AlignAs.fromAbiAlignment(Type.ptrAbiAlignment(target.*)), | |
| 1441 | .alignas = AlignAs.fromAbiAlignment(Type.ptrAbiAlignment(target)), | |
| 1442 | 1442 | }, |
| 1443 | 1443 | .{ |
| 1444 | 1444 | .name = .{ .index = .len }, |
| 1445 | 1445 | .ctype = .usize, |
| 1446 | 1446 | .alignas = AlignAs.fromAbiAlignment( |
| 1447 | .fromByteUnits(std.zig.target.intAlignment(target.*, target.ptrBitWidth())), | |
| 1447 | .fromByteUnits(std.zig.target.intAlignment(target, target.ptrBitWidth())), | |
| 1448 | 1448 | ), |
| 1449 | 1449 | }, |
| 1450 | 1450 | }; |
| ... | ... | @@ -2246,13 +2246,13 @@ pub const Pool = struct { |
| 2246 | 2246 | mod, |
| 2247 | 2247 | kind, |
| 2248 | 2248 | ), |
| 2249 | .alignas = AlignAs.fromAbiAlignment(Type.ptrAbiAlignment(target.*)), | |
| 2249 | .alignas = AlignAs.fromAbiAlignment(Type.ptrAbiAlignment(target)), | |
| 2250 | 2250 | }, |
| 2251 | 2251 | .{ |
| 2252 | 2252 | .name = .{ .index = .len }, |
| 2253 | 2253 | .ctype = .usize, |
| 2254 | 2254 | .alignas = AlignAs.fromAbiAlignment( |
| 2255 | .fromByteUnits(std.zig.target.intAlignment(target.*, target.ptrBitWidth())), | |
| 2255 | .fromByteUnits(std.zig.target.intAlignment(target, target.ptrBitWidth())), | |
| 2256 | 2256 | ), |
| 2257 | 2257 | }, |
| 2258 | 2258 | }; |
| ... | ... | @@ -2372,7 +2372,7 @@ pub const Pool = struct { |
| 2372 | 2372 | .name = .{ .index = .@"error" }, |
| 2373 | 2373 | .ctype = error_set_ctype, |
| 2374 | 2374 | .alignas = AlignAs.fromAbiAlignment( |
| 2375 | .fromByteUnits(std.zig.target.intAlignment(target.*, error_set_bits)), | |
| 2375 | .fromByteUnits(std.zig.target.intAlignment(target, error_set_bits)), | |
| 2376 | 2376 | ), |
| 2377 | 2377 | }, |
| 2378 | 2378 | .{ |
src/codegen/llvm.zig+37-39| ... | ... | @@ -43,7 +43,7 @@ pub fn legalizeFeatures(_: *const std.Target) ?*const Air.Legalize.Features { |
| 43 | 43 | }); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | fn subArchName(target: std.Target, comptime family: std.Target.Cpu.Arch.Family, mappings: anytype) ?[]const u8 { | |
| 46 | fn subArchName(target: *const std.Target, comptime family: std.Target.Cpu.Arch.Family, mappings: anytype) ?[]const u8 { | |
| 47 | 47 | inline for (mappings) |mapping| { |
| 48 | 48 | if (target.cpu.has(family, mapping[0])) return mapping[1]; |
| 49 | 49 | } |
| ... | ... | @@ -51,7 +51,7 @@ fn subArchName(target: std.Target, comptime family: std.Target.Cpu.Arch.Family, |
| 51 | 51 | return null; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { | |
| 54 | pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 { | |
| 55 | 55 | var llvm_triple = std.ArrayList(u8).init(allocator); |
| 56 | 56 | defer llvm_triple.deinit(); |
| 57 | 57 | |
| ... | ... | @@ -309,7 +309,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { |
| 309 | 309 | return llvm_triple.toOwnedSlice(); |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | pub fn supportsTailCall(target: std.Target) bool { | |
| 312 | pub fn supportsTailCall(target: *const std.Target) bool { | |
| 313 | 313 | return switch (target.cpu.arch) { |
| 314 | 314 | .wasm32, .wasm64 => target.cpu.has(.wasm, .tail_call), |
| 315 | 315 | // Although these ISAs support tail calls, LLVM does not support tail calls on them. |
| ... | ... | @@ -319,7 +319,7 @@ pub fn supportsTailCall(target: std.Target) bool { |
| 319 | 319 | }; |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | pub fn dataLayout(target: std.Target) []const u8 { | |
| 322 | pub fn dataLayout(target: *const std.Target) []const u8 { | |
| 323 | 323 | // These data layouts should match Clang. |
| 324 | 324 | return switch (target.cpu.arch) { |
| 325 | 325 | .arc => "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-f32:32:32-i64:32-f64:32-a:0:32-n32", |
| ... | ... | @@ -475,7 +475,7 @@ const CodeModel = enum { |
| 475 | 475 | large, |
| 476 | 476 | }; |
| 477 | 477 | |
| 478 | fn codeModel(model: std.builtin.CodeModel, target: std.Target) CodeModel { | |
| 478 | fn codeModel(model: std.builtin.CodeModel, target: *const std.Target) CodeModel { | |
| 479 | 479 | // Roughly match Clang's mapping of GCC code models to LLVM code models. |
| 480 | 480 | return switch (model) { |
| 481 | 481 | .default => .default, |
| ... | ... | @@ -508,7 +508,7 @@ pub const Object = struct { |
| 508 | 508 | |
| 509 | 509 | debug_unresolved_namespace_scopes: std.AutoArrayHashMapUnmanaged(InternPool.NamespaceIndex, Builder.Metadata), |
| 510 | 510 | |
| 511 | target: std.Target, | |
| 511 | target: *const std.Target, | |
| 512 | 512 | /// Ideally we would use `llvm_module.getNamedFunction` to go from *Decl to LLVM function, |
| 513 | 513 | /// but that has some downsides: |
| 514 | 514 | /// * we have to compute the fully qualified name every time we want to do the lookup |
| ... | ... | @@ -562,7 +562,7 @@ pub const Object = struct { |
| 562 | 562 | pub fn create(arena: Allocator, comp: *Compilation) !Ptr { |
| 563 | 563 | dev.check(.llvm_backend); |
| 564 | 564 | const gpa = comp.gpa; |
| 565 | const target = comp.root_mod.resolved_target.result; | |
| 565 | const target = &comp.root_mod.resolved_target.result; | |
| 566 | 566 | const llvm_target_triple = try targetTriple(arena, target); |
| 567 | 567 | |
| 568 | 568 | var builder = try Builder.init(.{ |
| ... | ... | @@ -827,7 +827,7 @@ pub const Object = struct { |
| 827 | 827 | const behavior_max = try o.builder.metadataConstant(try o.builder.intConst(.i32, 7)); |
| 828 | 828 | const behavior_min = try o.builder.metadataConstant(try o.builder.intConst(.i32, 8)); |
| 829 | 829 | |
| 830 | if (target_util.llvmMachineAbi(comp.root_mod.resolved_target.result)) |abi| { | |
| 830 | if (target_util.llvmMachineAbi(&comp.root_mod.resolved_target.result)) |abi| { | |
| 831 | 831 | module_flags.appendAssumeCapacity(try o.builder.metadataModuleFlag( |
| 832 | 832 | behavior_error, |
| 833 | 833 | try o.builder.metadataString("target-abi"), |
| ... | ... | @@ -837,7 +837,7 @@ pub const Object = struct { |
| 837 | 837 | )); |
| 838 | 838 | } |
| 839 | 839 | |
| 840 | const pic_level = target_util.picLevel(comp.root_mod.resolved_target.result); | |
| 840 | const pic_level = target_util.picLevel(&comp.root_mod.resolved_target.result); | |
| 841 | 841 | if (comp.root_mod.pic) { |
| 842 | 842 | module_flags.appendAssumeCapacity(try o.builder.metadataModuleFlag( |
| 843 | 843 | behavior_min, |
| ... | ... | @@ -860,7 +860,7 @@ pub const Object = struct { |
| 860 | 860 | try o.builder.metadataString("Code Model"), |
| 861 | 861 | try o.builder.metadataConstant(try o.builder.intConst(.i32, @as( |
| 862 | 862 | i32, |
| 863 | switch (codeModel(comp.root_mod.code_model, comp.root_mod.resolved_target.result)) { | |
| 863 | switch (codeModel(comp.root_mod.code_model, &comp.root_mod.resolved_target.result)) { | |
| 864 | 864 | .default => unreachable, |
| 865 | 865 | .tiny => 0, |
| 866 | 866 | .small => 1, |
| ... | ... | @@ -906,7 +906,7 @@ pub const Object = struct { |
| 906 | 906 | } |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | const target = comp.root_mod.resolved_target.result; | |
| 909 | const target = &comp.root_mod.resolved_target.result; | |
| 910 | 910 | if (target.os.tag == .windows and (target.cpu.arch == .x86_64 or target.cpu.arch == .x86)) { |
| 911 | 911 | // Add the "RegCallv4" flag so that any functions using `x86_regcallcc` use regcall |
| 912 | 912 | // v4, which is essentially a requirement on Windows. See corresponding logic in |
| ... | ... | @@ -1020,7 +1020,7 @@ pub const Object = struct { |
| 1020 | 1020 | else |
| 1021 | 1021 | .Static; |
| 1022 | 1022 | |
| 1023 | const code_model: llvm.CodeModel = switch (codeModel(comp.root_mod.code_model, comp.root_mod.resolved_target.result)) { | |
| 1023 | const code_model: llvm.CodeModel = switch (codeModel(comp.root_mod.code_model, &comp.root_mod.resolved_target.result)) { | |
| 1024 | 1024 | .default => .Default, |
| 1025 | 1025 | .tiny => .Tiny, |
| 1026 | 1026 | .small => .Small, |
| ... | ... | @@ -1045,7 +1045,7 @@ pub const Object = struct { |
| 1045 | 1045 | comp.function_sections, |
| 1046 | 1046 | comp.data_sections, |
| 1047 | 1047 | float_abi, |
| 1048 | if (target_util.llvmMachineAbi(comp.root_mod.resolved_target.result)) |s| s.ptr else null, | |
| 1048 | if (target_util.llvmMachineAbi(&comp.root_mod.resolved_target.result)) |s| s.ptr else null, | |
| 1049 | 1049 | ); |
| 1050 | 1050 | errdefer target_machine.dispose(); |
| 1051 | 1051 | |
| ... | ... | @@ -1137,7 +1137,7 @@ pub const Object = struct { |
| 1137 | 1137 | const owner_mod = zcu.fileByIndex(file_scope).mod.?; |
| 1138 | 1138 | const fn_ty = Type.fromInterned(func.ty); |
| 1139 | 1139 | const fn_info = zcu.typeToFunc(fn_ty).?; |
| 1140 | const target = owner_mod.resolved_target.result; | |
| 1140 | const target = &owner_mod.resolved_target.result; | |
| 1141 | 1141 | |
| 1142 | 1142 | var ng: NavGen = .{ |
| 1143 | 1143 | .object = o, |
| ... | ... | @@ -2699,7 +2699,7 @@ pub const Object = struct { |
| 2699 | 2699 | if (gop.found_existing) return gop.value_ptr.ptr(&o.builder).kind.function; |
| 2700 | 2700 | |
| 2701 | 2701 | const fn_info = zcu.typeToFunc(ty).?; |
| 2702 | const target = owner_mod.resolved_target.result; | |
| 2702 | const target = &owner_mod.resolved_target.result; | |
| 2703 | 2703 | const sret = firstParamSRet(fn_info, zcu, target); |
| 2704 | 2704 | |
| 2705 | 2705 | const is_extern, const lib_name = if (nav.getExtern(ip)) |@"extern"| |
| ... | ... | @@ -2913,7 +2913,7 @@ pub const Object = struct { |
| 2913 | 2913 | try attributes.addFnAttr(.minsize, &o.builder); |
| 2914 | 2914 | try attributes.addFnAttr(.optsize, &o.builder); |
| 2915 | 2915 | } |
| 2916 | const target = owner_mod.resolved_target.result; | |
| 2916 | const target = &owner_mod.resolved_target.result; | |
| 2917 | 2917 | if (target.cpu.model.llvm_name) |s| { |
| 2918 | 2918 | try attributes.addFnAttr(.{ .string = .{ |
| 2919 | 2919 | .kind = try o.builder.string("target-cpu"), |
| ... | ... | @@ -4445,7 +4445,7 @@ pub const Object = struct { |
| 4445 | 4445 | if (o.builder.getGlobal(name)) |llvm_fn| return llvm_fn.ptrConst(&o.builder).kind.function; |
| 4446 | 4446 | |
| 4447 | 4447 | const zcu = o.pt.zcu; |
| 4448 | const target = zcu.root_mod.resolved_target.result; | |
| 4448 | const target = &zcu.root_mod.resolved_target.result; | |
| 4449 | 4449 | const function_index = try o.builder.addFunction( |
| 4450 | 4450 | try o.builder.fnType(.i1, &.{try o.errorIntType()}, .normal), |
| 4451 | 4451 | name, |
| ... | ... | @@ -4474,7 +4474,7 @@ pub const Object = struct { |
| 4474 | 4474 | |
| 4475 | 4475 | const usize_ty = try o.lowerType(Type.usize); |
| 4476 | 4476 | const ret_ty = try o.lowerType(Type.slice_const_u8_sentinel_0); |
| 4477 | const target = zcu.root_mod.resolved_target.result; | |
| 4477 | const target = &zcu.root_mod.resolved_target.result; | |
| 4478 | 4478 | const function_index = try o.builder.addFunction( |
| 4479 | 4479 | try o.builder.fnType(ret_ty, &.{try o.lowerType(Type.fromInterned(enum_type.tag_ty))}, .normal), |
| 4480 | 4480 | try o.builder.strtabStringFmt("__zig_tag_name_{}", .{enum_type.name.fmt(ip)}), |
| ... | ... | @@ -10372,7 +10372,7 @@ pub const FuncGen = struct { |
| 10372 | 10372 | if (gop.found_existing) return gop.value_ptr.*; |
| 10373 | 10373 | errdefer assert(o.named_enum_map.remove(enum_ty.toIntern())); |
| 10374 | 10374 | |
| 10375 | const target = zcu.root_mod.resolved_target.result; | |
| 10375 | const target = &zcu.root_mod.resolved_target.result; | |
| 10376 | 10376 | const function_index = try o.builder.addFunction( |
| 10377 | 10377 | try o.builder.fnType(.i1, &.{try o.lowerType(Type.fromInterned(enum_type.tag_ty))}, .normal), |
| 10378 | 10378 | try o.builder.strtabStringFmt("__zig_is_named_enum_value_{}", .{enum_type.name.fmt(ip)}), |
| ... | ... | @@ -11834,7 +11834,7 @@ const CallingConventionInfo = struct { |
| 11834 | 11834 | inreg_param_count: u2 = 0, |
| 11835 | 11835 | }; |
| 11836 | 11836 | |
| 11837 | pub fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) ?CallingConventionInfo { | |
| 11837 | pub fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: *const std.Target) ?CallingConventionInfo { | |
| 11838 | 11838 | const llvm_cc = toLlvmCallConvTag(cc, target) orelse return null; |
| 11839 | 11839 | const incoming_stack_alignment: ?u64, const register_params: u2 = switch (cc) { |
| 11840 | 11840 | inline else => |pl| switch (@TypeOf(pl)) { |
| ... | ... | @@ -11858,7 +11858,7 @@ pub fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) ?Ca |
| 11858 | 11858 | .inreg_param_count = register_params, |
| 11859 | 11859 | }; |
| 11860 | 11860 | } |
| 11861 | fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: std.Target) ?Builder.CallConv { | |
| 11861 | fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const std.Target) ?Builder.CallConv { | |
| 11862 | 11862 | if (target.cCallingConvention()) |default_c| { |
| 11863 | 11863 | if (cc_tag == default_c) { |
| 11864 | 11864 | return .ccc; |
| ... | ... | @@ -11972,7 +11972,7 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: std.Targ |
| 11972 | 11972 | } |
| 11973 | 11973 | |
| 11974 | 11974 | /// Convert a zig-address space to an llvm address space. |
| 11975 | fn toLlvmAddressSpace(address_space: std.builtin.AddressSpace, target: std.Target) Builder.AddrSpace { | |
| 11975 | fn toLlvmAddressSpace(address_space: std.builtin.AddressSpace, target: *const std.Target) Builder.AddrSpace { | |
| 11976 | 11976 | for (llvmAddrSpaceInfo(target)) |info| if (info.zig == address_space) return info.llvm; |
| 11977 | 11977 | unreachable; |
| 11978 | 11978 | } |
| ... | ... | @@ -11987,7 +11987,7 @@ const AddrSpaceInfo = struct { |
| 11987 | 11987 | idx: ?u16 = null, |
| 11988 | 11988 | force_in_data_layout: bool = false, |
| 11989 | 11989 | }; |
| 11990 | fn llvmAddrSpaceInfo(target: std.Target) []const AddrSpaceInfo { | |
| 11990 | fn llvmAddrSpaceInfo(target: *const std.Target) []const AddrSpaceInfo { | |
| 11991 | 11991 | return switch (target.cpu.arch) { |
| 11992 | 11992 | .x86, .x86_64 => &.{ |
| 11993 | 11993 | .{ .zig = .generic, .llvm = .default }, |
| ... | ... | @@ -12063,7 +12063,7 @@ fn llvmAddrSpaceInfo(target: std.Target) []const AddrSpaceInfo { |
| 12063 | 12063 | /// different address, space and then cast back to the generic address space. |
| 12064 | 12064 | /// For example, on GPUs local variable declarations must be generated into the local address space. |
| 12065 | 12065 | /// This function returns the address space local values should be generated into. |
| 12066 | fn llvmAllocaAddressSpace(target: std.Target) Builder.AddrSpace { | |
| 12066 | fn llvmAllocaAddressSpace(target: *const std.Target) Builder.AddrSpace { | |
| 12067 | 12067 | return switch (target.cpu.arch) { |
| 12068 | 12068 | // On amdgcn, locals should be generated into the private address space. |
| 12069 | 12069 | // To make Zig not impossible to use, these are then converted to addresses in the |
| ... | ... | @@ -12075,7 +12075,7 @@ fn llvmAllocaAddressSpace(target: std.Target) Builder.AddrSpace { |
| 12075 | 12075 | |
| 12076 | 12076 | /// On some targets, global values that are in the generic address space must be generated into a |
| 12077 | 12077 | /// different address space, and then cast back to the generic address space. |
| 12078 | fn llvmDefaultGlobalAddressSpace(target: std.Target) Builder.AddrSpace { | |
| 12078 | fn llvmDefaultGlobalAddressSpace(target: *const std.Target) Builder.AddrSpace { | |
| 12079 | 12079 | return switch (target.cpu.arch) { |
| 12080 | 12080 | // On amdgcn, globals must be explicitly allocated and uploaded so that the program can access |
| 12081 | 12081 | // them. |
| ... | ... | @@ -12086,14 +12086,14 @@ fn llvmDefaultGlobalAddressSpace(target: std.Target) Builder.AddrSpace { |
| 12086 | 12086 | |
| 12087 | 12087 | /// Return the actual address space that a value should be stored in if its a global address space. |
| 12088 | 12088 | /// When a value is placed in the resulting address space, it needs to be cast back into wanted_address_space. |
| 12089 | fn toLlvmGlobalAddressSpace(wanted_address_space: std.builtin.AddressSpace, target: std.Target) Builder.AddrSpace { | |
| 12089 | fn toLlvmGlobalAddressSpace(wanted_address_space: std.builtin.AddressSpace, target: *const std.Target) Builder.AddrSpace { | |
| 12090 | 12090 | return switch (wanted_address_space) { |
| 12091 | 12091 | .generic => llvmDefaultGlobalAddressSpace(target), |
| 12092 | 12092 | else => |as| toLlvmAddressSpace(as, target), |
| 12093 | 12093 | }; |
| 12094 | 12094 | } |
| 12095 | 12095 | |
| 12096 | fn returnTypeByRef(zcu: *Zcu, target: std.Target, ty: Type) bool { | |
| 12096 | fn returnTypeByRef(zcu: *Zcu, target: *const std.Target, ty: Type) bool { | |
| 12097 | 12097 | if (isByRef(ty, zcu)) { |
| 12098 | 12098 | return true; |
| 12099 | 12099 | } else if (target.cpu.arch.isX86() and |
| ... | ... | @@ -12108,7 +12108,7 @@ fn returnTypeByRef(zcu: *Zcu, target: std.Target, ty: Type) bool { |
| 12108 | 12108 | } |
| 12109 | 12109 | } |
| 12110 | 12110 | |
| 12111 | fn firstParamSRet(fn_info: InternPool.Key.FuncType, zcu: *Zcu, target: std.Target) bool { | |
| 12111 | fn firstParamSRet(fn_info: InternPool.Key.FuncType, zcu: *Zcu, target: *const std.Target) bool { | |
| 12112 | 12112 | const return_type = Type.fromInterned(fn_info.return_type); |
| 12113 | 12113 | if (!return_type.hasRuntimeBitsIgnoreComptime(zcu)) return false; |
| 12114 | 12114 | |
| ... | ... | @@ -12137,8 +12137,8 @@ fn firstParamSRet(fn_info: InternPool.Key.FuncType, zcu: *Zcu, target: std.Targe |
| 12137 | 12137 | }; |
| 12138 | 12138 | } |
| 12139 | 12139 | |
| 12140 | fn firstParamSRetSystemV(ty: Type, zcu: *Zcu, target: std.Target) bool { | |
| 12141 | const class = x86_64_abi.classifySystemV(ty, zcu, &target, .ret); | |
| 12140 | fn firstParamSRetSystemV(ty: Type, zcu: *Zcu, target: *const std.Target) bool { | |
| 12141 | const class = x86_64_abi.classifySystemV(ty, zcu, target, .ret); | |
| 12142 | 12142 | if (class[0] == .memory) return true; |
| 12143 | 12143 | if (class[0] == .x87 and class[2] != .none) return true; |
| 12144 | 12144 | return false; |
| ... | ... | @@ -12238,8 +12238,7 @@ fn lowerSystemVFnRetTy(o: *Object, fn_info: InternPool.Key.FuncType) Allocator.E |
| 12238 | 12238 | if (isScalar(zcu, return_type)) { |
| 12239 | 12239 | return o.lowerType(return_type); |
| 12240 | 12240 | } |
| 12241 | const target = zcu.getTarget(); | |
| 12242 | const classes = x86_64_abi.classifySystemV(return_type, zcu, &target, .ret); | |
| 12241 | const classes = x86_64_abi.classifySystemV(return_type, zcu, zcu.getTarget(), .ret); | |
| 12243 | 12242 | if (classes[0] == .memory) return .void; |
| 12244 | 12243 | var types_index: u32 = 0; |
| 12245 | 12244 | var types_buffer: [8]Builder.Type = undefined; |
| ... | ... | @@ -12527,8 +12526,7 @@ const ParamTypeIterator = struct { |
| 12527 | 12526 | fn nextSystemV(it: *ParamTypeIterator, ty: Type) Allocator.Error!?Lowering { |
| 12528 | 12527 | const zcu = it.object.pt.zcu; |
| 12529 | 12528 | const ip = &zcu.intern_pool; |
| 12530 | const target = zcu.getTarget(); | |
| 12531 | const classes = x86_64_abi.classifySystemV(ty, zcu, &target, .arg); | |
| 12529 | const classes = x86_64_abi.classifySystemV(ty, zcu, zcu.getTarget(), .arg); | |
| 12532 | 12530 | if (classes[0] == .memory) { |
| 12533 | 12531 | it.zig_index += 1; |
| 12534 | 12532 | it.llvm_index += 1; |
| ... | ... | @@ -12794,7 +12792,7 @@ fn isScalar(zcu: *Zcu, ty: Type) bool { |
| 12794 | 12792 | /// This function returns true if we expect LLVM to lower x86_fp80 correctly |
| 12795 | 12793 | /// and false if we expect LLVM to crash if it encounters an x86_fp80 type, |
| 12796 | 12794 | /// or if it produces miscompilations. |
| 12797 | fn backendSupportsF80(target: std.Target) bool { | |
| 12795 | fn backendSupportsF80(target: *const std.Target) bool { | |
| 12798 | 12796 | return switch (target.cpu.arch) { |
| 12799 | 12797 | .x86, .x86_64 => !target.cpu.has(.x86, .soft_float), |
| 12800 | 12798 | else => false, |
| ... | ... | @@ -12804,7 +12802,7 @@ fn backendSupportsF80(target: std.Target) bool { |
| 12804 | 12802 | /// This function returns true if we expect LLVM to lower f16 correctly |
| 12805 | 12803 | /// and false if we expect LLVM to crash if it encounters an f16 type, |
| 12806 | 12804 | /// or if it produces miscompilations. |
| 12807 | fn backendSupportsF16(target: std.Target) bool { | |
| 12805 | fn backendSupportsF16(target: *const std.Target) bool { | |
| 12808 | 12806 | return switch (target.cpu.arch) { |
| 12809 | 12807 | // https://github.com/llvm/llvm-project/issues/97981 |
| 12810 | 12808 | .csky, |
| ... | ... | @@ -12840,7 +12838,7 @@ fn backendSupportsF16(target: std.Target) bool { |
| 12840 | 12838 | /// This function returns true if we expect LLVM to lower f128 correctly, |
| 12841 | 12839 | /// and false if we expect LLVM to crash if it encounters an f128 type, |
| 12842 | 12840 | /// or if it produces miscompilations. |
| 12843 | fn backendSupportsF128(target: std.Target) bool { | |
| 12841 | fn backendSupportsF128(target: *const std.Target) bool { | |
| 12844 | 12842 | return switch (target.cpu.arch) { |
| 12845 | 12843 | // https://github.com/llvm/llvm-project/issues/121122 |
| 12846 | 12844 | .amdgcn, |
| ... | ... | @@ -12870,7 +12868,7 @@ fn backendSupportsF128(target: std.Target) bool { |
| 12870 | 12868 | |
| 12871 | 12869 | /// LLVM does not support all relevant intrinsics for all targets, so we |
| 12872 | 12870 | /// may need to manually generate a compiler-rt call. |
| 12873 | fn intrinsicsAllowed(scalar_ty: Type, target: std.Target) bool { | |
| 12871 | fn intrinsicsAllowed(scalar_ty: Type, target: *const std.Target) bool { | |
| 12874 | 12872 | return switch (scalar_ty.toIntern()) { |
| 12875 | 12873 | .f16_type => backendSupportsF16(target), |
| 12876 | 12874 | .f80_type => (target.cTypeBitSize(.longdouble) == 80) and backendSupportsF80(target), |
| ... | ... | @@ -12907,7 +12905,7 @@ fn buildAllocaInner( |
| 12907 | 12905 | wip: *Builder.WipFunction, |
| 12908 | 12906 | llvm_ty: Builder.Type, |
| 12909 | 12907 | alignment: Builder.Alignment, |
| 12910 | target: std.Target, | |
| 12908 | target: *const std.Target, | |
| 12911 | 12909 | ) Allocator.Error!Builder.Value { |
| 12912 | 12910 | const address_space = llvmAllocaAddressSpace(target); |
| 12913 | 12911 |
src/codegen/spirv.zig+1-1| ... | ... | @@ -185,7 +185,7 @@ pub const Object = struct { |
| 185 | 185 | /// related to that. |
| 186 | 186 | error_buffer: ?SpvModule.Decl.Index = null, |
| 187 | 187 | |
| 188 | pub fn init(gpa: Allocator, target: std.Target) Object { | |
| 188 | pub fn init(gpa: Allocator, target: *const std.Target) Object { | |
| 189 | 189 | return .{ |
| 190 | 190 | .gpa = gpa, |
| 191 | 191 | .spv = SpvModule.init(gpa, target), |
src/codegen/spirv/Module.zig+2-2| ... | ... | @@ -107,7 +107,7 @@ gpa: Allocator, |
| 107 | 107 | arena: std.heap.ArenaAllocator, |
| 108 | 108 | |
| 109 | 109 | /// Target info |
| 110 | target: std.Target, | |
| 110 | target: *const std.Target, | |
| 111 | 111 | |
| 112 | 112 | /// The target SPIR-V version |
| 113 | 113 | version: spec.Version, |
| ... | ... | @@ -187,7 +187,7 @@ decl_deps: std.ArrayListUnmanaged(Decl.Index) = .empty, |
| 187 | 187 | /// The list of entry points that should be exported from this module. |
| 188 | 188 | entry_points: std.AutoArrayHashMapUnmanaged(IdRef, EntryPoint) = .empty, |
| 189 | 189 | |
| 190 | pub fn init(gpa: Allocator, target: std.Target) Module { | |
| 190 | pub fn init(gpa: Allocator, target: *const std.Target) Module { | |
| 191 | 191 | const version_minor: u8 = blk: { |
| 192 | 192 | // Prefer higher versions |
| 193 | 193 | if (target.cpu.has(.spirv, .v1_6)) break :blk 6; |
src/libs/freebsd.zig+2-2| ... | ... | @@ -66,7 +66,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 66 | 66 | defer arena_allocator.deinit(); |
| 67 | 67 | const arena = arena_allocator.allocator(); |
| 68 | 68 | |
| 69 | const target = comp.root_mod.resolved_target.result; | |
| 69 | const target = &comp.root_mod.resolved_target.result; | |
| 70 | 70 | |
| 71 | 71 | // In all cases in this function, we add the C compiler flags to |
| 72 | 72 | // cache_exempt_flags rather than extra_flags, because these arguments |
| ... | ... | @@ -407,7 +407,7 @@ pub const BuiltSharedObjects = struct { |
| 407 | 407 | |
| 408 | 408 | const all_map_basename = "all.map"; |
| 409 | 409 | |
| 410 | fn wordDirective(target: std.Target) []const u8 { | |
| 410 | fn wordDirective(target: *const std.Target) []const u8 { | |
| 411 | 411 | // Based on its description in the GNU `as` manual, you might assume that `.word` is sized |
| 412 | 412 | // according to the target word size. But no; that would just make too much sense. |
| 413 | 413 | return if (target.ptrBitWidth() == 64) ".quad" else ".long"; |
src/libs/glibc.zig+3-3| ... | ... | @@ -172,7 +172,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 172 | 172 | defer arena_allocator.deinit(); |
| 173 | 173 | const arena = arena_allocator.allocator(); |
| 174 | 174 | |
| 175 | const target = comp.root_mod.resolved_target.result; | |
| 175 | const target = &comp.root_mod.resolved_target.result; | |
| 176 | 176 | const target_ver = target.os.versionRange().gnuLibCVersion().?; |
| 177 | 177 | const nonshared_stat = target_ver.order(.{ .major = 2, .minor = 32, .patch = 0 }) != .gt; |
| 178 | 178 | const start_old_init_fini = target_ver.order(.{ .major = 2, .minor = 33, .patch = 0 }) != .gt; |
| ... | ... | @@ -485,7 +485,7 @@ fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.ArrayList([ |
| 485 | 485 | fn add_include_dirs_arch( |
| 486 | 486 | arena: Allocator, |
| 487 | 487 | args: *std.ArrayList([]const u8), |
| 488 | target: std.Target, | |
| 488 | target: *const std.Target, | |
| 489 | 489 | opt_nptl: ?[]const u8, |
| 490 | 490 | dir: []const u8, |
| 491 | 491 | ) error{OutOfMemory}!void { |
| ... | ... | @@ -649,7 +649,7 @@ pub const BuiltSharedObjects = struct { |
| 649 | 649 | |
| 650 | 650 | const all_map_basename = "all.map"; |
| 651 | 651 | |
| 652 | fn wordDirective(target: std.Target) []const u8 { | |
| 652 | fn wordDirective(target: *const std.Target) []const u8 { | |
| 653 | 653 | // Based on its description in the GNU `as` manual, you might assume that `.word` is sized |
| 654 | 654 | // according to the target word size. But no; that would just make too much sense. |
| 655 | 655 | return if (target.ptrBitWidth() == 64) ".quad" else ".long"; |
src/libs/libcxx.zig+2-2| ... | ... | @@ -121,7 +121,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 121 | 121 | const root_name = "c++"; |
| 122 | 122 | const output_mode = .Lib; |
| 123 | 123 | const link_mode = .static; |
| 124 | const target = comp.root_mod.resolved_target.result; | |
| 124 | const target = &comp.root_mod.resolved_target.result; | |
| 125 | 125 | |
| 126 | 126 | const cxxabi_include_path = try comp.dirs.zig_lib.join(arena, &.{ "libcxxabi", "include" }); |
| 127 | 127 | const cxx_include_path = try comp.dirs.zig_lib.join(arena, &.{ "libcxx", "include" }); |
| ... | ... | @@ -314,7 +314,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 314 | 314 | const root_name = "c++abi"; |
| 315 | 315 | const output_mode = .Lib; |
| 316 | 316 | const link_mode = .static; |
| 317 | const target = comp.root_mod.resolved_target.result; | |
| 317 | const target = &comp.root_mod.resolved_target.result; | |
| 318 | 318 | |
| 319 | 319 | const cxxabi_include_path = try comp.dirs.zig_lib.join(arena, &.{ "libcxxabi", "include" }); |
| 320 | 320 | const cxx_include_path = try comp.dirs.zig_lib.join(arena, &.{ "libcxx", "include" }); |
src/libs/libtsan.zig+1-1| ... | ... | @@ -324,7 +324,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 324 | 324 | comp.tsan_lib = crt_file; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | fn addCcArgs(target: std.Target, args: *std.ArrayList([]const u8)) error{OutOfMemory}!void { | |
| 327 | fn addCcArgs(target: *const std.Target, args: *std.ArrayList([]const u8)) error{OutOfMemory}!void { | |
| 328 | 328 | try args.appendSlice(&[_][]const u8{ |
| 329 | 329 | "-nostdinc++", |
| 330 | 330 | "-fvisibility=hidden", |
src/libs/libunwind.zig+1-1| ... | ... | @@ -27,7 +27,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 27 | 27 | const arena = arena_allocator.allocator(); |
| 28 | 28 | |
| 29 | 29 | const output_mode = .Lib; |
| 30 | const target = comp.root_mod.resolved_target.result; | |
| 30 | const target = &comp.root_mod.resolved_target.result; | |
| 31 | 31 | const unwind_tables: std.builtin.UnwindTables = |
| 32 | 32 | if (target.cpu.arch == .x86 and target.os.tag == .windows) .none else .@"async"; |
| 33 | 33 | const config = Compilation.Config.resolve(.{ |
src/libs/mingw.zig+3-3| ... | ... | @@ -299,7 +299,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { |
| 299 | 299 | var aro_comp = aro.Compilation.init(gpa, std.fs.cwd()); |
| 300 | 300 | defer aro_comp.deinit(); |
| 301 | 301 | |
| 302 | aro_comp.target = target; | |
| 302 | aro_comp.target = target.*; | |
| 303 | 303 | |
| 304 | 304 | const include_dir = try comp.dirs.zig_lib.join(arena, &.{ "libc", "mingw", "def-include" }); |
| 305 | 305 | |
| ... | ... | @@ -373,7 +373,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { |
| 373 | 373 | |
| 374 | 374 | pub fn libExists( |
| 375 | 375 | allocator: Allocator, |
| 376 | target: std.Target, | |
| 376 | target: *const std.Target, | |
| 377 | 377 | zig_lib_directory: Cache.Directory, |
| 378 | 378 | lib_name: []const u8, |
| 379 | 379 | ) !bool { |
| ... | ... | @@ -389,7 +389,7 @@ pub fn libExists( |
| 389 | 389 | /// see if a .def file exists. |
| 390 | 390 | fn findDef( |
| 391 | 391 | allocator: Allocator, |
| 392 | target: std.Target, | |
| 392 | target: *const std.Target, | |
| 393 | 393 | zig_lib_directory: Cache.Directory, |
| 394 | 394 | lib_name: []const u8, |
| 395 | 395 | ) ![]u8 { |
src/libs/musl.zig+1-1| ... | ... | @@ -193,7 +193,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 193 | 193 | .link_libc = false, |
| 194 | 194 | }); |
| 195 | 195 | |
| 196 | const target = comp.root_mod.resolved_target.result; | |
| 196 | const target = &comp.root_mod.resolved_target.result; | |
| 197 | 197 | const arch_name = std.zig.target.muslArchName(target.cpu.arch, target.abi); |
| 198 | 198 | const time32 = for (time32_compat_arch_list) |time32_compat_arch| { |
| 199 | 199 | if (mem.eql(u8, arch_name, time32_compat_arch)) break true; |
src/libs/netbsd.zig+2-2| ... | ... | @@ -58,7 +58,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 58 | 58 | defer arena_allocator.deinit(); |
| 59 | 59 | const arena = arena_allocator.allocator(); |
| 60 | 60 | |
| 61 | const target = comp.root_mod.resolved_target.result; | |
| 61 | const target = &comp.root_mod.resolved_target.result; | |
| 62 | 62 | const target_version = target.os.version_range.semver.min; |
| 63 | 63 | |
| 64 | 64 | // In all cases in this function, we add the C compiler flags to |
| ... | ... | @@ -353,7 +353,7 @@ pub const BuiltSharedObjects = struct { |
| 353 | 353 | } |
| 354 | 354 | }; |
| 355 | 355 | |
| 356 | fn wordDirective(target: std.Target) []const u8 { | |
| 356 | fn wordDirective(target: *const std.Target) []const u8 { | |
| 357 | 357 | // Based on its description in the GNU `as` manual, you might assume that `.word` is sized |
| 358 | 358 | // according to the target word size. But no; that would just make too much sense. |
| 359 | 359 | return if (target.ptrBitWidth() == 64) ".quad" else ".long"; |
src/link.zig+5-5| ... | ... | @@ -1321,7 +1321,7 @@ pub fn doPrelinkTask(comp: *Compilation, task: PrelinkTask) void { |
| 1321 | 1321 | const prog_node = comp.link_prog_node.start("Parse Host libc", 0); |
| 1322 | 1322 | defer prog_node.end(); |
| 1323 | 1323 | |
| 1324 | const target = comp.root_mod.resolved_target.result; | |
| 1324 | const target = &comp.root_mod.resolved_target.result; | |
| 1325 | 1325 | const flags = target_util.libcFullLinkFlags(target); |
| 1326 | 1326 | const crt_dir = comp.libc_installation.?.crt_dir.?; |
| 1327 | 1327 | const sep = std.fs.path.sep_str; |
| ... | ... | @@ -1670,7 +1670,7 @@ pub fn hashInputs(man: *Cache.Manifest, link_inputs: []const Input) !void { |
| 1670 | 1670 | pub fn resolveInputs( |
| 1671 | 1671 | gpa: Allocator, |
| 1672 | 1672 | arena: Allocator, |
| 1673 | target: std.Target, | |
| 1673 | target: *const std.Target, | |
| 1674 | 1674 | /// This function mutates this array but does not take ownership. |
| 1675 | 1675 | /// Allocated with `gpa`. |
| 1676 | 1676 | unresolved_inputs: *std.ArrayListUnmanaged(UnresolvedInput), |
| ... | ... | @@ -1914,7 +1914,7 @@ fn resolveLibInput( |
| 1914 | 1914 | ld_script_bytes: *std.ArrayListUnmanaged(u8), |
| 1915 | 1915 | lib_directory: Directory, |
| 1916 | 1916 | name_query: UnresolvedInput.NameQuery, |
| 1917 | target: std.Target, | |
| 1917 | target: *const std.Target, | |
| 1918 | 1918 | link_mode: std.builtin.LinkMode, |
| 1919 | 1919 | color: std.zig.Color, |
| 1920 | 1920 | ) Allocator.Error!ResolveLibInputResult { |
| ... | ... | @@ -2028,7 +2028,7 @@ fn resolvePathInput( |
| 2028 | 2028 | resolved_inputs: *std.ArrayListUnmanaged(Input), |
| 2029 | 2029 | /// Allocated via `gpa`. |
| 2030 | 2030 | ld_script_bytes: *std.ArrayListUnmanaged(u8), |
| 2031 | target: std.Target, | |
| 2031 | target: *const std.Target, | |
| 2032 | 2032 | pq: UnresolvedInput.PathQuery, |
| 2033 | 2033 | color: std.zig.Color, |
| 2034 | 2034 | ) Allocator.Error!?ResolveLibInputResult { |
| ... | ... | @@ -2070,7 +2070,7 @@ fn resolvePathInputLib( |
| 2070 | 2070 | resolved_inputs: *std.ArrayListUnmanaged(Input), |
| 2071 | 2071 | /// Allocated via `gpa`. |
| 2072 | 2072 | ld_script_bytes: *std.ArrayListUnmanaged(u8), |
| 2073 | target: std.Target, | |
| 2073 | target: *const std.Target, | |
| 2074 | 2074 | pq: UnresolvedInput.PathQuery, |
| 2075 | 2075 | link_mode: std.builtin.LinkMode, |
| 2076 | 2076 | color: std.zig.Color, |
src/link/C.zig+2-2| ... | ... | @@ -116,7 +116,7 @@ pub fn createEmpty( |
| 116 | 116 | emit: Path, |
| 117 | 117 | options: link.File.OpenOptions, |
| 118 | 118 | ) !*C { |
| 119 | const target = comp.root_mod.resolved_target.result; | |
| 119 | const target = &comp.root_mod.resolved_target.result; | |
| 120 | 120 | assert(target.ofmt == .c); |
| 121 | 121 | const optimize_mode = comp.root_mod.optimize_mode; |
| 122 | 122 | const use_lld = build_options.have_llvm and comp.config.use_lld; |
| ... | ... | @@ -331,7 +331,7 @@ pub fn updateLineNumber(self: *C, pt: Zcu.PerThread, ti_id: InternPool.TrackedIn |
| 331 | 331 | _ = ti_id; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | fn abiDefines(self: *C, target: std.Target) !std.ArrayList(u8) { | |
| 334 | fn abiDefines(self: *C, target: *const std.Target) !std.ArrayList(u8) { | |
| 335 | 335 | const gpa = self.base.comp.gpa; |
| 336 | 336 | var defines = std.ArrayList(u8).init(gpa); |
| 337 | 337 | errdefer defines.deinit(); |
src/link/Coff.zig+4-4| ... | ... | @@ -208,7 +208,7 @@ pub fn createEmpty( |
| 208 | 208 | emit: Path, |
| 209 | 209 | options: link.File.OpenOptions, |
| 210 | 210 | ) !*Coff { |
| 211 | const target = comp.root_mod.resolved_target.result; | |
| 211 | const target = &comp.root_mod.resolved_target.result; | |
| 212 | 212 | assert(target.ofmt == .coff); |
| 213 | 213 | const optimize_mode = comp.root_mod.optimize_mode; |
| 214 | 214 | const output_mode = comp.config.output_mode; |
| ... | ... | @@ -1328,7 +1328,7 @@ fn updateNavCode( |
| 1328 | 1328 | |
| 1329 | 1329 | log.debug("updateNavCode {} 0x{x}", .{ nav.fqn.fmt(ip), nav_index }); |
| 1330 | 1330 | |
| 1331 | const target = zcu.navFileScope(nav_index).mod.?.resolved_target.result; | |
| 1331 | const target = &zcu.navFileScope(nav_index).mod.?.resolved_target.result; | |
| 1332 | 1332 | const required_alignment = switch (pt.navAlignment(nav_index)) { |
| 1333 | 1333 | .none => target_util.defaultFunctionAlignment(target), |
| 1334 | 1334 | else => |a| a.maxStrict(target_util.minFunctionAlignment(target)), |
| ... | ... | @@ -2153,7 +2153,7 @@ fn writeDataDirectoriesHeaders(coff: *Coff) !void { |
| 2153 | 2153 | } |
| 2154 | 2154 | |
| 2155 | 2155 | fn writeHeader(coff: *Coff) !void { |
| 2156 | const target = coff.base.comp.root_mod.resolved_target.result; | |
| 2156 | const target = &coff.base.comp.root_mod.resolved_target.result; | |
| 2157 | 2157 | const gpa = coff.base.comp.gpa; |
| 2158 | 2158 | var buffer = std.ArrayList(u8).init(gpa); |
| 2159 | 2159 | defer buffer.deinit(); |
| ... | ... | @@ -2800,7 +2800,7 @@ pub const Relocation = struct { |
| 2800 | 2800 | .ptr_width = coff.ptr_width, |
| 2801 | 2801 | }; |
| 2802 | 2802 | |
| 2803 | const target = coff.base.comp.root_mod.resolved_target.result; | |
| 2803 | const target = &coff.base.comp.root_mod.resolved_target.result; | |
| 2804 | 2804 | switch (target.cpu.arch) { |
| 2805 | 2805 | .aarch64 => reloc.resolveAarch64(ctx), |
| 2806 | 2806 | .x86, .x86_64 => reloc.resolveX86(ctx), |
src/link/Dwarf.zig+4-4| ... | ... | @@ -92,7 +92,7 @@ const DebugFrame = struct { |
| 92 | 92 | }; |
| 93 | 93 | |
| 94 | 94 | fn headerBytes(dwarf: *Dwarf) u32 { |
| 95 | const target = dwarf.bin_file.comp.root_mod.resolved_target.result; | |
| 95 | const target = &dwarf.bin_file.comp.root_mod.resolved_target.result; | |
| 96 | 96 | return @intCast(switch (dwarf.debug_frame.header.format) { |
| 97 | 97 | .none => return 0, |
| 98 | 98 | .debug_frame => dwarf.unitLengthBytes() + dwarf.sectionOffsetBytes() + 1 + "\x00".len + 1 + 1, |
| ... | ... | @@ -2140,7 +2140,7 @@ fn padToIdeal(actual_size: anytype) @TypeOf(actual_size) { |
| 2140 | 2140 | pub fn init(lf: *link.File, format: DW.Format) Dwarf { |
| 2141 | 2141 | const comp = lf.comp; |
| 2142 | 2142 | const gpa = comp.gpa; |
| 2143 | const target = comp.root_mod.resolved_target.result; | |
| 2143 | const target = &comp.root_mod.resolved_target.result; | |
| 2144 | 2144 | return .{ |
| 2145 | 2145 | .gpa = gpa, |
| 2146 | 2146 | .bin_file = lf, |
| ... | ... | @@ -2573,7 +2573,7 @@ fn initWipNavInner( |
| 2573 | 2573 | try wip_nav.infoAddrSym(sym_index, 0); |
| 2574 | 2574 | wip_nav.func_high_pc = @intCast(wip_nav.debug_info.items.len); |
| 2575 | 2575 | try diw.writeInt(u32, 0, dwarf.endian); |
| 2576 | const target = mod.resolved_target.result; | |
| 2576 | const target = &mod.resolved_target.result; | |
| 2577 | 2577 | try uleb128(diw, switch (nav.status.fully_resolved.alignment) { |
| 2578 | 2578 | .none => target_info.defaultFunctionAlignment(target), |
| 2579 | 2579 | else => |a| a.maxStrict(target_info.minFunctionAlignment(target)), |
| ... | ... | @@ -4529,7 +4529,7 @@ pub fn flush(dwarf: *Dwarf, pt: Zcu.PerThread) FlushError!void { |
| 4529 | 4529 | dwarf.debug_aranges.section.dirty = false; |
| 4530 | 4530 | } |
| 4531 | 4531 | if (dwarf.debug_frame.section.dirty) { |
| 4532 | const target = dwarf.bin_file.comp.root_mod.resolved_target.result; | |
| 4532 | const target = &dwarf.bin_file.comp.root_mod.resolved_target.result; | |
| 4533 | 4533 | switch (dwarf.debug_frame.header.format) { |
| 4534 | 4534 | .none => {}, |
| 4535 | 4535 | .debug_frame => unreachable, |
src/link/Elf.zig+6-6| ... | ... | @@ -196,7 +196,7 @@ pub fn createEmpty( |
| 196 | 196 | emit: Path, |
| 197 | 197 | options: link.File.OpenOptions, |
| 198 | 198 | ) !*Elf { |
| 199 | const target = comp.root_mod.resolved_target.result; | |
| 199 | const target = &comp.root_mod.resolved_target.result; | |
| 200 | 200 | assert(target.ofmt == .elf); |
| 201 | 201 | |
| 202 | 202 | const use_llvm = comp.config.use_llvm; |
| ... | ... | @@ -1073,7 +1073,7 @@ fn parseObject(self: *Elf, obj: link.Input.Object) !void { |
| 1073 | 1073 | |
| 1074 | 1074 | const gpa = self.base.comp.gpa; |
| 1075 | 1075 | const diags = &self.base.comp.link_diags; |
| 1076 | const target = self.base.comp.root_mod.resolved_target.result; | |
| 1076 | const target = &self.base.comp.root_mod.resolved_target.result; | |
| 1077 | 1077 | const debug_fmt_strip = self.base.comp.config.debug_format == .strip; |
| 1078 | 1078 | const default_sym_version = self.default_sym_version; |
| 1079 | 1079 | const file_handles = &self.file_handles; |
| ... | ... | @@ -1104,7 +1104,7 @@ fn parseArchive( |
| 1104 | 1104 | diags: *Diags, |
| 1105 | 1105 | file_handles: *std.ArrayListUnmanaged(File.Handle), |
| 1106 | 1106 | files: *std.MultiArrayList(File.Entry), |
| 1107 | target: std.Target, | |
| 1107 | target: *const std.Target, | |
| 1108 | 1108 | debug_fmt_strip: bool, |
| 1109 | 1109 | default_sym_version: elf.Versym, |
| 1110 | 1110 | objects: *std.ArrayListUnmanaged(File.Index), |
| ... | ... | @@ -1139,7 +1139,7 @@ fn parseDso( |
| 1139 | 1139 | dso: link.Input.Dso, |
| 1140 | 1140 | shared_objects: *std.StringArrayHashMapUnmanaged(File.Index), |
| 1141 | 1141 | files: *std.MultiArrayList(File.Entry), |
| 1142 | target: std.Target, | |
| 1142 | target: *const std.Target, | |
| 1143 | 1143 | ) !void { |
| 1144 | 1144 | const tracy = trace(@src()); |
| 1145 | 1145 | defer tracy.end(); |
| ... | ... | @@ -4121,8 +4121,8 @@ pub fn lsearch(comptime T: type, haystack: []const T, predicate: anytype) usize |
| 4121 | 4121 | return i; |
| 4122 | 4122 | } |
| 4123 | 4123 | |
| 4124 | pub fn getTarget(self: Elf) std.Target { | |
| 4125 | return self.base.comp.root_mod.resolved_target.result; | |
| 4124 | pub fn getTarget(self: *const Elf) *const std.Target { | |
| 4125 | return &self.base.comp.root_mod.resolved_target.result; | |
| 4126 | 4126 | } |
| 4127 | 4127 | |
| 4128 | 4128 | fn requiresThunks(self: Elf) bool { |
src/link/Elf/Object.zig+5-5| ... | ... | @@ -69,7 +69,7 @@ pub fn parse( |
| 69 | 69 | /// For error reporting purposes only. |
| 70 | 70 | path: Path, |
| 71 | 71 | handle: fs.File, |
| 72 | target: std.Target, | |
| 72 | target: *const std.Target, | |
| 73 | 73 | debug_fmt_strip: bool, |
| 74 | 74 | default_sym_version: elf.Versym, |
| 75 | 75 | ) !void { |
| ... | ... | @@ -98,7 +98,7 @@ pub fn parseCommon( |
| 98 | 98 | diags: *Diags, |
| 99 | 99 | path: Path, |
| 100 | 100 | handle: fs.File, |
| 101 | target: std.Target, | |
| 101 | target: *const std.Target, | |
| 102 | 102 | ) !void { |
| 103 | 103 | const offset = if (self.archive) |ar| ar.offset else 0; |
| 104 | 104 | const file_size = (try handle.stat()).size; |
| ... | ... | @@ -182,7 +182,7 @@ pub fn parseCommon( |
| 182 | 182 | pub fn validateEFlags( |
| 183 | 183 | diags: *Diags, |
| 184 | 184 | path: Path, |
| 185 | target: std.Target, | |
| 185 | target: *const std.Target, | |
| 186 | 186 | e_flags: elf.Word, |
| 187 | 187 | ) !void { |
| 188 | 188 | switch (target.cpu.arch) { |
| ... | ... | @@ -263,7 +263,7 @@ fn initAtoms( |
| 263 | 263 | path: Path, |
| 264 | 264 | handle: fs.File, |
| 265 | 265 | debug_fmt_strip: bool, |
| 266 | target: std.Target, | |
| 266 | target: *const std.Target, | |
| 267 | 267 | ) !void { |
| 268 | 268 | const shdrs = self.shdrs.items; |
| 269 | 269 | try self.atoms.ensureTotalCapacityPrecise(gpa, shdrs.len); |
| ... | ... | @@ -420,7 +420,7 @@ fn parseEhFrame( |
| 420 | 420 | gpa: Allocator, |
| 421 | 421 | handle: fs.File, |
| 422 | 422 | shndx: u32, |
| 423 | target: std.Target, | |
| 423 | target: *const std.Target, | |
| 424 | 424 | ) !void { |
| 425 | 425 | const relocs_shndx = for (self.shdrs.items, 0..) |shdr, i| switch (shdr.sh_type) { |
| 426 | 426 | elf.SHT_RELA => if (shdr.sh_info == shndx) break @as(u32, @intCast(i)), |
src/link/Elf/SharedObject.zig+1-1| ... | ... | @@ -96,7 +96,7 @@ pub fn parseHeader( |
| 96 | 96 | file_path: Path, |
| 97 | 97 | fs_file: std.fs.File, |
| 98 | 98 | stat: Stat, |
| 99 | target: std.Target, | |
| 99 | target: *const std.Target, | |
| 100 | 100 | ) !Header { |
| 101 | 101 | var ehdr: elf.Elf64_Ehdr = undefined; |
| 102 | 102 | { |
src/link/Elf/ZigObject.zig+1-1| ... | ... | @@ -1271,7 +1271,7 @@ fn updateNavCode( |
| 1271 | 1271 | |
| 1272 | 1272 | log.debug("updateNavCode {}({d})", .{ nav.fqn.fmt(ip), nav_index }); |
| 1273 | 1273 | |
| 1274 | const target = zcu.navFileScope(nav_index).mod.?.resolved_target.result; | |
| 1274 | const target = &zcu.navFileScope(nav_index).mod.?.resolved_target.result; | |
| 1275 | 1275 | const required_alignment = switch (pt.navAlignment(nav_index)) { |
| 1276 | 1276 | .none => target_util.defaultFunctionAlignment(target), |
| 1277 | 1277 | else => |a| a.maxStrict(target_util.minFunctionAlignment(target)), |
src/link/Goff.zig+2-2| ... | ... | @@ -26,7 +26,7 @@ pub fn createEmpty( |
| 26 | 26 | emit: Path, |
| 27 | 27 | options: link.File.OpenOptions, |
| 28 | 28 | ) !*Goff { |
| 29 | const target = comp.root_mod.resolved_target.result; | |
| 29 | const target = &comp.root_mod.resolved_target.result; | |
| 30 | 30 | const use_lld = build_options.have_llvm and comp.config.use_lld; |
| 31 | 31 | const use_llvm = comp.config.use_llvm; |
| 32 | 32 | |
| ... | ... | @@ -59,7 +59,7 @@ pub fn open( |
| 59 | 59 | emit: Path, |
| 60 | 60 | options: link.File.OpenOptions, |
| 61 | 61 | ) !*Goff { |
| 62 | const target = comp.root_mod.resolved_target.result; | |
| 62 | const target = &comp.root_mod.resolved_target.result; | |
| 63 | 63 | assert(target.ofmt == .goff); |
| 64 | 64 | return createEmpty(arena, comp, emit, options); |
| 65 | 65 | } |
src/link/Lld.zig+8-8| ... | ... | @@ -30,7 +30,7 @@ const Coff = struct { |
| 30 | 30 | dllmain_crt_startup: bool, |
| 31 | 31 | }, |
| 32 | 32 | fn init(comp: *Compilation, options: link.File.OpenOptions) !Coff { |
| 33 | const target = comp.root_mod.resolved_target.result; | |
| 33 | const target = &comp.root_mod.resolved_target.result; | |
| 34 | 34 | const output_mode = comp.config.output_mode; |
| 35 | 35 | return .{ |
| 36 | 36 | .image_base = options.image_base orelse switch (output_mode) { |
| ... | ... | @@ -103,7 +103,7 @@ pub const Elf = struct { |
| 103 | 103 | |
| 104 | 104 | fn init(comp: *Compilation, options: link.File.OpenOptions) !Elf { |
| 105 | 105 | const PtrWidth = enum { p32, p64 }; |
| 106 | const target = comp.root_mod.resolved_target.result; | |
| 106 | const target = &comp.root_mod.resolved_target.result; | |
| 107 | 107 | const output_mode = comp.config.output_mode; |
| 108 | 108 | const is_dyn_lib = output_mode == .Lib and comp.config.link_mode == .dynamic; |
| 109 | 109 | const ptr_width: PtrWidth = switch (target.ptrBitWidth()) { |
| ... | ... | @@ -202,7 +202,7 @@ pub fn createEmpty( |
| 202 | 202 | emit: Cache.Path, |
| 203 | 203 | options: link.File.OpenOptions, |
| 204 | 204 | ) !*Lld { |
| 205 | const target = comp.root_mod.resolved_target.result; | |
| 205 | const target = &comp.root_mod.resolved_target.result; | |
| 206 | 206 | const output_mode = comp.config.output_mode; |
| 207 | 207 | const optimize_mode = comp.root_mod.optimize_mode; |
| 208 | 208 | const is_native_os = comp.root_mod.resolved_target.is_native_os; |
| ... | ... | @@ -342,7 +342,7 @@ fn linkAsArchive(lld: *Lld, arena: Allocator) !void { |
| 342 | 342 | |
| 343 | 343 | const llvm_bindings = @import("../codegen/llvm/bindings.zig"); |
| 344 | 344 | const llvm = @import("../codegen/llvm.zig"); |
| 345 | const target = comp.root_mod.resolved_target.result; | |
| 345 | const target = &comp.root_mod.resolved_target.result; | |
| 346 | 346 | llvm.initializeLLVMTarget(target.cpu.arch); |
| 347 | 347 | const bad = llvm_bindings.WriteArchive( |
| 348 | 348 | full_out_path_z, |
| ... | ... | @@ -374,7 +374,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void { |
| 374 | 374 | const is_dyn_lib = comp.config.link_mode == .dynamic and is_lib; |
| 375 | 375 | const is_exe_or_dyn_lib = is_dyn_lib or comp.config.output_mode == .Exe; |
| 376 | 376 | const link_in_crt = comp.config.link_libc and is_exe_or_dyn_lib; |
| 377 | const target = comp.root_mod.resolved_target.result; | |
| 377 | const target = &comp.root_mod.resolved_target.result; | |
| 378 | 378 | const optimize_mode = comp.root_mod.optimize_mode; |
| 379 | 379 | const entry_name: ?[]const u8 = switch (coff.entry) { |
| 380 | 380 | // This logic isn't quite right for disabled or enabled. No point in fixing it |
| ... | ... | @@ -811,7 +811,7 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { |
| 811 | 811 | const is_dyn_lib = link_mode == .dynamic and is_lib; |
| 812 | 812 | const is_exe_or_dyn_lib = is_dyn_lib or output_mode == .Exe; |
| 813 | 813 | const have_dynamic_linker = link_mode == .dynamic and is_exe_or_dyn_lib; |
| 814 | const target = comp.root_mod.resolved_target.result; | |
| 814 | const target = &comp.root_mod.resolved_target.result; | |
| 815 | 815 | const compiler_rt_path: ?Cache.Path = blk: { |
| 816 | 816 | if (comp.compiler_rt_lib) |x| break :blk x.full_object_path; |
| 817 | 817 | if (comp.compiler_rt_obj) |x| break :blk x.full_object_path; |
| ... | ... | @@ -1281,7 +1281,7 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { |
| 1281 | 1281 | try spawnLld(comp, arena, argv.items); |
| 1282 | 1282 | } |
| 1283 | 1283 | } |
| 1284 | fn getLDMOption(target: std.Target) ?[]const u8 { | |
| 1284 | fn getLDMOption(target: *const std.Target) ?[]const u8 { | |
| 1285 | 1285 | // This should only return emulations understood by LLD's parseEmulation(). |
| 1286 | 1286 | return switch (target.cpu.arch) { |
| 1287 | 1287 | .aarch64 => switch (target.os.tag) { |
| ... | ... | @@ -1364,7 +1364,7 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void { |
| 1364 | 1364 | const shared_memory = comp.config.shared_memory; |
| 1365 | 1365 | const export_memory = comp.config.export_memory; |
| 1366 | 1366 | const import_memory = comp.config.import_memory; |
| 1367 | const target = comp.root_mod.resolved_target.result; | |
| 1367 | const target = &comp.root_mod.resolved_target.result; | |
| 1368 | 1368 | const base = &lld.base; |
| 1369 | 1369 | const wasm = &lld.ofmt.wasm; |
| 1370 | 1370 |
src/link/MachO.zig+4-4| ... | ... | @@ -163,7 +163,7 @@ pub fn createEmpty( |
| 163 | 163 | emit: Path, |
| 164 | 164 | options: link.File.OpenOptions, |
| 165 | 165 | ) !*MachO { |
| 166 | const target = comp.root_mod.resolved_target.result; | |
| 166 | const target = &comp.root_mod.resolved_target.result; | |
| 167 | 167 | assert(target.ofmt == .macho); |
| 168 | 168 | |
| 169 | 169 | const gpa = comp.gpa; |
| ... | ... | @@ -3545,8 +3545,8 @@ pub fn markDirty(self: *MachO, sect_index: u8) void { |
| 3545 | 3545 | } |
| 3546 | 3546 | } |
| 3547 | 3547 | |
| 3548 | pub fn getTarget(self: MachO) std.Target { | |
| 3549 | return self.base.comp.root_mod.resolved_target.result; | |
| 3548 | pub fn getTarget(self: *const MachO) *const std.Target { | |
| 3549 | return &self.base.comp.root_mod.resolved_target.result; | |
| 3550 | 3550 | } |
| 3551 | 3551 | |
| 3552 | 3552 | /// XNU starting with Big Sur running on arm64 is caching inodes of running binaries. |
| ... | ... | @@ -4233,7 +4233,7 @@ pub const Platform = struct { |
| 4233 | 4233 | } |
| 4234 | 4234 | } |
| 4235 | 4235 | |
| 4236 | pub fn fromTarget(target: std.Target) Platform { | |
| 4236 | pub fn fromTarget(target: *const std.Target) Platform { | |
| 4237 | 4237 | return .{ |
| 4238 | 4238 | .os_tag = target.os.tag, |
| 4239 | 4239 | .abi = target.abi, |
src/link/MachO/ZigObject.zig+1-1| ... | ... | @@ -948,7 +948,7 @@ fn updateNavCode( |
| 948 | 948 | |
| 949 | 949 | log.debug("updateNavCode {} 0x{x}", .{ nav.fqn.fmt(ip), nav_index }); |
| 950 | 950 | |
| 951 | const target = zcu.navFileScope(nav_index).mod.?.resolved_target.result; | |
| 951 | const target = &zcu.navFileScope(nav_index).mod.?.resolved_target.result; | |
| 952 | 952 | const required_alignment = switch (pt.navAlignment(nav_index)) { |
| 953 | 953 | .none => target_util.defaultFunctionAlignment(target), |
| 954 | 954 | else => |a| a.maxStrict(target_util.minFunctionAlignment(target)), |
src/link/Plan9.zig+5-5| ... | ... | @@ -184,7 +184,7 @@ pub const Atom = struct { |
| 184 | 184 | |
| 185 | 185 | // asserts that self.got_index != null |
| 186 | 186 | pub fn getOffsetTableAddress(self: Atom, plan9: *Plan9) u64 { |
| 187 | const target = plan9.base.comp.root_mod.resolved_target.result; | |
| 187 | const target = &plan9.base.comp.root_mod.resolved_target.result; | |
| 188 | 188 | const ptr_bytes = @divExact(target.ptrBitWidth(), 8); |
| 189 | 189 | const got_addr = plan9.bases.data; |
| 190 | 190 | const got_index = self.got_index.?; |
| ... | ... | @@ -278,7 +278,7 @@ pub fn createEmpty( |
| 278 | 278 | emit: Path, |
| 279 | 279 | options: link.File.OpenOptions, |
| 280 | 280 | ) !*Plan9 { |
| 281 | const target = comp.root_mod.resolved_target.result; | |
| 281 | const target = &comp.root_mod.resolved_target.result; | |
| 282 | 282 | const gpa = comp.gpa; |
| 283 | 283 | const optimize_mode = comp.root_mod.optimize_mode; |
| 284 | 284 | const output_mode = comp.config.output_mode; |
| ... | ... | @@ -394,7 +394,7 @@ pub fn updateFunc( |
| 394 | 394 | |
| 395 | 395 | const zcu = pt.zcu; |
| 396 | 396 | const gpa = zcu.gpa; |
| 397 | const target = self.base.comp.root_mod.resolved_target.result; | |
| 397 | const target = &self.base.comp.root_mod.resolved_target.result; | |
| 398 | 398 | const func = zcu.funcInfo(func_index); |
| 399 | 399 | |
| 400 | 400 | const atom_idx = try self.seeNav(pt, func.owner_nav); |
| ... | ... | @@ -583,7 +583,7 @@ pub fn flush( |
| 583 | 583 | const comp = self.base.comp; |
| 584 | 584 | const diags = &comp.link_diags; |
| 585 | 585 | const gpa = comp.gpa; |
| 586 | const target = comp.root_mod.resolved_target.result; | |
| 586 | const target = &comp.root_mod.resolved_target.result; | |
| 587 | 587 | |
| 588 | 588 | switch (comp.config.output_mode) { |
| 589 | 589 | .Exe => {}, |
| ... | ... | @@ -1153,7 +1153,7 @@ pub fn open( |
| 1153 | 1153 | emit: Path, |
| 1154 | 1154 | options: link.File.OpenOptions, |
| 1155 | 1155 | ) !*Plan9 { |
| 1156 | const target = comp.root_mod.resolved_target.result; | |
| 1156 | const target = &comp.root_mod.resolved_target.result; | |
| 1157 | 1157 | const use_lld = build_options.have_llvm and comp.config.use_lld; |
| 1158 | 1158 | const use_llvm = comp.config.use_llvm; |
| 1159 | 1159 |
src/link/SpirV.zig+1-1| ... | ... | @@ -58,7 +58,7 @@ pub fn createEmpty( |
| 58 | 58 | options: link.File.OpenOptions, |
| 59 | 59 | ) !*SpirV { |
| 60 | 60 | const gpa = comp.gpa; |
| 61 | const target = comp.root_mod.resolved_target.result; | |
| 61 | const target = &comp.root_mod.resolved_target.result; | |
| 62 | 62 | |
| 63 | 63 | assert(!comp.config.use_lld); // Caught by Compilation.Config.resolve |
| 64 | 64 | assert(!comp.config.use_llvm); // Caught by Compilation.Config.resolve |
src/link/Wasm.zig+1-1| ... | ... | @@ -2943,7 +2943,7 @@ pub fn createEmpty( |
| 2943 | 2943 | emit: Path, |
| 2944 | 2944 | options: link.File.OpenOptions, |
| 2945 | 2945 | ) !*Wasm { |
| 2946 | const target = comp.root_mod.resolved_target.result; | |
| 2946 | const target = &comp.root_mod.resolved_target.result; | |
| 2947 | 2947 | assert(target.ofmt == .wasm); |
| 2948 | 2948 | |
| 2949 | 2949 | const use_llvm = comp.config.use_llvm; |
src/link/Xcoff.zig+2-2| ... | ... | @@ -26,7 +26,7 @@ pub fn createEmpty( |
| 26 | 26 | emit: Path, |
| 27 | 27 | options: link.File.OpenOptions, |
| 28 | 28 | ) !*Xcoff { |
| 29 | const target = comp.root_mod.resolved_target.result; | |
| 29 | const target = &comp.root_mod.resolved_target.result; | |
| 30 | 30 | const use_lld = build_options.have_llvm and comp.config.use_lld; |
| 31 | 31 | const use_llvm = comp.config.use_llvm; |
| 32 | 32 | |
| ... | ... | @@ -59,7 +59,7 @@ pub fn open( |
| 59 | 59 | emit: Path, |
| 60 | 60 | options: link.File.OpenOptions, |
| 61 | 61 | ) !*Xcoff { |
| 62 | const target = comp.root_mod.resolved_target.result; | |
| 62 | const target = &comp.root_mod.resolved_target.result; | |
| 63 | 63 | assert(target.ofmt == .xcoff); |
| 64 | 64 | return createEmpty(arena, comp, emit, options); |
| 65 | 65 | } |
src/main.zig+7-7| ... | ... | @@ -340,7 +340,7 @@ fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 340 | 340 | dev.check(.targets_command); |
| 341 | 341 | const host = std.zig.resolveTargetQueryOrFatal(.{}); |
| 342 | 342 | const stdout = io.getStdOut().writer(); |
| 343 | return @import("print_targets.zig").cmdTargets(arena, cmd_args, stdout, host); | |
| 343 | return @import("print_targets.zig").cmdTargets(arena, cmd_args, stdout, &host); | |
| 344 | 344 | } else if (mem.eql(u8, cmd, "version")) { |
| 345 | 345 | dev.check(.version_command); |
| 346 | 346 | try std.io.getStdOut().writeAll(build_options.version ++ "\n"); |
| ... | ... | @@ -3086,7 +3086,7 @@ fn buildOutputType( |
| 3086 | 3086 | else => main_mod, |
| 3087 | 3087 | }; |
| 3088 | 3088 | |
| 3089 | const target = main_mod.resolved_target.result; | |
| 3089 | const target = &main_mod.resolved_target.result; | |
| 3090 | 3090 | |
| 3091 | 3091 | if (target.cpu.arch == .arc or target.cpu.arch.isNvptx()) { |
| 3092 | 3092 | if (emit_bin != .no and create_module.resolved_options.use_llvm) { |
| ... | ... | @@ -3655,7 +3655,7 @@ fn buildOutputType( |
| 3655 | 3655 | test_exec_args.items, |
| 3656 | 3656 | self_exe_path, |
| 3657 | 3657 | arg_mode, |
| 3658 | &target, | |
| 3658 | target, | |
| 3659 | 3659 | &comp_destroyed, |
| 3660 | 3660 | all_args, |
| 3661 | 3661 | runtime_args_start, |
| ... | ... | @@ -3800,12 +3800,12 @@ fn createModule( |
| 3800 | 3800 | // This block is for initializing the fields of |
| 3801 | 3801 | // `Compilation.Config.Options` that require knowledge of the |
| 3802 | 3802 | // target (which was just now resolved for the root module above). |
| 3803 | const resolved_target = cli_mod.inherited.resolved_target.?; | |
| 3804 | create_module.opts.resolved_target = resolved_target; | |
| 3803 | const resolved_target = &cli_mod.inherited.resolved_target.?; | |
| 3804 | create_module.opts.resolved_target = resolved_target.*; | |
| 3805 | 3805 | create_module.opts.root_optimize_mode = cli_mod.inherited.optimize_mode; |
| 3806 | 3806 | create_module.opts.root_strip = cli_mod.inherited.strip; |
| 3807 | 3807 | create_module.opts.root_error_tracing = cli_mod.inherited.error_tracing; |
| 3808 | const target = resolved_target.result; | |
| 3808 | const target = &resolved_target.result; | |
| 3809 | 3809 | |
| 3810 | 3810 | // First, remove libc, libc++, and compiler_rt libraries from the system libraries list. |
| 3811 | 3811 | // We need to know whether the set of system libraries contains anything besides these |
| ... | ... | @@ -6482,7 +6482,7 @@ fn warnAboutForeignBinaries( |
| 6482 | 6482 | const host_query: std.Target.Query = .{}; |
| 6483 | 6483 | const host_target = std.zig.resolveTargetQueryOrFatal(host_query); |
| 6484 | 6484 | |
| 6485 | switch (std.zig.system.getExternalExecutor(host_target, target, .{ .link_libc = link_libc })) { | |
| 6485 | switch (std.zig.system.getExternalExecutor(&host_target, target, .{ .link_libc = link_libc })) { | |
| 6486 | 6486 | .native => return, |
| 6487 | 6487 | .rosetta => { |
| 6488 | 6488 | const host_name = try host_target.zigTriple(arena); |
src/print_targets.zig+1-1| ... | ... | @@ -16,7 +16,7 @@ pub fn cmdTargets( |
| 16 | 16 | args: []const []const u8, |
| 17 | 17 | /// Output stream |
| 18 | 18 | stdout: anytype, |
| 19 | native_target: Target, | |
| 19 | native_target: *const Target, | |
| 20 | 20 | ) !void { |
| 21 | 21 | _ = args; |
| 22 | 22 | var zig_lib_directory = introspect.findZigLibDir(allocator) catch |err| { |
src/target.zig+45-42| ... | ... | @@ -9,7 +9,7 @@ const Feature = @import("Zcu.zig").Feature; |
| 9 | 9 | |
| 10 | 10 | pub const default_stack_protector_buffer_size = 4; |
| 11 | 11 | |
| 12 | pub fn cannotDynamicLink(target: std.Target) bool { | |
| 12 | pub fn cannotDynamicLink(target: *const std.Target) bool { | |
| 13 | 13 | return switch (target.os.tag) { |
| 14 | 14 | .freestanding => true, |
| 15 | 15 | else => target.cpu.arch.isSpirV(), |
| ... | ... | @@ -19,15 +19,15 @@ pub fn cannotDynamicLink(target: std.Target) bool { |
| 19 | 19 | /// On Darwin, we always link libSystem which contains libc. |
| 20 | 20 | /// Similarly on FreeBSD and NetBSD we always link system libc |
| 21 | 21 | /// since this is the stable syscall interface. |
| 22 | pub fn osRequiresLibC(target: std.Target) bool { | |
| 22 | pub fn osRequiresLibC(target: *const std.Target) bool { | |
| 23 | 23 | return target.os.requiresLibC(); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | pub fn libCNeedsLibUnwind(target: std.Target, link_mode: std.builtin.LinkMode) bool { | |
| 26 | pub fn libCNeedsLibUnwind(target: *const std.Target, link_mode: std.builtin.LinkMode) bool { | |
| 27 | 27 | return target.isGnuLibC() and link_mode == .static; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | pub fn libCxxNeedsLibUnwind(target: std.Target) bool { | |
| 30 | pub fn libCxxNeedsLibUnwind(target: *const std.Target) bool { | |
| 31 | 31 | return switch (target.os.tag) { |
| 32 | 32 | .macos, |
| 33 | 33 | .ios, |
| ... | ... | @@ -44,14 +44,14 @@ pub fn libCxxNeedsLibUnwind(target: std.Target) bool { |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /// This function returns whether non-pic code is completely invalid on the given target. |
| 47 | pub fn requiresPIC(target: std.Target, linking_libc: bool) bool { | |
| 47 | pub fn requiresPIC(target: *const std.Target, linking_libc: bool) bool { | |
| 48 | 48 | return target.abi.isAndroid() or |
| 49 | 49 | target.os.tag == .windows or target.os.tag == .uefi or |
| 50 | 50 | osRequiresLibC(target) or |
| 51 | 51 | (linking_libc and target.isGnuLibC()); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | pub fn picLevel(target: std.Target) u32 { | |
| 54 | pub fn picLevel(target: *const std.Target) u32 { | |
| 55 | 55 | // MIPS always uses PIC level 1; other platforms vary in their default PIC levels, but they |
| 56 | 56 | // support both level 1 and 2, in which case we prefer 2. |
| 57 | 57 | return if (target.cpu.arch.isMIPS()) 1 else 2; |
| ... | ... | @@ -59,7 +59,7 @@ pub fn picLevel(target: std.Target) u32 { |
| 59 | 59 | |
| 60 | 60 | /// This is not whether the target supports Position Independent Code, but whether the -fPIC |
| 61 | 61 | /// C compiler argument is valid to Clang. |
| 62 | pub fn supports_fpic(target: std.Target) bool { | |
| 62 | pub fn supports_fpic(target: *const std.Target) bool { | |
| 63 | 63 | return switch (target.os.tag) { |
| 64 | 64 | .windows, |
| 65 | 65 | .uefi, |
| ... | ... | @@ -68,12 +68,12 @@ pub fn supports_fpic(target: std.Target) bool { |
| 68 | 68 | }; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | pub fn alwaysSingleThreaded(target: std.Target) bool { | |
| 71 | pub fn alwaysSingleThreaded(target: *const std.Target) bool { | |
| 72 | 72 | _ = target; |
| 73 | 73 | return false; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | pub fn defaultSingleThreaded(target: std.Target) bool { | |
| 76 | pub fn defaultSingleThreaded(target: *const std.Target) bool { | |
| 77 | 77 | switch (target.cpu.arch) { |
| 78 | 78 | .wasm32, .wasm64 => return true, |
| 79 | 79 | else => {}, |
| ... | ... | @@ -85,7 +85,7 @@ pub fn defaultSingleThreaded(target: std.Target) bool { |
| 85 | 85 | return false; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | pub fn hasValgrindSupport(target: std.Target, backend: std.builtin.CompilerBackend) bool { | |
| 88 | pub fn hasValgrindSupport(target: *const std.Target, backend: std.builtin.CompilerBackend) bool { | |
| 89 | 89 | // We can't currently output the necessary Valgrind client request assembly when using the C |
| 90 | 90 | // backend and compiling with an MSVC-like compiler. |
| 91 | 91 | const ofmt_c_msvc = (target.abi == .msvc or target.abi == .itanium) and target.ofmt == .c; |
| ... | ... | @@ -133,7 +133,7 @@ pub fn hasValgrindSupport(target: std.Target, backend: std.builtin.CompilerBacke |
| 133 | 133 | /// The set of targets that LLVM has non-experimental support for. |
| 134 | 134 | /// Used to select between LLVM backend and self-hosted backend when compiling in |
| 135 | 135 | /// release modes. |
| 136 | pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool { | |
| 136 | pub fn hasLlvmSupport(target: *const std.Target, ofmt: std.Target.ObjectFormat) bool { | |
| 137 | 137 | switch (ofmt) { |
| 138 | 138 | // LLVM does not support these object formats: |
| 139 | 139 | .c, |
| ... | ... | @@ -221,7 +221,7 @@ pub fn hasLldSupport(ofmt: std.Target.ObjectFormat) bool { |
| 221 | 221 | /// Used to select between LLVM backend and self-hosted backend when compiling in |
| 222 | 222 | /// debug mode. A given target should only return true here if it is passing greater |
| 223 | 223 | /// than or equal to the number of behavior tests as the respective LLVM backend. |
| 224 | pub fn selfHostedBackendIsAsRobustAsLlvm(target: std.Target) bool { | |
| 224 | pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool { | |
| 225 | 225 | if (target.cpu.arch.isSpirV()) return true; |
| 226 | 226 | if (target.cpu.arch == .x86_64 and target.ptrBitWidth() == 64) return switch (target.ofmt) { |
| 227 | 227 | .elf, .macho => true, |
| ... | ... | @@ -230,12 +230,12 @@ pub fn selfHostedBackendIsAsRobustAsLlvm(target: std.Target) bool { |
| 230 | 230 | return false; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | pub fn supportsStackProbing(target: std.Target) bool { | |
| 233 | pub fn supportsStackProbing(target: *const std.Target) bool { | |
| 234 | 234 | return target.os.tag != .windows and target.os.tag != .uefi and |
| 235 | 235 | (target.cpu.arch == .x86 or target.cpu.arch == .x86_64); |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | pub fn supportsStackProtector(target: std.Target, backend: std.builtin.CompilerBackend) bool { | |
| 238 | pub fn supportsStackProtector(target: *const std.Target, backend: std.builtin.CompilerBackend) bool { | |
| 239 | 239 | switch (target.os.tag) { |
| 240 | 240 | .plan9 => return false, |
| 241 | 241 | else => {}, |
| ... | ... | @@ -250,20 +250,20 @@ pub fn supportsStackProtector(target: std.Target, backend: std.builtin.CompilerB |
| 250 | 250 | }; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | pub fn clangSupportsStackProtector(target: std.Target) bool { | |
| 253 | pub fn clangSupportsStackProtector(target: *const std.Target) bool { | |
| 254 | 254 | return switch (target.cpu.arch) { |
| 255 | 255 | .spirv, .spirv32, .spirv64 => return false, |
| 256 | 256 | else => true, |
| 257 | 257 | }; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | pub fn libcProvidesStackProtector(target: std.Target) bool { | |
| 260 | pub fn libcProvidesStackProtector(target: *const std.Target) bool { | |
| 261 | 261 | return !target.isMinGW() and target.os.tag != .wasi and !target.cpu.arch.isSpirV(); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /// Returns true if `@returnAddress()` is supported by the target and has a |
| 265 | 265 | /// reasonably performant implementation for the requested optimization mode. |
| 266 | pub fn supportsReturnAddress(target: std.Target, optimize: std.builtin.OptimizeMode) bool { | |
| 266 | pub fn supportsReturnAddress(target: *const std.Target, optimize: std.builtin.OptimizeMode) bool { | |
| 267 | 267 | return switch (target.cpu.arch) { |
| 268 | 268 | // Emscripten currently implements `emscripten_return_address()` by calling |
| 269 | 269 | // out into JavaScript and parsing a stack trace, which introduces significant |
| ... | ... | @@ -299,7 +299,7 @@ pub fn classifyCompilerRtLibName(name: []const u8) CompilerRtClassification { |
| 299 | 299 | return .none; |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | pub fn hasDebugInfo(target: std.Target) bool { | |
| 302 | pub fn hasDebugInfo(target: *const std.Target) bool { | |
| 303 | 303 | return switch (target.cpu.arch) { |
| 304 | 304 | // TODO: We should make newer PTX versions depend on older ones so we'd just check `ptx75`. |
| 305 | 305 | .nvptx, .nvptx64 => target.cpu.hasAny(.nvptx, &.{ |
| ... | ... | @@ -321,7 +321,7 @@ pub fn hasDebugInfo(target: std.Target) bool { |
| 321 | 321 | }; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | pub fn defaultCompilerRtOptimizeMode(target: std.Target) std.builtin.OptimizeMode { | |
| 324 | pub fn defaultCompilerRtOptimizeMode(target: *const std.Target) std.builtin.OptimizeMode { | |
| 325 | 325 | if (target.cpu.arch.isWasm() and target.os.tag == .freestanding) { |
| 326 | 326 | return .ReleaseSmall; |
| 327 | 327 | } else { |
| ... | ... | @@ -329,7 +329,7 @@ pub fn defaultCompilerRtOptimizeMode(target: std.Target) std.builtin.OptimizeMod |
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | pub fn canBuildLibCompilerRt(target: std.Target, use_llvm: bool, have_llvm: bool) bool { | |
| 332 | pub fn canBuildLibCompilerRt(target: *const std.Target, use_llvm: bool, have_llvm: bool) bool { | |
| 333 | 333 | switch (target.os.tag) { |
| 334 | 334 | .plan9 => return false, |
| 335 | 335 | else => {}, |
| ... | ... | @@ -342,12 +342,15 @@ pub fn canBuildLibCompilerRt(target: std.Target, use_llvm: bool, have_llvm: bool |
| 342 | 342 | } |
| 343 | 343 | return switch (zigBackend(target, use_llvm)) { |
| 344 | 344 | .stage2_llvm => true, |
| 345 | .stage2_x86_64 => if (target.ofmt == .elf or target.ofmt == .macho) true else have_llvm, | |
| 345 | .stage2_x86_64 => switch (target.ofmt) { | |
| 346 | .elf, .macho => true, | |
| 347 | else => have_llvm, | |
| 348 | }, | |
| 346 | 349 | else => have_llvm, |
| 347 | 350 | }; |
| 348 | 351 | } |
| 349 | 352 | |
| 350 | pub fn canBuildLibUbsanRt(target: std.Target) bool { | |
| 353 | pub fn canBuildLibUbsanRt(target: *const std.Target) bool { | |
| 351 | 354 | switch (target.cpu.arch) { |
| 352 | 355 | .spirv, .spirv32, .spirv64 => return false, |
| 353 | 356 | // Remove this once https://github.com/ziglang/zig/issues/23715 is fixed |
| ... | ... | @@ -356,7 +359,7 @@ pub fn canBuildLibUbsanRt(target: std.Target) bool { |
| 356 | 359 | } |
| 357 | 360 | } |
| 358 | 361 | |
| 359 | pub fn hasRedZone(target: std.Target) bool { | |
| 362 | pub fn hasRedZone(target: *const std.Target) bool { | |
| 360 | 363 | return switch (target.cpu.arch) { |
| 361 | 364 | .aarch64, |
| 362 | 365 | .aarch64_be, |
| ... | ... | @@ -372,7 +375,7 @@ pub fn hasRedZone(target: std.Target) bool { |
| 372 | 375 | }; |
| 373 | 376 | } |
| 374 | 377 | |
| 375 | pub fn libcFullLinkFlags(target: std.Target) []const []const u8 { | |
| 378 | pub fn libcFullLinkFlags(target: *const std.Target) []const []const u8 { | |
| 376 | 379 | // The linking order of these is significant and should match the order other |
| 377 | 380 | // c compilers such as gcc or clang use. |
| 378 | 381 | const result: []const []const u8 = switch (target.os.tag) { |
| ... | ... | @@ -389,14 +392,14 @@ pub fn libcFullLinkFlags(target: std.Target) []const []const u8 { |
| 389 | 392 | return result; |
| 390 | 393 | } |
| 391 | 394 | |
| 392 | pub fn clangMightShellOutForAssembly(target: std.Target) bool { | |
| 395 | pub fn clangMightShellOutForAssembly(target: *const std.Target) bool { | |
| 393 | 396 | // Clang defaults to using the system assembler in some cases. |
| 394 | 397 | return target.cpu.arch.isNvptx() or target.cpu.arch == .xcore; |
| 395 | 398 | } |
| 396 | 399 | |
| 397 | 400 | /// Each backend architecture in Clang has a different codepath which may or may not |
| 398 | 401 | /// support an -mcpu flag. |
| 399 | pub fn clangAssemblerSupportsMcpuArg(target: std.Target) bool { | |
| 402 | pub fn clangAssemblerSupportsMcpuArg(target: *const std.Target) bool { | |
| 400 | 403 | return switch (target.cpu.arch) { |
| 401 | 404 | .arm, .armeb, .thumb, .thumbeb => true, |
| 402 | 405 | else => false, |
| ... | ... | @@ -405,7 +408,7 @@ pub fn clangAssemblerSupportsMcpuArg(target: std.Target) bool { |
| 405 | 408 | |
| 406 | 409 | /// Some experimental or poorly-maintained LLVM targets do not properly process CPU models in their |
| 407 | 410 | /// Clang driver code. For these, we should omit the `-Xclang -target-cpu -Xclang <model>` flags. |
| 408 | pub fn clangSupportsTargetCpuArg(target: std.Target) bool { | |
| 411 | pub fn clangSupportsTargetCpuArg(target: *const std.Target) bool { | |
| 409 | 412 | return switch (target.cpu.arch) { |
| 410 | 413 | .arc, |
| 411 | 414 | .msp430, |
| ... | ... | @@ -417,7 +420,7 @@ pub fn clangSupportsTargetCpuArg(target: std.Target) bool { |
| 417 | 420 | }; |
| 418 | 421 | } |
| 419 | 422 | |
| 420 | pub fn clangSupportsFloatAbiArg(target: std.Target) bool { | |
| 423 | pub fn clangSupportsFloatAbiArg(target: *const std.Target) bool { | |
| 421 | 424 | return switch (target.cpu.arch) { |
| 422 | 425 | .arm, |
| 423 | 426 | .armeb, |
| ... | ... | @@ -442,7 +445,7 @@ pub fn clangSupportsFloatAbiArg(target: std.Target) bool { |
| 442 | 445 | }; |
| 443 | 446 | } |
| 444 | 447 | |
| 445 | pub fn clangSupportsNoImplicitFloatArg(target: std.Target) bool { | |
| 448 | pub fn clangSupportsNoImplicitFloatArg(target: *const std.Target) bool { | |
| 446 | 449 | return switch (target.cpu.arch) { |
| 447 | 450 | .aarch64, |
| 448 | 451 | .aarch64_be, |
| ... | ... | @@ -459,7 +462,7 @@ pub fn clangSupportsNoImplicitFloatArg(target: std.Target) bool { |
| 459 | 462 | }; |
| 460 | 463 | } |
| 461 | 464 | |
| 462 | pub fn defaultUnwindTables(target: std.Target, libunwind: bool, libtsan: bool) std.builtin.UnwindTables { | |
| 465 | pub fn defaultUnwindTables(target: *const std.Target, libunwind: bool, libtsan: bool) std.builtin.UnwindTables { | |
| 463 | 466 | if (target.os.tag == .windows) { |
| 464 | 467 | // The old 32-bit x86 variant of SEH doesn't use tables. |
| 465 | 468 | return if (target.cpu.arch != .x86) .@"async" else .none; |
| ... | ... | @@ -472,7 +475,7 @@ pub fn defaultUnwindTables(target: std.Target, libunwind: bool, libtsan: bool) s |
| 472 | 475 | } |
| 473 | 476 | |
| 474 | 477 | pub fn defaultAddressSpace( |
| 475 | target: std.Target, | |
| 478 | target: *const std.Target, | |
| 476 | 479 | context: enum { |
| 477 | 480 | /// Query the default address space for global constant values. |
| 478 | 481 | global_constant, |
| ... | ... | @@ -492,7 +495,7 @@ pub fn defaultAddressSpace( |
| 492 | 495 | |
| 493 | 496 | /// Returns true if pointers in `from` can be converted to a pointer in `to`. |
| 494 | 497 | pub fn addrSpaceCastIsValid( |
| 495 | target: std.Target, | |
| 498 | target: *const std.Target, | |
| 496 | 499 | from: AddressSpace, |
| 497 | 500 | to: AddressSpace, |
| 498 | 501 | ) bool { |
| ... | ... | @@ -512,7 +515,7 @@ pub fn addrSpaceCastIsValid( |
| 512 | 515 | /// a number of restrictions on usage of such pointers. For example, a logical pointer may not be |
| 513 | 516 | /// part of a merge (result of a branch) and may not be stored in memory at all. This function returns |
| 514 | 517 | /// for a particular architecture and address space wether such pointers are logical. |
| 515 | pub fn arePointersLogical(target: std.Target, as: AddressSpace) bool { | |
| 518 | pub fn arePointersLogical(target: *const std.Target, as: AddressSpace) bool { | |
| 516 | 519 | if (target.os.tag != .vulkan) return false; |
| 517 | 520 | |
| 518 | 521 | return switch (as) { |
| ... | ... | @@ -537,7 +540,7 @@ pub fn arePointersLogical(target: std.Target, as: AddressSpace) bool { |
| 537 | 540 | }; |
| 538 | 541 | } |
| 539 | 542 | |
| 540 | pub fn isDynamicAMDGCNFeature(target: std.Target, feature: std.Target.Cpu.Feature) bool { | |
| 543 | pub fn isDynamicAMDGCNFeature(target: *const std.Target, feature: std.Target.Cpu.Feature) bool { | |
| 541 | 544 | if (target.cpu.arch != .amdgcn) return false; |
| 542 | 545 | |
| 543 | 546 | const sramecc_only = &[_]*const std.Target.Cpu.Model{ |
| ... | ... | @@ -585,7 +588,7 @@ pub fn isDynamicAMDGCNFeature(target: std.Target, feature: std.Target.Cpu.Featur |
| 585 | 588 | return false; |
| 586 | 589 | } |
| 587 | 590 | |
| 588 | pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 { | |
| 591 | pub fn llvmMachineAbi(target: *const std.Target) ?[:0]const u8 { | |
| 589 | 592 | // LLD does not support ELFv1. Rather than having LLVM produce ELFv1 code and then linking it |
| 590 | 593 | // into a broken ELFv2 binary, just force LLVM to use ELFv2 as well. This will break when glibc |
| 591 | 594 | // is linked as glibc only supports ELFv2 for little endian, but there's nothing we can do about |
| ... | ... | @@ -642,7 +645,7 @@ pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 { |
| 642 | 645 | |
| 643 | 646 | /// This function returns 1 if function alignment is not observable or settable. Note that this |
| 644 | 647 | /// value will not necessarily match the backend's default function alignment (e.g. for LLVM). |
| 645 | pub fn defaultFunctionAlignment(target: std.Target) Alignment { | |
| 648 | pub fn defaultFunctionAlignment(target: *const std.Target) Alignment { | |
| 646 | 649 | // Overrides of the minimum for performance. |
| 647 | 650 | return switch (target.cpu.arch) { |
| 648 | 651 | .csky, |
| ... | ... | @@ -669,7 +672,7 @@ pub fn defaultFunctionAlignment(target: std.Target) Alignment { |
| 669 | 672 | } |
| 670 | 673 | |
| 671 | 674 | /// This function returns 1 if function alignment is not observable or settable. |
| 672 | pub fn minFunctionAlignment(target: std.Target) Alignment { | |
| 675 | pub fn minFunctionAlignment(target: *const std.Target) Alignment { | |
| 673 | 676 | return switch (target.cpu.arch) { |
| 674 | 677 | .riscv32, |
| 675 | 678 | .riscv64, |
| ... | ... | @@ -712,7 +715,7 @@ pub fn minFunctionAlignment(target: std.Target) Alignment { |
| 712 | 715 | }; |
| 713 | 716 | } |
| 714 | 717 | |
| 715 | pub fn supportsFunctionAlignment(target: std.Target) bool { | |
| 718 | pub fn supportsFunctionAlignment(target: *const std.Target) bool { | |
| 716 | 719 | return switch (target.cpu.arch) { |
| 717 | 720 | .nvptx, |
| 718 | 721 | .nvptx64, |
| ... | ... | @@ -726,7 +729,7 @@ pub fn supportsFunctionAlignment(target: std.Target) bool { |
| 726 | 729 | }; |
| 727 | 730 | } |
| 728 | 731 | |
| 729 | pub fn functionPointerMask(target: std.Target) ?u64 { | |
| 732 | pub fn functionPointerMask(target: *const std.Target) ?u64 { | |
| 730 | 733 | // 32-bit Arm uses the LSB to mean that the target function contains Thumb code. |
| 731 | 734 | // MIPS uses the LSB to mean that the target function contains MIPS16/microMIPS code. |
| 732 | 735 | return if (target.cpu.arch.isArm() or target.cpu.arch.isMIPS32()) |
| ... | ... | @@ -737,7 +740,7 @@ pub fn functionPointerMask(target: std.Target) ?u64 { |
| 737 | 740 | null; |
| 738 | 741 | } |
| 739 | 742 | |
| 740 | pub fn supportsTailCall(target: std.Target, backend: std.builtin.CompilerBackend) bool { | |
| 743 | pub fn supportsTailCall(target: *const std.Target, backend: std.builtin.CompilerBackend) bool { | |
| 741 | 744 | switch (backend) { |
| 742 | 745 | .stage2_llvm => return @import("codegen/llvm.zig").supportsTailCall(target), |
| 743 | 746 | .stage2_c => return true, |
| ... | ... | @@ -745,7 +748,7 @@ pub fn supportsTailCall(target: std.Target, backend: std.builtin.CompilerBackend |
| 745 | 748 | } |
| 746 | 749 | } |
| 747 | 750 | |
| 748 | pub fn supportsThreads(target: std.Target, backend: std.builtin.CompilerBackend) bool { | |
| 751 | pub fn supportsThreads(target: *const std.Target, backend: std.builtin.CompilerBackend) bool { | |
| 749 | 752 | return switch (backend) { |
| 750 | 753 | .stage2_powerpc => true, |
| 751 | 754 | .stage2_x86_64 => target.ofmt == .macho or target.ofmt == .elf, |
| ... | ... | @@ -804,7 +807,7 @@ pub fn fnCallConvAllowsZigTypes(cc: std.builtin.CallingConvention) bool { |
| 804 | 807 | }; |
| 805 | 808 | } |
| 806 | 809 | |
| 807 | pub fn zigBackend(target: std.Target, use_llvm: bool) std.builtin.CompilerBackend { | |
| 810 | pub fn zigBackend(target: *const std.Target, use_llvm: bool) std.builtin.CompilerBackend { | |
| 808 | 811 | if (use_llvm) return .stage2_llvm; |
| 809 | 812 | if (target.ofmt == .c) return .stage2_c; |
| 810 | 813 | return switch (target.cpu.arch) { |
test/link/macho.zig+1-1| ... | ... | @@ -864,7 +864,7 @@ fn testLayout(b: *Build, opts: Options) *Step { |
| 864 | 864 | fn testLinkDirectlyCppTbd(b: *Build, opts: Options) *Step { |
| 865 | 865 | const test_step = addTestStep(b, "link-directly-cpp-tbd", opts); |
| 866 | 866 | |
| 867 | const sdk = std.zig.system.darwin.getSdk(b.allocator, opts.target.result) orelse | |
| 867 | const sdk = std.zig.system.darwin.getSdk(b.allocator, &opts.target.result) orelse | |
| 868 | 868 | @panic("macOS SDK is required to run the test"); |
| 869 | 869 | |
| 870 | 870 | const exe = addExecutable(b, opts, .{ |
test/src/Cases.zig+2-2| ... | ... | @@ -433,7 +433,7 @@ fn addFromDirInner( |
| 433 | 433 | // Cross-product to get all possible test combinations |
| 434 | 434 | for (targets) |target_query| { |
| 435 | 435 | const resolved_target = b.resolveTargetQuery(target_query); |
| 436 | const target = resolved_target.result; | |
| 436 | const target = &resolved_target.result; | |
| 437 | 437 | for (backends) |backend| { |
| 438 | 438 | if (backend == .stage2 and |
| 439 | 439 | target.cpu.arch != .wasm32 and target.cpu.arch != .x86_64 and target.cpu.arch != .spirv64) |
| ... | ... | @@ -708,7 +708,7 @@ pub fn lowerToBuildSteps( |
| 708 | 708 | }, |
| 709 | 709 | .Execution => |expected_stdout| no_exec: { |
| 710 | 710 | const run = if (case.target.result.ofmt == .c) run_step: { |
| 711 | if (getExternalExecutor(host, &case.target.result, .{ .link_libc = true }) != .native) { | |
| 711 | if (getExternalExecutor(&host, &case.target.result, .{ .link_libc = true }) != .native) { | |
| 712 | 712 | // We wouldn't be able to run the compiled C code. |
| 713 | 713 | break :no_exec; |
| 714 | 714 | } |
test/src/Debugger.zig+4-4| ... | ... | @@ -21,7 +21,7 @@ pub const Target = struct { |
| 21 | 21 | test_name_suffix: []const u8, |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | pub fn addTestsForTarget(db: *Debugger, target: Target) void { | |
| 24 | pub fn addTestsForTarget(db: *Debugger, target: *const Target) void { | |
| 25 | 25 | db.addLldbTest( |
| 26 | 26 | "basic", |
| 27 | 27 | target, |
| ... | ... | @@ -2376,7 +2376,7 @@ const File = struct { import: ?[]const u8 = null, path: []const u8, source: []co |
| 2376 | 2376 | fn addGdbTest( |
| 2377 | 2377 | db: *Debugger, |
| 2378 | 2378 | name: []const u8, |
| 2379 | target: Target, | |
| 2379 | target: *const Target, | |
| 2380 | 2380 | files: []const File, |
| 2381 | 2381 | commands: []const u8, |
| 2382 | 2382 | expected_output: []const []const u8, |
| ... | ... | @@ -2402,7 +2402,7 @@ fn addGdbTest( |
| 2402 | 2402 | fn addLldbTest( |
| 2403 | 2403 | db: *Debugger, |
| 2404 | 2404 | name: []const u8, |
| 2405 | target: Target, | |
| 2405 | target: *const Target, | |
| 2406 | 2406 | files: []const File, |
| 2407 | 2407 | commands: []const u8, |
| 2408 | 2408 | expected_output: []const []const u8, |
| ... | ... | @@ -2433,7 +2433,7 @@ const success = 99; |
| 2433 | 2433 | fn addTest( |
| 2434 | 2434 | db: *Debugger, |
| 2435 | 2435 | name: []const u8, |
| 2436 | target: Target, | |
| 2436 | target: *const Target, | |
| 2437 | 2437 | files: []const File, |
| 2438 | 2438 | db_argv1: []const []const u8, |
| 2439 | 2439 | db_commands: []const u8, |
test/src/StackTrace.zig+2-2| ... | ... | @@ -22,7 +22,7 @@ const Config = struct { |
| 22 | 22 | |
| 23 | 23 | pub fn addCase(self: *StackTrace, config: Config) void { |
| 24 | 24 | self.addCaseInner(config, true); |
| 25 | if (shouldTestNonLlvm(self.b.graph.host.result)) { | |
| 25 | if (shouldTestNonLlvm(&self.b.graph.host.result)) { | |
| 26 | 26 | self.addCaseInner(config, false); |
| 27 | 27 | } |
| 28 | 28 | } |
| ... | ... | @@ -41,7 +41,7 @@ fn addCaseInner(self: *StackTrace, config: Config, use_llvm: bool) void { |
| 41 | 41 | self.addExpect(config.name, config.source, .ReleaseSafe, use_llvm, per_mode); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | fn shouldTestNonLlvm(target: std.Target) bool { | |
| 44 | fn shouldTestNonLlvm(target: *const std.Target) bool { | |
| 45 | 45 | return switch (target.cpu.arch) { |
| 46 | 46 | .x86_64 => switch (target.ofmt) { |
| 47 | 47 | .elf => true, |
test/standalone/ios/build.zig+1-1| ... | ... | @@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void { |
| 12 | 12 | .cpu_arch = .aarch64, |
| 13 | 13 | .os_tag = .ios, |
| 14 | 14 | }); |
| 15 | const sdk = std.zig.system.darwin.getSdk(b.allocator, target.result) orelse | |
| 15 | const sdk = std.zig.system.darwin.getSdk(b.allocator, &target.result) orelse | |
| 16 | 16 | @panic("no iOS SDK found"); |
| 17 | 17 | b.sysroot = sdk; |
| 18 | 18 |
test/tests.zig+4-4| ... | ... | @@ -2311,7 +2311,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 2311 | 2311 | |
| 2312 | 2312 | const resolved_target = b.resolveTargetQuery(test_target.target); |
| 2313 | 2313 | const triple_txt = resolved_target.query.zigTriple(b.allocator) catch @panic("OOM"); |
| 2314 | const target = resolved_target.result; | |
| 2314 | const target = &resolved_target.result; | |
| 2315 | 2315 | |
| 2316 | 2316 | if (options.test_target_filters.len > 0) { |
| 2317 | 2317 | for (options.test_target_filters) |filter| { |
| ... | ... | @@ -2557,7 +2557,7 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step { |
| 2557 | 2557 | |
| 2558 | 2558 | const resolved_target = b.resolveTargetQuery(c_abi_target.target); |
| 2559 | 2559 | const triple_txt = resolved_target.query.zigTriple(b.allocator) catch @panic("OOM"); |
| 2560 | const target = resolved_target.result; | |
| 2560 | const target = &resolved_target.result; | |
| 2561 | 2561 | |
| 2562 | 2562 | if (options.test_target_filters.len > 0) { |
| 2563 | 2563 | for (options.test_target_filters) |filter| { |
| ... | ... | @@ -2659,7 +2659,7 @@ pub fn addDebuggerTests(b: *std.Build, options: DebuggerContext.Options) ?*Step |
| 2659 | 2659 | .options = options, |
| 2660 | 2660 | .root_step = step, |
| 2661 | 2661 | }; |
| 2662 | context.addTestsForTarget(.{ | |
| 2662 | context.addTestsForTarget(&.{ | |
| 2663 | 2663 | .resolved = b.resolveTargetQuery(.{ |
| 2664 | 2664 | .cpu_arch = .x86_64, |
| 2665 | 2665 | .os_tag = .linux, |
| ... | ... | @@ -2668,7 +2668,7 @@ pub fn addDebuggerTests(b: *std.Build, options: DebuggerContext.Options) ?*Step |
| 2668 | 2668 | .pic = false, |
| 2669 | 2669 | .test_name_suffix = "x86_64-linux", |
| 2670 | 2670 | }); |
| 2671 | context.addTestsForTarget(.{ | |
| 2671 | context.addTestsForTarget(&.{ | |
| 2672 | 2672 | .resolved = b.resolveTargetQuery(.{ |
| 2673 | 2673 | .cpu_arch = .x86_64, |
| 2674 | 2674 | .os_tag = .linux, |
tools/doctest.zig+2-2| ... | ... | @@ -317,7 +317,7 @@ fn printOutput( |
| 317 | 317 | const target = try std.zig.system.resolveTargetQuery( |
| 318 | 318 | target_query, |
| 319 | 319 | ); |
| 320 | switch (getExternalExecutor(host, &target, .{ | |
| 320 | switch (getExternalExecutor(&host, &target, .{ | |
| 321 | 321 | .link_libc = code.link_libc, |
| 322 | 322 | })) { |
| 323 | 323 | .native => {}, |
| ... | ... | @@ -538,7 +538,7 @@ fn printOutput( |
| 538 | 538 | .lib => { |
| 539 | 539 | const bin_basename = try std.zig.binNameAlloc(arena, .{ |
| 540 | 540 | .root_name = code_name, |
| 541 | .target = builtin.target, | |
| 541 | .target = &builtin.target, | |
| 542 | 542 | .output_mode = .Lib, |
| 543 | 543 | }); |
| 544 | 544 |
tools/incr-check.zig+2-2| ... | ... | @@ -316,7 +316,7 @@ const Eval = struct { |
| 316 | 316 | |
| 317 | 317 | const bin_name = try std.zig.EmitArtifact.bin.cacheName(arena, .{ |
| 318 | 318 | .root_name = "root", // corresponds to the module name "root" |
| 319 | .target = eval.target.resolved, | |
| 319 | .target = &eval.target.resolved, | |
| 320 | 320 | .output_mode = .Exe, |
| 321 | 321 | }); |
| 322 | 322 | const bin_path = try std.fs.path.join(arena, &.{ result_dir, bin_name }); |
| ... | ... | @@ -444,7 +444,7 @@ const Eval = struct { |
| 444 | 444 | |
| 445 | 445 | var argv_buf: [2][]const u8 = undefined; |
| 446 | 446 | const argv: []const []const u8, const is_foreign: bool = switch (std.zig.system.getExternalExecutor( |
| 447 | eval.host, | |
| 447 | &eval.host, | |
| 448 | 448 | &eval.target.resolved, |
| 449 | 449 | .{ .link_libc = eval.target.backend == .cbe }, |
| 450 | 450 | )) { |