feature. See also
. The project being documented here (as the example) is the Zig library itself.
Target.cCallingConvention
pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
File
Code
pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention {
return switch (target.cpu.arch) {
.x86_64 => switch (target.os.tag) {
.windows,
.uefi,
=> .{ .x86_64_win = .{} },
else => switch (target.abi) {
.gnux32, .muslx32, .x32 => .{ .x86_64_x32 = .{} },
else => .{ .x86_64_sysv = .{} },
},
},
.x86 => switch (target.os.tag) {
.windows,
.uefi,
=> .{ .x86_win = .{} },
else => .{ .x86_sysv = .{} },
},
.x86_16 => .{ .x86_16_cdecl = .{} },
.aarch64, .aarch64_be => if (target.os.tag.isDarwin())
.{ .aarch64_aapcs_darwin = .{} }
else switch (target.os.tag) {
.windows => .{ .aarch64_aapcs_win = .{} },
else => .{ .aarch64_aapcs = .{} },
},
.alpha => .{ .alpha_osf = .{} },
.arm, .armeb, .thumb, .thumbeb => switch (target.abi.float()) {
.soft => .{ .arm_aapcs = .{} },
.hard => .{ .arm_aapcs_vfp = .{} },
},
.mips64, .mips64el => switch (target.abi) {
.gnuabin32, .muslabin32, .abin32 => .{ .mips64_n32 = .{} },
else => .{ .mips64_n64 = .{} },
},
.mips, .mipsel => .{ .mips_o32 = .{} },
.riscv64, .riscv64be => .{ .riscv64_lp64 = .{} },
.riscv32, .riscv32be => .{ .riscv32_ilp32 = .{} },
.sparc64 => .{ .sparc64_sysv = .{} },
.sparc => .{ .sparc_sysv = .{} },
.powerpc64 => if (target.os.tag == .ps3 or target.abi.isGnu())
.{ .powerpc64_elf = .{} }
else
.{ .powerpc64_elf_v2 = .{} },
.powerpc64le => .{ .powerpc64_elf_v2 = .{} },
.powerpc, .powerpcle => .{ .powerpc_sysv = .{} },
.wasm32, .wasm64 => .{ .wasm_mvp = .{} },
.arc, .arceb => .{ .arc_sysv = .{} },
.avr => .avr_gnu,
.bpfel, .bpfeb => .{ .bpf_std = .{} },
.csky => .{ .csky_sysv = .{} },
.hexagon => .{ .hexagon_sysv = .{} },
.hppa => .{ .hppa_elf = .{} },
.hppa64 => .{ .hppa64_elf = .{} },
.kalimba => null,
.kvx => switch (target.abi) {
.ilp32 => .{ .kvx_ilp32 = .{} },
else => .{ .kvx_lp64 = .{} },
},
.lanai => .{ .lanai_sysv = .{} },
.loongarch64 => .{ .loongarch64_lp64 = .{} },
.loongarch32 => .{ .loongarch32_ilp32 = .{} },
.m68k => .{ .m68k_gnu = .{} },
.m88k => .{ .m88k_sysv = .{} },
.microblaze, .microblazeel => .{ .microblaze_std = .{} },
.msp430 => .{ .msp430_eabi = .{} },
.or1k => .{ .or1k_sysv = .{} },
.propeller => .{ .propeller_sysv = .{} },
.s390x => .{ .s390x_sysv = .{} },
.sh, .sheb => .{ .sh_gnu = .{} },
.ve => .{ .ve_sysv = .{} },
.xcore => .{ .xcore_xs1 = .{} },
.xtensa, .xtensaeb => .{ .xtensa_call0 = .{} },
.amdgcn => .{ .amdgcn_device = .{} },
.nvptx, .nvptx64 => .nvptx_device,
.spirv32, .spirv64 => .spirv_device,
.ez80 => .ez80_cet,
};
}