x86_64,riscv64: fix incorrect incoming_stack_alignment handling

The whole motivation behind this proposal in the first place was that
the LLVM backend disagrees with the self-hosted backends on what
`@setAlignStack` meant, so we can't just translate the old logic to the
new system! These backends can introduce support for overriding
`incoming_stack_alignment` later on.
This commit is contained in:
mlugg 2024-10-16 17:19:40 +01:00
parent cf39652500
commit 387965a696
No known key found for this signature in database
GPG Key ID: 3F5B7DCCBF4AF02E
3 changed files with 4 additions and 9 deletions

View File

@ -3607,7 +3607,8 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.builtin.CallingConvention) union(enu
else => false,
},
.stage2_x86_64 => switch (cc) {
.x86_64_sysv, .x86_64_win, .naked => true, // stack alignment supported
.x86_64_sysv, .x86_64_win => |opts| opts.incoming_stack_alignment == null,
.naked => true,
else => false,
},
.stage2_aarch64 => switch (cc) {

View File

@ -820,10 +820,7 @@ pub fn generate(
try function.frame_allocs.resize(gpa, FrameIndex.named_count);
function.frame_allocs.set(
@intFromEnum(FrameIndex.stack_frame),
FrameAlloc.init(.{
.size = 0,
.alignment = .fromByteUnits(target_util.stackAlignment(function.target.*, fn_type.fnCallingConvention(zcu))),
}),
FrameAlloc.init(.{ .size = 0, .alignment = .@"1" }),
);
function.frame_allocs.set(
@intFromEnum(FrameIndex.call_frame),

View File

@ -871,10 +871,7 @@ pub fn generate(
try function.frame_allocs.resize(gpa, FrameIndex.named_count);
function.frame_allocs.set(
@intFromEnum(FrameIndex.stack_frame),
FrameAlloc.init(.{
.size = 0,
.alignment = .fromByteUnits(target_util.stackAlignment(function.target.*, fn_type.fnCallingConvention(zcu))),
}),
FrameAlloc.init(.{ .size = 0, .alignment = .@"1" }),
);
function.frame_allocs.set(
@intFromEnum(FrameIndex.call_frame),