[PATCH] D125412: [ARM64EC 2/?] Add target triple, and allow targeting it.

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 31 13:42:09 PDT 2022


mstorsjo added a comment.

In D125412#3548237 <https://reviews.llvm.org/D125412#3548237>, @dpaoliello wrote:

>> We could do something like arm64ec-pc-windows-msvc, I guess.  That sort of goes against the spirit of target triples: the first part is usually used to describe the instruction set, and the fourth part is usually used to describe alternate ABI/environment/etc.  It's not like "arm64ec" makes sense anywhere other than Windows, anyway.
>>
>> Of course, everything related to triples is a bit fuzzy; if we want to use AArch64SubArch_arm64ec, there isn't really anything stopping us.
>
> I would prefer it if we used a different first part to indicate that Arm64EC is a different "architecture" than AArch64.
>
> From a theoretical perspective, Arm64EC is a mix of AArch64 and x86_64: one can think of it as a weird processor that can run both AArch64 code (with some caveats, like the restricted registers) and x86_64 code, even if LLVM is only ever emitting AArch64 (which may not be true in the future if support for x86_64 assembly is added).
>
> From a practical perspective, MSVC uses a distinct set of architecture-specific preprocessor macros for Arm64EC vs AArch64: https://techcommunity.microsoft.com/t5/windows-kernel-internals-blog/getting-to-know-arm64ec-defines-and-intrinsic-functions/ba-p/2957235. Other languages should follow this pattern (i.e., disabling code that is targeted to AArch64 and instead enabling Arm64EC-specific code  - whether x86_64 code is also enabled is debatable), and having a different "architecture" part to the target-triple is an excellent way to signal this.

Veering slightly offtopic here, but - I'm curious - is it possible to link in regular aarch64 object files in an arm64ec executable (for functions where the calling convention doesn't differ from regular aarch64)? Those object files would only ever be called from arm64ec code (not from x86_64), so I wonder if it would work without all the thunks that are present in arm64ec object files. (In particular, the case I have in mind is cases with handwritten aarch64 assembly.) Would it be possible to mark such functions with a calling convention attribute on the C level, to let the compiler generate code for calling regular aarch64 functions?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125412/new/

https://reviews.llvm.org/D125412



More information about the llvm-commits mailing list