[PATCH] D126809: [ARM64EC 8/?] Implement ARM64EC "thunk" calling conventions
Daniel Paoliello via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 2 11:48:25 PDT 2022
dpaoliello added inline comments.
================
Comment at: llvm/include/llvm/IR/CallingConv.h:258
+ /// ARM64 register names. The first parameter is mapped to x9.
+ ARM64EC_Thunk_X64 = 102,
+
----------------
efriedma wrote:
> dpaoliello wrote:
> > When adding a calling convention, does it not also need to be added to the IR AsmWriter/AsmPrinter?
> If you don't add it to the asmparser/writer, there's some default handling that just uses the number, I think. But it might be better to give them proper names in IR.
>
> Alternatively, I was thinking about marking the calls using an attribute instead of a calling convention. Which is basically equivalent to using a calling convention, but doesn't consume calling convention numbers. Probably doesn't matter much in practice.
I think using a calling convention makes more sense, and should avoid these functions being accidentally treated like a normal function.
================
Comment at: llvm/lib/Target/AArch64/AArch64CallingConvention.td:263
+ // convention requires "this" to be passed in RCX.
+ // FIXME: Do we need a ARM64EC_Thunk_thiscall convention?
+ // CCIfCC<"CallingConv::X86_ThisCall",
----------------
mstorsjo wrote:
> efriedma wrote:
> > dpaoliello wrote:
> > > I'll get some clarification on this...
> > I copy-pasted the X86_ThisCall thing from the x86 code. It might be a red herring, though; I just looked at this in clang, and it looks like clang doesn't actually use the X86_ThisCall on x64 Windows, so this doesn't actually do anything, even in the original? I'm sort of confused how it ended up that way. Maybe can just delete it, though.
> >
> > I probably do need some handling for C++ methods, though, which I haven't implemented yet. (In particular, I need to ensure we emit the arguments for exit thunks for C++ methods in the correct order.)
> `thiscall` (similarly to `stdcall`, `fastcall` and `vectorcall`) are all no-ops on x86_64, they're only a thing on x86_32 windows.
`vectorcall` still exists for x64, however Arm64EC currently only supports standard x64 calling convention.
For now, I think we can drop the `thiscall` special case, but I will double check if it is required (we can always add it back later if so).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126809/new/
https://reviews.llvm.org/D126809
More information about the llvm-commits
mailing list