This is an archive of the discontinued LLVM Phabricator instance.

[clang] [AArch64] Fix Windows va_arg handling for larger structs
ClosedPublic

Authored by mstorsjo on Apr 13 2021, 2:51 AM.

Details

Summary

Aggregate types over 16 bytes are passed by reference.

Contrary to the x86_64 ABI, smaller structs with an odd (non power
of two) are padded and passed in registers.

I noted that I could clean up the rest of the test, sharing check patterns
that are identical, in a separate patch later.

Diff Detail

Event Timeline

mstorsjo created this revision.Apr 13 2021, 2:51 AM
mstorsjo requested review of this revision.Apr 13 2021, 2:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2021, 2:51 AM
rnk added inline comments.Apr 13 2021, 12:47 PM
clang/lib/CodeGen/TargetInfo.cpp
6115

Do we need to worry about H[VF]As passed to variadic functions, or is there a special case when passing those to variadics?

rnk accepted this revision.Apr 13 2021, 12:51 PM

lgtm

clang/lib/CodeGen/TargetInfo.cpp
6115

After looking at D100365, I'm assuming the answer is yes. It would be surprising if an HFA passed to a variadic function is passed in integer registers. I suppose it could be passed directly in memory instead of indirectly, but that also seems unlikely.

This revision is now accepted and ready to land.Apr 13 2021, 12:51 PM
mstorsjo added inline comments.Apr 13 2021, 1:11 PM
clang/lib/CodeGen/TargetInfo.cpp
6115

Looks like we don't handle them correctly either, both as fixed and variable arguments in vararg functions - I'll leave this patch uncommitted until I've got that one figured out to see if it should be amended to this one (probably) or warrants a separate patch.