[clang][CodeGen] Factor out Swift ABI hooks (NFCI)
authorSergei Barannikov <barannikov88@gmail.com>
Sun, 7 Aug 2022 16:21:40 +0000 (00:21 +0800)
committerYingChi Long <me@inclyc.cn>
Sun, 7 Aug 2022 16:23:23 +0000 (00:23 +0800)
commit87dc7d4b619d9823b4d5d33bbc3ff3a193b9da2f
tree17a9df81204013d45b0bd5fd05a3df6155948365
parentdbff03b85840592fcfc97d1a10d4fad5f70e6aee
[clang][CodeGen] Factor out Swift ABI hooks (NFCI)

Swift calling conventions stands out in the way that they are lowered in
mostly target-independent manner, with very few customization points.
As such, swift-related methods of ABIInfo do not reference the rest of
ABIInfo and vice versa.
This change follows interface segregation principle; it removes
dependency of SwiftABIInfo on ABIInfo. Targets must now implement
SwiftABIInfo separately if they support Swift calling conventions.

Almost all targets implemented `shouldPassIndirectly` the same way. This
de-facto default implementation has been moved into the base class.

`isSwiftErrorInRegister` used to be virtual, now it is not. It didn't
accept any arguments which could have an effect on the returned value.
This is now a static property of the target ABI.

Reviewed By: rusyaev-roman, inclyc

Differential Revision: https://reviews.llvm.org/D130394
clang/lib/CodeGen/ABIInfo.h
clang/lib/CodeGen/SwiftCallingConv.cpp
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/CodeGen/TargetInfo.h