This is an archive of the discontinued LLVM Phabricator instance.

[ARM64] [Windows] Follow MS X86_64 C++ ABI when passing structs
ClosedPublic

Authored by ssijaric on Jul 24 2018, 4:38 PM.

Details

Summary

Microsoft's C++ object model for ARM64 is the same as that for X86_64. For example, small structs with non-trivial copy constructors or virtual function tables are passed indirectly. Currently, they are passed in registers when compiled with clang.

Diff Detail

Repository
rC Clang

Event Timeline

ssijaric created this revision.Jul 24 2018, 4:38 PM
mstorsjo accepted this revision.Jul 25 2018, 2:14 AM

This seems to be another case of all other arches being the same while x86_32 is different. The thumb case (with same actual code as x86_64) has a comment about a corner case where this doesn't match MSVC exactly, does that also apply here?

This revision is now accepted and ready to land.Jul 25 2018, 2:14 AM

Yes, it looks like the comment for the thumb case is applicable here as well. VC++ on ARM64 passes small structs with a destructor and a default copy constructor in a register, while clang passes them on the stack. I will probably address this in a separate patch.

ssijaric updated this revision to Diff 157394.Jul 25 2018, 4:57 PM

Updated to address Martin's observation. Verified that small structs with default copy constructors and non-trivial destructors are passed in registers on ARM64 Windows.

mstorsjo accepted this revision.Jul 25 2018, 9:43 PM

LGTM. Should the same tweak also be done for arm/thumb?

rnk accepted this revision.Jul 26 2018, 10:30 AM

Please avoid the extra enum case, and commit.

include/clang/Basic/TargetInfo.h
1223

This is poorly named. I'll try to send a patch to rename it after this lands.

1226–1227

IMO it'd be better to collapse these into something like CCK_MicrosoftWin64, since we don't treat them differently.

ssijaric updated this revision to Diff 157559.Jul 26 2018, 1:29 PM

Last change before committing to address Reid's point of using CCK_MicrosoftWin64 for Windows on both X86_64 and ARM64.

This revision was automatically updated to reflect the committed changes.