[PATCH] D148092: [clang][CodeGen] Break up TargetInfo.cpp [4/6]
Sergei Barannikov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 12 03:34:58 PDT 2023
barannikov88 created this revision.
Herald added a project: All.
barannikov88 added reviewers: rjmccall, aaron.ballman, erichkeane.
barannikov88 published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Remove `getABIInfo` overrides returning references to target-specific
implementations of `ABIInfo`.
The methods may be convenient, but they are only used in one place and
prevent from `ABIInfo` implementations from being put into anonymous
namespaces in different cpp files.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D148092
Files:
clang/lib/CodeGen/TargetInfo.cpp
Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -2482,10 +2482,6 @@
std::make_unique<SwiftABIInfo>(CGT, /*SwiftErrorInRegister=*/true);
}
- const X86_64ABIInfo &getABIInfo() const {
- return static_cast<const X86_64ABIInfo&>(TargetCodeGenInfo::getABIInfo());
- }
-
/// Disable tail call on x86-64. The epilogue code before the tail jump blocks
/// autoreleaseRV/retainRV and autoreleaseRV/unsafeClaimRV optimizations.
bool markARCOptimizedReturnCallsAsNoTail() const override { return true; }
@@ -2522,7 +2518,8 @@
bool HasAVXType = false;
for (CallArgList::const_iterator
it = args.begin(), ie = args.end(); it != ie; ++it) {
- if (getABIInfo().isPassedUsingAVXType(it->Ty)) {
+ if (static_cast<const X86_64ABIInfo &>(TargetCodeGenInfo::getABIInfo())
+ .isPassedUsingAVXType(it->Ty)) {
HasAVXType = true;
break;
}
@@ -6404,10 +6401,6 @@
SwiftInfo = std::make_unique<ARMSwiftABIInfo>(CGT);
}
- const ARMABIInfo &getABIInfo() const {
- return static_cast<const ARMABIInfo&>(TargetCodeGenInfo::getABIInfo());
- }
-
int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const override {
return 13;
}
@@ -6426,7 +6419,9 @@
}
unsigned getSizeOfUnwindException() const override {
- if (getABIInfo().isEABI()) return 88;
+ if (static_cast<const ARMABIInfo &>(TargetCodeGenInfo::getABIInfo())
+ .isEABI())
+ return 88;
return TargetCodeGenInfo::getSizeOfUnwindException();
}
@@ -6493,7 +6488,7 @@
Fn->addFnAttr("interrupt", Kind);
- ARMABIKind ABI = cast<ARMABIInfo>(getABIInfo()).getABIKind();
+ ARMABIKind ABI = static_cast<const ARMABIInfo&>(getABIInfo()).getABIKind();
if (ABI == ARMABIKind::APCS)
return;
@@ -7431,10 +7426,6 @@
class SystemZTargetCodeGenInfo : public TargetCodeGenInfo {
ASTContext &Ctx;
- const SystemZABIInfo &getABIInfo() const {
- return static_cast<const SystemZABIInfo&>(TargetCodeGenInfo::getABIInfo());
- }
-
// These are used for speeding up the search for a visible vector ABI.
mutable bool HasVisibleVecABIFlag = false;
mutable std::set<const Type *> SeenTypes;
@@ -7884,7 +7875,9 @@
// be passed via "hidden" pointer where any extra alignment is not
// required (per GCC).
const Type *SingleEltTy =
- getABIInfo().GetSingleElementType(QualType(Ty, 0)).getTypePtr();
+ static_cast<const SystemZABIInfo &>(TargetCodeGenInfo::getABIInfo())
+ .GetSingleElementType(QualType(Ty, 0))
+ .getTypePtr();
bool SingleVecEltStruct = SingleEltTy != Ty && SingleEltTy->isVectorType() &&
Ctx.getTypeSize(SingleEltTy) == Ctx.getTypeSize(Ty);
if (Ty->isVectorType() || SingleVecEltStruct)
@@ -11836,10 +11829,6 @@
public:
BPFTargetCodeGenInfo(CodeGenTypes &CGT)
: TargetCodeGenInfo(std::make_unique<BPFABIInfo>(CGT)) {}
-
- const BPFABIInfo &getABIInfo() const {
- return static_cast<const BPFABIInfo&>(TargetCodeGenInfo::getABIInfo());
- }
};
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148092.512717.patch
Type: text/x-patch
Size: 3209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230412/5f95ec45/attachment.bin>
More information about the cfe-commits
mailing list