Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
|
Wow, that's kinda hacky, but does actually seem to work... I tried using a @beetrees do you have better ideas for how to handle this? The proposal here is kind of weird but with a solid comment maybe it's good enough? We do use |
|
The alternative here would be to keep track of whether (one of) the previous ZST argument(s) was an aligned ZST that needs padding and add the required padding to the next non-ZST argument. |
Played around with this, and it has an extremely subtle edge case of an over-aligned ZST before That makes for a good test case regardless. |
|
Would using |
|
It could perhaps but currently it hits the bottom rust/compiler/rustc_codegen_ssa/src/mir/block.rs Lines 2055 to 2072 in fbcff0a This is also where a cast to an empty |
There was a problem hiding this comment.
Can you extend the comment here with this second padding use?
rust/compiler/rustc_codegen_ssa/src/mir/block.rs
Lines 2055 to 2072 in fbcff0a
| // Use pointer indirection as padding for 16-byte-aligned ZSTs. | ||
| arg.make_indirect_from_ignore(); |
There was a problem hiding this comment.
| // Use pointer indirection as padding for 16-byte-aligned ZSTs. | |
| arg.make_indirect_from_ignore(); | |
| // Use pointer indirection as padding for over-aligned ZSTs. | |
| // | |
| // ZSTs are not passed (they have no data), but may be over-aligned, and when they | |
| // are aligned to 16 or more, that still matters for register alignment. So, add padding | |
| // to have the ZST argument start in an even-numbered register. | |
| // | |
| // This is (ab)using a mechanism that some other calling conventions use where | |
| // ZSTs are passed as pointers (to uninitialized memory). This is the least | |
| // awkward way to fit padding on a ZST into our logic. | |
| arg.make_indirect_from_ignore(); |
Let's expand this a bit, the above is a suggestion.
There was a problem hiding this comment.
Can you add a c-variadic test, the padding parameter should show up before the ... like in https://godbolt.org/z/5d4WfheW6. I'd add the 8-aligned version too to make it easier to compare.
Overall it might be good to add some 8-aligned negative tests.
|
Reminder, once the PR becomes ready for a review, use |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@rustbot ready |
Oof, I forgot to address this request. |
While ZSTs themselves are ignored, the paddings are not, so we use an indirection pointer to fill the argument list when a padding is needed.
callconv: mips64: match gcc for "alignment" of 16-byte-aligned ZSTs While ZSTs themselves are ignored, the paddings are not, so we use an indirection pointer to fill the argument list when padding is needed. Fix validated with abi-cafe. r? folkertdev
|
☔ The latest upstream changes (presumably #166507) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. This pull request was unapproved. |
While ZSTs themselves are ignored, the paddings are not, so we use an indirection pointer to fill the argument list when padding is needed.
Fix validated with abi-cafe.
r? folkertdev