From 9eb400ef19391261a3b61129d8665602c89959c5 Mon Sep 17 00:00:00 2001 From: mlugg Date: Thu, 29 May 2025 05:38:55 +0100 Subject: compiler: rework backend pipeline to separate codegen and link The idea here is that instead of the linker calling into codegen, instead codegen should run before we touch the linker, and after MIR is produced, it is sent to the linker. Aside from simplifying the call graph (by preventing N linkers from each calling into M codegen backends!), this has the huge benefit that it is possible to parallellize codegen separately from linking. The threading model can look like this: * 1 semantic analysis thread, which generates AIR * N codegen threads, which process AIR into MIR * 1 linker thread, which emits MIR to the binary The codegen threads are also responsible for `Air.Legalize` and `Air.Liveness`; it's more efficient to do this work here instead of blocking the main thread for this trivially parallel task. I have repurposed the `Zcu.Feature.separate_thread` backend feature to indicate support for this 1:N:1 threading pattern. This commit makes the C backend support this feature, since it was relatively easy to divorce from `link.C`: it just required eliminating some shared buffers. Other backends don't currently support this feature. In fact, they don't even compile -- the next few commits will fix them back up. --- src/codegen.zig | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 93 insertions(+), 4 deletions(-) (limited to 'src/codegen.zig') diff --git a/src/codegen.zig b/src/codegen.zig index a2de3e2d01..2c2524257c 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -85,16 +85,104 @@ pub fn legalizeFeatures(pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) ?*co } } +/// Every code generation backend has a different MIR representation. However, we want to pass +/// MIR from codegen to the linker *regardless* of which backend is in use. So, we use this: a +/// union of all MIR types. The active tag is known from the backend in use; see `AnyMir.tag`. +pub const AnyMir = union { + aarch64: @import("arch/aarch64/Mir.zig"), + arm: @import("arch/arm/Mir.zig"), + powerpc: noreturn, //@import("arch/powerpc/Mir.zig"), + riscv64: @import("arch/riscv64/Mir.zig"), + sparc64: @import("arch/sparc64/Mir.zig"), + x86_64: @import("arch/x86_64/Mir.zig"), + wasm: @import("arch/wasm/Mir.zig"), + c: @import("codegen/c.zig").Mir, + + pub inline fn tag(comptime backend: std.builtin.CompilerBackend) []const u8 { + return switch (backend) { + .stage2_aarch64 => "aarch64", + .stage2_arm => "arm", + .stage2_powerpc => "powerpc", + .stage2_riscv64 => "riscv64", + .stage2_sparc64 => "sparc64", + .stage2_x86_64 => "x86_64", + .stage2_wasm => "wasm", + .stage2_c => "c", + else => unreachable, + }; + } + + pub fn deinit(mir: *AnyMir, zcu: *const Zcu) void { + const gpa = zcu.gpa; + const backend = target_util.zigBackend(zcu.root_mod.resolved_target.result, zcu.comp.config.use_llvm); + switch (backend) { + else => unreachable, + inline .stage2_aarch64, + .stage2_arm, + .stage2_powerpc, + .stage2_riscv64, + .stage2_sparc64, + .stage2_x86_64, + .stage2_c, + => |backend_ct| @field(mir, tag(backend_ct)).deinit(gpa), + } + } +}; + +/// Runs code generation for a function. This process converts the `Air` emitted by `Sema`, +/// alongside annotated `Liveness` data, to machine code in the form of MIR (see `AnyMir`). +/// +/// This is supposed to be a "pure" process, but some backends are currently buggy; see +/// `Zcu.Feature.separate_thread` for details. pub fn generateFunction( lf: *link.File, pt: Zcu.PerThread, src_loc: Zcu.LazySrcLoc, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, + air: *const Air, + liveness: *const Air.Liveness, +) CodeGenError!AnyMir { + const zcu = pt.zcu; + const func = zcu.funcInfo(func_index); + const target = zcu.navFileScope(func.owner_nav).mod.?.resolved_target.result; + switch (target_util.zigBackend(target, false)) { + else => unreachable, + inline .stage2_aarch64, + .stage2_arm, + .stage2_powerpc, + .stage2_riscv64, + .stage2_sparc64, + .stage2_x86_64, + .stage2_c, + => |backend| { + dev.check(devFeatureForBackend(backend)); + const CodeGen = importBackend(backend); + const mir = try CodeGen.generate(lf, pt, src_loc, func_index, air, liveness); + return @unionInit(AnyMir, AnyMir.tag(backend), mir); + }, + } +} + +/// Converts the MIR returned by `generateFunction` to finalized machine code to be placed in +/// the output binary. This is called from linker implementations, and may query linker state. +/// +/// This function is not called for the C backend, as `link.C` directly understands its MIR. +/// +/// The `air` parameter is not supposed to exist, but some backends are currently buggy; see +/// `Zcu.Feature.separate_thread` for details. +pub fn emitFunction( + lf: *link.File, + pt: Zcu.PerThread, + src_loc: Zcu.LazySrcLoc, + func_index: InternPool.Index, + any_mir: *const AnyMir, code: *std.ArrayListUnmanaged(u8), debug_output: link.File.DebugInfoOutput, -) CodeGenError!void { + /// TODO: this parameter needs to be removed. We should not still hold AIR this late + /// in the pipeline. Any information needed to call emit must be stored in MIR. + /// This is `undefined` if the backend supports the `separate_thread` feature. + air: *const Air, +) Allocator.Error!void { const zcu = pt.zcu; const func = zcu.funcInfo(func_index); const target = zcu.navFileScope(func.owner_nav).mod.?.resolved_target.result; @@ -108,7 +196,8 @@ pub fn generateFunction( .stage2_x86_64, => |backend| { dev.check(devFeatureForBackend(backend)); - return importBackend(backend).generate(lf, pt, src_loc, func_index, air, liveness, code, debug_output); + const mir = &@field(any_mir, AnyMir.tag(backend)); + return mir.emit(lf, pt, src_loc, func_index, code, debug_output, air); }, } } -- cgit v1.2.3 From 5ab307cf47b1f0418d9ed4ab56df6fb798305c20 Mon Sep 17 00:00:00 2001 From: mlugg Date: Sun, 1 Jun 2025 22:57:59 +0100 Subject: compiler: get most backends compiling again As of this commit, every backend other than self-hosted Wasm and self-hosted SPIR-V compiles and (at least somewhat) functions again. Those two backends are currently disabled with panics. Note that `Zcu.Feature.separate_thread` is *not* enabled for the fixed backends. Avoiding linker references from codegen is a non-trivial task, and can be done after this branch. --- src/Compilation.zig | 8 ++-- src/Zcu/PerThread.zig | 28 +++++++++--- src/arch/aarch64/CodeGen.zig | 46 +++++++------------ src/arch/aarch64/Mir.zig | 43 ++++++++++++++++++ src/arch/arm/CodeGen.zig | 48 +++++++------------- src/arch/arm/Mir.zig | 43 ++++++++++++++++++ src/arch/powerpc/CodeGen.zig | 10 ++--- src/arch/riscv64/CodeGen.zig | 51 ++++++--------------- src/arch/riscv64/Mir.zig | 50 +++++++++++++++++++++ src/arch/sparc64/CodeGen.zig | 45 ++++++------------- src/arch/sparc64/Mir.zig | 39 +++++++++++++++- src/arch/x86_64/CodeGen.zig | 104 ++++++++++++++----------------------------- src/arch/x86_64/Mir.zig | 65 +++++++++++++++++++++++++++ src/codegen.zig | 2 +- src/libs/freebsd.zig | 2 +- src/libs/glibc.zig | 2 +- src/libs/netbsd.zig | 2 +- src/link.zig | 2 + src/link/Coff.zig | 12 ++--- src/link/Goff.zig | 9 ++-- src/link/MachO.zig | 6 +-- src/link/MachO/ZigObject.zig | 12 ++--- src/link/Plan9.zig | 12 ++--- src/link/Queue.zig | 3 +- src/link/Xcoff.zig | 9 ++-- 25 files changed, 402 insertions(+), 251 deletions(-) (limited to 'src/codegen.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 64ec1ab0a8..e967935539 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -4550,8 +4550,6 @@ fn processOneJob(tid: usize, comp: *Compilation, job: Job) JobError!void { air.deinit(gpa); return; } - const pt: Zcu.PerThread = .activate(comp.zcu.?, @enumFromInt(tid)); - defer pt.deactivate(); const shared_mir = try gpa.create(link.ZcuTask.LinkFunc.SharedMir); shared_mir.* = .{ .status = .init(.pending), @@ -4567,7 +4565,11 @@ fn processOneJob(tid: usize, comp: *Compilation, job: Job) JobError!void { } }); } else { const emit_needs_air = !zcu.backendSupportsFeature(.separate_thread); - pt.runCodegen(func.func, &air, shared_mir); + { + const pt: Zcu.PerThread = .activate(comp.zcu.?, @enumFromInt(tid)); + defer pt.deactivate(); + pt.runCodegen(func.func, &air, shared_mir); + } assert(shared_mir.status.load(.monotonic) != .pending); comp.dispatchZcuLinkTask(tid, .{ .link_func = .{ .func = func.func, diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index 92f1adbf2a..6475649a68 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -4376,26 +4376,40 @@ pub fn addDependency(pt: Zcu.PerThread, unit: AnalUnit, dependee: InternPool.Dep /// other code. This function is currently run either on the main thread, or on a separate /// codegen thread, depending on whether the backend supports `Zcu.Feature.separate_thread`. pub fn runCodegen(pt: Zcu.PerThread, func_index: InternPool.Index, air: *Air, out: *@import("../link.zig").ZcuTask.LinkFunc.SharedMir) void { + const zcu = pt.zcu; if (runCodegenInner(pt, func_index, air)) |mir| { out.value = mir; out.status.store(.ready, .release); } else |err| switch (err) { error.OutOfMemory => { - pt.zcu.comp.setAllocFailure(); + zcu.comp.setAllocFailure(); out.status.store(.failed, .monotonic); }, error.CodegenFail => { - pt.zcu.assertCodegenFailed(pt.zcu.funcInfo(func_index).owner_nav); + zcu.assertCodegenFailed(zcu.funcInfo(func_index).owner_nav); out.status.store(.failed, .monotonic); }, error.NoLinkFile => { - assert(pt.zcu.comp.bin_file == null); + assert(zcu.comp.bin_file == null); + out.status.store(.failed, .monotonic); + }, + error.BackendDoesNotProduceMir => { + const backend = target_util.zigBackend(zcu.root_mod.resolved_target.result, zcu.comp.config.use_llvm); + switch (backend) { + else => unreachable, // assertion failure + .stage2_llvm => {}, + } out.status.store(.failed, .monotonic); }, } - pt.zcu.comp.link_task_queue.mirReady(pt.zcu.comp, out); + zcu.comp.link_task_queue.mirReady(zcu.comp, out); } -fn runCodegenInner(pt: Zcu.PerThread, func_index: InternPool.Index, air: *Air) error{ OutOfMemory, CodegenFail, NoLinkFile }!codegen.AnyMir { +fn runCodegenInner(pt: Zcu.PerThread, func_index: InternPool.Index, air: *Air) error{ + OutOfMemory, + CodegenFail, + NoLinkFile, + BackendDoesNotProduceMir, +}!codegen.AnyMir { const zcu = pt.zcu; const gpa = zcu.gpa; const ip = &zcu.intern_pool; @@ -4441,7 +4455,9 @@ fn runCodegenInner(pt: Zcu.PerThread, func_index: InternPool.Index, air: *Air) e // "emit" step because LLVM does not support incremental linking. Our linker (LLD or self-hosted) // will just see the ZCU object file which LLVM ultimately emits. if (zcu.llvm_object) |llvm_object| { - return llvm_object.updateFunc(pt, func_index, air, &liveness); + assert(pt.tid == .main); // LLVM has a lot of shared state + try llvm_object.updateFunc(pt, func_index, air, &liveness); + return error.BackendDoesNotProduceMir; } const lf = comp.bin_file orelse return error.NoLinkFile; diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig index 00cceb0c67..0c29fd96e2 100644 --- a/src/arch/aarch64/CodeGen.zig +++ b/src/arch/aarch64/CodeGen.zig @@ -49,7 +49,6 @@ pt: Zcu.PerThread, air: Air, liveness: Air.Liveness, bin_file: *link.File, -debug_output: link.File.DebugInfoOutput, target: *const std.Target, func_index: InternPool.Index, owner_nav: InternPool.Nav.Index, @@ -185,6 +184,9 @@ const DbgInfoReloc = struct { } fn genArgDbgInfo(reloc: DbgInfoReloc, function: Self) !void { + // TODO: Add a pseudo-instruction or something to defer this work until Emit. + // We aren't allowed to interact with linker state here. + if (true) return; switch (function.debug_output) { .dwarf => |dw| { const loc: link.File.Dwarf.Loc = switch (reloc.mcv) { @@ -213,6 +215,9 @@ const DbgInfoReloc = struct { } fn genVarDbgInfo(reloc: DbgInfoReloc, function: Self) !void { + // TODO: Add a pseudo-instruction or something to defer this work until Emit. + // We aren't allowed to interact with linker state here. + if (true) return; switch (function.debug_output) { .dwarf => |dwarf| { const loc: link.File.Dwarf.Loc = switch (reloc.mcv) { @@ -326,11 +331,9 @@ pub fn generate( pt: Zcu.PerThread, src_loc: Zcu.LazySrcLoc, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, - code: *std.ArrayListUnmanaged(u8), - debug_output: link.File.DebugInfoOutput, -) CodeGenError!void { + air: *const Air, + liveness: *const Air.Liveness, +) CodeGenError!Mir { const zcu = pt.zcu; const gpa = zcu.gpa; const func = zcu.funcInfo(func_index); @@ -349,9 +352,8 @@ pub fn generate( var function: Self = .{ .gpa = gpa, .pt = pt, - .air = air, - .liveness = liveness, - .debug_output = debug_output, + .air = air.*, + .liveness = liveness.*, .target = target, .bin_file = lf, .func_index = func_index, @@ -395,29 +397,13 @@ pub fn generate( var mir: Mir = .{ .instructions = function.mir_instructions.toOwnedSlice(), - .extra = try function.mir_extra.toOwnedSlice(gpa), - }; - defer mir.deinit(gpa); - - var emit: Emit = .{ - .mir = mir, - .bin_file = lf, - .debug_output = debug_output, - .target = target, - .src_loc = src_loc, - .code = code, - .prev_di_pc = 0, - .prev_di_line = func.lbrace_line, - .prev_di_column = func.lbrace_column, - .stack_size = function.max_end_stack, + .extra = &.{}, // fallible, so assign after errdefer + .max_end_stack = function.max_end_stack, .saved_regs_stack_space = function.saved_regs_stack_space, }; - defer emit.deinit(); - - emit.emitMir() catch |err| switch (err) { - error.EmitFail => return function.failMsg(emit.err_msg.?), - else => |e| return e, - }; + errdefer mir.deinit(gpa); + mir.extra = try function.mir_extra.toOwnedSlice(gpa); + return mir; } fn addInst(self: *Self, inst: Mir.Inst) error{OutOfMemory}!Mir.Inst.Index { diff --git a/src/arch/aarch64/Mir.zig b/src/arch/aarch64/Mir.zig index edf05f625e..34fcc64c7e 100644 --- a/src/arch/aarch64/Mir.zig +++ b/src/arch/aarch64/Mir.zig @@ -13,6 +13,14 @@ const assert = std.debug.assert; const bits = @import("bits.zig"); const Register = bits.Register; +const InternPool = @import("../../InternPool.zig"); +const Emit = @import("Emit.zig"); +const codegen = @import("../../codegen.zig"); +const link = @import("../../link.zig"); +const Zcu = @import("../../Zcu.zig"); + +max_end_stack: u32, +saved_regs_stack_space: u32, instructions: std.MultiArrayList(Inst).Slice, /// The meaning of this data is determined by `Inst.Tag` value. @@ -498,6 +506,41 @@ pub fn deinit(mir: *Mir, gpa: std.mem.Allocator) void { mir.* = undefined; } +pub fn emit( + mir: Mir, + lf: *link.File, + pt: Zcu.PerThread, + src_loc: Zcu.LazySrcLoc, + func_index: InternPool.Index, + code: *std.ArrayListUnmanaged(u8), + debug_output: link.File.DebugInfoOutput, + air: *const @import("../../Air.zig"), +) codegen.CodeGenError!void { + _ = air; // using this would be a bug + const zcu = pt.zcu; + const func = zcu.funcInfo(func_index); + const nav = func.owner_nav; + const mod = zcu.navFileScope(nav).mod.?; + var e: Emit = .{ + .mir = mir, + .bin_file = lf, + .debug_output = debug_output, + .target = &mod.resolved_target.result, + .src_loc = src_loc, + .code = code, + .prev_di_pc = 0, + .prev_di_line = func.lbrace_line, + .prev_di_column = func.lbrace_column, + .stack_size = mir.max_end_stack, + .saved_regs_stack_space = mir.saved_regs_stack_space, + }; + defer e.deinit(); + e.emitMir() catch |err| switch (err) { + error.EmitFail => return zcu.codegenFailMsg(nav, e.err_msg.?), + else => |e1| return e1, + }; +} + /// Returns the requested data, as well as the new index which is at the start of the /// trailers for the object. pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end: usize } { diff --git a/src/arch/arm/CodeGen.zig b/src/arch/arm/CodeGen.zig index 421ba7d753..3868011557 100644 --- a/src/arch/arm/CodeGen.zig +++ b/src/arch/arm/CodeGen.zig @@ -50,7 +50,6 @@ pt: Zcu.PerThread, air: Air, liveness: Air.Liveness, bin_file: *link.File, -debug_output: link.File.DebugInfoOutput, target: *const std.Target, func_index: InternPool.Index, err_msg: ?*ErrorMsg, @@ -264,6 +263,9 @@ const DbgInfoReloc = struct { } fn genArgDbgInfo(reloc: DbgInfoReloc, function: Self) !void { + // TODO: Add a pseudo-instruction or something to defer this work until Emit. + // We aren't allowed to interact with linker state here. + if (true) return; switch (function.debug_output) { .dwarf => |dw| { const loc: link.File.Dwarf.Loc = switch (reloc.mcv) { @@ -292,6 +294,9 @@ const DbgInfoReloc = struct { } fn genVarDbgInfo(reloc: DbgInfoReloc, function: Self) !void { + // TODO: Add a pseudo-instruction or something to defer this work until Emit. + // We aren't allowed to interact with linker state here. + if (true) return; switch (function.debug_output) { .dwarf => |dw| { const loc: link.File.Dwarf.Loc = switch (reloc.mcv) { @@ -335,11 +340,9 @@ pub fn generate( pt: Zcu.PerThread, src_loc: Zcu.LazySrcLoc, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, - code: *std.ArrayListUnmanaged(u8), - debug_output: link.File.DebugInfoOutput, -) CodeGenError!void { + air: *const Air, + liveness: *const Air.Liveness, +) CodeGenError!Mir { const zcu = pt.zcu; const gpa = zcu.gpa; const func = zcu.funcInfo(func_index); @@ -358,11 +361,10 @@ pub fn generate( var function: Self = .{ .gpa = gpa, .pt = pt, - .air = air, - .liveness = liveness, + .air = air.*, + .liveness = liveness.*, .target = target, .bin_file = lf, - .debug_output = debug_output, .func_index = func_index, .err_msg = null, .args = undefined, // populated after `resolveCallingConventionValues` @@ -402,31 +404,15 @@ pub fn generate( return function.fail("failed to generate debug info: {s}", .{@errorName(err)}); } - var mir = Mir{ + var mir: Mir = .{ .instructions = function.mir_instructions.toOwnedSlice(), - .extra = try function.mir_extra.toOwnedSlice(gpa), - }; - defer mir.deinit(gpa); - - var emit = Emit{ - .mir = mir, - .bin_file = lf, - .debug_output = debug_output, - .target = target, - .src_loc = src_loc, - .code = code, - .prev_di_pc = 0, - .prev_di_line = func.lbrace_line, - .prev_di_column = func.lbrace_column, - .stack_size = function.max_end_stack, + .extra = &.{}, // fallible, so assign after errdefer + .max_end_stack = function.max_end_stack, .saved_regs_stack_space = function.saved_regs_stack_space, }; - defer emit.deinit(); - - emit.emitMir() catch |err| switch (err) { - error.EmitFail => return function.failMsg(emit.err_msg.?), - else => |e| return e, - }; + errdefer mir.deinit(gpa); + mir.extra = try function.mir_extra.toOwnedSlice(gpa); + return mir; } fn addInst(self: *Self, inst: Mir.Inst) error{OutOfMemory}!Mir.Inst.Index { diff --git a/src/arch/arm/Mir.zig b/src/arch/arm/Mir.zig index 5e651b7939..0366663eae 100644 --- a/src/arch/arm/Mir.zig +++ b/src/arch/arm/Mir.zig @@ -13,6 +13,14 @@ const assert = std.debug.assert; const bits = @import("bits.zig"); const Register = bits.Register; +const InternPool = @import("../../InternPool.zig"); +const Emit = @import("Emit.zig"); +const codegen = @import("../../codegen.zig"); +const link = @import("../../link.zig"); +const Zcu = @import("../../Zcu.zig"); + +max_end_stack: u32, +saved_regs_stack_space: u32, instructions: std.MultiArrayList(Inst).Slice, /// The meaning of this data is determined by `Inst.Tag` value. @@ -278,6 +286,41 @@ pub fn deinit(mir: *Mir, gpa: std.mem.Allocator) void { mir.* = undefined; } +pub fn emit( + mir: Mir, + lf: *link.File, + pt: Zcu.PerThread, + src_loc: Zcu.LazySrcLoc, + func_index: InternPool.Index, + code: *std.ArrayListUnmanaged(u8), + debug_output: link.File.DebugInfoOutput, + air: *const @import("../../Air.zig"), +) codegen.CodeGenError!void { + _ = air; // using this would be a bug + const zcu = pt.zcu; + const func = zcu.funcInfo(func_index); + const nav = func.owner_nav; + const mod = zcu.navFileScope(nav).mod.?; + var e: Emit = .{ + .mir = mir, + .bin_file = lf, + .debug_output = debug_output, + .target = &mod.resolved_target.result, + .src_loc = src_loc, + .code = code, + .prev_di_pc = 0, + .prev_di_line = func.lbrace_line, + .prev_di_column = func.lbrace_column, + .stack_size = mir.max_end_stack, + .saved_regs_stack_space = mir.saved_regs_stack_space, + }; + defer e.deinit(); + e.emitMir() catch |err| switch (err) { + error.EmitFail => return zcu.codegenFailMsg(nav, e.err_msg.?), + else => |e1| return e1, + }; +} + /// Returns the requested data, as well as the new index which is at the start of the /// trailers for the object. pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end: usize } { diff --git a/src/arch/powerpc/CodeGen.zig b/src/arch/powerpc/CodeGen.zig index 0cfee67ebd..4964fe19f4 100644 --- a/src/arch/powerpc/CodeGen.zig +++ b/src/arch/powerpc/CodeGen.zig @@ -19,19 +19,15 @@ pub fn generate( pt: Zcu.PerThread, src_loc: Zcu.LazySrcLoc, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, - code: *std.ArrayListUnmanaged(u8), - debug_output: link.File.DebugInfoOutput, -) codegen.CodeGenError!void { + air: *const Air, + liveness: *const Air.Liveness, +) codegen.CodeGenError!noreturn { _ = bin_file; _ = pt; _ = src_loc; _ = func_index; _ = air; _ = liveness; - _ = code; - _ = debug_output; unreachable; } diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig index 9fc51bd2d3..9b5e0ed69b 100644 --- a/src/arch/riscv64/CodeGen.zig +++ b/src/arch/riscv64/CodeGen.zig @@ -68,7 +68,6 @@ gpa: Allocator, mod: *Package.Module, target: *const std.Target, -debug_output: link.File.DebugInfoOutput, args: []MCValue, ret_mcv: InstTracking, fn_type: Type, @@ -746,13 +745,10 @@ pub fn generate( pt: Zcu.PerThread, src_loc: Zcu.LazySrcLoc, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, - code: *std.ArrayListUnmanaged(u8), - debug_output: link.File.DebugInfoOutput, -) CodeGenError!void { + air: *const Air, + liveness: *const Air.Liveness, +) CodeGenError!Mir { const zcu = pt.zcu; - const comp = zcu.comp; const gpa = zcu.gpa; const ip = &zcu.intern_pool; const func = zcu.funcInfo(func_index); @@ -769,13 +765,12 @@ pub fn generate( var function: Func = .{ .gpa = gpa, - .air = air, + .air = air.*, .pt = pt, .mod = mod, .bin_file = bin_file, - .liveness = liveness, + .liveness = liveness.*, .target = &mod.resolved_target.result, - .debug_output = debug_output, .owner = .{ .nav_index = func.owner_nav }, .args = undefined, // populated after `resolveCallingConventionValues` .ret_mcv = undefined, // populated after `resolveCallingConventionValues` @@ -855,33 +850,8 @@ pub fn generate( .instructions = function.mir_instructions.toOwnedSlice(), .frame_locs = function.frame_locs.toOwnedSlice(), }; - defer mir.deinit(gpa); - - var emit: Emit = .{ - .lower = .{ - .pt = pt, - .allocator = gpa, - .mir = mir, - .cc = fn_info.cc, - .src_loc = src_loc, - .output_mode = comp.config.output_mode, - .link_mode = comp.config.link_mode, - .pic = mod.pic, - }, - .bin_file = bin_file, - .debug_output = debug_output, - .code = code, - .prev_di_pc = 0, - .prev_di_line = func.lbrace_line, - .prev_di_column = func.lbrace_column, - }; - defer emit.deinit(); - - emit.emitMir() catch |err| switch (err) { - error.LowerFail, error.EmitFail => return function.failMsg(emit.lower.err_msg.?), - error.InvalidInstruction => |e| return function.fail("emit MIR failed: {s} (Zig compiler bug)", .{@errorName(e)}), - else => |e| return e, - }; + errdefer mir.deinit(gpa); + return mir; } pub fn generateLazy( @@ -904,7 +874,6 @@ pub fn generateLazy( .bin_file = bin_file, .liveness = undefined, .target = &mod.resolved_target.result, - .debug_output = debug_output, .owner = .{ .lazy_sym = lazy_sym }, .args = undefined, // populated after `resolveCallingConventionValues` .ret_mcv = undefined, // populated after `resolveCallingConventionValues` @@ -4760,6 +4729,9 @@ fn genArgDbgInfo(func: *const Func, inst: Air.Inst.Index, mcv: MCValue) InnerErr const ty = arg.ty.toType(); if (arg.name == .none) return; + // TODO: Add a pseudo-instruction or something to defer this work until Emit. + // We aren't allowed to interact with linker state here. + if (true) return; switch (func.debug_output) { .dwarf => |dw| switch (mcv) { .register => |reg| dw.genLocalDebugInfo( @@ -5273,6 +5245,9 @@ fn genVarDbgInfo( mcv: MCValue, name: []const u8, ) !void { + // TODO: Add a pseudo-instruction or something to defer this work until Emit. + // We aren't allowed to interact with linker state here. + if (true) return; switch (func.debug_output) { .dwarf => |dwarf| { const loc: link.File.Dwarf.Loc = switch (mcv) { diff --git a/src/arch/riscv64/Mir.zig b/src/arch/riscv64/Mir.zig index 2ae62fd9b2..eef3fe7511 100644 --- a/src/arch/riscv64/Mir.zig +++ b/src/arch/riscv64/Mir.zig @@ -109,6 +109,50 @@ pub fn deinit(mir: *Mir, gpa: std.mem.Allocator) void { mir.* = undefined; } +pub fn emit( + mir: Mir, + lf: *link.File, + pt: Zcu.PerThread, + src_loc: Zcu.LazySrcLoc, + func_index: InternPool.Index, + code: *std.ArrayListUnmanaged(u8), + debug_output: link.File.DebugInfoOutput, + air: *const @import("../../Air.zig"), +) codegen.CodeGenError!void { + _ = air; // using this would be a bug + const zcu = pt.zcu; + const comp = zcu.comp; + const gpa = comp.gpa; + const func = zcu.funcInfo(func_index); + const fn_info = zcu.typeToFunc(.fromInterned(func.ty)).?; + const nav = func.owner_nav; + const mod = zcu.navFileScope(nav).mod.?; + var e: Emit = .{ + .lower = .{ + .pt = pt, + .allocator = gpa, + .mir = mir, + .cc = fn_info.cc, + .src_loc = src_loc, + .output_mode = comp.config.output_mode, + .link_mode = comp.config.link_mode, + .pic = mod.pic, + }, + .bin_file = lf, + .debug_output = debug_output, + .code = code, + .prev_di_pc = 0, + .prev_di_line = func.lbrace_line, + .prev_di_column = func.lbrace_column, + }; + defer e.deinit(); + e.emitMir() catch |err| switch (err) { + error.LowerFail, error.EmitFail => return zcu.codegenFailMsg(nav, e.lower.err_msg.?), + error.InvalidInstruction => return zcu.codegenFail(nav, "emit MIR failed: {s} (Zig compiler bug)", .{@errorName(err)}), + else => |err1| return err1, + }; +} + pub const FrameLoc = struct { base: Register, disp: i32, @@ -202,3 +246,9 @@ const FrameIndex = bits.FrameIndex; const FrameAddr = @import("CodeGen.zig").FrameAddr; const IntegerBitSet = std.bit_set.IntegerBitSet; const Mnemonic = @import("mnem.zig").Mnemonic; + +const InternPool = @import("../../InternPool.zig"); +const Emit = @import("Emit.zig"); +const codegen = @import("../../codegen.zig"); +const link = @import("../../link.zig"); +const Zcu = @import("../../Zcu.zig"); diff --git a/src/arch/sparc64/CodeGen.zig b/src/arch/sparc64/CodeGen.zig index ad9884dcdb..180aaedd3c 100644 --- a/src/arch/sparc64/CodeGen.zig +++ b/src/arch/sparc64/CodeGen.zig @@ -57,8 +57,6 @@ liveness: Air.Liveness, bin_file: *link.File, target: *const std.Target, func_index: InternPool.Index, -code: *std.ArrayListUnmanaged(u8), -debug_output: link.File.DebugInfoOutput, err_msg: ?*ErrorMsg, args: []MCValue, ret_mcv: MCValue, @@ -268,11 +266,9 @@ pub fn generate( pt: Zcu.PerThread, src_loc: Zcu.LazySrcLoc, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, - code: *std.ArrayListUnmanaged(u8), - debug_output: link.File.DebugInfoOutput, -) CodeGenError!void { + air: *const Air, + liveness: *const Air.Liveness, +) CodeGenError!Mir { const zcu = pt.zcu; const gpa = zcu.gpa; const func = zcu.funcInfo(func_index); @@ -291,13 +287,11 @@ pub fn generate( var function: Self = .{ .gpa = gpa, .pt = pt, - .air = air, - .liveness = liveness, + .air = air.*, + .liveness = liveness.*, .target = target, .bin_file = lf, .func_index = func_index, - .code = code, - .debug_output = debug_output, .err_msg = null, .args = undefined, // populated after `resolveCallingConventionValues` .ret_mcv = undefined, // populated after `resolveCallingConventionValues` @@ -330,29 +324,13 @@ pub fn generate( else => |e| return e, }; - var mir = Mir{ + var mir: Mir = .{ .instructions = function.mir_instructions.toOwnedSlice(), - .extra = try function.mir_extra.toOwnedSlice(gpa), - }; - defer mir.deinit(gpa); - - var emit: Emit = .{ - .mir = mir, - .bin_file = lf, - .debug_output = debug_output, - .target = target, - .src_loc = src_loc, - .code = code, - .prev_di_pc = 0, - .prev_di_line = func.lbrace_line, - .prev_di_column = func.lbrace_column, - }; - defer emit.deinit(); - - emit.emitMir() catch |err| switch (err) { - error.EmitFail => return function.failMsg(emit.err_msg.?), - else => |e| return e, + .extra = &.{}, // fallible, so populated after errdefer }; + errdefer mir.deinit(gpa); + mir.extra = try function.mir_extra.toOwnedSlice(gpa); + return mir; } fn gen(self: *Self) !void { @@ -3566,6 +3544,9 @@ fn genArgDbgInfo(self: Self, inst: Air.Inst.Index, mcv: MCValue) !void { const ty = arg.ty.toType(); if (arg.name == .none) return; + // TODO: Add a pseudo-instruction or something to defer this work until Emit. + // We aren't allowed to interact with linker state here. + if (true) return; switch (self.debug_output) { .dwarf => |dw| switch (mcv) { .register => |reg| try dw.genLocalDebugInfo( diff --git a/src/arch/sparc64/Mir.zig b/src/arch/sparc64/Mir.zig index e9086db7a5..26c5c3267b 100644 --- a/src/arch/sparc64/Mir.zig +++ b/src/arch/sparc64/Mir.zig @@ -12,7 +12,11 @@ const assert = std.debug.assert; const Mir = @This(); const bits = @import("bits.zig"); -const Air = @import("../../Air.zig"); +const InternPool = @import("../../InternPool.zig"); +const Emit = @import("Emit.zig"); +const codegen = @import("../../codegen.zig"); +const link = @import("../../link.zig"); +const Zcu = @import("../../Zcu.zig"); const Instruction = bits.Instruction; const ASI = bits.Instruction.ASI; @@ -370,6 +374,39 @@ pub fn deinit(mir: *Mir, gpa: std.mem.Allocator) void { mir.* = undefined; } +pub fn emit( + mir: Mir, + lf: *link.File, + pt: Zcu.PerThread, + src_loc: Zcu.LazySrcLoc, + func_index: InternPool.Index, + code: *std.ArrayListUnmanaged(u8), + debug_output: link.File.DebugInfoOutput, + air: *const @import("../../Air.zig"), +) codegen.CodeGenError!void { + _ = air; // using this would be a bug + const zcu = pt.zcu; + const func = zcu.funcInfo(func_index); + const nav = func.owner_nav; + const mod = zcu.navFileScope(nav).mod.?; + var e: Emit = .{ + .mir = mir, + .bin_file = lf, + .debug_output = debug_output, + .target = &mod.resolved_target.result, + .src_loc = src_loc, + .code = code, + .prev_di_pc = 0, + .prev_di_line = func.lbrace_line, + .prev_di_column = func.lbrace_column, + }; + defer e.deinit(); + e.emitMir() catch |err| switch (err) { + error.EmitFail => return zcu.codegenFailMsg(nav, e.err_msg.?), + else => |err1| return err1, + }; +} + /// Returns the requested data, as well as the new index which is at the start of the /// trailers for the object. pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end: usize } { diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index b38492d500..1d95c8db77 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -125,7 +125,6 @@ pt: Zcu.PerThread, air: Air, liveness: Air.Liveness, bin_file: *link.File, -debug_output: link.File.DebugInfoOutput, target: *const std.Target, owner: Owner, inline_func: InternPool.Index, @@ -972,13 +971,10 @@ pub fn generate( pt: Zcu.PerThread, src_loc: Zcu.LazySrcLoc, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, - code: *std.ArrayListUnmanaged(u8), - debug_output: link.File.DebugInfoOutput, -) codegen.CodeGenError!void { + air: *const Air, + liveness: *const Air.Liveness, +) codegen.CodeGenError!Mir { const zcu = pt.zcu; - const comp = zcu.comp; const gpa = zcu.gpa; const ip = &zcu.intern_pool; const func = zcu.funcInfo(func_index); @@ -988,12 +984,11 @@ pub fn generate( var function: CodeGen = .{ .gpa = gpa, .pt = pt, - .air = air, - .liveness = liveness, + .air = air.*, + .liveness = liveness.*, .target = &mod.resolved_target.result, .mod = mod, .bin_file = bin_file, - .debug_output = debug_output, .owner = .{ .nav_index = func.owner_nav }, .inline_func = func_index, .arg_index = undefined, @@ -1090,7 +1085,7 @@ pub fn generate( }; // Drop them off at the rbrace. - if (debug_output != .none) _ = try function.addInst(.{ + if (!mod.strip) _ = try function.addInst(.{ .tag = .pseudo, .ops = .pseudo_dbg_line_line_column, .data = .{ .line_column = .{ @@ -1100,49 +1095,17 @@ pub fn generate( }); var mir: Mir = .{ - .instructions = function.mir_instructions.toOwnedSlice(), - .extra = try function.mir_extra.toOwnedSlice(gpa), - .table = try function.mir_table.toOwnedSlice(gpa), - .frame_locs = function.frame_locs.toOwnedSlice(), - }; - defer mir.deinit(gpa); - - var emit: Emit = .{ - .air = function.air, - .lower = .{ - .bin_file = bin_file, - .target = function.target, - .allocator = gpa, - .mir = mir, - .cc = fn_info.cc, - .src_loc = src_loc, - .output_mode = comp.config.output_mode, - .link_mode = comp.config.link_mode, - .pic = mod.pic, - }, - .atom_index = function.owner.getSymbolIndex(&function) catch |err| switch (err) { - error.CodegenFail => return error.CodegenFail, - else => |e| return e, - }, - .debug_output = debug_output, - .code = code, - .prev_di_loc = .{ - .line = func.lbrace_line, - .column = func.lbrace_column, - .is_stmt = switch (debug_output) { - .dwarf => |dwarf| dwarf.dwarf.debug_line.header.default_is_stmt, - .plan9 => undefined, - .none => undefined, - }, - }, - .prev_di_pc = 0, - }; - emit.emitMir() catch |err| switch (err) { - error.LowerFail, error.EmitFail => return function.failMsg(emit.lower.err_msg.?), - - error.InvalidInstruction, error.CannotEncode => |e| return function.fail("emit MIR failed: {s} (Zig compiler bug)", .{@errorName(e)}), - else => |e| return function.fail("emit MIR failed: {s}", .{@errorName(e)}), + .instructions = .empty, + .extra = &.{}, + .table = &.{}, + .frame_locs = .empty, }; + errdefer mir.deinit(gpa); + mir.instructions = function.mir_instructions.toOwnedSlice(); + mir.extra = try function.mir_extra.toOwnedSlice(gpa); + mir.table = try function.mir_table.toOwnedSlice(gpa); + mir.frame_locs = function.frame_locs.toOwnedSlice(); + return mir; } pub fn generateLazy( @@ -1165,7 +1128,6 @@ pub fn generateLazy( .target = &mod.resolved_target.result, .mod = mod, .bin_file = bin_file, - .debug_output = debug_output, .owner = .{ .lazy_sym = lazy_sym }, .inline_func = undefined, .arg_index = undefined, @@ -2339,7 +2301,7 @@ fn gen(self: *CodeGen) InnerError!void { else => |cc| return self.fail("{s} does not support var args", .{@tagName(cc)}), }; - if (self.debug_output != .none) try self.asmPseudo(.pseudo_dbg_prologue_end_none); + if (!self.mod.strip) try self.asmPseudo(.pseudo_dbg_prologue_end_none); try self.genBody(self.air.getMainBody()); @@ -2356,7 +2318,7 @@ fn gen(self: *CodeGen) InnerError!void { } for (self.epilogue_relocs.items) |epilogue_reloc| self.performReloc(epilogue_reloc); - if (self.debug_output != .none) try self.asmPseudo(.pseudo_dbg_epilogue_begin_none); + if (!self.mod.strip) try self.asmPseudo(.pseudo_dbg_epilogue_begin_none); const backpatch_stack_dealloc = try self.asmPlaceholder(); const backpatch_pop_callee_preserved_regs = try self.asmPlaceholder(); try self.asmRegister(.{ ._, .pop }, .rbp); @@ -2475,9 +2437,9 @@ fn gen(self: *CodeGen) InnerError!void { }); } } else { - if (self.debug_output != .none) try self.asmPseudo(.pseudo_dbg_prologue_end_none); + if (!self.mod.strip) try self.asmPseudo(.pseudo_dbg_prologue_end_none); try self.genBody(self.air.getMainBody()); - if (self.debug_output != .none) try self.asmPseudo(.pseudo_dbg_epilogue_begin_none); + if (!self.mod.strip) try self.asmPseudo(.pseudo_dbg_epilogue_begin_none); } } @@ -2498,9 +2460,9 @@ fn checkInvariantsAfterAirInst(self: *CodeGen) void { } fn genBodyBlock(self: *CodeGen, body: []const Air.Inst.Index) InnerError!void { - if (self.debug_output != .none) try self.asmPseudo(.pseudo_dbg_enter_block_none); + if (!self.mod.strip) try self.asmPseudo(.pseudo_dbg_enter_block_none); try self.genBody(body); - if (self.debug_output != .none) try self.asmPseudo(.pseudo_dbg_leave_block_none); + if (!self.mod.strip) try self.asmPseudo(.pseudo_dbg_leave_block_none); } fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { @@ -2544,7 +2506,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .shuffle_one, .shuffle_two => @panic("x86_64 TODO: shuffle_one/shuffle_two"), // zig fmt: on - .arg => if (cg.debug_output != .none) { + .arg => if (!cg.mod.strip) { // skip zero-bit arguments as they don't have a corresponding arg instruction var arg_index = cg.arg_index; while (cg.args[arg_index] == .none) arg_index += 1; @@ -64179,9 +64141,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .block => { const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; const block = cg.air.extraData(Air.Block, ty_pl.payload); - if (cg.debug_output != .none) try cg.asmPseudo(.pseudo_dbg_enter_block_none); + if (!cg.mod.strip) try cg.asmPseudo(.pseudo_dbg_enter_block_none); try cg.lowerBlock(inst, @ptrCast(cg.air.extra.items[block.end..][0..block.data.body_len])); - if (cg.debug_output != .none) try cg.asmPseudo(.pseudo_dbg_leave_block_none); + if (!cg.mod.strip) try cg.asmPseudo(.pseudo_dbg_leave_block_none); }, .loop => if (use_old) try cg.airLoop(inst) else { const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; @@ -85191,7 +85153,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .switch_dispatch => try cg.airSwitchDispatch(inst), .@"try", .try_cold => try cg.airTry(inst), .try_ptr, .try_ptr_cold => try cg.airTryPtr(inst), - .dbg_stmt => if (cg.debug_output != .none) { + .dbg_stmt => if (!cg.mod.strip) { const dbg_stmt = air_datas[@intFromEnum(inst)].dbg_stmt; _ = try cg.addInst(.{ .tag = .pseudo, @@ -85202,7 +85164,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { } }, }); }, - .dbg_empty_stmt => if (cg.debug_output != .none) { + .dbg_empty_stmt => if (!cg.mod.strip) { if (cg.mir_instructions.len > 0) { const prev_mir_op = &cg.mir_instructions.items(.ops)[cg.mir_instructions.len - 1]; if (prev_mir_op.* == .pseudo_dbg_line_line_column) @@ -85216,13 +85178,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { const old_inline_func = cg.inline_func; defer cg.inline_func = old_inline_func; cg.inline_func = dbg_inline_block.data.func; - if (cg.debug_output != .none) _ = try cg.addInst(.{ + if (!cg.mod.strip) _ = try cg.addInst(.{ .tag = .pseudo, .ops = .pseudo_dbg_enter_inline_func, .data = .{ .func = dbg_inline_block.data.func }, }); try cg.lowerBlock(inst, @ptrCast(cg.air.extra.items[dbg_inline_block.end..][0..dbg_inline_block.data.body_len])); - if (cg.debug_output != .none) _ = try cg.addInst(.{ + if (!cg.mod.strip) _ = try cg.addInst(.{ .tag = .pseudo, .ops = .pseudo_dbg_leave_inline_func, .data = .{ .func = old_inline_func }, @@ -85231,7 +85193,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .dbg_var_ptr, .dbg_var_val, .dbg_arg_inline, - => if (use_old) try cg.airDbgVar(inst) else if (cg.debug_output != .none) { + => if (use_old) try cg.airDbgVar(inst) else if (!cg.mod.strip) { const pl_op = air_datas[@intFromEnum(inst)].pl_op; var ops = try cg.tempsFromOperands(inst, .{pl_op.operand}); var mcv = ops[0].tracking(cg).short; @@ -173366,7 +173328,7 @@ fn airArg(self: *CodeGen, inst: Air.Inst.Index) !void { while (self.args[arg_index] == .none) arg_index += 1; self.arg_index = arg_index + 1; - const result: MCValue = if (self.debug_output == .none and self.liveness.isUnused(inst)) .unreach else result: { + const result: MCValue = if (self.mod.strip and self.liveness.isUnused(inst)) .unreach else result: { const arg_ty = self.typeOfIndex(inst); const src_mcv = self.args[arg_index]; switch (src_mcv) { @@ -173468,7 +173430,7 @@ fn airArg(self: *CodeGen, inst: Air.Inst.Index) !void { } fn airDbgVarArgs(self: *CodeGen) !void { - if (self.debug_output == .none) return; + if (self.mod.strip) return; if (!self.pt.zcu.typeToFunc(self.fn_type).?.is_var_args) return; try self.asmPseudo(.pseudo_dbg_var_args_none); } @@ -173478,7 +173440,7 @@ fn genLocalDebugInfo( inst: Air.Inst.Index, mcv: MCValue, ) !void { - if (self.debug_output == .none) return; + if (self.mod.strip) return; switch (self.air.instructions.items(.tag)[@intFromEnum(inst)]) { else => unreachable, .arg, .dbg_arg_inline, .dbg_var_val => |tag| { diff --git a/src/arch/x86_64/Mir.zig b/src/arch/x86_64/Mir.zig index 8d202e6bae..14468677af 100644 --- a/src/arch/x86_64/Mir.zig +++ b/src/arch/x86_64/Mir.zig @@ -1929,6 +1929,67 @@ pub fn deinit(mir: *Mir, gpa: std.mem.Allocator) void { mir.* = undefined; } +pub fn emit( + mir: Mir, + lf: *link.File, + pt: Zcu.PerThread, + src_loc: Zcu.LazySrcLoc, + func_index: InternPool.Index, + code: *std.ArrayListUnmanaged(u8), + debug_output: link.File.DebugInfoOutput, + /// TODO: remove dependency on this argument. This blocks enabling `Zcu.Feature.separate_thread`. + air: *const Air, +) codegen.CodeGenError!void { + const zcu = pt.zcu; + const comp = zcu.comp; + const gpa = comp.gpa; + const func = zcu.funcInfo(func_index); + const fn_info = zcu.typeToFunc(.fromInterned(func.ty)).?; + const nav = func.owner_nav; + const mod = zcu.navFileScope(nav).mod.?; + var e: Emit = .{ + .air = air.*, + .lower = .{ + .bin_file = lf, + .target = &mod.resolved_target.result, + .allocator = gpa, + .mir = mir, + .cc = fn_info.cc, + .src_loc = src_loc, + .output_mode = comp.config.output_mode, + .link_mode = comp.config.link_mode, + .pic = mod.pic, + }, + .atom_index = sym: { + if (lf.cast(.elf)) |ef| break :sym try ef.zigObjectPtr().?.getOrCreateMetadataForNav(zcu, nav); + if (lf.cast(.macho)) |mf| break :sym try mf.getZigObject().?.getOrCreateMetadataForNav(mf, nav); + if (lf.cast(.coff)) |cf| { + const atom = try cf.getOrCreateAtomForNav(nav); + break :sym cf.getAtom(atom).getSymbolIndex().?; + } + if (lf.cast(.plan9)) |p9f| break :sym try p9f.seeNav(pt, nav); + unreachable; + }, + .debug_output = debug_output, + .code = code, + .prev_di_loc = .{ + .line = func.lbrace_line, + .column = func.lbrace_column, + .is_stmt = switch (debug_output) { + .dwarf => |dwarf| dwarf.dwarf.debug_line.header.default_is_stmt, + .plan9 => undefined, + .none => undefined, + }, + }, + .prev_di_pc = 0, + }; + e.emitMir() catch |err| switch (err) { + error.LowerFail, error.EmitFail => return zcu.codegenFailMsg(nav, e.lower.err_msg.?), + error.InvalidInstruction, error.CannotEncode => return zcu.codegenFail(nav, "emit MIR failed: {s} (Zig compiler bug)", .{@errorName(err)}), + else => return zcu.codegenFail(nav, "emit MIR failed: {s}", .{@errorName(err)}), + }; +} + pub fn extraData(mir: Mir, comptime T: type, index: u32) struct { data: T, end: u32 } { const fields = std.meta.fields(T); var i: u32 = index; @@ -1987,3 +2048,7 @@ const IntegerBitSet = std.bit_set.IntegerBitSet; const InternPool = @import("../../InternPool.zig"); const Mir = @This(); const Register = bits.Register; +const Emit = @import("Emit.zig"); +const codegen = @import("../../codegen.zig"); +const link = @import("../../link.zig"); +const Zcu = @import("../../Zcu.zig"); diff --git a/src/codegen.zig b/src/codegen.zig index 2c2524257c..ea57aaf89c 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -182,7 +182,7 @@ pub fn emitFunction( /// in the pipeline. Any information needed to call emit must be stored in MIR. /// This is `undefined` if the backend supports the `separate_thread` feature. air: *const Air, -) Allocator.Error!void { +) CodeGenError!void { const zcu = pt.zcu; const func = zcu.funcInfo(func_index); const target = zcu.navFileScope(func.owner_nav).mod.?.resolved_target.result; diff --git a/src/libs/freebsd.zig b/src/libs/freebsd.zig index 98d4a42f91..d90ba974fc 100644 --- a/src/libs/freebsd.zig +++ b/src/libs/freebsd.zig @@ -985,7 +985,7 @@ fn queueSharedObjects(comp: *Compilation, so_files: BuiltSharedObjects) void { assert(comp.freebsd_so_files == null); comp.freebsd_so_files = so_files; - var task_buffer: [libs.len]link.Task = undefined; + var task_buffer: [libs.len]link.PrelinkTask = undefined; var task_buffer_i: usize = 0; { diff --git a/src/libs/glibc.zig b/src/libs/glibc.zig index c1146d933d..ed5eae377f 100644 --- a/src/libs/glibc.zig +++ b/src/libs/glibc.zig @@ -1148,7 +1148,7 @@ fn queueSharedObjects(comp: *Compilation, so_files: BuiltSharedObjects) void { assert(comp.glibc_so_files == null); comp.glibc_so_files = so_files; - var task_buffer: [libs.len]link.Task = undefined; + var task_buffer: [libs.len]link.PrelinkTask = undefined; var task_buffer_i: usize = 0; { diff --git a/src/libs/netbsd.zig b/src/libs/netbsd.zig index aab75cce49..7121c308f5 100644 --- a/src/libs/netbsd.zig +++ b/src/libs/netbsd.zig @@ -650,7 +650,7 @@ fn queueSharedObjects(comp: *Compilation, so_files: BuiltSharedObjects) void { assert(comp.netbsd_so_files == null); comp.netbsd_so_files = so_files; - var task_buffer: [libs.len]link.Task = undefined; + var task_buffer: [libs.len]link.PrelinkTask = undefined; var task_buffer_i: usize = 0; { diff --git a/src/link.zig b/src/link.zig index 31fd0a4a4e..838654775d 100644 --- a/src/link.zig +++ b/src/link.zig @@ -759,6 +759,8 @@ pub const File = struct { switch (base.tag) { .lld => unreachable, inline else => |tag| { + if (tag == .wasm) @panic("MLUGG TODO"); + if (tag == .spirv) @panic("MLUGG TODO"); dev.check(tag.devFeature()); return @as(*tag.Type(), @fieldParentPtr("base", base)).updateFunc(pt, func_index, mir, maybe_undef_air); }, diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 9a040754ef..bb8faf583d 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -1057,8 +1057,10 @@ pub fn updateFunc( coff: *Coff, pt: Zcu.PerThread, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, + mir: *const codegen.AnyMir, + /// This may be `undefined`; only pass it to `emitFunction`. + /// This parameter will eventually be removed. + maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { if (build_options.skip_non_native and builtin.object_format != .coff) { @panic("Attempted to compile for object format that was disabled by build configuration"); @@ -1079,15 +1081,15 @@ pub fn updateFunc( var code_buffer: std.ArrayListUnmanaged(u8) = .empty; defer code_buffer.deinit(gpa); - try codegen.generateFunction( + try codegen.emitFunction( &coff.base, pt, zcu.navSrcLoc(nav_index), func_index, - air, - liveness, + mir, &code_buffer, .none, + maybe_undef_air, ); try coff.updateNavCode(pt, nav_index, code_buffer.items, .FUNCTION); diff --git a/src/link/Goff.zig b/src/link/Goff.zig index 28da184495..d0c2b8e80b 100644 --- a/src/link/Goff.zig +++ b/src/link/Goff.zig @@ -13,6 +13,7 @@ const Path = std.Build.Cache.Path; const Zcu = @import("../Zcu.zig"); const InternPool = @import("../InternPool.zig"); const Compilation = @import("../Compilation.zig"); +const codegen = @import("../codegen.zig"); const link = @import("../link.zig"); const trace = @import("../tracy.zig").trace; const build_options = @import("build_options"); @@ -72,14 +73,14 @@ pub fn updateFunc( self: *Goff, pt: Zcu.PerThread, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, + mir: *const codegen.AnyMir, + maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { _ = self; _ = pt; _ = func_index; - _ = air; - _ = liveness; + _ = mir; + _ = maybe_undef_air; unreachable; // we always use llvm } diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 2c30b34215..8fd85df0a3 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -3051,13 +3051,13 @@ pub fn updateFunc( self: *MachO, pt: Zcu.PerThread, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, + mir: *const codegen.AnyMir, + maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { if (build_options.skip_non_native and builtin.object_format != .macho) { @panic("Attempted to compile for object format that was disabled by build configuration"); } - return self.getZigObject().?.updateFunc(self, pt, func_index, air, liveness); + return self.getZigObject().?.updateFunc(self, pt, func_index, mir, maybe_undef_air); } pub fn updateNav(self: *MachO, pt: Zcu.PerThread, nav: InternPool.Nav.Index) link.File.UpdateNavError!void { diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig index 13ebb40cf9..f378a9c410 100644 --- a/src/link/MachO/ZigObject.zig +++ b/src/link/MachO/ZigObject.zig @@ -777,8 +777,10 @@ pub fn updateFunc( macho_file: *MachO, pt: Zcu.PerThread, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, + mir: *const codegen.AnyMir, + /// This may be `undefined`; only pass it to `emitFunction`. + /// This parameter will eventually be removed. + maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { const tracy = trace(@src()); defer tracy.end(); @@ -796,15 +798,15 @@ pub fn updateFunc( var debug_wip_nav = if (self.dwarf) |*dwarf| try dwarf.initWipNav(pt, func.owner_nav, sym_index) else null; defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); - try codegen.generateFunction( + try codegen.emitFunction( &macho_file.base, pt, zcu.navSrcLoc(func.owner_nav), func_index, - air, - liveness, + mir, &code_buffer, if (debug_wip_nav) |*wip_nav| .{ .dwarf = wip_nav } else .none, + maybe_undef_air, ); const code = code_buffer.items; diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig index c487169b3f..0d0699f0f0 100644 --- a/src/link/Plan9.zig +++ b/src/link/Plan9.zig @@ -386,8 +386,10 @@ pub fn updateFunc( self: *Plan9, pt: Zcu.PerThread, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, + mir: *const codegen.AnyMir, + /// This may be `undefined`; only pass it to `emitFunction`. + /// This parameter will eventually be removed. + maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { if (build_options.skip_non_native and builtin.object_format != .plan9) { @panic("Attempted to compile for object format that was disabled by build configuration"); @@ -412,15 +414,15 @@ pub fn updateFunc( }; defer dbg_info_output.dbg_line.deinit(); - try codegen.generateFunction( + try codegen.emitFunction( &self.base, pt, zcu.navSrcLoc(func.owner_nav), func_index, - air, - liveness, + mir, &code_buffer, .{ .plan9 = &dbg_info_output }, + maybe_undef_air, ); const code = try code_buffer.toOwnedSlice(gpa); self.getAtomPtr(atom_idx).code = .{ diff --git a/src/link/Queue.zig b/src/link/Queue.zig index c73a0e9684..3436be5921 100644 --- a/src/link/Queue.zig +++ b/src/link/Queue.zig @@ -97,8 +97,7 @@ pub fn mirReady(q: *Queue, comp: *Compilation, mir: *ZcuTask.LinkFunc.SharedMir) q.mutex.lock(); defer q.mutex.unlock(); switch (q.state) { - .finished => unreachable, // there's definitely a task queued - .running => return, + .finished, .running => return, .wait_for_mir => |wait_for| if (wait_for != mir) return, } // We were waiting for `mir`, so we will restart the linker thread. diff --git a/src/link/Xcoff.zig b/src/link/Xcoff.zig index 7fe714ce6e..97ea300ed2 100644 --- a/src/link/Xcoff.zig +++ b/src/link/Xcoff.zig @@ -13,6 +13,7 @@ const Path = std.Build.Cache.Path; const Zcu = @import("../Zcu.zig"); const InternPool = @import("../InternPool.zig"); const Compilation = @import("../Compilation.zig"); +const codegen = @import("../codegen.zig"); const link = @import("../link.zig"); const trace = @import("../tracy.zig").trace; const build_options = @import("build_options"); @@ -72,14 +73,14 @@ pub fn updateFunc( self: *Xcoff, pt: Zcu.PerThread, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, + mir: *const codegen.AnyMir, + maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { _ = self; _ = pt; _ = func_index; - _ = air; - _ = liveness; + _ = mir; + _ = maybe_undef_air; unreachable; // we always use llvm } -- cgit v1.2.3 From c0df70706695a67089d4e691d3d3a0f77b90298f Mon Sep 17 00:00:00 2001 From: mlugg Date: Tue, 3 Jun 2025 16:25:16 +0100 Subject: wasm: get self-hosted compiling, and supporting `separate_thread` My original goal here was just to get the self-hosted Wasm backend compiling again after the pipeline change, but it turned out that from there it was pretty simple to entirely eliminate the shared state between `codegen.wasm` and `link.Wasm`. As such, this commit not only fixes the backend, but makes it the second backend (after CBE) to support the new 1:N:1 threading model. --- lib/std/multi_array_list.zig | 16 +++ src/Compilation.zig | 2 +- src/arch/wasm/CodeGen.zig | 301 +++++++++++++++---------------------------- src/arch/wasm/Emit.zig | 39 ++++-- src/arch/wasm/Mir.zig | 123 +++++++++++++++--- src/codegen.zig | 19 +-- src/link.zig | 3 +- src/link/Wasm.zig | 193 ++++++++++++++++++--------- src/link/Wasm/Flush.zig | 17 ++- src/target.zig | 2 +- 10 files changed, 404 insertions(+), 311 deletions(-) (limited to 'src/codegen.zig') diff --git a/lib/std/multi_array_list.zig b/lib/std/multi_array_list.zig index 341ca6931e..279a150799 100644 --- a/lib/std/multi_array_list.zig +++ b/lib/std/multi_array_list.zig @@ -135,6 +135,22 @@ pub fn MultiArrayList(comptime T: type) type { self.* = undefined; } + /// Returns a `Slice` representing a range of elements in `s`, analagous to `arr[off..len]`. + /// It is illegal to call `deinit` or `toMultiArrayList` on the returned `Slice`. + /// Asserts that `off + len <= s.len`. + pub fn subslice(s: Slice, off: usize, len: usize) Slice { + assert(off + len <= s.len); + var ptrs: [fields.len][*]u8 = undefined; + inline for (s.ptrs, &ptrs, fields) |in, *out, field| { + out.* = in + (off * @sizeOf(field.type)); + } + return .{ + .ptrs = ptrs, + .len = len, + .capacity = len, + }; + } + /// This function is used in the debugger pretty formatters in tools/ to fetch the /// child field order and entry type to facilitate fancy debug printing for this type. fn dbHelper(self: *Slice, child: *Elem, field: *Field, entry: *Entry) void { diff --git a/src/Compilation.zig b/src/Compilation.zig index e967935539..0342566e27 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -3500,7 +3500,7 @@ pub fn saveState(comp: *Compilation) !void { // TODO handle the union safety field //addBuf(&bufs, mem.sliceAsBytes(wasm.mir_instructions.items(.data))); addBuf(&bufs, mem.sliceAsBytes(wasm.mir_extra.items)); - addBuf(&bufs, mem.sliceAsBytes(wasm.all_zcu_locals.items)); + addBuf(&bufs, mem.sliceAsBytes(wasm.mir_locals.items)); addBuf(&bufs, mem.sliceAsBytes(wasm.tag_name_bytes.items)); addBuf(&bufs, mem.sliceAsBytes(wasm.tag_name_offs.items)); diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig index 264b1e732d..2993923589 100644 --- a/src/arch/wasm/CodeGen.zig +++ b/src/arch/wasm/CodeGen.zig @@ -3,7 +3,6 @@ const builtin = @import("builtin"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const testing = std.testing; -const leb = std.leb; const mem = std.mem; const log = std.log.scoped(.codegen); @@ -18,12 +17,10 @@ const Compilation = @import("../../Compilation.zig"); const link = @import("../../link.zig"); const Air = @import("../../Air.zig"); const Mir = @import("Mir.zig"); -const Emit = @import("Emit.zig"); const abi = @import("abi.zig"); const Alignment = InternPool.Alignment; const errUnionPayloadOffset = codegen.errUnionPayloadOffset; const errUnionErrorOffset = codegen.errUnionErrorOffset; -const Wasm = link.File.Wasm; const target_util = @import("../../target.zig"); const libcFloatPrefix = target_util.libcFloatPrefix; @@ -78,17 +75,24 @@ simd_immediates: std.ArrayListUnmanaged([16]u8) = .empty, /// The Target we're emitting (used to call intInfo) target: *const std.Target, ptr_size: enum { wasm32, wasm64 }, -wasm: *link.File.Wasm, pt: Zcu.PerThread, /// List of MIR Instructions -mir_instructions: *std.MultiArrayList(Mir.Inst), +mir_instructions: std.MultiArrayList(Mir.Inst), /// Contains extra data for MIR -mir_extra: *std.ArrayListUnmanaged(u32), -start_mir_extra_off: u32, -start_locals_off: u32, +mir_extra: std.ArrayListUnmanaged(u32), /// List of all locals' types generated throughout this declaration /// used to emit locals count at start of 'code' section. -locals: *std.ArrayListUnmanaged(std.wasm.Valtype), +mir_locals: std.ArrayListUnmanaged(std.wasm.Valtype), +/// Set of all UAVs referenced by this function. Key is the UAV value, value is the alignment. +/// `.none` means naturally aligned. An explicit alignment is never less than the natural alignment. +mir_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment), +/// Set of all functions whose address this function has taken and which therefore might be called +/// via a `call_indirect` function. +mir_indirect_function_set: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void), +/// Set of all function types used by this function. These must be interned by the linker. +mir_func_tys: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), +/// The number of `error_name_table_ref` instructions emitted. +error_name_table_ref_count: u32, /// When a function is executing, we store the the current stack pointer's value within this local. /// This value is then used to restore the stack pointer to the original value at the return of the function. initial_stack_value: WValue = .none, @@ -219,7 +223,7 @@ const WValue = union(enum) { if (local_value < reserved + 2) return; // reserved locals may never be re-used. Also accounts for 2 stack locals. const index = local_value - reserved; - const valtype = gen.locals.items[gen.start_locals_off + index]; + const valtype = gen.mir_locals.items[index]; switch (valtype) { .i32 => gen.free_locals_i32.append(gen.gpa, local_value) catch return, // It's ok to fail any of those, a new local can be allocated instead .i64 => gen.free_locals_i64.append(gen.gpa, local_value) catch return, @@ -716,6 +720,12 @@ pub fn deinit(cg: *CodeGen) void { cg.free_locals_f32.deinit(gpa); cg.free_locals_f64.deinit(gpa); cg.free_locals_v128.deinit(gpa); + cg.mir_instructions.deinit(gpa); + cg.mir_extra.deinit(gpa); + cg.mir_locals.deinit(gpa); + cg.mir_uavs.deinit(gpa); + cg.mir_indirect_function_set.deinit(gpa); + cg.mir_func_tys.deinit(gpa); cg.* = undefined; } @@ -876,7 +886,7 @@ fn addTag(cg: *CodeGen, tag: Mir.Inst.Tag) error{OutOfMemory}!void { } fn addExtended(cg: *CodeGen, opcode: std.wasm.MiscOpcode) error{OutOfMemory}!void { - const extra_index = cg.extraLen(); + const extra_index: u32 = @intCast(cg.mir_extra.items.len); try cg.mir_extra.append(cg.gpa, @intFromEnum(opcode)); try cg.addInst(.{ .tag = .misc_prefix, .data = .{ .payload = extra_index } }); } @@ -889,10 +899,6 @@ fn addLocal(cg: *CodeGen, tag: Mir.Inst.Tag, local: u32) error{OutOfMemory}!void try cg.addInst(.{ .tag = tag, .data = .{ .local = local } }); } -fn addFuncTy(cg: *CodeGen, tag: Mir.Inst.Tag, i: Wasm.FunctionType.Index) error{OutOfMemory}!void { - try cg.addInst(.{ .tag = tag, .data = .{ .func_ty = i } }); -} - /// Accepts an unsigned 32bit integer rather than a signed integer to /// prevent us from having to bitcast multiple times as most values /// within codegen are represented as unsigned rather than signed. @@ -911,7 +917,7 @@ fn addImm64(cg: *CodeGen, imm: u64) error{OutOfMemory}!void { /// Accepts the index into the list of 128bit-immediates fn addImm128(cg: *CodeGen, index: u32) error{OutOfMemory}!void { const simd_values = cg.simd_immediates.items[index]; - const extra_index = cg.extraLen(); + const extra_index: u32 = @intCast(cg.mir_extra.items.len); // tag + 128bit value try cg.mir_extra.ensureUnusedCapacity(cg.gpa, 5); cg.mir_extra.appendAssumeCapacity(@intFromEnum(std.wasm.SimdOpcode.v128_const)); @@ -956,15 +962,13 @@ fn addExtra(cg: *CodeGen, extra: anytype) error{OutOfMemory}!u32 { /// Returns the index into `mir_extra` fn addExtraAssumeCapacity(cg: *CodeGen, extra: anytype) error{OutOfMemory}!u32 { const fields = std.meta.fields(@TypeOf(extra)); - const result = cg.extraLen(); + const result: u32 = @intCast(cg.mir_extra.items.len); inline for (fields) |field| { cg.mir_extra.appendAssumeCapacity(switch (field.type) { u32 => @field(extra, field.name), i32 => @bitCast(@field(extra, field.name)), InternPool.Index, InternPool.Nav.Index, - Wasm.UavsObjIndex, - Wasm.UavsExeIndex, => @intFromEnum(@field(extra, field.name)), else => |field_type| @compileError("Unsupported field type " ++ @typeName(field_type)), }); @@ -1034,18 +1038,12 @@ fn emitWValue(cg: *CodeGen, value: WValue) InnerError!void { .float32 => |val| try cg.addInst(.{ .tag = .f32_const, .data = .{ .float32 = val } }), .float64 => |val| try cg.addFloat64(val), .nav_ref => |nav_ref| { - const wasm = cg.wasm; - const comp = wasm.base.comp; - const zcu = comp.zcu.?; + const zcu = cg.pt.zcu; const ip = &zcu.intern_pool; if (ip.getNav(nav_ref.nav_index).isFn(ip)) { assert(nav_ref.offset == 0); - const gop = try wasm.zcu_indirect_function_set.getOrPut(comp.gpa, nav_ref.nav_index); - if (!gop.found_existing) gop.value_ptr.* = {}; - try cg.addInst(.{ - .tag = .func_ref, - .data = .{ .indirect_function_table_index = @enumFromInt(gop.index) }, - }); + try cg.mir_indirect_function_set.put(cg.gpa, nav_ref.nav_index, {}); + try cg.addInst(.{ .tag = .func_ref, .data = .{ .nav_index = nav_ref.nav_index } }); } else if (nav_ref.offset == 0) { try cg.addInst(.{ .tag = .nav_ref, .data = .{ .nav_index = nav_ref.nav_index } }); } else { @@ -1061,41 +1059,37 @@ fn emitWValue(cg: *CodeGen, value: WValue) InnerError!void { } }, .uav_ref => |uav| { - const wasm = cg.wasm; - const comp = wasm.base.comp; - const is_obj = comp.config.output_mode == .Obj; - const zcu = comp.zcu.?; + const zcu = cg.pt.zcu; const ip = &zcu.intern_pool; - if (ip.isFunctionType(ip.typeOf(uav.ip_index))) { - assert(uav.offset == 0); - const owner_nav = ip.toFunc(uav.ip_index).owner_nav; - const gop = try wasm.zcu_indirect_function_set.getOrPut(comp.gpa, owner_nav); - if (!gop.found_existing) gop.value_ptr.* = {}; - try cg.addInst(.{ - .tag = .func_ref, - .data = .{ .indirect_function_table_index = @enumFromInt(gop.index) }, - }); - } else if (uav.offset == 0) { + assert(!ip.isFunctionType(ip.typeOf(uav.ip_index))); + const gop = try cg.mir_uavs.getOrPut(cg.gpa, uav.ip_index); + const this_align: Alignment = a: { + if (uav.orig_ptr_ty == .none) break :a .none; + const ptr_type = ip.indexToKey(uav.orig_ptr_ty).ptr_type; + const this_align = ptr_type.flags.alignment; + if (this_align == .none) break :a .none; + const abi_align = Type.fromInterned(ptr_type.child).abiAlignment(zcu); + if (this_align.compare(.lte, abi_align)) break :a .none; + break :a this_align; + }; + if (!gop.found_existing or + gop.value_ptr.* == .none or + (this_align != .none and this_align.compare(.gt, gop.value_ptr.*))) + { + gop.value_ptr.* = this_align; + } + if (uav.offset == 0) { try cg.addInst(.{ .tag = .uav_ref, - .data = if (is_obj) .{ - .uav_obj = try wasm.refUavObj(uav.ip_index, uav.orig_ptr_ty), - } else .{ - .uav_exe = try wasm.refUavExe(uav.ip_index, uav.orig_ptr_ty), - }, + .data = .{ .ip_index = uav.ip_index }, }); } else { try cg.addInst(.{ .tag = .uav_ref_off, - .data = .{ - .payload = if (is_obj) try cg.addExtra(Mir.UavRefOffObj{ - .uav_obj = try wasm.refUavObj(uav.ip_index, uav.orig_ptr_ty), - .offset = uav.offset, - }) else try cg.addExtra(Mir.UavRefOffExe{ - .uav_exe = try wasm.refUavExe(uav.ip_index, uav.orig_ptr_ty), - .offset = uav.offset, - }), - }, + .data = .{ .payload = try cg.addExtra(@as(Mir.UavRefOff, .{ + .value = uav.ip_index, + .offset = uav.offset, + })) }, }); } }, @@ -1157,106 +1151,12 @@ fn allocLocal(cg: *CodeGen, ty: Type) InnerError!WValue { /// to use a zero-initialized local. fn ensureAllocLocal(cg: *CodeGen, ty: Type) InnerError!WValue { const zcu = cg.pt.zcu; - try cg.locals.append(cg.gpa, typeToValtype(ty, zcu, cg.target)); + try cg.mir_locals.append(cg.gpa, typeToValtype(ty, zcu, cg.target)); const initial_index = cg.local_index; cg.local_index += 1; return .{ .local = .{ .value = initial_index, .references = 1 } }; } -pub const Function = extern struct { - /// Index into `Wasm.mir_instructions`. - mir_off: u32, - /// This is unused except for as a safety slice bound and could be removed. - mir_len: u32, - /// Index into `Wasm.mir_extra`. - mir_extra_off: u32, - /// This is unused except for as a safety slice bound and could be removed. - mir_extra_len: u32, - locals_off: u32, - locals_len: u32, - prologue: Prologue, - - pub const Prologue = extern struct { - flags: Flags, - sp_local: u32, - stack_size: u32, - bottom_stack_local: u32, - - pub const Flags = packed struct(u32) { - stack_alignment: Alignment, - padding: u26 = 0, - }; - - pub const none: Prologue = .{ - .sp_local = 0, - .flags = .{ .stack_alignment = .none }, - .stack_size = 0, - .bottom_stack_local = 0, - }; - - pub fn isNone(p: *const Prologue) bool { - return p.flags.stack_alignment != .none; - } - }; - - pub fn lower(f: *Function, wasm: *Wasm, code: *std.ArrayListUnmanaged(u8)) Allocator.Error!void { - const gpa = wasm.base.comp.gpa; - - // Write the locals in the prologue of the function body. - const locals = wasm.all_zcu_locals.items[f.locals_off..][0..f.locals_len]; - try code.ensureUnusedCapacity(gpa, 5 + locals.len * 6 + 38); - - std.leb.writeUleb128(code.fixedWriter(), @as(u32, @intCast(locals.len))) catch unreachable; - for (locals) |local| { - std.leb.writeUleb128(code.fixedWriter(), @as(u32, 1)) catch unreachable; - code.appendAssumeCapacity(@intFromEnum(local)); - } - - // Stack management section of function prologue. - const stack_alignment = f.prologue.flags.stack_alignment; - if (stack_alignment.toByteUnits()) |align_bytes| { - const sp_global: Wasm.GlobalIndex = .stack_pointer; - // load stack pointer - code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.global_get)); - std.leb.writeULEB128(code.fixedWriter(), @intFromEnum(sp_global)) catch unreachable; - // store stack pointer so we can restore it when we return from the function - code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_tee)); - leb.writeUleb128(code.fixedWriter(), f.prologue.sp_local) catch unreachable; - // get the total stack size - const aligned_stack: i32 = @intCast(stack_alignment.forward(f.prologue.stack_size)); - code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); - leb.writeIleb128(code.fixedWriter(), aligned_stack) catch unreachable; - // subtract it from the current stack pointer - code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_sub)); - // Get negative stack alignment - const neg_stack_align = @as(i32, @intCast(align_bytes)) * -1; - code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); - leb.writeIleb128(code.fixedWriter(), neg_stack_align) catch unreachable; - // Bitwise-and the value to get the new stack pointer to ensure the - // pointers are aligned with the abi alignment. - code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_and)); - // The bottom will be used to calculate all stack pointer offsets. - code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_tee)); - leb.writeUleb128(code.fixedWriter(), f.prologue.bottom_stack_local) catch unreachable; - // Store the current stack pointer value into the global stack pointer so other function calls will - // start from this value instead and not overwrite the current stack. - code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.global_set)); - std.leb.writeULEB128(code.fixedWriter(), @intFromEnum(sp_global)) catch unreachable; - } - - var emit: Emit = .{ - .mir = .{ - .instruction_tags = wasm.mir_instructions.items(.tag)[f.mir_off..][0..f.mir_len], - .instruction_datas = wasm.mir_instructions.items(.data)[f.mir_off..][0..f.mir_len], - .extra = wasm.mir_extra.items[f.mir_extra_off..][0..f.mir_extra_len], - }, - .wasm = wasm, - .code = code, - }; - try emit.lowerToCode(); - } -}; - pub const Error = error{ OutOfMemory, /// Compiler was asked to operate on a number larger than supported. @@ -1265,13 +1165,16 @@ pub const Error = error{ CodegenFail, }; -pub fn function( - wasm: *Wasm, +pub fn generate( + bin_file: *link.File, pt: Zcu.PerThread, + src_loc: Zcu.LazySrcLoc, func_index: InternPool.Index, - air: Air, - liveness: Air.Liveness, -) Error!Function { + air: *const Air, + liveness: *const Air.Liveness, +) Error!Mir { + _ = src_loc; + _ = bin_file; const zcu = pt.zcu; const gpa = zcu.gpa; const cg = zcu.funcInfo(func_index); @@ -1279,10 +1182,8 @@ pub fn function( const target = &file_scope.mod.?.resolved_target.result; const fn_ty = zcu.navValue(cg.owner_nav).typeOf(zcu); const fn_info = zcu.typeToFunc(fn_ty).?; - const ip = &zcu.intern_pool; - const fn_ty_index = try wasm.internFunctionType(fn_info.cc, fn_info.param_types.get(ip), .fromInterned(fn_info.return_type), target); - const returns = fn_ty_index.ptr(wasm).returns.slice(wasm); - const any_returns = returns.len != 0; + const ret_ty: Type = .fromInterned(fn_info.return_type); + const any_returns = !firstParamSRet(fn_info.cc, ret_ty, zcu, target) and ret_ty.hasRuntimeBitsIgnoreComptime(zcu); var cc_result = try resolveCallingConventionValues(zcu, fn_ty, target); defer cc_result.deinit(gpa); @@ -1290,8 +1191,8 @@ pub fn function( var code_gen: CodeGen = .{ .gpa = gpa, .pt = pt, - .air = air, - .liveness = liveness, + .air = air.*, + .liveness = liveness.*, .owner_nav = cg.owner_nav, .target = target, .ptr_size = switch (target.cpu.arch) { @@ -1299,31 +1200,33 @@ pub fn function( .wasm64 => .wasm64, else => unreachable, }, - .wasm = wasm, .func_index = func_index, .args = cc_result.args, .return_value = cc_result.return_value, .local_index = cc_result.local_index, - .mir_instructions = &wasm.mir_instructions, - .mir_extra = &wasm.mir_extra, - .locals = &wasm.all_zcu_locals, - .start_mir_extra_off = @intCast(wasm.mir_extra.items.len), - .start_locals_off = @intCast(wasm.all_zcu_locals.items.len), + .mir_instructions = .empty, + .mir_extra = .empty, + .mir_locals = .empty, + .mir_uavs = .empty, + .mir_indirect_function_set = .empty, + .mir_func_tys = .empty, + .error_name_table_ref_count = 0, }; defer code_gen.deinit(); - return functionInner(&code_gen, any_returns) catch |err| switch (err) { - error.CodegenFail => return error.CodegenFail, + try code_gen.mir_func_tys.putNoClobber(gpa, fn_ty.toIntern(), {}); + + return generateInner(&code_gen, any_returns) catch |err| switch (err) { + error.CodegenFail, + error.OutOfMemory, + error.Overflow, + => |e| return e, else => |e| return code_gen.fail("failed to generate function: {s}", .{@errorName(e)}), }; } -fn functionInner(cg: *CodeGen, any_returns: bool) InnerError!Function { - const wasm = cg.wasm; +fn generateInner(cg: *CodeGen, any_returns: bool) InnerError!Mir { const zcu = cg.pt.zcu; - - const start_mir_off: u32 = @intCast(wasm.mir_instructions.len); - try cg.branches.append(cg.gpa, .{}); // clean up outer branch defer { @@ -1347,20 +1250,25 @@ fn functionInner(cg: *CodeGen, any_returns: bool) InnerError!Function { try cg.addTag(.end); try cg.addTag(.dbg_epilogue_begin); - return .{ - .mir_off = start_mir_off, - .mir_len = @intCast(wasm.mir_instructions.len - start_mir_off), - .mir_extra_off = cg.start_mir_extra_off, - .mir_extra_len = cg.extraLen(), - .locals_off = cg.start_locals_off, - .locals_len = @intCast(wasm.all_zcu_locals.items.len - cg.start_locals_off), + var mir: Mir = .{ + .instructions = cg.mir_instructions.toOwnedSlice(), + .extra = &.{}, // fallible so assigned after errdefer + .locals = &.{}, // fallible so assigned after errdefer .prologue = if (cg.initial_stack_value == .none) .none else .{ .sp_local = cg.initial_stack_value.local.value, .flags = .{ .stack_alignment = cg.stack_alignment }, .stack_size = cg.stack_size, .bottom_stack_local = cg.bottom_stack_value.local.value, }, + .uavs = cg.mir_uavs.move(), + .indirect_function_set = cg.mir_indirect_function_set.move(), + .func_tys = cg.mir_func_tys.move(), + .error_name_table_ref_count = cg.error_name_table_ref_count, }; + errdefer mir.deinit(cg.gpa); + mir.extra = try cg.mir_extra.toOwnedSlice(cg.gpa); + mir.locals = try cg.mir_locals.toOwnedSlice(cg.gpa); + return mir; } const CallWValues = struct { @@ -2220,7 +2128,6 @@ fn airRetLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { } fn airCall(cg: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) InnerError!void { - const wasm = cg.wasm; if (modifier == .always_tail) return cg.fail("TODO implement tail calls for wasm", .{}); const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; const extra = cg.air.extraData(Air.Call, pl_op.payload); @@ -2277,8 +2184,11 @@ fn airCall(cg: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModifie const operand = try cg.resolveInst(pl_op.operand); try cg.emitWValue(operand); - const fn_type_index = try wasm.internFunctionType(fn_info.cc, fn_info.param_types.get(ip), .fromInterned(fn_info.return_type), cg.target); - try cg.addFuncTy(.call_indirect, fn_type_index); + try cg.mir_func_tys.put(cg.gpa, fn_ty.toIntern(), {}); + try cg.addInst(.{ + .tag = .call_indirect, + .data = .{ .ip_index = fn_ty.toIntern() }, + }); } const result_value = result_value: { @@ -2449,7 +2359,7 @@ fn store(cg: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerErr try cg.emitWValue(lhs); try cg.lowerToStack(rhs); // TODO: Add helper functions for simd opcodes - const extra_index = cg.extraLen(); + const extra_index: u32 = @intCast(cg.mir_extra.items.len); // stores as := opcode, offset, alignment (opcode::memarg) try cg.mir_extra.appendSlice(cg.gpa, &[_]u32{ @intFromEnum(std.wasm.SimdOpcode.v128_store), @@ -2574,7 +2484,7 @@ fn load(cg: *CodeGen, operand: WValue, ty: Type, offset: u32) InnerError!WValue if (ty.zigTypeTag(zcu) == .vector) { // TODO: Add helper functions for simd opcodes - const extra_index = cg.extraLen(); + const extra_index: u32 = @intCast(cg.mir_extra.items.len); // stores as := opcode, offset, alignment (opcode::memarg) try cg.mir_extra.appendSlice(cg.gpa, &[_]u32{ @intFromEnum(std.wasm.SimdOpcode.v128_load), @@ -4971,7 +4881,7 @@ fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { try cg.emitWValue(array); - const extra_index = cg.extraLen(); + const extra_index: u32 = @intCast(cg.mir_extra.items.len); try cg.mir_extra.appendSlice(cg.gpa, &operands); try cg.addInst(.{ .tag = .simd_prefix, .data = .{ .payload = extra_index } }); @@ -5123,7 +5033,7 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { else => break :blk, // Cannot make use of simd-instructions }; try cg.emitWValue(operand); - const extra_index: u32 = cg.extraLen(); + const extra_index: u32 = @intCast(cg.mir_extra.items.len); // stores as := opcode, offset, alignment (opcode::memarg) try cg.mir_extra.appendSlice(cg.gpa, &[_]u32{ opcode, @@ -5142,7 +5052,7 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { else => break :blk, // Cannot make use of simd-instructions }; try cg.emitWValue(operand); - const extra_index = cg.extraLen(); + const extra_index: u32 = @intCast(cg.mir_extra.items.len); try cg.mir_extra.append(cg.gpa, opcode); try cg.addInst(.{ .tag = .simd_prefix, .data = .{ .payload = extra_index } }); return cg.finishAir(inst, .stack, &.{ty_op.operand}); @@ -5246,7 +5156,7 @@ fn airShuffleTwo(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { } try cg.emitWValue(operand_a); try cg.emitWValue(operand_b); - const extra_index = cg.extraLen(); + const extra_index: u32 = @intCast(cg.mir_extra.items.len); try cg.mir_extra.appendSlice(cg.gpa, &.{ @intFromEnum(std.wasm.SimdOpcode.i8x16_shuffle), @bitCast(lane_map[0..4].*), @@ -6016,9 +5926,8 @@ fn airErrorName(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { const name_ty = Type.slice_const_u8_sentinel_0; const abi_size = name_ty.abiSize(pt.zcu); - cg.wasm.error_name_table_ref_count += 1; - // Lowers to a i32.const or i64.const with the error table memory address. + cg.error_name_table_ref_count += 1; try cg.addTag(.error_name_table_ref); try cg.emitWValue(operand); switch (cg.ptr_size) { @@ -6046,7 +5955,7 @@ fn airPtrSliceFieldPtr(cg: *CodeGen, inst: Air.Inst.Index, offset: u32) InnerErr /// NOTE: Allocates place for result on virtual stack, when integer size > 64 bits fn intZeroValue(cg: *CodeGen, ty: Type) InnerError!WValue { - const zcu = cg.wasm.base.comp.zcu.?; + const zcu = cg.pt.zcu; const int_info = ty.intInfo(zcu); const wasm_bits = toWasmBits(int_info.bits) orelse { return cg.fail("TODO: Implement intZeroValue for integer bitsize: {d}", .{int_info.bits}); @@ -7673,7 +7582,3 @@ fn floatCmpIntrinsic(op: std.math.CompareOperator, bits: u16) Mir.Intrinsic { }, }; } - -fn extraLen(cg: *const CodeGen) u32 { - return @intCast(cg.mir_extra.items.len - cg.start_mir_extra_off); -} diff --git a/src/arch/wasm/Emit.zig b/src/arch/wasm/Emit.zig index 28159f3336..8024f2db9e 100644 --- a/src/arch/wasm/Emit.zig +++ b/src/arch/wasm/Emit.zig @@ -31,8 +31,8 @@ pub fn lowerToCode(emit: *Emit) Error!void { const target = &comp.root_mod.resolved_target.result; const is_wasm32 = target.cpu.arch == .wasm32; - const tags = mir.instruction_tags; - const datas = mir.instruction_datas; + const tags = mir.instructions.items(.tag); + const datas = mir.instructions.items(.data); var inst: u32 = 0; loop: switch (tags[inst]) { @@ -50,18 +50,19 @@ pub fn lowerToCode(emit: *Emit) Error!void { }, .uav_ref => { if (is_obj) { - try uavRefOffObj(wasm, code, .{ .uav_obj = datas[inst].uav_obj, .offset = 0 }, is_wasm32); + try uavRefObj(wasm, code, datas[inst].ip_index, 0, is_wasm32); } else { - try uavRefOffExe(wasm, code, .{ .uav_exe = datas[inst].uav_exe, .offset = 0 }, is_wasm32); + try uavRefExe(wasm, code, datas[inst].ip_index, 0, is_wasm32); } inst += 1; continue :loop tags[inst]; }, .uav_ref_off => { + const extra = mir.extraData(Mir.UavRefOff, datas[inst].payload).data; if (is_obj) { - try uavRefOffObj(wasm, code, mir.extraData(Mir.UavRefOffObj, datas[inst].payload).data, is_wasm32); + try uavRefObj(wasm, code, extra.value, extra.offset, is_wasm32); } else { - try uavRefOffExe(wasm, code, mir.extraData(Mir.UavRefOffExe, datas[inst].payload).data, is_wasm32); + try uavRefExe(wasm, code, extra.value, extra.offset, is_wasm32); } inst += 1; continue :loop tags[inst]; @@ -77,11 +78,14 @@ pub fn lowerToCode(emit: *Emit) Error!void { continue :loop tags[inst]; }, .func_ref => { + const indirect_func_idx: Wasm.ZcuIndirectFunctionSetIndex = @enumFromInt( + wasm.zcu_indirect_function_set.getIndex(datas[inst].nav_index).?, + ); code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); if (is_obj) { @panic("TODO"); } else { - leb.writeUleb128(code.fixedWriter(), 1 + @intFromEnum(datas[inst].indirect_function_table_index)) catch unreachable; + leb.writeUleb128(code.fixedWriter(), 1 + @intFromEnum(indirect_func_idx)) catch unreachable; } inst += 1; continue :loop tags[inst]; @@ -101,6 +105,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { continue :loop tags[inst]; }, .error_name_table_ref => { + wasm.error_name_table_ref_count += 1; try code.ensureUnusedCapacity(gpa, 11); const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; code.appendAssumeCapacity(@intFromEnum(opcode)); @@ -176,7 +181,13 @@ pub fn lowerToCode(emit: *Emit) Error!void { .call_indirect => { try code.ensureUnusedCapacity(gpa, 11); - const func_ty_index = datas[inst].func_ty; + const fn_info = comp.zcu.?.typeToFunc(.fromInterned(datas[inst].ip_index)).?; + const func_ty_index = wasm.getExistingFunctionType( + fn_info.cc, + fn_info.param_types.get(&comp.zcu.?.intern_pool), + .fromInterned(fn_info.return_type), + target, + ).?; code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call_indirect)); if (is_obj) { try wasm.out_relocs.append(gpa, .{ @@ -912,7 +923,7 @@ fn encodeMemArg(code: *std.ArrayListUnmanaged(u8), mem_arg: Mir.MemArg) void { leb.writeUleb128(code.fixedWriter(), mem_arg.offset) catch unreachable; } -fn uavRefOffObj(wasm: *Wasm, code: *std.ArrayListUnmanaged(u8), data: Mir.UavRefOffObj, is_wasm32: bool) !void { +fn uavRefObj(wasm: *Wasm, code: *std.ArrayListUnmanaged(u8), value: InternPool.Index, offset: i32, is_wasm32: bool) !void { const comp = wasm.base.comp; const gpa = comp.gpa; const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; @@ -922,14 +933,14 @@ fn uavRefOffObj(wasm: *Wasm, code: *std.ArrayListUnmanaged(u8), data: Mir.UavRef try wasm.out_relocs.append(gpa, .{ .offset = @intCast(code.items.len), - .pointee = .{ .symbol_index = try wasm.uavSymbolIndex(data.uav_obj.key(wasm).*) }, + .pointee = .{ .symbol_index = try wasm.uavSymbolIndex(value) }, .tag = if (is_wasm32) .memory_addr_leb else .memory_addr_leb64, - .addend = data.offset, + .addend = offset, }); code.appendNTimesAssumeCapacity(0, if (is_wasm32) 5 else 10); } -fn uavRefOffExe(wasm: *Wasm, code: *std.ArrayListUnmanaged(u8), data: Mir.UavRefOffExe, is_wasm32: bool) !void { +fn uavRefExe(wasm: *Wasm, code: *std.ArrayListUnmanaged(u8), value: InternPool.Index, offset: i32, is_wasm32: bool) !void { const comp = wasm.base.comp; const gpa = comp.gpa; const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; @@ -937,8 +948,8 @@ fn uavRefOffExe(wasm: *Wasm, code: *std.ArrayListUnmanaged(u8), data: Mir.UavRef try code.ensureUnusedCapacity(gpa, 11); code.appendAssumeCapacity(@intFromEnum(opcode)); - const addr = wasm.uavAddr(data.uav_exe); - leb.writeUleb128(code.fixedWriter(), @as(u32, @intCast(@as(i64, addr) + data.offset))) catch unreachable; + const addr = wasm.uavAddr(value); + leb.writeUleb128(code.fixedWriter(), @as(u32, @intCast(@as(i64, addr) + offset))) catch unreachable; } fn navRefOff(wasm: *Wasm, code: *std.ArrayListUnmanaged(u8), data: Mir.NavRefOff, is_wasm32: bool) !void { diff --git a/src/arch/wasm/Mir.zig b/src/arch/wasm/Mir.zig index 5c8c558926..3aee13acd7 100644 --- a/src/arch/wasm/Mir.zig +++ b/src/arch/wasm/Mir.zig @@ -9,16 +9,53 @@ const Mir = @This(); const InternPool = @import("../../InternPool.zig"); const Wasm = @import("../../link/Wasm.zig"); +const Emit = @import("Emit.zig"); +const Alignment = InternPool.Alignment; const builtin = @import("builtin"); const std = @import("std"); const assert = std.debug.assert; +const leb = std.leb; -instruction_tags: []const Inst.Tag, -instruction_datas: []const Inst.Data, +instructions: std.MultiArrayList(Inst).Slice, /// A slice of indexes where the meaning of the data is determined by the /// `Inst.Tag` value. extra: []const u32, +locals: []const std.wasm.Valtype, +prologue: Prologue, + +/// Not directly used by `Emit`, but the linker needs this to merge it with a global set. +/// Value is the explicit alignment if greater than natural alignment, `.none` otherwise. +uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment), +/// Not directly used by `Emit`, but the linker needs this to merge it with a global set. +indirect_function_set: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void), +/// Not directly used by `Emit`, but the linker needs this to ensure these types are interned. +func_tys: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), +/// Not directly used by `Emit`, but the linker needs this to add it to its own refcount. +error_name_table_ref_count: u32, + +pub const Prologue = extern struct { + flags: Flags, + sp_local: u32, + stack_size: u32, + bottom_stack_local: u32, + + pub const Flags = packed struct(u32) { + stack_alignment: Alignment, + padding: u26 = 0, + }; + + pub const none: Prologue = .{ + .sp_local = 0, + .flags = .{ .stack_alignment = .none }, + .stack_size = 0, + .bottom_stack_local = 0, + }; + + pub fn isNone(p: *const Prologue) bool { + return p.flags.stack_alignment != .none; + } +}; pub const Inst = struct { /// The opcode that represents this instruction @@ -80,7 +117,7 @@ pub const Inst = struct { /// Lowers to an i32_const which is the index of the function in the /// table section. /// - /// Uses `indirect_function_table_index`. + /// Uses `nav_index`. func_ref, /// Inserts debug information about the current line and column /// of the source code @@ -123,7 +160,7 @@ pub const Inst = struct { /// Calls a function pointer by its function signature /// and index into the function table. /// - /// Uses `func_ty` + /// Uses `ip_index`; the `InternPool.Index` is the function type. call_indirect, /// Calls a function by its index. /// @@ -611,11 +648,7 @@ pub const Inst = struct { ip_index: InternPool.Index, nav_index: InternPool.Nav.Index, - func_ty: Wasm.FunctionType.Index, intrinsic: Intrinsic, - uav_obj: Wasm.UavsObjIndex, - uav_exe: Wasm.UavsExeIndex, - indirect_function_table_index: Wasm.ZcuIndirectFunctionSetIndex, comptime { switch (builtin.mode) { @@ -626,10 +659,66 @@ pub const Inst = struct { }; }; -pub fn deinit(self: *Mir, gpa: std.mem.Allocator) void { - self.instructions.deinit(gpa); - gpa.free(self.extra); - self.* = undefined; +pub fn deinit(mir: *Mir, gpa: std.mem.Allocator) void { + mir.instructions.deinit(gpa); + gpa.free(mir.extra); + gpa.free(mir.locals); + mir.uavs.deinit(gpa); + mir.indirect_function_set.deinit(gpa); + mir.func_tys.deinit(gpa); + mir.* = undefined; +} + +pub fn lower(mir: *const Mir, wasm: *Wasm, code: *std.ArrayListUnmanaged(u8)) std.mem.Allocator.Error!void { + const gpa = wasm.base.comp.gpa; + + // Write the locals in the prologue of the function body. + try code.ensureUnusedCapacity(gpa, 5 + mir.locals.len * 6 + 38); + + std.leb.writeUleb128(code.fixedWriter(), @as(u32, @intCast(mir.locals.len))) catch unreachable; + for (mir.locals) |local| { + std.leb.writeUleb128(code.fixedWriter(), @as(u32, 1)) catch unreachable; + code.appendAssumeCapacity(@intFromEnum(local)); + } + + // Stack management section of function prologue. + const stack_alignment = mir.prologue.flags.stack_alignment; + if (stack_alignment.toByteUnits()) |align_bytes| { + const sp_global: Wasm.GlobalIndex = .stack_pointer; + // load stack pointer + code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.global_get)); + std.leb.writeULEB128(code.fixedWriter(), @intFromEnum(sp_global)) catch unreachable; + // store stack pointer so we can restore it when we return from the function + code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_tee)); + leb.writeUleb128(code.fixedWriter(), mir.prologue.sp_local) catch unreachable; + // get the total stack size + const aligned_stack: i32 = @intCast(stack_alignment.forward(mir.prologue.stack_size)); + code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); + leb.writeIleb128(code.fixedWriter(), aligned_stack) catch unreachable; + // subtract it from the current stack pointer + code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_sub)); + // Get negative stack alignment + const neg_stack_align = @as(i32, @intCast(align_bytes)) * -1; + code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); + leb.writeIleb128(code.fixedWriter(), neg_stack_align) catch unreachable; + // Bitwise-and the value to get the new stack pointer to ensure the + // pointers are aligned with the abi alignment. + code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_and)); + // The bottom will be used to calculate all stack pointer offsets. + code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_tee)); + leb.writeUleb128(code.fixedWriter(), mir.prologue.bottom_stack_local) catch unreachable; + // Store the current stack pointer value into the global stack pointer so other function calls will + // start from this value instead and not overwrite the current stack. + code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.global_set)); + std.leb.writeULEB128(code.fixedWriter(), @intFromEnum(sp_global)) catch unreachable; + } + + var emit: Emit = .{ + .mir = mir.*, + .wasm = wasm, + .code = code, + }; + try emit.lowerToCode(); } pub fn extraData(self: *const Mir, comptime T: type, index: usize) struct { data: T, end: usize } { @@ -643,6 +732,7 @@ pub fn extraData(self: *const Mir, comptime T: type, index: usize) struct { data Wasm.UavsObjIndex, Wasm.UavsExeIndex, InternPool.Nav.Index, + InternPool.Index, => @enumFromInt(self.extra[i]), else => |field_type| @compileError("Unsupported field type " ++ @typeName(field_type)), }; @@ -695,13 +785,8 @@ pub const MemArg = struct { alignment: u32, }; -pub const UavRefOffObj = struct { - uav_obj: Wasm.UavsObjIndex, - offset: i32, -}; - -pub const UavRefOffExe = struct { - uav_exe: Wasm.UavsExeIndex, +pub const UavRefOff = struct { + value: InternPool.Index, offset: i32, }; diff --git a/src/codegen.zig b/src/codegen.zig index ea57aaf89c..5a8f17735a 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -123,6 +123,7 @@ pub const AnyMir = union { .stage2_riscv64, .stage2_sparc64, .stage2_x86_64, + .stage2_wasm, .stage2_c, => |backend_ct| @field(mir, tag(backend_ct)).deinit(gpa), } @@ -153,6 +154,7 @@ pub fn generateFunction( .stage2_riscv64, .stage2_sparc64, .stage2_x86_64, + .stage2_wasm, .stage2_c, => |backend| { dev.check(devFeatureForBackend(backend)); @@ -784,7 +786,6 @@ fn lowerUavRef( const comp = lf.comp; const target = &comp.root_mod.resolved_target.result; const ptr_width_bytes = @divExact(target.ptrBitWidth(), 8); - const is_obj = comp.config.output_mode == .Obj; const uav_val = uav.val; const uav_ty = Type.fromInterned(ip.typeOf(uav_val)); const is_fn_body = uav_ty.zigTypeTag(zcu) == .@"fn"; @@ -804,21 +805,7 @@ fn lowerUavRef( dev.check(link.File.Tag.wasm.devFeature()); const wasm = lf.cast(.wasm).?; assert(reloc_parent == .none); - if (is_obj) { - try wasm.out_relocs.append(gpa, .{ - .offset = @intCast(code.items.len), - .pointee = .{ .symbol_index = try wasm.uavSymbolIndex(uav.val) }, - .tag = if (ptr_width_bytes == 4) .memory_addr_i32 else .memory_addr_i64, - .addend = @intCast(offset), - }); - } else { - try wasm.uav_fixups.ensureUnusedCapacity(gpa, 1); - wasm.uav_fixups.appendAssumeCapacity(.{ - .uavs_exe_index = try wasm.refUavExe(uav.val, uav.orig_ty), - .offset = @intCast(code.items.len), - .addend = @intCast(offset), - }); - } + try wasm.addUavReloc(code.items.len, uav.val, uav.orig_ty, @intCast(offset)); code.appendNTimesAssumeCapacity(0, ptr_width_bytes); return; }, diff --git a/src/link.zig b/src/link.zig index 838654775d..f49acbf3d6 100644 --- a/src/link.zig +++ b/src/link.zig @@ -759,7 +759,6 @@ pub const File = struct { switch (base.tag) { .lld => unreachable, inline else => |tag| { - if (tag == .wasm) @panic("MLUGG TODO"); if (tag == .spirv) @panic("MLUGG TODO"); dev.check(tag.devFeature()); return @as(*tag.Type(), @fieldParentPtr("base", base)).updateFunc(pt, func_index, mir, maybe_undef_air); @@ -1450,12 +1449,12 @@ pub fn doZcuTask(comp: *Compilation, tid: usize, task: ZcuTask) void { const nav = zcu.funcInfo(func.func).owner_nav; const pt: Zcu.PerThread = .activate(zcu, @enumFromInt(tid)); defer pt.deactivate(); - assert(zcu.llvm_object == null); // LLVM codegen doesn't produce MIR switch (func.mir.status.load(.monotonic)) { .pending => unreachable, .ready => {}, .failed => return, } + assert(zcu.llvm_object == null); // LLVM codegen doesn't produce MIR const mir = &func.mir.value; if (comp.bin_file) |lf| { lf.updateFunc(pt, func.func, mir, func.air) catch |err| switch (err) { diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 5c804ed21f..67e530b5cc 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -282,7 +282,7 @@ mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, /// Corresponds to `mir_instructions`. mir_extra: std.ArrayListUnmanaged(u32) = .empty, /// All local types for all Zcu functions. -all_zcu_locals: std.ArrayListUnmanaged(std.wasm.Valtype) = .empty, +mir_locals: std.ArrayListUnmanaged(std.wasm.Valtype) = .empty, params_scratch: std.ArrayListUnmanaged(std.wasm.Valtype) = .empty, returns_scratch: std.ArrayListUnmanaged(std.wasm.Valtype) = .empty, @@ -866,9 +866,24 @@ const ZcuDataStarts = struct { }; pub const ZcuFunc = union { - function: CodeGen.Function, + function: Function, tag_name: TagName, + pub const Function = extern struct { + /// Index into `Wasm.mir_instructions`. + instructions_off: u32, + /// This is unused except for as a safety slice bound and could be removed. + instructions_len: u32, + /// Index into `Wasm.mir_extra`. + extra_off: u32, + /// This is unused except for as a safety slice bound and could be removed. + extra_len: u32, + /// Index into `Wasm.mir_locals`. + locals_off: u32, + locals_len: u32, + prologue: Mir.Prologue, + }; + pub const TagName = extern struct { symbol_name: String, type_index: FunctionType.Index, @@ -3107,7 +3122,7 @@ pub fn deinit(wasm: *Wasm) void { wasm.mir_instructions.deinit(gpa); wasm.mir_extra.deinit(gpa); - wasm.all_zcu_locals.deinit(gpa); + wasm.mir_locals.deinit(gpa); if (wasm.dwarf) |*dwarf| dwarf.deinit(); @@ -3167,33 +3182,96 @@ pub fn deinit(wasm: *Wasm) void { wasm.missing_exports.deinit(gpa); } -pub fn updateFunc(wasm: *Wasm, pt: Zcu.PerThread, func_index: InternPool.Index, air: Air, liveness: Air.Liveness) !void { +pub fn updateFunc( + wasm: *Wasm, + pt: Zcu.PerThread, + func_index: InternPool.Index, + any_mir: *const codegen.AnyMir, + maybe_undef_air: *const Air, +) !void { if (build_options.skip_non_native and builtin.object_format != .wasm) { @panic("Attempted to compile for object format that was disabled by build configuration"); } dev.check(.wasm_backend); + _ = maybe_undef_air; // we (correctly) do not need this + // This linker implementation only works with codegen backend `.stage2_wasm`. + const mir = &any_mir.wasm; const zcu = pt.zcu; const gpa = zcu.gpa; - try wasm.functions.ensureUnusedCapacity(gpa, 1); - try wasm.zcu_funcs.ensureUnusedCapacity(gpa, 1); - const ip = &zcu.intern_pool; + const is_obj = zcu.comp.config.output_mode == .Obj; + const target = &zcu.comp.root_mod.resolved_target.result; const owner_nav = zcu.funcInfo(func_index).owner_nav; log.debug("updateFunc {}", .{ip.getNav(owner_nav).fqn.fmt(ip)}); + // For Wasm, we do not lower the MIR to code just yet. That lowering happens during `flush`, + // after garbage collection, which can affect function and global indexes, which affects the + // LEB integer encoding, which affects the output binary size. + + // However, we do move the MIR into a more efficient in-memory representation, where the arrays + // for all functions are packed together rather than keeping them each in their own `Mir`. + const mir_instructions_off: u32 = @intCast(wasm.mir_instructions.len); + const mir_extra_off: u32 = @intCast(wasm.mir_extra.items.len); + const mir_locals_off: u32 = @intCast(wasm.mir_locals.items.len); + { + // Copying MultiArrayList data is a little non-trivial. Resize, then memcpy both slices. + const old_len = wasm.mir_instructions.len; + try wasm.mir_instructions.resize(gpa, old_len + mir.instructions.len); + const dest_slice = wasm.mir_instructions.slice().subslice(old_len, mir.instructions.len); + const src_slice = mir.instructions; + @memcpy(dest_slice.items(.tag), src_slice.items(.tag)); + @memcpy(dest_slice.items(.data), src_slice.items(.data)); + } + try wasm.mir_extra.appendSlice(gpa, mir.extra); + try wasm.mir_locals.appendSlice(gpa, mir.locals); + + // We also need to populate some global state from `mir`. + try wasm.zcu_indirect_function_set.ensureUnusedCapacity(gpa, mir.indirect_function_set.count()); + for (mir.indirect_function_set.keys()) |nav| wasm.zcu_indirect_function_set.putAssumeCapacity(nav, {}); + for (mir.func_tys.keys()) |func_ty| { + const fn_info = zcu.typeToFunc(.fromInterned(func_ty)).?; + _ = try wasm.internFunctionType(fn_info.cc, fn_info.param_types.get(ip), .fromInterned(fn_info.return_type), target); + } + wasm.error_name_table_ref_count += mir.error_name_table_ref_count; + // We need to populate UAV data. In theory, we can lower the UAV values while we fill `mir.uavs`. + // However, lowering the data might cause *more* UAVs to be created, and mixing them up would be + // a headache. So instead, just write `undefined` placeholder code and use the `ZcuDataStarts`. const zds: ZcuDataStarts = .init(wasm); + for (mir.uavs.keys(), mir.uavs.values()) |uav_val, uav_align| { + if (uav_align != .none) { + const gop = try wasm.overaligned_uavs.getOrPut(gpa, uav_val); + gop.value_ptr.* = if (gop.found_existing) gop.value_ptr.maxStrict(uav_align) else uav_align; + } + if (is_obj) { + const gop = try wasm.uavs_obj.getOrPut(gpa, uav_val); + if (!gop.found_existing) gop.value_ptr.* = undefined; // `zds` handles lowering + } else { + const gop = try wasm.uavs_exe.getOrPut(gpa, uav_val); + if (!gop.found_existing) gop.value_ptr.* = .{ + .code = undefined, // `zds` handles lowering + .count = 0, + }; + gop.value_ptr.count += 1; + } + } + try zds.finish(wasm, pt); // actually generates the UAVs + + try wasm.functions.ensureUnusedCapacity(gpa, 1); + try wasm.zcu_funcs.ensureUnusedCapacity(gpa, 1); // This converts AIR to MIR but does not yet lower to wasm code. - // That lowering happens during `flush`, after garbage collection, which - // can affect function and global indexes, which affects the LEB integer - // encoding, which affects the output binary size. - const function = try CodeGen.function(wasm, pt, func_index, air, liveness); - wasm.zcu_funcs.putAssumeCapacity(func_index, .{ .function = function }); + wasm.zcu_funcs.putAssumeCapacity(func_index, .{ .function = .{ + .instructions_off = mir_instructions_off, + .instructions_len = @intCast(mir.instructions.len), + .extra_off = mir_extra_off, + .extra_len = @intCast(mir.extra.len), + .locals_off = mir_locals_off, + .locals_len = @intCast(mir.locals.len), + .prologue = mir.prologue, + } }); wasm.functions.putAssumeCapacity(.pack(wasm, .{ .zcu_func = @enumFromInt(wasm.zcu_funcs.entries.len - 1) }), {}); - - try zds.finish(wasm, pt); } // Generate code for the "Nav", storing it in memory to be later written to @@ -3988,58 +4066,54 @@ pub fn symbolNameIndex(wasm: *Wasm, name: String) Allocator.Error!SymbolTableInd return @enumFromInt(gop.index); } -pub fn refUavObj(wasm: *Wasm, ip_index: InternPool.Index, orig_ptr_ty: InternPool.Index) !UavsObjIndex { - const comp = wasm.base.comp; - const zcu = comp.zcu.?; - const ip = &zcu.intern_pool; - const gpa = comp.gpa; - assert(comp.config.output_mode == .Obj); - - if (orig_ptr_ty != .none) { - const abi_alignment = Zcu.Type.fromInterned(ip.typeOf(ip_index)).abiAlignment(zcu); - const explicit_alignment = ip.indexToKey(orig_ptr_ty).ptr_type.flags.alignment; - if (explicit_alignment.compare(.gt, abi_alignment)) { - const gop = try wasm.overaligned_uavs.getOrPut(gpa, ip_index); - gop.value_ptr.* = if (gop.found_existing) gop.value_ptr.maxStrict(explicit_alignment) else explicit_alignment; - } - } - - const gop = try wasm.uavs_obj.getOrPut(gpa, ip_index); - if (!gop.found_existing) gop.value_ptr.* = .{ - // Lowering the value is delayed to avoid recursion. - .code = undefined, - .relocs = undefined, - }; - return @enumFromInt(gop.index); -} - -pub fn refUavExe(wasm: *Wasm, ip_index: InternPool.Index, orig_ptr_ty: InternPool.Index) !UavsExeIndex { +pub fn addUavReloc( + wasm: *Wasm, + reloc_offset: usize, + uav_val: InternPool.Index, + orig_ptr_ty: InternPool.Index, + addend: u32, +) !void { const comp = wasm.base.comp; const zcu = comp.zcu.?; const ip = &zcu.intern_pool; const gpa = comp.gpa; - assert(comp.config.output_mode != .Obj); - if (orig_ptr_ty != .none) { - const abi_alignment = Zcu.Type.fromInterned(ip.typeOf(ip_index)).abiAlignment(zcu); - const explicit_alignment = ip.indexToKey(orig_ptr_ty).ptr_type.flags.alignment; - if (explicit_alignment.compare(.gt, abi_alignment)) { - const gop = try wasm.overaligned_uavs.getOrPut(gpa, ip_index); - gop.value_ptr.* = if (gop.found_existing) gop.value_ptr.maxStrict(explicit_alignment) else explicit_alignment; - } - } - - const gop = try wasm.uavs_exe.getOrPut(gpa, ip_index); - if (gop.found_existing) { - gop.value_ptr.count += 1; + @"align": { + const ptr_type = ip.indexToKey(orig_ptr_ty).ptr_type; + const this_align = ptr_type.flags.alignment; + if (this_align == .none) break :@"align"; + const abi_align = Zcu.Type.fromInterned(ptr_type.child).abiAlignment(zcu); + if (this_align.compare(.lte, abi_align)) break :@"align"; + const gop = try wasm.overaligned_uavs.getOrPut(gpa, uav_val); + gop.value_ptr.* = if (gop.found_existing) gop.value_ptr.maxStrict(this_align) else this_align; + } + + if (comp.config.output_mode == .Obj) { + const gop = try wasm.uavs_obj.getOrPut(gpa, uav_val); + if (!gop.found_existing) gop.value_ptr.* = undefined; // to avoid recursion, `ZcuDataStarts` will lower the value later + try wasm.out_relocs.append(gpa, .{ + .offset = @intCast(reloc_offset), + .pointee = .{ .symbol_index = try wasm.uavSymbolIndex(uav_val) }, + .tag = switch (wasm.pointerSize()) { + 32 => .memory_addr_i32, + 64 => .memory_addr_i64, + else => unreachable, + }, + .addend = @intCast(addend), + }); } else { - gop.value_ptr.* = .{ - // Lowering the value is delayed to avoid recursion. - .code = undefined, - .count = 1, + const gop = try wasm.uavs_exe.getOrPut(gpa, uav_val); + if (!gop.found_existing) gop.value_ptr.* = .{ + .code = undefined, // to avoid recursion, `ZcuDataStarts` will lower the value later + .count = 0, }; + gop.value_ptr.count += 1; + try wasm.uav_fixups.append(gpa, .{ + .uavs_exe_index = @enumFromInt(gop.index), + .offset = @intCast(reloc_offset), + .addend = addend, + }); } - return @enumFromInt(gop.index); } pub fn refNavObj(wasm: *Wasm, nav_index: InternPool.Nav.Index) !NavsObjIndex { @@ -4073,10 +4147,11 @@ pub fn refNavExe(wasm: *Wasm, nav_index: InternPool.Nav.Index) !NavsExeIndex { } /// Asserts it is called after `Flush.data_segments` is fully populated and sorted. -pub fn uavAddr(wasm: *Wasm, uav_index: UavsExeIndex) u32 { +pub fn uavAddr(wasm: *Wasm, ip_index: InternPool.Index) u32 { assert(wasm.flush_buffer.memory_layout_finished); const comp = wasm.base.comp; assert(comp.config.output_mode != .Obj); + const uav_index: UavsExeIndex = @enumFromInt(wasm.uavs_exe.getIndex(ip_index).?); const ds_id: DataSegmentId = .pack(wasm, .{ .uav_exe = uav_index }); return wasm.flush_buffer.data_segments.get(ds_id).?; } diff --git a/src/link/Wasm/Flush.zig b/src/link/Wasm/Flush.zig index 7ed72e8518..60f5971e40 100644 --- a/src/link/Wasm/Flush.zig +++ b/src/link/Wasm/Flush.zig @@ -9,6 +9,7 @@ const Alignment = Wasm.Alignment; const String = Wasm.String; const Relocation = Wasm.Relocation; const InternPool = @import("../../InternPool.zig"); +const Mir = @import("../../arch/wasm/Mir.zig"); const build_options = @import("build_options"); @@ -868,7 +869,21 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { .enum_type => { try emitTagNameFunction(wasm, binary_bytes, f.data_segments.get(.__zig_tag_name_table).?, i.value(wasm).tag_name.table_index, ip_index); }, - else => try i.value(wasm).function.lower(wasm, binary_bytes), + else => { + const func = i.value(wasm).function; + const mir: Mir = .{ + .instructions = wasm.mir_instructions.slice().subslice(func.instructions_off, func.instructions_len), + .extra = wasm.mir_extra.items[func.extra_off..][0..func.extra_len], + .locals = wasm.mir_locals.items[func.locals_off..][0..func.locals_len], + .prologue = func.prologue, + // These fields are unused by `lower`. + .uavs = undefined, + .indirect_function_set = undefined, + .func_tys = undefined, + .error_name_table_ref_count = undefined, + }; + try mir.lower(wasm, binary_bytes); + }, } }, }; diff --git a/src/target.zig b/src/target.zig index 01c6a6cbf0..a408c82c14 100644 --- a/src/target.zig +++ b/src/target.zig @@ -851,7 +851,7 @@ pub inline fn backendSupportsFeature(backend: std.builtin.CompilerBackend, compt .separate_thread => switch (backend) { .stage2_llvm => false, // MLUGG TODO - .stage2_c => true, + .stage2_c, .stage2_wasm => true, else => false, }, }; -- cgit v1.2.3 From c95b1bf2d3c3ae7595e15ad521952b77d5063801 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Sat, 7 Jun 2025 04:51:26 -0400 Subject: x86_64: remove air references from mir --- lib/std/zig/Zir.zig | 9 + src/Air.zig | 4 +- src/Air/print.zig | 5 +- src/Compilation.zig | 3 - src/Sema.zig | 22 +- src/Type.zig | 24 +- src/Zcu/PerThread.zig | 14 +- src/arch/aarch64/CodeGen.zig | 25 +- src/arch/aarch64/Mir.zig | 2 - src/arch/arm/CodeGen.zig | 26 +- src/arch/arm/Mir.zig | 2 - src/arch/riscv64/CodeGen.zig | 22 +- src/arch/riscv64/Mir.zig | 2 - src/arch/sparc64/CodeGen.zig | 30 +-- src/arch/sparc64/Mir.zig | 2 - src/arch/wasm/CodeGen.zig | 4 +- src/arch/x86_64/CodeGen.zig | 564 +++++++++++++++++++++---------------------- src/arch/x86_64/Emit.zig | 190 ++++++++------- src/arch/x86_64/Lower.zig | 38 ++- src/arch/x86_64/Mir.zig | 119 +++++---- src/codegen.zig | 6 +- src/codegen/llvm.zig | 15 +- src/link.zig | 13 +- src/link/C.zig | 6 - src/link/Coff.zig | 5 - src/link/Dwarf.zig | 177 ++++++++++++-- src/link/Elf.zig | 4 +- src/link/Elf/ZigObject.zig | 5 - src/link/Goff.zig | 3 - src/link/MachO.zig | 4 +- src/link/MachO/ZigObject.zig | 5 - src/link/Plan9.zig | 4 - src/link/Wasm.zig | 3 - src/link/Xcoff.zig | 3 - 34 files changed, 744 insertions(+), 616 deletions(-) (limited to 'src/codegen.zig') diff --git a/lib/std/zig/Zir.zig b/lib/std/zig/Zir.zig index 440b4df9fc..17643e6f1e 100644 --- a/lib/std/zig/Zir.zig +++ b/lib/std/zig/Zir.zig @@ -4861,6 +4861,15 @@ pub fn getParamBody(zir: Zir, fn_inst: Inst.Index) []const Zir.Inst.Index { } } +pub fn getParamName(zir: Zir, param_inst: Inst.Index) ?NullTerminatedString { + const inst = zir.instructions.get(@intFromEnum(param_inst)); + return switch (inst.tag) { + .param, .param_comptime => zir.extraData(Inst.Param, inst.data.pl_tok.payload_index).data.name, + .param_anytype, .param_anytype_comptime => inst.data.str_tok.start, + else => null, + }; +} + pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { const tags = zir.instructions.items(.tag); const datas = zir.instructions.items(.data); diff --git a/src/Air.zig b/src/Air.zig index 4810766e71..74f4c57424 100644 --- a/src/Air.zig +++ b/src/Air.zig @@ -1153,9 +1153,7 @@ pub const Inst = struct { ty: Type, arg: struct { ty: Ref, - /// Index into `extra` of a null-terminated string representing the parameter name. - /// This is `.none` if debug info is stripped. - name: NullTerminatedString, + zir_param_index: u32, }, ty_op: struct { ty: Ref, diff --git a/src/Air/print.zig b/src/Air/print.zig index 343c640a63..7f5f396cae 100644 --- a/src/Air/print.zig +++ b/src/Air/print.zig @@ -363,10 +363,7 @@ const Writer = struct { fn writeArg(w: *Writer, s: anytype, inst: Air.Inst.Index) @TypeOf(s).Error!void { const arg = w.air.instructions.items(.data)[@intFromEnum(inst)].arg; try w.writeType(s, arg.ty.toType()); - switch (arg.name) { - .none => {}, - _ => try s.print(", \"{}\"", .{std.zig.fmtEscapes(arg.name.toSlice(w.air))}), - } + try s.print(", {d}", .{arg.zir_param_index}); } fn writeTyOp(w: *Writer, s: anytype, inst: Air.Inst.Index) @TypeOf(s).Error!void { diff --git a/src/Compilation.zig b/src/Compilation.zig index b9b51222eb..fe4671848d 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -4589,10 +4589,8 @@ fn processOneJob(tid: usize, comp: *Compilation, job: Job) JobError!void { comp.dispatchZcuLinkTask(tid, .{ .link_func = .{ .func = func.func, .mir = shared_mir, - .air = undefined, } }); } else { - const emit_needs_air = !zcu.backendSupportsFeature(.separate_thread); { const pt: Zcu.PerThread = .activate(comp.zcu.?, @enumFromInt(tid)); defer pt.deactivate(); @@ -4602,7 +4600,6 @@ fn processOneJob(tid: usize, comp: *Compilation, job: Job) JobError!void { comp.dispatchZcuLinkTask(tid, .{ .link_func = .{ .func = func.func, .mir = shared_mir, - .air = if (emit_needs_air) &air else undefined, } }); air.deinit(gpa); } diff --git a/src/Sema.zig b/src/Sema.zig index 87837d96d5..97c9217a5e 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -35088,24 +35088,24 @@ pub fn resolveUnionLayout(sema: *Sema, ty: Type) SemaError!void { var max_align: Alignment = .@"1"; for (0..union_type.field_types.len) |field_index| { const field_ty: Type = .fromInterned(union_type.field_types.get(ip)[field_index]); + if (field_ty.isNoReturn(pt.zcu)) continue; - if (try field_ty.comptimeOnlySema(pt) or field_ty.zigTypeTag(pt.zcu) == .noreturn) continue; // TODO: should this affect alignment? - - max_size = @max(max_size, field_ty.abiSizeSema(pt) catch |err| switch (err) { - error.AnalysisFail => { - const msg = sema.err orelse return err; - try sema.addFieldErrNote(ty, field_index, msg, "while checking this field", .{}); - return err; - }, - else => return err, - }); + if (try field_ty.hasRuntimeBitsSema(pt)) { + max_size = @max(max_size, field_ty.abiSizeSema(pt) catch |err| switch (err) { + error.AnalysisFail => { + const msg = sema.err orelse return err; + try sema.addFieldErrNote(ty, field_index, msg, "while checking this field", .{}); + return err; + }, + else => return err, + }); + } const explicit_align = union_type.fieldAlign(ip, field_index); const field_align = if (explicit_align != .none) explicit_align else try field_ty.abiAlignmentSema(pt); - max_align = max_align.max(field_align); } diff --git a/src/Type.zig b/src/Type.zig index 00f1c70129..64b389cf5f 100644 --- a/src/Type.zig +++ b/src/Type.zig @@ -177,6 +177,7 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error const zcu = pt.zcu; const ip = &zcu.intern_pool; switch (ip.indexToKey(ty.toIntern())) { + .undef => return writer.writeAll("@as(type, undefined)"), .int_type => |int_type| { const sign_char: u8 = switch (int_type.signedness) { .signed => 'i', @@ -398,7 +399,6 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error }, // values, not types - .undef, .simple_value, .variable, .@"extern", @@ -3921,23 +3921,25 @@ pub fn getUnionLayout(loaded_union: InternPool.LoadedUnionType, zcu: *const Zcu) var payload_size: u64 = 0; var payload_align: InternPool.Alignment = .@"1"; for (loaded_union.field_types.get(ip), 0..) |field_ty, field_index| { - if (!Type.fromInterned(field_ty).hasRuntimeBitsIgnoreComptime(zcu)) continue; + if (Type.fromInterned(field_ty).isNoReturn(zcu)) continue; const explicit_align = loaded_union.fieldAlign(ip, field_index); const field_align = if (explicit_align != .none) explicit_align else Type.fromInterned(field_ty).abiAlignment(zcu); - const field_size = Type.fromInterned(field_ty).abiSize(zcu); - if (field_size > payload_size) { - payload_size = field_size; - biggest_field = @intCast(field_index); - } - if (field_align.compare(.gte, payload_align)) { - payload_align = field_align; - most_aligned_field = @intCast(field_index); - most_aligned_field_size = field_size; + if (Type.fromInterned(field_ty).hasRuntimeBits(zcu)) { + const field_size = Type.fromInterned(field_ty).abiSize(zcu); + if (field_size > payload_size) { + payload_size = field_size; + biggest_field = @intCast(field_index); + } + if (field_align.compare(.gte, payload_align)) { + most_aligned_field = @intCast(field_index); + most_aligned_field_size = field_size; + } } + payload_align = payload_align.max(field_align); } const have_tag = loaded_union.flagsUnordered(ip).runtime_tag.hasTag(); if (!have_tag or !Type.fromInterned(loaded_union.enum_tag_ty).hasRuntimeBits(zcu)) { diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index 6f0eeba864..f8efa40dc0 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -2893,17 +2893,10 @@ fn analyzeFnBodyInner(pt: Zcu.PerThread, func_index: InternPool.Index) Zcu.SemaE runtime_params_len; var runtime_param_index: usize = 0; - for (fn_info.param_body[0..src_params_len]) |inst| { + for (fn_info.param_body[0..src_params_len], 0..) |inst, zir_param_index| { const gop = sema.inst_map.getOrPutAssumeCapacity(inst); if (gop.found_existing) continue; // provided above by comptime arg - const param_inst_info = sema.code.instructions.get(@intFromEnum(inst)); - const param_name: Zir.NullTerminatedString = switch (param_inst_info.tag) { - .param_anytype => param_inst_info.data.str_tok.start, - .param => sema.code.extraData(Zir.Inst.Param, param_inst_info.data.pl_tok.payload_index).data.name, - else => unreachable, - }; - const param_ty = fn_ty_info.param_types.get(ip)[runtime_param_index]; runtime_param_index += 1; @@ -2923,10 +2916,7 @@ fn analyzeFnBodyInner(pt: Zcu.PerThread, func_index: InternPool.Index) Zcu.SemaE .tag = .arg, .data = .{ .arg = .{ .ty = Air.internedToRef(param_ty), - .name = if (inner_block.ownerModule().strip) - .none - else - try sema.appendAirString(sema.code.nullTerminatedString(param_name)), + .zir_param_index = @intCast(zir_param_index), } }, }); } diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig index 0c29fd96e2..4aaf6bf85c 100644 --- a/src/arch/aarch64/CodeGen.zig +++ b/src/arch/aarch64/CodeGen.zig @@ -4208,15 +4208,22 @@ fn airArg(self: *Self, inst: Air.Inst.Index) InnerError!void { while (self.args[arg_index] == .none) arg_index += 1; self.arg_index = arg_index + 1; - const ty = self.typeOfIndex(inst); - const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; - const name = self.air.instructions.items(.data)[@intFromEnum(inst)].arg.name; - if (name != .none) try self.dbg_info_relocs.append(self.gpa, .{ - .tag = tag, - .ty = ty, - .name = name.toSlice(self.air), - .mcv = self.args[arg_index], - }); + const zcu = self.pt.zcu; + const func_zir = zcu.funcInfo(self.func_index).zir_body_inst.resolveFull(&zcu.intern_pool).?; + const file = zcu.fileByIndex(func_zir.file); + if (!file.mod.?.strip) { + const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; + const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg; + const ty = self.typeOfIndex(inst); + const zir = &file.zir.?; + const name = zir.nullTerminatedString(zir.getParamName(zir.getParamBody(func_zir.inst)[arg.zir_param_index]).?); + try self.dbg_info_relocs.append(self.gpa, .{ + .tag = tag, + .ty = ty, + .name = name, + .mcv = self.args[arg_index], + }); + } const result: MCValue = if (self.liveness.isUnused(inst)) .dead else self.args[arg_index]; return self.finishAir(inst, result, .{ .none, .none, .none }); diff --git a/src/arch/aarch64/Mir.zig b/src/arch/aarch64/Mir.zig index 34fcc64c7e..88089c8488 100644 --- a/src/arch/aarch64/Mir.zig +++ b/src/arch/aarch64/Mir.zig @@ -514,9 +514,7 @@ pub fn emit( func_index: InternPool.Index, code: *std.ArrayListUnmanaged(u8), debug_output: link.File.DebugInfoOutput, - air: *const @import("../../Air.zig"), ) codegen.CodeGenError!void { - _ = air; // using this would be a bug const zcu = pt.zcu; const func = zcu.funcInfo(func_index); const nav = func.owner_nav; diff --git a/src/arch/arm/CodeGen.zig b/src/arch/arm/CodeGen.zig index 3868011557..09304bf1de 100644 --- a/src/arch/arm/CodeGen.zig +++ b/src/arch/arm/CodeGen.zig @@ -4191,16 +4191,22 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void { while (self.args[arg_index] == .none) arg_index += 1; self.arg_index = arg_index + 1; - const ty = self.typeOfIndex(inst); - const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; - - const name = self.air.instructions.items(.data)[@intFromEnum(inst)].arg.name; - if (name != .none) try self.dbg_info_relocs.append(self.gpa, .{ - .tag = tag, - .ty = ty, - .name = name.toSlice(self.air), - .mcv = self.args[arg_index], - }); + const zcu = self.pt.zcu; + const func_zir = zcu.funcInfo(self.func_index).zir_body_inst.resolveFull(&zcu.intern_pool).?; + const file = zcu.fileByIndex(func_zir.file); + if (!file.mod.?.strip) { + const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; + const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg; + const ty = self.typeOfIndex(inst); + const zir = &file.zir.?; + const name = zir.nullTerminatedString(zir.getParamName(zir.getParamBody(func_zir.inst)[arg.zir_param_index]).?); + try self.dbg_info_relocs.append(self.gpa, .{ + .tag = tag, + .ty = ty, + .name = name, + .mcv = self.args[arg_index], + }); + } const result: MCValue = if (self.liveness.isUnused(inst)) .dead else self.args[arg_index]; return self.finishAir(inst, result, .{ .none, .none, .none }); diff --git a/src/arch/arm/Mir.zig b/src/arch/arm/Mir.zig index 0366663eae..5b7585a2ca 100644 --- a/src/arch/arm/Mir.zig +++ b/src/arch/arm/Mir.zig @@ -294,9 +294,7 @@ pub fn emit( func_index: InternPool.Index, code: *std.ArrayListUnmanaged(u8), debug_output: link.File.DebugInfoOutput, - air: *const @import("../../Air.zig"), ) codegen.CodeGenError!void { - _ = air; // using this would be a bug const zcu = pt.zcu; const func = zcu.funcInfo(func_index); const nav = func.owner_nav; diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig index 9b5e0ed69b..080760bbab 100644 --- a/src/arch/riscv64/CodeGen.zig +++ b/src/arch/riscv64/CodeGen.zig @@ -70,6 +70,7 @@ mod: *Package.Module, target: *const std.Target, args: []MCValue, ret_mcv: InstTracking, +func_index: InternPool.Index, fn_type: Type, arg_index: usize, src_loc: Zcu.LazySrcLoc, @@ -774,6 +775,7 @@ pub fn generate( .owner = .{ .nav_index = func.owner_nav }, .args = undefined, // populated after `resolveCallingConventionValues` .ret_mcv = undefined, // populated after `resolveCallingConventionValues` + .func_index = func_index, .fn_type = fn_type, .arg_index = 0, .branch_stack = &branch_stack, @@ -877,6 +879,7 @@ pub fn generateLazy( .owner = .{ .lazy_sym = lazy_sym }, .args = undefined, // populated after `resolveCallingConventionValues` .ret_mcv = undefined, // populated after `resolveCallingConventionValues` + .func_index = undefined, .fn_type = undefined, .arg_index = 0, .branch_stack = undefined, @@ -4724,10 +4727,8 @@ fn airFieldParentPtr(func: *Func, inst: Air.Inst.Index) !void { return func.fail("TODO implement codegen airFieldParentPtr", .{}); } -fn genArgDbgInfo(func: *const Func, inst: Air.Inst.Index, mcv: MCValue) InnerError!void { - const arg = func.air.instructions.items(.data)[@intFromEnum(inst)].arg; - const ty = arg.ty.toType(); - if (arg.name == .none) return; +fn genArgDbgInfo(func: *const Func, name: []const u8, ty: Type, mcv: MCValue) InnerError!void { + assert(!func.mod.strip); // TODO: Add a pseudo-instruction or something to defer this work until Emit. // We aren't allowed to interact with linker state here. @@ -4736,7 +4737,7 @@ fn genArgDbgInfo(func: *const Func, inst: Air.Inst.Index, mcv: MCValue) InnerErr .dwarf => |dw| switch (mcv) { .register => |reg| dw.genLocalDebugInfo( .local_arg, - arg.name.toSlice(func.air), + name, ty, .{ .reg = reg.dwarfNum() }, ) catch |err| return func.fail("failed to generate debug info: {s}", .{@errorName(err)}), @@ -4749,6 +4750,8 @@ fn genArgDbgInfo(func: *const Func, inst: Air.Inst.Index, mcv: MCValue) InnerErr } fn airArg(func: *Func, inst: Air.Inst.Index) InnerError!void { + const zcu = func.pt.zcu; + var arg_index = func.arg_index; // we skip over args that have no bits @@ -4765,7 +4768,14 @@ fn airArg(func: *Func, inst: Air.Inst.Index) InnerError!void { try func.genCopy(arg_ty, dst_mcv, src_mcv); - try func.genArgDbgInfo(inst, src_mcv); + const arg = func.air.instructions.items(.data)[@intFromEnum(inst)].arg; + // can delete `func.func_index` if this logic is moved to emit + const func_zir = zcu.funcInfo(func.func_index).zir_body_inst.resolveFull(&zcu.intern_pool).?; + const file = zcu.fileByIndex(func_zir.file); + const zir = &file.zir.?; + const name = zir.nullTerminatedString(zir.getParamName(zir.getParamBody(func_zir.inst)[arg.zir_param_index]).?); + + try func.genArgDbgInfo(name, arg_ty, src_mcv); break :result dst_mcv; }; diff --git a/src/arch/riscv64/Mir.zig b/src/arch/riscv64/Mir.zig index eef3fe7511..2ad75e4677 100644 --- a/src/arch/riscv64/Mir.zig +++ b/src/arch/riscv64/Mir.zig @@ -117,9 +117,7 @@ pub fn emit( func_index: InternPool.Index, code: *std.ArrayListUnmanaged(u8), debug_output: link.File.DebugInfoOutput, - air: *const @import("../../Air.zig"), ) codegen.CodeGenError!void { - _ = air; // using this would be a bug const zcu = pt.zcu; const comp = zcu.comp; const gpa = comp.gpa; diff --git a/src/arch/sparc64/CodeGen.zig b/src/arch/sparc64/CodeGen.zig index 180aaedd3c..b35f45dd64 100644 --- a/src/arch/sparc64/CodeGen.zig +++ b/src/arch/sparc64/CodeGen.zig @@ -995,23 +995,29 @@ fn airArg(self: *Self, inst: Air.Inst.Index) InnerError!void { self.arg_index += 1; const ty = self.typeOfIndex(inst); - - const arg = self.args[arg_index]; - const mcv = blk: { - switch (arg) { + const mcv: MCValue = blk: { + switch (self.args[arg_index]) { .stack_offset => |off| { const abi_size = math.cast(u32, ty.abiSize(zcu)) orelse { return self.fail("type '{}' too big to fit into stack frame", .{ty.fmt(pt)}); }; const offset = off + abi_size; - break :blk MCValue{ .stack_offset = offset }; + break :blk .{ .stack_offset = offset }; }, - else => break :blk arg, + else => |mcv| break :blk mcv, } }; - self.genArgDbgInfo(inst, mcv) catch |err| - return self.fail("failed to generate debug info for parameter: {s}", .{@errorName(err)}); + const func_zir = zcu.funcInfo(self.func_index).zir_body_inst.resolveFull(&zcu.intern_pool).?; + const file = zcu.fileByIndex(func_zir.file); + if (!file.mod.?.strip) { + const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg; + const zir = &file.zir.?; + const name = zir.nullTerminatedString(zir.getParamName(zir.getParamBody(func_zir.inst)[arg.zir_param_index]).?); + + self.genArgDbgInfo(name, ty, mcv) catch |err| + return self.fail("failed to generate debug info for parameter: {s}", .{@errorName(err)}); + } if (self.liveness.isUnused(inst)) return self.finishAirBookkeeping(); @@ -3539,11 +3545,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Air. self.finishAirBookkeeping(); } -fn genArgDbgInfo(self: Self, inst: Air.Inst.Index, mcv: MCValue) !void { - const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg; - const ty = arg.ty.toType(); - if (arg.name == .none) return; - +fn genArgDbgInfo(self: Self, name: []const u8, ty: Type, mcv: MCValue) !void { // TODO: Add a pseudo-instruction or something to defer this work until Emit. // We aren't allowed to interact with linker state here. if (true) return; @@ -3551,7 +3553,7 @@ fn genArgDbgInfo(self: Self, inst: Air.Inst.Index, mcv: MCValue) !void { .dwarf => |dw| switch (mcv) { .register => |reg| try dw.genLocalDebugInfo( .local_arg, - arg.name.toSlice(self.air), + name, ty, .{ .reg = reg.dwarfNum() }, ), diff --git a/src/arch/sparc64/Mir.zig b/src/arch/sparc64/Mir.zig index 26c5c3267b..842ac10fed 100644 --- a/src/arch/sparc64/Mir.zig +++ b/src/arch/sparc64/Mir.zig @@ -382,9 +382,7 @@ pub fn emit( func_index: InternPool.Index, code: *std.ArrayListUnmanaged(u8), debug_output: link.File.DebugInfoOutput, - air: *const @import("../../Air.zig"), ) codegen.CodeGenError!void { - _ = air; // using this would be a bug const zcu = pt.zcu; const func = zcu.funcInfo(func_index); const nav = func.owner_nav; diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig index 2993923589..2936025a49 100644 --- a/src/arch/wasm/CodeGen.zig +++ b/src/arch/wasm/CodeGen.zig @@ -1877,7 +1877,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { .dbg_inline_block => cg.airDbgInlineBlock(inst), .dbg_var_ptr => cg.airDbgVar(inst, .local_var, true), .dbg_var_val => cg.airDbgVar(inst, .local_var, false), - .dbg_arg_inline => cg.airDbgVar(inst, .local_arg, false), + .dbg_arg_inline => cg.airDbgVar(inst, .arg, false), .call => cg.airCall(inst, .auto), .call_always_tail => cg.airCall(inst, .always_tail), @@ -6427,7 +6427,7 @@ fn airDbgInlineBlock(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { fn airDbgVar( cg: *CodeGen, inst: Air.Inst.Index, - local_tag: link.File.Dwarf.WipNav.LocalTag, + local_tag: link.File.Dwarf.WipNav.LocalVarTag, is_ptr: bool, ) InnerError!void { _ = is_ptr; diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 1d95c8db77..7d88307ba5 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -129,7 +129,6 @@ target: *const std.Target, owner: Owner, inline_func: InternPool.Index, mod: *Module, -arg_index: u32, args: []MCValue, va_info: union { sysv: struct { @@ -151,6 +150,8 @@ eflags_inst: ?Air.Inst.Index = null, mir_instructions: std.MultiArrayList(Mir.Inst) = .empty, /// MIR extra data mir_extra: std.ArrayListUnmanaged(u32) = .empty, +mir_local_name_bytes: std.ArrayListUnmanaged(u8) = .empty, +mir_local_types: std.ArrayListUnmanaged(InternPool.Index) = .empty, mir_table: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, /// The value is an offset into the `Function` `code` from the beginning. @@ -978,8 +979,10 @@ pub fn generate( const gpa = zcu.gpa; const ip = &zcu.intern_pool; const func = zcu.funcInfo(func_index); + const func_zir = func.zir_body_inst.resolveFull(ip).?; + const file = zcu.fileByIndex(func_zir.file); const fn_type: Type = .fromInterned(func.ty); - const mod = zcu.navFileScope(func.owner_nav).mod.?; + const mod = file.mod.?; var function: CodeGen = .{ .gpa = gpa, @@ -991,7 +994,6 @@ pub fn generate( .bin_file = bin_file, .owner = .{ .nav_index = func.owner_nav }, .inline_func = func_index, - .arg_index = undefined, .args = undefined, // populated after `resolveCallingConventionValues` .va_info = undefined, // populated after `resolveCallingConventionValues` .ret_mcv = undefined, // populated after `resolveCallingConventionValues` @@ -1011,6 +1013,8 @@ pub fn generate( function.inst_tracking.deinit(gpa); function.epilogue_relocs.deinit(gpa); function.mir_instructions.deinit(gpa); + function.mir_local_name_bytes.deinit(gpa); + function.mir_local_types.deinit(gpa); function.mir_extra.deinit(gpa); function.mir_table.deinit(gpa); } @@ -1078,7 +1082,7 @@ pub fn generate( ); } - function.gen() catch |err| switch (err) { + function.gen(&file.zir.?, func_zir.inst, func.comptime_args, call_info.air_arg_count) catch |err| switch (err) { error.CodegenFail => return error.CodegenFail, error.OutOfRegisters => return function.fail("ran out of registers (Zig compiler bug)", .{}), else => |e| return e, @@ -1097,17 +1101,32 @@ pub fn generate( var mir: Mir = .{ .instructions = .empty, .extra = &.{}, + .local_name_bytes = &.{}, + .local_types = &.{}, .table = &.{}, .frame_locs = .empty, }; errdefer mir.deinit(gpa); mir.instructions = function.mir_instructions.toOwnedSlice(); mir.extra = try function.mir_extra.toOwnedSlice(gpa); + mir.local_name_bytes = try function.mir_local_name_bytes.toOwnedSlice(gpa); + mir.local_types = try function.mir_local_types.toOwnedSlice(gpa); mir.table = try function.mir_table.toOwnedSlice(gpa); mir.frame_locs = function.frame_locs.toOwnedSlice(); return mir; } +pub fn toTmpMir(cg: *CodeGen) Mir { + return .{ + .instructions = cg.mir_instructions.slice(), + .extra = cg.mir_extra.items, + .local_name_bytes = cg.mir_local_name_bytes.items, + .local_types = cg.mir_local_types.items, + .table = cg.mir_table.items, + .frame_locs = cg.frame_locs.slice(), + }; +} + pub fn generateLazy( bin_file: *link.File, pt: Zcu.PerThread, @@ -1130,7 +1149,6 @@ pub fn generateLazy( .bin_file = bin_file, .owner = .{ .lazy_sym = lazy_sym }, .inline_func = undefined, - .arg_index = undefined, .args = undefined, .va_info = undefined, .ret_mcv = undefined, @@ -1141,6 +1159,8 @@ pub fn generateLazy( defer { function.inst_tracking.deinit(gpa); function.mir_instructions.deinit(gpa); + function.mir_local_name_bytes.deinit(gpa); + function.mir_local_types.deinit(gpa); function.mir_extra.deinit(gpa); function.mir_table.deinit(gpa); } @@ -1156,21 +1176,12 @@ pub fn generateLazy( else => |e| return e, }; - var mir: Mir = .{ - .instructions = function.mir_instructions.toOwnedSlice(), - .extra = try function.mir_extra.toOwnedSlice(gpa), - .table = try function.mir_table.toOwnedSlice(gpa), - .frame_locs = function.frame_locs.toOwnedSlice(), - }; - defer mir.deinit(gpa); - var emit: Emit = .{ - .air = function.air, .lower = .{ .bin_file = bin_file, .target = function.target, .allocator = gpa, - .mir = mir, + .mir = function.toTmpMir(), .cc = .auto, .src_loc = src_loc, .output_mode = comp.config.output_mode, @@ -1240,22 +1251,16 @@ fn formatWipMir( writer: anytype, ) @TypeOf(writer).Error!void { const comp = data.self.bin_file.comp; - const mod = comp.root_mod; var lower: Lower = .{ .bin_file = data.self.bin_file, .target = data.self.target, .allocator = data.self.gpa, - .mir = .{ - .instructions = data.self.mir_instructions.slice(), - .extra = data.self.mir_extra.items, - .table = data.self.mir_table.items, - .frame_locs = (std.MultiArrayList(Mir.FrameLoc){}).slice(), - }, + .mir = data.self.toTmpMir(), .cc = .auto, .src_loc = data.self.src_loc, .output_mode = comp.config.output_mode, .link_mode = comp.config.link_mode, - .pic = mod.pic, + .pic = data.self.mod.pic, }; var first = true; for ((lower.lowerMir(data.inst) catch |err| switch (err) { @@ -1291,7 +1296,9 @@ fn formatWipMir( .pseudo_dbg_epilogue_begin_none, .pseudo_dbg_enter_block_none, .pseudo_dbg_leave_block_none, + .pseudo_dbg_arg_none, .pseudo_dbg_var_args_none, + .pseudo_dbg_var_none, .pseudo_dead_none, => {}, .pseudo_dbg_line_stmt_line_column, .pseudo_dbg_line_line_column => try writer.print( @@ -1299,57 +1306,47 @@ fn formatWipMir( mir_inst.data.line_column, ), .pseudo_dbg_enter_inline_func, .pseudo_dbg_leave_inline_func => try writer.print(" {}", .{ - ip.getNav(ip.indexToKey(mir_inst.data.func).func.owner_nav).name.fmt(ip), + ip.getNav(ip.indexToKey(mir_inst.data.ip_index).func.owner_nav).name.fmt(ip), }), - .pseudo_dbg_local_a => try writer.print(" {}", .{mir_inst.data.a.air_inst}), - .pseudo_dbg_local_ai_s => try writer.print(" {}, {d}", .{ - mir_inst.data.ai.air_inst, - @as(i32, @bitCast(mir_inst.data.ai.i)), + .pseudo_dbg_arg_i_s, .pseudo_dbg_var_i_s => try writer.print(" {d}", .{ + @as(i32, @bitCast(mir_inst.data.i.i)), }), - .pseudo_dbg_local_ai_u => try writer.print(" {}, {d}", .{ - mir_inst.data.ai.air_inst, - mir_inst.data.ai.i, + .pseudo_dbg_arg_i_u, .pseudo_dbg_var_i_u => try writer.print(" {d}", .{ + mir_inst.data.i.i, }), - .pseudo_dbg_local_ai_64 => try writer.print(" {}, {d}", .{ - mir_inst.data.ai.air_inst, - lower.mir.extraData(Mir.Imm64, mir_inst.data.ai.i).data.decode(), + .pseudo_dbg_arg_i_64, .pseudo_dbg_var_i_64 => try writer.print(" {d}", .{ + mir_inst.data.i64, }), - .pseudo_dbg_local_as => { + .pseudo_dbg_arg_reloc, .pseudo_dbg_var_reloc => { const mem_op: encoder.Instruction.Operand = .{ .mem = .initSib(.qword, .{ - .base = .{ .reloc = mir_inst.data.as.sym_index }, + .base = .{ .reloc = mir_inst.data.reloc.sym_index }, + .disp = mir_inst.data.reloc.off, }) }; - try writer.print(" {}, {}", .{ mir_inst.data.as.air_inst, mem_op.fmt(.m) }); + try writer.print(" {}", .{mem_op.fmt(.m)}); }, - .pseudo_dbg_local_aso => { - const sym_off = lower.mir.extraData(bits.SymbolOffset, mir_inst.data.ax.payload).data; + .pseudo_dbg_arg_ro, .pseudo_dbg_var_ro => { const mem_op: encoder.Instruction.Operand = .{ .mem = .initSib(.qword, .{ - .base = .{ .reloc = sym_off.sym_index }, - .disp = sym_off.off, + .base = .{ .reg = mir_inst.data.ro.reg }, + .disp = mir_inst.data.ro.off, }) }; - try writer.print(" {}, {}", .{ mir_inst.data.ax.air_inst, mem_op.fmt(.m) }); + try writer.print(" {}", .{mem_op.fmt(.m)}); }, - .pseudo_dbg_local_aro => { - const air_off = lower.mir.extraData(Mir.AirOffset, mir_inst.data.rx.payload).data; + .pseudo_dbg_arg_fa, .pseudo_dbg_var_fa => { const mem_op: encoder.Instruction.Operand = .{ .mem = .initSib(.qword, .{ - .base = .{ .reg = mir_inst.data.rx.r1 }, - .disp = air_off.off, + .base = .{ .frame = mir_inst.data.fa.index }, + .disp = mir_inst.data.fa.off, }) }; - try writer.print(" {}, {}", .{ air_off.air_inst, mem_op.fmt(.m) }); + try writer.print(" {}", .{mem_op.fmt(.m)}); }, - .pseudo_dbg_local_af => { - const frame_addr = lower.mir.extraData(bits.FrameAddr, mir_inst.data.ax.payload).data; - const mem_op: encoder.Instruction.Operand = .{ .mem = .initSib(.qword, .{ - .base = .{ .frame = frame_addr.index }, - .disp = frame_addr.off, - }) }; - try writer.print(" {}, {}", .{ mir_inst.data.ax.air_inst, mem_op.fmt(.m) }); - }, - .pseudo_dbg_local_am => { + .pseudo_dbg_arg_m, .pseudo_dbg_var_m => { const mem_op: encoder.Instruction.Operand = .{ - .mem = lower.mir.extraData(Mir.Memory, mir_inst.data.ax.payload).data.decode(), + .mem = lower.mir.extraData(Mir.Memory, mir_inst.data.x.payload).data.decode(), }; - try writer.print(" {}, {}", .{ mir_inst.data.ax.air_inst, mem_op.fmt(.m) }); + try writer.print(" {}", .{mem_op.fmt(.m)}); }, + .pseudo_dbg_arg_val, .pseudo_dbg_var_val => try writer.print(" {}", .{ + Value.fromInterned(mir_inst.data.ip_index).fmtValue(data.self.pt), + }), } } } @@ -1640,124 +1637,6 @@ fn asmPlaceholder(self: *CodeGen) !Mir.Inst.Index { }); } -const MirTagAir = enum { dbg_local }; - -fn asmAir(self: *CodeGen, tag: MirTagAir, inst: Air.Inst.Index) !void { - _ = try self.addInst(.{ - .tag = .pseudo, - .ops = switch (tag) { - .dbg_local => .pseudo_dbg_local_a, - }, - .data = .{ .a = .{ .air_inst = inst } }, - }); -} - -fn asmAirImmediate(self: *CodeGen, tag: MirTagAir, inst: Air.Inst.Index, imm: Immediate) !void { - switch (imm) { - .signed => |s| _ = try self.addInst(.{ - .tag = .pseudo, - .ops = switch (tag) { - .dbg_local => .pseudo_dbg_local_ai_s, - }, - .data = .{ .ai = .{ - .air_inst = inst, - .i = @bitCast(s), - } }, - }), - .unsigned => |u| _ = if (std.math.cast(u32, u)) |small| try self.addInst(.{ - .tag = .pseudo, - .ops = switch (tag) { - .dbg_local => .pseudo_dbg_local_ai_u, - }, - .data = .{ .ai = .{ - .air_inst = inst, - .i = small, - } }, - }) else try self.addInst(.{ - .tag = .pseudo, - .ops = switch (tag) { - .dbg_local => .pseudo_dbg_local_ai_64, - }, - .data = .{ .ai = .{ - .air_inst = inst, - .i = try self.addExtra(Mir.Imm64.encode(u)), - } }, - }), - .reloc => |sym_off| _ = if (sym_off.off == 0) try self.addInst(.{ - .tag = .pseudo, - .ops = switch (tag) { - .dbg_local => .pseudo_dbg_local_as, - }, - .data = .{ .as = .{ - .air_inst = inst, - .sym_index = sym_off.sym_index, - } }, - }) else try self.addInst(.{ - .tag = .pseudo, - .ops = switch (tag) { - .dbg_local => .pseudo_dbg_local_aso, - }, - .data = .{ .ax = .{ - .air_inst = inst, - .payload = try self.addExtra(sym_off), - } }, - }), - } -} - -fn asmAirRegisterImmediate( - self: *CodeGen, - tag: MirTagAir, - inst: Air.Inst.Index, - reg: Register, - imm: Immediate, -) !void { - _ = try self.addInst(.{ - .tag = .pseudo, - .ops = switch (tag) { - .dbg_local => .pseudo_dbg_local_aro, - }, - .data = .{ .rx = .{ - .r1 = reg, - .payload = try self.addExtra(Mir.AirOffset{ - .air_inst = inst, - .off = imm.signed, - }), - } }, - }); -} - -fn asmAirFrameAddress( - self: *CodeGen, - tag: MirTagAir, - inst: Air.Inst.Index, - frame_addr: bits.FrameAddr, -) !void { - _ = try self.addInst(.{ - .tag = .pseudo, - .ops = switch (tag) { - .dbg_local => .pseudo_dbg_local_af, - }, - .data = .{ .ax = .{ - .air_inst = inst, - .payload = try self.addExtra(frame_addr), - } }, - }); -} - -fn asmAirMemory(self: *CodeGen, tag: MirTagAir, inst: Air.Inst.Index, m: Memory) !void { - _ = try self.addInst(.{ - .tag = .pseudo, - .ops = switch (tag) { - .dbg_local => .pseudo_dbg_local_am, - }, - .data = .{ .ax = .{ - .air_inst = inst, - .payload = try self.addExtra(Mir.Memory.encode(m)), - } }, - }); -} - fn asmOpOnly(self: *CodeGen, tag: Mir.Inst.FixedTag) !void { _ = try self.addInst(.{ .tag = tag[1], @@ -2233,7 +2112,13 @@ fn asmMemoryRegisterImmediate( }); } -fn gen(self: *CodeGen) InnerError!void { +fn gen( + self: *CodeGen, + zir: *const std.zig.Zir, + func_zir_inst: std.zig.Zir.Inst.Index, + comptime_args: InternPool.Index.Slice, + air_arg_count: u32, +) InnerError!void { const pt = self.pt; const zcu = pt.zcu; const fn_info = zcu.typeToFunc(self.fn_type).?; @@ -2303,7 +2188,7 @@ fn gen(self: *CodeGen) InnerError!void { if (!self.mod.strip) try self.asmPseudo(.pseudo_dbg_prologue_end_none); - try self.genBody(self.air.getMainBody()); + try self.genMainBody(zir, func_zir_inst, comptime_args, air_arg_count); const epilogue = if (self.epilogue_relocs.items.len > 0) epilogue: { var last_inst: Mir.Inst.Index = @intCast(self.mir_instructions.len - 1); @@ -2438,20 +2323,81 @@ fn gen(self: *CodeGen) InnerError!void { } } else { if (!self.mod.strip) try self.asmPseudo(.pseudo_dbg_prologue_end_none); - try self.genBody(self.air.getMainBody()); + try self.genMainBody(zir, func_zir_inst, comptime_args, air_arg_count); if (!self.mod.strip) try self.asmPseudo(.pseudo_dbg_epilogue_begin_none); } } -fn checkInvariantsAfterAirInst(self: *CodeGen) void { - assert(!self.register_manager.lockedRegsExist()); +fn genMainBody( + cg: *CodeGen, + zir: *const std.zig.Zir, + func_zir_inst: std.zig.Zir.Inst.Index, + comptime_args: InternPool.Index.Slice, + air_arg_count: u32, +) InnerError!void { + const pt = cg.pt; + const zcu = pt.zcu; + const ip = &zcu.intern_pool; + + const main_body = cg.air.getMainBody(); + const air_args_body = main_body[0..air_arg_count]; + try cg.genBody(air_args_body); + + if (!cg.mod.strip) { + var air_arg_index: usize = 0; + const fn_info = zcu.typeToFunc(cg.fn_type).?; + var fn_param_index: usize = 0; + try cg.mir_local_types.ensureTotalCapacity(cg.gpa, fn_info.param_types.len); + var zir_param_index: usize = 0; + for (zir.getParamBody(func_zir_inst)) |zir_param_inst| { + const name = zir.nullTerminatedString(zir.getParamName(zir_param_inst) orelse continue); + defer zir_param_index += 1; + try cg.mir_local_name_bytes.appendSlice(cg.gpa, name[0 .. name.len + 1]); + + if (comptime_args.len > 0) switch (comptime_args.get(ip)[zir_param_index]) { + .none => {}, + else => |comptime_arg| { + _ = try cg.addInst(.{ + .tag = .pseudo, + .ops = .pseudo_dbg_arg_val, + .data = .{ .ip_index = comptime_arg }, + }); + continue; + }, + }; + + const arg_ty: Type = .fromInterned(fn_info.param_types.get(ip)[fn_param_index]); + fn_param_index += 1; + cg.mir_local_types.appendAssumeCapacity(arg_ty.toIntern()); + + if (air_arg_index == air_args_body.len) { + try cg.asmPseudo(.pseudo_dbg_arg_none); + continue; + } + const air_arg_inst = air_args_body[air_arg_index]; + const air_arg_data = cg.air.instructions.items(.data)[air_arg_index].arg; + if (air_arg_data.zir_param_index != zir_param_index) { + try cg.asmPseudo(.pseudo_dbg_arg_none); + continue; + } + air_arg_index += 1; + try cg.genLocalDebugInfo(.arg, arg_ty, cg.getResolvedInstValue(air_arg_inst).short); + } + if (fn_info.is_var_args) try cg.asmPseudo(.pseudo_dbg_var_args_none); + } + + try cg.genBody(main_body[air_arg_count..]); +} + +fn checkInvariantsAfterAirInst(cg: *CodeGen) void { + assert(!cg.register_manager.lockedRegsExist()); if (std.debug.runtime_safety) { // check consistency of tracked registers - var it = self.register_manager.free_registers.iterator(.{ .kind = .unset }); + var it = cg.register_manager.free_registers.iterator(.{ .kind = .unset }); while (it.next()) |index| { - const tracked_inst = self.register_manager.registers[index]; - const tracking = self.getResolvedInstValue(tracked_inst); + const tracked_inst = cg.register_manager.registers[index]; + const tracking = cg.getResolvedInstValue(tracked_inst); for (tracking.getRegs()) |reg| { if (RegisterManager.indexOfRegIntoTracked(reg).? == index) break; } else unreachable; // tracked register not in use @@ -2459,10 +2405,10 @@ fn checkInvariantsAfterAirInst(self: *CodeGen) void { } } -fn genBodyBlock(self: *CodeGen, body: []const Air.Inst.Index) InnerError!void { - if (!self.mod.strip) try self.asmPseudo(.pseudo_dbg_enter_block_none); - try self.genBody(body); - if (!self.mod.strip) try self.asmPseudo(.pseudo_dbg_leave_block_none); +fn genBodyBlock(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { + if (!cg.mod.strip) try cg.asmPseudo(.pseudo_dbg_enter_block_none); + try cg.genBody(body); + if (!cg.mod.strip) try cg.asmPseudo(.pseudo_dbg_leave_block_none); } fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { @@ -2474,25 +2420,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { const air_datas = cg.air.instructions.items(.data); const use_old = cg.target.ofmt == .coff; - cg.arg_index = 0; - for (body) |inst| switch (air_tags[@intFromEnum(inst)]) { - .arg => { - wip_mir_log.debug("{}", .{cg.fmtAir(inst)}); - verbose_tracking_log.debug("{}", .{cg.fmtTracking()}); - - cg.reused_operands = .initEmpty(); - try cg.inst_tracking.ensureUnusedCapacity(cg.gpa, 1); - - try cg.airArg(inst); - - try cg.resetTemps(@enumFromInt(0)); - cg.checkInvariantsAfterAirInst(); - }, - else => break, - }; - - if (cg.arg_index == 0) try cg.airDbgVarArgs(); - cg.arg_index = 0; for (body) |inst| { if (cg.liveness.isUnused(inst) and !cg.air.mustLower(inst, ip)) continue; wip_mir_log.debug("{}", .{cg.fmtAir(inst)}); @@ -2506,20 +2433,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .shuffle_one, .shuffle_two => @panic("x86_64 TODO: shuffle_one/shuffle_two"), // zig fmt: on - .arg => if (!cg.mod.strip) { - // skip zero-bit arguments as they don't have a corresponding arg instruction - var arg_index = cg.arg_index; - while (cg.args[arg_index] == .none) arg_index += 1; - cg.arg_index = arg_index + 1; - - const name = air_datas[@intFromEnum(inst)].arg.name; - if (name != .none) try cg.genLocalDebugInfo(inst, cg.getResolvedInstValue(inst).short); - if (cg.liveness.isUnused(inst)) try cg.processDeath(inst); - - for (cg.args[arg_index + 1 ..]) |arg| { - if (arg != .none) break; - } else try cg.airDbgVarArgs(); - }, + .arg => try cg.airArg(inst), .add, .add_optimized, .add_wrap => |air_tag| if (use_old) try cg.airBinOp(inst, switch (air_tag) { else => unreachable, .add, .add_optimized => .add, @@ -85181,19 +85095,19 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { if (!cg.mod.strip) _ = try cg.addInst(.{ .tag = .pseudo, .ops = .pseudo_dbg_enter_inline_func, - .data = .{ .func = dbg_inline_block.data.func }, + .data = .{ .ip_index = dbg_inline_block.data.func }, }); try cg.lowerBlock(inst, @ptrCast(cg.air.extra.items[dbg_inline_block.end..][0..dbg_inline_block.data.body_len])); if (!cg.mod.strip) _ = try cg.addInst(.{ .tag = .pseudo, .ops = .pseudo_dbg_leave_inline_func, - .data = .{ .func = old_inline_func }, + .data = .{ .ip_index = old_inline_func }, }); }, .dbg_var_ptr, .dbg_var_val, .dbg_arg_inline, - => if (use_old) try cg.airDbgVar(inst) else if (!cg.mod.strip) { + => |air_tag| if (use_old) try cg.airDbgVar(inst) else if (!cg.mod.strip) { const pl_op = air_datas[@intFromEnum(inst)].pl_op; var ops = try cg.tempsFromOperands(inst, .{pl_op.operand}); var mcv = ops[0].tracking(cg).short; @@ -85209,7 +85123,16 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, }, } - try cg.genLocalDebugInfo(inst, ops[0].tracking(cg).short); + + const name_nts: Air.NullTerminatedString = @enumFromInt(pl_op.payload); + assert(name_nts != .none); + const name = name_nts.toSlice(cg.air); + try cg.mir_local_name_bytes.appendSlice(cg.gpa, name[0 .. name.len + 1]); + + const ty = cg.typeOf(pl_op.operand); + try cg.mir_local_types.append(cg.gpa, ty.toIntern()); + + try cg.genLocalDebugInfo(air_tag, ty, ops[0].tracking(cg).short); try ops[0].die(cg); }, .is_null => if (use_old) try cg.airIsNull(inst) else { @@ -173321,16 +173244,14 @@ fn genIntMulComplexOpMir(self: *CodeGen, dst_ty: Type, dst_mcv: MCValue, src_mcv } fn airArg(self: *CodeGen, inst: Air.Inst.Index) !void { - const pt = self.pt; - const zcu = pt.zcu; - // skip zero-bit arguments as they don't have a corresponding arg instruction - var arg_index = self.arg_index; - while (self.args[arg_index] == .none) arg_index += 1; - self.arg_index = arg_index + 1; - + const zcu = self.pt.zcu; + const arg_index = for (self.args, 0..) |arg, arg_index| { + if (arg != .none) break arg_index; + } else unreachable; + const src_mcv = self.args[arg_index]; + self.args = self.args[arg_index + 1 ..]; const result: MCValue = if (self.mod.strip and self.liveness.isUnused(inst)) .unreach else result: { const arg_ty = self.typeOfIndex(inst); - const src_mcv = self.args[arg_index]; switch (src_mcv) { .register, .register_pair, .load_frame => { for (src_mcv.getRegs()) |reg| self.register_manager.getRegAssumeFree(reg, inst); @@ -173429,68 +173350,108 @@ fn airArg(self: *CodeGen, inst: Air.Inst.Index) !void { return self.finishAir(inst, result, .{ .none, .none, .none }); } -fn airDbgVarArgs(self: *CodeGen) !void { - if (self.mod.strip) return; - if (!self.pt.zcu.typeToFunc(self.fn_type).?.is_var_args) return; - try self.asmPseudo(.pseudo_dbg_var_args_none); -} - -fn genLocalDebugInfo( - self: *CodeGen, - inst: Air.Inst.Index, - mcv: MCValue, -) !void { - if (self.mod.strip) return; - switch (self.air.instructions.items(.tag)[@intFromEnum(inst)]) { +fn genLocalDebugInfo(cg: *CodeGen, air_tag: Air.Inst.Tag, ty: Type, mcv: MCValue) !void { + assert(!cg.mod.strip); + _ = switch (air_tag) { else => unreachable, - .arg, .dbg_arg_inline, .dbg_var_val => |tag| { - switch (mcv) { - .none => try self.asmAir(.dbg_local, inst), - .unreach, .dead, .elementwise_args, .reserved_frame, .air_ref => unreachable, - .immediate => |imm| try self.asmAirImmediate(.dbg_local, inst, .u(imm)), - .lea_frame => |frame_addr| try self.asmAirFrameAddress(.dbg_local, inst, frame_addr), - .lea_symbol => |sym_off| try self.asmAirImmediate(.dbg_local, inst, .rel(sym_off)), - else => { - const ty = switch (tag) { - else => unreachable, - .arg => self.typeOfIndex(inst), - .dbg_arg_inline, .dbg_var_val => self.typeOf( - self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op.operand, - ), - }; - const frame_index = try self.allocFrameIndex(.initSpill(ty, self.pt.zcu)); - try self.genSetMem(.{ .frame = frame_index }, 0, ty, mcv, .{}); - try self.asmAirMemory(.dbg_local, inst, .{ - .base = .{ .frame = frame_index }, - .mod = .{ .rm = .{ .size = .qword } }, - }); + .arg, .dbg_var_val, .dbg_arg_inline => switch (mcv) { + .none, .unreach, .dead, .elementwise_args, .reserved_frame, .air_ref => unreachable, + .immediate => |imm| if (std.math.cast(u32, imm)) |small| try cg.addInst(.{ + .tag = .pseudo, + .ops = switch (air_tag) { + else => unreachable, + .arg, .dbg_arg_inline => .pseudo_dbg_arg_i_u, + .dbg_var_val => .pseudo_dbg_var_i_u, }, - } + .data = .{ .i = .{ .i = small } }, + }) else try cg.addInst(.{ + .tag = .pseudo, + .ops = switch (air_tag) { + else => unreachable, + .arg, .dbg_arg_inline => .pseudo_dbg_arg_i_64, + .dbg_var_val => .pseudo_dbg_var_i_64, + }, + .data = .{ .i64 = imm }, + }), + .lea_frame => |frame_addr| try cg.addInst(.{ + .tag = .pseudo, + .ops = switch (air_tag) { + else => unreachable, + .arg, .dbg_arg_inline => .pseudo_dbg_arg_fa, + .dbg_var_val => .pseudo_dbg_var_fa, + }, + .data = .{ .fa = frame_addr }, + }), + .lea_symbol => |sym_off| try cg.addInst(.{ + .tag = .pseudo, + .ops = switch (air_tag) { + else => unreachable, + .arg, .dbg_arg_inline => .pseudo_dbg_arg_reloc, + .dbg_var_val => .pseudo_dbg_var_reloc, + }, + .data = .{ .reloc = sym_off }, + }), + else => { + const frame_index = try cg.allocFrameIndex(.initSpill(ty, cg.pt.zcu)); + try cg.genSetMem(.{ .frame = frame_index }, 0, ty, mcv, .{}); + _ = try cg.addInst(.{ + .tag = .pseudo, + .ops = switch (air_tag) { + else => unreachable, + .arg, .dbg_arg_inline => .pseudo_dbg_arg_m, + .dbg_var_val => .pseudo_dbg_var_m, + }, + .data = .{ .x = .{ + .payload = try cg.addExtra(Mir.Memory.encode(.{ + .base = .{ .frame = frame_index }, + .mod = .{ .rm = .{ .size = .qword } }, + })), + } }, + }); + }, }, .dbg_var_ptr => switch (mcv) { else => unreachable, - .unreach, .dead, .elementwise_args, .reserved_frame, .air_ref => unreachable, - .lea_frame => |frame_addr| try self.asmAirMemory(.dbg_local, inst, .{ - .base = .{ .frame = frame_addr.index }, - .mod = .{ .rm = .{ - .size = .qword, - .disp = frame_addr.off, + .none, .unreach, .dead, .elementwise_args, .reserved_frame, .air_ref => unreachable, + .lea_frame => |frame_addr| try cg.addInst(.{ + .tag = .pseudo, + .ops = .pseudo_dbg_var_m, + .data = .{ .x = .{ + .payload = try cg.addExtra(Mir.Memory.encode(.{ + .base = .{ .frame = frame_addr.index }, + .mod = .{ .rm = .{ + .size = .qword, + .disp = frame_addr.off, + } }, + })), } }, }), // debug info should explicitly ignore pcrel requirements - .lea_symbol, .lea_pcrel => |sym_off| try self.asmAirMemory(.dbg_local, inst, .{ - .base = .{ .reloc = sym_off.sym_index }, - .mod = .{ .rm = .{ - .size = .qword, - .disp = sym_off.off, + .lea_symbol, .lea_pcrel => |sym_off| try cg.addInst(.{ + .tag = .pseudo, + .ops = .pseudo_dbg_var_m, + .data = .{ .x = .{ + .payload = try cg.addExtra(Mir.Memory.encode(.{ + .base = .{ .reloc = sym_off.sym_index }, + .mod = .{ .rm = .{ + .size = .qword, + .disp = sym_off.off, + } }, + })), } }, }), - .lea_direct, .lea_got => |sym_index| try self.asmAirMemory(.dbg_local, inst, .{ - .base = .{ .reloc = sym_index }, - .mod = .{ .rm = .{ .size = .qword } }, + .lea_direct, .lea_got => |sym_index| try cg.addInst(.{ + .tag = .pseudo, + .ops = .pseudo_dbg_var_m, + .data = .{ .x = .{ + .payload = try cg.addExtra(Mir.Memory.encode(.{ + .base = .{ .reloc = sym_index }, + .mod = .{ .rm = .{ .size = .qword } }, + })), + } }, }), }, - } + }; } fn airRetAddr(self: *CodeGen, inst: Air.Inst.Index) !void { @@ -173514,8 +173475,8 @@ fn airCall(self: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif @ptrCast(self.air.extra.items[extra.end..][0..extra.data.args_len]); const ExpectedContents = extern struct { - tys: [16][@sizeOf(Type)]u8 align(@alignOf(Type)), - vals: [16][@sizeOf(MCValue)]u8 align(@alignOf(MCValue)), + tys: [32][@sizeOf(Type)]u8 align(@alignOf(Type)), + vals: [32][@sizeOf(MCValue)]u8 align(@alignOf(MCValue)), }; var stack align(@max(@alignOf(ExpectedContents), @alignOf(std.heap.StackFallbackAllocator(0)))) = std.heap.stackFallback(@sizeOf(ExpectedContents), self.gpa); @@ -173570,9 +173531,9 @@ fn genCall(self: *CodeGen, info: union(enum) { const fn_info = zcu.typeToFunc(fn_ty).?; const ExpectedContents = extern struct { - var_args: [16][@sizeOf(Type)]u8 align(@alignOf(Type)), - frame_indices: [16]FrameIndex, - reg_locks: [16][@sizeOf(?RegisterLock)]u8 align(@alignOf(?RegisterLock)), + var_args: [32][@sizeOf(Type)]u8 align(@alignOf(Type)), + frame_indices: [32]FrameIndex, + reg_locks: [32][@sizeOf(?RegisterLock)]u8 align(@alignOf(?RegisterLock)), }; var stack align(@max(@alignOf(ExpectedContents), @alignOf(std.heap.StackFallbackAllocator(0)))) = std.heap.stackFallback(@sizeOf(ExpectedContents), self.gpa); @@ -174488,10 +174449,21 @@ fn genTry( return result; } -fn airDbgVar(self: *CodeGen, inst: Air.Inst.Index) !void { - const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; - try self.genLocalDebugInfo(inst, try self.resolveInst(pl_op.operand)); - return self.finishAir(inst, .unreach, .{ pl_op.operand, .none, .none }); +fn airDbgVar(cg: *CodeGen, inst: Air.Inst.Index) !void { + if (cg.mod.strip) return; + const air_tag = cg.air.instructions.items(.tag)[@intFromEnum(inst)]; + const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; + + const name_nts: Air.NullTerminatedString = @enumFromInt(pl_op.payload); + assert(name_nts != .none); + const name = name_nts.toSlice(cg.air); + try cg.mir_local_name_bytes.appendSlice(cg.gpa, name[0 .. name.len + 1]); + + const ty = cg.typeOf(pl_op.operand); + try cg.mir_local_types.append(cg.gpa, ty.toIntern()); + + try cg.genLocalDebugInfo(air_tag, ty, try cg.resolveInst(pl_op.operand)); + return cg.finishAir(inst, .unreach, .{ pl_op.operand, .none, .none }); } fn genCondBrMir(self: *CodeGen, ty: Type, mcv: MCValue) !Mir.Inst.Index { @@ -181477,6 +181449,7 @@ fn lowerUav(self: *CodeGen, val: Value, alignment: InternPool.Alignment) InnerEr const CallMCValues = struct { args: []MCValue, + air_arg_count: u32, return_value: InstTracking, stack_byte_count: u31, stack_align: InternPool.Alignment, @@ -181512,13 +181485,14 @@ fn resolveCallingConventionValues( const param_types = try allocator.alloc(Type, fn_info.param_types.len + var_args.len); defer allocator.free(param_types); - for (param_types[0..fn_info.param_types.len], fn_info.param_types.get(ip)) |*dest, src| - dest.* = .fromInterned(src); + for (param_types[0..fn_info.param_types.len], fn_info.param_types.get(ip)) |*param_ty, arg_ty| + param_ty.* = .fromInterned(arg_ty); for (param_types[fn_info.param_types.len..], var_args) |*param_ty, arg_ty| param_ty.* = self.promoteVarArg(arg_ty); var result: CallMCValues = .{ .args = try self.gpa.alloc(MCValue, param_types.len), + .air_arg_count = 0, // These undefined values must be populated before returning from this function. .return_value = undefined, .stack_byte_count = 0, @@ -181640,6 +181614,7 @@ fn resolveCallingConventionValues( // Input params for (param_types, result.args) |ty, *arg| { assert(ty.hasRuntimeBitsIgnoreComptime(zcu)); + result.air_arg_count += 1; switch (cc) { .x86_64_sysv => {}, .x86_64_win => { @@ -181812,6 +181787,7 @@ fn resolveCallingConventionValues( arg.* = .none; continue; } + result.air_arg_count += 1; const param_size: u31 = @intCast(param_ty.abiSize(zcu)); if (abi.zigcc.params_in_regs) switch (self.regClassForType(param_ty)) { .general_purpose, .gphi => if (param_gpr.len >= 1 and param_size <= @as(u4, switch (self.target.cpu.arch) { diff --git a/src/arch/x86_64/Emit.zig b/src/arch/x86_64/Emit.zig index d4116974cf..cbbfdab202 100644 --- a/src/arch/x86_64/Emit.zig +++ b/src/arch/x86_64/Emit.zig @@ -1,6 +1,5 @@ //! This file contains the functionality for emitting x86_64 MIR as machine code -air: Air, lower: Lower, atom_index: u32, debug_output: link.File.DebugInfoOutput, @@ -22,6 +21,8 @@ pub fn emitMir(emit: *Emit) Error!void { defer relocs.deinit(emit.lower.allocator); var table_relocs: std.ArrayListUnmanaged(TableReloc) = .empty; defer table_relocs.deinit(emit.lower.allocator); + var local_name_index: usize = 0; + var local_index: usize = 0; for (0..emit.lower.mir.instructions.len) |mir_i| { const mir_index: Mir.Inst.Index = @intCast(mir_i); code_offset_mapping[mir_index] = @intCast(emit.code.items.len); @@ -338,7 +339,7 @@ pub fn emitMir(emit: *Emit) Error!void { log.debug("mirDbgEnterInline (line={d}, col={d})", .{ emit.prev_di_loc.line, emit.prev_di_loc.column, }); - try dwarf.enterInlineFunc(mir_inst.data.func, emit.code.items.len, emit.prev_di_loc.line, emit.prev_di_loc.column); + try dwarf.enterInlineFunc(mir_inst.data.ip_index, emit.code.items.len, emit.prev_di_loc.line, emit.prev_di_loc.column); }, .plan9 => {}, .none => {}, @@ -348,77 +349,61 @@ pub fn emitMir(emit: *Emit) Error!void { log.debug("mirDbgLeaveInline (line={d}, col={d})", .{ emit.prev_di_loc.line, emit.prev_di_loc.column, }); - try dwarf.leaveInlineFunc(mir_inst.data.func, emit.code.items.len); + try dwarf.leaveInlineFunc(mir_inst.data.ip_index, emit.code.items.len); }, .plan9 => {}, .none => {}, }, - .pseudo_dbg_local_a, - .pseudo_dbg_local_ai_s, - .pseudo_dbg_local_ai_u, - .pseudo_dbg_local_ai_64, - .pseudo_dbg_local_as, - .pseudo_dbg_local_aso, - .pseudo_dbg_local_aro, - .pseudo_dbg_local_af, - .pseudo_dbg_local_am, + .pseudo_dbg_arg_none, + .pseudo_dbg_arg_i_s, + .pseudo_dbg_arg_i_u, + .pseudo_dbg_arg_i_64, + .pseudo_dbg_arg_reloc, + .pseudo_dbg_arg_ro, + .pseudo_dbg_arg_fa, + .pseudo_dbg_arg_m, + .pseudo_dbg_var_none, + .pseudo_dbg_var_i_s, + .pseudo_dbg_var_i_u, + .pseudo_dbg_var_i_64, + .pseudo_dbg_var_reloc, + .pseudo_dbg_var_ro, + .pseudo_dbg_var_fa, + .pseudo_dbg_var_m, => switch (emit.debug_output) { .dwarf => |dwarf| { var loc_buf: [2]link.File.Dwarf.Loc = undefined; - const air_inst_index, const loc: link.File.Dwarf.Loc = switch (mir_inst.ops) { + const loc: link.File.Dwarf.Loc = loc: switch (mir_inst.ops) { else => unreachable, - .pseudo_dbg_local_a => .{ mir_inst.data.a.air_inst, .empty }, - .pseudo_dbg_local_ai_s, - .pseudo_dbg_local_ai_u, - .pseudo_dbg_local_ai_64, - => .{ mir_inst.data.ai.air_inst, .{ .stack_value = stack_value: { - loc_buf[0] = switch (emit.lower.imm(mir_inst.ops, mir_inst.data.ai.i)) { + .pseudo_dbg_arg_none, .pseudo_dbg_var_none => .empty, + .pseudo_dbg_arg_i_s, + .pseudo_dbg_arg_i_u, + .pseudo_dbg_var_i_s, + .pseudo_dbg_var_i_u, + => .{ .stack_value = stack_value: { + loc_buf[0] = switch (emit.lower.imm(mir_inst.ops, mir_inst.data.i.i)) { .signed => |s| .{ .consts = s }, .unsigned => |u| .{ .constu = u }, }; break :stack_value &loc_buf[0]; - } } }, - .pseudo_dbg_local_as => .{ mir_inst.data.as.air_inst, .{ - .addr_reloc = mir_inst.data.as.sym_index, } }, - .pseudo_dbg_local_aso => loc: { - const sym_off = emit.lower.mir.extraData( - bits.SymbolOffset, - mir_inst.data.ax.payload, - ).data; - break :loc .{ mir_inst.data.ax.air_inst, .{ .plus = .{ - sym: { - loc_buf[0] = .{ .addr_reloc = sym_off.sym_index }; - break :sym &loc_buf[0]; - }, - off: { - loc_buf[1] = .{ .consts = sym_off.off }; - break :off &loc_buf[1]; - }, - } } }; - }, - .pseudo_dbg_local_aro => loc: { - const air_off = emit.lower.mir.extraData( - Mir.AirOffset, - mir_inst.data.rx.payload, - ).data; - break :loc .{ air_off.air_inst, .{ .plus = .{ - reg: { - loc_buf[0] = .{ .breg = mir_inst.data.rx.r1.dwarfNum() }; - break :reg &loc_buf[0]; - }, - off: { - loc_buf[1] = .{ .consts = air_off.off }; - break :off &loc_buf[1]; - }, - } } }; - }, - .pseudo_dbg_local_af => loc: { - const reg_off = emit.lower.mir.resolveFrameAddr(emit.lower.mir.extraData( - bits.FrameAddr, - mir_inst.data.ax.payload, - ).data); - break :loc .{ mir_inst.data.ax.air_inst, .{ .plus = .{ + .pseudo_dbg_arg_i_64, .pseudo_dbg_var_i_64 => .{ .stack_value = stack_value: { + loc_buf[0] = .{ .constu = mir_inst.data.i64 }; + break :stack_value &loc_buf[0]; + } }, + .pseudo_dbg_arg_reloc, .pseudo_dbg_var_reloc => .{ .plus = .{ + sym: { + loc_buf[0] = .{ .addr_reloc = mir_inst.data.reloc.sym_index }; + break :sym &loc_buf[0]; + }, + off: { + loc_buf[1] = .{ .consts = mir_inst.data.reloc.off }; + break :off &loc_buf[1]; + }, + } }, + .pseudo_dbg_arg_fa, .pseudo_dbg_var_fa => { + const reg_off = emit.lower.mir.resolveFrameAddr(mir_inst.data.fa); + break :loc .{ .plus = .{ reg: { loc_buf[0] = .{ .breg = reg_off.reg.dwarfNum() }; break :reg &loc_buf[0]; @@ -427,11 +412,11 @@ pub fn emitMir(emit: *Emit) Error!void { loc_buf[1] = .{ .consts = reg_off.off }; break :off &loc_buf[1]; }, - } } }; + } }; }, - .pseudo_dbg_local_am => loc: { - const mem = emit.lower.mem(undefined, mir_inst.data.ax.payload); - break :loc .{ mir_inst.data.ax.air_inst, .{ .plus = .{ + .pseudo_dbg_arg_m, .pseudo_dbg_var_m => { + const mem = emit.lower.mem(undefined, mir_inst.data.x.payload); + break :loc .{ .plus = .{ base: { loc_buf[0] = switch (mem.base()) { .none => .{ .constu = 0 }, @@ -449,30 +434,64 @@ pub fn emitMir(emit: *Emit) Error!void { }; break :disp &loc_buf[1]; }, - } } }; + } }; }, }; - const ip = &emit.lower.bin_file.comp.zcu.?.intern_pool; - const air_inst = emit.air.instructions.get(@intFromEnum(air_inst_index)); - const name: Air.NullTerminatedString = switch (air_inst.tag) { - else => unreachable, - .arg => air_inst.data.arg.name, - .dbg_var_ptr, .dbg_var_val, .dbg_arg_inline => @enumFromInt(air_inst.data.pl_op.payload), - }; - try dwarf.genLocalDebugInfo( - switch (air_inst.tag) { + + const local_name_bytes = emit.lower.mir.local_name_bytes[local_name_index..]; + const local_name = local_name_bytes[0..std.mem.indexOfScalar(u8, local_name_bytes, 0).? :0]; + local_name_index += local_name.len + 1; + + const local_type = emit.lower.mir.local_types[local_index]; + local_index += 1; + + try dwarf.genLocalVarDebugInfo( + switch (mir_inst.ops) { else => unreachable, - .arg, .dbg_arg_inline => .local_arg, - .dbg_var_ptr, .dbg_var_val => .local_var, + .pseudo_dbg_arg_none, + .pseudo_dbg_arg_i_s, + .pseudo_dbg_arg_i_u, + .pseudo_dbg_arg_i_64, + .pseudo_dbg_arg_reloc, + .pseudo_dbg_arg_ro, + .pseudo_dbg_arg_fa, + .pseudo_dbg_arg_m, + .pseudo_dbg_arg_val, + => .arg, + .pseudo_dbg_var_none, + .pseudo_dbg_var_i_s, + .pseudo_dbg_var_i_u, + .pseudo_dbg_var_i_64, + .pseudo_dbg_var_reloc, + .pseudo_dbg_var_ro, + .pseudo_dbg_var_fa, + .pseudo_dbg_var_m, + .pseudo_dbg_var_val, + => .local_var, }, - name.toSlice(emit.air), - switch (air_inst.tag) { + local_name, + .fromInterned(local_type), + loc, + ); + }, + .plan9 => {}, + .none => {}, + }, + .pseudo_dbg_arg_val, .pseudo_dbg_var_val => switch (emit.debug_output) { + .dwarf => |dwarf| { + const local_name_bytes = emit.lower.mir.local_name_bytes[local_name_index..]; + const local_name = local_name_bytes[0..std.mem.indexOfScalar(u8, local_name_bytes, 0).? :0]; + local_name_index += local_name.len + 1; + + try dwarf.genLocalConstDebugInfo( + emit.lower.src_loc, + switch (mir_inst.ops) { else => unreachable, - .arg => emit.air.typeOfIndex(air_inst_index, ip), - .dbg_var_ptr => emit.air.typeOf(air_inst.data.pl_op.operand, ip).childTypeIp(ip), - .dbg_var_val, .dbg_arg_inline => emit.air.typeOf(air_inst.data.pl_op.operand, ip), + .pseudo_dbg_arg_val => .comptime_arg, + .pseudo_dbg_var_val => .local_const, }, - loc, + local_name, + .fromInterned(mir_inst.data.ip_index), ); }, .plan9 => {}, @@ -611,11 +630,10 @@ fn dbgAdvancePCAndLine(emit: *Emit, loc: Loc) Error!void { } const bits = @import("bits.zig"); +const Emit = @This(); +const InternPool = @import("../../InternPool.zig"); const link = @import("../../link.zig"); const log = std.log.scoped(.emit); -const std = @import("std"); - -const Air = @import("../../Air.zig"); -const Emit = @This(); const Lower = @import("Lower.zig"); const Mir = @import("Mir.zig"); +const std = @import("std"); diff --git a/src/arch/x86_64/Lower.zig b/src/arch/x86_64/Lower.zig index 838f155d10..54b419103f 100644 --- a/src/arch/x86_64/Lower.zig +++ b/src/arch/x86_64/Lower.zig @@ -327,16 +327,25 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { .pseudo_dbg_leave_block_none, .pseudo_dbg_enter_inline_func, .pseudo_dbg_leave_inline_func, - .pseudo_dbg_local_a, - .pseudo_dbg_local_ai_s, - .pseudo_dbg_local_ai_u, - .pseudo_dbg_local_ai_64, - .pseudo_dbg_local_as, - .pseudo_dbg_local_aso, - .pseudo_dbg_local_aro, - .pseudo_dbg_local_af, - .pseudo_dbg_local_am, + .pseudo_dbg_arg_none, + .pseudo_dbg_arg_i_s, + .pseudo_dbg_arg_i_u, + .pseudo_dbg_arg_i_64, + .pseudo_dbg_arg_reloc, + .pseudo_dbg_arg_ro, + .pseudo_dbg_arg_fa, + .pseudo_dbg_arg_m, + .pseudo_dbg_arg_val, .pseudo_dbg_var_args_none, + .pseudo_dbg_var_none, + .pseudo_dbg_var_i_s, + .pseudo_dbg_var_i_u, + .pseudo_dbg_var_i_64, + .pseudo_dbg_var_reloc, + .pseudo_dbg_var_ro, + .pseudo_dbg_var_fa, + .pseudo_dbg_var_m, + .pseudo_dbg_var_val, .pseudo_dead_none, => {}, @@ -364,7 +373,8 @@ pub fn imm(lower: *const Lower, ops: Mir.Inst.Ops, i: u32) Immediate { .i_s, .mi_s, .rmi_s, - .pseudo_dbg_local_ai_s, + .pseudo_dbg_arg_i_s, + .pseudo_dbg_var_i_s, => .s(@bitCast(i)), .ii, @@ -379,13 +389,17 @@ pub fn imm(lower: *const Lower, ops: Mir.Inst.Ops, i: u32) Immediate { .mri, .rrm, .rrmi, - .pseudo_dbg_local_ai_u, + .pseudo_dbg_arg_i_u, + .pseudo_dbg_var_i_u, => .u(i), .ri_64, - .pseudo_dbg_local_ai_64, => .u(lower.mir.extraData(Mir.Imm64, i).data.decode()), + .pseudo_dbg_arg_i_64, + .pseudo_dbg_var_i_64, + => unreachable, + else => unreachable, }; } diff --git a/src/arch/x86_64/Mir.zig b/src/arch/x86_64/Mir.zig index 14468677af..24d5c6a3ed 100644 --- a/src/arch/x86_64/Mir.zig +++ b/src/arch/x86_64/Mir.zig @@ -9,6 +9,8 @@ instructions: std.MultiArrayList(Inst).Slice, /// The meaning of this data is determined by `Inst.Tag` value. extra: []const u32, +local_name_bytes: []const u8, +local_types: []const InternPool.Index, table: []const Inst.Index, frame_locs: std.MultiArrayList(FrameLoc).Slice, @@ -1522,6 +1524,7 @@ pub const Inst = struct { pseudo_cfi_escape_bytes, /// End of prologue + /// Uses `none` payload. pseudo_dbg_prologue_end_none, /// Update debug line with is_stmt register set /// Uses `line_column` payload. @@ -1530,44 +1533,76 @@ pub const Inst = struct { /// Uses `line_column` payload. pseudo_dbg_line_line_column, /// Start of epilogue + /// Uses `none` payload. pseudo_dbg_epilogue_begin_none, /// Start of lexical block + /// Uses `none` payload. pseudo_dbg_enter_block_none, /// End of lexical block + /// Uses `none` payload. pseudo_dbg_leave_block_none, /// Start of inline function + /// Uses `ip_index` payload. pseudo_dbg_enter_inline_func, /// End of inline function + /// Uses `ip_index` payload. pseudo_dbg_leave_inline_func, - /// Local argument or variable. - /// Uses `a` payload. - pseudo_dbg_local_a, - /// Local argument or variable. - /// Uses `ai` payload. - pseudo_dbg_local_ai_s, - /// Local argument or variable. - /// Uses `ai` payload. - pseudo_dbg_local_ai_u, - /// Local argument or variable. - /// Uses `ai` payload with extra data of type `Imm64`. - pseudo_dbg_local_ai_64, - /// Local argument or variable. - /// Uses `as` payload. - pseudo_dbg_local_as, - /// Local argument or variable. - /// Uses `ax` payload with extra data of type `bits.SymbolOffset`. - pseudo_dbg_local_aso, - /// Local argument or variable. - /// Uses `rx` payload with extra data of type `AirOffset`. - pseudo_dbg_local_aro, - /// Local argument or variable. - /// Uses `ax` payload with extra data of type `bits.FrameAddr`. - pseudo_dbg_local_af, - /// Local argument or variable. - /// Uses `ax` payload with extra data of type `Memory`. - pseudo_dbg_local_am, + /// Local argument. + /// Uses `none` payload. + pseudo_dbg_arg_none, + /// Local argument. + /// Uses `i` payload. + pseudo_dbg_arg_i_s, + /// Local argument. + /// Uses `i` payload. + pseudo_dbg_arg_i_u, + /// Local argument. + /// Uses `i64` payload. + pseudo_dbg_arg_i_64, + /// Local argument. + /// Uses `reloc` payload. + pseudo_dbg_arg_reloc, + /// Local argument. + /// Uses `ro` payload. + pseudo_dbg_arg_ro, + /// Local argument. + /// Uses `fa` payload. + pseudo_dbg_arg_fa, + /// Local argument. + /// Uses `x` payload with extra data of type `Memory`. + pseudo_dbg_arg_m, + /// Local argument. + /// Uses `ip_index` payload. + pseudo_dbg_arg_val, /// Remaining arguments are varargs. pseudo_dbg_var_args_none, + /// Local variable. + /// Uses `none` payload. + pseudo_dbg_var_none, + /// Local variable. + /// Uses `i` payload. + pseudo_dbg_var_i_s, + /// Local variable. + /// Uses `i` payload. + pseudo_dbg_var_i_u, + /// Local variable. + /// Uses `i64` payload. + pseudo_dbg_var_i_64, + /// Local variable. + /// Uses `reloc` payload. + pseudo_dbg_var_reloc, + /// Local variable. + /// Uses `ro` payload. + pseudo_dbg_var_ro, + /// Local variable. + /// Uses `fa` payload. + pseudo_dbg_var_fa, + /// Local variable. + /// Uses `x` payload with extra data of type `Memory`. + pseudo_dbg_var_m, + /// Local variable. + /// Uses `ip_index` payload. + pseudo_dbg_var_val, /// Tombstone /// Emitter should skip this instruction. @@ -1584,6 +1619,7 @@ pub const Inst = struct { inst: Index, }, /// A 32-bit immediate value. + i64: u64, i: struct { fixes: Fixes = ._, i: u32, @@ -1683,31 +1719,18 @@ pub const Inst = struct { return std.mem.sliceAsBytes(mir.extra[bytes.payload..])[0..bytes.len]; } }, - a: struct { - air_inst: Air.Inst.Index, - }, - ai: struct { - air_inst: Air.Inst.Index, - i: u32, - }, - as: struct { - air_inst: Air.Inst.Index, - sym_index: u32, - }, - ax: struct { - air_inst: Air.Inst.Index, - payload: u32, - }, /// Relocation for the linker where: /// * `sym_index` is the index of the target /// * `off` is the offset from the target reloc: bits.SymbolOffset, + fa: bits.FrameAddr, + ro: bits.RegisterOffset, /// Debug line and column position line_column: struct { line: u32, column: u32, }, - func: InternPool.Index, + ip_index: InternPool.Index, /// Register list reg_list: RegisterList, }; @@ -1760,8 +1783,6 @@ pub const Inst = struct { } }; -pub const AirOffset = struct { air_inst: Air.Inst.Index, off: i32 }; - /// Used in conjunction with payload to transfer a list of used registers in a compact manner. pub const RegisterList = struct { bitset: BitSet, @@ -1924,6 +1945,8 @@ pub const Memory = struct { pub fn deinit(mir: *Mir, gpa: std.mem.Allocator) void { mir.instructions.deinit(gpa); gpa.free(mir.extra); + gpa.free(mir.local_name_bytes); + gpa.free(mir.local_types); gpa.free(mir.table); mir.frame_locs.deinit(gpa); mir.* = undefined; @@ -1937,8 +1960,6 @@ pub fn emit( func_index: InternPool.Index, code: *std.ArrayListUnmanaged(u8), debug_output: link.File.DebugInfoOutput, - /// TODO: remove dependency on this argument. This blocks enabling `Zcu.Feature.separate_thread`. - air: *const Air, ) codegen.CodeGenError!void { const zcu = pt.zcu; const comp = zcu.comp; @@ -1948,7 +1969,6 @@ pub fn emit( const nav = func.owner_nav; const mod = zcu.navFileScope(nav).mod.?; var e: Emit = .{ - .air = air.*, .lower = .{ .bin_file = lf, .target = &mod.resolved_target.result, @@ -1998,7 +2018,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: u32) struct { data: T, end: @field(result, field.name) = switch (field.type) { u32 => mir.extra[i], i32, Memory.Info => @bitCast(mir.extra[i]), - bits.FrameIndex, Air.Inst.Index => @enumFromInt(mir.extra[i]), + bits.FrameIndex => @enumFromInt(mir.extra[i]), else => @compileError("bad field type: " ++ field.name ++ ": " ++ @typeName(field.type)), }; i += 1; @@ -2043,7 +2063,6 @@ const builtin = @import("builtin"); const encoder = @import("encoder.zig"); const std = @import("std"); -const Air = @import("../../Air.zig"); const IntegerBitSet = std.bit_set.IntegerBitSet; const InternPool = @import("../../InternPool.zig"); const Mir = @This(); diff --git a/src/codegen.zig b/src/codegen.zig index 5a8f17735a..9199c27dc2 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -180,10 +180,6 @@ pub fn emitFunction( any_mir: *const AnyMir, code: *std.ArrayListUnmanaged(u8), debug_output: link.File.DebugInfoOutput, - /// TODO: this parameter needs to be removed. We should not still hold AIR this late - /// in the pipeline. Any information needed to call emit must be stored in MIR. - /// This is `undefined` if the backend supports the `separate_thread` feature. - air: *const Air, ) CodeGenError!void { const zcu = pt.zcu; const func = zcu.funcInfo(func_index); @@ -199,7 +195,7 @@ pub fn emitFunction( => |backend| { dev.check(devFeatureForBackend(backend)); const mir = &@field(any_mir, AnyMir.tag(backend)); - return mir.emit(lf, pt, src_loc, func_index, code, debug_output, air); + return mir.emit(lf, pt, src_loc, func_index, code, debug_output); }, } } diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index e30e8f70a3..658764ba3c 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -9509,15 +9509,21 @@ pub const FuncGen = struct { const inst_ty = self.typeOfIndex(inst); - const name = self.air.instructions.items(.data)[@intFromEnum(inst)].arg.name; - if (name == .none) return arg_val; - const func = zcu.funcInfo(zcu.navValue(self.ng.nav_index).toIntern()); + const func_zir = func.zir_body_inst.resolveFull(&zcu.intern_pool).?; + const file = zcu.fileByIndex(func_zir.file); + + const mod = file.mod.?; + if (mod.strip) return arg_val; + const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg; + const zir = &file.zir.?; + const name = zir.nullTerminatedString(zir.getParamName(zir.getParamBody(func_zir.inst)[arg.zir_param_index]).?); + const lbrace_line = zcu.navSrcLine(func.owner_nav) + func.lbrace_line + 1; const lbrace_col = func.lbrace_column + 1; const debug_parameter = try o.builder.debugParameter( - try o.builder.metadataString(name.toSlice(self.air)), + try o.builder.metadataString(name), self.file, self.scope, lbrace_line, @@ -9535,7 +9541,6 @@ pub const FuncGen = struct { }, }; - const mod = self.ng.ownerModule(); if (isByRef(inst_ty, zcu)) { _ = try self.wip.callIntrinsic( .normal, diff --git a/src/link.zig b/src/link.zig index bbd0163d23..844ea7a85c 100644 --- a/src/link.zig +++ b/src/link.zig @@ -8,7 +8,6 @@ const log = std.log.scoped(.link); const trace = @import("tracy.zig").trace; const wasi_libc = @import("libs/wasi_libc.zig"); -const Air = @import("Air.zig"); const Allocator = std.mem.Allocator; const Cache = std.Build.Cache; const Path = std.Build.Cache.Path; @@ -752,9 +751,6 @@ pub const File = struct { /// that `mir.deinit` remains legal for the caller. For instance, the callee can /// take ownership of an embedded slice and replace it with `&.{}` in `mir`. mir: *codegen.AnyMir, - /// This may be `undefined`; only pass it to `emitFunction`. - /// This parameter will eventually be removed. - maybe_undef_air: *const Air, ) UpdateNavError!void { assert(base.comp.zcu.?.llvm_object == null); switch (base.tag) { @@ -762,7 +758,7 @@ pub const File = struct { .spirv => unreachable, // see corresponding special case in `Zcu.PerThread.runCodegenInner` inline else => |tag| { dev.check(tag.devFeature()); - return @as(*tag.Type(), @fieldParentPtr("base", base)).updateFunc(pt, func_index, mir, maybe_undef_air); + return @as(*tag.Type(), @fieldParentPtr("base", base)).updateFunc(pt, func_index, mir); }, } } @@ -1271,11 +1267,6 @@ pub const ZcuTask = union(enum) { /// the codegen job to ensure that the linker receives functions in a deterministic order, /// allowing reproducible builds. mir: *SharedMir, - /// This field exists only due to deficiencies in some codegen implementations; it should - /// be removed when the corresponding parameter of `CodeGen.emitFunction` can be removed. - /// This is `undefined` if `Zcu.Feature.separate_thread` is supported. - /// If this is defined, its memory is owned externally; do not `deinit` this `air`. - air: *const Air, pub const SharedMir = struct { /// This is initially `.pending`. When `value` is populated, the codegen thread will set @@ -1458,7 +1449,7 @@ pub fn doZcuTask(comp: *Compilation, tid: usize, task: ZcuTask) void { assert(zcu.llvm_object == null); // LLVM codegen doesn't produce MIR const mir = &func.mir.value; if (comp.bin_file) |lf| { - lf.updateFunc(pt, func.func, mir, func.air) catch |err| switch (err) { + lf.updateFunc(pt, func.func, mir) catch |err| switch (err) { error.OutOfMemory => return diags.setAllocFailure(), error.CodegenFail => return zcu.assertCodegenFailed(nav), error.Overflow, error.RelocationNotByteAligned => { diff --git a/src/link/C.zig b/src/link/C.zig index 417ebcdee6..f3465055b8 100644 --- a/src/link/C.zig +++ b/src/link/C.zig @@ -17,7 +17,6 @@ const link = @import("../link.zig"); const trace = @import("../tracy.zig").trace; const Type = @import("../Type.zig"); const Value = @import("../Value.zig"); -const Air = @import("../Air.zig"); const AnyMir = @import("../codegen.zig").AnyMir; pub const zig_h = "#include \"zig.h\"\n"; @@ -182,12 +181,7 @@ pub fn updateFunc( pt: Zcu.PerThread, func_index: InternPool.Index, mir: *AnyMir, - /// This may be `undefined`; only pass it to `emitFunction`. - /// This parameter will eventually be removed. - maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { - _ = maybe_undef_air; // It would be a bug to use this argument. - const zcu = pt.zcu; const gpa = zcu.gpa; const func = zcu.funcInfo(func_index); diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 81376c45d8..c9234b335d 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -1053,9 +1053,6 @@ pub fn updateFunc( pt: Zcu.PerThread, func_index: InternPool.Index, mir: *const codegen.AnyMir, - /// This may be `undefined`; only pass it to `emitFunction`. - /// This parameter will eventually be removed. - maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { if (build_options.skip_non_native and builtin.object_format != .coff) { @panic("Attempted to compile for object format that was disabled by build configuration"); @@ -1084,7 +1081,6 @@ pub fn updateFunc( mir, &code_buffer, .none, - maybe_undef_air, ); try coff.updateNavCode(pt, nav_index, code_buffer.items, .FUNCTION); @@ -3123,7 +3119,6 @@ const link = @import("../link.zig"); const target_util = @import("../target.zig"); const trace = @import("../tracy.zig").trace; -const Air = @import("../Air.zig"); const Compilation = @import("../Compilation.zig"); const Zcu = @import("../Zcu.zig"); const InternPool = @import("../InternPool.zig"); diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig index 393cd53774..42d0d74ec5 100644 --- a/src/link/Dwarf.zig +++ b/src/link/Dwarf.zig @@ -1474,17 +1474,18 @@ pub const WipNav = struct { try cfa.write(wip_nav); } - pub const LocalTag = enum { local_arg, local_var }; - pub fn genLocalDebugInfo( + pub const LocalVarTag = enum { arg, local_var }; + pub fn genLocalVarDebugInfo( wip_nav: *WipNav, - tag: LocalTag, + tag: LocalVarTag, name: []const u8, ty: Type, loc: Loc, ) UpdateError!void { assert(wip_nav.func != .none); try wip_nav.abbrevCode(switch (tag) { - inline else => |ct_tag| @field(AbbrevCode, @tagName(ct_tag)), + .arg => .arg, + .local_var => .local_var, }); try wip_nav.strp(name); try wip_nav.refType(ty); @@ -1492,6 +1493,40 @@ pub const WipNav = struct { wip_nav.any_children = true; } + pub const LocalConstTag = enum { comptime_arg, local_const }; + pub fn genLocalConstDebugInfo( + wip_nav: *WipNav, + src_loc: Zcu.LazySrcLoc, + tag: LocalConstTag, + name: []const u8, + val: Value, + ) UpdateError!void { + assert(wip_nav.func != .none); + const pt = wip_nav.pt; + const zcu = pt.zcu; + const ty = val.typeOf(zcu); + const has_runtime_bits = ty.hasRuntimeBits(zcu); + const has_comptime_state = ty.comptimeOnly(zcu) and try ty.onePossibleValue(pt) == null; + try wip_nav.abbrevCode(if (has_runtime_bits and has_comptime_state) switch (tag) { + .comptime_arg => .comptime_arg_runtime_bits_comptime_state, + .local_const => .local_const_runtime_bits_comptime_state, + } else if (has_comptime_state) switch (tag) { + .comptime_arg => .comptime_arg_comptime_state, + .local_const => .local_const_comptime_state, + } else if (has_runtime_bits) switch (tag) { + .comptime_arg => .comptime_arg_runtime_bits, + .local_const => .local_const_runtime_bits, + } else switch (tag) { + .comptime_arg => .comptime_arg, + .local_const => .local_const, + }); + try wip_nav.strp(name); + try wip_nav.refType(ty); + if (has_runtime_bits) try wip_nav.blockValue(src_loc, val); + if (has_comptime_state) try wip_nav.refValue(val); + wip_nav.any_children = true; + } + pub fn genVarArgsDebugInfo(wip_nav: *WipNav) UpdateError!void { assert(wip_nav.func != .none); try wip_nav.abbrevCode(.is_var_args); @@ -1825,7 +1860,8 @@ pub const WipNav = struct { fn getNavEntry(wip_nav: *WipNav, nav_index: InternPool.Nav.Index) UpdateError!struct { Unit.Index, Entry.Index } { const zcu = wip_nav.pt.zcu; const ip = &zcu.intern_pool; - const unit = try wip_nav.dwarf.getUnit(zcu.fileByIndex(ip.getNav(nav_index).srcInst(ip).resolveFile(ip)).mod.?); + const nav = ip.getNav(nav_index); + const unit = try wip_nav.dwarf.getUnit(zcu.fileByIndex(nav.srcInst(ip).resolveFile(ip)).mod.?); const gop = try wip_nav.dwarf.navs.getOrPut(wip_nav.dwarf.gpa, nav_index); if (gop.found_existing) return .{ unit, gop.value_ptr.* }; const entry = try wip_nav.dwarf.addCommonEntry(unit); @@ -1842,10 +1878,16 @@ pub const WipNav = struct { const zcu = wip_nav.pt.zcu; const ip = &zcu.intern_pool; const maybe_inst_index = ty.typeDeclInst(zcu); - const unit = if (maybe_inst_index) |inst_index| - try wip_nav.dwarf.getUnit(zcu.fileByIndex(inst_index.resolveFile(ip)).mod.?) - else - .main; + const unit = if (maybe_inst_index) |inst_index| switch (switch (ip.indexToKey(ty.toIntern())) { + else => unreachable, + .struct_type => ip.loadStructType(ty.toIntern()).name_nav, + .union_type => ip.loadUnionType(ty.toIntern()).name_nav, + .enum_type => ip.loadEnumType(ty.toIntern()).name_nav, + .opaque_type => ip.loadOpaqueType(ty.toIntern()).name_nav, + }) { + .none => try wip_nav.dwarf.getUnit(zcu.fileByIndex(inst_index.resolveFile(ip)).mod.?), + else => |name_nav| return wip_nav.getNavEntry(name_nav.unwrap().?), + } else .main; const gop = try wip_nav.dwarf.types.getOrPut(wip_nav.dwarf.gpa, ty.toIntern()); if (gop.found_existing) return .{ unit, gop.value_ptr.* }; const entry = try wip_nav.dwarf.addCommonEntry(unit); @@ -1864,10 +1906,8 @@ pub const WipNav = struct { const ip = &zcu.intern_pool; const ty = value.typeOf(zcu); if (std.debug.runtime_safety) assert(ty.comptimeOnly(zcu) and try ty.onePossibleValue(wip_nav.pt) == null); - if (!value.isUndef(zcu)) { - if (ty.toIntern() == .type_type) return wip_nav.getTypeEntry(value.toType()); - if (ip.isFunctionType(ty.toIntern())) return wip_nav.getNavEntry(zcu.funcInfo(value.toIntern()).owner_nav); - } + if (ty.toIntern() == .type_type) return wip_nav.getTypeEntry(value.toType()); + if (ip.isFunctionType(ty.toIntern()) and !value.isUndef(zcu)) return wip_nav.getNavEntry(zcu.funcInfo(value.toIntern()).owner_nav); const gop = try wip_nav.dwarf.values.getOrPut(wip_nav.dwarf.gpa, value.toIntern()); const unit: Unit.Index = .main; if (gop.found_existing) return .{ unit, gop.value_ptr.* }; @@ -1916,7 +1956,10 @@ pub const WipNav = struct { &wip_nav.debug_info, .{ .debug_output = .{ .dwarf = wip_nav } }, ); - assert(old_len + bytes == wip_nav.debug_info.items.len); + if (old_len + bytes != wip_nav.debug_info.items.len) { + std.debug.print("{} [{}]: {} != {}\n", .{ ty.fmt(wip_nav.pt), ty.toIntern(), bytes, wip_nav.debug_info.items.len - old_len }); + unreachable; + } } const AbbrevCodeForForm = struct { @@ -2788,6 +2831,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); if (type_gop.found_existing) { if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias; + assert(!nav_gop.found_existing); nav_gop.value_ptr.* = type_gop.value_ptr.*; } else { if (nav_gop.found_existing) @@ -2890,6 +2934,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); if (type_gop.found_existing) { if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias; + assert(!nav_gop.found_existing); nav_gop.value_ptr.* = type_gop.value_ptr.*; } else { if (nav_gop.found_existing) @@ -2928,6 +2973,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); if (type_gop.found_existing) { if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias; + assert(!nav_gop.found_existing); nav_gop.value_ptr.* = type_gop.value_ptr.*; } else { if (nav_gop.found_existing) @@ -2998,6 +3044,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); if (type_gop.found_existing) { if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias; + assert(!nav_gop.found_existing); nav_gop.value_ptr.* = type_gop.value_ptr.*; } else { if (nav_gop.found_existing) @@ -3164,6 +3211,7 @@ fn updateLazyType( ) UpdateError!void { const zcu = pt.zcu; const ip = &zcu.intern_pool; + assert(ip.typeOf(type_index) == .type_type); const ty: Type = .fromInterned(type_index); switch (type_index) { .generic_poison_type => log.debug("updateLazyType({s})", .{"anytype"}), @@ -3200,6 +3248,10 @@ fn updateLazyType( defer dwarf.gpa.free(name); switch (ip.indexToKey(type_index)) { + .undef => { + try wip_nav.abbrevCode(.undefined_comptime_value); + try wip_nav.refType(.type); + }, .int_type => |int_type| { try wip_nav.abbrevCode(.numeric_type); try wip_nav.strp(name); @@ -3633,7 +3685,6 @@ fn updateLazyType( }, // values, not types - .undef, .simple_value, .variable, .@"extern", @@ -3666,7 +3717,11 @@ fn updateLazyValue( ) UpdateError!void { const zcu = pt.zcu; const ip = &zcu.intern_pool; - log.debug("updateLazyValue({})", .{Value.fromInterned(value_index).fmtValue(pt)}); + assert(ip.typeOf(value_index) != .type_type); + log.debug("updateLazyValue(@as({}, {}))", .{ + Value.fromInterned(value_index).typeOf(zcu).fmt(pt), + Value.fromInterned(value_index).fmtValue(pt), + }); var wip_nav: WipNav = .{ .dwarf = dwarf, .pt = pt, @@ -3710,9 +3765,8 @@ fn updateLazyValue( .inferred_error_set_type, => unreachable, // already handled .undef => |ty| { - try wip_nav.abbrevCode(.aggregate_comptime_value); + try wip_nav.abbrevCode(.undefined_comptime_value); try wip_nav.refType(.fromInterned(ty)); - try uleb128(diw, @intFromEnum(AbbrevCode.null)); }, .simple_value => unreachable, // opv state .variable, .@"extern" => unreachable, // not a value @@ -4890,8 +4944,17 @@ const AbbrevCode = enum { block, empty_inlined_func, inlined_func, - local_arg, + arg, + comptime_arg, + comptime_arg_runtime_bits, + comptime_arg_comptime_state, + comptime_arg_runtime_bits_comptime_state, local_var, + local_const, + local_const_runtime_bits, + local_const_comptime_state, + local_const_runtime_bits_comptime_state, + undefined_comptime_value, data2_comptime_value, data4_comptime_value, data8_comptime_value, @@ -5663,7 +5726,7 @@ const AbbrevCode = enum { .{ .high_pc, .data4 }, }, }, - .local_arg = .{ + .arg = .{ .tag = .formal_parameter, .attrs = &.{ .{ .name, .strp }, @@ -5671,6 +5734,42 @@ const AbbrevCode = enum { .{ .location, .exprloc }, }, }, + .comptime_arg = .{ + .tag = .formal_parameter, + .attrs = &.{ + .{ .const_expr, .flag_present }, + .{ .name, .strp }, + .{ .type, .ref_addr }, + }, + }, + .comptime_arg_runtime_bits = .{ + .tag = .formal_parameter, + .attrs = &.{ + .{ .const_expr, .flag_present }, + .{ .name, .strp }, + .{ .type, .ref_addr }, + .{ .const_value, .block }, + }, + }, + .comptime_arg_comptime_state = .{ + .tag = .formal_parameter, + .attrs = &.{ + .{ .const_expr, .flag_present }, + .{ .name, .strp }, + .{ .type, .ref_addr }, + .{ .ZIG_comptime_value, .ref_addr }, + }, + }, + .comptime_arg_runtime_bits_comptime_state = .{ + .tag = .formal_parameter, + .attrs = &.{ + .{ .const_expr, .flag_present }, + .{ .name, .strp }, + .{ .type, .ref_addr }, + .{ .const_value, .block }, + .{ .ZIG_comptime_value, .ref_addr }, + }, + }, .local_var = .{ .tag = .variable, .attrs = &.{ @@ -5679,6 +5778,44 @@ const AbbrevCode = enum { .{ .location, .exprloc }, }, }, + .local_const = .{ + .tag = .constant, + .attrs = &.{ + .{ .name, .strp }, + .{ .type, .ref_addr }, + }, + }, + .local_const_runtime_bits = .{ + .tag = .constant, + .attrs = &.{ + .{ .name, .strp }, + .{ .type, .ref_addr }, + .{ .const_value, .block }, + }, + }, + .local_const_comptime_state = .{ + .tag = .constant, + .attrs = &.{ + .{ .name, .strp }, + .{ .type, .ref_addr }, + .{ .ZIG_comptime_value, .ref_addr }, + }, + }, + .local_const_runtime_bits_comptime_state = .{ + .tag = .constant, + .attrs = &.{ + .{ .name, .strp }, + .{ .type, .ref_addr }, + .{ .const_value, .block }, + .{ .ZIG_comptime_value, .ref_addr }, + }, + }, + .undefined_comptime_value = .{ + .tag = .ZIG_comptime_value, + .attrs = &.{ + .{ .type, .ref_addr }, + }, + }, .data2_comptime_value = .{ .tag = .ZIG_comptime_value, .attrs = &.{ diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 498bc734c3..0beea0d9e7 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -1683,12 +1683,11 @@ pub fn updateFunc( pt: Zcu.PerThread, func_index: InternPool.Index, mir: *const codegen.AnyMir, - maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { if (build_options.skip_non_native and builtin.object_format != .elf) { @panic("Attempted to compile for object format that was disabled by build configuration"); } - return self.zigObjectPtr().?.updateFunc(self, pt, func_index, mir, maybe_undef_air); + return self.zigObjectPtr().?.updateFunc(self, pt, func_index, mir); } pub fn updateNav( @@ -4516,7 +4515,6 @@ const trace = @import("../tracy.zig").trace; const synthetic_sections = @import("Elf/synthetic_sections.zig"); const Merge = @import("Elf/Merge.zig"); -const Air = @import("../Air.zig"); const Archive = @import("Elf/Archive.zig"); const AtomList = @import("Elf/AtomList.zig"); const Compilation = @import("../Compilation.zig"); diff --git a/src/link/Elf/ZigObject.zig b/src/link/Elf/ZigObject.zig index 1a5ef4b408..8478aad8c3 100644 --- a/src/link/Elf/ZigObject.zig +++ b/src/link/Elf/ZigObject.zig @@ -1417,9 +1417,6 @@ pub fn updateFunc( pt: Zcu.PerThread, func_index: InternPool.Index, mir: *const codegen.AnyMir, - /// This may be `undefined`; only pass it to `emitFunction`. - /// This parameter will eventually be removed. - maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { const tracy = trace(@src()); defer tracy.end(); @@ -1448,7 +1445,6 @@ pub fn updateFunc( mir, &code_buffer, if (debug_wip_nav) |*dn| .{ .dwarf = dn } else .none, - maybe_undef_air, ); const code = code_buffer.items; @@ -2363,7 +2359,6 @@ const trace = @import("../../tracy.zig").trace; const std = @import("std"); const Allocator = std.mem.Allocator; -const Air = @import("../../Air.zig"); const Archive = @import("Archive.zig"); const Atom = @import("Atom.zig"); const Dwarf = @import("../Dwarf.zig"); diff --git a/src/link/Goff.zig b/src/link/Goff.zig index c222ae029f..ec4cb1252b 100644 --- a/src/link/Goff.zig +++ b/src/link/Goff.zig @@ -17,7 +17,6 @@ const codegen = @import("../codegen.zig"); const link = @import("../link.zig"); const trace = @import("../tracy.zig").trace; const build_options = @import("build_options"); -const Air = @import("../Air.zig"); base: link.File, @@ -74,13 +73,11 @@ pub fn updateFunc( pt: Zcu.PerThread, func_index: InternPool.Index, mir: *const codegen.AnyMir, - maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { _ = self; _ = pt; _ = func_index; _ = mir; - _ = maybe_undef_air; unreachable; // we always use llvm } diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 6c081653ea..3f3a94bee7 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -3040,12 +3040,11 @@ pub fn updateFunc( pt: Zcu.PerThread, func_index: InternPool.Index, mir: *const codegen.AnyMir, - maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { if (build_options.skip_non_native and builtin.object_format != .macho) { @panic("Attempted to compile for object format that was disabled by build configuration"); } - return self.getZigObject().?.updateFunc(self, pt, func_index, mir, maybe_undef_air); + return self.getZigObject().?.updateFunc(self, pt, func_index, mir); } pub fn updateNav(self: *MachO, pt: Zcu.PerThread, nav: InternPool.Nav.Index) link.File.UpdateNavError!void { @@ -5431,7 +5430,6 @@ const target_util = @import("../target.zig"); const trace = @import("../tracy.zig").trace; const synthetic = @import("MachO/synthetic.zig"); -const Air = @import("../Air.zig"); const Alignment = Atom.Alignment; const Allocator = mem.Allocator; const Archive = @import("MachO/Archive.zig"); diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig index f378a9c410..bd54be6caa 100644 --- a/src/link/MachO/ZigObject.zig +++ b/src/link/MachO/ZigObject.zig @@ -778,9 +778,6 @@ pub fn updateFunc( pt: Zcu.PerThread, func_index: InternPool.Index, mir: *const codegen.AnyMir, - /// This may be `undefined`; only pass it to `emitFunction`. - /// This parameter will eventually be removed. - maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { const tracy = trace(@src()); defer tracy.end(); @@ -806,7 +803,6 @@ pub fn updateFunc( mir, &code_buffer, if (debug_wip_nav) |*wip_nav| .{ .dwarf = wip_nav } else .none, - maybe_undef_air, ); const code = code_buffer.items; @@ -1815,7 +1811,6 @@ const target_util = @import("../../target.zig"); const trace = @import("../../tracy.zig").trace; const std = @import("std"); -const Air = @import("../../Air.zig"); const Allocator = std.mem.Allocator; const Archive = @import("Archive.zig"); const Atom = @import("Atom.zig"); diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig index 0d0699f0f0..c99ebb81bb 100644 --- a/src/link/Plan9.zig +++ b/src/link/Plan9.zig @@ -387,9 +387,6 @@ pub fn updateFunc( pt: Zcu.PerThread, func_index: InternPool.Index, mir: *const codegen.AnyMir, - /// This may be `undefined`; only pass it to `emitFunction`. - /// This parameter will eventually be removed. - maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { if (build_options.skip_non_native and builtin.object_format != .plan9) { @panic("Attempted to compile for object format that was disabled by build configuration"); @@ -422,7 +419,6 @@ pub fn updateFunc( mir, &code_buffer, .{ .plan9 = &dbg_info_output }, - maybe_undef_air, ); const code = try code_buffer.toOwnedSlice(gpa); self.getAtomPtr(atom_idx).code = .{ diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 82293b9c45..eda7552986 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -29,7 +29,6 @@ const leb = std.leb; const log = std.log.scoped(.link); const mem = std.mem; -const Air = @import("../Air.zig"); const Mir = @import("../arch/wasm/Mir.zig"); const CodeGen = @import("../arch/wasm/CodeGen.zig"); const abi = @import("../arch/wasm/abi.zig"); @@ -3182,14 +3181,12 @@ pub fn updateFunc( pt: Zcu.PerThread, func_index: InternPool.Index, any_mir: *const codegen.AnyMir, - maybe_undef_air: *const Air, ) !void { if (build_options.skip_non_native and builtin.object_format != .wasm) { @panic("Attempted to compile for object format that was disabled by build configuration"); } dev.check(.wasm_backend); - _ = maybe_undef_air; // we (correctly) do not need this // This linker implementation only works with codegen backend `.stage2_wasm`. const mir = &any_mir.wasm; diff --git a/src/link/Xcoff.zig b/src/link/Xcoff.zig index 93fda27f3f..bbd8a3fea4 100644 --- a/src/link/Xcoff.zig +++ b/src/link/Xcoff.zig @@ -17,7 +17,6 @@ const codegen = @import("../codegen.zig"); const link = @import("../link.zig"); const trace = @import("../tracy.zig").trace; const build_options = @import("build_options"); -const Air = @import("../Air.zig"); base: link.File, @@ -74,13 +73,11 @@ pub fn updateFunc( pt: Zcu.PerThread, func_index: InternPool.Index, mir: *const codegen.AnyMir, - maybe_undef_air: *const Air, ) link.File.UpdateNavError!void { _ = self; _ = pt; _ = func_index; _ = mir; - _ = maybe_undef_air; unreachable; // we always use llvm } -- cgit v1.2.3 From ba53b140288b4518de38a8174ab7ad402607b8d4 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Sat, 7 Jun 2025 23:30:17 -0400 Subject: x86_64: remove linker references from codegen --- lib/std/heap/debug_allocator.zig | 4 +- src/arch/riscv64/CodeGen.zig | 4 +- src/arch/riscv64/Emit.zig | 4 +- src/arch/x86_64/CodeGen.zig | 3639 ++++++++++++++++++-------------------- src/arch/x86_64/Emit.zig | 781 +++++--- src/arch/x86_64/Lower.zig | 346 +--- src/arch/x86_64/Mir.zig | 174 +- src/arch/x86_64/bits.zig | 26 +- src/arch/x86_64/encoder.zig | 17 +- src/codegen.zig | 156 +- src/link/Dwarf.zig | 72 +- src/link/Elf/Symbol.zig | 3 - src/link/Elf/ZigObject.zig | 6 +- src/link/MachO/Symbol.zig | 3 - src/link/MachO/ZigObject.zig | 6 +- src/target.zig | 2 +- 16 files changed, 2663 insertions(+), 2580 deletions(-) (limited to 'src/codegen.zig') diff --git a/lib/std/heap/debug_allocator.zig b/lib/std/heap/debug_allocator.zig index 3243f1b1bd..e8778fc9c1 100644 --- a/lib/std/heap/debug_allocator.zig +++ b/lib/std/heap/debug_allocator.zig @@ -212,8 +212,8 @@ pub fn DebugAllocator(comptime config: Config) type { DummyMutex{}; const DummyMutex = struct { - inline fn lock(_: *DummyMutex) void {} - inline fn unlock(_: *DummyMutex) void {} + inline fn lock(_: DummyMutex) void {} + inline fn unlock(_: DummyMutex) void {} }; const stack_n = config.stack_trace_frames; diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig index 080760bbab..c82061a5dd 100644 --- a/src/arch/riscv64/CodeGen.zig +++ b/src/arch/riscv64/CodeGen.zig @@ -3603,9 +3603,7 @@ fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void { const tlv_sym_index = if (func.bin_file.cast(.elf)) |elf_file| sym: { const zo = elf_file.zigObjectPtr().?; if (nav.getExtern(ip)) |e| { - const sym = try elf_file.getGlobalSymbol(nav.name.toSlice(ip), e.lib_name.toSlice(ip)); - zo.symbol(sym).flags.is_extern_ptr = true; - break :sym sym; + break :sym try elf_file.getGlobalSymbol(nav.name.toSlice(ip), e.lib_name.toSlice(ip)); } break :sym try zo.getOrCreateMetadataForNav(zcu, ty_nav.nav); } else return func.fail("TODO runtime_nav_ptr on {}", .{func.bin_file.tag}); diff --git a/src/arch/riscv64/Emit.zig b/src/arch/riscv64/Emit.zig index 095cfc278b..0561eb2019 100644 --- a/src/arch/riscv64/Emit.zig +++ b/src/arch/riscv64/Emit.zig @@ -50,8 +50,8 @@ pub fn emitMir(emit: *Emit) Error!void { const atom_ptr = zo.symbol(symbol.atom_index).atom(elf_file).?; const sym = zo.symbol(symbol.sym_index); - if (sym.flags.is_extern_ptr and emit.lower.pic) { - return emit.fail("emit GOT relocation for symbol '{s}'", .{sym.name(elf_file)}); + if (emit.lower.pic) { + return emit.fail("know when to emit GOT relocation for symbol '{s}'", .{sym.name(elf_file)}); } const hi_r_type: u32 = @intFromEnum(std.elf.R_RISCV.HI20); diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 7d88307ba5..84b263a93e 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -124,9 +124,11 @@ gpa: Allocator, pt: Zcu.PerThread, air: Air, liveness: Air.Liveness, -bin_file: *link.File, target: *const std.Target, -owner: Owner, +owner: union(enum) { + nav_index: InternPool.Nav.Index, + lazy_sym: link.File.LazySymbol, +}, inline_func: InternPool.Index, mod: *Module, args: []MCValue, @@ -150,8 +152,14 @@ eflags_inst: ?Air.Inst.Index = null, mir_instructions: std.MultiArrayList(Mir.Inst) = .empty, /// MIR extra data mir_extra: std.ArrayListUnmanaged(u32) = .empty, -mir_local_name_bytes: std.ArrayListUnmanaged(u8) = .empty, -mir_local_types: std.ArrayListUnmanaged(InternPool.Index) = .empty, +mir_string_bytes: std.ArrayListUnmanaged(u8) = .empty, +mir_strings: std.HashMapUnmanaged( + u32, + void, + std.hash_map.StringIndexContext, + std.hash_map.default_max_load_percentage, +) = .empty, +mir_locals: std.ArrayListUnmanaged(Mir.Local) = .empty, mir_table: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, /// The value is an offset into the `Function` `code` from the beginning. @@ -194,41 +202,6 @@ loop_switches: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { next_temp_index: Temp.Index = @enumFromInt(0), temp_type: [Temp.Index.max]Type = undefined, -const Owner = union(enum) { - nav_index: InternPool.Nav.Index, - lazy_sym: link.File.LazySymbol, - - fn getSymbolIndex(owner: Owner, ctx: *CodeGen) !u32 { - const pt = ctx.pt; - switch (owner) { - .nav_index => |nav_index| if (ctx.bin_file.cast(.elf)) |elf_file| { - return elf_file.zigObjectPtr().?.getOrCreateMetadataForNav(pt.zcu, nav_index); - } else if (ctx.bin_file.cast(.macho)) |macho_file| { - return macho_file.getZigObject().?.getOrCreateMetadataForNav(macho_file, nav_index); - } else if (ctx.bin_file.cast(.coff)) |coff_file| { - const atom = try coff_file.getOrCreateAtomForNav(nav_index); - return coff_file.getAtom(atom).getSymbolIndex().?; - } else if (ctx.bin_file.cast(.plan9)) |p9_file| { - return p9_file.seeNav(pt, nav_index); - } else unreachable, - .lazy_sym => |lazy_sym| if (ctx.bin_file.cast(.elf)) |elf_file| { - return elf_file.zigObjectPtr().?.getOrCreateMetadataForLazySymbol(elf_file, pt, lazy_sym) catch |err| - ctx.fail("{s} creating lazy symbol", .{@errorName(err)}); - } else if (ctx.bin_file.cast(.macho)) |macho_file| { - return macho_file.getZigObject().?.getOrCreateMetadataForLazySymbol(macho_file, pt, lazy_sym) catch |err| - ctx.fail("{s} creating lazy symbol", .{@errorName(err)}); - } else if (ctx.bin_file.cast(.coff)) |coff_file| { - const atom = coff_file.getOrCreateAtomForLazySymbol(pt, lazy_sym) catch |err| - return ctx.fail("{s} creating lazy symbol", .{@errorName(err)}); - return coff_file.getAtom(atom).getSymbolIndex().?; - } else if (ctx.bin_file.cast(.plan9)) |p9_file| { - return p9_file.getOrCreateAtomForLazySymbol(pt, lazy_sym) catch |err| - return ctx.fail("{s} creating lazy symbol", .{@errorName(err)}); - } else unreachable, - } - } -}; - const MaskInfo = packed struct { kind: enum(u1) { sign, all }, inverted: bool = false, @@ -269,37 +242,22 @@ pub const MCValue = union(enum) { /// The value is in memory at a hard-coded address. /// If the type is a pointer, it means the pointer address is stored at this memory location. memory: u64, - /// The value is in memory at an address not-yet-allocated by the linker. - /// This traditionally corresponds to a relocation emitted in a relocatable object file. - load_symbol: bits.SymbolOffset, - /// The address of the memory location not-yet-allocated by the linker. - lea_symbol: bits.SymbolOffset, - /// The value is in memory at an address not-yet-allocated by the linker. - /// This must use a non-got pc-relative relocation. - load_pcrel: bits.SymbolOffset, - /// The address of the memory location not-yet-allocated by the linker. - /// This must use a non-got pc-relative relocation. - lea_pcrel: bits.SymbolOffset, /// The value is in memory at a constant offset from the address in a register. indirect: bits.RegisterOffset, - /// The value is in memory. - /// Payload is a symbol index. - load_direct: u32, - /// The value is a pointer to a value in memory. - /// Payload is a symbol index. - lea_direct: u32, - /// The value is in memory referenced indirectly via GOT. - /// Payload is a symbol index. - load_got: u32, - /// The value is a pointer to a value referenced indirectly via GOT. - /// Payload is a symbol index. - lea_got: u32, /// The value stored at an offset from a frame index /// Payload is a frame address. load_frame: bits.FrameAddr, /// The address of an offset from a frame index /// Payload is a frame address. lea_frame: bits.FrameAddr, + load_nav: InternPool.Nav.Index, + lea_nav: InternPool.Nav.Index, + load_uav: InternPool.Key.Ptr.BaseAddr.Uav, + lea_uav: InternPool.Key.Ptr.BaseAddr.Uav, + load_lazy_sym: link.File.LazySymbol, + lea_lazy_sym: link.File.LazySymbol, + load_extern_func: Mir.NullTerminatedString, + lea_extern_func: Mir.NullTerminatedString, /// Supports integer_per_element abi elementwise_args: packed struct { regs: u3, frame_off: i29, frame_index: FrameIndex }, /// This indicates that we have already allocated a frame index for this instruction, @@ -319,11 +277,14 @@ pub const MCValue = union(enum) { .register_mask, .eflags, .register_overflow, - .lea_symbol, - .lea_pcrel, - .lea_direct, - .lea_got, .lea_frame, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .lea_extern_func, + .load_extern_func, .elementwise_args, .reserved_frame, .air_ref, @@ -333,11 +294,8 @@ pub const MCValue = union(enum) { .register_triple, .register_quadruple, .memory, - .load_symbol, - .load_pcrel, - .load_got, - .load_direct, .indirect, + .load_nav, => true, .load_frame => |frame_addr| !frame_addr.index.isNamed(), }; @@ -353,7 +311,14 @@ pub const MCValue = union(enum) { fn isMemory(mcv: MCValue) bool { return switch (mcv) { - .memory, .indirect, .load_frame, .load_symbol => true, + .memory, + .indirect, + .load_frame, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, + => true, else => false, }; } @@ -423,7 +388,7 @@ pub const MCValue = union(enum) { fn address(mcv: MCValue) MCValue { return switch (mcv) { - .none, + .none => .none, .unreach, .dead, .undef, @@ -436,11 +401,11 @@ pub const MCValue = union(enum) { .register_offset, .register_overflow, .register_mask, - .lea_symbol, - .lea_pcrel, - .lea_direct, - .lea_got, .lea_frame, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, .elementwise_args, .reserved_frame, .air_ref, @@ -450,17 +415,17 @@ pub const MCValue = union(enum) { 0 => .{ .register = reg_off.reg }, else => .{ .register_offset = reg_off }, }, - .load_direct => |sym_index| .{ .lea_direct = sym_index }, - .load_got => |sym_index| .{ .lea_got = sym_index }, .load_frame => |frame_addr| .{ .lea_frame = frame_addr }, - .load_symbol => |sym_off| .{ .lea_symbol = sym_off }, - .load_pcrel => |sym_off| .{ .lea_pcrel = sym_off }, + .load_nav => |nav| .{ .lea_nav = nav }, + .load_uav => |uav| .{ .lea_uav = uav }, + .load_lazy_sym => |lazy_sym| .{ .lea_lazy_sym = lazy_sym }, + .load_extern_func => |extern_func| .{ .lea_extern_func = extern_func }, }; } fn deref(mcv: MCValue) MCValue { return switch (mcv) { - .none, + .none => .none, .unreach, .dead, .undef, @@ -472,11 +437,11 @@ pub const MCValue = union(enum) { .register_mask, .memory, .indirect, - .load_direct, - .load_got, .load_frame, - .load_symbol, - .load_pcrel, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, .elementwise_args, .reserved_frame, .air_ref, @@ -484,17 +449,17 @@ pub const MCValue = union(enum) { .immediate => |addr| .{ .memory = addr }, .register => |reg| .{ .indirect = .{ .reg = reg } }, .register_offset => |reg_off| .{ .indirect = reg_off }, - .lea_direct => |sym_index| .{ .load_direct = sym_index }, - .lea_got => |sym_index| .{ .load_got = sym_index }, .lea_frame => |frame_addr| .{ .load_frame = frame_addr }, - .lea_symbol => |sym_index| .{ .load_symbol = sym_index }, - .lea_pcrel => |sym_index| .{ .load_pcrel = sym_index }, + .lea_nav => |nav| .{ .load_nav = nav }, + .lea_uav => |uav| .{ .load_uav = uav }, + .lea_lazy_sym => |lazy_sym| .{ .load_lazy_sym = lazy_sym }, + .lea_extern_func => |extern_func| .{ .load_extern_func = extern_func }, }; } fn offset(mcv: MCValue, off: i32) MCValue { return switch (mcv) { - .none, + .none => .none, .unreach, .dead, .undef, @@ -510,15 +475,15 @@ pub const MCValue = union(enum) { .register_mask, .memory, .indirect, - .load_direct, - .lea_direct, - .load_got, - .lea_got, .load_frame, - .load_symbol, - .lea_symbol, - .load_pcrel, - .lea_pcrel, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .load_extern_func, + .lea_extern_func, => switch (off) { 0 => mcv, else => unreachable, // not offsettable @@ -536,7 +501,7 @@ pub const MCValue = union(enum) { fn mem(mcv: MCValue, function: *CodeGen, mod_rm: Memory.Mod.Rm) !Memory { return switch (mcv) { - .none, + .none => .{ .mod = .{ .rm = mod_rm } }, .unreach, .dead, .undef, @@ -549,15 +514,13 @@ pub const MCValue = union(enum) { .register_offset, .register_overflow, .register_mask, - .load_direct, - .lea_direct, - .load_got, - .lea_got, .lea_frame, .elementwise_args, .reserved_frame, - .lea_symbol, - .lea_pcrel, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, => unreachable, .memory => |addr| if (std.math.cast(i32, @as(i64, @bitCast(addr)))) |small_addr| .{ .base = .{ .reg = .ds }, @@ -586,30 +549,10 @@ pub const MCValue = union(enum) { .disp = frame_addr.off + mod_rm.disp, } }, }, - .load_symbol => |sym_off| { - assert(sym_off.off == 0); - return .{ - .base = .{ .reloc = sym_off.sym_index }, - .mod = .{ .rm = .{ - .size = mod_rm.size, - .index = mod_rm.index, - .scale = mod_rm.scale, - .disp = sym_off.off + mod_rm.disp, - } }, - }; - }, - .load_pcrel => |sym_off| { - assert(sym_off.off == 0); - return .{ - .base = .{ .pcrel = sym_off.sym_index }, - .mod = .{ .rm = .{ - .size = mod_rm.size, - .index = mod_rm.index, - .scale = mod_rm.scale, - .disp = sym_off.off + mod_rm.disp, - } }, - }; - }, + .load_nav => |nav| .{ .base = .{ .nav = nav }, .mod = .{ .rm = mod_rm } }, + .load_uav => |uav| .{ .base = .{ .uav = uav }, .mod = .{ .rm = mod_rm } }, + .load_lazy_sym => |lazy_sym| .{ .base = .{ .lazy_sym = lazy_sym }, .mod = .{ .rm = mod_rm } }, + .load_extern_func => |extern_func| .{ .base = .{ .extern_func = extern_func }, .mod = .{ .rm = mod_rm } }, .air_ref => |ref| (try function.resolveInst(ref)).mem(function, mod_rm), }; } @@ -643,20 +586,20 @@ pub const MCValue = union(enum) { @as(u8, if (pl.info.inverted) '!' else ' '), @tagName(pl.reg), }), - .load_symbol => |pl| try writer.print("[sym:{} + 0x{x}]", .{ pl.sym_index, pl.off }), - .lea_symbol => |pl| try writer.print("sym:{} + 0x{x}", .{ pl.sym_index, pl.off }), - .load_pcrel => |pl| try writer.print("[sym@pcrel:{} + 0x{x}]", .{ pl.sym_index, pl.off }), - .lea_pcrel => |pl| try writer.print("sym@pcrel:{} + 0x{x}", .{ pl.sym_index, pl.off }), .indirect => |pl| try writer.print("[{s} + 0x{x}]", .{ @tagName(pl.reg), pl.off }), - .load_direct => |pl| try writer.print("[direct:{d}]", .{pl}), - .lea_direct => |pl| try writer.print("direct:{d}", .{pl}), - .load_got => |pl| try writer.print("[got:{d}]", .{pl}), - .lea_got => |pl| try writer.print("got:{d}", .{pl}), .load_frame => |pl| try writer.print("[{} + 0x{x}]", .{ pl.index, pl.off }), + .lea_frame => |pl| try writer.print("{} + 0x{x}", .{ pl.index, pl.off }), + .load_nav => |pl| try writer.print("[nav:{d}]", .{@intFromEnum(pl)}), + .lea_nav => |pl| try writer.print("nav:{d}", .{@intFromEnum(pl)}), + .load_uav => |pl| try writer.print("[uav:{d}]", .{@intFromEnum(pl.val)}), + .lea_uav => |pl| try writer.print("uav:{d}", .{@intFromEnum(pl.val)}), + .load_lazy_sym => |pl| try writer.print("[lazy:{s}:{d}]", .{ @tagName(pl.kind), @intFromEnum(pl.ty) }), + .lea_lazy_sym => |pl| try writer.print("lazy:{s}:{d}", .{ @tagName(pl.kind), @intFromEnum(pl.ty) }), + .load_extern_func => |pl| try writer.print("[extern:{d}]", .{@intFromEnum(pl)}), + .lea_extern_func => |pl| try writer.print("extern:{d}", .{@intFromEnum(pl)}), .elementwise_args => |pl| try writer.print("elementwise:{d}:[{} + 0x{x}]", .{ pl.regs, pl.frame_index, pl.frame_off, }), - .lea_frame => |pl| try writer.print("{} + 0x{x}", .{ pl.index, pl.off }), .reserved_frame => |pl| try writer.print("(dead:{})", .{pl}), .air_ref => |pl| try writer.print("(air:0x{x})", .{@intFromEnum(pl)}), } @@ -676,16 +619,16 @@ const InstTracking = struct { .undef, .immediate, .memory, - .load_direct, - .lea_direct, - .load_got, - .lea_got, .load_frame, .lea_frame, - .load_symbol, - .lea_symbol, - .load_pcrel, - .lea_pcrel, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .load_extern_func, + .lea_extern_func, => result, .dead, .elementwise_args, @@ -779,15 +722,15 @@ const InstTracking = struct { .undef, .immediate, .memory, - .load_direct, - .lea_direct, - .load_got, - .lea_got, .lea_frame, - .load_symbol, - .lea_symbol, - .load_pcrel, - .lea_pcrel, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .load_extern_func, + .lea_extern_func, => assert(std.meta.eql(self.long, target.long)), .dead, .eflags, @@ -975,6 +918,7 @@ pub fn generate( air: *const Air, liveness: *const Air.Liveness, ) codegen.CodeGenError!Mir { + _ = bin_file; const zcu = pt.zcu; const gpa = zcu.gpa; const ip = &zcu.intern_pool; @@ -991,7 +935,6 @@ pub fn generate( .liveness = liveness.*, .target = &mod.resolved_target.result, .mod = mod, - .bin_file = bin_file, .owner = .{ .nav_index = func.owner_nav }, .inline_func = func_index, .args = undefined, // populated after `resolveCallingConventionValues` @@ -1013,8 +956,9 @@ pub fn generate( function.inst_tracking.deinit(gpa); function.epilogue_relocs.deinit(gpa); function.mir_instructions.deinit(gpa); - function.mir_local_name_bytes.deinit(gpa); - function.mir_local_types.deinit(gpa); + function.mir_string_bytes.deinit(gpa); + function.mir_strings.deinit(gpa); + function.mir_locals.deinit(gpa); function.mir_extra.deinit(gpa); function.mir_table.deinit(gpa); } @@ -1101,27 +1045,27 @@ pub fn generate( var mir: Mir = .{ .instructions = .empty, .extra = &.{}, - .local_name_bytes = &.{}, - .local_types = &.{}, + .string_bytes = &.{}, + .locals = &.{}, .table = &.{}, .frame_locs = .empty, }; errdefer mir.deinit(gpa); mir.instructions = function.mir_instructions.toOwnedSlice(); mir.extra = try function.mir_extra.toOwnedSlice(gpa); - mir.local_name_bytes = try function.mir_local_name_bytes.toOwnedSlice(gpa); - mir.local_types = try function.mir_local_types.toOwnedSlice(gpa); + mir.string_bytes = try function.mir_string_bytes.toOwnedSlice(gpa); + mir.locals = try function.mir_locals.toOwnedSlice(gpa); mir.table = try function.mir_table.toOwnedSlice(gpa); mir.frame_locs = function.frame_locs.toOwnedSlice(); return mir; } -pub fn toTmpMir(cg: *CodeGen) Mir { +pub fn getTmpMir(cg: *CodeGen) Mir { return .{ .instructions = cg.mir_instructions.slice(), .extra = cg.mir_extra.items, - .local_name_bytes = cg.mir_local_name_bytes.items, - .local_types = cg.mir_local_types.items, + .string_bytes = cg.mir_string_bytes.items, + .locals = cg.mir_locals.items, .table = cg.mir_table.items, .frame_locs = cg.frame_locs.slice(), }; @@ -1135,10 +1079,9 @@ pub fn generateLazy( code: *std.ArrayListUnmanaged(u8), debug_output: link.File.DebugInfoOutput, ) codegen.CodeGenError!void { - const comp = bin_file.comp; - const gpa = comp.gpa; + const gpa = pt.zcu.gpa; // This function is for generating global code, so we use the root module. - const mod = comp.root_mod; + const mod = pt.zcu.comp.root_mod; var function: CodeGen = .{ .gpa = gpa, .pt = pt, @@ -1146,7 +1089,6 @@ pub fn generateLazy( .liveness = undefined, .target = &mod.resolved_target.result, .mod = mod, - .bin_file = bin_file, .owner = .{ .lazy_sym = lazy_sym }, .inline_func = undefined, .args = undefined, @@ -1159,8 +1101,9 @@ pub fn generateLazy( defer { function.inst_tracking.deinit(gpa); function.mir_instructions.deinit(gpa); - function.mir_local_name_bytes.deinit(gpa); - function.mir_local_types.deinit(gpa); + function.mir_string_bytes.deinit(gpa); + function.mir_strings.deinit(gpa); + function.mir_locals.deinit(gpa); function.mir_extra.deinit(gpa); function.mir_table.deinit(gpa); } @@ -1176,33 +1119,7 @@ pub fn generateLazy( else => |e| return e, }; - var emit: Emit = .{ - .lower = .{ - .bin_file = bin_file, - .target = function.target, - .allocator = gpa, - .mir = function.toTmpMir(), - .cc = .auto, - .src_loc = src_loc, - .output_mode = comp.config.output_mode, - .link_mode = comp.config.link_mode, - .pic = mod.pic, - }, - .atom_index = function.owner.getSymbolIndex(&function) catch |err| switch (err) { - error.CodegenFail => return error.CodegenFail, - else => |e| return e, - }, - .debug_output = debug_output, - .code = code, - .prev_di_loc = undefined, // no debug info yet - .prev_di_pc = undefined, // no debug info yet - }; - emit.emitMir() catch |err| switch (err) { - error.LowerFail, error.EmitFail => return function.failMsg(emit.lower.err_msg.?), - error.InvalidInstruction => return function.fail("failed to find a viable x86 instruction (Zig compiler bug)", .{}), - error.CannotEncode => return function.fail("failed to encode x86 instruction (Zig compiler bug)", .{}), - else => |e| return function.fail("failed to emit MIR: {s}", .{@errorName(e)}), - }; + try function.getTmpMir().emitLazy(bin_file, pt, src_loc, lazy_sym, code, debug_output); } const FormatNavData = struct { @@ -1250,17 +1167,12 @@ fn formatWipMir( _: std.fmt.FormatOptions, writer: anytype, ) @TypeOf(writer).Error!void { - const comp = data.self.bin_file.comp; var lower: Lower = .{ - .bin_file = data.self.bin_file, .target = data.self.target, .allocator = data.self.gpa, - .mir = data.self.toTmpMir(), + .mir = data.self.getTmpMir(), .cc = .auto, .src_loc = data.self.src_loc, - .output_mode = comp.config.output_mode, - .link_mode = comp.config.link_mode, - .pic = data.self.mod.pic, }; var first = true; for ((lower.lowerMir(data.inst) catch |err| switch (err) { @@ -1317,13 +1229,6 @@ fn formatWipMir( .pseudo_dbg_arg_i_64, .pseudo_dbg_var_i_64 => try writer.print(" {d}", .{ mir_inst.data.i64, }), - .pseudo_dbg_arg_reloc, .pseudo_dbg_var_reloc => { - const mem_op: encoder.Instruction.Operand = .{ .mem = .initSib(.qword, .{ - .base = .{ .reloc = mir_inst.data.reloc.sym_index }, - .disp = mir_inst.data.reloc.off, - }) }; - try writer.print(" {}", .{mem_op.fmt(.m)}); - }, .pseudo_dbg_arg_ro, .pseudo_dbg_var_ro => { const mem_op: encoder.Instruction.Operand = .{ .mem = .initSib(.qword, .{ .base = .{ .reg = mir_inst.data.ro.reg }, @@ -1399,6 +1304,22 @@ fn addExtraAssumeCapacity(self: *CodeGen, extra: anytype) u32 { return result; } +fn addString(cg: *CodeGen, string: []const u8) Allocator.Error!Mir.NullTerminatedString { + try cg.mir_string_bytes.ensureUnusedCapacity(cg.gpa, string.len + 1); + try cg.mir_strings.ensureUnusedCapacityContext(cg.gpa, 1, .{ .bytes = &cg.mir_string_bytes }); + + const mir_string_gop = cg.mir_strings.getOrPutAssumeCapacityAdapted( + string, + std.hash_map.StringIndexAdapter{ .bytes = &cg.mir_string_bytes }, + ); + if (!mir_string_gop.found_existing) { + mir_string_gop.key_ptr.* = @intCast(cg.mir_string_bytes.items.len); + cg.mir_string_bytes.appendSliceAssumeCapacity(string); + cg.mir_string_bytes.appendAssumeCapacity(0); + } + return @enumFromInt(mir_string_gop.key_ptr.*); +} + fn asmOps(self: *CodeGen, tag: Mir.Inst.FixedTag, ops: [4]Operand) !void { return switch (ops[0]) { .none => self.asmOpOnly(tag), @@ -1714,21 +1635,36 @@ fn asmImmediate(self: *CodeGen, tag: Mir.Inst.FixedTag, imm: Immediate) !void { .ops = switch (imm) { .signed => .i_s, .unsigned => .i_u, - .reloc => .rel, + .nav => .nav, + .uav => .uav, + .lazy_sym => .lazy_sym, + .extern_func => .extern_func, }, .data = switch (imm) { - .reloc => |sym_off| reloc: { - assert(tag[0] == ._); - break :reloc .{ .reloc = sym_off }; - }, .signed, .unsigned => .{ .i = .{ .fixes = tag[0], .i = switch (imm) { .signed => |s| @bitCast(s), .unsigned => |u| @intCast(u), - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, }, } }, + .nav => |nav| switch (tag[0]) { + ._ => .{ .nav = nav }, + else => unreachable, + }, + .uav => |uav| switch (tag[0]) { + ._ => .{ .uav = uav }, + else => unreachable, + }, + .lazy_sym => |lazy_sym| switch (tag[0]) { + ._ => .{ .lazy_sym = lazy_sym }, + else => unreachable, + }, + .extern_func => |extern_func| switch (tag[0]) { + ._ => .{ .extern_func = extern_func }, + else => unreachable, + }, }, }); } @@ -1743,7 +1679,7 @@ fn asmImmediateRegister(self: *CodeGen, tag: Mir.Inst.FixedTag, imm: Immediate, .i = @as(u8, switch (imm) { .signed => |s| @bitCast(@as(i8, @intCast(s))), .unsigned => |u| @intCast(u), - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, }), } }, }); @@ -1758,12 +1694,12 @@ fn asmImmediateImmediate(self: *CodeGen, tag: Mir.Inst.FixedTag, imm1: Immediate .i1 = switch (imm1) { .signed => |s| @bitCast(@as(i16, @intCast(s))), .unsigned => |u| @intCast(u), - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, }, .i2 = switch (imm2) { .signed => |s| @bitCast(@as(i8, @intCast(s))), .unsigned => |u| @intCast(u), - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, }, } }, }); @@ -1788,7 +1724,7 @@ fn asmRegisterImmediate(self: *CodeGen, tag: Mir.Inst.FixedTag, reg: Register, i .{ .ri_u, small } else .{ .ri_64, try self.addExtra(Mir.Imm64.encode(imm.unsigned)) }, - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, }; _ = try self.addInst(.{ .tag = tag[1], @@ -1860,7 +1796,7 @@ fn asmRegisterRegisterRegisterImmediate( .i = switch (imm) { .signed => |s| @bitCast(@as(i8, @intCast(s))), .unsigned => |u| @intCast(u), - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, }, } }, }); @@ -1878,7 +1814,7 @@ fn asmRegisterRegisterImmediate( .ops = switch (imm) { .signed => .rri_s, .unsigned => .rri_u, - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, }, .data = .{ .rri = .{ .fixes = tag[0], @@ -1887,7 +1823,7 @@ fn asmRegisterRegisterImmediate( .i = switch (imm) { .signed => |s| @bitCast(s), .unsigned => |u| @intCast(u), - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, }, } }, }); @@ -1985,7 +1921,7 @@ fn asmRegisterMemoryImmediate( if (switch (imm) { .signed => |s| if (std.math.cast(i16, s)) |x| @as(u16, @bitCast(x)) else null, .unsigned => |u| std.math.cast(u16, u), - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, }) |small_imm| { _ = try self.addInst(.{ .tag = tag[1], @@ -2001,7 +1937,7 @@ fn asmRegisterMemoryImmediate( const payload = try self.addExtra(Mir.Imm32{ .imm = switch (imm) { .signed => |s| @bitCast(s), .unsigned => |u| @as(u32, @intCast(u)), - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, } }); assert(payload + 1 == try self.addExtra(Mir.Memory.encode(m))); _ = try self.addInst(.{ @@ -2009,7 +1945,7 @@ fn asmRegisterMemoryImmediate( .ops = switch (imm) { .signed => .rmi_s, .unsigned => .rmi_u, - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, }, .data = .{ .rx = .{ .fixes = tag[0], @@ -2057,7 +1993,7 @@ fn asmMemoryImmediate(self: *CodeGen, tag: Mir.Inst.FixedTag, m: Memory, imm: Im const payload = try self.addExtra(Mir.Imm32{ .imm = switch (imm) { .signed => |s| @bitCast(s), .unsigned => |u| @intCast(u), - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, } }); assert(payload + 1 == try self.addExtra(Mir.Memory.encode(m))); _ = try self.addInst(.{ @@ -2065,7 +2001,7 @@ fn asmMemoryImmediate(self: *CodeGen, tag: Mir.Inst.FixedTag, m: Memory, imm: Im .ops = switch (imm) { .signed => .mi_s, .unsigned => .mi_u, - .reloc => unreachable, + .nav, .uav, .lazy_sym, .extern_func => unreachable, }, .data = .{ .x = .{ .fixes = tag[0], @@ -2347,16 +2283,18 @@ fn genMainBody( var air_arg_index: usize = 0; const fn_info = zcu.typeToFunc(cg.fn_type).?; var fn_param_index: usize = 0; - try cg.mir_local_types.ensureTotalCapacity(cg.gpa, fn_info.param_types.len); var zir_param_index: usize = 0; for (zir.getParamBody(func_zir_inst)) |zir_param_inst| { - const name = zir.nullTerminatedString(zir.getParamName(zir_param_inst) orelse continue); + const name = switch (zir.getParamName(zir_param_inst) orelse break) { + .empty => .none, + else => |zir_name| try cg.addString(zir.nullTerminatedString(zir_name)), + }; defer zir_param_index += 1; - try cg.mir_local_name_bytes.appendSlice(cg.gpa, name[0 .. name.len + 1]); if (comptime_args.len > 0) switch (comptime_args.get(ip)[zir_param_index]) { .none => {}, else => |comptime_arg| { + try cg.mir_locals.append(cg.gpa, .{ .name = name, .type = ip.typeOf(comptime_arg) }); _ = try cg.addInst(.{ .tag = .pseudo, .ops = .pseudo_dbg_arg_val, @@ -2366,9 +2304,9 @@ fn genMainBody( }, }; - const arg_ty: Type = .fromInterned(fn_info.param_types.get(ip)[fn_param_index]); + const arg_ty = fn_info.param_types.get(ip)[fn_param_index]; + try cg.mir_locals.append(cg.gpa, .{ .name = name, .type = arg_ty }); fn_param_index += 1; - cg.mir_local_types.appendAssumeCapacity(arg_ty.toIntern()); if (air_arg_index == air_args_body.len) { try cg.asmPseudo(.pseudo_dbg_arg_none); @@ -2381,7 +2319,11 @@ fn genMainBody( continue; } air_arg_index += 1; - try cg.genLocalDebugInfo(.arg, arg_ty, cg.getResolvedInstValue(air_arg_inst).short); + try cg.genLocalDebugInfo( + .arg, + .fromInterned(arg_ty), + cg.getResolvedInstValue(air_arg_inst).short, + ); } if (fn_info.is_var_args) try cg.asmPseudo(.pseudo_dbg_var_args_none); } @@ -3453,7 +3395,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -3585,7 +3527,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -3621,7 +3563,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -3658,7 +3600,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -3698,7 +3640,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -4183,7 +4125,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -4215,7 +4157,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -4250,7 +4192,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -4285,7 +4227,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -13885,7 +13827,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__subhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__subhf3" } }, .unused, .unused, .unused, @@ -14017,7 +13959,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__subhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__subhf3" } }, .unused, .unused, .unused, @@ -14053,7 +13995,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__subhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__subhf3" } }, .unused, .unused, .unused, @@ -14090,7 +14032,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__subhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__subhf3" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -14130,7 +14072,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__subhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__subhf3" } }, .unused, .unused, .unused, @@ -14632,7 +14574,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__subtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__subtf3" } }, .unused, .unused, .unused, @@ -14664,7 +14606,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__subtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__subtf3" } }, .unused, .unused, .unused, @@ -14699,7 +14641,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__subtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__subtf3" } }, .unused, .unused, .unused, @@ -14734,7 +14676,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__subtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__subtf3" } }, .unused, .unused, .unused, @@ -23415,7 +23357,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -23547,7 +23489,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -23583,7 +23525,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -23620,7 +23562,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -23660,7 +23602,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -24145,7 +24087,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -24177,7 +24119,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -24212,7 +24154,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -24247,7 +24189,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -26107,7 +26049,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -26239,7 +26181,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -26275,7 +26217,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -26312,7 +26254,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -26352,7 +26294,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -26837,7 +26779,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -26869,7 +26811,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -26904,7 +26846,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -26939,7 +26881,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -32247,7 +32189,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, .unused, .unused, .unused, @@ -32379,7 +32321,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, .unused, .unused, .unused, @@ -32415,7 +32357,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, .unused, .unused, .unused, @@ -32452,7 +32394,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -32492,7 +32434,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, .unused, .unused, .unused, @@ -32995,7 +32937,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, .unused, .unused, .unused, @@ -33027,7 +32969,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, .unused, .unused, .unused, @@ -33062,7 +33004,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, .unused, .unused, .unused, @@ -33097,7 +33039,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, .unused, .unused, .unused, @@ -33181,8 +33123,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunch" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunch" } }, .unused, .unused, .unused, @@ -33323,8 +33265,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunch" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunch" } }, .unused, .unused, .unused, @@ -33360,8 +33302,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunch" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunch" } }, .unused, .unused, .unused, @@ -33398,8 +33340,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunch" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunch" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -33439,8 +33381,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunch" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunch" } }, .unused, .unused, .unused, @@ -33508,7 +33450,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "truncf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "truncf" } }, .unused, .unused, .unused, @@ -33572,7 +33514,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "truncf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "truncf" } }, .unused, .unused, .unused, @@ -33721,7 +33663,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "trunc" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "trunc" } }, .unused, .unused, .unused, @@ -33751,8 +33693,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divdf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "trunc" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divdf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "trunc" } }, .unused, .unused, .unused, @@ -33899,7 +33841,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "trunc" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "trunc" } }, .unused, .unused, .unused, @@ -33935,8 +33877,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divdf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "trunc" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divdf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "trunc" } }, .unused, .unused, .unused, @@ -33973,7 +33915,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f80, .kind = .{ .reg = .st6 } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncx" } }, .unused, .unused, .unused, @@ -34007,7 +33949,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f80, .kind = .{ .reg = .st6 } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncx" } }, .unused, .unused, .unused, @@ -34041,8 +33983,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "truncq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "truncq" } }, .unused, .unused, .unused, @@ -34074,8 +34016,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "truncq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "truncq" } }, .unused, .unused, .unused, @@ -34110,8 +34052,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "truncq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "truncq" } }, .unused, .unused, .unused, @@ -34146,8 +34088,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "truncq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "truncq" } }, .unused, .unused, .unused, @@ -34237,12 +34179,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "__trunch", .down => "__floorh", - } } } }, + } } }, .unused, .unused, .unused, @@ -34377,12 +34319,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "__trunch", .down => "__floorh", - } } } }, + } } }, .unused, .unused, .unused, @@ -34418,12 +34360,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "__trunch", .down => "__floorh", - } } } }, + } } }, .unused, .unused, .unused, @@ -34460,12 +34402,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "__trunch", .down => "__floorh", - } } } }, + } } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -34505,12 +34447,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "__trunch", .down => "__floorh", - } } } }, + } } }, .unused, .unused, .unused, @@ -34578,11 +34520,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "truncf", .down => "floorf", - } } } }, + } } }, .unused, .unused, .unused, @@ -34646,11 +34588,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "truncf", .down => "floorf", - } } } }, + } } }, .unused, .unused, .unused, @@ -34799,11 +34741,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "trunc", .down => "floor", - } } } }, + } } }, .unused, .unused, .unused, @@ -34833,12 +34775,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divdf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = "__divdf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "trunc", .down => "floor", - } } } }, + } } }, .unused, .unused, .unused, @@ -34985,11 +34927,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "trunc", .down => "floor", - } } } }, + } } }, .unused, .unused, .unused, @@ -35025,12 +34967,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divdf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = "__divdf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "trunc", .down => "floor", - } } } }, + } } }, .unused, .unused, .unused, @@ -35067,11 +35009,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f80, .kind = .{ .reg = .st6 } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "__truncx", .down => "__floorx", - } } } }, + } } }, .unused, .unused, .unused, @@ -35103,11 +35045,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "__truncx", .down => "__floorx", - } } } }, + } } }, .unused, .unused, .unused, @@ -35140,11 +35082,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "__truncx", .down => "__floorx", - } } } }, + } } }, .unused, .unused, .unused, @@ -35178,11 +35120,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f80, .kind = .{ .reg = .st6 } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "__truncx", .down => "__floorx", - } } } }, + } } }, .unused, .unused, .unused, @@ -35216,12 +35158,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "truncq", .down => "floorq", - } } } }, + } } }, .unused, .unused, .unused, @@ -35253,12 +35195,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "truncq", .down => "floorq", - } } } }, + } } }, .unused, .unused, .unused, @@ -35293,12 +35235,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "truncq", .down => "floorq", - } } } }, + } } }, .unused, .unused, .unused, @@ -35333,12 +35275,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .zero => "truncq", .down => "floorq", - } } } }, + } } }, .unused, .unused, .unused, @@ -35525,9 +35467,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .i128, .kind = .{ .param_gpr_pair = .{ .cc = .ccc, .at = 0 } } }, .{ .type = .i64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__modti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__modti3" } }, .{ .type = .i64, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divti3" } }, .unused, .unused, .unused, @@ -35576,9 +35518,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, .{ .type = .i32, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divei4" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divei4" } }, .{ .kind = .{ .mem_of_type = .dst0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__modei4" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__modei4" } }, .unused, .unused, .unused, @@ -35657,8 +35599,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floorh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floorh" } }, .unused, .unused, .unused, @@ -35799,8 +35741,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floorh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floorh" } }, .unused, .unused, .unused, @@ -35836,8 +35778,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floorh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floorh" } }, .unused, .unused, .unused, @@ -35874,8 +35816,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floorh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floorh" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -35915,8 +35857,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divhf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floorh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divhf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floorh" } }, .unused, .unused, .unused, @@ -35984,7 +35926,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "floorf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "floorf" } }, .unused, .unused, .unused, @@ -36048,7 +35990,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "floorf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "floorf" } }, .unused, .unused, .unused, @@ -36197,7 +36139,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "floor" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "floor" } }, .unused, .unused, .unused, @@ -36227,8 +36169,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divdf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "floor" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divdf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "floor" } }, .unused, .unused, .unused, @@ -36375,7 +36317,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "floor" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "floor" } }, .unused, .unused, .unused, @@ -36411,8 +36353,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divdf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "floor" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divdf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "floor" } }, .unused, .unused, .unused, @@ -36449,7 +36391,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f80, .kind = .{ .reg = .st6 } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floorx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floorx" } }, .unused, .unused, .unused, @@ -36483,7 +36425,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f80, .kind = .{ .reg = .st6 } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floorx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floorx" } }, .unused, .unused, .unused, @@ -36517,8 +36459,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "floorq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "floorq" } }, .unused, .unused, .unused, @@ -36550,8 +36492,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "floorq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "floorq" } }, .unused, .unused, .unused, @@ -36586,8 +36528,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "floorq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "floorq" } }, .unused, .unused, .unused, @@ -36622,8 +36564,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divtf3" } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "floorq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } }, + .{ .type = .usize, .kind = .{ .extern_func = "floorq" } }, .unused, .unused, .unused, @@ -36779,7 +36721,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__modti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__modti3" } }, .unused, .unused, .unused, @@ -36808,7 +36750,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__umodti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__umodti3" } }, .unused, .unused, .unused, @@ -36841,7 +36783,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__modei4" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__modei4" } }, .unused, .unused, .unused, @@ -36874,7 +36816,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__umodei4" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__umodei4" } }, .unused, .unused, .unused, @@ -37238,7 +37180,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .i64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .u64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .i64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__modti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__modti3" } }, .{ .type = .u64, .kind = .{ .ret_gpr = .{ .cc = .ccc, .at = 0 } } }, .unused, .unused, @@ -37276,7 +37218,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .u64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .u64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__umodti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__umodti3" } }, .{ .type = .u64, .kind = .{ .ret_gpr = .{ .cc = .ccc, .at = 0 } } }, .unused, .unused, @@ -37314,7 +37256,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__modei4" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__modei4" } }, .unused, .unused, .unused, @@ -37350,7 +37292,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__umodei4" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__umodei4" } }, .unused, .unused, .unused, @@ -37381,7 +37323,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .unused, .unused, .unused, @@ -37413,7 +37355,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .unused, .unused, .unused, @@ -37449,7 +37391,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .unused, .unused, .unused, @@ -37486,7 +37428,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -37526,7 +37468,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .unused, .unused, .unused, @@ -37562,7 +37504,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodf" } }, .unused, .unused, .unused, @@ -37594,7 +37536,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodf" } }, .unused, .unused, .unused, @@ -37629,7 +37571,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodf" } }, .unused, .unused, .unused, @@ -37661,7 +37603,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmod" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmod" } }, .unused, .unused, .unused, @@ -37693,7 +37635,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmod" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmod" } }, .unused, .unused, .unused, @@ -37728,7 +37670,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmod" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmod" } }, .unused, .unused, .unused, @@ -37763,7 +37705,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmod" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmod" } }, .unused, .unused, .unused, @@ -37799,7 +37741,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .unused, .unused, .unused, @@ -37832,7 +37774,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .unused, .unused, .unused, @@ -37865,7 +37807,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .unused, .unused, .unused, @@ -37899,7 +37841,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .unused, .unused, .unused, @@ -37937,7 +37879,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .unused, .unused, .unused, @@ -37975,7 +37917,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .unused, .unused, .unused, @@ -38010,7 +37952,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodq" } }, .unused, .unused, .unused, @@ -38042,7 +37984,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodq" } }, .unused, .unused, .unused, @@ -38077,7 +38019,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodq" } }, .unused, .unused, .unused, @@ -38112,7 +38054,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodq" } }, .unused, .unused, .unused, @@ -38447,7 +38389,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .i64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__modti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__modti3" } }, .{ .type = .i64, .kind = .{ .rc = .general_purpose } }, .unused, .unused, @@ -38486,7 +38428,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .i64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__modti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__modti3" } }, .unused, .unused, .unused, @@ -38526,7 +38468,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__umodti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__umodti3" } }, .unused, .unused, .unused, @@ -38560,7 +38502,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, .{ .type = .i64, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__modei4" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__modei4" } }, .unused, .unused, .unused, @@ -38617,7 +38559,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__umodei4" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__umodei4" } }, .unused, .unused, .unused, @@ -38647,7 +38589,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, @@ -38688,7 +38630,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, @@ -38729,10 +38671,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -38767,10 +38709,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -38805,10 +38747,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -38843,10 +38785,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -38881,10 +38823,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f32, .kind = .mem }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .ax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -38919,10 +38861,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f32, .kind = .mem }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .ax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -38960,7 +38902,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, @@ -39008,7 +38950,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, @@ -39056,10 +38998,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -39101,10 +39043,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -39146,10 +39088,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -39191,10 +39133,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -39236,10 +39178,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -39282,10 +39224,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f16, .kind = .{ .reg = .dx } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -39329,9 +39271,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f32, .kind = .mem }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -39378,9 +39320,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodh" } }, .{ .type = .f32, .kind = .mem }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -39423,7 +39365,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f32, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodf" } }, .{ .type = .f32, .kind = .{ .reg = .edx } }, .{ .type = .f32, .kind = .{ .reg = .eax } }, .unused, @@ -39461,7 +39403,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f32, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodf" } }, .{ .type = .f32, .kind = .{ .reg = .edx } }, .{ .type = .f32, .kind = .{ .reg = .eax } }, .unused, @@ -39499,7 +39441,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f32, .kind = .mem }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodf" } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f32, .kind = .{ .reg = .eax } }, .unused, @@ -39539,7 +39481,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .{ .reg = .xmm1 } }, .{ .type = .f32, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodf" } }, .{ .type = .f32, .kind = .{ .reg = .edx } }, .{ .type = .f32, .kind = .{ .reg = .eax } }, .unused, @@ -39583,7 +39525,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .{ .reg = .xmm1 } }, .{ .type = .f32, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodf" } }, .{ .type = .f32, .kind = .{ .reg = .edx } }, .{ .type = .f32, .kind = .{ .reg = .eax } }, .unused, @@ -39626,7 +39568,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodf" } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f32, .kind = .{ .reg = .eax } }, .unused, @@ -39666,7 +39608,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f64, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmod" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmod" } }, .{ .type = .f64, .kind = .{ .reg = .rcx } }, .{ .type = .f64, .kind = .{ .reg = .rdx } }, .{ .type = .f64, .kind = .{ .reg = .rax } }, @@ -39705,7 +39647,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f64, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmod" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmod" } }, .{ .type = .f64, .kind = .{ .reg = .rcx } }, .{ .type = .f64, .kind = .{ .reg = .rdx } }, .{ .type = .f64, .kind = .{ .reg = .rax } }, @@ -39744,7 +39686,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f64, .kind = .mem }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmod" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmod" } }, .{ .type = .f64, .kind = .mem }, .{ .type = .f64, .kind = .{ .reg = .rdx } }, .{ .type = .f64, .kind = .{ .reg = .rax } }, @@ -39789,7 +39731,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, .{ .type = .f64, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmod" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmod" } }, .{ .type = .f64, .kind = .{ .reg = .rcx } }, .{ .type = .f64, .kind = .{ .reg = .rdx } }, .{ .type = .f64, .kind = .{ .reg = .rax } }, @@ -39834,7 +39776,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, .{ .type = .f64, .kind = .{ .rc = .general_purpose } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmod" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmod" } }, .{ .type = .f64, .kind = .{ .reg = .rcx } }, .{ .type = .f64, .kind = .{ .reg = .rdx } }, .{ .type = .f64, .kind = .{ .reg = .rax } }, @@ -39878,7 +39820,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmod" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmod" } }, .{ .type = .f64, .kind = .{ .reg = .rdx } }, .{ .type = .f64, .kind = .mem }, .{ .type = .f64, .kind = .{ .reg = .rax } }, @@ -39926,7 +39868,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .reg = .rax } }, .unused, @@ -39969,7 +39911,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .reg = .rax } }, .unused, @@ -40012,7 +39954,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .reg = .rax } }, .unused, @@ -40055,7 +39997,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .reg = .rax } }, .unused, @@ -40098,7 +40040,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .reg = .rax } }, .unused, @@ -40141,7 +40083,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .reg = .rax } }, .unused, @@ -40185,7 +40127,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .reg = .rax } }, .unused, @@ -40233,7 +40175,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .reg = .rax } }, .unused, @@ -40281,7 +40223,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .reg = .rax } }, .unused, @@ -40329,7 +40271,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .reg = .rax } }, .unused, @@ -40377,7 +40319,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .reg = .rax } }, .unused, @@ -40425,7 +40367,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmodx" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmodx" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .{ .type = .f80, .kind = .{ .reg = .rax } }, .unused, @@ -40471,11 +40413,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f128, .kind = .mem }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodq" } }, .{ .type = .f128, .kind = .{ .reg = .rcx } }, .{ .type = .f128, .kind = .{ .reg = .rdx } }, .{ .type = .f128, .kind = .{ .reg = .rax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -40512,11 +40454,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f128, .kind = .mem }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodq" } }, .{ .type = .f128, .kind = .{ .reg = .rcx } }, .{ .type = .f128, .kind = .{ .reg = .rdx } }, .{ .type = .f128, .kind = .{ .reg = .rax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -40553,11 +40495,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f128, .kind = .mem }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodq" } }, .{ .type = .f128, .kind = .{ .reg = .rcx } }, .{ .type = .f128, .kind = .{ .reg = .rdx } }, .{ .type = .f128, .kind = .{ .reg = .rax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -40595,11 +40537,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f128, .kind = .mem }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodq" } }, .{ .type = .f128, .kind = .{ .reg = .rdx } }, .{ .type = .f128, .kind = .mem }, .{ .type = .f128, .kind = .{ .reg = .rax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -40637,11 +40579,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodq" } }, .{ .type = .f128, .kind = .{ .reg = .rcx } }, .{ .type = .f128, .kind = .{ .reg = .rdx } }, .{ .type = .f128, .kind = .{ .reg = .rax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -40683,11 +40625,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodq" } }, .{ .type = .f128, .kind = .{ .reg = .rcx } }, .{ .type = .f128, .kind = .{ .reg = .rdx } }, .{ .type = .f128, .kind = .{ .reg = .rax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -40729,11 +40671,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodq" } }, .{ .type = .f128, .kind = .{ .reg = .rcx } }, .{ .type = .f128, .kind = .{ .reg = .rdx } }, .{ .type = .f128, .kind = .{ .reg = .rax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -40776,11 +40718,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmodq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmodq" } }, .{ .type = .f128, .kind = .{ .reg = .rdx } }, .{ .type = .f128, .kind = .mem }, .{ .type = .f128, .kind = .{ .reg = .rax } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -43870,7 +43812,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmaxh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmaxh" } }, .unused, .unused, .unused, @@ -44008,7 +43950,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmaxh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmaxh" } }, .unused, .unused, .unused, @@ -44044,7 +43986,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmaxh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmaxh" } }, .unused, .unused, .unused, @@ -44081,7 +44023,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmaxh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmaxh" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -44121,7 +44063,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmaxh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmaxh" } }, .unused, .unused, .unused, @@ -44536,7 +44478,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmax" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmax" } }, .unused, .unused, .unused, @@ -44791,7 +44733,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmax" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmax" } }, .unused, .unused, .unused, @@ -45080,7 +45022,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaxq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaxq" } }, .unused, .unused, .unused, @@ -45112,7 +45054,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaxq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaxq" } }, .unused, .unused, .unused, @@ -45147,7 +45089,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaxq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaxq" } }, .unused, .unused, .unused, @@ -45182,7 +45124,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaxq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaxq" } }, .unused, .unused, .unused, @@ -48029,7 +47971,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fminh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fminh" } }, .unused, .unused, .unused, @@ -48167,7 +48109,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fminh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fminh" } }, .unused, .unused, .unused, @@ -48203,7 +48145,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fminh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fminh" } }, .unused, .unused, .unused, @@ -48240,7 +48182,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fminh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fminh" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -48280,7 +48222,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fminh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fminh" } }, .unused, .unused, .unused, @@ -48695,7 +48637,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmin" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmin" } }, .unused, .unused, .unused, @@ -48950,7 +48892,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmin" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmin" } }, .unused, .unused, .unused, @@ -49227,7 +49169,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fminq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fminq" } }, .unused, .unused, .unused, @@ -49259,7 +49201,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fminq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fminq" } }, .unused, .unused, .unused, @@ -49294,7 +49236,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fminq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fminq" } }, .unused, .unused, .unused, @@ -49329,7 +49271,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fminq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fminq" } }, .unused, .unused, .unused, @@ -72269,7 +72211,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__sqrth" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__sqrth" } }, .unused, .unused, .unused, @@ -72351,7 +72293,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__sqrth" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__sqrth" } }, .unused, .unused, .unused, @@ -72382,7 +72324,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__sqrth" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__sqrth" } }, .unused, .unused, .unused, @@ -72413,7 +72355,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__sqrth" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__sqrth" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -72447,7 +72389,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__sqrth" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__sqrth" } }, .unused, .unused, .unused, @@ -72519,7 +72461,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "sqrtf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "sqrtf" } }, .unused, .unused, .unused, @@ -72635,7 +72577,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "sqrtf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "sqrtf" } }, .unused, .unused, .unused, @@ -72665,7 +72607,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "sqrtf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "sqrtf" } }, .unused, .unused, .unused, @@ -72735,7 +72677,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "sqrt" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "sqrt" } }, .unused, .unused, .unused, @@ -72851,7 +72793,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "sqrt" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "sqrt" } }, .unused, .unused, .unused, @@ -72881,7 +72823,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "sqrt" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "sqrt" } }, .unused, .unused, .unused, @@ -72911,7 +72853,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "sqrt" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "sqrt" } }, .unused, .unused, .unused, @@ -72995,7 +72937,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "sqrtq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "sqrtq" } }, .unused, .unused, .unused, @@ -73022,7 +72964,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "sqrtq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "sqrtq" } }, .unused, .unused, .unused, @@ -73052,7 +72994,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "sqrtq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "sqrtq" } }, .unused, .unused, .unused, @@ -73082,7 +73024,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "sqrtq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "sqrtq" } }, .unused, .unused, .unused, @@ -73126,7 +73068,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__" ++ @tagName(name) ++ "h" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__" ++ @tagName(name) ++ "h" } }, .unused, .unused, .unused, @@ -73153,7 +73095,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__" ++ @tagName(name) ++ "h" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__" ++ @tagName(name) ++ "h" } }, .unused, .unused, .unused, @@ -73184,7 +73126,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__" ++ @tagName(name) ++ "h" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__" ++ @tagName(name) ++ "h" } }, .unused, .unused, .unused, @@ -73215,7 +73157,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__" ++ @tagName(name) ++ "h" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__" ++ @tagName(name) ++ "h" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -73249,7 +73191,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__" ++ @tagName(name) ++ "h" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__" ++ @tagName(name) ++ "h" } }, .unused, .unused, .unused, @@ -73279,7 +73221,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = @tagName(name) ++ "f" } } }, + .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) ++ "f" } }, .unused, .unused, .unused, @@ -73306,7 +73248,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = @tagName(name) ++ "f" } } }, + .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) ++ "f" } }, .unused, .unused, .unused, @@ -73336,7 +73278,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = @tagName(name) ++ "f" } } }, + .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) ++ "f" } }, .unused, .unused, .unused, @@ -73364,7 +73306,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = @tagName(name) } } }, + .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) } }, .unused, .unused, .unused, @@ -73391,7 +73333,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = @tagName(name) } } }, + .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) } }, .unused, .unused, .unused, @@ -73421,7 +73363,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = @tagName(name) } } }, + .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) } }, .unused, .unused, .unused, @@ -73451,7 +73393,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = @tagName(name) } } }, + .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) } }, .unused, .unused, .unused, @@ -73482,7 +73424,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__" ++ @tagName(name) ++ "x" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__" ++ @tagName(name) ++ "x" } }, .unused, .unused, .unused, @@ -73509,7 +73451,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__" ++ @tagName(name) ++ "x" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__" ++ @tagName(name) ++ "x" } }, .unused, .unused, .unused, @@ -73536,7 +73478,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__" ++ @tagName(name) ++ "x" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__" ++ @tagName(name) ++ "x" } }, .unused, .unused, .unused, @@ -73564,7 +73506,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__" ++ @tagName(name) ++ "x" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__" ++ @tagName(name) ++ "x" } }, .unused, .unused, .unused, @@ -73596,7 +73538,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__" ++ @tagName(name) ++ "x" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__" ++ @tagName(name) ++ "x" } }, .unused, .unused, .unused, @@ -73628,7 +73570,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__" ++ @tagName(name) ++ "x" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__" ++ @tagName(name) ++ "x" } }, .unused, .unused, .unused, @@ -73657,7 +73599,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = @tagName(name) ++ "q" } } }, + .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) ++ "q" } }, .unused, .unused, .unused, @@ -73684,7 +73626,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = @tagName(name) ++ "q" } } }, + .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) ++ "q" } }, .unused, .unused, .unused, @@ -73714,7 +73656,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = @tagName(name) ++ "q" } } }, + .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) ++ "q" } }, .unused, .unused, .unused, @@ -73744,7 +73686,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = @tagName(name) ++ "q" } } }, + .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) ++ "q" } }, .unused, .unused, .unused, @@ -75362,12 +75304,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "__floorh", .up => "__ceilh", .zero => "__trunch", - } } } }, + } } }, .unused, .unused, .unused, @@ -75449,12 +75391,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "__floorh", .up => "__ceilh", .zero => "__trunch", - } } } }, + } } }, .unused, .unused, .unused, @@ -75485,12 +75427,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "__floorh", .up => "__ceilh", .zero => "__trunch", - } } } }, + } } }, .unused, .unused, .unused, @@ -75521,12 +75463,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "__floorh", .up => "__ceilh", .zero => "__trunch", - } } } }, + } } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -75560,12 +75502,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "__floorh", .up => "__ceilh", .zero => "__trunch", - } } } }, + } } }, .unused, .unused, .unused, @@ -75637,12 +75579,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "floorf", .up => "ceilf", .zero => "truncf", - } } } }, + } } }, .unused, .unused, .unused, @@ -75764,12 +75706,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "floorf", .up => "ceilf", .zero => "truncf", - } } } }, + } } }, .unused, .unused, .unused, @@ -75799,12 +75741,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "floorf", .up => "ceilf", .zero => "truncf", - } } } }, + } } }, .unused, .unused, .unused, @@ -75874,12 +75816,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "floor", .up => "ceil", .zero => "trunc", - } } } }, + } } }, .unused, .unused, .unused, @@ -76001,12 +75943,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "floor", .up => "ceil", .zero => "trunc", - } } } }, + } } }, .unused, .unused, .unused, @@ -76036,12 +75978,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "floor", .up => "ceil", .zero => "trunc", - } } } }, + } } }, .unused, .unused, .unused, @@ -76071,12 +76013,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "floor", .up => "ceil", .zero => "trunc", - } } } }, + } } }, .unused, .unused, .unused, @@ -76107,12 +76049,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "__floorx", .up => "__ceilx", .zero => "__truncx", - } } } }, + } } }, .unused, .unused, .unused, @@ -76139,12 +76081,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "__floorx", .up => "__ceilx", .zero => "__truncx", - } } } }, + } } }, .unused, .unused, .unused, @@ -76171,12 +76113,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "__floorx", .up => "__ceilx", .zero => "__truncx", - } } } }, + } } }, .unused, .unused, .unused, @@ -76204,12 +76146,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "__floorx", .up => "__ceilx", .zero => "__truncx", - } } } }, + } } }, .unused, .unused, .unused, @@ -76241,12 +76183,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "__floorx", .up => "__ceilx", .zero => "__truncx", - } } } }, + } } }, .unused, .unused, .unused, @@ -76278,12 +76220,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "__floorx", .up => "__ceilx", .zero => "__truncx", - } } } }, + } } }, .unused, .unused, .unused, @@ -76312,12 +76254,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "floorq", .up => "ceilq", .zero => "truncq", - } } } }, + } } }, .unused, .unused, .unused, @@ -76344,12 +76286,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "floorq", .up => "ceilq", .zero => "truncq", - } } } }, + } } }, .unused, .unused, .unused, @@ -76379,12 +76321,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "floorq", .up => "ceilq", .zero => "truncq", - } } } }, + } } }, .unused, .unused, .unused, @@ -76414,12 +76356,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = switch (direction) { + .{ .type = .usize, .kind = .{ .extern_func = switch (direction) { else => unreachable, .down => "floorq", .up => "ceilq", .zero => "truncq", - } } } }, + } } }, .unused, .unused, .unused, @@ -77051,7 +76993,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -77394,7 +77336,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -77555,7 +77497,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -77922,7 +77864,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -78591,7 +78533,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -78635,7 +78577,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -78679,7 +78621,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -78724,7 +78666,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -78769,7 +78711,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -78816,7 +78758,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -78863,7 +78805,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -78916,7 +78858,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -78969,7 +78911,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -79023,7 +78965,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -79077,7 +79019,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -79133,7 +79075,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -79960,7 +79902,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -80004,7 +79946,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -80048,7 +79990,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -80092,7 +80034,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -80136,7 +80078,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -80180,7 +80122,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -80224,7 +80166,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -80277,7 +80219,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -80330,7 +80272,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -80383,7 +80325,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -80436,7 +80378,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -80489,7 +80431,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -83099,7 +83041,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -83143,7 +83085,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -83187,7 +83129,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -83232,7 +83174,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -83277,7 +83219,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -83324,7 +83266,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -83371,7 +83313,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -83424,7 +83366,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -83477,7 +83419,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -83531,7 +83473,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -83585,7 +83527,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -83641,7 +83583,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmphf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmphf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -84482,7 +84424,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -84526,7 +84468,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -84570,7 +84512,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -84614,7 +84556,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -84658,7 +84600,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -84702,7 +84644,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u32, .kind = .{ .reg = .edx } }, @@ -84746,7 +84688,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -84799,7 +84741,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -84852,7 +84794,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -84905,7 +84847,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -84958,7 +84900,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -85011,7 +84953,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__cmptf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__cmptf2" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .u8, .kind = .{ .reg = .cl } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, @@ -85109,6 +85051,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .dbg_arg_inline, => |air_tag| if (use_old) try cg.airDbgVar(inst) else if (!cg.mod.strip) { const pl_op = air_datas[@intFromEnum(inst)].pl_op; + const air_name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); + const ty = cg.typeOf(pl_op.operand); var ops = try cg.tempsFromOperands(inst, .{pl_op.operand}); var mcv = ops[0].tracking(cg).short; switch (mcv) { @@ -85124,13 +85068,16 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, } - const name_nts: Air.NullTerminatedString = @enumFromInt(pl_op.payload); - assert(name_nts != .none); - const name = name_nts.toSlice(cg.air); - try cg.mir_local_name_bytes.appendSlice(cg.gpa, name[0 .. name.len + 1]); - - const ty = cg.typeOf(pl_op.operand); - try cg.mir_local_types.append(cg.gpa, ty.toIntern()); + try cg.mir_locals.append(cg.gpa, .{ + .name = switch (air_name) { + .none => switch (air_tag) { + else => unreachable, + .dbg_arg_inline => .none, + }, + else => try cg.addString(air_name.toSlice(cg.air)), + }, + .type = ty.toIntern(), + }); try cg.genLocalDebugInfo(air_tag, ty, ops[0].tracking(cg).short); try ops[0].die(cg); @@ -85398,7 +85345,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncsfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncsfhf2" } }, .unused, .unused, .unused, @@ -85455,7 +85402,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncsfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncsfhf2" } }, .unused, .unused, .unused, @@ -85486,7 +85433,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncsfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncsfhf2" } }, .unused, .unused, .unused, @@ -85517,7 +85464,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncsfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncsfhf2" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -85549,7 +85496,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncsfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncsfhf2" } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, @@ -85580,7 +85527,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncdfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncdfhf2" } }, .unused, .unused, .unused, @@ -85608,7 +85555,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncdfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncdfhf2" } }, .unused, .unused, .unused, @@ -85639,7 +85586,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncdfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncdfhf2" } }, .unused, .unused, .unused, @@ -85670,7 +85617,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncdfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncdfhf2" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -85702,7 +85649,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncdfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncdfhf2" } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, @@ -85919,7 +85866,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .size = 16, .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncxfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncxfhf2" } }, .unused, .unused, .unused, @@ -85947,7 +85894,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .size = 16, .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncxfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncxfhf2" } }, .unused, .unused, .unused, @@ -85975,7 +85922,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .size = 16, .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncxfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncxfhf2" } }, .unused, .unused, .unused, @@ -86005,7 +85952,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncxfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncxfhf2" } }, .unused, .unused, .unused, @@ -86037,7 +85984,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncxfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncxfhf2" } }, .unused, .unused, .unused, @@ -86069,7 +86016,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncxfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncxfhf2" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -86102,7 +86049,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__truncxfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__truncxfhf2" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -86243,7 +86190,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfhf2" } }, .unused, .unused, .unused, @@ -86271,7 +86218,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfhf2" } }, .unused, .unused, .unused, @@ -86302,7 +86249,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfhf2" } }, .unused, .unused, .unused, @@ -86333,7 +86280,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfhf2" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -86365,7 +86312,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfhf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfhf2" } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, @@ -86396,7 +86343,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfsf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfsf2" } }, .unused, .unused, .unused, @@ -86424,7 +86371,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfsf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfsf2" } }, .unused, .unused, .unused, @@ -86455,7 +86402,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfsf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfsf2" } }, .unused, .unused, .unused, @@ -86486,7 +86433,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfsf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfsf2" } }, .unused, .unused, .unused, @@ -86515,7 +86462,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfdf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfdf2" } }, .unused, .unused, .unused, @@ -86543,7 +86490,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfdf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfdf2" } }, .unused, .unused, .unused, @@ -86574,7 +86521,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfdf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfdf2" } }, .unused, .unused, .unused, @@ -86605,7 +86552,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfdf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfdf2" } }, .unused, .unused, .unused, @@ -86634,7 +86581,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfxf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfxf2" } }, .unused, .unused, .unused, @@ -86662,7 +86609,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfxf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfxf2" } }, .unused, .unused, .unused, @@ -86694,7 +86641,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfxf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfxf2" } }, .unused, .unused, .unused, @@ -86726,7 +86673,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__trunctfxf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__trunctfxf2" } }, .unused, .unused, .unused, @@ -86806,7 +86753,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhfsf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhfsf2" } }, .unused, .unused, .unused, @@ -86863,7 +86810,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhfsf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhfsf2" } }, .unused, .unused, .unused, @@ -86895,7 +86842,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhfsf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhfsf2" } }, .unused, .unused, .unused, @@ -86929,7 +86876,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhfsf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhfsf2" } }, .unused, .unused, .unused, @@ -87026,7 +86973,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhfdf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhfdf2" } }, .unused, .unused, .unused, @@ -87087,7 +87034,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhfdf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhfdf2" } }, .unused, .unused, .unused, @@ -87119,7 +87066,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhfdf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhfdf2" } }, .unused, .unused, .unused, @@ -87153,7 +87100,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhfdf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhfdf2" } }, .unused, .unused, .unused, @@ -87209,7 +87156,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhfxf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhfxf2" } }, .unused, .unused, .unused, @@ -87237,7 +87184,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhfxf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhfxf2" } }, .unused, .unused, .unused, @@ -87270,7 +87217,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhfxf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhfxf2" } }, .unused, .unused, .unused, @@ -87305,7 +87252,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhfxf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhfxf2" } }, .unused, .unused, .unused, @@ -87335,7 +87282,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhftf2" } }, .unused, .unused, .unused, @@ -87363,7 +87310,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhftf2" } }, .unused, .unused, .unused, @@ -87395,7 +87342,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhftf2" } }, .unused, .unused, .unused, @@ -87429,7 +87376,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendhftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendhftf2" } }, .unused, .unused, .unused, @@ -87696,7 +87643,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendsftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendsftf2" } }, .unused, .unused, .unused, @@ -87724,7 +87671,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendsftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendsftf2" } }, .unused, .unused, .unused, @@ -87755,7 +87702,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendsftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendsftf2" } }, .unused, .unused, .unused, @@ -87786,7 +87733,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendsftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendsftf2" } }, .unused, .unused, .unused, @@ -87869,7 +87816,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extenddftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extenddftf2" } }, .unused, .unused, .unused, @@ -87897,7 +87844,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extenddftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extenddftf2" } }, .unused, .unused, .unused, @@ -87928,7 +87875,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extenddftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extenddftf2" } }, .unused, .unused, .unused, @@ -87959,7 +87906,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extenddftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extenddftf2" } }, .unused, .unused, .unused, @@ -87990,7 +87937,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .size = 16, .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendxftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendxftf2" } }, .unused, .unused, .unused, @@ -88018,7 +87965,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .size = 16, .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendxftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendxftf2" } }, .unused, .unused, .unused, @@ -88046,7 +87993,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .size = 16, .alignment = .@"16" }, .extra_temps = .{ .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendxftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendxftf2" } }, .unused, .unused, .unused, @@ -88076,7 +88023,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendxftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendxftf2" } }, .unused, .unused, .unused, @@ -88108,7 +88055,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendxftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendxftf2" } }, .unused, .unused, .unused, @@ -88140,7 +88087,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__extendxftf2" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__extendxftf2" } }, .unused, .unused, .unused, @@ -98891,9 +98838,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { } }) catch |err| switch (err) { error.SelectFailed => { const elem_size = res_ty.abiSize(zcu); - const base = try cg.tempAllocReg(.usize, abi.RegisterClass.gp); + var base = try cg.tempAllocReg(.usize, abi.RegisterClass.gp); while (try ops[0].toBase(false, cg) or - try ops[1].toRegClass(true, .general_purpose, cg)) + try ops[1].toRegClass(true, .general_purpose, cg) or + try base.toRegClass(true, .general_purpose, cg)) {} const base_reg = base.tracking(cg).short.register.to64(); const rhs_reg = ops[1].tracking(cg).short.register.to64(); @@ -99334,7 +99282,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .unused, .unused, .unused, @@ -99360,7 +99308,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfsi" } }, .unused, .unused, .unused, @@ -99386,7 +99334,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfdi" } }, .unused, .unused, .unused, @@ -99412,7 +99360,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfdi" } }, .unused, .unused, .unused, @@ -99438,7 +99386,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfti" } }, .unused, .unused, .unused, @@ -99464,7 +99412,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfti" } }, .unused, .unused, .unused, @@ -99490,7 +99438,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfdi" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .u32, .kind = .{ .reg = .ecx } }, @@ -99521,7 +99469,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfdi" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .u32, .kind = .{ .reg = .ecx } }, @@ -99615,7 +99563,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -99647,7 +99595,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -99679,7 +99627,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -99711,7 +99659,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -99745,7 +99693,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .unused, .unused, .unused, @@ -99778,7 +99726,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .unused, .unused, .unused, @@ -99899,7 +99847,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -99931,7 +99879,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -99965,7 +99913,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .unused, .unused, .unused, @@ -100058,7 +100006,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -100090,7 +100038,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfsi" } }, .{ .type = .u32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -100122,7 +100070,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -100154,7 +100102,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfsi" } }, .{ .type = .u32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -100188,7 +100136,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .i32, .kind = .{ .reg = .eax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfsi" } }, .unused, .unused, .unused, @@ -100221,7 +100169,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u32, .kind = .{ .reg = .eax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfsi" } }, .unused, .unused, .unused, @@ -100284,7 +100232,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfdi" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -100316,7 +100264,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfdi" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -100348,7 +100296,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfdi" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -100380,7 +100328,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfdi" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -100414,7 +100362,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .i64, .kind = .{ .reg = .rax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfdi" } }, .unused, .unused, .unused, @@ -100447,7 +100395,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfdi" } }, .unused, .unused, .unused, @@ -100478,7 +100426,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -100511,7 +100459,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -100544,7 +100492,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -100577,7 +100525,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -100612,7 +100560,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfti" } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, .unused, @@ -100646,7 +100594,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfti" } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, .unused, @@ -100681,7 +100629,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfei" } }, .unused, .unused, .unused, @@ -100716,7 +100664,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfei" } }, .unused, .unused, .unused, @@ -100751,7 +100699,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfei" } }, .unused, .unused, .unused, @@ -100786,7 +100734,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfei" } }, .unused, .unused, .unused, @@ -100822,7 +100770,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixhfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixhfei" } }, .unused, .unused, .unused, @@ -100858,7 +100806,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunshfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunshfei" } }, .unused, .unused, .unused, @@ -101000,7 +100948,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfti" } }, .unused, .unused, .unused, @@ -101026,7 +100974,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfti" } }, .unused, .unused, .unused, @@ -101055,7 +101003,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .i64, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .{ .type = .vector_4_f32, .kind = .{ .smax_mem = .{} } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfti" } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .u32, .kind = .{ .reg = .ecx } }, @@ -101096,7 +101044,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .i64, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .{ .type = .vector_4_f32, .kind = .{ .smax_mem = .{} } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfti" } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .u32, .kind = .{ .reg = .ecx } }, @@ -101137,7 +101085,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .{ .type = .vector_4_f32, .kind = .{ .smax_mem = .{} } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfti" } }, .{ .type = .u32, .kind = .{ .reg = .ecx } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, @@ -101175,7 +101123,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfti" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, @@ -101385,7 +101333,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -101416,7 +101364,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -101447,7 +101395,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -101478,7 +101426,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -101681,7 +101629,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -101712,7 +101660,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -101825,7 +101773,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -101856,7 +101804,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfsi" } }, .{ .type = .u32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -101887,7 +101835,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -101918,7 +101866,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfsi" } }, .{ .type = .u32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -102007,7 +101955,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfdi" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -102038,7 +101986,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfdi" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -102069,7 +102017,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfdi" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -102100,7 +102048,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfdi" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -102131,7 +102079,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -102163,7 +102111,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -102195,7 +102143,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -102227,7 +102175,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -102262,7 +102210,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfei" } }, .unused, .unused, .unused, @@ -102296,7 +102244,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfei" } }, .unused, .unused, .unused, @@ -102330,7 +102278,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfei" } }, .unused, .unused, .unused, @@ -102364,7 +102312,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunssfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunssfei" } }, .unused, .unused, .unused, @@ -102703,7 +102651,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfti" } }, .unused, .unused, .unused, @@ -102729,7 +102677,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfti" } }, .unused, .unused, .unused, @@ -102757,7 +102705,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfei" } }, .unused, .unused, .unused, @@ -102785,7 +102733,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfei" } }, .unused, .unused, .unused, @@ -103090,7 +103038,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103121,7 +103069,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103152,7 +103100,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103183,7 +103131,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103214,7 +103162,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103246,7 +103194,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixsfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixsfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103577,7 +103525,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103608,7 +103556,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103639,7 +103587,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103837,7 +103785,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103868,7 +103816,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfsi" } }, .{ .type = .u32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103899,7 +103847,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103930,7 +103878,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfsi" } }, .{ .type = .u32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103961,7 +103909,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -103993,7 +103941,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfsi" } }, .{ .type = .u32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -104118,7 +104066,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfdi" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -104149,7 +104097,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfdi" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -104180,7 +104128,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfdi" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -104211,7 +104159,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfdi" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -104242,7 +104190,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfdi" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -104274,7 +104222,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfdi" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -104306,7 +104254,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -104338,7 +104286,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -104370,7 +104318,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -104402,7 +104350,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -104434,7 +104382,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -104467,7 +104415,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -104503,7 +104451,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfei" } }, .unused, .unused, .unused, @@ -104537,7 +104485,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfei" } }, .unused, .unused, .unused, @@ -104571,7 +104519,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfei" } }, .unused, .unused, .unused, @@ -104605,7 +104553,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfei" } }, .unused, .unused, .unused, @@ -104639,7 +104587,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixdfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixdfei" } }, .unused, .unused, .unused, @@ -104674,7 +104622,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsdfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsdfei" } }, .unused, .unused, .unused, @@ -105695,7 +105643,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -105727,7 +105675,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -105759,7 +105707,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -105790,7 +105738,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixxfti" } }, .unused, .unused, .unused, @@ -105818,7 +105766,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfti" } }, .unused, .unused, .unused, @@ -105846,7 +105794,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixxfti" } }, .unused, .unused, .unused, @@ -105874,7 +105822,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfti" } }, .unused, .unused, .unused, @@ -105902,7 +105850,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixxfti" } }, .unused, .unused, .unused, @@ -105930,7 +105878,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfti" } }, .unused, .unused, .unused, @@ -105959,7 +105907,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixxfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -105992,7 +105940,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -106025,7 +105973,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixxfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -106058,7 +106006,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -106091,7 +106039,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixxfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -106124,7 +106072,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -106158,7 +106106,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixxfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixxfei" } }, .unused, .unused, .unused, @@ -106188,7 +106136,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfei" } }, .unused, .unused, .unused, @@ -106218,7 +106166,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixxfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixxfei" } }, .unused, .unused, .unused, @@ -106248,7 +106196,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfei" } }, .unused, .unused, .unused, @@ -106278,7 +106226,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixxfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixxfei" } }, .unused, .unused, .unused, @@ -106308,7 +106256,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfei" } }, .unused, .unused, .unused, @@ -106340,7 +106288,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixxfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixxfei" } }, .unused, .unused, .unused, @@ -106375,7 +106323,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfei" } }, .unused, .unused, .unused, @@ -106410,7 +106358,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixxfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixxfei" } }, .unused, .unused, .unused, @@ -106445,7 +106393,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfei" } }, .unused, .unused, .unused, @@ -106480,7 +106428,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixxfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixxfei" } }, .unused, .unused, .unused, @@ -106515,7 +106463,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunsxfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunsxfei" } }, .unused, .unused, .unused, @@ -106547,7 +106495,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -106580,7 +106528,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -106613,7 +106561,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -106646,7 +106594,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -106679,7 +106627,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -106712,7 +106660,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -106744,7 +106692,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -106775,7 +106723,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -106806,7 +106754,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -106835,7 +106783,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .unused, .unused, .unused, @@ -106861,7 +106809,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfsi" } }, .unused, .unused, .unused, @@ -106889,7 +106837,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -106920,7 +106868,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfsi" } }, .{ .type = .u32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -106951,7 +106899,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -106982,7 +106930,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfsi" } }, .{ .type = .u32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -107013,7 +106961,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfsi" } }, .{ .type = .i32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -107044,7 +106992,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfsi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfsi" } }, .{ .type = .u32, .kind = .{ .reg = .eax } }, .unused, .unused, @@ -107073,7 +107021,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfdi" } }, .unused, .unused, .unused, @@ -107099,7 +107047,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfdi" } }, .unused, .unused, .unused, @@ -107127,7 +107075,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfdi" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -107158,7 +107106,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfdi" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -107189,7 +107137,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfdi" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -107220,7 +107168,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfdi" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -107251,7 +107199,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfdi" } }, .{ .type = .i64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -107282,7 +107230,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfdi" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfdi" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .unused, .unused, @@ -107311,7 +107259,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfti" } }, .unused, .unused, .unused, @@ -107337,7 +107285,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfti" } }, .unused, .unused, .unused, @@ -107365,7 +107313,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -107397,7 +107345,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -107429,7 +107377,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -107461,7 +107409,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -107493,7 +107441,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .i64, .kind = .{ .reg = .rdx } }, .unused, @@ -107525,7 +107473,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfti" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfti" } }, .{ .type = .u64, .kind = .{ .reg = .rax } }, .{ .type = .u64, .kind = .{ .reg = .rdx } }, .unused, @@ -107557,7 +107505,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfei" } }, .unused, .unused, .unused, @@ -107585,7 +107533,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfei" } }, .unused, .unused, .unused, @@ -107616,7 +107564,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfei" } }, .unused, .unused, .unused, @@ -107650,7 +107598,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfei" } }, .unused, .unused, .unused, @@ -107684,7 +107632,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfei" } }, .unused, .unused, .unused, @@ -107718,7 +107666,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfei" } }, .unused, .unused, .unused, @@ -107752,7 +107700,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixtfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixtfei" } }, .unused, .unused, .unused, @@ -107786,7 +107734,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fixunstfei" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fixunstfei" } }, .unused, .unused, .unused, @@ -108034,7 +107982,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .unused, .unused, .unused, @@ -108061,7 +108009,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .unused, .unused, .unused, @@ -108088,7 +108036,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .unused, .unused, .unused, @@ -108115,7 +108063,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .unused, .unused, .unused, @@ -108142,7 +108090,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .unused, .unused, .unused, @@ -108168,7 +108116,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .unused, .unused, .unused, @@ -108194,7 +108142,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatdihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatdihf" } }, .unused, .unused, .unused, @@ -108220,7 +108168,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatundihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatundihf" } }, .unused, .unused, .unused, @@ -108246,7 +108194,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattihf" } }, .unused, .unused, .unused, @@ -108272,7 +108220,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntihf" } }, .unused, .unused, .unused, @@ -108300,7 +108248,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateihf" } }, .unused, .unused, .unused, @@ -108328,7 +108276,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneihf" } }, .unused, .unused, .unused, @@ -108532,7 +108480,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -108563,7 +108511,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -108594,7 +108542,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -108625,7 +108573,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -108656,7 +108604,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -108688,7 +108636,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -108720,7 +108668,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -108753,7 +108701,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -108786,7 +108734,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -108817,7 +108765,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -108848,7 +108796,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -108879,7 +108827,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -108910,7 +108858,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -108942,7 +108890,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -108974,7 +108922,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -109007,7 +108955,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -109216,7 +109164,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109247,7 +109195,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109278,7 +109226,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109310,7 +109258,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -109343,7 +109291,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109374,7 +109322,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109405,7 +109353,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109437,7 +109385,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -109554,7 +109502,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109585,7 +109533,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109616,7 +109564,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109648,7 +109596,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -109681,7 +109629,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109712,7 +109660,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109743,7 +109691,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109775,7 +109723,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -109839,7 +109787,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatdihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatdihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109870,7 +109818,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatdihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatdihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109901,7 +109849,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatdihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatdihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109933,7 +109881,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatdihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatdihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -109966,7 +109914,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatundihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatundihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -109997,7 +109945,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatundihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatundihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110028,7 +109976,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatundihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatundihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110060,7 +110008,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatundihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatundihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -110094,7 +110042,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110126,7 +110074,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110158,7 +110106,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110191,7 +110139,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -110225,7 +110173,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110257,7 +110205,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110289,7 +110237,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110322,7 +110270,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -110357,7 +110305,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110391,7 +110339,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110425,7 +110373,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110460,7 +110408,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -110496,7 +110444,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110530,7 +110478,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110564,7 +110512,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -110599,7 +110547,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneihf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneihf" } }, .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .mem }, .unused, @@ -111023,7 +110971,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattisf" } }, .unused, .unused, .unused, @@ -111049,7 +110997,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntisf" } }, .unused, .unused, .unused, @@ -111077,7 +111025,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateisf" } }, .unused, .unused, .unused, @@ -111105,7 +111053,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneisf" } }, .unused, .unused, .unused, @@ -111391,7 +111339,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -111422,7 +111370,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -111453,7 +111401,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -111484,7 +111432,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -111515,7 +111463,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -111546,7 +111494,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -111577,7 +111525,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -111608,7 +111556,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -111897,7 +111845,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -111928,7 +111876,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -111959,7 +111907,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -111990,7 +111938,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112173,7 +112121,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112204,7 +112152,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112235,7 +112183,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112266,7 +112214,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112357,7 +112305,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatdisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatdisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112388,7 +112336,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatdisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatdisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112419,7 +112367,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatundisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatundisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112450,7 +112398,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatundisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatundisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112482,7 +112430,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112514,7 +112462,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112546,7 +112494,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112578,7 +112526,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112611,7 +112559,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112645,7 +112593,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112679,7 +112627,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -112713,7 +112661,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneisf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneisf" } }, .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -113353,7 +113301,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattidf" } }, .unused, .unused, .unused, @@ -113379,7 +113327,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntidf" } }, .unused, .unused, .unused, @@ -113407,7 +113355,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateidf" } }, .unused, .unused, .unused, @@ -113435,7 +113383,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneidf" } }, .unused, .unused, .unused, @@ -113729,7 +113677,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -113760,7 +113708,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -113791,7 +113739,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -113822,7 +113770,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -113853,7 +113801,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -113884,7 +113832,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -113915,7 +113863,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -113946,7 +113894,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -113977,7 +113925,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114008,7 +113956,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114039,7 +113987,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114070,7 +114018,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114363,7 +114311,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114394,7 +114342,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114425,7 +114373,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114456,7 +114404,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114487,7 +114435,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114518,7 +114466,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114672,7 +114620,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114703,7 +114651,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114734,7 +114682,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114765,7 +114713,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114796,7 +114744,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114827,7 +114775,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114918,7 +114866,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatdidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatdidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114949,7 +114897,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatdidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatdidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -114980,7 +114928,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatdidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatdidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115011,7 +114959,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatundidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatundidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115042,7 +114990,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatundidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatundidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115073,7 +115021,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatundidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatundidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115105,7 +115053,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115137,7 +115085,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115169,7 +115117,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115201,7 +115149,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115233,7 +115181,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115265,7 +115213,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115298,7 +115246,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115332,7 +115280,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115366,7 +115314,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115400,7 +115348,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115434,7 +115382,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115468,7 +115416,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneidf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneidf" } }, .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -115715,7 +115663,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattixf" } }, .unused, .unused, .unused, @@ -115741,7 +115689,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntixf" } }, .unused, .unused, .unused, @@ -115769,7 +115717,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateixf" } }, .unused, .unused, .unused, @@ -115797,7 +115745,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneixf" } }, .unused, .unused, .unused, @@ -115958,7 +115906,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -115992,7 +115940,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116026,7 +115974,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116060,7 +116008,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116122,7 +116070,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116154,7 +116102,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116215,7 +116163,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116247,7 +116195,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116308,7 +116256,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatdixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatdixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116340,7 +116288,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatundixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatundixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116373,7 +116321,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116406,7 +116354,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116440,7 +116388,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116475,7 +116423,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneixf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneixf" } }, .{ .type = .f80, .kind = .{ .reg = .st7 } }, .unused, .unused, @@ -116508,7 +116456,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .unused, .unused, .unused, @@ -116536,7 +116484,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .unused, .unused, .unused, @@ -116564,7 +116512,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .unused, .unused, .unused, @@ -116592,7 +116540,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .unused, .unused, .unused, @@ -116618,7 +116566,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .unused, .unused, .unused, @@ -116644,7 +116592,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .unused, .unused, .unused, @@ -116670,7 +116618,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatditf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatditf" } }, .unused, .unused, .unused, @@ -116696,7 +116644,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunditf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunditf" } }, .unused, .unused, .unused, @@ -116722,7 +116670,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattitf" } }, .unused, .unused, .unused, @@ -116748,7 +116696,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntitf" } }, .unused, .unused, .unused, @@ -116776,7 +116724,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateitf" } }, .unused, .unused, .unused, @@ -116804,7 +116752,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneitf" } }, .unused, .unused, .unused, @@ -116833,7 +116781,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -116866,7 +116814,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -116899,7 +116847,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -116932,7 +116880,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -116965,7 +116913,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -116998,7 +116946,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117031,7 +116979,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117064,7 +117012,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117097,7 +117045,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117130,7 +117078,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117163,7 +117111,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117196,7 +117144,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117228,7 +117176,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117259,7 +117207,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117290,7 +117238,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117321,7 +117269,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117352,7 +117300,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117383,7 +117331,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117414,7 +117362,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117445,7 +117393,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117476,7 +117424,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117507,7 +117455,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117538,7 +117486,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117569,7 +117517,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u32, .kind = .{ .reg = .edi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunsitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117600,7 +117548,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatditf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatditf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117631,7 +117579,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatditf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatditf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117662,7 +117610,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .i64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatditf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatditf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117693,7 +117641,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunditf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunditf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117724,7 +117672,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunditf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunditf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117755,7 +117703,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatunditf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatunditf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117787,7 +117735,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117819,7 +117767,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117851,7 +117799,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .i64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floattitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floattitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117883,7 +117831,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117915,7 +117863,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117947,7 +117895,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .u64, .kind = .{ .reg = .rdi } }, .{ .type = .u64, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuntitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuntitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -117980,7 +117928,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -118014,7 +117962,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -118048,7 +117996,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floateitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floateitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -118082,7 +118030,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -118116,7 +118064,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -118150,7 +118098,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .usize, .kind = .{ .reg = .rdi } }, .{ .type = .usize, .kind = .{ .reg = .rsi } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__floatuneitf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__floatuneitf" } }, .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .unused, .unused, @@ -131865,7 +131813,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fminh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fminh" } }, .unused, .unused, .unused, @@ -131898,7 +131846,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fminh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fminh" } }, .unused, .unused, .unused, @@ -131933,7 +131881,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fminh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fminh" } }, .unused, .unused, .unused, @@ -133533,7 +133481,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fminq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fminq" } }, .unused, .unused, .unused, @@ -133564,7 +133512,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fminq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fminq" } }, .unused, .unused, .unused, @@ -133595,7 +133543,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fminq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fminq" } }, .unused, .unused, .unused, @@ -141985,7 +141933,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmaxh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmaxh" } }, .unused, .unused, .unused, @@ -142018,7 +141966,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmaxh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmaxh" } }, .unused, .unused, .unused, @@ -142053,7 +142001,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmaxh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmaxh" } }, .unused, .unused, .unused, @@ -143661,7 +143609,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaxq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaxq" } }, .unused, .unused, .unused, @@ -143692,7 +143640,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaxq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaxq" } }, .unused, .unused, .unused, @@ -143723,7 +143671,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaxq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaxq" } }, .unused, .unused, .unused, @@ -147656,7 +147604,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -147689,7 +147637,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -147724,7 +147672,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -148241,7 +148189,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -148272,7 +148220,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -148303,7 +148251,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -151315,7 +151263,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -151348,7 +151296,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -151383,7 +151331,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -151780,7 +151728,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -151811,7 +151759,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -151842,7 +151790,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -152354,7 +152302,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fminh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fminh" } }, .unused, .unused, .unused, @@ -152387,7 +152335,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fminh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fminh" } }, .unused, .unused, .unused, @@ -152422,7 +152370,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fminh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fminh" } }, .unused, .unused, .unused, @@ -153502,7 +153450,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fminq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fminq" } }, .unused, .unused, .unused, @@ -153533,7 +153481,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fminq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fminq" } }, .unused, .unused, .unused, @@ -153564,7 +153512,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fminq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fminq" } }, .unused, .unused, .unused, @@ -154046,7 +153994,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmaxh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmaxh" } }, .unused, .unused, .unused, @@ -154079,7 +154027,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmaxh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmaxh" } }, .unused, .unused, .unused, @@ -154114,7 +154062,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmaxh" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmaxh" } }, .unused, .unused, .unused, @@ -155194,7 +155142,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaxq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaxq" } }, .unused, .unused, .unused, @@ -155225,7 +155173,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaxq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaxq" } }, .unused, .unused, .unused, @@ -155256,7 +155204,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaxq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaxq" } }, .unused, .unused, .unused, @@ -155987,7 +155935,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -156020,7 +155968,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -156055,7 +156003,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addhf3" } }, .unused, .unused, .unused, @@ -157453,7 +157401,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -157484,7 +157432,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -157515,7 +157463,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__addtf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } }, .unused, .unused, .unused, @@ -157997,7 +157945,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -158030,7 +157978,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -158065,7 +158013,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .ax } }, .{ .type = .f32, .kind = .mem }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__mulhf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__mulhf3" } }, .unused, .unused, .unused, @@ -158996,7 +158944,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -159027,7 +158975,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -159058,7 +159006,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .u32, .kind = .{ .rc = .general_purpose } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__multf3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } }, .unused, .unused, .unused, @@ -160939,7 +160887,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = @tagName(symbol) } } }, + .{ .type = .usize, .kind = .{ .extern_func = @tagName(symbol) } }, .unused, .unused, .unused, @@ -160988,7 +160936,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"32" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .lazy_symbol = .{ .kind = .code, .ref = .src0 } } }, + .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .code, .ref = .src0 } } }, .unused, .unused, .unused, @@ -161014,7 +160962,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .lazy_symbol = .{ .kind = .code, .ref = .src0 } } }, + .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .code, .ref = .src0 } } }, .unused, .unused, .unused, @@ -161039,7 +160987,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"8" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .lazy_symbol = .{ .kind = .code, .ref = .src0 } } }, + .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .code, .ref = .src0 } } }, .unused, .unused, .unused, @@ -161079,7 +161027,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"32" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .lazy_symbol = .{ .kind = .code, .ref = .src0 } } }, + .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .code, .ref = .src0 } } }, .unused, .unused, .unused, @@ -161104,7 +161052,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .lazy_symbol = .{ .kind = .code, .ref = .src0 } } }, + .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .code, .ref = .src0 } } }, .unused, .unused, .unused, @@ -161128,7 +161076,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"8" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .lazy_symbol = .{ .kind = .code, .ref = .src0 } } }, + .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .code, .ref = .src0 } } }, .unused, .unused, .unused, @@ -161167,7 +161115,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .src = .{ .to_gpr, .none, .none } }, }, .extra_temps = .{ - .{ .type = .anyerror, .kind = .{ .lazy_symbol = .{ .kind = .const_data } } }, + .{ .type = .anyerror, .kind = .{ .lazy_sym = .{ .kind = .const_data } } }, .{ .type = .u32, .kind = .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } } }, .unused, .unused, @@ -161196,7 +161144,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .src = .{ .to_gpr, .none, .none } }, }, .extra_temps = .{ - .{ .type = .anyerror, .kind = .{ .lazy_symbol = .{ .kind = .const_data } } }, + .{ .type = .anyerror, .kind = .{ .lazy_sym = .{ .kind = .const_data } } }, .{ .type = .u32, .kind = .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } } }, .unused, .unused, @@ -161225,7 +161173,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .src = .{ .to_gpr, .none, .none } }, }, .extra_temps = .{ - .{ .type = .anyerror, .kind = .{ .lazy_symbol = .{ .kind = .const_data } } }, + .{ .type = .anyerror, .kind = .{ .lazy_sym = .{ .kind = .const_data } } }, .{ .type = .u32, .kind = .{ .mut_rc = .{ .ref = .src0, .rc = .general_purpose } } }, .unused, .unused, @@ -161276,7 +161224,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"32" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .lazy_symbol = .{ .kind = .code, .ref = .src1 } } }, + .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .code, .ref = .src1 } } }, .unused, .unused, .unused, @@ -161302,7 +161250,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .lazy_symbol = .{ .kind = .code, .ref = .src1 } } }, + .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .code, .ref = .src1 } } }, .unused, .unused, .unused, @@ -161327,7 +161275,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"8" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .lazy_symbol = .{ .kind = .code, .ref = .src1 } } }, + .{ .type = .usize, .kind = .{ .lazy_sym = .{ .kind = .code, .ref = .src1 } } }, .unused, .unused, .unused, @@ -161523,7 +161471,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmah" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmah" } }, .unused, .unused, .unused, @@ -161666,7 +161614,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, .{ .type = .f16, .kind = .{ .reg = .xmm2 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmah" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmah" } }, .unused, .unused, .unused, @@ -161703,7 +161651,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, .{ .type = .f16, .kind = .{ .reg = .xmm2 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmah" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmah" } }, .unused, .unused, .unused, @@ -161742,7 +161690,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, .{ .type = .f16, .kind = .{ .reg = .xmm2 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmah" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmah" } }, .{ .type = .f16, .kind = .{ .reg = .ax } }, .unused, .unused, @@ -161784,7 +161732,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f16, .kind = .{ .reg = .xmm0 } }, .{ .type = .f16, .kind = .{ .reg = .xmm1 } }, .{ .type = .f16, .kind = .{ .reg = .xmm2 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmah" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmah" } }, .unused, .unused, .unused, @@ -161872,7 +161820,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaf" } }, .unused, .unused, .unused, @@ -162038,7 +161986,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .{ .reg = .xmm1 } }, .{ .type = .f32, .kind = .{ .reg = .xmm2 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaf" } }, .unused, .unused, .unused, @@ -162074,7 +162022,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f32, .kind = .{ .reg = .xmm0 } }, .{ .type = .f32, .kind = .{ .reg = .xmm1 } }, .{ .type = .f32, .kind = .{ .reg = .xmm2 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaf" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaf" } }, .unused, .unused, .unused, @@ -162156,7 +162104,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fma" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fma" } }, .unused, .unused, .unused, @@ -162322,7 +162270,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, .{ .type = .f64, .kind = .{ .reg = .xmm2 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fma" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fma" } }, .unused, .unused, .unused, @@ -162358,7 +162306,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, .{ .type = .f64, .kind = .{ .reg = .xmm2 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fma" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fma" } }, .unused, .unused, .unused, @@ -162394,7 +162342,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f64, .kind = .{ .reg = .xmm0 } }, .{ .type = .f64, .kind = .{ .reg = .xmm1 } }, .{ .type = .f64, .kind = .{ .reg = .xmm2 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fma" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fma" } }, .unused, .unused, .unused, @@ -162431,7 +162379,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .extra_temps = .{ .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmax" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmax" } }, .unused, .unused, .unused, @@ -162467,7 +162415,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .isize, .kind = .{ .rc = .general_purpose } }, .{ .type = .f80, .kind = .{ .reg = .xmm0 } }, .{ .type = .f80, .kind = .{ .frame = .call_frame } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__fmax" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__fmax" } }, .unused, .unused, .unused, @@ -162504,7 +162452,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaq" } }, .unused, .unused, .unused, @@ -162537,7 +162485,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, .{ .type = .f128, .kind = .{ .reg = .xmm2 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaq" } }, .unused, .unused, .unused, @@ -162573,7 +162521,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, .{ .type = .f128, .kind = .{ .reg = .xmm2 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaq" } }, .unused, .unused, .unused, @@ -162609,7 +162557,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .type = .f128, .kind = .{ .reg = .xmm0 } }, .{ .type = .f128, .kind = .{ .reg = .xmm1 } }, .{ .type = .f128, .kind = .{ .reg = .xmm2 } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "fmaq" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "fmaq" } }, .unused, .unused, .unused, @@ -162663,7 +162611,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .src = .{ .to_gpr, .none, .none } }, }, .extra_temps = .{ - .{ .type = .anyerror, .kind = .{ .lazy_symbol = .{ .kind = .const_data } } }, + .{ .type = .anyerror, .kind = .{ .lazy_sym = .{ .kind = .const_data } } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .unused, .unused, @@ -162687,7 +162635,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .src = .{ .to_gpr, .none, .none } }, }, .extra_temps = .{ - .{ .type = .anyerror, .kind = .{ .lazy_symbol = .{ .kind = .const_data } } }, + .{ .type = .anyerror, .kind = .{ .lazy_sym = .{ .kind = .const_data } } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .unused, .unused, @@ -162711,7 +162659,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .{ .src = .{ .to_gpr, .none, .none } }, }, .extra_temps = .{ - .{ .type = .anyerror, .kind = .{ .lazy_symbol = .{ .kind = .const_data } } }, + .{ .type = .anyerror, .kind = .{ .lazy_sym = .{ .kind = .const_data } } }, .{ .type = .usize, .kind = .{ .rc = .general_purpose } }, .unused, .unused, @@ -163402,65 +163350,17 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }; for (ops) |op| try op.die(cg); }, - .runtime_nav_ptr => switch (cg.bin_file.tag) { - .elf, .macho => { - const ty_nav = air_datas[@intFromEnum(inst)].ty_nav; - - const nav = ip.getNav(ty_nav.nav); - const sym_index, const relocation = sym: { - if (cg.bin_file.cast(.elf)) |elf_file| { - const zo = elf_file.zigObjectPtr().?; - if (nav.getExtern(ip)) |e| { - const sym = try elf_file.getGlobalSymbol(nav.name.toSlice(ip), e.lib_name.toSlice(ip)); - linkage: switch (e.linkage) { - .internal => {}, - .strong => switch (e.visibility) { - .default => zo.symbol(sym).flags.is_extern_ptr = true, - .hidden, .protected => {}, - }, - .weak => { - zo.symbol(sym).flags.weak = true; - continue :linkage .strong; - }, - .link_once => unreachable, - } - break :sym .{ sym, e.relocation }; - } else break :sym .{ try zo.getOrCreateMetadataForNav(zcu, ty_nav.nav), .any }; - } else if (cg.bin_file.cast(.macho)) |macho_file| { - const zo = macho_file.getZigObject().?; - if (nav.getExtern(ip)) |e| { - const sym = try macho_file.getGlobalSymbol(nav.name.toSlice(ip), e.lib_name.toSlice(ip)); - linkage: switch (e.linkage) { - .internal => {}, - .strong => switch (e.visibility) { - .default => zo.symbols.items[sym].flags.is_extern_ptr = true, - .hidden, .protected => {}, - }, - .weak => { - zo.symbols.items[sym].flags.weak = true; - continue :linkage .strong; - }, - .link_once => unreachable, - } - break :sym .{ sym, e.relocation }; - } else break :sym .{ try zo.getOrCreateMetadataForNav(macho_file, ty_nav.nav), .any }; - } else unreachable; - }; - - if (cg.mod.pic) { - try cg.spillRegisters(&.{ .rdi, .rax }); - } else { - try cg.spillRegisters(&.{.rax}); - } - - var slot = try cg.tempInit(.usize, switch (relocation) { - .any => .{ .lea_symbol = .{ .sym_index = sym_index } }, - .pcrel => .{ .lea_pcrel = .{ .sym_index = sym_index } }, - }); - while (try slot.toRegClass(true, .general_purpose, cg)) {} - try slot.finish(inst, &.{}, &.{}, cg); - }, - else => return cg.fail("TODO implement runtime_nav_ptr on {}", .{cg.bin_file.tag}), + .runtime_nav_ptr => { + const ty_nav = air_datas[@intFromEnum(inst)].ty_nav; + const is_threadlocal = ip.getNav(ty_nav.nav).isThreadlocal(ip); + if (is_threadlocal) if (cg.mod.pic) { + try cg.spillRegisters(&.{ .rdi, .rax }); + } else { + try cg.spillRegisters(&.{.rax}); + }; + var res = try cg.tempInit(.fromInterned(ty_nav.ty), .{ .lea_nav = ty_nav.nav }); + if (is_threadlocal) while (try res.toRegClass(true, .general_purpose, cg)) {}; + try res.finish(inst, &.{}, &.{}, cg); }, .c_va_arg => try cg.airVaArg(inst), .c_va_copy => try cg.airVaCopy(inst), @@ -164116,11 +164016,11 @@ fn airFptrunc(self: *CodeGen, inst: Air.Inst.Index) !void { }, else => unreachable, }) { - var callee_buf: ["__trunc?f?f2".len]u8 = undefined; - break :result try self.genCall(.{ .lib = .{ + var sym_buf: ["__trunc?f?f2".len]u8 = undefined; + break :result try self.genCall(.{ .extern_func = .{ .return_type = self.floatCompilerRtAbiType(dst_ty, src_ty).toIntern(), .param_types = &.{self.floatCompilerRtAbiType(src_ty, dst_ty).toIntern()}, - .callee = std.fmt.bufPrint(&callee_buf, "__trunc{c}f{c}f2", .{ + .sym = std.fmt.bufPrint(&sym_buf, "__trunc{c}f{c}f2", .{ floatCompilerRtAbiName(src_bits), floatCompilerRtAbiName(dst_bits), }) catch unreachable, @@ -164220,11 +164120,11 @@ fn airFpext(self: *CodeGen, inst: Air.Inst.Index) !void { else => unreachable, }) { if (dst_ty.isVector(zcu)) break :result null; - var callee_buf: ["__extend?f?f2".len]u8 = undefined; - break :result try self.genCall(.{ .lib = .{ + var sym_buf: ["__extend?f?f2".len]u8 = undefined; + break :result try self.genCall(.{ .extern_func = .{ .return_type = self.floatCompilerRtAbiType(dst_scalar_ty, src_scalar_ty).toIntern(), .param_types = &.{self.floatCompilerRtAbiType(src_scalar_ty, dst_scalar_ty).toIntern()}, - .callee = std.fmt.bufPrint(&callee_buf, "__extend{c}f{c}f2", .{ + .sym = std.fmt.bufPrint(&sym_buf, "__extend{c}f{c}f2", .{ floatCompilerRtAbiName(src_bits), floatCompilerRtAbiName(dst_bits), }) catch unreachable, @@ -164661,7 +164561,7 @@ fn airTrunc(self: *CodeGen, inst: Air.Inst.Index) !void { .storage = .{ .repeated_elem = mask_val.ip_index }, } }); - const splat_mcv = try self.genTypedValue(.fromInterned(splat_val)); + const splat_mcv = try self.lowerValue(.fromInterned(splat_val)); const splat_addr_mcv: MCValue = switch (splat_mcv) { .memory, .indirect, .load_frame => splat_mcv.address(), else => .{ .register = try self.copyToTmpRegister(.usize, splat_mcv.address()) }, @@ -164860,7 +164760,7 @@ fn airMulDivBinOp(self: *CodeGen, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void .mul, .mul_wrap => {}, .div_trunc, .div_floor, .div_exact, .rem, .mod => { const signed = dst_ty.isSignedInt(zcu); - var callee_buf: ["__udiv?i3".len]u8 = undefined; + var sym_buf: ["__udiv?i3".len]u8 = undefined; const signed_div_floor_state: struct { frame_index: FrameIndex, state: State, @@ -164879,7 +164779,7 @@ fn airMulDivBinOp(self: *CodeGen, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void const lhs_mcv = try self.resolveInst(bin_op.lhs); const mat_lhs_mcv = switch (lhs_mcv) { - .load_symbol => mat_lhs_mcv: { + .load_nav, .load_uav, .load_lazy_sym => mat_lhs_mcv: { // TODO clean this up! const addr_reg = try self.copyToTmpRegister(.usize, lhs_mcv.address()); break :mat_lhs_mcv MCValue{ .indirect = .{ .reg = addr_reg } }; @@ -164903,7 +164803,7 @@ fn airMulDivBinOp(self: *CodeGen, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void const rhs_mcv = try self.resolveInst(bin_op.rhs); const mat_rhs_mcv = switch (rhs_mcv) { - .load_symbol => mat_rhs_mcv: { + .load_nav, .load_uav, .load_lazy_sym => mat_rhs_mcv: { // TODO clean this up! const addr_reg = try self.copyToTmpRegister(.usize, rhs_mcv.address()); break :mat_rhs_mcv MCValue{ .indirect = .{ .reg = addr_reg } }; @@ -164930,10 +164830,10 @@ fn airMulDivBinOp(self: *CodeGen, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void break :state .{ .frame_index = frame_index, .state = state, .reloc = reloc }; } else undefined; const call_mcv = try self.genCall( - .{ .lib = .{ + .{ .extern_func = .{ .return_type = dst_ty.toIntern(), .param_types = &.{ src_ty.toIntern(), src_ty.toIntern() }, - .callee = std.fmt.bufPrint(&callee_buf, "__{s}{s}{c}i3", .{ + .sym = std.fmt.bufPrint(&sym_buf, "__{s}{s}{c}i3", .{ if (signed) "" else "u", switch (tag) { .div_trunc, .div_exact => "div", @@ -164967,10 +164867,10 @@ fn airMulDivBinOp(self: *CodeGen, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void }); self.performReloc(signed_div_floor_state.reloc); const dst_mcv = try self.genCall( - .{ .lib = .{ + .{ .extern_func = .{ .return_type = dst_ty.toIntern(), .param_types = &.{ src_ty.toIntern(), src_ty.toIntern() }, - .callee = std.fmt.bufPrint(&callee_buf, "__div{c}i3", .{ + .sym = std.fmt.bufPrint(&sym_buf, "__div{c}i3", .{ intCompilerRtAbiName(@intCast(dst_ty.bitSize(zcu))), }) catch unreachable, } }, @@ -165004,7 +164904,7 @@ fn airMulDivBinOp(self: *CodeGen, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void const rhs_mcv = try self.resolveInst(bin_op.rhs); const mat_rhs_mcv = switch (rhs_mcv) { - .load_symbol => mat_rhs_mcv: { + .load_nav, .load_uav, .load_lazy_sym => mat_rhs_mcv: { // TODO clean this up! const addr_reg = try self.copyToTmpRegister(.usize, rhs_mcv.address()); break :mat_rhs_mcv MCValue{ .indirect = .{ .reg = addr_reg } }; @@ -165218,10 +165118,10 @@ fn airMulSat(self: *CodeGen, inst: Air.Inst.Index) !void { const ptr_c_int = try pt.singleMutPtrType(.c_int); const overflow = try self.allocTempRegOrMem(.c_int, false); - const dst_mcv = try self.genCall(.{ .lib = .{ + const dst_mcv = try self.genCall(.{ .extern_func = .{ .return_type = .i128_type, .param_types = &.{ .i128_type, .i128_type, ptr_c_int.toIntern() }, - .callee = "__muloti4", + .sym = "__muloti4", } }, &.{ .i128, .i128, ptr_c_int }, &.{ .{ .air_ref = bin_op.lhs }, .{ .air_ref = bin_op.rhs }, @@ -165236,7 +165136,7 @@ fn airMulSat(self: *CodeGen, inst: Air.Inst.Index) !void { const lhs_mcv = try self.resolveInst(bin_op.lhs); const mat_lhs_mcv = switch (lhs_mcv) { - .load_symbol => mat_lhs_mcv: { + .load_nav, .load_uav, .load_lazy_sym => mat_lhs_mcv: { // TODO clean this up! const addr_reg = try self.copyToTmpRegister(.usize, lhs_mcv.address()); break :mat_lhs_mcv MCValue{ .indirect = .{ .reg = addr_reg } }; @@ -165260,7 +165160,7 @@ fn airMulSat(self: *CodeGen, inst: Air.Inst.Index) !void { const rhs_mcv = try self.resolveInst(bin_op.rhs); const mat_rhs_mcv = switch (rhs_mcv) { - .load_symbol => mat_rhs_mcv: { + .load_nav, .load_uav, .load_lazy_sym => mat_rhs_mcv: { // TODO clean this up! const addr_reg = try self.copyToTmpRegister(.usize, rhs_mcv.address()); break :mat_rhs_mcv MCValue{ .indirect = .{ .reg = addr_reg } }; @@ -165734,10 +165634,10 @@ fn airMulWithOverflow(self: *CodeGen, inst: Air.Inst.Index) !void { .signed => { const ptr_c_int = try pt.singleMutPtrType(.c_int); const overflow = try self.allocTempRegOrMem(.c_int, false); - const result = try self.genCall(.{ .lib = .{ + const result = try self.genCall(.{ .extern_func = .{ .return_type = .i128_type, .param_types = &.{ .i128_type, .i128_type, ptr_c_int.toIntern() }, - .callee = "__muloti4", + .sym = "__muloti4", } }, &.{ .i128, .i128, ptr_c_int }, &.{ .{ .air_ref = bin_op.lhs }, .{ .air_ref = bin_op.rhs }, @@ -165791,7 +165691,7 @@ fn airMulWithOverflow(self: *CodeGen, inst: Air.Inst.Index) !void { break :mat_lhs_mcv mat_lhs_mcv; }, }, - .load_symbol => { + .load_nav, .load_uav, .load_lazy_sym => { // TODO clean this up! const addr_reg = try self.copyToTmpRegister(.usize, lhs_mcv.address()); break :mat_lhs_mcv MCValue{ .indirect = .{ .reg = addr_reg } }; @@ -165815,7 +165715,7 @@ fn airMulWithOverflow(self: *CodeGen, inst: Air.Inst.Index) !void { break :mat_rhs_mcv mat_rhs_mcv; }, }, - .load_symbol => { + .load_nav, .load_uav, .load_lazy_sym => { // TODO clean this up! const addr_reg = try self.copyToTmpRegister(.usize, rhs_mcv.address()); break :mat_rhs_mcv MCValue{ .indirect = .{ .reg = addr_reg } }; @@ -166291,7 +166191,7 @@ fn airShlShrBinOp(self: *CodeGen, inst: Air.Inst.Index) !void { defer self.register_manager.unlockReg(shift_lock); const mask_ty = try pt.vectorType(.{ .len = 16, .child = .u8_type }); - const mask_mcv = try self.genTypedValue(.fromInterned(try pt.intern(.{ .aggregate = .{ + const mask_mcv = try self.lowerValue(.fromInterned(try pt.intern(.{ .aggregate = .{ .ty = mask_ty.toIntern(), .storage = .{ .elems = &([1]InternPool.Index{ (try rhs_ty.childType(zcu).maxIntScalar(pt, .u8)).toIntern(), @@ -166432,7 +166332,7 @@ fn airShlSat(self: *CodeGen, inst: Air.Inst.Index) !void { // if lhs is negative, it is min switch (lhs_ty.intInfo(zcu).signedness) { .unsigned => { - const bound_mcv = try self.genTypedValue(try lhs_ty.maxIntScalar(self.pt, lhs_ty)); + const bound_mcv = try self.lowerValue(try lhs_ty.maxIntScalar(self.pt, lhs_ty)); try self.genCopy(lhs_ty, dst_mcv, bound_mcv, .{}); }, .signed => { @@ -166441,7 +166341,7 @@ fn airShlSat(self: *CodeGen, inst: Air.Inst.Index) !void { // we only need the highest bit so shifting the highest part of lhs_mcv // is enough to check the signedness. other parts can be skipped here. var lhs_temp2 = try self.tempInit(lhs_ty, lhs_mcv); - var zero_temp = try self.tempInit(lhs_ty, try self.genTypedValue(try self.pt.intValue(lhs_ty, 0))); + var zero_temp = try self.tempInit(lhs_ty, try self.lowerValue(try self.pt.intValue(lhs_ty, 0))); const sign_cc_temp = lhs_temp2.cmpInts(.lt, &zero_temp, self) catch |err| switch (err) { error.SelectFailed => unreachable, else => |e| return e, @@ -166452,13 +166352,13 @@ fn airShlSat(self: *CodeGen, inst: Air.Inst.Index) !void { try sign_cc_temp.die(self); // if it is negative - const min_mcv = try self.genTypedValue(try lhs_ty.minIntScalar(self.pt, lhs_ty)); + const min_mcv = try self.lowerValue(try lhs_ty.minIntScalar(self.pt, lhs_ty)); try self.genCopy(lhs_ty, dst_mcv, min_mcv, .{}); const sign_reloc_br = try self.asmJmpReloc(undefined); self.performReloc(sign_reloc_condbr); // if it is positive - const max_mcv = try self.genTypedValue(try lhs_ty.maxIntScalar(self.pt, lhs_ty)); + const max_mcv = try self.lowerValue(try lhs_ty.maxIntScalar(self.pt, lhs_ty)); try self.genCopy(lhs_ty, dst_mcv, max_mcv, .{}); self.performReloc(sign_reloc_br); }, @@ -167179,7 +167079,12 @@ fn airArrayElemVal(self: *CodeGen, inst: Air.Inst.Index) !void { }.to64(), ), }, - .memory, .load_symbol, .load_direct, .load_got => switch (index_mcv) { + .memory, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, + => switch (index_mcv) { .immediate => |index_imm| try self.asmMemoryImmediate( .{ ._, .bt }, .{ @@ -167241,11 +167146,15 @@ fn airArrayElemVal(self: *CodeGen, inst: Air.Inst.Index) !void { }, ), .memory, - .load_symbol, - .load_direct, - .load_got, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .load_extern_func, + .lea_extern_func, => try self.genSetReg(addr_reg, .usize, array_mcv.address(), .{}), - .lea_symbol, .lea_direct => unreachable, else => return self.fail("TODO airArrayElemVal_val for {s} of {}", .{ @tagName(array_mcv), array_ty.fmt(pt), }), @@ -168346,7 +168255,7 @@ fn floatSign(self: *CodeGen, inst: Air.Inst.Index, tag: Air.Inst.Tag, operand: A .child = (try pt.intType(.signed, scalar_bits)).ip_index, }); - const sign_mcv = try self.genTypedValue(switch (tag) { + const sign_mcv = try self.lowerValue(switch (tag) { .neg => try vec_ty.minInt(pt, vec_ty), .abs => try vec_ty.maxInt(pt, vec_ty), else => unreachable, @@ -168488,11 +168397,11 @@ fn genRoundLibcall(self: *CodeGen, ty: Type, src_mcv: MCValue, mode: bits.RoundM if (ty.zigTypeTag(zcu) != .float) return self.fail("TODO implement genRound for {}", .{ty.fmt(pt)}); - var callee_buf: ["__trunc?".len]u8 = undefined; - return try self.genCall(.{ .lib = .{ + var sym_buf: ["__trunc?".len]u8 = undefined; + return try self.genCall(.{ .extern_func = .{ .return_type = ty.toIntern(), .param_types = &.{ty.toIntern()}, - .callee = std.fmt.bufPrint(&callee_buf, "{s}{s}{s}", .{ + .sym = std.fmt.bufPrint(&sym_buf, "{s}{s}{s}", .{ floatLibcAbiPrefix(ty), switch (mode.direction) { .down => "floor", @@ -168765,11 +168674,11 @@ fn airSqrt(self: *CodeGen, inst: Air.Inst.Index) !void { 80, 128 => true, else => unreachable, }) { - var callee_buf: ["__sqrt?".len]u8 = undefined; - break :result try self.genCall(.{ .lib = .{ + var sym_buf: ["__sqrt?".len]u8 = undefined; + break :result try self.genCall(.{ .extern_func = .{ .return_type = ty.toIntern(), .param_types = &.{ty.toIntern()}, - .callee = std.fmt.bufPrint(&callee_buf, "{s}sqrt{s}", .{ + .sym = std.fmt.bufPrint(&sym_buf, "{s}sqrt{s}", .{ floatLibcAbiPrefix(ty), floatLibcAbiSuffix(ty), }) catch unreachable, @@ -168918,11 +168827,11 @@ fn airSqrt(self: *CodeGen, inst: Air.Inst.Index) !void { fn airUnaryMath(self: *CodeGen, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; const ty = self.typeOf(un_op); - var callee_buf: ["__round?".len]u8 = undefined; - const result = try self.genCall(.{ .lib = .{ + var sym_buf: ["__round?".len]u8 = undefined; + const result = try self.genCall(.{ .extern_func = .{ .return_type = ty.toIntern(), .param_types = &.{ty.toIntern()}, - .callee = std.fmt.bufPrint(&callee_buf, "{s}{s}{s}", .{ + .sym = std.fmt.bufPrint(&sym_buf, "{s}{s}{s}", .{ floatLibcAbiPrefix(ty), switch (tag) { .sin, @@ -169122,19 +169031,19 @@ fn load(self: *CodeGen, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerE .immediate, .register, .register_offset, - .lea_symbol, - .lea_pcrel, - .lea_direct, - .lea_got, .lea_frame, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, => try self.genCopy(dst_ty, dst_mcv, ptr_mcv.deref(), .{}), .memory, .indirect, - .load_symbol, - .load_pcrel, - .load_direct, - .load_got, .load_frame, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, => { const addr_reg = try self.copyToTmpRegister(ptr_ty, ptr_mcv); const addr_lock = self.register_manager.lockRegAssumeUnused(addr_reg); @@ -169342,19 +169251,19 @@ fn store( .immediate, .register, .register_offset, - .lea_symbol, - .lea_pcrel, - .lea_direct, - .lea_got, .lea_frame, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, => try self.genCopy(src_ty, ptr_mcv.deref(), src_mcv, opts), .memory, .indirect, - .load_symbol, - .load_pcrel, - .load_direct, - .load_got, .load_frame, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, => { const addr_reg = try self.copyToTmpRegister(ptr_ty, ptr_mcv); const addr_lock = self.register_manager.lockRegAssumeUnused(addr_reg); @@ -169820,18 +169729,18 @@ fn genUnOpMir(self: *CodeGen, mir_tag: Mir.Inst.FixedTag, dst_ty: Type, dst_mcv: .eflags, .register_overflow, .register_mask, - .lea_symbol, - .lea_pcrel, - .lea_direct, - .lea_got, .lea_frame, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, .elementwise_args, .reserved_frame, .air_ref, => unreachable, // unmodifiable destination .register => |dst_reg| try self.asmRegister(mir_tag, registerAlias(dst_reg, abi_size)), .register_pair, .register_triple, .register_quadruple => unreachable, // unimplemented - .memory, .load_symbol, .load_pcrel, .load_got, .load_direct => { + .memory, .load_nav, .load_uav, .load_lazy_sym, .load_extern_func => { const addr_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp); const addr_reg_lock = self.register_manager.lockRegAssumeUnused(addr_reg); defer self.register_manager.unlockReg(addr_reg_lock); @@ -170591,7 +170500,7 @@ fn genMulDivBinOp( defer for (reg_locks) |reg_lock| if (reg_lock) |lock| self.register_manager.unlockReg(lock); const mat_lhs_mcv = switch (lhs_mcv) { - .load_symbol => mat_lhs_mcv: { + .load_nav, .load_uav, .load_lazy_sym => mat_lhs_mcv: { // TODO clean this up! const addr_reg = try self.copyToTmpRegister(.usize, lhs_mcv.address()); break :mat_lhs_mcv MCValue{ .indirect = .{ .reg = addr_reg } }; @@ -170604,7 +170513,7 @@ fn genMulDivBinOp( }; defer if (mat_lhs_lock) |lock| self.register_manager.unlockReg(lock); const mat_rhs_mcv = switch (rhs_mcv) { - .load_symbol => mat_rhs_mcv: { + .load_nav, .load_uav, .load_lazy_sym => mat_rhs_mcv: { // TODO clean this up! const addr_reg = try self.copyToTmpRegister(.usize, rhs_mcv.address()); break :mat_rhs_mcv MCValue{ .indirect = .{ .reg = addr_reg } }; @@ -170772,7 +170681,7 @@ fn genMulDivBinOp( .is_const = true, }, }); - _ = try self.genCall(.{ .lib = .{ + _ = try self.genCall(.{ .extern_func = .{ .return_type = .void_type, .param_types = &.{ manyptr_u32_ty.toIntern(), @@ -170780,7 +170689,7 @@ fn genMulDivBinOp( manyptr_const_u32_ty.toIntern(), .usize_type, }, - .callee = switch (tag) { + .sym = switch (tag) { .div_trunc, .div_floor, .div_exact, @@ -171003,8 +170912,8 @@ fn genBinOp( .rem, .mod => {}, else => if (!type_needs_libcall) break :libcall, } - var callee_buf: ["__mod?f3".len]u8 = undefined; - const callee = switch (air_tag) { + var sym_buf: ["__mod?f3".len]u8 = undefined; + const sym = switch (air_tag) { .add, .sub, .mul, @@ -171012,11 +170921,11 @@ fn genBinOp( .div_trunc, .div_floor, .div_exact, - => std.fmt.bufPrint(&callee_buf, "__{s}{c}f3", .{ + => std.fmt.bufPrint(&sym_buf, "__{s}{c}f3", .{ @tagName(air_tag)[0..3], floatCompilerRtAbiName(float_bits), }), - .rem, .mod, .min, .max => std.fmt.bufPrint(&callee_buf, "{s}f{s}{s}", .{ + .rem, .mod, .min, .max => std.fmt.bufPrint(&sym_buf, "{s}f{s}{s}", .{ floatLibcAbiPrefix(lhs_ty), switch (air_tag) { .rem, .mod => "mod", @@ -171030,22 +170939,22 @@ fn genBinOp( @tagName(air_tag), lhs_ty.fmt(pt), }), } catch unreachable; - const result = try self.genCall(.{ .lib = .{ + const result = try self.genCall(.{ .extern_func = .{ .return_type = lhs_ty.toIntern(), .param_types = &.{ lhs_ty.toIntern(), rhs_ty.toIntern() }, - .callee = callee, + .sym = sym, } }, &.{ lhs_ty, rhs_ty }, &.{ .{ .air_ref = lhs_air }, .{ .air_ref = rhs_air } }, .{}); return switch (air_tag) { .mod => result: { const adjusted: MCValue = if (type_needs_libcall) adjusted: { - var add_callee_buf: ["__add?f3".len]u8 = undefined; - break :adjusted try self.genCall(.{ .lib = .{ + var add_sym_buf: ["__add?f3".len]u8 = undefined; + break :adjusted try self.genCall(.{ .extern_func = .{ .return_type = lhs_ty.toIntern(), .param_types = &.{ lhs_ty.toIntern(), rhs_ty.toIntern(), }, - .callee = std.fmt.bufPrint(&add_callee_buf, "__add{c}f3", .{ + .sym = std.fmt.bufPrint(&add_sym_buf, "__add{c}f3", .{ floatCompilerRtAbiName(float_bits), }) catch unreachable, } }, &.{ lhs_ty, rhs_ty }, &.{ result, .{ .air_ref = rhs_air } }, .{}); @@ -171144,10 +171053,10 @@ fn genBinOp( }), else => unreachable, }; - break :result try self.genCall(.{ .lib = .{ + break :result try self.genCall(.{ .extern_func = .{ .return_type = lhs_ty.toIntern(), .param_types = &.{ lhs_ty.toIntern(), rhs_ty.toIntern() }, - .callee = callee, + .sym = sym, } }, &.{ lhs_ty, rhs_ty }, &.{ adjusted, .{ .air_ref = rhs_air } }, .{}); }, .div_trunc, .div_floor => try self.genRoundLibcall(lhs_ty, result, .{ @@ -171430,13 +171339,15 @@ fn genBinOp( .immediate, .eflags, .register_offset, - .load_symbol, - .lea_symbol, - .load_direct, - .lea_direct, - .load_got, - .lea_got, .lea_frame, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .load_extern_func, + .lea_extern_func, => true, .memory => |addr| std.math.cast(i32, @as(i64, @bitCast(addr))) == null, else => false, @@ -171489,15 +171400,15 @@ fn genBinOp( .register_offset, .register_overflow, .register_mask, - .load_symbol, - .lea_symbol, - .load_pcrel, - .lea_pcrel, - .load_direct, - .lea_direct, - .load_got, - .lea_got, .lea_frame, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .load_extern_func, + .lea_extern_func, .elementwise_args, .reserved_frame, .air_ref, @@ -172595,7 +172506,7 @@ fn genBinOp( .cmp_neq, => { const unsigned_ty = try lhs_ty.toUnsigned(pt); - const not_mcv = try self.genTypedValue(try unsigned_ty.maxInt(pt, unsigned_ty)); + const not_mcv = try self.lowerValue(try unsigned_ty.maxInt(pt, unsigned_ty)); const not_mem: Memory = if (not_mcv.isBase()) try not_mcv.mem(self, .{ .size = .fromSize(abi_size) }) else @@ -172677,11 +172588,11 @@ fn genBinOpMir( .eflags, .register_overflow, .register_mask, - .lea_direct, - .lea_got, .lea_frame, - .lea_symbol, - .lea_pcrel, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, .elementwise_args, .reserved_frame, .air_ref, @@ -172771,16 +172682,16 @@ fn genBinOpMir( .register_offset, .memory, .indirect, - .load_symbol, - .lea_symbol, - .load_pcrel, - .lea_pcrel, - .load_direct, - .lea_direct, - .load_got, - .lea_got, .load_frame, .lea_frame, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .load_extern_func, + .lea_extern_func, => { direct: { try self.asmRegisterMemory(mir_limb_tag, dst_alias, switch (src_mcv) { @@ -172813,10 +172724,11 @@ fn genBinOpMir( switch (src_mcv) { .eflags, .register_offset, - .lea_symbol, - .lea_direct, - .lea_got, .lea_frame, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, => { assert(off == 0); const reg = try self.copyToTmpRegister(ty, src_mcv); @@ -172828,9 +172740,10 @@ fn genBinOpMir( ); }, .memory, - .load_symbol, - .load_direct, - .load_got, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, => { const ptr_ty = try pt.singleConstPtrType(ty); const addr_reg = try self.copyToTmpRegister(ptr_ty, src_mcv.address()); @@ -172850,13 +172763,20 @@ fn genBinOpMir( } } }, - .memory, .indirect, .load_symbol, .load_pcrel, .load_got, .load_direct, .load_frame => { + .memory, + .indirect, + .load_frame, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, + => { const OpInfo = ?struct { addr_reg: Register, addr_lock: RegisterLock }; const limb_abi_size: u32 = @min(abi_size, 8); const dst_info: OpInfo = switch (dst_mcv) { else => unreachable, - .memory, .load_symbol, .load_got, .load_direct => dst: { + .memory, .load_nav, .load_uav, .load_lazy_sym, .load_extern_func => dst: { const dst_addr_reg = (try self.register_manager.allocReg(null, abi.RegisterClass.gp)).to64(); const dst_addr_lock = self.register_manager.lockRegAssumeUnused(dst_addr_reg); @@ -172892,19 +172812,24 @@ fn genBinOpMir( .register_quadruple, .register_offset, .indirect, - .lea_direct, - .lea_got, .load_frame, .lea_frame, - .lea_symbol, - .lea_pcrel, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, => null, - .memory, .load_symbol, .load_pcrel, .load_got, .load_direct => src: { + .memory, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, + => src: { switch (resolved_src_mcv) { .memory => |addr| if (std.math.cast(i32, @as(i64, @bitCast(addr))) != null and std.math.cast(i32, @as(i64, @bitCast(addr)) + abi_size - limb_abi_size) != null) break :src null, - .load_symbol, .load_got, .load_direct => {}, + .load_nav, .load_uav, .load_lazy_sym, .load_extern_func => {}, else => unreachable, } @@ -172944,9 +172869,10 @@ fn genBinOpMir( }; const dst_limb_mem: Memory = switch (dst_mcv) { .memory, - .load_symbol, - .load_got, - .load_direct, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, => .{ .base = .{ .reg = dst_info.?.addr_reg }, .mod = .{ .rm = .{ @@ -173036,16 +172962,16 @@ fn genBinOpMir( .eflags, .memory, .indirect, - .load_symbol, - .lea_symbol, - .load_pcrel, - .lea_pcrel, - .load_direct, - .lea_direct, - .load_got, - .lea_got, .load_frame, .lea_frame, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .load_extern_func, + .lea_extern_func, => { const src_limb_mcv: MCValue = if (src_info) |info| .{ .indirect = .{ .reg = info.addr_reg, .off = off }, @@ -173055,10 +172981,11 @@ fn genBinOpMir( }, .eflags, .register_offset, - .lea_symbol, - .lea_direct, - .lea_got, .lea_frame, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, => switch (limb_i) { 0 => resolved_src_mcv, else => .{ .immediate = 0 }, @@ -173106,11 +173033,11 @@ fn genIntMulComplexOpMir(self: *CodeGen, dst_ty: Type, dst_mcv: MCValue, src_mcv .register_offset, .register_overflow, .register_mask, - .lea_symbol, - .lea_pcrel, - .lea_direct, - .lea_got, .lea_frame, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, .elementwise_args, .reserved_frame, .air_ref, @@ -173168,15 +173095,15 @@ fn genIntMulComplexOpMir(self: *CodeGen, dst_ty: Type, dst_mcv: MCValue, src_mcv }, .register_offset, .eflags, - .load_symbol, - .lea_symbol, - .load_pcrel, - .lea_pcrel, - .load_direct, - .lea_direct, - .load_got, - .lea_got, .lea_frame, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .load_extern_func, + .lea_extern_func, => { const src_reg = try self.copyToTmpRegister(dst_ty, resolved_src_mcv); switch (abi_size) { @@ -173231,7 +173158,14 @@ fn genIntMulComplexOpMir(self: *CodeGen, dst_ty: Type, dst_mcv: MCValue, src_mcv } }, .register_pair, .register_triple, .register_quadruple => unreachable, // unimplemented - .memory, .indirect, .load_symbol, .load_pcrel, .load_direct, .load_got, .load_frame => { + .memory, + .indirect, + .load_frame, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, + => { const tmp_reg = try self.copyToTmpRegister(dst_ty, dst_mcv); const tmp_mcv = MCValue{ .register = tmp_reg }; const tmp_lock = self.register_manager.lockRegAssumeUnused(tmp_reg); @@ -173382,15 +173316,6 @@ fn genLocalDebugInfo(cg: *CodeGen, air_tag: Air.Inst.Tag, ty: Type, mcv: MCValue }, .data = .{ .fa = frame_addr }, }), - .lea_symbol => |sym_off| try cg.addInst(.{ - .tag = .pseudo, - .ops = switch (air_tag) { - else => unreachable, - .arg, .dbg_arg_inline => .pseudo_dbg_arg_reloc, - .dbg_var_val => .pseudo_dbg_var_reloc, - }, - .data = .{ .reloc = sym_off }, - }), else => { const frame_index = try cg.allocFrameIndex(.initSpill(ty, cg.pt.zcu)); try cg.genSetMem(.{ .frame = frame_index }, 0, ty, mcv, .{}); @@ -173426,26 +173351,42 @@ fn genLocalDebugInfo(cg: *CodeGen, air_tag: Air.Inst.Tag, ty: Type, mcv: MCValue })), } }, }), - // debug info should explicitly ignore pcrel requirements - .lea_symbol, .lea_pcrel => |sym_off| try cg.addInst(.{ + .lea_nav => |nav| try cg.addInst(.{ .tag = .pseudo, .ops = .pseudo_dbg_var_m, .data = .{ .x = .{ .payload = try cg.addExtra(Mir.Memory.encode(.{ - .base = .{ .reloc = sym_off.sym_index }, - .mod = .{ .rm = .{ - .size = .qword, - .disp = sym_off.off, - } }, + .base = .{ .nav = nav }, + .mod = .{ .rm = .{ .size = .qword } }, })), } }, }), - .lea_direct, .lea_got => |sym_index| try cg.addInst(.{ + .lea_uav => |uav| try cg.addInst(.{ .tag = .pseudo, .ops = .pseudo_dbg_var_m, .data = .{ .x = .{ .payload = try cg.addExtra(Mir.Memory.encode(.{ - .base = .{ .reloc = sym_index }, + .base = .{ .uav = uav }, + .mod = .{ .rm = .{ .size = .qword } }, + })), + } }, + }), + .lea_lazy_sym => |lazy_sym| try cg.addInst(.{ + .tag = .pseudo, + .ops = .pseudo_dbg_var_m, + .data = .{ .x = .{ + .payload = try cg.addExtra(Mir.Memory.encode(.{ + .base = .{ .lazy_sym = lazy_sym }, + .mod = .{ .rm = .{ .size = .qword } }, + })), + } }, + }), + .lea_extern_func => |extern_func| try cg.addInst(.{ + .tag = .pseudo, + .ops = .pseudo_dbg_var_m, + .data = .{ .x = .{ + .payload = try cg.addExtra(Mir.Memory.encode(.{ + .base = .{ .extern_func = extern_func }, .mod = .{ .rm = .{ .size = .qword } }, })), } }, @@ -173502,11 +173443,10 @@ fn airCall(self: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif fn genCall(self: *CodeGen, info: union(enum) { air: Air.Inst.Ref, - lib: struct { + extern_func: struct { return_type: InternPool.Index, param_types: []const InternPool.Index, - lib: ?[]const u8 = null, - callee: []const u8, + sym: []const u8, }, }, arg_types: []const Type, args: []const MCValue, opts: CopyOptions) !MCValue { const pt = self.pt; @@ -173522,9 +173462,9 @@ fn genCall(self: *CodeGen, info: union(enum) { else => unreachable, }; }, - .lib => |lib| try pt.funcType(.{ - .param_types = lib.param_types, - .return_type = lib.return_type, + .extern_func => |extern_func| try pt.funcType(.{ + .param_types = extern_func.param_types, + .return_type = extern_func.return_type, .cc = self.target.cCallingConvention().?, }), }; @@ -173753,52 +173693,9 @@ fn genCall(self: *CodeGen, info: union(enum) { else => func_key, } else func_key, }) { - .func => |func| { - if (self.bin_file.cast(.elf)) |elf_file| { - const zo = elf_file.zigObjectPtr().?; - const sym_index = try zo.getOrCreateMetadataForNav(zcu, func.owner_nav); - try self.asmImmediate(.{ ._, .call }, .rel(.{ .sym_index = sym_index })); - } else if (self.bin_file.cast(.coff)) |coff_file| { - const atom = try coff_file.getOrCreateAtomForNav(func.owner_nav); - const sym_index = coff_file.getAtom(atom).getSymbolIndex().?; - const scratch_reg = abi.getCAbiLinkerScratchReg(fn_info.cc); - try self.genSetReg(scratch_reg, .usize, .{ .lea_got = sym_index }, .{}); - try self.asmRegister(.{ ._, .call }, scratch_reg); - } else if (self.bin_file.cast(.macho)) |macho_file| { - const zo = macho_file.getZigObject().?; - const sym_index = try zo.getOrCreateMetadataForNav(macho_file, func.owner_nav); - const sym = zo.symbols.items[sym_index]; - try self.asmImmediate(.{ ._, .call }, .rel(.{ .sym_index = sym.nlist_idx })); - } else if (self.bin_file.cast(.plan9)) |p9| { - const atom_index = try p9.seeNav(pt, func.owner_nav); - const atom = p9.getAtom(atom_index); - try self.asmMemory(.{ ._, .call }, .{ - .base = .{ .reg = .ds }, - .mod = .{ .rm = .{ - .size = .qword, - .disp = @intCast(atom.getOffsetTableAddress(p9)), - } }, - }); - } else unreachable; - }, - .@"extern" => |@"extern"| if (self.bin_file.cast(.elf)) |elf_file| { - const target_sym_index = try elf_file.getGlobalSymbol( - @"extern".name.toSlice(ip), - @"extern".lib_name.toSlice(ip), - ); - try self.asmImmediate(.{ ._, .call }, .rel(.{ .sym_index = target_sym_index })); - } else if (self.bin_file.cast(.macho)) |macho_file| { - const target_sym_index = try macho_file.getGlobalSymbol( - @"extern".name.toSlice(ip), - @"extern".lib_name.toSlice(ip), - ); - try self.asmImmediate(.{ ._, .call }, .rel(.{ .sym_index = target_sym_index })); - } else try self.genExternSymbolRef( - .call, - @"extern".lib_name.toSlice(ip), - @"extern".name.toSlice(ip), - ), - else => return self.fail("TODO implement calling bitcasted functions", .{}), + else => unreachable, + .func => |func| try self.asmImmediate(.{ ._, .call }, .{ .nav = .{ .index = func.owner_nav } }), + .@"extern" => |@"extern"| try self.asmImmediate(.{ ._, .call }, .{ .nav = .{ .index = @"extern".owner_nav } }), } } else { assert(self.typeOf(callee).zigTypeTag(zcu) == .pointer); @@ -173806,13 +173703,7 @@ fn genCall(self: *CodeGen, info: union(enum) { try self.genSetReg(scratch_reg, .usize, .{ .air_ref = callee }, .{}); try self.asmRegister(.{ ._, .call }, scratch_reg); }, - .lib => |lib| if (self.bin_file.cast(.elf)) |elf_file| { - const target_sym_index = try elf_file.getGlobalSymbol(lib.callee, lib.lib); - try self.asmImmediate(.{ ._, .call }, .rel(.{ .sym_index = target_sym_index })); - } else if (self.bin_file.cast(.macho)) |macho_file| { - const target_sym_index = try macho_file.getGlobalSymbol(lib.callee, lib.lib); - try self.asmImmediate(.{ ._, .call }, .rel(.{ .sym_index = target_sym_index })); - } else try self.genExternSymbolRef(.call, lib.lib, lib.callee), + .extern_func => |extern_func| try self.asmImmediate(.{ ._, .call }, .{ .extern_func = try self.addString(extern_func.sym) }), } return call_info.return_value.short; } @@ -173946,11 +173837,11 @@ fn airCmp(self: *CodeGen, inst: Air.Inst.Index, op: std.math.CompareOperator) !v 80, 128 => false, else => unreachable, }) { - var callee_buf: ["__???f2".len]u8 = undefined; - const ret = try self.genCall(.{ .lib = .{ + var sym_buf: ["__???f2".len]u8 = undefined; + const ret = try self.genCall(.{ .extern_func = .{ .return_type = .i32_type, .param_types = &.{ ty.toIntern(), ty.toIntern() }, - .callee = std.fmt.bufPrint(&callee_buf, "__{s}{c}f2", .{ + .sym = std.fmt.bufPrint(&sym_buf, "__{s}{c}f2", .{ switch (op) { .eq => "eq", .neq => "ne", @@ -174093,17 +173984,27 @@ fn airCmp(self: *CodeGen, inst: Air.Inst.Index, op: std.math.CompareOperator) !v .register_overflow, .register_mask, .indirect, - .lea_direct, - .lea_got, .lea_frame, - .lea_symbol, - .lea_pcrel, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, .elementwise_args, .reserved_frame, .air_ref, => unreachable, - .register, .register_pair, .register_triple, .register_quadruple, .load_frame => null, - .memory, .load_symbol, .load_pcrel, .load_got, .load_direct => dst: { + .register, + .register_pair, + .register_triple, + .register_quadruple, + .load_frame, + => null, + .memory, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, + => dst: { switch (resolved_dst_mcv) { .memory => |addr| if (std.math.cast( i32, @@ -174112,7 +174013,7 @@ fn airCmp(self: *CodeGen, inst: Air.Inst.Index, op: std.math.CompareOperator) !v i32, @as(i64, @bitCast(addr)) + abi_size - 8, ) != null) break :dst null, - .load_symbol, .load_pcrel, .load_got, .load_direct => {}, + .load_nav, .load_uav, .load_lazy_sym, .load_extern_func => {}, else => unreachable, } @@ -174149,17 +174050,26 @@ fn airCmp(self: *CodeGen, inst: Air.Inst.Index, op: std.math.CompareOperator) !v .register_overflow, .register_mask, .indirect, - .lea_symbol, - .lea_pcrel, - .lea_direct, - .lea_got, .lea_frame, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, .elementwise_args, .reserved_frame, .air_ref, => unreachable, - .register_pair, .register_triple, .register_quadruple, .load_frame => null, - .memory, .load_symbol, .load_pcrel, .load_got, .load_direct => src: { + .register_pair, + .register_triple, + .register_quadruple, + .load_frame, + => null, + .memory, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, + => src: { switch (resolved_src_mcv) { .memory => |addr| if (std.math.cast( i32, @@ -174168,7 +174078,7 @@ fn airCmp(self: *CodeGen, inst: Air.Inst.Index, op: std.math.CompareOperator) !v i32, @as(i64, @bitCast(addr)) + abi_size - 8, ) != null) break :src null, - .load_symbol, .load_pcrel, .load_got, .load_direct => {}, + .load_nav, .load_uav, .load_lazy_sym, .load_extern_func => {}, else => unreachable, } @@ -174453,14 +174363,19 @@ fn airDbgVar(cg: *CodeGen, inst: Air.Inst.Index) !void { if (cg.mod.strip) return; const air_tag = cg.air.instructions.items(.tag)[@intFromEnum(inst)]; const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; - - const name_nts: Air.NullTerminatedString = @enumFromInt(pl_op.payload); - assert(name_nts != .none); - const name = name_nts.toSlice(cg.air); - try cg.mir_local_name_bytes.appendSlice(cg.gpa, name[0 .. name.len + 1]); - + const air_name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); const ty = cg.typeOf(pl_op.operand); - try cg.mir_local_types.append(cg.gpa, ty.toIntern()); + + try cg.mir_locals.append(cg.gpa, .{ + .name = switch (air_name) { + .none => switch (air_tag) { + else => unreachable, + .dbg_arg_inline => .none, + }, + else => try cg.addString(air_name.toSlice(cg.air)), + }, + .type = ty.toIntern(), + }); try cg.genLocalDebugInfo(air_tag, ty, try cg.resolveInst(pl_op.operand)); return cg.finishAir(inst, .unreach, .{ pl_op.operand, .none, .none }); @@ -174567,10 +174482,10 @@ fn isNull(self: *CodeGen, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) .register_offset, .register_overflow, .register_mask, - .lea_direct, - .lea_got, - .lea_symbol, - .lea_pcrel, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, .elementwise_args, .reserved_frame, .air_ref, @@ -174618,10 +174533,10 @@ fn isNull(self: *CodeGen, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) }, .memory, - .load_symbol, - .load_pcrel, - .load_got, - .load_direct, + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, => { const addr_reg = (try self.register_manager.allocReg(null, abi.RegisterClass.gp)).to64(); const addr_reg_lock = self.register_manager.lockRegAssumeUnused(addr_reg); @@ -175655,7 +175570,7 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void { .memory => |addr| if (std.math.cast(i32, @as(i64, @bitCast(addr)))) |_| break :arg input_mcv, .indirect, .load_frame => break :arg input_mcv, - .load_symbol, .load_direct, .load_got => {}, + .load_nav, .load_uav, .load_lazy_sym, .load_extern_func => {}, else => { const temp_mcv = try self.allocTempRegOrMem(ty, false); try self.genCopy(ty, temp_mcv, input_mcv, .{}); @@ -175934,12 +175849,20 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void { } } else return self.fail("invalid modifier: '{s}'", .{modifier}), - .lea_got => |sym_index| if (std.mem.eql(u8, modifier, "P")) - .{ .reg = try self.copyToTmpRegister(.usize, .{ .lea_got = sym_index }) } + .lea_nav => |nav| if (std.mem.eql(u8, modifier, "P")) + .{ .reg = try self.copyToTmpRegister(.usize, .{ .lea_nav = nav }) } + else + return self.fail("invalid modifier: '{s}'", .{modifier}), + .lea_uav => |uav| if (std.mem.eql(u8, modifier, "P")) + .{ .reg = try self.copyToTmpRegister(.usize, .{ .lea_uav = uav }) } + else + return self.fail("invalid modifier: '{s}'", .{modifier}), + .lea_lazy_sym => |lazy_sym| if (std.mem.eql(u8, modifier, "P")) + .{ .reg = try self.copyToTmpRegister(.usize, .{ .lea_lazy_sym = lazy_sym }) } else return self.fail("invalid modifier: '{s}'", .{modifier}), - .lea_symbol => |sym_off| if (std.mem.eql(u8, modifier, "P")) - .{ .reg = try self.copyToTmpRegister(.usize, .{ .lea_symbol = sym_off }) } + .lea_extern_func => |extern_func| if (std.mem.eql(u8, modifier, "P")) + .{ .reg = try self.copyToTmpRegister(.usize, .{ .lea_extern_func = extern_func }) } else return self.fail("invalid modifier: '{s}'", .{modifier}), else => return self.fail("invalid constraint: '{s}'", .{op_str}), @@ -176623,11 +176546,11 @@ fn genCopy(self: *CodeGen, ty: Type, dst_mcv: MCValue, src_mcv: MCValue, opts: C .eflags, .register_overflow, .register_mask, - .lea_direct, - .lea_got, .lea_frame, - .lea_symbol, - .lea_pcrel, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, .elementwise_args, .reserved_frame, .air_ref, @@ -176722,7 +176645,7 @@ fn genCopy(self: *CodeGen, ty: Type, dst_mcv: MCValue, src_mcv: MCValue, opts: C } return; }, - .load_symbol, .load_pcrel, .load_direct, .load_got => { + .load_nav, .load_uav, .load_lazy_sym, .load_extern_func => { const src_addr_reg = (try self.register_manager.allocReg(null, abi.RegisterClass.gp)).to64(); const src_addr_lock = self.register_manager.lockRegAssumeUnused(src_addr_reg); @@ -176755,7 +176678,11 @@ fn genCopy(self: *CodeGen, ty: Type, dst_mcv: MCValue, src_mcv: MCValue, opts: C .undef => if (opts.safety and part_i > 0) .{ .register = dst_regs[0] } else .undef, dst_tag => |src_regs| .{ .register = src_regs[part_i] }, .memory, .indirect, .load_frame => src_mcv.address().offset(part_disp).deref(), - .load_symbol, .load_pcrel, .load_direct, .load_got => .{ .indirect = .{ + .load_nav, + .load_uav, + .load_lazy_sym, + .load_extern_func, + => .{ .indirect = .{ .reg = src_info.?.addr_reg, .off = part_disp, } }, @@ -176776,11 +176703,11 @@ fn genCopy(self: *CodeGen, ty: Type, dst_mcv: MCValue, src_mcv: MCValue, opts: C src_mcv, opts, ), - .memory, .load_symbol, .load_pcrel, .load_direct, .load_got => { + .memory => { switch (dst_mcv) { .memory => |addr| if (std.math.cast(i32, @as(i64, @bitCast(addr)))) |small_addr| return self.genSetMem(.{ .reg = .ds }, small_addr, ty, src_mcv, opts), - .load_symbol, .load_pcrel, .load_direct, .load_got => {}, + .load_nav, .load_uav, .load_lazy_sym, .load_extern_func => {}, else => unreachable, } @@ -176797,6 +176724,10 @@ fn genCopy(self: *CodeGen, ty: Type, dst_mcv: MCValue, src_mcv: MCValue, opts: C src_mcv, opts, ), + .load_nav => |nav| try self.genSetMem(.{ .nav = nav }, 0, ty, src_mcv, opts), + .load_uav => |uav| try self.genSetMem(.{ .uav = uav }, 0, ty, src_mcv, opts), + .load_lazy_sym => |lazy_sym| try self.genSetMem(.{ .lazy_sym = lazy_sym }, 0, ty, src_mcv, opts), + .load_extern_func => |extern_func| try self.genSetMem(.{ .extern_func = extern_func }, 0, ty, src_mcv, opts), } } @@ -176841,14 +176772,14 @@ fn genSetReg( .len = self.vectorSize(.float), .child = .u8_type, }); - try self.genSetReg(dst_reg, full_ty, try self.genTypedValue( + try self.genSetReg(dst_reg, full_ty, try self.lowerValue( .fromInterned(try pt.intern(.{ .aggregate = .{ .ty = full_ty.toIntern(), .storage = .{ .repeated_elem = (try pt.intValue(.u8, 0xaa)).toIntern() }, } })), ), opts); }, - .x87 => try self.genSetReg(dst_reg, .f80, try self.genTypedValue( + .x87 => try self.genSetReg(dst_reg, .f80, try self.lowerValue( try pt.floatValue(.f80, @as(f80, @bitCast(@as(u80, 0xaaaaaaaaaaaaaaaaaaaa)))), ), opts), .ip, .cr, .dr => unreachable, @@ -176878,12 +176809,24 @@ fn genSetReg( } }, .register => |src_reg| if (dst_reg.id() != src_reg.id()) switch (dst_reg.class()) { - .general_purpose, .gphi => switch (src_reg.class()) { - .general_purpose, .gphi => try self.asmRegisterRegister( + .general_purpose => switch (src_reg.class()) { + .general_purpose => try self.asmRegisterRegister( .{ ._, .mov }, dst_alias, registerAlias(src_reg, abi_size), ), + .gphi => if (dst_reg.isClass(.gphi)) try self.asmRegisterRegister( + .{ ._, .mov }, + dst_alias, + registerAlias(src_reg, abi_size), + ) else { + const src_lock = self.register_manager.lockReg(src_reg); + defer if (src_lock) |lock| self.register_manager.unlockReg(lock); + const tmp_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gphi); + + try self.asmRegisterRegister(.{ ._, .mov }, tmp_reg.to8(), src_reg); + try self.asmRegisterRegister(.{ ._, .mov }, dst_alias, tmp_reg.to8()); + }, .segment => try self.asmRegisterRegister( .{ ._, .mov }, dst_alias, @@ -176919,6 +176862,26 @@ fn genSetReg( }); }, }, + .gphi => switch (src_reg.class()) { + .general_purpose => if (src_reg.isClass(.gphi)) try self.asmRegisterRegister( + .{ ._, .mov }, + dst_alias, + registerAlias(src_reg, abi_size), + ) else { + const dst_lock = self.register_manager.lockReg(dst_reg); + defer if (dst_lock) |lock| self.register_manager.unlockReg(lock); + const tmp_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gphi); + + try self.asmRegisterRegister(.{ ._, .mov }, tmp_reg.to8(), src_reg.to8()); + try self.asmRegisterRegister(.{ ._, .mov }, dst_reg, tmp_reg.to8()); + }, + .gphi => try self.asmRegisterRegister( + .{ ._, .mov }, + dst_alias, + registerAlias(src_reg, abi_size), + ), + .segment, .x87, .mmx, .ip, .cr, .dr, .sse => unreachable, + }, .segment => try self.asmRegisterRegister( .{ ._, .mov }, dst_reg, @@ -177237,7 +177200,7 @@ fn genSetReg( if (src_reg_mask.info.inverted) try self.asmRegister(.{ ._, .not }, registerAlias(bits_reg, abi_size)); try self.genSetReg(dst_reg, ty, .{ .register = bits_reg }, .{}); }, - .memory, .load_symbol, .load_pcrel, .load_direct, .load_got => { + .memory, .load_nav, .load_uav, .load_lazy_sym, .load_extern_func => { switch (src_mcv) { .memory => |addr| if (std.math.cast(i32, @as(i64, @bitCast(addr)))) |small_addr| return (try self.moveStrategy( @@ -177251,52 +177214,50 @@ fn genSetReg( .disp = small_addr, } }, }), - .load_symbol => |sym_off| switch (dst_reg.class()) { + .load_nav => |nav| switch (dst_reg.class()) { .general_purpose, .gphi => { - assert(sym_off.off == 0); try self.asmRegisterMemory(.{ ._, .mov }, dst_alias, .{ - .base = .{ .reloc = sym_off.sym_index }, - .mod = .{ .rm = .{ - .size = self.memSize(ty), - .disp = sym_off.off, - } }, + .base = .{ .nav = nav }, + .mod = .{ .rm = .{ .size = self.memSize(ty) } }, }); return; }, .segment, .mmx, .ip, .cr, .dr => unreachable, .x87, .sse => {}, }, - .load_pcrel => |sym_off| switch (dst_reg.class()) { + .load_uav => |uav| switch (dst_reg.class()) { .general_purpose, .gphi => { - assert(sym_off.off == 0); try self.asmRegisterMemory(.{ ._, .mov }, dst_alias, .{ - .base = .{ .pcrel = sym_off.sym_index }, - .mod = .{ .rm = .{ - .size = self.memSize(ty), - .disp = sym_off.off, - } }, + .base = .{ .uav = uav }, + .mod = .{ .rm = .{ .size = self.memSize(ty) } }, }); return; }, .segment, .mmx, .ip, .cr, .dr => unreachable, .x87, .sse => {}, }, - .load_direct => |sym_index| switch (dst_reg.class()) { + .load_lazy_sym => |lazy_sym| switch (dst_reg.class()) { .general_purpose, .gphi => { - _ = try self.addInst(.{ - .tag = .mov, - .ops = .direct_reloc, - .data = .{ .rx = .{ - .r1 = dst_alias, - .payload = try self.addExtra(bits.SymbolOffset{ .sym_index = sym_index }), - } }, + try self.asmRegisterMemory(.{ ._, .mov }, dst_alias, .{ + .base = .{ .lazy_sym = lazy_sym }, + .mod = .{ .rm = .{ .size = self.memSize(ty) } }, + }); + return; + }, + .segment, .mmx, .ip, .cr, .dr => unreachable, + .x87, .sse => {}, + }, + .load_extern_func => |extern_func| switch (dst_reg.class()) { + .general_purpose, .gphi => { + try self.asmRegisterMemory(.{ ._, .mov }, dst_alias, .{ + .base = .{ .extern_func = extern_func }, + .mod = .{ .rm = .{ .size = self.memSize(ty) } }, }); return; }, .segment, .mmx, .ip, .cr, .dr => unreachable, .x87, .sse => {}, }, - .load_got => {}, else => unreachable, } @@ -177309,65 +177270,17 @@ fn genSetReg( .mod = .{ .rm = .{ .size = self.memSize(ty) } }, }); }, - .lea_symbol => |sym_off| switch (self.bin_file.tag) { - .elf, .macho => { - try self.asmRegisterMemory( - .{ ._, .lea }, - dst_reg.to64(), - .{ - .base = .{ .reloc = sym_off.sym_index }, - }, - ); - if (sym_off.off != 0) try self.asmRegisterMemory( - .{ ._, .lea }, - dst_reg.to64(), - .{ - .base = .{ .reg = dst_reg.to64() }, - .mod = .{ .rm = .{ .disp = sym_off.off } }, - }, - ); - }, - else => return self.fail("TODO emit symbol sequence on {s}", .{ - @tagName(self.bin_file.tag), - }), - }, - .lea_pcrel => |sym_off| switch (self.bin_file.tag) { - .elf, .macho => { - try self.asmRegisterMemory( - .{ ._, .lea }, - dst_reg.to64(), - .{ - .base = .{ .pcrel = sym_off.sym_index }, - }, - ); - if (sym_off.off != 0) try self.asmRegisterMemory( - .{ ._, .lea }, - dst_reg.to64(), - .{ - .base = .{ .reg = dst_reg.to64() }, - .mod = .{ .rm = .{ .disp = sym_off.off } }, - }, - ); - }, - else => return self.fail("TODO emit symbol sequence on {s}", .{ - @tagName(self.bin_file.tag), - }), - }, - .lea_direct, .lea_got => |sym_index| _ = try self.addInst(.{ - .tag = switch (src_mcv) { - .lea_direct => .lea, - .lea_got => .mov, - else => unreachable, - }, - .ops = switch (src_mcv) { - .lea_direct => .direct_reloc, - .lea_got => .got_reloc, - else => unreachable, - }, - .data = .{ .rx = .{ - .r1 = dst_reg.to64(), - .payload = try self.addExtra(bits.SymbolOffset{ .sym_index = sym_index }), - } }, + .lea_nav => |nav| try self.asmRegisterMemory(.{ ._, .lea }, dst_reg.to64(), .{ + .base = .{ .nav = nav }, + }), + .lea_uav => |uav| try self.asmRegisterMemory(.{ ._, .lea }, dst_reg.to64(), .{ + .base = .{ .uav = uav }, + }), + .lea_lazy_sym => |lazy_sym| try self.asmRegisterMemory(.{ ._, .lea }, dst_reg.to64(), .{ + .base = .{ .lazy_sym = lazy_sym }, + }), + .lea_extern_func => |lazy_sym| try self.asmRegisterMemory(.{ ._, .lea }, dst_reg.to64(), .{ + .base = .{ .extern_func = lazy_sym }, }), .air_ref => |src_ref| try self.genSetReg(dst_reg, ty, try self.resolveInst(src_ref), opts), } @@ -177388,9 +177301,10 @@ fn genSetMem( .none => .{ .immediate = @bitCast(@as(i64, disp)) }, .reg => |base_reg| .{ .register_offset = .{ .reg = base_reg, .off = disp } }, .frame => |base_frame_index| .{ .lea_frame = .{ .index = base_frame_index, .off = disp } }, - .table, .rip_inst => unreachable, - .reloc => |sym_index| .{ .lea_symbol = .{ .sym_index = sym_index, .off = disp } }, - .pcrel => |sym_index| .{ .lea_pcrel = .{ .sym_index = sym_index, .off = disp } }, + .table, .rip_inst, .lazy_sym => unreachable, + .nav => |nav| .{ .lea_nav = nav }, + .uav => |uav| .{ .lea_uav = uav }, + .extern_func => |extern_func| .{ .lea_extern_func = extern_func }, }; switch (src_mcv) { .none, @@ -177453,6 +177367,7 @@ fn genSetMem( .rm = .{ .size = .byte, .disp = disp }, } }), .register => |src_reg| { + const ip = &zcu.intern_pool; const mem_size = switch (base) { .frame => |base_fi| mem_size: { assert(disp >= 0); @@ -177506,8 +177421,9 @@ fn genSetMem( .index = frame_index, .off = disp, }).compare(.gte, src_align), - .table, .rip_inst => unreachable, - .reloc, .pcrel => false, + .table, .rip_inst, .lazy_sym, .extern_func => unreachable, + .nav => |nav| ip.getNav(nav).getAlignment().compare(.gte, src_align), + .uav => |uav| Type.fromInterned(uav.orig_ty).ptrAlignment(zcu).compare(.gte, src_align), })).write( self, .{ .base = base, .mod = .{ .rm = .{ @@ -177590,16 +177506,16 @@ fn genSetMem( }, .memory, .indirect, - .load_direct, - .lea_direct, - .load_got, - .lea_got, .load_frame, .lea_frame, - .load_symbol, - .lea_symbol, - .load_pcrel, - .lea_pcrel, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .load_extern_func, + .lea_extern_func, => switch (abi_size) { 0 => {}, 1, 2, 4, 8 => { @@ -177693,119 +177609,19 @@ fn genInlineMemset( try self.asmOpOnly(.{ .@"rep _sb", .sto }); } -fn genExternSymbolRef( - self: *CodeGen, - comptime tag: Mir.Inst.Tag, - lib: ?[]const u8, - callee: []const u8, -) InnerError!void { - if (self.bin_file.cast(.coff)) |coff_file| { - const global_index = try coff_file.getGlobalSymbol(callee, lib); - const scratch_reg = abi.getCAbiLinkerScratchReg(self.target.cCallingConvention().?); - _ = try self.addInst(.{ - .tag = .mov, - .ops = .import_reloc, - .data = .{ .rx = .{ - .r1 = scratch_reg, - .payload = try self.addExtra(bits.SymbolOffset{ - .sym_index = link.File.Coff.global_symbol_bit | global_index, - }), - } }, - }); - switch (tag) { - .mov => {}, - .call => try self.asmRegister(.{ ._, .call }, scratch_reg), - else => unreachable, - } - } else return self.fail("TODO implement calling extern functions", .{}); -} - fn genLazySymbolRef( self: *CodeGen, comptime tag: Mir.Inst.Tag, reg: Register, lazy_sym: link.File.LazySymbol, ) InnerError!void { - const pt = self.pt; - if (self.bin_file.cast(.elf)) |elf_file| { - const zo = elf_file.zigObjectPtr().?; - const sym_index = zo.getOrCreateMetadataForLazySymbol(elf_file, pt, lazy_sym) catch |err| - return self.fail("{s} creating lazy symbol", .{@errorName(err)}); - if (self.mod.pic) { - switch (tag) { - .lea, .call => try self.genSetReg(reg, .usize, .{ - .lea_symbol = .{ .sym_index = sym_index }, - }, .{}), - .mov => try self.genSetReg(reg, .usize, .{ - .load_symbol = .{ .sym_index = sym_index }, - }, .{}), - else => unreachable, - } - switch (tag) { - .lea, .mov => {}, - .call => try self.asmRegister(.{ ._, .call }, reg), - else => unreachable, - } - } else switch (tag) { - .lea, .mov => try self.asmRegisterMemory(.{ ._, tag }, reg.to64(), .{ - .base = .{ .reloc = sym_index }, - .mod = .{ .rm = .{ .size = .qword } }, - }), - .call => try self.asmImmediate(.{ ._, .call }, .rel(.{ .sym_index = sym_index })), - else => unreachable, - } - } else if (self.bin_file.cast(.plan9)) |p9_file| { - const atom_index = p9_file.getOrCreateAtomForLazySymbol(pt, lazy_sym) catch |err| - return self.fail("{s} creating lazy symbol", .{@errorName(err)}); - var atom = p9_file.getAtom(atom_index); - _ = atom.getOrCreateOffsetTableEntry(p9_file); - const got_addr = atom.getOffsetTableAddress(p9_file); - const got_mem: Memory = .{ - .base = .{ .reg = .ds }, - .mod = .{ .rm = .{ - .size = .qword, - .disp = @intCast(got_addr), - } }, - }; - switch (tag) { - .lea, .mov => try self.asmRegisterMemory(.{ ._, .mov }, reg.to64(), got_mem), - .call => try self.asmMemory(.{ ._, .call }, got_mem), - else => unreachable, - } - switch (tag) { - .lea, .call => {}, - .mov => try self.asmRegisterMemory( - .{ ._, tag }, - reg.to64(), - .initSib(.qword, .{ .base = .{ .reg = reg.to64() } }), - ), - else => unreachable, - } - } else if (self.bin_file.cast(.coff)) |coff_file| { - const atom_index = coff_file.getOrCreateAtomForLazySymbol(pt, lazy_sym) catch |err| - return self.fail("{s} creating lazy symbol", .{@errorName(err)}); - const sym_index = coff_file.getAtom(atom_index).getSymbolIndex().?; - switch (tag) { - .lea, .call => try self.genSetReg(reg, .usize, .{ .lea_got = sym_index }, .{}), - .mov => try self.genSetReg(reg, .usize, .{ .load_got = sym_index }, .{}), - else => unreachable, - } - switch (tag) { - .lea, .mov => {}, - .call => try self.asmRegister(.{ ._, .call }, reg), - else => unreachable, - } - } else if (self.bin_file.cast(.macho)) |macho_file| { - const zo = macho_file.getZigObject().?; - const sym_index = zo.getOrCreateMetadataForLazySymbol(macho_file, pt, lazy_sym) catch |err| - return self.fail("{s} creating lazy symbol", .{@errorName(err)}); - const sym = zo.symbols.items[sym_index]; + if (self.mod.pic) { switch (tag) { .lea, .call => try self.genSetReg(reg, .usize, .{ - .lea_symbol = .{ .sym_index = sym.nlist_idx }, + .lea_lazy_sym = lazy_sym, }, .{}), .mov => try self.genSetReg(reg, .usize, .{ - .load_symbol = .{ .sym_index = sym.nlist_idx }, + .lea_lazy_sym = lazy_sym, }, .{}), else => unreachable, } @@ -177814,8 +177630,13 @@ fn genLazySymbolRef( .call => try self.asmRegister(.{ ._, .call }, reg), else => unreachable, } - } else { - return self.fail("TODO implement genLazySymbol for x86_64 {s}", .{@tagName(self.bin_file.tag)}); + } else switch (tag) { + .lea, .mov => try self.asmRegisterMemory(.{ ._, tag }, reg.to64(), .{ + .base = .{ .lazy_sym = lazy_sym }, + .mod = .{ .rm = .{ .size = .qword } }, + }), + .call => try self.asmImmediate(.{ ._, .call }, .{ .lazy_sym = lazy_sym }), + else => unreachable, } } @@ -177968,11 +177789,11 @@ fn airFloatFromInt(self: *CodeGen, inst: Air.Inst.Index) !void { src_ty.fmt(pt), dst_ty.fmt(pt), }); - var callee_buf: ["__floatun?i?f".len]u8 = undefined; - break :result try self.genCall(.{ .lib = .{ + var sym_buf: ["__floatun?i?f".len]u8 = undefined; + break :result try self.genCall(.{ .extern_func = .{ .return_type = dst_ty.toIntern(), .param_types = &.{src_ty.toIntern()}, - .callee = std.fmt.bufPrint(&callee_buf, "__float{s}{c}i{c}f", .{ + .sym = std.fmt.bufPrint(&sym_buf, "__float{s}{c}i{c}f", .{ switch (src_signedness) { .signed => "", .unsigned => "un", @@ -178048,11 +177869,11 @@ fn airIntFromFloat(self: *CodeGen, inst: Air.Inst.Index) !void { src_ty.fmt(pt), dst_ty.fmt(pt), }); - var callee_buf: ["__fixuns?f?i".len]u8 = undefined; - break :result try self.genCall(.{ .lib = .{ + var sym_buf: ["__fixuns?f?i".len]u8 = undefined; + break :result try self.genCall(.{ .extern_func = .{ .return_type = dst_ty.toIntern(), .param_types = &.{src_ty.toIntern()}, - .callee = std.fmt.bufPrint(&callee_buf, "__fix{s}{c}f{c}i", .{ + .sym = std.fmt.bufPrint(&sym_buf, "__fix{s}{c}f{c}i", .{ switch (dst_signedness) { .signed => "", .unsigned => "uns", @@ -178153,9 +177974,9 @@ fn airCmpxchg(self: *CodeGen, inst: Air.Inst.Index) !void { .off => return self.fail("TODO airCmpxchg with {s}", .{@tagName(ptr_mcv)}), } const ptr_lock = switch (ptr_mem.base) { - .none, .frame, .reloc, .pcrel => null, + .none, .frame, .nav, .uav => null, .reg => |reg| self.register_manager.lockReg(reg), - .table, .rip_inst => unreachable, + .table, .rip_inst, .lazy_sym, .extern_func => unreachable, }; defer if (ptr_lock) |lock| self.register_manager.unlockReg(lock); @@ -178236,9 +178057,9 @@ fn atomicOp( .off => return self.fail("TODO airCmpxchg with {s}", .{@tagName(ptr_mcv)}), } const mem_lock = switch (ptr_mem.base) { - .none, .frame, .reloc, .pcrel => null, + .none, .frame, .nav, .uav => null, .reg => |reg| self.register_manager.lockReg(reg), - .table, .rip_inst => unreachable, + .table, .rip_inst, .lazy_sym, .extern_func => unreachable, }; defer if (mem_lock) |lock| self.register_manager.unlockReg(lock); @@ -179627,7 +179448,7 @@ fn airSelect(self: *CodeGen, inst: Air.Inst.Index) !void { var mask_elems_buf: [32]u8 = undefined; const mask_elems = mask_elems_buf[0..mask_len]; for (mask_elems, 0..) |*elem, bit| elem.* = @intCast(bit / elem_bits); - const mask_mcv = try self.genTypedValue(.fromInterned(try pt.intern(.{ .aggregate = .{ + const mask_mcv = try self.lowerValue(.fromInterned(try pt.intern(.{ .aggregate = .{ .ty = mask_ty.toIntern(), .storage = .{ .bytes = try zcu.intern_pool.getOrPutString(zcu.gpa, pt.tid, mask_elems, .maybe_embedded_nulls) }, } }))); @@ -179655,7 +179476,7 @@ fn airSelect(self: *CodeGen, inst: Air.Inst.Index) !void { mask_elem_ty, @as(u8, 1) << @truncate(bit), )).toIntern(); - const mask_mcv = try self.genTypedValue(.fromInterned(try pt.intern(.{ .aggregate = .{ + const mask_mcv = try self.lowerValue(.fromInterned(try pt.intern(.{ .aggregate = .{ .ty = mask_ty.toIntern(), .storage = .{ .elems = mask_elems }, } }))); @@ -180386,7 +180207,7 @@ fn airShuffle(self: *CodeGen, inst: Air.Inst.Index) !void { else try select_mask_elem_ty.minIntScalar(pt, select_mask_elem_ty)).toIntern(); } - const select_mask_mcv = try self.genTypedValue(.fromInterned(try pt.intern(.{ .aggregate = .{ + const select_mask_mcv = try self.lowerValue(.fromInterned(try pt.intern(.{ .aggregate = .{ .ty = select_mask_ty.toIntern(), .storage = .{ .elems = select_mask_elems[0..mask_elems.len] }, } }))); @@ -180531,7 +180352,7 @@ fn airShuffle(self: *CodeGen, inst: Air.Inst.Index) !void { })).toIntern(); } const lhs_mask_ty = try pt.vectorType(.{ .len = max_abi_size, .child = .u8_type }); - const lhs_mask_mcv = try self.genTypedValue(.fromInterned(try pt.intern(.{ .aggregate = .{ + const lhs_mask_mcv = try self.lowerValue(.fromInterned(try pt.intern(.{ .aggregate = .{ .ty = lhs_mask_ty.toIntern(), .storage = .{ .elems = lhs_mask_elems[0..max_abi_size] }, } }))); @@ -180562,7 +180383,7 @@ fn airShuffle(self: *CodeGen, inst: Air.Inst.Index) !void { })).toIntern(); } const rhs_mask_ty = try pt.vectorType(.{ .len = max_abi_size, .child = .u8_type }); - const rhs_mask_mcv = try self.genTypedValue(.fromInterned(try pt.intern(.{ .aggregate = .{ + const rhs_mask_mcv = try self.lowerValue(.fromInterned(try pt.intern(.{ .aggregate = .{ .ty = rhs_mask_ty.toIntern(), .storage = .{ .elems = rhs_mask_elems[0..max_abi_size] }, } }))); @@ -180896,7 +180717,7 @@ fn airAggregateInit(self: *CodeGen, inst: Air.Inst.Index) !void { .{ .frame = frame_index }, @intCast(elem_size * elements.len), elem_ty, - try self.genTypedValue(sentinel), + try self.lowerValue(sentinel), .{}, ); break :result .{ .load_frame = .{ .index = frame_index } }; @@ -180980,11 +180801,11 @@ fn airMulAdd(self: *CodeGen, inst: Air.Inst.Index) !void { ty.fmt(pt), }); - var callee_buf: ["__fma?".len]u8 = undefined; - break :result try self.genCall(.{ .lib = .{ + var sym_buf: ["__fma?".len]u8 = undefined; + break :result try self.genCall(.{ .extern_func = .{ .return_type = ty.toIntern(), .param_types = &.{ ty.toIntern(), ty.toIntern(), ty.toIntern() }, - .callee = std.fmt.bufPrint(&callee_buf, "{s}fma{s}", .{ + .sym = std.fmt.bufPrint(&sym_buf, "{s}fma{s}", .{ floatLibcAbiPrefix(ty), floatLibcAbiSuffix(ty), }) catch unreachable, @@ -181384,7 +181205,7 @@ fn resolveInst(self: *CodeGen, ref: Air.Inst.Ref) InnerError!MCValue { const mcv: MCValue = if (ref.toIndex()) |inst| mcv: { break :mcv self.inst_tracking.getPtr(inst).?.short; } else mcv: { - break :mcv try self.genTypedValue(.fromInterned(ref.toInterned().?)); + break :mcv try self.lowerValue(.fromInterned(ref.toInterned().?)); }; switch (mcv) { @@ -181422,31 +181243,17 @@ fn limitImmediateType(self: *CodeGen, operand: Air.Inst.Ref, comptime T: type) ! return mcv; } -fn genResult(self: *CodeGen, res: codegen.GenResult) InnerError!MCValue { - return switch (res) { - .mcv => |mcv| switch (mcv) { - .none => .none, - .undef => .undef, - .immediate => |imm| .{ .immediate = imm }, - .memory => |addr| .{ .memory = addr }, - .load_symbol => |sym_index| .{ .load_symbol = .{ .sym_index = sym_index } }, - .lea_symbol => |sym_index| .{ .lea_symbol = .{ .sym_index = sym_index } }, - .load_direct => |sym_index| .{ .load_direct = sym_index }, - .lea_direct => |sym_index| .{ .lea_direct = sym_index }, - .load_got => |sym_index| .{ .lea_got = sym_index }, - }, - .fail => |msg| return self.failMsg(msg), +fn lowerValue(cg: *CodeGen, val: Value) Allocator.Error!MCValue { + return switch (try codegen.lowerValue(cg.pt, val, cg.target)) { + .none => .none, + .undef => .undef, + .immediate => |imm| .{ .immediate = imm }, + .lea_nav => |nav| .{ .lea_nav = nav }, + .lea_uav => |uav| .{ .lea_uav = uav }, + .load_uav => |uav| .{ .load_uav = uav }, }; } -fn genTypedValue(self: *CodeGen, val: Value) InnerError!MCValue { - return self.genResult(try codegen.genTypedValue(self.bin_file, self.pt, self.src_loc, val, self.target.*)); -} - -fn lowerUav(self: *CodeGen, val: Value, alignment: InternPool.Alignment) InnerError!MCValue { - return self.genResult(try self.bin_file.lowerUav(self.pt, val.toIntern(), alignment, self.src_loc)); -} - const CallMCValues = struct { args: []MCValue, air_arg_count: u32, @@ -182311,16 +182118,16 @@ const Temp = struct { .register_offset, .register_mask, .memory, - .load_symbol, - .lea_symbol, - .load_pcrel, - .lea_pcrel, .indirect, - .load_direct, - .lea_direct, - .load_got, - .lea_got, .lea_frame, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .lea_extern_func, + .load_extern_func, .elementwise_args, .reserved_frame, .air_ref, @@ -182363,15 +182170,11 @@ const Temp = struct { .mod = .{ .rm = .{ .disp = reg_off.off + off } }, }); }, - .load_symbol, .load_frame => { + .load_frame, .load_nav, .lea_nav, .load_uav, .lea_uav, .load_lazy_sym, .lea_lazy_sym => { const new_reg = try cg.register_manager.allocReg(new_temp_index.toIndex(), abi.RegisterClass.gp); new_temp_index.tracking(cg).* = .init(.{ .register_offset = .{ .reg = new_reg, .off = off } }); try cg.genSetReg(new_reg, .usize, mcv, .{}); }, - .lea_symbol => |sym_off| new_temp_index.tracking(cg).* = .init(.{ .lea_symbol = .{ - .sym_index = sym_off.sym_index, - .off = sym_off.off + off, - } }), .lea_frame => |frame_addr| new_temp_index.tracking(cg).* = .init(.{ .lea_frame = .{ .index = frame_addr.index, .off = frame_addr.off + off, @@ -182404,14 +182207,6 @@ const Temp = struct { } }); return; }, - .lea_symbol => |sym_off| { - assert(std.meta.eql(temp_tracking.long.lea_symbol, sym_off)); - temp_tracking.* = .init(.{ .lea_symbol = .{ - .sym_index = sym_off.sym_index, - .off = sym_off.off + off, - } }); - return; - }, .lea_frame => |frame_addr| { assert(std.meta.eql(temp_tracking.long.lea_frame, frame_addr)); temp_tracking.* = .init(.{ .lea_frame = .{ @@ -182460,53 +182255,85 @@ const Temp = struct { .mod = .{ .rm = .{ .disp = reg_off.off + @as(u31, limb_index) * 8 } }, }); }, - .load_symbol => |sym_off| { + .load_frame => |frame_addr| { const new_reg = try cg.register_manager.allocReg(new_temp_index.toIndex(), abi.RegisterClass.gp); new_temp_index.tracking(cg).* = .init(.{ .register = new_reg }); try cg.asmRegisterMemory(.{ ._, .mov }, new_reg.to64(), .{ - .base = .{ .reloc = sym_off.sym_index }, + .base = .{ .frame = frame_addr.index }, .mod = .{ .rm = .{ .size = .qword, - .disp = sym_off.off + @as(u31, limb_index) * 8, + .disp = frame_addr.off + @as(u31, limb_index) * 8, } }, }); }, - .lea_symbol => |sym_off| { + .lea_frame => |frame_addr| { assert(limb_index == 0); - new_temp_index.tracking(cg).* = .init(.{ .lea_symbol = sym_off }); + new_temp_index.tracking(cg).* = .init(.{ .lea_frame = frame_addr }); }, - .load_pcrel => |sym_off| { + .load_nav => |nav| { const new_reg = try cg.register_manager.allocReg(new_temp_index.toIndex(), abi.RegisterClass.gp); new_temp_index.tracking(cg).* = .init(.{ .register = new_reg }); try cg.asmRegisterMemory(.{ ._, .mov }, new_reg.to64(), .{ - .base = .{ .pcrel = sym_off.sym_index }, + .base = .{ .nav = nav }, .mod = .{ .rm = .{ .size = .qword, - .disp = sym_off.off + @as(u31, limb_index) * 8, + .disp = @as(u31, limb_index) * 8, } }, }); }, - .lea_pcrel => |sym_off| { + .lea_nav => |nav| { assert(limb_index == 0); - new_temp_index.tracking(cg).* = .init(.{ .lea_pcrel = sym_off }); + new_temp_index.tracking(cg).* = .init(.{ .lea_nav = nav }); }, - .load_frame => |frame_addr| { + .load_uav => |uav| { const new_reg = try cg.register_manager.allocReg(new_temp_index.toIndex(), abi.RegisterClass.gp); new_temp_index.tracking(cg).* = .init(.{ .register = new_reg }); try cg.asmRegisterMemory(.{ ._, .mov }, new_reg.to64(), .{ - .base = .{ .frame = frame_addr.index }, + .base = .{ .uav = uav }, .mod = .{ .rm = .{ .size = .qword, - .disp = frame_addr.off + @as(u31, limb_index) * 8, + .disp = @as(u31, limb_index) * 8, } }, }); }, - .lea_frame => |frame_addr| { + .lea_uav => |uav| { assert(limb_index == 0); - new_temp_index.tracking(cg).* = .init(.{ .lea_frame = frame_addr }); + new_temp_index.tracking(cg).* = .init(.{ .lea_uav = uav }); + }, + .load_lazy_sym => |lazy_sym| { + const new_reg = + try cg.register_manager.allocReg(new_temp_index.toIndex(), abi.RegisterClass.gp); + new_temp_index.tracking(cg).* = .init(.{ .register = new_reg }); + try cg.asmRegisterMemory(.{ ._, .mov }, new_reg.to64(), .{ + .base = .{ .lazy_sym = lazy_sym }, + .mod = .{ .rm = .{ + .size = .qword, + .disp = @as(u31, limb_index) * 8, + } }, + }); + }, + .lea_lazy_sym => |lazy_sym| { + assert(limb_index == 0); + new_temp_index.tracking(cg).* = .init(.{ .lea_lazy_sym = lazy_sym }); + }, + .load_extern_func => |extern_func| { + const new_reg = + try cg.register_manager.allocReg(new_temp_index.toIndex(), abi.RegisterClass.gp); + new_temp_index.tracking(cg).* = .init(.{ .register = new_reg }); + try cg.asmRegisterMemory(.{ ._, .mov }, new_reg.to64(), .{ + .base = .{ .extern_func = extern_func }, + .mod = .{ .rm = .{ + .size = .qword, + .disp = @as(u31, limb_index) * 8, + } }, + }); + }, + .lea_extern_func => |extern_func| { + assert(limb_index == 0); + new_temp_index.tracking(cg).* = .init(.{ .lea_extern_func = extern_func }); }, } cg.next_temp_index = @enumFromInt(@intFromEnum(new_temp_index) + 1); @@ -182563,7 +182390,7 @@ const Temp = struct { const temp_tracking = temp_index.tracking(cg); switch (temp_tracking.short) { else => {}, - .register, .lea_symbol, .lea_frame => { + .register, .lea_frame, .lea_nav, .lea_uav, .lea_lazy_sym => { assert(limb_index == 0); cg.temp_type[@intFromEnum(temp_index)] = limb_ty; return; @@ -182580,15 +182407,6 @@ const Temp = struct { cg.temp_type[@intFromEnum(temp_index)] = limb_ty; return; }, - .load_symbol => |sym_off| { - assert(std.meta.eql(temp_tracking.long.load_symbol, sym_off)); - temp_tracking.* = .init(.{ .load_symbol = .{ - .sym_index = sym_off.sym_index, - .off = sym_off.off + @as(u31, limb_index) * 8, - } }); - cg.temp_type[@intFromEnum(temp_index)] = limb_ty; - return; - }, .load_frame => |frame_addr| if (!frame_addr.index.isNamed()) { assert(std.meta.eql(temp_tracking.long.load_frame, frame_addr)); temp_tracking.* = .init(.{ .load_frame = .{ @@ -182779,27 +182597,20 @@ const Temp = struct { .immediate, .register, .register_offset, - .lea_direct, - .lea_got, .lea_frame, => return false, .memory, .indirect, - .load_symbol, - .load_pcrel, - .load_direct, - .load_got, .load_frame, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .load_extern_func, + .lea_extern_func, => return temp.toRegClass(true, .general_purpose, cg), - .lea_symbol, .lea_pcrel => |sym_off| { - const off = sym_off.off; - // hack around linker relocation bugs - if (false and off == 0) return false; - try temp.toOffset(-off, cg); - while (try temp.toRegClass(true, .general_purpose, cg)) {} - try temp.toOffset(off, cg); - return true; - }, } } @@ -182866,7 +182677,7 @@ const Temp = struct { ), cg), else => unreachable, }, - .memory, .indirect, .load_frame, .load_symbol => { + .memory, .indirect, .load_frame, .load_nav, .load_uav, .load_lazy_sym => { var val_ptr = try cg.tempInit(.usize, val_mcv.address()); var len = try cg.tempInit(.usize, .{ .immediate = val_ty.abiSize(cg.pt.zcu) }); try val_ptr.memcpy(ptr, &len, cg); @@ -182904,7 +182715,11 @@ const Temp = struct { // hack around linker relocation bugs switch (ptr.tracking(cg).short) { else => {}, - .lea_symbol => while (try ptr.toRegClass(false, .general_purpose, cg)) {}, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, + => while (try ptr.toRegClass(false, .general_purpose, cg)) {}, } try cg.asmMemoryImmediate( .{ ._, .mov }, @@ -182918,7 +182733,11 @@ const Temp = struct { // hack around linker relocation bugs switch (ptr.tracking(cg).short) { else => {}, - .lea_symbol => while (try ptr.toRegClass(false, .general_purpose, cg)) {}, + .lea_nav, + .lea_uav, + .lea_lazy_sym, + .lea_extern_func, + => while (try ptr.toRegClass(false, .general_purpose, cg)) {}, } try cg.asmSetccMemory( cc, @@ -182962,8 +182781,8 @@ const Temp = struct { try ptr.tracking(cg).short.deref().mem(cg, .{ .size = .byte }), ); }, - .lea_frame, .lea_symbol => continue :val_to_gpr, - .memory, .indirect, .load_frame, .load_symbol => { + .lea_frame, .lea_nav, .lea_uav, .lea_lazy_sym => continue :val_to_gpr, + .memory, .indirect, .load_frame, .load_nav, .load_uav, .load_lazy_sym => { var val_ptr = try cg.tempInit(.usize, val_mcv.address()); var len = try cg.tempInit(.usize, .{ .immediate = val_ty.abiSize(cg.pt.zcu) }); try ptr.memcpy(&val_ptr, &len, cg); @@ -183003,7 +182822,7 @@ const Temp = struct { ), cg), else => unreachable, }, - .memory, .indirect, .load_frame, .load_symbol => { + .memory, .indirect, .load_frame, .load_nav, .load_uav, .load_lazy_sym => { var val_ptr = try cg.tempInit(.usize, val_mcv.address()); var src_ptr = try cg.tempInit(.usize, src.tracking(cg).short.address().offset(opts.disp)); @@ -183097,8 +182916,8 @@ const Temp = struct { }), ); }, - .lea_frame, .lea_symbol => continue :val_to_gpr, - .memory, .indirect, .load_frame, .load_symbol => { + .lea_frame, .lea_nav, .lea_uav, .lea_lazy_sym => continue :val_to_gpr, + .memory, .indirect, .load_frame, .load_nav, .load_uav, .load_lazy_sym => { var dst_ptr = try cg.tempInit(.usize, dst.tracking(cg).short.address().offset(opts.disp)); var val_ptr = try cg.tempInit(.usize, val_mcv.address()); @@ -183119,7 +182938,7 @@ const Temp = struct { // hack around linker relocation bugs switch (ptr.tracking(cg).short) { else => {}, - .lea_symbol => |sym_off| if (dst_rc != .general_purpose or sym_off.off != 0) + .lea_nav, .lea_uav, .lea_lazy_sym => if (dst_rc != .general_purpose) while (try ptr.toRegClass(false, .general_purpose, cg)) {}, } try strat.read(cg, dst_reg, try ptr.tracking(cg).short.deref().mem(cg, .{ @@ -183139,7 +182958,7 @@ const Temp = struct { // hack around linker relocation bugs switch (ptr.tracking(cg).short) { else => {}, - .lea_symbol => while (try ptr.toRegClass(false, .general_purpose, cg)) {}, + .lea_nav, .lea_uav, .lea_lazy_sym => while (try ptr.toRegClass(false, .general_purpose, cg)) {}, } const strat = try cg.moveStrategy(src_ty, src_rc, false); try strat.write(cg, try ptr.tracking(cg).short.deref().mem(cg, .{ @@ -186902,7 +186721,7 @@ const Temp = struct { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divti3" } }, .unused, .unused, .unused, @@ -186931,7 +186750,7 @@ const Temp = struct { }, .call_frame = .{ .alignment = .@"16" }, .extra_temps = .{ - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__udivti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__udivti3" } }, .unused, .unused, .unused, @@ -186964,7 +186783,7 @@ const Temp = struct { .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divei4" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divei4" } }, .unused, .unused, .unused, @@ -186997,7 +186816,7 @@ const Temp = struct { .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__udivei4" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__udivei4" } }, .unused, .unused, .unused, @@ -187361,7 +187180,7 @@ const Temp = struct { .{ .type = .i64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .u64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .i64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divti3" } }, .{ .type = .u64, .kind = .{ .ret_gpr = .{ .cc = .ccc, .at = 0 } } }, .unused, .unused, @@ -187399,7 +187218,7 @@ const Temp = struct { .{ .type = .u64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .u64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .u64, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__udivti3" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__udivti3" } }, .{ .type = .u64, .kind = .{ .ret_gpr = .{ .cc = .ccc, .at = 0 } } }, .unused, .unused, @@ -187437,7 +187256,7 @@ const Temp = struct { .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__divei4" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__divei4" } }, .unused, .unused, .unused, @@ -187473,7 +187292,7 @@ const Temp = struct { .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 1 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 2 } } }, .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .at = 3 } } }, - .{ .type = .usize, .kind = .{ .symbol = &.{ .name = "__udivei4" } } }, + .{ .type = .usize, .kind = .{ .extern_func = "__udivei4" } }, .unused, .unused, .unused, @@ -187528,16 +187347,16 @@ const Temp = struct { .register_overflow, .register_mask, .memory, - .load_symbol, - .lea_symbol, - .load_pcrel, - .lea_pcrel, .indirect, - .load_direct, - .lea_direct, - .load_got, - .lea_got, .load_frame, + .load_nav, + .lea_nav, + .load_uav, + .lea_uav, + .load_lazy_sym, + .lea_lazy_sym, + .load_extern_func, + .lea_extern_func, => { const result = try cg.allocRegOrMem(inst, true); try cg.genCopy(cg.typeOfIndex(inst), result, temp_mcv, .{}); @@ -187714,7 +187533,7 @@ fn tempInit(cg: *CodeGen, ty: Type, value: MCValue) InnerError!Temp { } fn tempFromValue(cg: *CodeGen, value: Value) InnerError!Temp { - return cg.tempInit(value.typeOf(cg.pt.zcu), try cg.genTypedValue(value)); + return cg.tempInit(value.typeOf(cg.pt.zcu), try cg.lowerValue(value)); } fn tempMemFromValue(cg: *CodeGen, value: Value) InnerError!Temp { @@ -187722,13 +187541,20 @@ fn tempMemFromValue(cg: *CodeGen, value: Value) InnerError!Temp { } fn tempMemFromAlignedValue(cg: *CodeGen, alignment: InternPool.Alignment, value: Value) InnerError!Temp { - return cg.tempInit(value.typeOf(cg.pt.zcu), try cg.lowerUav(value, alignment)); + const ty = value.typeOf(cg.pt.zcu); + return cg.tempInit(ty, .{ .load_uav = .{ + .val = value.toIntern(), + .orig_ty = (try cg.pt.ptrType(.{ + .child = ty.toIntern(), + .flags = .{ + .is_const = true, + .alignment = alignment, + }, + })).toIntern(), + } }); } fn tempFromOperand(cg: *CodeGen, op_ref: Air.Inst.Ref, op_dies: bool) InnerError!Temp { - const zcu = cg.pt.zcu; - const ip = &zcu.intern_pool; - if (op_dies) { const temp_index = cg.next_temp_index; const temp: Temp = .{ .index = temp_index.toIndex() }; @@ -187742,8 +187568,7 @@ fn tempFromOperand(cg: *CodeGen, op_ref: Air.Inst.Ref, op_dies: bool) InnerError } if (op_ref.toIndex()) |op_inst| return .{ .index = op_inst }; - const val = op_ref.toInterned().?; - return cg.tempInit(.fromInterned(ip.typeOf(val)), try cg.genTypedValue(.fromInterned(val))); + return cg.tempFromValue(.fromInterned(op_ref.toInterned().?)); } fn tempsFromOperandsInner( @@ -188578,8 +188403,8 @@ const Select = struct { splat_int_mem: struct { ref: Select.Operand.Ref, inside: enum { umin, smin, smax } = .umin, outside: enum { smin, smax } }, splat_float_mem: struct { ref: Select.Operand.Ref, inside: enum { zero } = .zero, outside: f16 }, frame: FrameIndex, - lazy_symbol: struct { kind: link.File.LazySymbol.Kind, ref: Select.Operand.Ref = .none }, - symbol: *const struct { lib: ?[]const u8 = null, name: []const u8 }, + lazy_sym: struct { kind: link.File.LazySymbol.Kind, ref: Select.Operand.Ref = .none }, + extern_func: [*:0]const u8, const ConstSpec = struct { ref: Select.Operand.Ref = .none, @@ -189010,43 +188835,21 @@ const Select = struct { } }))), true }; }, .frame => |frame_index| .{ try cg.tempInit(spec.type, .{ .load_frame = .{ .index = frame_index } }), true }, - .lazy_symbol => |lazy_symbol_spec| { + .lazy_sym => |lazy_symbol_spec| { const ip = &pt.zcu.intern_pool; const ty = if (lazy_symbol_spec.ref == .none) spec.type else lazy_symbol_spec.ref.typeOf(s); - const lazy_symbol: link.File.LazySymbol = .{ + return .{ try cg.tempInit(.usize, .{ .lea_lazy_sym = .{ .kind = lazy_symbol_spec.kind, .ty = switch (ip.indexToKey(ty.toIntern())) { .inferred_error_set_type => |func_index| switch (ip.funcIesResolvedUnordered(func_index)) { - .none => unreachable, // unresolved inferred error set + .none => unreachable, else => |ty_index| ty_index, }, else => ty.toIntern(), }, - }; - return .{ try cg.tempInit(.usize, .{ .lea_symbol = .{ - .sym_index = if (cg.bin_file.cast(.elf)) |elf_file| - elf_file.zigObjectPtr().?.getOrCreateMetadataForLazySymbol(elf_file, pt, lazy_symbol) catch |err| - return cg.fail("{s} creating lazy symbol", .{@errorName(err)}) - else if (cg.bin_file.cast(.macho)) |macho_file| - macho_file.getZigObject().?.getOrCreateMetadataForLazySymbol(macho_file, pt, lazy_symbol) catch |err| - return cg.fail("{s} creating lazy symbol", .{@errorName(err)}) - else if (cg.bin_file.cast(.coff)) |coff_file| - coff_file.getAtom(coff_file.getOrCreateAtomForLazySymbol(pt, lazy_symbol) catch |err| - return cg.fail("{s} creating lazy symbol", .{@errorName(err)})).getSymbolIndex().? - else - return cg.fail("external symbols unimplemented for {s}", .{@tagName(cg.bin_file.tag)}), } }), true }; }, - .symbol => |symbol_spec| .{ try cg.tempInit(spec.type, .{ .lea_symbol = .{ - .sym_index = if (cg.bin_file.cast(.elf)) |elf_file| - try elf_file.getGlobalSymbol(symbol_spec.name, symbol_spec.lib) - else if (cg.bin_file.cast(.macho)) |macho_file| - try macho_file.getGlobalSymbol(symbol_spec.name, symbol_spec.lib) - else if (cg.bin_file.cast(.coff)) |coff_file| - link.File.Coff.global_symbol_bit | try coff_file.getGlobalSymbol(symbol_spec.name, symbol_spec.lib) - else - return cg.fail("external symbols unimplemented for {s}", .{@tagName(cg.bin_file.tag)}), - } }), true }, + .extern_func => |extern_func_spec| .{ try cg.tempInit(spec.type, .{ .lea_extern_func = try cg.addString(std.mem.span(extern_func_spec)) }), true }, }; } @@ -190089,9 +189892,12 @@ const Select = struct { .register => |reg| .{ .reg = s.lowerReg(reg.toSize(op.flags.base.size, s.cg.target)) }, .register_pair, .register_triple, .register_quadruple, .register_offset, .register_overflow => unreachable, .register_mask => |reg_mask| .{ .reg = s.lowerReg(reg_mask.reg.toSize(op.flags.base.size, s.cg.target)) }, + .lea_nav => |nav| .{ .imm = .{ .nav = .{ .index = nav } } }, + .lea_uav => |uav| .{ .imm = .{ .uav = uav } }, + .lea_lazy_sym => |lazy_sym| .{ .imm = .{ .lazy_sym = lazy_sym } }, + .lea_extern_func => |extern_func| .{ .imm = .{ .extern_func = extern_func } }, else => |mcv| .{ .mem = try mcv.mem(s.cg, .{ .size = op.flags.base.size }) }, - .lea_symbol => |sym_off| .{ .imm = .rel(sym_off) }, - .load_direct, .lea_direct, .load_got, .lea_got, .lea_frame, .elementwise_args, .reserved_frame, .air_ref => unreachable, + .lea_frame, .elementwise_args, .reserved_frame, .air_ref => unreachable, }, 1...2 => |imm| switch (op.flags.base.ref.valueOf(s)) { inline .register_pair, .register_triple, .register_quadruple => |regs| .{ @@ -190105,37 +189911,20 @@ const Select = struct { }, .simm => .{ .imm = .s(op.adjustedImm(i32, s)) }, .uimm => .{ .imm = .u(@bitCast(op.adjustedImm(i64, s))) }, - .lea => .{ .mem = .{ - .base = switch (op.flags.base.ref.valueOf(s)) { + .lea => .{ .mem = try op.flags.base.ref.valueOf(s).deref().mem(s.cg, .{ + .size = op.flags.base.size, + .index = switch (op.flags.index.ref.valueOf(s)) { else => unreachable, .none => .none, - .register => |base_reg| .{ .reg = base_reg.toSize(.ptr, s.cg.target) }, - .register_offset => |base_reg_off| .{ .reg = base_reg_off.reg.toSize(.ptr, s.cg.target) }, - .lea_symbol => |base_sym_off| .{ .reloc = base_sym_off.sym_index }, - .lea_pcrel => |base_sym_off| .{ .pcrel = base_sym_off.sym_index }, + .register => |index_reg| index_reg.toSize(.ptr, s.cg.target), }, - .mod = .{ .rm = .{ - .size = op.flags.base.size, - .index = switch (op.flags.index.ref.valueOf(s)) { - else => unreachable, - .none => .none, - .register => |index_reg| index_reg.toSize(.ptr, s.cg.target), - .register_offset => |index_reg_off| index_reg_off.reg.toSize(.ptr, s.cg.target), - }, - .scale = op.flags.index.scale, - .disp = op.adjustedImm(i32, s) + switch (op.flags.base.ref.valueOf(s)) { - else => unreachable, - .none, .register => 0, - .register_offset => |base_reg_off| base_reg_off.off, - .lea_symbol => |base_sym_off| base_sym_off.off, - } + switch (op.flags.index.ref.valueOf(s)) { - else => unreachable, - .none, .register => 0, - .register_offset => |base_reg_off| base_reg_off.off, - .lea_symbol => |base_sym_off| base_sym_off.off, - }, - } }, - } }, + .scale = op.flags.index.scale, + .disp = op.adjustedImm(i32, s) + switch (op.flags.index.ref.valueOf(s)) { + else => unreachable, + .none, .register, .lea_nav, .lea_uav, .lea_lazy_sym, .lea_extern_func => 0, + .register_offset => |base_reg_off| base_reg_off.off, + }, + }) }, .mem => .{ .mem = try op.flags.base.ref.valueOf(s).mem(s.cg, .{ .size = op.flags.base.size, .index = switch (op.flags.index.ref.valueOf(s)) { diff --git a/src/arch/x86_64/Emit.zig b/src/arch/x86_64/Emit.zig index cbbfdab202..ff6bf85ef3 100644 --- a/src/arch/x86_64/Emit.zig +++ b/src/arch/x86_64/Emit.zig @@ -1,6 +1,9 @@ //! This file contains the functionality for emitting x86_64 MIR as machine code lower: Lower, +bin_file: *link.File, +pt: Zcu.PerThread, +pic: bool, atom_index: u32, debug_output: link.File.DebugInfoOutput, code: *std.ArrayListUnmanaged(u8), @@ -9,28 +12,28 @@ prev_di_loc: Loc, /// Relative to the beginning of `code`. prev_di_pc: usize, +code_offset_mapping: std.ArrayListUnmanaged(u32), +relocs: std.ArrayListUnmanaged(Reloc), +table_relocs: std.ArrayListUnmanaged(TableReloc), + pub const Error = Lower.Error || error{ EmitFail, } || link.File.UpdateDebugInfoError; pub fn emitMir(emit: *Emit) Error!void { - const gpa = emit.lower.bin_file.comp.gpa; - const code_offset_mapping = try emit.lower.allocator.alloc(u32, emit.lower.mir.instructions.len); - defer emit.lower.allocator.free(code_offset_mapping); - var relocs: std.ArrayListUnmanaged(Reloc) = .empty; - defer relocs.deinit(emit.lower.allocator); - var table_relocs: std.ArrayListUnmanaged(TableReloc) = .empty; - defer table_relocs.deinit(emit.lower.allocator); - var local_name_index: usize = 0; + const gpa = emit.bin_file.comp.gpa; + try emit.code_offset_mapping.resize(gpa, emit.lower.mir.instructions.len); + emit.relocs.clearRetainingCapacity(); + emit.table_relocs.clearRetainingCapacity(); var local_index: usize = 0; for (0..emit.lower.mir.instructions.len) |mir_i| { const mir_index: Mir.Inst.Index = @intCast(mir_i); - code_offset_mapping[mir_index] = @intCast(emit.code.items.len); + emit.code_offset_mapping.items[mir_index] = @intCast(emit.code.items.len); const lowered = try emit.lower.lowerMir(mir_index); var lowered_relocs = lowered.relocs; - for (lowered.insts, 0..) |lowered_inst, lowered_index| { - const start_offset: u32 = @intCast(emit.code.items.len); + lowered_inst: for (lowered.insts, 0..) |lowered_inst, lowered_index| { if (lowered_inst.prefix == .directive) { + const start_offset: u32 = @intCast(emit.code.items.len); switch (emit.debug_output) { .dwarf => |dwarf| switch (lowered_inst.encoding.mnemonic) { .@".cfi_def_cfa" => try dwarf.genDebugFrame(start_offset, .{ .def_cfa = .{ @@ -83,204 +86,305 @@ pub fn emitMir(emit: *Emit) Error!void { } continue; } - try lowered_inst.encode(emit.code.writer(gpa), .{}); - const end_offset: u32 = @intCast(emit.code.items.len); + var reloc_info_buf: [2]RelocInfo = undefined; + var reloc_info_index: usize = 0; while (lowered_relocs.len > 0 and lowered_relocs[0].lowered_inst_index == lowered_index) : ({ lowered_relocs = lowered_relocs[1..]; - }) switch (lowered_relocs[0].target) { - .inst => |target| { - const inst_length: u4 = @intCast(end_offset - start_offset); - const reloc_offset, const reloc_length = reloc_offset_length: { - var reloc_offset = inst_length; - var op_index: usize = lowered_inst.ops.len; - while (true) { - op_index -= 1; - const op = lowered_inst.encoding.data.ops[op_index]; - if (op == .none) continue; - const is_mem = op.isMemory(); - const enc_length: u4 = if (is_mem) switch (lowered_inst.ops[op_index].mem.sib.base) { - .rip_inst => 4, - else => unreachable, - } else @intCast(std.math.divCeil(u7, @intCast(op.immBitSize()), 8) catch unreachable); - reloc_offset -= enc_length; - if (op_index == lowered_relocs[0].op_index) break :reloc_offset_length .{ reloc_offset, enc_length }; - std.debug.assert(!is_mem); - } - }; - try relocs.append(emit.lower.allocator, .{ - .inst_offset = start_offset, - .inst_length = inst_length, - .source_offset = reloc_offset, - .source_length = reloc_length, - .target = target, - .target_offset = lowered_relocs[0].off, - }); - }, - .table => try table_relocs.append(emit.lower.allocator, .{ - .source_offset = end_offset - 4, - .target_offset = lowered_relocs[0].off, - }), - .linker_extern_fn => |sym_index| if (emit.lower.bin_file.cast(.elf)) |elf_file| { - // Add relocation to the decl. - const zo = elf_file.zigObjectPtr().?; - const atom_ptr = zo.symbol(emit.atom_index).atom(elf_file).?; - const r_type = @intFromEnum(std.elf.R_X86_64.PLT32); - try atom_ptr.addReloc(gpa, .{ - .r_offset = end_offset - 4, - .r_info = @as(u64, sym_index) << 32 | r_type, - .r_addend = lowered_relocs[0].off - 4, - }, zo); - } else if (emit.lower.bin_file.cast(.macho)) |macho_file| { - // Add relocation to the decl. - const zo = macho_file.getZigObject().?; - const atom = zo.symbols.items[emit.atom_index].getAtom(macho_file).?; - try atom.addReloc(macho_file, .{ - .tag = .@"extern", - .offset = end_offset - 4, - .target = sym_index, - .addend = lowered_relocs[0].off, - .type = .branch, - .meta = .{ - .pcrel = true, - .has_subtractor = false, - .length = 2, - .symbolnum = @intCast(sym_index), + reloc_info_index += 1; + }) reloc_info_buf[reloc_info_index] = .{ + .op_index = lowered_relocs[0].op_index, + .off = lowered_relocs[0].off, + .target = target: switch (lowered_relocs[0].target) { + .inst => |inst| .{ .index = inst, .is_extern = false, .type = .inst }, + .table => .{ .index = undefined, .is_extern = false, .type = .table }, + .nav => |nav| { + const ip = &emit.pt.zcu.intern_pool; + const sym_index = switch (try codegen.genNavRef( + emit.bin_file, + emit.pt, + emit.lower.src_loc, + .fromInterned(ip.getNav(nav).typeOf(ip)), + nav, + emit.lower.target.*, + )) { + .mcv => |mcv| switch (mcv) { + else => std.debug.panic("{s}: {}\n", .{ @src().fn_name, mcv }), + .lea_symbol => |sym_index| sym_index, + }, + .fail => |em| { + assert(emit.lower.err_msg == null); + emit.lower.err_msg = em; + return error.EmitFail; + }, + }; + break :target switch (ip.getNav(nav).status) { + .unresolved => unreachable, + .type_resolved => |type_resolved| .{ + .index = sym_index, + .is_extern = false, + .type = if (type_resolved.is_threadlocal) .tlv else .symbol, + }, + .fully_resolved => |fully_resolved| switch (ip.indexToKey(fully_resolved.val)) { + .@"extern" => |@"extern"| .{ + .index = sym_index, + .is_extern = switch (@"extern".visibility) { + .default => true, + .hidden, .protected => false, + }, + .type = if (@"extern".is_threadlocal) .tlv else .symbol, + .force_pcrel_direct = switch (@"extern".relocation) { + .any => false, + .pcrel => true, + }, + }, + .variable => |variable| .{ + .index = sym_index, + .is_extern = false, + .type = if (variable.is_threadlocal) .tlv else .symbol, + }, + else => .{ .index = sym_index, .is_extern = false, .type = .symbol }, + }, + }; + }, + .uav => |uav| .{ + .index = switch (try emit.bin_file.lowerUav( + emit.pt, + uav.val, + Type.fromInterned(uav.orig_ty).ptrAlignment(emit.pt.zcu), + emit.lower.src_loc, + )) { + .mcv => |mcv| switch (mcv) { + else => std.debug.panic("{s}: {}\n", .{ @src().fn_name, mcv }), + .load_direct, .load_symbol => |sym_index| sym_index, + }, + .fail => |em| { + assert(emit.lower.err_msg == null); + emit.lower.err_msg = em; + return error.EmitFail; + }, }, - }); - } else if (emit.lower.bin_file.cast(.coff)) |coff_file| { - // Add relocation to the decl. - const atom_index = coff_file.getAtomIndexForSymbol( - .{ .sym_index = emit.atom_index, .file = null }, - ).?; - const target = if (link.File.Coff.global_symbol_bit & sym_index != 0) - coff_file.getGlobalByIndex(link.File.Coff.global_symbol_mask & sym_index) - else - link.File.Coff.SymbolWithLoc{ .sym_index = sym_index, .file = null }; - try coff_file.addRelocation(atom_index, .{ - .type = .direct, - .target = target, - .offset = end_offset - 4, - .addend = @intCast(lowered_relocs[0].off), - .pcrel = true, - .length = 2, - }); - } else return emit.fail("TODO implement extern reloc for {s}", .{ - @tagName(emit.lower.bin_file.tag), - }), - .linker_tlsld => |sym_index| { - const elf_file = emit.lower.bin_file.cast(.elf).?; - const zo = elf_file.zigObjectPtr().?; - const atom = zo.symbol(emit.atom_index).atom(elf_file).?; - const r_type = @intFromEnum(std.elf.R_X86_64.TLSLD); - try atom.addReloc(gpa, .{ - .r_offset = end_offset - 4, - .r_info = @as(u64, sym_index) << 32 | r_type, - .r_addend = lowered_relocs[0].off - 4, - }, zo); - }, - .linker_dtpoff => |sym_index| { - const elf_file = emit.lower.bin_file.cast(.elf).?; - const zo = elf_file.zigObjectPtr().?; - const atom = zo.symbol(emit.atom_index).atom(elf_file).?; - const r_type = @intFromEnum(std.elf.R_X86_64.DTPOFF32); - try atom.addReloc(gpa, .{ - .r_offset = end_offset - 4, - .r_info = @as(u64, sym_index) << 32 | r_type, - .r_addend = lowered_relocs[0].off, - }, zo); - }, - .linker_reloc, .linker_pcrel => |sym_index| if (emit.lower.bin_file.cast(.elf)) |elf_file| { - const zo = elf_file.zigObjectPtr().?; - const atom = zo.symbol(emit.atom_index).atom(elf_file).?; - const sym = zo.symbol(sym_index); - if (emit.lower.pic) { - const r_type: u32 = if (sym.flags.is_extern_ptr and lowered_relocs[0].target != .linker_pcrel) - @intFromEnum(std.elf.R_X86_64.GOTPCREL) + .is_extern = false, + .type = .symbol, + }, + .lazy_sym => |lazy_sym| .{ + .index = if (emit.bin_file.cast(.elf)) |elf_file| + elf_file.zigObjectPtr().?.getOrCreateMetadataForLazySymbol(elf_file, emit.pt, lazy_sym) catch |err| + return emit.fail("{s} creating lazy symbol", .{@errorName(err)}) + else if (emit.bin_file.cast(.macho)) |macho_file| + macho_file.getZigObject().?.getOrCreateMetadataForLazySymbol(macho_file, emit.pt, lazy_sym) catch |err| + return emit.fail("{s} creating lazy symbol", .{@errorName(err)}) + else if (emit.bin_file.cast(.coff)) |coff_file| sym_index: { + const atom = coff_file.getOrCreateAtomForLazySymbol(emit.pt, lazy_sym) catch |err| + return emit.fail("{s} creating lazy symbol", .{@errorName(err)}); + break :sym_index coff_file.getAtom(atom).getSymbolIndex().?; + } else if (emit.bin_file.cast(.plan9)) |p9_file| + p9_file.getOrCreateAtomForLazySymbol(emit.pt, lazy_sym) catch |err| + return emit.fail("{s} creating lazy symbol", .{@errorName(err)}) else - @intFromEnum(std.elf.R_X86_64.PC32); - try atom.addReloc(gpa, .{ - .r_offset = end_offset - 4, - .r_info = @as(u64, sym_index) << 32 | r_type, - .r_addend = lowered_relocs[0].off - 4, - }, zo); - } else { - const r_type: u32 = if (sym.flags.is_tls) - @intFromEnum(std.elf.R_X86_64.TPOFF32) + return emit.fail("lazy symbols unimplemented for {s}", .{@tagName(emit.bin_file.tag)}), + .is_extern = false, + .type = .symbol, + }, + .extern_func => |extern_func| .{ + .index = if (emit.bin_file.cast(.elf)) |elf_file| + try elf_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null) + else if (emit.bin_file.cast(.macho)) |macho_file| + try macho_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null) + else if (emit.bin_file.cast(.coff)) |coff_file| + link.File.Coff.global_symbol_bit | try coff_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null) else - @intFromEnum(std.elf.R_X86_64.@"32"); - try atom.addReloc(gpa, .{ - .r_offset = end_offset - 4, - .r_info = @as(u64, sym_index) << 32 | r_type, - .r_addend = lowered_relocs[0].off, - }, zo); - } - } else if (emit.lower.bin_file.cast(.macho)) |macho_file| { - const zo = macho_file.getZigObject().?; - const atom = zo.symbols.items[emit.atom_index].getAtom(macho_file).?; - const sym = &zo.symbols.items[sym_index]; - const @"type": link.File.MachO.Relocation.Type = if (sym.flags.is_extern_ptr and lowered_relocs[0].target != .linker_pcrel) - .got_load - else if (sym.flags.tlv) - .tlv - else - .signed; - try atom.addReloc(macho_file, .{ - .tag = .@"extern", - .offset = @intCast(end_offset - 4), - .target = sym_index, - .addend = lowered_relocs[0].off, - .type = @"type", - .meta = .{ - .pcrel = true, - .has_subtractor = false, - .length = 2, - .symbolnum = @intCast(sym_index), + return emit.fail("external symbols unimplemented for {s}", .{@tagName(emit.bin_file.tag)}), + .is_extern = true, + .type = .symbol, + }, + }, + }; + const reloc_info = reloc_info_buf[0..reloc_info_index]; + for (reloc_info) |*reloc| switch (reloc.target.type) { + .inst, .table => {}, + .symbol => { + switch (lowered_inst.encoding.mnemonic) { + .call => { + reloc.target.type = .branch; + try emit.encodeInst(lowered_inst, reloc_info); + continue :lowered_inst; }, + else => {}, + } + if (emit.bin_file.cast(.elf)) |_| { + if (!emit.pic) switch (lowered_inst.encoding.mnemonic) { + .lea => try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .imm = .s(0) }, + }, emit.lower.target), reloc_info), + .mov => try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initSib(lowered_inst.ops[reloc.op_index].mem.sib.ptr_size, .{ + .base = .{ .reg = .ds }, + }) }, + }, emit.lower.target), reloc_info), + else => unreachable, + } else if (reloc.target.is_extern) switch (lowered_inst.encoding.mnemonic) { + .lea => try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initRip(.ptr, 0) }, + }, emit.lower.target), reloc_info), + .mov => { + try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initRip(.ptr, 0) }, + }, emit.lower.target), reloc_info); + try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initSib(lowered_inst.ops[reloc.op_index].mem.sib.ptr_size, .{ .base = .{ + .reg = lowered_inst.ops[0].reg.to64(), + } }) }, + }, emit.lower.target), &.{}); + }, + else => unreachable, + } else switch (lowered_inst.encoding.mnemonic) { + .lea => try emit.encodeInst(try .new(.none, .lea, &.{ + lowered_inst.ops[0], + .{ .mem = .initRip(.none, 0) }, + }, emit.lower.target), reloc_info), + .mov => try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initRip(lowered_inst.ops[reloc.op_index].mem.sib.ptr_size, 0) }, + }, emit.lower.target), reloc_info), + else => unreachable, + } + } else if (emit.bin_file.cast(.macho)) |_| { + if (reloc.target.is_extern) switch (lowered_inst.encoding.mnemonic) { + .lea => try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initRip(.ptr, 0) }, + }, emit.lower.target), reloc_info), + .mov => { + try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initRip(.ptr, 0) }, + }, emit.lower.target), reloc_info); + try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initSib(lowered_inst.ops[reloc.op_index].mem.sib.ptr_size, .{ .base = .{ + .reg = lowered_inst.ops[0].reg.to64(), + } }) }, + }, emit.lower.target), &.{}); + }, + else => unreachable, + } else switch (lowered_inst.encoding.mnemonic) { + .lea => try emit.encodeInst(try .new(.none, .lea, &.{ + lowered_inst.ops[0], + .{ .mem = .initRip(.none, 0) }, + }, emit.lower.target), reloc_info), + .mov => try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initRip(lowered_inst.ops[reloc.op_index].mem.sib.ptr_size, 0) }, + }, emit.lower.target), reloc_info), + else => unreachable, + } + } else return emit.fail("TODO implement relocs for {s}", .{ + @tagName(emit.bin_file.tag), }); - } else unreachable, - .linker_got, - .linker_direct, - .linker_import, - => |sym_index| if (emit.lower.bin_file.cast(.elf)) |_| { - unreachable; - } else if (emit.lower.bin_file.cast(.macho)) |_| { - unreachable; - } else if (emit.lower.bin_file.cast(.coff)) |coff_file| { - const atom_index = coff_file.getAtomIndexForSymbol(.{ - .sym_index = emit.atom_index, - .file = null, - }).?; - const target = if (link.File.Coff.global_symbol_bit & sym_index != 0) - coff_file.getGlobalByIndex(link.File.Coff.global_symbol_mask & sym_index) - else - link.File.Coff.SymbolWithLoc{ .sym_index = sym_index, .file = null }; - try coff_file.addRelocation(atom_index, .{ - .type = switch (lowered_relocs[0].target) { - .linker_got => .got, - .linker_direct => .direct, - .linker_import => .import, + continue :lowered_inst; + }, + .branch, .tls => unreachable, + .tlv => { + if (emit.bin_file.cast(.elf)) |elf_file| { + if (reloc.target.is_extern) { + // TODO handle extern TLS vars, i.e., emit GD model + return emit.fail("TODO implement extern {s} reloc for {s}", .{ + @tagName(reloc.target.type), @tagName(emit.bin_file.tag), + }); + } else if (emit.pic) switch (lowered_inst.encoding.mnemonic) { + .lea, .mov => { + // Here, we currently assume local dynamic TLS vars, and so + // we emit LD model. + try emit.encodeInst(try .new(.none, .lea, &.{ + .{ .reg = .rdi }, + .{ .mem = .initRip(.none, 0) }, + }, emit.lower.target), &.{.{ + .op_index = 1, + .target = .{ + .index = reloc.target.index, + .is_extern = false, + .type = .tls, + }, + }}); + try emit.encodeInst(try .new(.none, .call, &.{ + .{ .imm = .s(0) }, + }, emit.lower.target), &.{.{ + .op_index = 0, + .target = .{ + .index = try elf_file.getGlobalSymbol("__tls_get_addr", null), + .is_extern = true, + .type = .branch, + }, + }}); + try emit.encodeInst(try .new(.none, lowered_inst.encoding.mnemonic, &.{ + lowered_inst.ops[0], + .{ .mem = .initSib(.none, .{ + .base = .{ .reg = .rax }, + .disp = std.math.minInt(i32), + }) }, + }, emit.lower.target), reloc_info); + }, else => unreachable, + } else switch (lowered_inst.encoding.mnemonic) { + .lea, .mov => { + // Since we are linking statically, we emit LE model directly. + try emit.encodeInst(try .new(.none, .mov, &.{ + .{ .reg = .rax }, + .{ .mem = .initSib(.qword, .{ .base = .{ .reg = .fs } }) }, + }, emit.lower.target), &.{}); + try emit.encodeInst(try .new(.none, lowered_inst.encoding.mnemonic, &.{ + lowered_inst.ops[0], + .{ .mem = .initSib(.none, .{ + .base = .{ .reg = .rax }, + .disp = std.math.minInt(i32), + }) }, + }, emit.lower.target), reloc_info); + }, + else => unreachable, + } + } else if (emit.bin_file.cast(.macho)) |_| switch (lowered_inst.encoding.mnemonic) { + .lea => { + try emit.encodeInst(try .new(.none, .mov, &.{ + .{ .reg = .rdi }, + .{ .mem = .initRip(.ptr, 0) }, + }, emit.lower.target), reloc_info); + try emit.encodeInst(try .new(.none, .call, &.{ + .{ .mem = .initSib(.qword, .{ .base = .{ .reg = .rdi } }) }, + }, emit.lower.target), &.{}); + try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .reg = .rax }, + }, emit.lower.target), &.{}); }, - .target = target, - .offset = @intCast(end_offset - 4), - .addend = @intCast(lowered_relocs[0].off), - .pcrel = true, - .length = 2, - }); - } else if (emit.lower.bin_file.cast(.plan9)) |p9_file| { - try p9_file.addReloc(emit.atom_index, .{ // TODO we may need to add a .type field to the relocs if they are .linker_got instead of just .linker_direct - .target = sym_index, // we set sym_index to just be the atom index - .offset = @intCast(end_offset - 4), - .addend = @intCast(lowered_relocs[0].off), - .type = .pcrel, + .mov => { + try emit.encodeInst(try .new(.none, .mov, &.{ + .{ .reg = .rdi }, + .{ .mem = .initRip(.ptr, 0) }, + }, emit.lower.target), reloc_info); + try emit.encodeInst(try .new(.none, .call, &.{ + .{ .mem = .initSib(.qword, .{ .base = .{ .reg = .rdi } }) }, + }, emit.lower.target), &.{}); + try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initSib(.qword, .{ .base = .{ .reg = .rax } }) }, + }, emit.lower.target), &.{}); + }, + else => unreachable, + } else return emit.fail("TODO implement relocs for {s}", .{ + @tagName(emit.bin_file.tag), }); - } else return emit.fail("TODO implement linker reloc for {s}", .{ - @tagName(emit.lower.bin_file.tag), - }), + continue :lowered_inst; + }, }; + try emit.encodeInst(lowered_inst, reloc_info); } - std.debug.assert(lowered_relocs.len == 0); + assert(lowered_relocs.len == 0); if (lowered.insts.len == 0) { const mir_inst = emit.lower.mir.instructions.get(mir_index); @@ -358,7 +462,6 @@ pub fn emitMir(emit: *Emit) Error!void { .pseudo_dbg_arg_i_s, .pseudo_dbg_arg_i_u, .pseudo_dbg_arg_i_64, - .pseudo_dbg_arg_reloc, .pseudo_dbg_arg_ro, .pseudo_dbg_arg_fa, .pseudo_dbg_arg_m, @@ -366,7 +469,6 @@ pub fn emitMir(emit: *Emit) Error!void { .pseudo_dbg_var_i_s, .pseudo_dbg_var_i_u, .pseudo_dbg_var_i_64, - .pseudo_dbg_var_reloc, .pseudo_dbg_var_ro, .pseudo_dbg_var_fa, .pseudo_dbg_var_m, @@ -391,16 +493,6 @@ pub fn emitMir(emit: *Emit) Error!void { loc_buf[0] = .{ .constu = mir_inst.data.i64 }; break :stack_value &loc_buf[0]; } }, - .pseudo_dbg_arg_reloc, .pseudo_dbg_var_reloc => .{ .plus = .{ - sym: { - loc_buf[0] = .{ .addr_reloc = mir_inst.data.reloc.sym_index }; - break :sym &loc_buf[0]; - }, - off: { - loc_buf[1] = .{ .consts = mir_inst.data.reloc.off }; - break :off &loc_buf[1]; - }, - } }, .pseudo_dbg_arg_fa, .pseudo_dbg_var_fa => { const reg_off = emit.lower.mir.resolveFrameAddr(mir_inst.data.fa); break :loc .{ .plus = .{ @@ -415,15 +507,53 @@ pub fn emitMir(emit: *Emit) Error!void { } }; }, .pseudo_dbg_arg_m, .pseudo_dbg_var_m => { - const mem = emit.lower.mem(undefined, mir_inst.data.x.payload); + const ip = &emit.pt.zcu.intern_pool; + const mem = emit.lower.mir.resolveMemoryExtra(mir_inst.data.x.payload).decode(); break :loc .{ .plus = .{ base: { loc_buf[0] = switch (mem.base()) { .none => .{ .constu = 0 }, .reg => |reg| .{ .breg = reg.dwarfNum() }, .frame, .table, .rip_inst => unreachable, - .reloc => |sym_index| .{ .addr_reloc = sym_index }, - .pcrel => unreachable, + .nav => |nav| .{ .addr_reloc = switch (codegen.genNavRef( + emit.bin_file, + emit.pt, + emit.lower.src_loc, + .fromInterned(ip.getNav(nav).typeOf(ip)), + nav, + emit.lower.target.*, + ) catch |err| switch (err) { + error.CodegenFail, + => return emit.fail("unable to codegen: {s}", .{@errorName(err)}), + else => |e| return e, + }) { + .mcv => |mcv| switch (mcv) { + else => unreachable, + .load_direct, .load_symbol => |sym_index| sym_index, + }, + .fail => |em| { + assert(emit.lower.err_msg == null); + emit.lower.err_msg = em; + return error.EmitFail; + }, + } }, + .uav => |uav| .{ .addr_reloc = switch (try emit.bin_file.lowerUav( + emit.pt, + uav.val, + Type.fromInterned(uav.orig_ty).ptrAlignment(emit.pt.zcu), + emit.lower.src_loc, + )) { + .mcv => |mcv| switch (mcv) { + else => unreachable, + .load_direct, .load_symbol => |sym_index| sym_index, + }, + .fail => |em| { + assert(emit.lower.err_msg == null); + emit.lower.err_msg = em; + return error.EmitFail; + }, + } }, + .lazy_sym, .extern_func => unreachable, }; break :base &loc_buf[0]; }, @@ -438,13 +568,8 @@ pub fn emitMir(emit: *Emit) Error!void { }, }; - const local_name_bytes = emit.lower.mir.local_name_bytes[local_name_index..]; - const local_name = local_name_bytes[0..std.mem.indexOfScalar(u8, local_name_bytes, 0).? :0]; - local_name_index += local_name.len + 1; - - const local_type = emit.lower.mir.local_types[local_index]; + const local = &emit.lower.mir.locals[local_index]; local_index += 1; - try dwarf.genLocalVarDebugInfo( switch (mir_inst.ops) { else => unreachable, @@ -452,7 +577,6 @@ pub fn emitMir(emit: *Emit) Error!void { .pseudo_dbg_arg_i_s, .pseudo_dbg_arg_i_u, .pseudo_dbg_arg_i_64, - .pseudo_dbg_arg_reloc, .pseudo_dbg_arg_ro, .pseudo_dbg_arg_fa, .pseudo_dbg_arg_m, @@ -462,27 +586,23 @@ pub fn emitMir(emit: *Emit) Error!void { .pseudo_dbg_var_i_s, .pseudo_dbg_var_i_u, .pseudo_dbg_var_i_64, - .pseudo_dbg_var_reloc, .pseudo_dbg_var_ro, .pseudo_dbg_var_fa, .pseudo_dbg_var_m, .pseudo_dbg_var_val, => .local_var, }, - local_name, - .fromInterned(local_type), + local.name.toSlice(&emit.lower.mir), + .fromInterned(local.type), loc, ); }, - .plan9 => {}, - .none => {}, + .plan9, .none => local_index += 1, }, .pseudo_dbg_arg_val, .pseudo_dbg_var_val => switch (emit.debug_output) { .dwarf => |dwarf| { - const local_name_bytes = emit.lower.mir.local_name_bytes[local_name_index..]; - const local_name = local_name_bytes[0..std.mem.indexOfScalar(u8, local_name_bytes, 0).? :0]; - local_name_index += local_name.len + 1; - + const local = &emit.lower.mir.locals[local_index]; + local_index += 1; try dwarf.genLocalConstDebugInfo( emit.lower.src_loc, switch (mir_inst.ops) { @@ -490,12 +610,11 @@ pub fn emitMir(emit: *Emit) Error!void { .pseudo_dbg_arg_val => .comptime_arg, .pseudo_dbg_var_val => .local_const, }, - local_name, + local.name.toSlice(&emit.lower.mir), .fromInterned(mir_inst.data.ip_index), ); }, - .plan9 => {}, - .none => {}, + .plan9, .none => local_index += 1, }, .pseudo_dbg_var_args_none => switch (emit.debug_output) { .dwarf => |dwarf| try dwarf.genVarArgsDebugInfo(), @@ -507,8 +626,8 @@ pub fn emitMir(emit: *Emit) Error!void { } } } - for (relocs.items) |reloc| { - const target = code_offset_mapping[reloc.target]; + for (emit.relocs.items) |reloc| { + const target = emit.code_offset_mapping.items[reloc.target]; const disp = @as(i64, @intCast(target)) - @as(i64, @intCast(reloc.inst_offset + reloc.inst_length)) + reloc.target_offset; const inst_bytes = emit.code.items[reloc.inst_offset..][0..reloc.inst_length]; switch (reloc.source_length) { @@ -522,13 +641,13 @@ pub fn emitMir(emit: *Emit) Error!void { } } if (emit.lower.mir.table.len > 0) { - if (emit.lower.bin_file.cast(.elf)) |elf_file| { + if (emit.bin_file.cast(.elf)) |elf_file| { const zo = elf_file.zigObjectPtr().?; const atom = zo.symbol(emit.atom_index).atom(elf_file).?; const ptr_size = @divExact(emit.lower.target.ptrBitWidth(), 8); var table_offset = std.mem.alignForward(u32, @intCast(emit.code.items.len), ptr_size); - for (table_relocs.items) |table_reloc| try atom.addReloc(gpa, .{ + for (emit.table_relocs.items) |table_reloc| try atom.addReloc(gpa, .{ .r_offset = table_reloc.source_offset, .r_info = @as(u64, emit.atom_index) << 32 | @intFromEnum(std.elf.R_X86_64.@"32"), .r_addend = @as(i64, table_offset) + table_reloc.target_offset, @@ -537,7 +656,7 @@ pub fn emitMir(emit: *Emit) Error!void { try atom.addReloc(gpa, .{ .r_offset = table_offset, .r_info = @as(u64, emit.atom_index) << 32 | @intFromEnum(std.elf.R_X86_64.@"64"), - .r_addend = code_offset_mapping[entry], + .r_addend = emit.code_offset_mapping.items[entry], }, zo); table_offset += ptr_size; } @@ -546,6 +665,192 @@ pub fn emitMir(emit: *Emit) Error!void { } } +pub fn deinit(emit: *Emit) void { + const gpa = emit.bin_file.comp.gpa; + emit.code_offset_mapping.deinit(gpa); + emit.relocs.deinit(gpa); + emit.table_relocs.deinit(gpa); + emit.* = undefined; +} + +const RelocInfo = struct { + op_index: Lower.InstOpIndex, + off: i32 = 0, + target: Target, + + const Target = struct { + index: u32, + is_extern: bool, + type: Target.Type, + force_pcrel_direct: bool = false, + + const Type = enum { inst, table, symbol, branch, tls, tlv }; + }; +}; + +fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocInfo) Error!void { + const comp = emit.bin_file.comp; + const gpa = comp.gpa; + const start_offset: u32 = @intCast(emit.code.items.len); + try lowered_inst.encode(emit.code.writer(gpa), .{}); + const end_offset: u32 = @intCast(emit.code.items.len); + for (reloc_info) |reloc| switch (reloc.target.type) { + .inst => { + const inst_length: u4 = @intCast(end_offset - start_offset); + const reloc_offset, const reloc_length = reloc_offset_length: { + var reloc_offset = inst_length; + var op_index: usize = lowered_inst.ops.len; + while (true) { + op_index -= 1; + const op = lowered_inst.encoding.data.ops[op_index]; + if (op == .none) continue; + const is_mem = op.isMemory(); + const enc_length: u4 = if (is_mem) switch (lowered_inst.ops[op_index].mem.sib.base) { + .rip_inst => 4, + else => unreachable, + } else @intCast(std.math.divCeil(u7, @intCast(op.immBitSize()), 8) catch unreachable); + reloc_offset -= enc_length; + if (op_index == reloc.op_index) break :reloc_offset_length .{ reloc_offset, enc_length }; + assert(!is_mem); + } + }; + try emit.relocs.append(emit.lower.allocator, .{ + .inst_offset = start_offset, + .inst_length = inst_length, + .source_offset = reloc_offset, + .source_length = reloc_length, + .target = reloc.target.index, + .target_offset = reloc.off, + }); + }, + .table => try emit.table_relocs.append(emit.lower.allocator, .{ + .source_offset = end_offset - 4, + .target_offset = reloc.off, + }), + .symbol => if (emit.bin_file.cast(.elf)) |elf_file| { + const zo = elf_file.zigObjectPtr().?; + const atom = zo.symbol(emit.atom_index).atom(elf_file).?; + const r_type: std.elf.R_X86_64 = if (!emit.pic) + .@"32" + else if (reloc.target.is_extern and !reloc.target.force_pcrel_direct) + .GOTPCREL + else + .PC32; + try atom.addReloc(gpa, .{ + .r_offset = end_offset - 4, + .r_info = @as(u64, reloc.target.index) << 32 | @intFromEnum(r_type), + .r_addend = if (emit.pic) reloc.off - 4 else reloc.off, + }, zo); + } else if (emit.bin_file.cast(.macho)) |macho_file| { + const zo = macho_file.getZigObject().?; + const atom = zo.symbols.items[emit.atom_index].getAtom(macho_file).?; + try atom.addReloc(macho_file, .{ + .tag = .@"extern", + .offset = end_offset - 4, + .target = reloc.target.index, + .addend = reloc.off, + .type = if (reloc.target.is_extern and !reloc.target.force_pcrel_direct) .got_load else .signed, + .meta = .{ + .pcrel = true, + .has_subtractor = false, + .length = 2, + .symbolnum = @intCast(reloc.target.index), + }, + }); + } else unreachable, + .branch => if (emit.bin_file.cast(.elf)) |elf_file| { + const zo = elf_file.zigObjectPtr().?; + const atom = zo.symbol(emit.atom_index).atom(elf_file).?; + const r_type: std.elf.R_X86_64 = .PLT32; + try atom.addReloc(gpa, .{ + .r_offset = end_offset - 4, + .r_info = @as(u64, reloc.target.index) << 32 | @intFromEnum(r_type), + .r_addend = reloc.off - 4, + }, zo); + } else if (emit.bin_file.cast(.macho)) |macho_file| { + const zo = macho_file.getZigObject().?; + const atom = zo.symbols.items[emit.atom_index].getAtom(macho_file).?; + try atom.addReloc(macho_file, .{ + .tag = .@"extern", + .offset = end_offset - 4, + .target = reloc.target.index, + .addend = reloc.off, + .type = .branch, + .meta = .{ + .pcrel = true, + .has_subtractor = false, + .length = 2, + .symbolnum = @intCast(reloc.target.index), + }, + }); + } else if (emit.bin_file.cast(.coff)) |coff_file| { + const atom_index = coff_file.getAtomIndexForSymbol( + .{ .sym_index = emit.atom_index, .file = null }, + ).?; + const target: link.File.Coff.SymbolWithLoc = if (link.File.Coff.global_symbol_bit & reloc.target.index != 0) + coff_file.getGlobalByIndex(link.File.Coff.global_symbol_mask & reloc.target.index) + else + .{ .sym_index = reloc.target.index, .file = null }; + try coff_file.addRelocation(atom_index, .{ + .type = .direct, + .target = target, + .offset = end_offset - 4, + .addend = @intCast(reloc.off), + .pcrel = true, + .length = 2, + }); + } else return emit.fail("TODO implement {s} reloc for {s}", .{ + @tagName(reloc.target.type), @tagName(emit.bin_file.tag), + }), + .tls => if (emit.bin_file.cast(.elf)) |elf_file| { + if (reloc.target.is_extern) return emit.fail("TODO implement extern {s} reloc for {s}", .{ + @tagName(reloc.target.type), @tagName(emit.bin_file.tag), + }); + const zo = elf_file.zigObjectPtr().?; + const atom = zo.symbol(emit.atom_index).atom(elf_file).?; + const r_type: std.elf.R_X86_64 = if (emit.pic) .TLSLD else unreachable; + try atom.addReloc(gpa, .{ + .r_offset = end_offset - 4, + .r_info = @as(u64, reloc.target.index) << 32 | @intFromEnum(r_type), + .r_addend = reloc.off - 4, + }, zo); + } else return emit.fail("TODO implement {s} reloc for {s}", .{ + @tagName(reloc.target.type), @tagName(emit.bin_file.tag), + }), + .tlv => if (emit.bin_file.cast(.elf)) |elf_file| { + if (reloc.target.is_extern) return emit.fail("TODO implement extern {s} reloc for {s}", .{ + @tagName(reloc.target.type), @tagName(emit.bin_file.tag), + }); + const zo = elf_file.zigObjectPtr().?; + const atom = zo.symbol(emit.atom_index).atom(elf_file).?; + const r_type: std.elf.R_X86_64 = if (emit.pic) .DTPOFF32 else .TPOFF32; + try atom.addReloc(gpa, .{ + .r_offset = end_offset - 4, + .r_info = @as(u64, reloc.target.index) << 32 | @intFromEnum(r_type), + .r_addend = reloc.off, + }, zo); + } else if (emit.bin_file.cast(.macho)) |macho_file| { + const zo = macho_file.getZigObject().?; + const atom = zo.symbols.items[emit.atom_index].getAtom(macho_file).?; + try atom.addReloc(macho_file, .{ + .tag = .@"extern", + .offset = end_offset - 4, + .target = reloc.target.index, + .addend = reloc.off, + .type = .tlv, + .meta = .{ + .pcrel = true, + .has_subtractor = false, + .length = 2, + .symbolnum = @intCast(reloc.target.index), + }, + }); + } else return emit.fail("TODO implement {s} reloc for {s}", .{ + @tagName(reloc.target.type), @tagName(emit.bin_file.tag), + }), + }; +} + fn fail(emit: *Emit, comptime format: []const u8, args: anytype) Error { return switch (emit.lower.fail(format, args)) { error.LowerFail => error.EmitFail, @@ -629,11 +934,17 @@ fn dbgAdvancePCAndLine(emit: *Emit, loc: Loc) Error!void { } } +const assert = std.debug.assert; const bits = @import("bits.zig"); +const codegen = @import("../../codegen.zig"); const Emit = @This(); +const encoder = @import("encoder.zig"); +const Instruction = encoder.Instruction; const InternPool = @import("../../InternPool.zig"); const link = @import("../../link.zig"); const log = std.log.scoped(.emit); const Lower = @import("Lower.zig"); const Mir = @import("Mir.zig"); const std = @import("std"); +const Type = @import("../../Type.zig"); +const Zcu = @import("../../Zcu.zig"); diff --git a/src/arch/x86_64/Lower.zig b/src/arch/x86_64/Lower.zig index 54b419103f..c476fd2eda 100644 --- a/src/arch/x86_64/Lower.zig +++ b/src/arch/x86_64/Lower.zig @@ -1,10 +1,6 @@ //! This file contains the functionality for lowering x86_64 MIR to Instructions -bin_file: *link.File, target: *const std.Target, -output_mode: std.builtin.OutputMode, -link_mode: std.builtin.LinkMode, -pic: bool, allocator: std.mem.Allocator, mir: Mir, cc: std.builtin.CallingConvention, @@ -17,7 +13,6 @@ result_relocs: [max_result_relocs]Reloc = undefined, const max_result_insts = @max( 1, // non-pseudo instructions - 3, // (ELF only) TLS local dynamic (LD) sequence in PIC mode 2, // cmovcc: cmovcc \ cmovcc 3, // setcc: setcc \ setcc \ logicop 2, // jcc: jcc \ jcc @@ -25,6 +20,7 @@ const max_result_insts = @max( pseudo_probe_adjust_unrolled_max_insts, pseudo_probe_adjust_setup_insts, pseudo_probe_adjust_loop_insts, + abi.zigcc.callee_preserved_regs.len * 2, // push_regs/pop_regs abi.Win64.callee_preserved_regs.len * 2, // push_regs/pop_regs abi.SysV.callee_preserved_regs.len * 2, // push_regs/pop_regs ); @@ -33,14 +29,13 @@ const max_result_relocs = @max( 2, // jcc: jcc \ jcc 2, // test \ jcc \ probe \ sub \ jmp 1, // probe \ sub \ jcc - 3, // (ELF only) TLS local dynamic (LD) sequence in PIC mode ); -const ResultInstIndex = std.math.IntFittingRange(0, max_result_insts - 1); -const ResultRelocIndex = std.math.IntFittingRange(0, max_result_relocs - 1); -const InstOpIndex = std.math.IntFittingRange( +const ResultInstIndex = std.math.IntFittingRange(0, max_result_insts); +const ResultRelocIndex = std.math.IntFittingRange(0, max_result_relocs); +pub const InstOpIndex = std.math.IntFittingRange( 0, - @typeInfo(@FieldType(Instruction, "ops")).array.len - 1, + @typeInfo(@FieldType(Instruction, "ops")).array.len, ); pub const pseudo_probe_align_insts = 5; // test \ jcc \ probe \ sub \ jmp @@ -54,7 +49,8 @@ pub const Error = error{ LowerFail, InvalidInstruction, CannotEncode, -}; + CodegenFail, +} || codegen.GenerateSymbolError; pub const Reloc = struct { lowered_inst_index: ResultInstIndex, @@ -65,14 +61,10 @@ pub const Reloc = struct { const Target = union(enum) { inst: Mir.Inst.Index, table, - linker_reloc: u32, - linker_pcrel: u32, - linker_tlsld: u32, - linker_dtpoff: u32, - linker_extern_fn: u32, - linker_got: u32, - linker_direct: u32, - linker_import: u32, + nav: InternPool.Nav.Index, + uav: InternPool.Key.Ptr.BaseAddr.Uav, + lazy_sym: link.File.LazySymbol, + extern_func: Mir.NullTerminatedString, }; }; @@ -80,7 +72,7 @@ const Options = struct { allow_frame_locs: bool }; /// The returned slice is overwritten by the next call to lowerMir. pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { - insts: []const Instruction, + insts: []Instruction, relocs: []const Reloc, } { lower.result_insts = undefined; @@ -98,130 +90,130 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { .pseudo => switch (inst.ops) { .pseudo_cmov_z_and_np_rr => { assert(inst.data.rr.fixes == ._); - try lower.emit(.none, .cmovnz, &.{ + try lower.encode(.none, .cmovnz, &.{ .{ .reg = inst.data.rr.r2 }, .{ .reg = inst.data.rr.r1 }, }); - try lower.emit(.none, .cmovnp, &.{ + try lower.encode(.none, .cmovnp, &.{ .{ .reg = inst.data.rr.r1 }, .{ .reg = inst.data.rr.r2 }, }); }, .pseudo_cmov_nz_or_p_rr => { assert(inst.data.rr.fixes == ._); - try lower.emit(.none, .cmovnz, &.{ + try lower.encode(.none, .cmovnz, &.{ .{ .reg = inst.data.rr.r1 }, .{ .reg = inst.data.rr.r2 }, }); - try lower.emit(.none, .cmovp, &.{ + try lower.encode(.none, .cmovp, &.{ .{ .reg = inst.data.rr.r1 }, .{ .reg = inst.data.rr.r2 }, }); }, .pseudo_cmov_nz_or_p_rm => { assert(inst.data.rx.fixes == ._); - try lower.emit(.none, .cmovnz, &.{ + try lower.encode(.none, .cmovnz, &.{ .{ .reg = inst.data.rx.r1 }, .{ .mem = lower.mem(1, inst.data.rx.payload) }, }); - try lower.emit(.none, .cmovp, &.{ + try lower.encode(.none, .cmovp, &.{ .{ .reg = inst.data.rx.r1 }, .{ .mem = lower.mem(1, inst.data.rx.payload) }, }); }, .pseudo_set_z_and_np_r => { assert(inst.data.rr.fixes == ._); - try lower.emit(.none, .setz, &.{ + try lower.encode(.none, .setz, &.{ .{ .reg = inst.data.rr.r1 }, }); - try lower.emit(.none, .setnp, &.{ + try lower.encode(.none, .setnp, &.{ .{ .reg = inst.data.rr.r2 }, }); - try lower.emit(.none, .@"and", &.{ + try lower.encode(.none, .@"and", &.{ .{ .reg = inst.data.rr.r1 }, .{ .reg = inst.data.rr.r2 }, }); }, .pseudo_set_z_and_np_m => { assert(inst.data.rx.fixes == ._); - try lower.emit(.none, .setz, &.{ + try lower.encode(.none, .setz, &.{ .{ .mem = lower.mem(0, inst.data.rx.payload) }, }); - try lower.emit(.none, .setnp, &.{ + try lower.encode(.none, .setnp, &.{ .{ .reg = inst.data.rx.r1 }, }); - try lower.emit(.none, .@"and", &.{ + try lower.encode(.none, .@"and", &.{ .{ .mem = lower.mem(0, inst.data.rx.payload) }, .{ .reg = inst.data.rx.r1 }, }); }, .pseudo_set_nz_or_p_r => { assert(inst.data.rr.fixes == ._); - try lower.emit(.none, .setnz, &.{ + try lower.encode(.none, .setnz, &.{ .{ .reg = inst.data.rr.r1 }, }); - try lower.emit(.none, .setp, &.{ + try lower.encode(.none, .setp, &.{ .{ .reg = inst.data.rr.r2 }, }); - try lower.emit(.none, .@"or", &.{ + try lower.encode(.none, .@"or", &.{ .{ .reg = inst.data.rr.r1 }, .{ .reg = inst.data.rr.r2 }, }); }, .pseudo_set_nz_or_p_m => { assert(inst.data.rx.fixes == ._); - try lower.emit(.none, .setnz, &.{ + try lower.encode(.none, .setnz, &.{ .{ .mem = lower.mem(0, inst.data.rx.payload) }, }); - try lower.emit(.none, .setp, &.{ + try lower.encode(.none, .setp, &.{ .{ .reg = inst.data.rx.r1 }, }); - try lower.emit(.none, .@"or", &.{ + try lower.encode(.none, .@"or", &.{ .{ .mem = lower.mem(0, inst.data.rx.payload) }, .{ .reg = inst.data.rx.r1 }, }); }, .pseudo_j_z_and_np_inst => { assert(inst.data.inst.fixes == ._); - try lower.emit(.none, .jnz, &.{ + try lower.encode(.none, .jnz, &.{ .{ .imm = lower.reloc(0, .{ .inst = index + 1 }, 0) }, }); - try lower.emit(.none, .jnp, &.{ + try lower.encode(.none, .jnp, &.{ .{ .imm = lower.reloc(0, .{ .inst = inst.data.inst.inst }, 0) }, }); }, .pseudo_j_nz_or_p_inst => { assert(inst.data.inst.fixes == ._); - try lower.emit(.none, .jnz, &.{ + try lower.encode(.none, .jnz, &.{ .{ .imm = lower.reloc(0, .{ .inst = inst.data.inst.inst }, 0) }, }); - try lower.emit(.none, .jp, &.{ + try lower.encode(.none, .jp, &.{ .{ .imm = lower.reloc(0, .{ .inst = inst.data.inst.inst }, 0) }, }); }, .pseudo_probe_align_ri_s => { - try lower.emit(.none, .@"test", &.{ + try lower.encode(.none, .@"test", &.{ .{ .reg = inst.data.ri.r1 }, .{ .imm = .s(@bitCast(inst.data.ri.i)) }, }); - try lower.emit(.none, .jz, &.{ + try lower.encode(.none, .jz, &.{ .{ .imm = lower.reloc(0, .{ .inst = index + 1 }, 0) }, }); - try lower.emit(.none, .lea, &.{ + try lower.encode(.none, .lea, &.{ .{ .reg = inst.data.ri.r1 }, .{ .mem = Memory.initSib(.qword, .{ .base = .{ .reg = inst.data.ri.r1 }, .disp = -page_size, }) }, }); - try lower.emit(.none, .@"test", &.{ + try lower.encode(.none, .@"test", &.{ .{ .mem = Memory.initSib(.dword, .{ .base = .{ .reg = inst.data.ri.r1 }, }) }, .{ .reg = inst.data.ri.r1.to32() }, }); - try lower.emit(.none, .jmp, &.{ + try lower.encode(.none, .jmp, &.{ .{ .imm = lower.reloc(0, .{ .inst = index }, 0) }, }); assert(lower.result_insts_len == pseudo_probe_align_insts); @@ -229,7 +221,7 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { .pseudo_probe_adjust_unrolled_ri_s => { var offset = page_size; while (offset < @as(i32, @bitCast(inst.data.ri.i))) : (offset += page_size) { - try lower.emit(.none, .@"test", &.{ + try lower.encode(.none, .@"test", &.{ .{ .mem = Memory.initSib(.dword, .{ .base = .{ .reg = inst.data.ri.r1 }, .disp = -offset, @@ -237,25 +229,25 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { .{ .reg = inst.data.ri.r1.to32() }, }); } - try lower.emit(.none, .sub, &.{ + try lower.encode(.none, .sub, &.{ .{ .reg = inst.data.ri.r1 }, .{ .imm = .s(@bitCast(inst.data.ri.i)) }, }); assert(lower.result_insts_len <= pseudo_probe_adjust_unrolled_max_insts); }, .pseudo_probe_adjust_setup_rri_s => { - try lower.emit(.none, .mov, &.{ + try lower.encode(.none, .mov, &.{ .{ .reg = inst.data.rri.r2.to32() }, .{ .imm = .s(@bitCast(inst.data.rri.i)) }, }); - try lower.emit(.none, .sub, &.{ + try lower.encode(.none, .sub, &.{ .{ .reg = inst.data.rri.r1 }, .{ .reg = inst.data.rri.r2 }, }); assert(lower.result_insts_len == pseudo_probe_adjust_setup_insts); }, .pseudo_probe_adjust_loop_rr => { - try lower.emit(.none, .@"test", &.{ + try lower.encode(.none, .@"test", &.{ .{ .mem = Memory.initSib(.dword, .{ .base = .{ .reg = inst.data.rr.r1 }, .scale_index = .{ .scale = 1, .index = inst.data.rr.r2 }, @@ -263,11 +255,11 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { }) }, .{ .reg = inst.data.rr.r1.to32() }, }); - try lower.emit(.none, .sub, &.{ + try lower.encode(.none, .sub, &.{ .{ .reg = inst.data.rr.r2 }, .{ .imm = .s(page_size) }, }); - try lower.emit(.none, .jae, &.{ + try lower.encode(.none, .jae, &.{ .{ .imm = lower.reloc(0, .{ .inst = index }, 0) }, }); assert(lower.result_insts_len == pseudo_probe_adjust_loop_insts); @@ -275,47 +267,47 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { .pseudo_push_reg_list => try lower.pushPopRegList(.push, inst), .pseudo_pop_reg_list => try lower.pushPopRegList(.pop, inst), - .pseudo_cfi_def_cfa_ri_s => try lower.emit(.directive, .@".cfi_def_cfa", &.{ + .pseudo_cfi_def_cfa_ri_s => try lower.encode(.directive, .@".cfi_def_cfa", &.{ .{ .reg = inst.data.ri.r1 }, .{ .imm = lower.imm(.ri_s, inst.data.ri.i) }, }), - .pseudo_cfi_def_cfa_register_r => try lower.emit(.directive, .@".cfi_def_cfa_register", &.{ + .pseudo_cfi_def_cfa_register_r => try lower.encode(.directive, .@".cfi_def_cfa_register", &.{ .{ .reg = inst.data.r.r1 }, }), - .pseudo_cfi_def_cfa_offset_i_s => try lower.emit(.directive, .@".cfi_def_cfa_offset", &.{ + .pseudo_cfi_def_cfa_offset_i_s => try lower.encode(.directive, .@".cfi_def_cfa_offset", &.{ .{ .imm = lower.imm(.i_s, inst.data.i.i) }, }), - .pseudo_cfi_adjust_cfa_offset_i_s => try lower.emit(.directive, .@".cfi_adjust_cfa_offset", &.{ + .pseudo_cfi_adjust_cfa_offset_i_s => try lower.encode(.directive, .@".cfi_adjust_cfa_offset", &.{ .{ .imm = lower.imm(.i_s, inst.data.i.i) }, }), - .pseudo_cfi_offset_ri_s => try lower.emit(.directive, .@".cfi_offset", &.{ + .pseudo_cfi_offset_ri_s => try lower.encode(.directive, .@".cfi_offset", &.{ .{ .reg = inst.data.ri.r1 }, .{ .imm = lower.imm(.ri_s, inst.data.ri.i) }, }), - .pseudo_cfi_val_offset_ri_s => try lower.emit(.directive, .@".cfi_val_offset", &.{ + .pseudo_cfi_val_offset_ri_s => try lower.encode(.directive, .@".cfi_val_offset", &.{ .{ .reg = inst.data.ri.r1 }, .{ .imm = lower.imm(.ri_s, inst.data.ri.i) }, }), - .pseudo_cfi_rel_offset_ri_s => try lower.emit(.directive, .@".cfi_rel_offset", &.{ + .pseudo_cfi_rel_offset_ri_s => try lower.encode(.directive, .@".cfi_rel_offset", &.{ .{ .reg = inst.data.ri.r1 }, .{ .imm = lower.imm(.ri_s, inst.data.ri.i) }, }), - .pseudo_cfi_register_rr => try lower.emit(.directive, .@".cfi_register", &.{ + .pseudo_cfi_register_rr => try lower.encode(.directive, .@".cfi_register", &.{ .{ .reg = inst.data.rr.r1 }, .{ .reg = inst.data.rr.r2 }, }), - .pseudo_cfi_restore_r => try lower.emit(.directive, .@".cfi_restore", &.{ + .pseudo_cfi_restore_r => try lower.encode(.directive, .@".cfi_restore", &.{ .{ .reg = inst.data.r.r1 }, }), - .pseudo_cfi_undefined_r => try lower.emit(.directive, .@".cfi_undefined", &.{ + .pseudo_cfi_undefined_r => try lower.encode(.directive, .@".cfi_undefined", &.{ .{ .reg = inst.data.r.r1 }, }), - .pseudo_cfi_same_value_r => try lower.emit(.directive, .@".cfi_same_value", &.{ + .pseudo_cfi_same_value_r => try lower.encode(.directive, .@".cfi_same_value", &.{ .{ .reg = inst.data.r.r1 }, }), - .pseudo_cfi_remember_state_none => try lower.emit(.directive, .@".cfi_remember_state", &.{}), - .pseudo_cfi_restore_state_none => try lower.emit(.directive, .@".cfi_restore_state", &.{}), - .pseudo_cfi_escape_bytes => try lower.emit(.directive, .@".cfi_escape", &.{ + .pseudo_cfi_remember_state_none => try lower.encode(.directive, .@".cfi_remember_state", &.{}), + .pseudo_cfi_restore_state_none => try lower.encode(.directive, .@".cfi_restore_state", &.{}), + .pseudo_cfi_escape_bytes => try lower.encode(.directive, .@".cfi_escape", &.{ .{ .bytes = inst.data.bytes.get(lower.mir) }, }), @@ -331,7 +323,6 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { .pseudo_dbg_arg_i_s, .pseudo_dbg_arg_i_u, .pseudo_dbg_arg_i_64, - .pseudo_dbg_arg_reloc, .pseudo_dbg_arg_ro, .pseudo_dbg_arg_fa, .pseudo_dbg_arg_m, @@ -341,7 +332,6 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { .pseudo_dbg_var_i_s, .pseudo_dbg_var_i_u, .pseudo_dbg_var_i_64, - .pseudo_dbg_var_reloc, .pseudo_dbg_var_ro, .pseudo_dbg_var_fa, .pseudo_dbg_var_m, @@ -362,7 +352,7 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { pub fn fail(lower: *Lower, comptime format: []const u8, args: anytype) Error { @branchHint(.cold); assert(lower.err_msg == null); - lower.err_msg = try Zcu.ErrorMsg.create(lower.allocator, lower.src_loc, format, args); + lower.err_msg = try .create(lower.allocator, lower.src_loc, format, args); return error.LowerFail; } @@ -404,13 +394,17 @@ pub fn imm(lower: *const Lower, ops: Mir.Inst.Ops, i: u32) Immediate { }; } -pub fn mem(lower: *Lower, op_index: InstOpIndex, payload: u32) Memory { - var m = lower.mir.resolveFrameLoc(lower.mir.extraData(Mir.Memory, payload).data).decode(); +fn mem(lower: *Lower, op_index: InstOpIndex, payload: u32) Memory { + var m = lower.mir.resolveMemoryExtra(payload).decode(); switch (m) { .sib => |*sib| switch (sib.base) { - else => {}, + .none, .reg, .frame => {}, .table => sib.disp = lower.reloc(op_index, .table, sib.disp).signed, .rip_inst => |inst_index| sib.disp = lower.reloc(op_index, .{ .inst = inst_index }, sib.disp).signed, + .nav => |nav| sib.disp = lower.reloc(op_index, .{ .nav = nav }, sib.disp).signed, + .uav => |uav| sib.disp = lower.reloc(op_index, .{ .uav = uav }, sib.disp).signed, + .lazy_sym => |lazy_sym| sib.disp = lower.reloc(op_index, .{ .lazy_sym = lazy_sym }, sib.disp).signed, + .extern_func => |extern_func| sib.disp = lower.reloc(op_index, .{ .extern_func = extern_func }, sib.disp).signed, }, else => {}, } @@ -428,172 +422,8 @@ fn reloc(lower: *Lower, op_index: InstOpIndex, target: Reloc.Target, off: i32) I return .s(0); } -fn emit(lower: *Lower, prefix: Prefix, mnemonic: Mnemonic, ops: []const Operand) Error!void { - const emit_prefix = prefix; - var emit_mnemonic = mnemonic; - var emit_ops_storage: [4]Operand = undefined; - const emit_ops = emit_ops_storage[0..ops.len]; - for (emit_ops, ops, 0..) |*emit_op, op, op_index| { - emit_op.* = switch (op) { - else => op, - .mem => |mem_op| op: switch (mem_op.base()) { - else => op, - .reloc => |sym_index| { - assert(prefix == .none); - assert(mem_op.sib.disp == 0); - assert(mem_op.sib.scale_index.scale == 0); - - if (lower.bin_file.cast(.elf)) |elf_file| { - const zo = elf_file.zigObjectPtr().?; - const elf_sym = zo.symbol(sym_index); - - if (elf_sym.flags.is_tls) { - // TODO handle extern TLS vars, i.e., emit GD model - if (lower.pic) { - // Here, we currently assume local dynamic TLS vars, and so - // we emit LD model. - _ = lower.reloc(1, .{ .linker_tlsld = sym_index }, 0); - lower.result_insts[lower.result_insts_len] = try .new(.none, .lea, &.{ - .{ .reg = .rdi }, - .{ .mem = Memory.initRip(.none, 0) }, - }, lower.target); - lower.result_insts_len += 1; - _ = lower.reloc(0, .{ - .linker_extern_fn = try elf_file.getGlobalSymbol("__tls_get_addr", null), - }, 0); - lower.result_insts[lower.result_insts_len] = try .new(.none, .call, &.{ - .{ .imm = .s(0) }, - }, lower.target); - lower.result_insts_len += 1; - _ = lower.reloc(@intCast(op_index), .{ .linker_dtpoff = sym_index }, 0); - emit_mnemonic = .lea; - break :op .{ .mem = Memory.initSib(.none, .{ - .base = .{ .reg = .rax }, - .disp = std.math.minInt(i32), - }) }; - } else { - // Since we are linking statically, we emit LE model directly. - lower.result_insts[lower.result_insts_len] = try .new(.none, .mov, &.{ - .{ .reg = .rax }, - .{ .mem = Memory.initSib(.qword, .{ .base = .{ .reg = .fs } }) }, - }, lower.target); - lower.result_insts_len += 1; - _ = lower.reloc(@intCast(op_index), .{ .linker_reloc = sym_index }, 0); - emit_mnemonic = .lea; - break :op .{ .mem = Memory.initSib(.none, .{ - .base = .{ .reg = .rax }, - .disp = std.math.minInt(i32), - }) }; - } - } - - if (lower.pic) switch (mnemonic) { - .lea => { - _ = lower.reloc(@intCast(op_index), .{ .linker_reloc = sym_index }, 0); - if (!elf_sym.flags.is_extern_ptr) break :op .{ .mem = Memory.initRip(.none, 0) }; - emit_mnemonic = .mov; - break :op .{ .mem = Memory.initRip(.ptr, 0) }; - }, - .mov => { - if (elf_sym.flags.is_extern_ptr) { - const reg = ops[0].reg; - _ = lower.reloc(1, .{ .linker_reloc = sym_index }, 0); - lower.result_insts[lower.result_insts_len] = try .new(.none, .mov, &.{ - .{ .reg = reg.to64() }, - .{ .mem = Memory.initRip(.qword, 0) }, - }, lower.target); - lower.result_insts_len += 1; - break :op .{ .mem = Memory.initSib(mem_op.sib.ptr_size, .{ .base = .{ - .reg = reg.to64(), - } }) }; - } - _ = lower.reloc(@intCast(op_index), .{ .linker_reloc = sym_index }, 0); - break :op .{ .mem = Memory.initRip(mem_op.sib.ptr_size, 0) }; - }, - else => unreachable, - }; - _ = lower.reloc(@intCast(op_index), .{ .linker_reloc = sym_index }, 0); - switch (mnemonic) { - .call => break :op .{ .mem = Memory.initSib(mem_op.sib.ptr_size, .{ - .base = .{ .reg = .ds }, - }) }, - .lea => { - emit_mnemonic = .mov; - break :op .{ .imm = .s(0) }; - }, - .mov => break :op .{ .mem = Memory.initSib(mem_op.sib.ptr_size, .{ - .base = .{ .reg = .ds }, - }) }, - else => unreachable, - } - } else if (lower.bin_file.cast(.macho)) |macho_file| { - const zo = macho_file.getZigObject().?; - const macho_sym = zo.symbols.items[sym_index]; - - if (macho_sym.flags.tlv) { - _ = lower.reloc(1, .{ .linker_reloc = sym_index }, 0); - lower.result_insts[lower.result_insts_len] = try .new(.none, .mov, &.{ - .{ .reg = .rdi }, - .{ .mem = Memory.initRip(.ptr, 0) }, - }, lower.target); - lower.result_insts_len += 1; - lower.result_insts[lower.result_insts_len] = try .new(.none, .call, &.{ - .{ .mem = Memory.initSib(.qword, .{ .base = .{ .reg = .rdi } }) }, - }, lower.target); - lower.result_insts_len += 1; - emit_mnemonic = .mov; - break :op .{ .reg = .rax }; - } - - break :op switch (mnemonic) { - .lea => { - _ = lower.reloc(@intCast(op_index), .{ .linker_reloc = sym_index }, 0); - if (!macho_sym.flags.is_extern_ptr) break :op .{ .mem = Memory.initRip(.none, 0) }; - emit_mnemonic = .mov; - break :op .{ .mem = Memory.initRip(.ptr, 0) }; - }, - .mov => { - if (macho_sym.flags.is_extern_ptr) { - const reg = ops[0].reg; - _ = lower.reloc(1, .{ .linker_reloc = sym_index }, 0); - lower.result_insts[lower.result_insts_len] = try .new(.none, .mov, &.{ - .{ .reg = reg.to64() }, - .{ .mem = Memory.initRip(.qword, 0) }, - }, lower.target); - lower.result_insts_len += 1; - break :op .{ .mem = Memory.initSib(mem_op.sib.ptr_size, .{ .base = .{ - .reg = reg.to64(), - } }) }; - } - _ = lower.reloc(@intCast(op_index), .{ .linker_reloc = sym_index }, 0); - break :op .{ .mem = Memory.initRip(mem_op.sib.ptr_size, 0) }; - }, - else => unreachable, - }; - } else { - return lower.fail("TODO: bin format '{s}'", .{@tagName(lower.bin_file.tag)}); - } - }, - .pcrel => |sym_index| { - assert(prefix == .none); - assert(mem_op.sib.disp == 0); - assert(mem_op.sib.scale_index.scale == 0); - - _ = lower.reloc(@intCast(op_index), .{ .linker_pcrel = sym_index }, 0); - break :op switch (lower.bin_file.tag) { - .elf => op, - .macho => switch (mnemonic) { - .lea => .{ .mem = Memory.initRip(.none, 0) }, - .mov => .{ .mem = Memory.initRip(mem_op.sib.ptr_size, 0) }, - else => unreachable, - }, - else => |tag| return lower.fail("TODO: bin format '{s}'", .{@tagName(tag)}), - }; - }, - }, - }; - } - lower.result_insts[lower.result_insts_len] = try .new(emit_prefix, emit_mnemonic, emit_ops, lower.target); +fn encode(lower: *Lower, prefix: Prefix, mnemonic: Mnemonic, ops: []const Operand) Error!void { + lower.result_insts[lower.result_insts_len] = try .new(prefix, mnemonic, ops, lower.target); lower.result_insts_len += 1; } @@ -618,10 +448,10 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void { .rrmi => inst.data.rrix.fixes, .mi_u, .mi_s => inst.data.x.fixes, .m => inst.data.x.fixes, - .extern_fn_reloc, .got_reloc, .direct_reloc, .import_reloc, .tlv_reloc, .rel => ._, + .nav, .uav, .lazy_sym, .extern_func => ._, else => return lower.fail("TODO lower .{s}", .{@tagName(inst.ops)}), }; - try lower.emit(switch (fixes) { + try lower.encode(switch (fixes) { inline else => |tag| comptime if (std.mem.indexOfScalar(u8, @tagName(tag), ' ')) |space| @field(Prefix, @tagName(tag)[0..space]) else @@ -752,22 +582,17 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void { .{ .mem = lower.mem(2, inst.data.rrix.payload) }, .{ .imm = lower.imm(inst.ops, inst.data.rrix.i) }, }, - .extern_fn_reloc, .rel => &.{ - .{ .imm = lower.reloc(0, .{ .linker_extern_fn = inst.data.reloc.sym_index }, inst.data.reloc.off) }, + .nav => &.{ + .{ .imm = lower.reloc(0, .{ .nav = inst.data.nav.index }, inst.data.nav.off) }, }, - .got_reloc, .direct_reloc, .import_reloc => ops: { - const reg = inst.data.rx.r1; - const extra = lower.mir.extraData(bits.SymbolOffset, inst.data.rx.payload).data; - _ = lower.reloc(1, switch (inst.ops) { - .got_reloc => .{ .linker_got = extra.sym_index }, - .direct_reloc => .{ .linker_direct = extra.sym_index }, - .import_reloc => .{ .linker_import = extra.sym_index }, - else => unreachable, - }, extra.off); - break :ops &.{ - .{ .reg = reg }, - .{ .mem = Memory.initRip(Memory.PtrSize.fromBitSize(reg.bitSize()), 0) }, - }; + .uav => &.{ + .{ .imm = lower.reloc(0, .{ .uav = inst.data.uav }, 0) }, + }, + .lazy_sym => &.{ + .{ .imm = lower.reloc(0, .{ .lazy_sym = inst.data.lazy_sym }, 0) }, + }, + .extern_func => &.{ + .{ .imm = lower.reloc(0, .{ .extern_func = inst.data.extern_func }, 0) }, }, else => return lower.fail("TODO lower {s} {s}", .{ @tagName(inst.tag), @tagName(inst.ops) }), }); @@ -787,7 +612,7 @@ fn pushPopRegList(lower: *Lower, comptime mnemonic: Mnemonic, inst: Mir.Inst) Er else => unreachable, } }); while (it.next()) |i| { - try lower.emit(.none, mnemonic, &.{.{ + try lower.encode(.none, mnemonic, &.{.{ .reg = callee_preserved_regs[i], }}); switch (mnemonic) { @@ -801,7 +626,7 @@ fn pushPopRegList(lower: *Lower, comptime mnemonic: Mnemonic, inst: Mir.Inst) Er .push => { var it = inst.data.reg_list.iterator(.{}); while (it.next()) |i| { - try lower.emit(.directive, .@".cfi_rel_offset", &.{ + try lower.encode(.directive, .@".cfi_rel_offset", &.{ .{ .reg = callee_preserved_regs[i] }, .{ .imm = .s(off) }, }); @@ -819,12 +644,14 @@ const page_size: i32 = 1 << 12; const abi = @import("abi.zig"); const assert = std.debug.assert; const bits = @import("bits.zig"); +const codegen = @import("../../codegen.zig"); const encoder = @import("encoder.zig"); const link = @import("../../link.zig"); const std = @import("std"); const Immediate = Instruction.Immediate; const Instruction = encoder.Instruction; +const InternPool = @import("../../InternPool.zig"); const Lower = @This(); const Memory = Instruction.Memory; const Mir = @import("Mir.zig"); @@ -833,3 +660,4 @@ const Zcu = @import("../../Zcu.zig"); const Operand = Instruction.Operand; const Prefix = Instruction.Prefix; const Register = bits.Register; +const Type = @import("../../Type.zig"); diff --git a/src/arch/x86_64/Mir.zig b/src/arch/x86_64/Mir.zig index 24d5c6a3ed..70f8090685 100644 --- a/src/arch/x86_64/Mir.zig +++ b/src/arch/x86_64/Mir.zig @@ -9,8 +9,8 @@ instructions: std.MultiArrayList(Inst).Slice, /// The meaning of this data is determined by `Inst.Tag` value. extra: []const u32, -local_name_bytes: []const u8, -local_types: []const InternPool.Index, +string_bytes: []const u8, +locals: []const Local, table: []const Inst.Index, frame_locs: std.MultiArrayList(FrameLoc).Slice, @@ -1363,9 +1363,6 @@ pub const Inst = struct { /// Immediate (byte), register operands. /// Uses `ri` payload. ir, - /// Relative displacement operand. - /// Uses `reloc` payload. - rel, /// Register, memory operands. /// Uses `rx` payload with extra data of type `Memory`. rm, @@ -1411,21 +1408,18 @@ pub const Inst = struct { /// References another Mir instruction directly. /// Uses `inst` payload. inst, - /// Linker relocation - external function. - /// Uses `reloc` payload. - extern_fn_reloc, - /// Linker relocation - GOT indirection. - /// Uses `rx` payload with extra data of type `bits.SymbolOffset`. - got_reloc, - /// Linker relocation - direct reference. - /// Uses `rx` payload with extra data of type `bits.SymbolOffset`. - direct_reloc, - /// Linker relocation - imports table indirection (binding). - /// Uses `rx` payload with extra data of type `bits.SymbolOffset`. - import_reloc, - /// Linker relocation - threadlocal variable via GOT indirection. - /// Uses `rx` payload with extra data of type `bits.SymbolOffset`. - tlv_reloc, + /// References a nav. + /// Uses `nav` payload. + nav, + /// References an uav. + /// Uses `uav` payload. + uav, + /// References a lazy symbol. + /// Uses `lazy_sym` payload. + lazy_sym, + /// References an external symbol. + /// Uses `extern_func` payload. + extern_func, // Pseudo instructions: @@ -1560,9 +1554,6 @@ pub const Inst = struct { /// Uses `i64` payload. pseudo_dbg_arg_i_64, /// Local argument. - /// Uses `reloc` payload. - pseudo_dbg_arg_reloc, - /// Local argument. /// Uses `ro` payload. pseudo_dbg_arg_ro, /// Local argument. @@ -1589,9 +1580,6 @@ pub const Inst = struct { /// Uses `i64` payload. pseudo_dbg_var_i_64, /// Local variable. - /// Uses `reloc` payload. - pseudo_dbg_var_reloc, - /// Local variable. /// Uses `ro` payload. pseudo_dbg_var_ro, /// Local variable. @@ -1719,12 +1707,12 @@ pub const Inst = struct { return std.mem.sliceAsBytes(mir.extra[bytes.payload..])[0..bytes.len]; } }, - /// Relocation for the linker where: - /// * `sym_index` is the index of the target - /// * `off` is the offset from the target - reloc: bits.SymbolOffset, fa: bits.FrameAddr, ro: bits.RegisterOffset, + nav: bits.NavOffset, + uav: InternPool.Key.Ptr.BaseAddr.Uav, + lazy_sym: link.File.LazySymbol, + extern_func: Mir.NullTerminatedString, /// Debug line and column position line_column: struct { line: u32, @@ -1787,7 +1775,7 @@ pub const Inst = struct { pub const RegisterList = struct { bitset: BitSet, - const BitSet = IntegerBitSet(32); + const BitSet = std.bit_set.IntegerBitSet(32); const Self = @This(); pub const empty: RegisterList = .{ .bitset = .initEmpty() }; @@ -1826,6 +1814,22 @@ pub const RegisterList = struct { } }; +pub const NullTerminatedString = enum(u32) { + none = std.math.maxInt(u32), + _, + + pub fn toSlice(nts: NullTerminatedString, mir: *const Mir) ?[:0]const u8 { + if (nts == .none) return null; + const string_bytes = mir.string_bytes[@intFromEnum(nts)..]; + return string_bytes[0..std.mem.indexOfScalar(u8, string_bytes, 0).? :0]; + } +}; + +pub const Local = struct { + name: NullTerminatedString, + type: InternPool.Index, +}; + pub const Imm32 = struct { imm: u32, }; @@ -1861,11 +1865,10 @@ pub const Memory = struct { size: bits.Memory.Size, index: Register, scale: bits.Memory.Scale, - _: u14 = undefined, + _: u13 = undefined, }; pub fn encode(mem: bits.Memory) Memory { - assert(mem.base != .reloc or mem.mod != .off); return .{ .info = .{ .base = mem.base, @@ -1887,17 +1890,27 @@ pub const Memory = struct { .none, .table => undefined, .reg => |reg| @intFromEnum(reg), .frame => |frame_index| @intFromEnum(frame_index), - .reloc, .pcrel => |sym_index| sym_index, .rip_inst => |inst_index| inst_index, + .nav => |nav| @intFromEnum(nav), + .uav => |uav| @intFromEnum(uav.val), + .lazy_sym => |lazy_sym| @intFromEnum(lazy_sym.ty), + .extern_func => |extern_func| @intFromEnum(extern_func), }, .off = switch (mem.mod) { .rm => |rm| @bitCast(rm.disp), .off => |off| @truncate(off), }, - .extra = if (mem.mod == .off) - @intCast(mem.mod.off >> 32) - else - undefined, + .extra = switch (mem.mod) { + .rm => switch (mem.base) { + else => undefined, + .uav => |uav| @intFromEnum(uav.orig_ty), + .lazy_sym => |lazy_sym| @intFromEnum(lazy_sym.kind), + }, + .off => switch (mem.base) { + .reg => @intCast(mem.mod.off >> 32), + else => unreachable, + }, + }, }; } @@ -1915,9 +1928,11 @@ pub const Memory = struct { .reg => .{ .reg = @enumFromInt(mem.base) }, .frame => .{ .frame = @enumFromInt(mem.base) }, .table => .table, - .reloc => .{ .reloc = mem.base }, - .pcrel => .{ .pcrel = mem.base }, .rip_inst => .{ .rip_inst = mem.base }, + .nav => .{ .nav = @enumFromInt(mem.base) }, + .uav => .{ .uav = .{ .val = @enumFromInt(mem.base), .orig_ty = @enumFromInt(mem.extra) } }, + .lazy_sym => .{ .lazy_sym = .{ .kind = @enumFromInt(mem.extra), .ty = @enumFromInt(mem.base) } }, + .extern_func => .{ .extern_func = @enumFromInt(mem.base) }, }, .scale_index = switch (mem.info.index) { .none => null, @@ -1945,8 +1960,8 @@ pub const Memory = struct { pub fn deinit(mir: *Mir, gpa: std.mem.Allocator) void { mir.instructions.deinit(gpa); gpa.free(mir.extra); - gpa.free(mir.local_name_bytes); - gpa.free(mir.local_types); + gpa.free(mir.string_bytes); + gpa.free(mir.locals); gpa.free(mir.table); mir.frame_locs.deinit(gpa); mir.* = undefined; @@ -1970,16 +1985,15 @@ pub fn emit( const mod = zcu.navFileScope(nav).mod.?; var e: Emit = .{ .lower = .{ - .bin_file = lf, .target = &mod.resolved_target.result, .allocator = gpa, .mir = mir, .cc = fn_info.cc, .src_loc = src_loc, - .output_mode = comp.config.output_mode, - .link_mode = comp.config.link_mode, - .pic = mod.pic, }, + .bin_file = lf, + .pt = pt, + .pic = mod.pic, .atom_index = sym: { if (lf.cast(.elf)) |ef| break :sym try ef.zigObjectPtr().?.getOrCreateMetadataForNav(zcu, nav); if (lf.cast(.macho)) |mf| break :sym try mf.getZigObject().?.getOrCreateMetadataForNav(mf, nav); @@ -1992,6 +2006,7 @@ pub fn emit( }, .debug_output = debug_output, .code = code, + .prev_di_loc = .{ .line = func.lbrace_line, .column = func.lbrace_column, @@ -2002,7 +2017,12 @@ pub fn emit( }, }, .prev_di_pc = 0, + + .code_offset_mapping = .empty, + .relocs = .empty, + .table_relocs = .empty, }; + defer e.deinit(); e.emitMir() catch |err| switch (err) { error.LowerFail, error.EmitFail => return zcu.codegenFailMsg(nav, e.lower.err_msg.?), error.InvalidInstruction, error.CannotEncode => return zcu.codegenFail(nav, "emit MIR failed: {s} (Zig compiler bug)", .{@errorName(err)}), @@ -2010,6 +2030,62 @@ pub fn emit( }; } +pub fn emitLazy( + mir: Mir, + lf: *link.File, + pt: Zcu.PerThread, + src_loc: Zcu.LazySrcLoc, + lazy_sym: link.File.LazySymbol, + code: *std.ArrayListUnmanaged(u8), + debug_output: link.File.DebugInfoOutput, +) codegen.CodeGenError!void { + const zcu = pt.zcu; + const comp = zcu.comp; + const gpa = comp.gpa; + const mod = comp.root_mod; + var e: Emit = .{ + .lower = .{ + .target = &mod.resolved_target.result, + .allocator = gpa, + .mir = mir, + .cc = .auto, + .src_loc = src_loc, + }, + .bin_file = lf, + .pt = pt, + .pic = mod.pic, + .atom_index = sym: { + if (lf.cast(.elf)) |ef| break :sym ef.zigObjectPtr().?.getOrCreateMetadataForLazySymbol(ef, pt, lazy_sym) catch |err| + return zcu.codegenFailType(lazy_sym.ty, "{s} creating lazy symbol", .{@errorName(err)}); + if (lf.cast(.macho)) |mf| break :sym mf.getZigObject().?.getOrCreateMetadataForLazySymbol(mf, pt, lazy_sym) catch |err| + return zcu.codegenFailType(lazy_sym.ty, "{s} creating lazy symbol", .{@errorName(err)}); + if (lf.cast(.coff)) |cf| { + const atom = cf.getOrCreateAtomForLazySymbol(pt, lazy_sym) catch |err| + return zcu.codegenFailType(lazy_sym.ty, "{s} creating lazy symbol", .{@errorName(err)}); + break :sym cf.getAtom(atom).getSymbolIndex().?; + } + if (lf.cast(.plan9)) |p9f| break :sym p9f.getOrCreateAtomForLazySymbol(pt, lazy_sym) catch |err| + return zcu.codegenFailType(lazy_sym.ty, "{s} creating lazy symbol", .{@errorName(err)}); + unreachable; + }, + .debug_output = debug_output, + .code = code, + + .prev_di_loc = undefined, + .prev_di_pc = undefined, + + .code_offset_mapping = .empty, + .relocs = .empty, + .table_relocs = .empty, + }; + defer e.deinit(); + e.emitMir() catch |err| switch (err) { + error.LowerFail, error.EmitFail => return zcu.codegenFailTypeMsg(lazy_sym.ty, e.lower.err_msg.?), + error.InvalidInstruction, error.CannotEncode => return zcu.codegenFailType(lazy_sym.ty, "emit MIR failed: {s} (Zig compiler bug)", .{@errorName(err)}), + else => return zcu.codegenFailType(lazy_sym.ty, "emit MIR failed: {s}", .{@errorName(err)}), + }; +} + pub fn extraData(mir: Mir, comptime T: type, index: u32) struct { data: T, end: u32 } { const fields = std.meta.fields(T); var i: u32 = index; @@ -2039,9 +2115,10 @@ pub fn resolveFrameAddr(mir: Mir, frame_addr: bits.FrameAddr) bits.RegisterOffse return .{ .reg = frame_loc.base, .off = frame_loc.disp + frame_addr.off }; } -pub fn resolveFrameLoc(mir: Mir, mem: Memory) Memory { +pub fn resolveMemoryExtra(mir: Mir, payload: u32) Memory { + const mem = mir.extraData(Mir.Memory, payload).data; return switch (mem.info.base) { - .none, .reg, .table, .reloc, .pcrel, .rip_inst => mem, + .none, .reg, .table, .rip_inst, .nav, .uav, .lazy_sym, .extern_func => mem, .frame => if (mir.frame_locs.len > 0) .{ .info = .{ .base = .reg, @@ -2063,7 +2140,6 @@ const builtin = @import("builtin"); const encoder = @import("encoder.zig"); const std = @import("std"); -const IntegerBitSet = std.bit_set.IntegerBitSet; const InternPool = @import("../../InternPool.zig"); const Mir = @This(); const Register = bits.Register; diff --git a/src/arch/x86_64/bits.zig b/src/arch/x86_64/bits.zig index 63b5d4b238..53080598e5 100644 --- a/src/arch/x86_64/bits.zig +++ b/src/arch/x86_64/bits.zig @@ -4,6 +4,8 @@ const expect = std.testing.expect; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; +const InternPool = @import("../../InternPool.zig"); +const link = @import("../../link.zig"); const Mir = @import("Mir.zig"); /// EFLAGS condition codes @@ -750,20 +752,22 @@ pub const FrameAddr = struct { index: FrameIndex, off: i32 = 0 }; pub const RegisterOffset = struct { reg: Register, off: i32 = 0 }; -pub const SymbolOffset = struct { sym_index: u32, off: i32 = 0 }; +pub const NavOffset = struct { index: InternPool.Nav.Index, off: i32 = 0 }; pub const Memory = struct { base: Base = .none, mod: Mod = .{ .rm = .{} }, - pub const Base = union(enum(u3)) { + pub const Base = union(enum(u4)) { none, reg: Register, frame: FrameIndex, table, - reloc: u32, - pcrel: u32, rip_inst: Mir.Inst.Index, + nav: InternPool.Nav.Index, + uav: InternPool.Key.Ptr.BaseAddr.Uav, + lazy_sym: link.File.LazySymbol, + extern_func: Mir.NullTerminatedString, pub const Tag = @typeInfo(Base).@"union".tag_type.?; }; @@ -899,7 +903,10 @@ pub const Memory = struct { pub const Immediate = union(enum) { signed: i32, unsigned: u64, - reloc: SymbolOffset, + nav: NavOffset, + uav: InternPool.Key.Ptr.BaseAddr.Uav, + lazy_sym: link.File.LazySymbol, + extern_func: Mir.NullTerminatedString, pub fn u(x: u64) Immediate { return .{ .unsigned = x }; @@ -909,10 +916,6 @@ pub const Immediate = union(enum) { return .{ .signed = x }; } - pub fn rel(sym_off: SymbolOffset) Immediate { - return .{ .reloc = sym_off }; - } - pub fn format( imm: Immediate, comptime _: []const u8, @@ -921,7 +924,10 @@ pub const Immediate = union(enum) { ) @TypeOf(writer).Error!void { switch (imm) { inline else => |int| try writer.print("{d}", .{int}), - .reloc => |sym_off| try writer.print("Symbol({[sym_index]d}) + {[off]d}", sym_off), + .nav => |nav_off| try writer.print("Nav({d}) + {d}", .{ @intFromEnum(nav_off.nav), nav_off.off }), + .uav => |uav| try writer.print("Uav({d})", .{@intFromEnum(uav.val)}), + .lazy_sym => |lazy_sym| try writer.print("LazySym({s}, {d})", .{ @tagName(lazy_sym.kind), @intFromEnum(lazy_sym.ty) }), + .extern_func => |extern_func| try writer.print("ExternFunc({d})", .{@intFromEnum(extern_func)}), } } }; diff --git a/src/arch/x86_64/encoder.zig b/src/arch/x86_64/encoder.zig index cb1272fba0..8d07dce83a 100644 --- a/src/arch/x86_64/encoder.zig +++ b/src/arch/x86_64/encoder.zig @@ -138,7 +138,7 @@ pub const Instruction = struct { .moffs => true, .rip => false, .sib => |s| switch (s.base) { - .none, .frame, .table, .reloc, .pcrel, .rip_inst => false, + .none, .frame, .table, .rip_inst, .nav, .uav, .lazy_sym, .extern_func => false, .reg => |reg| reg.isClass(.segment), }, }; @@ -211,7 +211,7 @@ pub const Instruction = struct { .none, .imm => 0b00, .reg => |reg| @truncate(reg.enc() >> 3), .mem => |mem| switch (mem.base()) { - .none, .frame, .table, .reloc, .pcrel, .rip_inst => 0b00, // rsp, rbp, and rip are not extended + .none, .frame, .table, .rip_inst, .nav, .uav, .lazy_sym, .extern_func => 0b00, // rsp, rbp, and rip are not extended .reg => |reg| @truncate(reg.enc() >> 3), }, .bytes => unreachable, @@ -281,9 +281,14 @@ pub const Instruction = struct { .reg => |reg| try writer.print("{s}", .{@tagName(reg)}), .frame => |frame_index| try writer.print("{}", .{frame_index}), .table => try writer.print("Table", .{}), - .reloc => |sym_index| try writer.print("Symbol({d})", .{sym_index}), - .pcrel => |sym_index| try writer.print("PcRelSymbol({d})", .{sym_index}), .rip_inst => |inst_index| try writer.print("RipInst({d})", .{inst_index}), + .nav => |nav| try writer.print("Nav({d})", .{@intFromEnum(nav)}), + .uav => |uav| try writer.print("Uav({d})", .{@intFromEnum(uav.val)}), + .lazy_sym => |lazy_sym| try writer.print("LazySym({s}, {d})", .{ + @tagName(lazy_sym.kind), + @intFromEnum(lazy_sym.ty), + }), + .extern_func => |extern_func| try writer.print("ExternFunc({d})", .{@intFromEnum(extern_func)}), } if (mem.scaleIndex()) |si| { if (any) try writer.writeAll(" + "); @@ -718,11 +723,11 @@ pub const Instruction = struct { try encoder.modRm_indirectDisp32(operand_enc, 0); try encoder.disp32(undefined); } else return error.CannotEncode, - .reloc => if (@TypeOf(encoder).options.allow_symbols) { + .nav, .uav, .lazy_sym, .extern_func => if (@TypeOf(encoder).options.allow_symbols) { try encoder.modRm_indirectDisp32(operand_enc, 0); try encoder.disp32(undefined); } else return error.CannotEncode, - .pcrel, .rip_inst => { + .rip_inst => { try encoder.modRm_RIPDisp32(operand_enc); try encoder.disp32(sib.disp); }, diff --git a/src/codegen.zig b/src/codegen.zig index 9199c27dc2..a977d3003f 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -951,18 +951,17 @@ pub const GenResult = union(enum) { }; }; -fn genNavRef( +pub fn genNavRef( lf: *link.File, pt: Zcu.PerThread, src_loc: Zcu.LazySrcLoc, - val: Value, + ty: Type, nav_index: InternPool.Nav.Index, target: std.Target, ) CodeGenError!GenResult { const zcu = pt.zcu; const ip = &zcu.intern_pool; - const ty = val.typeOf(zcu); - log.debug("genNavRef: val = {}", .{val.fmtValue(pt)}); + log.debug("genNavRef: ty = {}", .{ty.fmt(pt)}); if (!ty.isFnOrHasRuntimeBitsIgnoreComptime(zcu)) { const imm: u64 = switch (@divExact(target.ptrBitWidth(), 8)) { @@ -991,12 +990,10 @@ fn genNavRef( } const nav = ip.getNav(nav_index); - assert(!nav.isThreadlocal(ip)); - - const lib_name, const linkage, const visibility = if (nav.getExtern(ip)) |e| - .{ e.lib_name, e.linkage, e.visibility } + const lib_name, const linkage, const is_threadlocal = if (nav.getExtern(ip)) |e| + .{ e.lib_name, e.linkage, e.is_threadlocal and !zcu.navFileScope(nav_index).mod.?.single_threaded } else - .{ .none, .internal, .default }; + .{ .none, .internal, false }; const name = nav.name; if (lf.cast(.elf)) |elf_file| { @@ -1004,6 +1001,7 @@ fn genNavRef( switch (linkage) { .internal => { const sym_index = try zo.getOrCreateMetadataForNav(zcu, nav_index); + if (is_threadlocal) zo.symbol(sym_index).flags.is_tls = true; return .{ .mcv = .{ .lea_symbol = sym_index } }; }, .strong, .weak => { @@ -1014,10 +1012,7 @@ fn genNavRef( .weak => zo.symbol(sym_index).flags.weak = true, .link_once => unreachable, } - switch (visibility) { - .default => zo.symbol(sym_index).flags.is_extern_ptr = true, - .hidden, .protected => {}, - } + if (is_threadlocal) zo.symbol(sym_index).flags.is_tls = true; return .{ .mcv = .{ .lea_symbol = sym_index } }; }, .link_once => unreachable, @@ -1027,8 +1022,8 @@ fn genNavRef( switch (linkage) { .internal => { const sym_index = try zo.getOrCreateMetadataForNav(macho_file, nav_index); - const sym = zo.symbols.items[sym_index]; - return .{ .mcv = .{ .lea_symbol = sym.nlist_idx } }; + if (is_threadlocal) zo.symbols.items[sym_index].flags.tlv = true; + return .{ .mcv = .{ .lea_symbol = sym_index } }; }, .strong, .weak => { const sym_index = try macho_file.getGlobalSymbol(name.toSlice(ip), lib_name.toSlice(ip)); @@ -1038,10 +1033,7 @@ fn genNavRef( .weak => zo.symbols.items[sym_index].flags.weak = true, .link_once => unreachable, } - switch (visibility) { - .default => zo.symbols.items[sym_index].flags.is_extern_ptr = true, - .hidden, .protected => {}, - } + if (is_threadlocal) zo.symbols.items[sym_index].flags.tlv = true; return .{ .mcv = .{ .lea_symbol = sym_index } }; }, .link_once => unreachable, @@ -1071,6 +1063,7 @@ fn genNavRef( } } +/// deprecated legacy code path pub fn genTypedValue( lf: *link.File, pt: Zcu.PerThread, @@ -1078,45 +1071,97 @@ pub fn genTypedValue( val: Value, target: std.Target, ) CodeGenError!GenResult { + const ip = &pt.zcu.intern_pool; + return switch (try lowerValue(pt, val, &target)) { + .none => .{ .mcv = .none }, + .undef => .{ .mcv = .undef }, + .immediate => |imm| .{ .mcv = .{ .immediate = imm } }, + .lea_nav => |nav| genNavRef(lf, pt, src_loc, .fromInterned(ip.getNav(nav).typeOf(ip)), nav, target), + .lea_uav => |uav| switch (try lf.lowerUav( + pt, + uav.val, + Type.fromInterned(uav.orig_ty).ptrAlignment(pt.zcu), + src_loc, + )) { + .mcv => |mcv| .{ .mcv = switch (mcv) { + else => unreachable, + .load_direct => |sym_index| .{ .lea_direct = sym_index }, + .load_symbol => |sym_index| .{ .lea_symbol = sym_index }, + } }, + .fail => |em| .{ .fail = em }, + }, + .load_uav => |uav| lf.lowerUav( + pt, + uav.val, + Type.fromInterned(uav.orig_ty).ptrAlignment(pt.zcu), + src_loc, + ), + }; +} + +const LowerResult = union(enum) { + none, + undef, + /// The bit-width of the immediate may be smaller than `u64`. For example, on 32-bit targets + /// such as ARM, the immediate will never exceed 32-bits. + immediate: u64, + lea_nav: InternPool.Nav.Index, + lea_uav: InternPool.Key.Ptr.BaseAddr.Uav, + load_uav: InternPool.Key.Ptr.BaseAddr.Uav, +}; + +pub fn lowerValue(pt: Zcu.PerThread, val: Value, target: *const std.Target) Allocator.Error!LowerResult { const zcu = pt.zcu; const ip = &zcu.intern_pool; const ty = val.typeOf(zcu); - log.debug("genTypedValue: val = {}", .{val.fmtValue(pt)}); + log.debug("lowerValue(@as({}, {}))", .{ ty.fmt(pt), val.fmtValue(pt) }); - if (val.isUndef(zcu)) return .{ .mcv = .undef }; + if (val.isUndef(zcu)) return .undef; switch (ty.zigTypeTag(zcu)) { - .void => return .{ .mcv = .none }, + .void => return .none, .pointer => switch (ty.ptrSize(zcu)) { .slice => {}, else => switch (val.toIntern()) { .null_value => { - return .{ .mcv = .{ .immediate = 0 } }; + return .{ .immediate = 0 }; }, else => switch (ip.indexToKey(val.toIntern())) { .int => { - return .{ .mcv = .{ .immediate = val.toUnsignedInt(zcu) } }; + return .{ .immediate = val.toUnsignedInt(zcu) }; }, .ptr => |ptr| if (ptr.byte_offset == 0) switch (ptr.base_addr) { - .nav => |nav| return genNavRef(lf, pt, src_loc, val, nav, target), - .uav => |uav| if (Value.fromInterned(uav.val).typeOf(zcu).hasRuntimeBits(zcu)) - return switch (try lf.lowerUav( - pt, - uav.val, - Type.fromInterned(uav.orig_ty).ptrAlignment(zcu), - src_loc, - )) { - .mcv => |mcv| return .{ .mcv = switch (mcv) { - .load_direct => |sym_index| .{ .lea_direct = sym_index }, - .load_symbol => |sym_index| .{ .lea_symbol = sym_index }, + .nav => |nav| { + if (!ty.isFnOrHasRuntimeBitsIgnoreComptime(zcu)) { + const imm: u64 = switch (@divExact(target.ptrBitWidth(), 8)) { + 1 => 0xaa, + 2 => 0xaaaa, + 4 => 0xaaaaaaaa, + 8 => 0xaaaaaaaaaaaaaaaa, else => unreachable, - } }, - .fail => |em| return .{ .fail = em }, + }; + return .{ .immediate = imm }; } + + if (ty.castPtrToFn(zcu)) |fn_ty| { + if (zcu.typeToFunc(fn_ty).?.is_generic) { + return .{ .immediate = fn_ty.abiAlignment(zcu).toByteUnits().? }; + } + } else if (ty.zigTypeTag(zcu) == .pointer) { + const elem_ty = ty.elemType2(zcu); + if (!elem_ty.hasRuntimeBits(zcu)) { + return .{ .immediate = elem_ty.abiAlignment(zcu).toByteUnits().? }; + } + } + + return .{ .lea_nav = nav }; + }, + .uav => |uav| if (Value.fromInterned(uav.val).typeOf(zcu).hasRuntimeBits(zcu)) + return .{ .lea_uav = uav } else - return .{ .mcv = .{ .immediate = Type.fromInterned(uav.orig_ty).ptrAlignment(zcu) - .forward(@intCast((@as(u66, 1) << @intCast(target.ptrBitWidth() | 1)) / 3)) } }, + return .{ .immediate = Type.fromInterned(uav.orig_ty).ptrAlignment(zcu) + .forward(@intCast((@as(u66, 1) << @intCast(target.ptrBitWidth() | 1)) / 3)) }, else => {}, }, else => {}, @@ -1130,39 +1175,35 @@ pub fn genTypedValue( .signed => @bitCast(val.toSignedInt(zcu)), .unsigned => val.toUnsignedInt(zcu), }; - return .{ .mcv = .{ .immediate = unsigned } }; + return .{ .immediate = unsigned }; } }, .bool => { - return .{ .mcv = .{ .immediate = @intFromBool(val.toBool()) } }; + return .{ .immediate = @intFromBool(val.toBool()) }; }, .optional => { if (ty.isPtrLikeOptional(zcu)) { - return genTypedValue( - lf, + return lowerValue( pt, - src_loc, - val.optionalValue(zcu) orelse return .{ .mcv = .{ .immediate = 0 } }, + val.optionalValue(zcu) orelse return .{ .immediate = 0 }, target, ); } else if (ty.abiSize(zcu) == 1) { - return .{ .mcv = .{ .immediate = @intFromBool(!val.isNull(zcu)) } }; + return .{ .immediate = @intFromBool(!val.isNull(zcu)) }; } }, .@"enum" => { const enum_tag = ip.indexToKey(val.toIntern()).enum_tag; - return genTypedValue( - lf, + return lowerValue( pt, - src_loc, Value.fromInterned(enum_tag.int), target, ); }, .error_set => { const err_name = ip.indexToKey(val.toIntern()).err.name; - const error_index = try pt.getErrorValue(err_name); - return .{ .mcv = .{ .immediate = error_index } }; + const error_index = ip.getErrorValueIfExists(err_name).?; + return .{ .immediate = error_index }; }, .error_union => { const err_type = ty.errorUnionSet(zcu); @@ -1171,20 +1212,16 @@ pub fn genTypedValue( // We use the error type directly as the type. const err_int_ty = try pt.errorIntType(); switch (ip.indexToKey(val.toIntern()).error_union.val) { - .err_name => |err_name| return genTypedValue( - lf, + .err_name => |err_name| return lowerValue( pt, - src_loc, Value.fromInterned(try pt.intern(.{ .err = .{ .ty = err_type.toIntern(), .name = err_name, } })), target, ), - .payload => return genTypedValue( - lf, + .payload => return lowerValue( pt, - src_loc, try pt.intValue(err_int_ty, 0), target, ), @@ -1204,7 +1241,10 @@ pub fn genTypedValue( else => {}, } - return lf.lowerUav(pt, val.toIntern(), .none, src_loc); + return .{ .load_uav = .{ + .val = val.toIntern(), + .orig_ty = (try pt.singleConstPtrType(ty)).toIntern(), + } }; } pub fn errUnionPayloadOffset(payload_ty: Type, zcu: *Zcu) u64 { diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig index 42d0d74ec5..0afe10ef03 100644 --- a/src/link/Dwarf.zig +++ b/src/link/Dwarf.zig @@ -1478,16 +1478,16 @@ pub const WipNav = struct { pub fn genLocalVarDebugInfo( wip_nav: *WipNav, tag: LocalVarTag, - name: []const u8, + opt_name: ?[]const u8, ty: Type, loc: Loc, ) UpdateError!void { assert(wip_nav.func != .none); try wip_nav.abbrevCode(switch (tag) { - .arg => .arg, - .local_var => .local_var, + .arg => if (opt_name) |_| .arg else .unnamed_arg, + .local_var => if (opt_name) |_| .local_var else unreachable, }); - try wip_nav.strp(name); + if (opt_name) |name| try wip_nav.strp(name); try wip_nav.refType(ty); try wip_nav.infoExprLoc(loc); wip_nav.any_children = true; @@ -1498,7 +1498,7 @@ pub const WipNav = struct { wip_nav: *WipNav, src_loc: Zcu.LazySrcLoc, tag: LocalConstTag, - name: []const u8, + opt_name: ?[]const u8, val: Value, ) UpdateError!void { assert(wip_nav.func != .none); @@ -1508,19 +1508,19 @@ pub const WipNav = struct { const has_runtime_bits = ty.hasRuntimeBits(zcu); const has_comptime_state = ty.comptimeOnly(zcu) and try ty.onePossibleValue(pt) == null; try wip_nav.abbrevCode(if (has_runtime_bits and has_comptime_state) switch (tag) { - .comptime_arg => .comptime_arg_runtime_bits_comptime_state, - .local_const => .local_const_runtime_bits_comptime_state, + .comptime_arg => if (opt_name) |_| .comptime_arg_runtime_bits_comptime_state else .unnamed_comptime_arg_runtime_bits_comptime_state, + .local_const => if (opt_name) |_| .local_const_runtime_bits_comptime_state else unreachable, } else if (has_comptime_state) switch (tag) { - .comptime_arg => .comptime_arg_comptime_state, - .local_const => .local_const_comptime_state, + .comptime_arg => if (opt_name) |_| .comptime_arg_comptime_state else .unnamed_comptime_arg_comptime_state, + .local_const => if (opt_name) |_| .local_const_comptime_state else unreachable, } else if (has_runtime_bits) switch (tag) { - .comptime_arg => .comptime_arg_runtime_bits, - .local_const => .local_const_runtime_bits, + .comptime_arg => if (opt_name) |_| .comptime_arg_runtime_bits else .unnamed_comptime_arg_runtime_bits, + .local_const => if (opt_name) |_| .local_const_runtime_bits else unreachable, } else switch (tag) { - .comptime_arg => .comptime_arg, - .local_const => .local_const, + .comptime_arg => if (opt_name) |_| .comptime_arg else .unnamed_comptime_arg, + .local_const => if (opt_name) |_| .local_const else unreachable, }); - try wip_nav.strp(name); + if (opt_name) |name| try wip_nav.strp(name); try wip_nav.refType(ty); if (has_runtime_bits) try wip_nav.blockValue(src_loc, val); if (has_comptime_state) try wip_nav.refValue(val); @@ -4945,10 +4945,15 @@ const AbbrevCode = enum { empty_inlined_func, inlined_func, arg, + unnamed_arg, comptime_arg, + unnamed_comptime_arg, comptime_arg_runtime_bits, + unnamed_comptime_arg_runtime_bits, comptime_arg_comptime_state, + unnamed_comptime_arg_comptime_state, comptime_arg_runtime_bits_comptime_state, + unnamed_comptime_arg_runtime_bits_comptime_state, local_var, local_const, local_const_runtime_bits, @@ -5734,6 +5739,13 @@ const AbbrevCode = enum { .{ .location, .exprloc }, }, }, + .unnamed_arg = .{ + .tag = .formal_parameter, + .attrs = &.{ + .{ .type, .ref_addr }, + .{ .location, .exprloc }, + }, + }, .comptime_arg = .{ .tag = .formal_parameter, .attrs = &.{ @@ -5742,6 +5754,13 @@ const AbbrevCode = enum { .{ .type, .ref_addr }, }, }, + .unnamed_comptime_arg = .{ + .tag = .formal_parameter, + .attrs = &.{ + .{ .const_expr, .flag_present }, + .{ .type, .ref_addr }, + }, + }, .comptime_arg_runtime_bits = .{ .tag = .formal_parameter, .attrs = &.{ @@ -5751,6 +5770,14 @@ const AbbrevCode = enum { .{ .const_value, .block }, }, }, + .unnamed_comptime_arg_runtime_bits = .{ + .tag = .formal_parameter, + .attrs = &.{ + .{ .const_expr, .flag_present }, + .{ .type, .ref_addr }, + .{ .const_value, .block }, + }, + }, .comptime_arg_comptime_state = .{ .tag = .formal_parameter, .attrs = &.{ @@ -5760,6 +5787,14 @@ const AbbrevCode = enum { .{ .ZIG_comptime_value, .ref_addr }, }, }, + .unnamed_comptime_arg_comptime_state = .{ + .tag = .formal_parameter, + .attrs = &.{ + .{ .const_expr, .flag_present }, + .{ .type, .ref_addr }, + .{ .ZIG_comptime_value, .ref_addr }, + }, + }, .comptime_arg_runtime_bits_comptime_state = .{ .tag = .formal_parameter, .attrs = &.{ @@ -5770,6 +5805,15 @@ const AbbrevCode = enum { .{ .ZIG_comptime_value, .ref_addr }, }, }, + .unnamed_comptime_arg_runtime_bits_comptime_state = .{ + .tag = .formal_parameter, + .attrs = &.{ + .{ .const_expr, .flag_present }, + .{ .type, .ref_addr }, + .{ .const_value, .block }, + .{ .ZIG_comptime_value, .ref_addr }, + }, + }, .local_var = .{ .tag = .variable, .attrs = &.{ diff --git a/src/link/Elf/Symbol.zig b/src/link/Elf/Symbol.zig index 31584ca406..843c23dca4 100644 --- a/src/link/Elf/Symbol.zig +++ b/src/link/Elf/Symbol.zig @@ -462,9 +462,6 @@ pub const Flags = packed struct { /// Whether the symbol is a TLS variable. is_tls: bool = false, - - /// Whether the symbol is an extern pointer (as opposed to function). - is_extern_ptr: bool = false, }; pub const Extra = struct { diff --git a/src/link/Elf/ZigObject.zig b/src/link/Elf/ZigObject.zig index 8478aad8c3..9d70caa632 100644 --- a/src/link/Elf/ZigObject.zig +++ b/src/link/Elf/ZigObject.zig @@ -1542,11 +1542,7 @@ pub fn updateNav( nav.name.toSlice(ip), @"extern".lib_name.toSlice(ip), ); - if (!ip.isFunctionType(@"extern".ty)) { - const sym = self.symbol(sym_index); - sym.flags.is_extern_ptr = true; - if (@"extern".is_threadlocal) sym.flags.is_tls = true; - } + if (@"extern".is_threadlocal) self.symbol(sym_index).flags.is_tls = true; if (self.dwarf) |*dwarf| dwarf: { var debug_wip_nav = try dwarf.initWipNav(pt, nav_index, sym_index) orelse break :dwarf; defer debug_wip_nav.deinit(); diff --git a/src/link/MachO/Symbol.zig b/src/link/MachO/Symbol.zig index 7493d3ceab..be126b0963 100644 --- a/src/link/MachO/Symbol.zig +++ b/src/link/MachO/Symbol.zig @@ -389,9 +389,6 @@ pub const Flags = packed struct { /// ZigObject specific flags /// Whether the symbol has a trampoline trampoline: bool = false, - - /// Whether the symbol is an extern pointer (as opposed to function). - is_extern_ptr: bool = false, }; pub const SectionFlags = packed struct(u8) { diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig index bd54be6caa..9b32bcde65 100644 --- a/src/link/MachO/ZigObject.zig +++ b/src/link/MachO/ZigObject.zig @@ -881,11 +881,7 @@ pub fn updateNav( const name = @"extern".name.toSlice(ip); const lib_name = @"extern".lib_name.toSlice(ip); const sym_index = try self.getGlobalSymbol(macho_file, name, lib_name); - if (!ip.isFunctionType(@"extern".ty)) { - const sym = &self.symbols.items[sym_index]; - sym.flags.is_extern_ptr = true; - if (@"extern".is_threadlocal) sym.flags.tlv = true; - } + if (@"extern".is_threadlocal) self.symbols.items[sym_index].flags.tlv = true; if (self.dwarf) |*dwarf| dwarf: { var debug_wip_nav = try dwarf.initWipNav(pt, nav_index, sym_index) orelse break :dwarf; defer debug_wip_nav.deinit(); diff --git a/src/target.zig b/src/target.zig index 02e64670d0..0cecc168f5 100644 --- a/src/target.zig +++ b/src/target.zig @@ -850,7 +850,7 @@ pub inline fn backendSupportsFeature(backend: std.builtin.CompilerBackend, compt }, .separate_thread => switch (backend) { .stage2_llvm => false, - .stage2_c, .stage2_wasm => true, + .stage2_c, .stage2_wasm, .stage2_x86_64 => true, // TODO: most self-hosted backends should be able to support this without too much work. else => false, }, -- cgit v1.2.3 From d312dfc1f21a9194dd06c1d45f653bdaf823d2f6 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Mon, 9 Jun 2025 02:36:32 -0400 Subject: codegen: make threadlocal logic consistent --- src/arch/x86_64/CodeGen.zig | 3 ++- src/arch/x86_64/Emit.zig | 28 ++++++++------------------ src/codegen.zig | 48 +++++++++----------------------------------- src/link/Elf/ZigObject.zig | 5 ++--- src/link/MachO/ZigObject.zig | 5 ++--- 5 files changed, 23 insertions(+), 66 deletions(-) (limited to 'src/codegen.zig') diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 5d2dd08de7..4a0113fe36 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -163354,7 +163354,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { }, .runtime_nav_ptr => { const ty_nav = air_datas[@intFromEnum(inst)].ty_nav; - const is_threadlocal = ip.getNav(ty_nav.nav).isThreadlocal(ip); + const nav = ip.getNav(ty_nav.nav); + const is_threadlocal = zcu.comp.config.any_non_single_threaded and nav.isThreadlocal(ip); if (is_threadlocal) if (cg.mod.pic) { try cg.spillRegisters(&.{ .rdi, .rax }); } else { diff --git a/src/arch/x86_64/Emit.zig b/src/arch/x86_64/Emit.zig index ff6bf85ef3..8a9609dafc 100644 --- a/src/arch/x86_64/Emit.zig +++ b/src/arch/x86_64/Emit.zig @@ -21,7 +21,8 @@ pub const Error = Lower.Error || error{ } || link.File.UpdateDebugInfoError; pub fn emitMir(emit: *Emit) Error!void { - const gpa = emit.bin_file.comp.gpa; + const comp = emit.bin_file.comp; + const gpa = comp.gpa; try emit.code_offset_mapping.resize(gpa, emit.lower.mir.instructions.len); emit.relocs.clearRetainingCapacity(); emit.table_relocs.clearRetainingCapacity(); @@ -99,12 +100,10 @@ pub fn emitMir(emit: *Emit) Error!void { .inst => |inst| .{ .index = inst, .is_extern = false, .type = .inst }, .table => .{ .index = undefined, .is_extern = false, .type = .table }, .nav => |nav| { - const ip = &emit.pt.zcu.intern_pool; const sym_index = switch (try codegen.genNavRef( emit.bin_file, emit.pt, emit.lower.src_loc, - .fromInterned(ip.getNav(nav).typeOf(ip)), nav, emit.lower.target.*, )) { @@ -118,12 +117,13 @@ pub fn emitMir(emit: *Emit) Error!void { return error.EmitFail; }, }; + const ip = &emit.pt.zcu.intern_pool; break :target switch (ip.getNav(nav).status) { .unresolved => unreachable, .type_resolved => |type_resolved| .{ .index = sym_index, .is_extern = false, - .type = if (type_resolved.is_threadlocal) .tlv else .symbol, + .type = if (type_resolved.is_threadlocal and comp.config.any_non_single_threaded) .tlv else .symbol, }, .fully_resolved => |fully_resolved| switch (ip.indexToKey(fully_resolved.val)) { .@"extern" => |@"extern"| .{ @@ -132,7 +132,7 @@ pub fn emitMir(emit: *Emit) Error!void { .default => true, .hidden, .protected => false, }, - .type = if (@"extern".is_threadlocal) .tlv else .symbol, + .type = if (@"extern".is_threadlocal and comp.config.any_non_single_threaded) .tlv else .symbol, .force_pcrel_direct = switch (@"extern".relocation) { .any => false, .pcrel => true, @@ -141,7 +141,7 @@ pub fn emitMir(emit: *Emit) Error!void { .variable => |variable| .{ .index = sym_index, .is_extern = false, - .type = if (variable.is_threadlocal) .tlv else .symbol, + .type = if (variable.is_threadlocal and comp.config.any_non_single_threaded) .tlv else .symbol, }, else => .{ .index = sym_index, .is_extern = false, .type = .symbol }, }, @@ -292,12 +292,8 @@ pub fn emitMir(emit: *Emit) Error!void { .branch, .tls => unreachable, .tlv => { if (emit.bin_file.cast(.elf)) |elf_file| { - if (reloc.target.is_extern) { - // TODO handle extern TLS vars, i.e., emit GD model - return emit.fail("TODO implement extern {s} reloc for {s}", .{ - @tagName(reloc.target.type), @tagName(emit.bin_file.tag), - }); - } else if (emit.pic) switch (lowered_inst.encoding.mnemonic) { + // TODO handle extern TLS vars, i.e., emit GD model + if (emit.pic) switch (lowered_inst.encoding.mnemonic) { .lea, .mov => { // Here, we currently assume local dynamic TLS vars, and so // we emit LD model. @@ -507,7 +503,6 @@ pub fn emitMir(emit: *Emit) Error!void { } }; }, .pseudo_dbg_arg_m, .pseudo_dbg_var_m => { - const ip = &emit.pt.zcu.intern_pool; const mem = emit.lower.mir.resolveMemoryExtra(mir_inst.data.x.payload).decode(); break :loc .{ .plus = .{ base: { @@ -519,7 +514,6 @@ pub fn emitMir(emit: *Emit) Error!void { emit.bin_file, emit.pt, emit.lower.src_loc, - .fromInterned(ip.getNav(nav).typeOf(ip)), nav, emit.lower.target.*, ) catch |err| switch (err) { @@ -803,9 +797,6 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI @tagName(reloc.target.type), @tagName(emit.bin_file.tag), }), .tls => if (emit.bin_file.cast(.elf)) |elf_file| { - if (reloc.target.is_extern) return emit.fail("TODO implement extern {s} reloc for {s}", .{ - @tagName(reloc.target.type), @tagName(emit.bin_file.tag), - }); const zo = elf_file.zigObjectPtr().?; const atom = zo.symbol(emit.atom_index).atom(elf_file).?; const r_type: std.elf.R_X86_64 = if (emit.pic) .TLSLD else unreachable; @@ -818,9 +809,6 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI @tagName(reloc.target.type), @tagName(emit.bin_file.tag), }), .tlv => if (emit.bin_file.cast(.elf)) |elf_file| { - if (reloc.target.is_extern) return emit.fail("TODO implement extern {s} reloc for {s}", .{ - @tagName(reloc.target.type), @tagName(emit.bin_file.tag), - }); const zo = elf_file.zigObjectPtr().?; const atom = zo.symbol(emit.atom_index).atom(elf_file).?; const r_type: std.elf.R_X86_64 = if (emit.pic) .DTPOFF32 else .TPOFF32; diff --git a/src/codegen.zig b/src/codegen.zig index a977d3003f..df9c0b4464 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -955,47 +955,18 @@ pub fn genNavRef( lf: *link.File, pt: Zcu.PerThread, src_loc: Zcu.LazySrcLoc, - ty: Type, nav_index: InternPool.Nav.Index, target: std.Target, ) CodeGenError!GenResult { const zcu = pt.zcu; const ip = &zcu.intern_pool; - log.debug("genNavRef: ty = {}", .{ty.fmt(pt)}); - - if (!ty.isFnOrHasRuntimeBitsIgnoreComptime(zcu)) { - const imm: u64 = switch (@divExact(target.ptrBitWidth(), 8)) { - 1 => 0xaa, - 2 => 0xaaaa, - 4 => 0xaaaaaaaa, - 8 => 0xaaaaaaaaaaaaaaaa, - else => unreachable, - }; - return .{ .mcv = .{ .immediate = imm } }; - } - - const comp = lf.comp; - const gpa = comp.gpa; - - // TODO this feels clunky. Perhaps we should check for it in `genTypedValue`? - if (ty.castPtrToFn(zcu)) |fn_ty| { - if (zcu.typeToFunc(fn_ty).?.is_generic) { - return .{ .mcv = .{ .immediate = fn_ty.abiAlignment(zcu).toByteUnits().? } }; - } - } else if (ty.zigTypeTag(zcu) == .pointer) { - const elem_ty = ty.elemType2(zcu); - if (!elem_ty.hasRuntimeBits(zcu)) { - return .{ .mcv = .{ .immediate = elem_ty.abiAlignment(zcu).toByteUnits().? } }; - } - } - const nav = ip.getNav(nav_index); + log.debug("genNavRef({})", .{nav.fqn.fmt(ip)}); + const lib_name, const linkage, const is_threadlocal = if (nav.getExtern(ip)) |e| - .{ e.lib_name, e.linkage, e.is_threadlocal and !zcu.navFileScope(nav_index).mod.?.single_threaded } + .{ e.lib_name, e.linkage, e.is_threadlocal and zcu.comp.config.any_non_single_threaded } else .{ .none, .internal, false }; - - const name = nav.name; if (lf.cast(.elf)) |elf_file| { const zo = elf_file.zigObjectPtr().?; switch (linkage) { @@ -1005,7 +976,7 @@ pub fn genNavRef( return .{ .mcv = .{ .lea_symbol = sym_index } }; }, .strong, .weak => { - const sym_index = try elf_file.getGlobalSymbol(name.toSlice(ip), lib_name.toSlice(ip)); + const sym_index = try elf_file.getGlobalSymbol(nav.name.toSlice(ip), lib_name.toSlice(ip)); switch (linkage) { .internal => unreachable, .strong => {}, @@ -1026,7 +997,7 @@ pub fn genNavRef( return .{ .mcv = .{ .lea_symbol = sym_index } }; }, .strong, .weak => { - const sym_index = try macho_file.getGlobalSymbol(name.toSlice(ip), lib_name.toSlice(ip)); + const sym_index = try macho_file.getGlobalSymbol(nav.name.toSlice(ip), lib_name.toSlice(ip)); switch (linkage) { .internal => unreachable, .strong => {}, @@ -1047,8 +1018,8 @@ pub fn genNavRef( return .{ .mcv = .{ .load_got = sym_index } }; }, .strong, .weak => { - const global_index = try coff_file.getGlobalSymbol(name.toSlice(ip), lib_name.toSlice(ip)); - try coff_file.need_got_table.put(gpa, global_index, {}); // needs GOT + const global_index = try coff_file.getGlobalSymbol(nav.name.toSlice(ip), lib_name.toSlice(ip)); + try coff_file.need_got_table.put(zcu.gpa, global_index, {}); // needs GOT return .{ .mcv = .{ .load_got = link.File.Coff.global_symbol_bit | global_index } }; }, .link_once => unreachable, @@ -1058,7 +1029,7 @@ pub fn genNavRef( const atom = p9.getAtom(atom_index); return .{ .mcv = .{ .memory = atom.getOffsetTableAddress(p9) } }; } else { - const msg = try ErrorMsg.create(gpa, src_loc, "TODO genNavRef for target {}", .{target}); + const msg = try ErrorMsg.create(zcu.gpa, src_loc, "TODO genNavRef for target {}", .{target}); return .{ .fail = msg }; } } @@ -1071,12 +1042,11 @@ pub fn genTypedValue( val: Value, target: std.Target, ) CodeGenError!GenResult { - const ip = &pt.zcu.intern_pool; return switch (try lowerValue(pt, val, &target)) { .none => .{ .mcv = .none }, .undef => .{ .mcv = .undef }, .immediate => |imm| .{ .mcv = .{ .immediate = imm } }, - .lea_nav => |nav| genNavRef(lf, pt, src_loc, .fromInterned(ip.getNav(nav).typeOf(ip)), nav, target), + .lea_nav => |nav| genNavRef(lf, pt, src_loc, nav, target), .lea_uav => |uav| switch (try lf.lowerUav( pt, uav.val, diff --git a/src/link/Elf/ZigObject.zig b/src/link/Elf/ZigObject.zig index 9d70caa632..71b42819e2 100644 --- a/src/link/Elf/ZigObject.zig +++ b/src/link/Elf/ZigObject.zig @@ -1142,7 +1142,6 @@ fn getNavShdrIndex( const gpa = elf_file.base.comp.gpa; const ptr_size = elf_file.ptrWidthBytes(); const ip = &zcu.intern_pool; - const any_non_single_threaded = elf_file.base.comp.config.any_non_single_threaded; const nav_val = zcu.navValue(nav_index); if (ip.isFunctionType(nav_val.typeOf(zcu).toIntern())) { if (self.text_index) |symbol_index| @@ -1162,7 +1161,7 @@ fn getNavShdrIndex( else => .{ true, false, nav_val.toIntern() }, }; const has_relocs = self.symbol(sym_index).atom(elf_file).?.relocs(elf_file).len > 0; - if (any_non_single_threaded and is_threadlocal) { + if (is_threadlocal and elf_file.base.comp.config.any_non_single_threaded) { const is_bss = !has_relocs and for (code) |byte| { if (byte != 0) break false; } else true; @@ -1542,7 +1541,7 @@ pub fn updateNav( nav.name.toSlice(ip), @"extern".lib_name.toSlice(ip), ); - if (@"extern".is_threadlocal) self.symbol(sym_index).flags.is_tls = true; + if (@"extern".is_threadlocal and elf_file.base.comp.config.any_non_single_threaded) self.symbol(sym_index).flags.is_tls = true; if (self.dwarf) |*dwarf| dwarf: { var debug_wip_nav = try dwarf.initWipNav(pt, nav_index, sym_index) orelse break :dwarf; defer debug_wip_nav.deinit(); diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig index 9b32bcde65..f9ecdc6fb5 100644 --- a/src/link/MachO/ZigObject.zig +++ b/src/link/MachO/ZigObject.zig @@ -881,7 +881,7 @@ pub fn updateNav( const name = @"extern".name.toSlice(ip); const lib_name = @"extern".lib_name.toSlice(ip); const sym_index = try self.getGlobalSymbol(macho_file, name, lib_name); - if (@"extern".is_threadlocal) self.symbols.items[sym_index].flags.tlv = true; + if (@"extern".is_threadlocal and macho_file.base.comp.config.any_non_single_threaded) self.symbols.items[sym_index].flags.tlv = true; if (self.dwarf) |*dwarf| dwarf: { var debug_wip_nav = try dwarf.initWipNav(pt, nav_index, sym_index) orelse break :dwarf; defer debug_wip_nav.deinit(); @@ -1154,7 +1154,6 @@ fn getNavOutputSection( ) error{OutOfMemory}!u8 { _ = self; const ip = &zcu.intern_pool; - const any_non_single_threaded = macho_file.base.comp.config.any_non_single_threaded; const nav_val = zcu.navValue(nav_index); if (ip.isFunctionType(nav_val.typeOf(zcu).toIntern())) return macho_file.zig_text_sect_index.?; const is_const, const is_threadlocal, const nav_init = switch (ip.indexToKey(nav_val.toIntern())) { @@ -1162,7 +1161,7 @@ fn getNavOutputSection( .@"extern" => |@"extern"| .{ @"extern".is_const, @"extern".is_threadlocal, .none }, else => .{ true, false, nav_val.toIntern() }, }; - if (any_non_single_threaded and is_threadlocal) { + if (is_threadlocal and macho_file.base.comp.config.any_non_single_threaded) { for (code) |byte| { if (byte != 0) break; } else return macho_file.getSectionByName("__DATA", "__thread_bss") orelse try macho_file.addSection( -- cgit v1.2.3 From afa07f723f956d78a4bd4c4be10ef04e86e50521 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Mon, 9 Jun 2025 09:05:58 -0400 Subject: x86_64: implement coff relocations --- src/arch/x86_64/CodeGen.zig | 6 +--- src/arch/x86_64/Emit.zig | 71 +++++++++++++++++++++++++++++++++++---------- src/codegen.zig | 4 +-- src/link/Coff.zig | 4 +-- 4 files changed, 61 insertions(+), 24 deletions(-) (limited to 'src/codegen.zig') diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 4a0113fe36..c652d48f3e 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -85269,11 +85269,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { .ret => try cg.airRet(inst, false), .ret_safe => try cg.airRet(inst, true), .ret_load => try cg.airRetLoad(inst), - .store, .store_safe => |air_tag| if (use_old) try cg.airStore(inst, switch (air_tag) { - else => unreachable, - .store => false, - .store_safe => true, - }) else fallback: { + .store, .store_safe => |air_tag| fallback: { const bin_op = air_datas[@intFromEnum(inst)].bin_op; const ptr_ty = cg.typeOf(bin_op.lhs); const ptr_info = ptr_ty.ptrInfo(zcu); diff --git a/src/arch/x86_64/Emit.zig b/src/arch/x86_64/Emit.zig index 8a9609dafc..e6b4ac26bb 100644 --- a/src/arch/x86_64/Emit.zig +++ b/src/arch/x86_64/Emit.zig @@ -107,10 +107,7 @@ pub fn emitMir(emit: *Emit) Error!void { nav, emit.lower.target.*, )) { - .mcv => |mcv| switch (mcv) { - else => std.debug.panic("{s}: {}\n", .{ @src().fn_name, mcv }), - .lea_symbol => |sym_index| sym_index, - }, + .mcv => |mcv| mcv.lea_symbol, .fail => |em| { assert(emit.lower.err_msg == null); emit.lower.err_msg = em; @@ -154,10 +151,7 @@ pub fn emitMir(emit: *Emit) Error!void { Type.fromInterned(uav.orig_ty).ptrAlignment(emit.pt.zcu), emit.lower.src_loc, )) { - .mcv => |mcv| switch (mcv) { - else => std.debug.panic("{s}: {}\n", .{ @src().fn_name, mcv }), - .load_direct, .load_symbol => |sym_index| sym_index, - }, + .mcv => |mcv| mcv.load_symbol, .fail => |em| { assert(emit.lower.err_msg == null); emit.lower.err_msg = em; @@ -207,7 +201,9 @@ pub fn emitMir(emit: *Emit) Error!void { switch (lowered_inst.encoding.mnemonic) { .call => { reloc.target.type = .branch; - try emit.encodeInst(lowered_inst, reloc_info); + if (emit.bin_file.cast(.coff)) |_| try emit.encodeInst(try .new(.none, .call, &.{ + .{ .mem = .initRip(.ptr, 0) }, + }, emit.lower.target), reloc_info) else try emit.encodeInst(lowered_inst, reloc_info); continue :lowered_inst; }, else => {}, @@ -284,6 +280,37 @@ pub fn emitMir(emit: *Emit) Error!void { }, emit.lower.target), reloc_info), else => unreachable, } + } else if (emit.bin_file.cast(.coff)) |_| { + if (reloc.target.is_extern) switch (lowered_inst.encoding.mnemonic) { + .lea => try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initRip(.ptr, 0) }, + }, emit.lower.target), reloc_info), + .mov => { + const dst_reg = lowered_inst.ops[0].reg.to64(); + try emit.encodeInst(try .new(.none, .mov, &.{ + .{ .reg = dst_reg }, + .{ .mem = .initRip(.ptr, 0) }, + }, emit.lower.target), reloc_info); + try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initSib(lowered_inst.ops[reloc.op_index].mem.sib.ptr_size, .{ .base = .{ + .reg = dst_reg, + } }) }, + }, emit.lower.target), &.{}); + }, + else => unreachable, + } else switch (lowered_inst.encoding.mnemonic) { + .lea => try emit.encodeInst(try .new(.none, .lea, &.{ + lowered_inst.ops[0], + .{ .mem = .initRip(.none, 0) }, + }, emit.lower.target), reloc_info), + .mov => try emit.encodeInst(try .new(.none, .mov, &.{ + lowered_inst.ops[0], + .{ .mem = .initRip(lowered_inst.ops[reloc.op_index].mem.sib.ptr_size, 0) }, + }, emit.lower.target), reloc_info), + else => unreachable, + } } else return emit.fail("TODO implement relocs for {s}", .{ @tagName(emit.bin_file.tag), }); @@ -751,6 +778,21 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI .symbolnum = @intCast(reloc.target.index), }, }); + } else if (emit.bin_file.cast(.coff)) |coff_file| { + const atom_index = coff_file.getAtomIndexForSymbol( + .{ .sym_index = emit.atom_index, .file = null }, + ).?; + try coff_file.addRelocation(atom_index, .{ + .type = if (reloc.target.is_extern) .got else .direct, + .target = if (reloc.target.is_extern) + coff_file.getGlobalByIndex(reloc.target.index) + else + .{ .sym_index = reloc.target.index, .file = null }, + .offset = end_offset - 4, + .addend = @intCast(reloc.off), + .pcrel = true, + .length = 2, + }); } else unreachable, .branch => if (emit.bin_file.cast(.elf)) |elf_file| { const zo = elf_file.zigObjectPtr().?; @@ -781,13 +823,12 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI const atom_index = coff_file.getAtomIndexForSymbol( .{ .sym_index = emit.atom_index, .file = null }, ).?; - const target: link.File.Coff.SymbolWithLoc = if (link.File.Coff.global_symbol_bit & reloc.target.index != 0) - coff_file.getGlobalByIndex(link.File.Coff.global_symbol_mask & reloc.target.index) - else - .{ .sym_index = reloc.target.index, .file = null }; try coff_file.addRelocation(atom_index, .{ - .type = .direct, - .target = target, + .type = if (reloc.target.is_extern) .import else .got, + .target = if (reloc.target.is_extern) + coff_file.getGlobalByIndex(reloc.target.index) + else + .{ .sym_index = reloc.target.index, .file = null }, .offset = end_offset - 4, .addend = @intCast(reloc.off), .pcrel = true, diff --git a/src/codegen.zig b/src/codegen.zig index df9c0b4464..9cc27b55ba 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -1015,12 +1015,12 @@ pub fn genNavRef( .internal => { const atom_index = try coff_file.getOrCreateAtomForNav(nav_index); const sym_index = coff_file.getAtom(atom_index).getSymbolIndex().?; - return .{ .mcv = .{ .load_got = sym_index } }; + return .{ .mcv = .{ .lea_symbol = sym_index } }; }, .strong, .weak => { const global_index = try coff_file.getGlobalSymbol(nav.name.toSlice(ip), lib_name.toSlice(ip)); try coff_file.need_got_table.put(zcu.gpa, global_index, {}); // needs GOT - return .{ .mcv = .{ .load_got = link.File.Coff.global_symbol_bit | global_index } }; + return .{ .mcv = .{ .lea_symbol = global_index } }; }, .link_once => unreachable, } diff --git a/src/link/Coff.zig b/src/link/Coff.zig index c9234b335d..0e00229b78 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -1767,7 +1767,7 @@ pub fn lowerUav( const atom = coff.getAtom(metadata.atom); const existing_addr = atom.getSymbol(coff).value; if (uav_alignment.check(existing_addr)) - return .{ .mcv = .{ .load_direct = atom.getSymbolIndex().? } }; + return .{ .mcv = .{ .load_symbol = atom.getSymbolIndex().? } }; } var name_buf: [32]u8 = undefined; @@ -1799,7 +1799,7 @@ pub fn lowerUav( .section = coff.rdata_section_index.?, }); return .{ .mcv = .{ - .load_direct = coff.getAtom(atom_index).getSymbolIndex().?, + .load_symbol = coff.getAtom(atom_index).getSymbolIndex().?, } }; } -- cgit v1.2.3