Page MenuHomePhabricator

[ARM64EC 12/?] Add param/ret attr for struct to help generate correct thunk for arm64ec
Needs ReviewPublic

Authored by bcl5980 on Aug 30 2022, 3:34 AM.

Details

Reviewers
efriedma
Summary

When we compile a function on Arm64EC, the function need arm64 function signature, and a corresponding x64 signature.
The frontend always generates the function with the arm64 signature, and thunk generation translates that to the x64 signature.
For now only from arm64 signature function type we can't translate all kinds of function to x64 signature.
So this change add a attribute to contain structure's original size to help thunk generation pass to generate correct x64 signature.

Diff Detail

Build Status
Buildable 188330

Event Timeline

bcl5980 created this revision.Aug 30 2022, 3:34 AM
bcl5980 requested review of this revision.Aug 30 2022, 3:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 30 2022, 3:34 AM
bcl5980 updated this revision to Diff 458079.Sep 5 2022, 7:29 PM

add getParamArm64ECArgX86SignBytes into function.h

bcl5980 updated this revision to Diff 458080.Sep 5 2022, 7:34 PM

Using "Sign" as an abbreviation for "Signature" is confusing. Avoid abbreviating if you can; if you think it's necessary, use "Sig" as shorthand for "Signature".

Not sure it's the right thing to put in the name of the attribute, though; the name of the attribute should probably mention it's the "size" of the argument. Maybe just arm64ec_arg_size().


This looks like it matches the approach I suggested.

clang/lib/CodeGen/CGCall.cpp
2338

Ty->isArrayType() will never be true; type promotion rules don't allow specifying an array as a function argument.

2340

Please use getTypeSizeInChars().

bcl5980 updated this revision to Diff 462382.Sep 22 2022, 8:03 PM

Rename the attribute to arm64ecargsize

bcl5980 marked 2 inline comments as done.Sep 22 2022, 8:04 PM