CallingConvention
The calling convention of a function defines how arguments and return values are passed, as well as any other requirements which callers and callees must respect, such as register preservation and stack alignment.
This data structure is used by the Zig language code generation and therefore must be kept in sync with the compiler implementation.
Fields of this type
Fields
- auto:auto
- The default Zig calling convention when neither `export` nor `inline` is specified.
- async:async
- The calling convention of a function that can be called with `async` syntax.
- naked:naked
- Functions with this calling convention have no prologue or epilogue, making the function
- @"inline":@"inline"
- This calling convention is exactly equivalent to using the `inline` keyword on a function
- arm_aapcs:CommonOptions
- ARM Architecture Procedure Call Standard
- arm_aapcs_vfp:CommonOptions
- ARM Architecture Procedure Call Standard Vector Floating-Point
- wasm_mvp:CommonOptions
- The standard `wasm32` and `wasm64` calling convention, as specified in the WebAssembly Tool Conventions.
- arc_sysv:CommonOptions
- The standard `arc` calling convention.
- avr_gnu:avr_gnu
- avr_builtin:avr_builtin
- avr_signal:avr_signal
- avr_interrupt:avr_interrupt
- bpf_std:CommonOptions
- The standard `bpfel`/`bpfeb` calling convention.
- lanai_sysv:CommonOptions
- The standard `lanai` calling convention.
- loongarch64_lp64:CommonOptions
- The standard `loongarch64` calling convention.
- loongarch32_ilp32:CommonOptions
- The standard `loongarch32` calling convention.
- msp430_eabi:CommonOptions
- The standard `msp430` calling convention.
- or1k_sysv:CommonOptions
- The standard `or1k` calling convention.
- propeller_sysv:CommonOptions
- The standard `propeller` calling convention.
- ve_sysv:CommonOptions
- The standard `ve` calling convention.
- amdgcn_kernel:amdgcn_kernel
- nvptx_device:nvptx_device
- nvptx_kernel:nvptx_kernel
- spirv_device:spirv_device
- spirv_kernel:spirv_kernel
- spirv_fragment:spirv_fragment
- spirv_vertex:spirv_vertex
Options shared across most calling conventions.
Types
- CommonOptions
- Options shared across most calling conventions.
- X86RegparmOptions
- Options for x86 calling conventions which support the regparm attribute to pass some
- ArmInterruptOptions
- Options for the `arm_interrupt` calling convention.
- MipsInterruptOptions
- Options for the `mips_interrupt` and `mips64_interrupt` calling conventions.
- RiscvInterruptOptions
- Options for the `riscv32_interrupt` and `riscv64_interrupt` calling conventions.
Returns the array of `std.Target.Cpu.Arch` to which this `CallingConvention` applies.
Functions
- archs
- Returns the array of `std.Target.Cpu.Arch` to which this `CallingConvention` applies.
= @typeInfo(CallingConvention).@"union".tag_type.?
Values
- Tag
- = @typeInfo(CallingConvention).@"union".tag_type.?
- c
- This is an alias for the default C calling convention for this target.
- winapi
- = switch (builtin.target.cpu.arch) { .x86_64 => .{ .x86_64_win = .{} }, .x86 => .{ .x86_stdcall = .{} }, .aarch64 => .{ .aarch64_aapcs_win = .{} }, .thumb => .{ .arm_aapcs_vfp = .{} }, else => unreachable, }
- kernel
- = switch (builtin.target.cpu.arch) { .amdgcn => .amdgcn_kernel, .nvptx, .nvptx64 => .nvptx_kernel, .spirv32, .spirv64 => .spirv_kernel, else => unreachable, }