[PATCH] D130394: [clang][CodeGen] Factor out Swift ABI hooks

Sergei Barannikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 22 13:03:49 PDT 2022


barannikov88 created this revision.
Herald added a subscriber: dschuff.
Herald added a project: All.
barannikov88 requested review of this revision.
Herald added subscribers: cfe-commits, aheejin.
Herald added a project: clang.

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 factors out
swift-related stuff into separate class -- SwiftABIInfo -- which
targets must implement 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130394

Files:
  clang/lib/CodeGen/ABIInfo.h
  clang/lib/CodeGen/SwiftCallingConv.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/CodeGen/TargetInfo.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130394.446952.patch
Type: text/x-patch
Size: 24783 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220722/150b5d73/attachment-0001.bin>


More information about the cfe-commits mailing list