Function stackAlignment [src]

Prototype

pub fn stackAlignment(target: Target) u16

Parameters

target: Target

Source

pub fn stackAlignment(target: 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, .riscv64, => if (!Target.riscv.featureSetHas(target.cpu.features, .e)) return 16, .x86 => if (target.os.tag != .windows and target.os.tag != .uefi) return 16, .x86_64 => return if (target.os.tag == .elfiamcu) 4 else 16, else => {}, } return @divExact(target.ptrBitWidth(), 8); }