This is an archive of the discontinued LLVM Phabricator instance.

AArch64: add support for arm64_32 (ILP32) triple and -arch option.
AcceptedPublic

Authored by t.p.northover on May 15 2019, 4:49 AM.

Details

Reviewers
fhahn
Summary

This patch adds very basic support so that Clang can recognize "-arch arm64_32", translate it to Triple::aarch64_32, and instantiate at least some kind of CodeGen classes to get IR out the other end. The output will still be incorrect after this patch.

Diff Detail

Event Timeline

t.p.northover created this revision.May 15 2019, 4:49 AM

During upstreaming we've changed from detecting an "arm64_32" ArchName to using a Triple::aarch64_32 Arch. We recently discovered a bug that meant only AArch32 NEON types were permitted, which is fixed in this new revision.

Also, ping.

The subject has a typo, 23 instead of 32 ?

Oops, yes. I'll leave it wrong though, the best that could come out of any attempt to change it would be to split the thread on llvm-commits.

fhahn added a subscriber: fhahn.May 30 2019, 3:55 PM

Hi Tim. Would it be possible to split this in the 'trivial' changes (extending the triple handling for example) and the arm64_32 related changes to size, ABI stuff and so on? The trivial changes look good to me and by splitting them off people can focus on reviewing the more important changes.

clang/lib/Basic/Targets/AArch64.h
93 ↗(On Diff #200707)

Why is this needed? It seems unused in the diff?

t.p.northover marked an inline comment as done.Jun 11 2019, 4:14 AM

Thanks for the suggestion Florian, and sorry it's taken so long to act on it. I've split the patch up as you suggest, I'll make this one cover the Triple bits.

clang/lib/Basic/Targets/AArch64.h
93 ↗(On Diff #200707)

It's overriding a virtual function used to decide whether __int128 is allowed, and the default implementation checks the pointer width.

We're still AArch64 though so we can support __int128 just as well with 32-bit or 64-bit pointers.

This diff now only covers the trivial additions so that "arm64_32" is understood by the driver and creates AArch64 instantiations of relevant classes. Code generated is still wildly incorrect (not even ILP32 yet).

t.p.northover retitled this revision from AArch64: add support for arm64_23 (ILP32) IR generation to AArch64: add support for arm64_32 (ILP32) triple and -arch option..Jun 11 2019, 4:17 AM
t.p.northover edited the summary of this revision. (Show Details)
fhahn accepted this revision.Jun 11 2019, 6:18 AM

LGTM, thanks

This revision is now accepted and ready to land.Jun 11 2019, 6:18 AM