Function stackAlignment [src]

Prototype

pub fn stackAlignment(target: *const Target) u16

Parameters

target: *const Target

Source

pub fn stackAlignment(target: *const Target) u16 { // Overrides for when the stack alignment is not equal to the pointer width. switch (target.cpu.arch) { .m68k, => return 2, .amdgcn, => return 4, .arm, .armeb, .thumb, .thumbeb, .lanai, .mips, .mipsel, .sparc, => return 8, .aarch64, .aarch64_be, .bpfeb, .bpfel, .loongarch32, .loongarch64, .mips64, .mips64el, .sparc64, .ve, .wasm32, .wasm64, => return 16, // Some of the following prongs should really be testing the ABI, but our current `Abi` enum // can't handle that level of nuance yet. .powerpc64, .powerpc64le, => if (target.os.tag == .linux or target.os.tag == .aix) return 16, .riscv32, .riscv32be, .riscv64, .riscv64be, => if (!target.cpu.has(.riscv, .e)) return 16, .x86 => if (target.os.tag != .windows and target.os.tag != .uefi) return 16, .x86_64 => return 16, else => {}, } return @divExact(target.ptrBitWidth(), 8); }