[ARM64EC 4/?] Add LLVM support for varargs calling convention.
authorEli Friedman <efriedma@quicinc.com>
Mon, 5 Sep 2022 20:05:48 +0000 (13:05 -0700)
committerEli Friedman <efriedma@quicinc.com>
Mon, 5 Sep 2022 20:05:48 +0000 (13:05 -0700)
commit5637ec0983041b26cdcd2064d8ec6636f352e3c9
tree174fbb792606247088771d64512b79e996936e47
parent4658366d95d5e398baad956225cc4ba339d5b037
[ARM64EC 4/?] Add LLVM support for varargs calling convention.

Part of patchset to add initial support for ARM64EC.

The ARM64EC calling convention is the same as ARM64 for non-varargs
functions, but for varargs, the convention is significantly different.
Basically, only x0-x3 registers are used for passing arguments, and x4
and x5 describe the address/size of the arguments passed in memory. (See
https://docs.microsoft.com/en-us/windows/uwp/porting/arm64ec-abi for
more details; see
https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention for
the x64 calling convention rules, which this convention needs to match.)

Note that this currently doesn't handle i128 arguments correctly; as
noted in review, that's sort of complicated to handle, so I'm leaving it
for a followup.

Differential Revision: https://reviews.llvm.org/D125415
llvm/lib/Target/AArch64/AArch64CallingConvention.h
llvm/lib/Target/AArch64/AArch64CallingConvention.td
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp
llvm/test/CodeGen/AArch64/arm64ec-varargs.ll [new file with mode: 0644]