llvm / clangir

A new (MLIR based) high-level IR for clang.
https://clangir.org
Other
327 stars 86 forks source link

[CIR][Lowering][CXXABI]lower var_arg op #570

Closed ghehg closed 3 months ago

ghehg commented 3 months ago

lowering var_arg op for ARM64 architecture. This is CIR lowering.

This PR modified LoweringPrepare CXXABI code to make LoweringPrepareArm64CXXABI class inherit more generic LoweringPrepareItaniumCXXABI, this way lowering var_arg would be only meaningful for arm64 targets and for other arch its no op for now.

The ABI doc and detailed algorithm description can be found in this official doc. https://github.com/ARM-software/abi-aa/blob/617079d8a0d45bec83d351974849483cf0cc66d5/aapcs64/aapcs64.rst#appendix-variable-argument-lists

The following pic is a easier-to-understand and close to lowered code explaination

Screenshot 2024-04-27 at 2 30 52 PM