This is an archive of the discontinued LLVM Phabricator instance.

[clang][aarch64] Add support for the MS qualifiers __ptr32, __ptr64, __sptr, __uptr for aarch64
AcceptedPublic

Authored by a_vorobev on Aug 25 2023, 9:10 AM.

Details

Reviewers
akhuang
rnk
Group Reviewers
Restricted Project
Summary

This is frontend patch for the issue : 62536 . This patch adds -p270:32:32-p271:32:32-p272:64:64 to the aarch64 data layout string, which are used in X86 for implementing mixed pointer sizes. This patch also changes the datalayout string in aarch64 backend target, because the datalayout specified in the frontend has to match the backend target datalayout.

Additionally, the patch adds changes to clang/basic/target/aarch64 for the correct size of the pointer and its address in the IR. The address spaces: 270,271 and 271 already choised in X86 platform.

Diff Detail

Event Timeline

a_vorobev created this revision.Aug 25 2023, 9:10 AM
a_vorobev requested review of this revision.Aug 25 2023, 9:10 AM
CynicRus retitled this revision from Add support for the MS qualifiers __ptr32, __ptr64, __sptr, __uptr for aarch64 to [clang][aarch64]Add support for the MS qualifiers __ptr32, __ptr64, __sptr, __uptr for aarch64.Aug 25 2023, 9:22 AM
a_vorobev retitled this revision from [clang][aarch64]Add support for the MS qualifiers __ptr32, __ptr64, __sptr, __uptr for aarch64 to [clang][aarch64] Add support for the MS qualifiers __ptr32, __ptr64, __sptr, __uptr for aarch64.Aug 25 2023, 9:23 AM
a_vorobev updated this revision to Diff 553518.Aug 25 2023, 9:33 AM
akhuang accepted this revision.Aug 28 2023, 11:22 AM

I think this looks good to me. I remember I also had to make this change to accept old datalayout strings https://reviews.llvm.org/D67631.

This revision is now accepted and ready to land.Aug 28 2023, 11:22 AM
rnk added a subscriber: efriedma.Aug 28 2023, 2:45 PM

+@efriedma, since I think we had that ongoing thread about what to do with i128 alignment in data layout. Is this a reasonable way to handle the datalayout migration?

If you don't have autoupgrade, that means you can't link IR built with older versions of LLVM to IR built with newer versions. llvm::UpgradeDataLayoutString is designed to fix this incompatibility. It's probably worth doing here given that it's relatively straightforward.

The issue with the i128 datalayout ugrade isn't the datalayout string itself, it's that the datalayout change affects existing code in a non-trivial way. That isn't really an issue here: there shouldn't be any existing AArch64 IR using address-space 270, so changing its meaning won't have any effect.