diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-10-14 07:57:11 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-10-19 19:15:23 +0100 |
| commit | ec19086aa0491024622c444b0d9310560de9e6f0 (patch) | |
| tree | 000cb85a1af4bf6fe1cb6d8dc40e3f1817e7e2dd /src/target.zig | |
| parent | bc797a97b1f7476b620567ff32b7a396ebdb4c9c (diff) | |
| download | zig-ec19086aa0491024622c444b0d9310560de9e6f0.tar.gz zig-ec19086aa0491024622c444b0d9310560de9e6f0.zip | |
compiler: remove @setAlignStack
This commit finishes implementing #21209 by removing the
`@setAlignStack` builtin in favour of `CallingConvention` payloads. The
x86_64 backend is updated to use the stack alignment given in the
calling convention (the LLVM backend was already updated in a previous
commit).
Resolves: #21209
Diffstat (limited to 'src/target.zig')
| -rw-r--r-- | src/target.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/target.zig b/src/target.zig index 7d30781f43..7a5c3387b6 100644 --- a/src/target.zig +++ b/src/target.zig @@ -607,3 +607,19 @@ pub inline fn backendSupportsFeature(backend: std.builtin.CompilerBackend, compt }, }; } + +pub fn stackAlignment(target: std.Target, cc: std.builtin.CallingConvention) u64 { + switch (cc) { + inline else => |payload| switch (@TypeOf(payload)) { + std.builtin.CallingConvention.CommonOptions, + std.builtin.CallingConvention.X86RegparmOptions, + std.builtin.CallingConvention.ArmInterruptOptions, + std.builtin.CallingConvention.MipsInterruptOptions, + std.builtin.CallingConvention.RiscvInterruptOptions, + => if (payload.incoming_stack_alignment) |a| return a, + void => {}, + else => comptime unreachable, + }, + } + return target.stackAlignment(); +} |
