aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorSergei Barannikov <barannikov88@gmail.com>2023-04-29 18:22:44 +0300
committerSergei Barannikov <barannikov88@gmail.com>2023-05-19 23:55:15 +0300
commit0a86e05d1da0f544920b1eff6656c5577fb6562f (patch)
treeded545a44c29ad118e0db06d32ccd3cd3376aac9 /clang/lib/CodeGen/TargetInfo.cpp
parent940b02095bf986b5bcc365dc97667a27176c3b13 (diff)
downloadllvm-0a86e05d1da0f544920b1eff6656c5577fb6562f.zip
llvm-0a86e05d1da0f544920b1eff6656c5577fb6562f.tar.gz
llvm-0a86e05d1da0f544920b1eff6656c5577fb6562f.tar.bz2
[clang][CodeGen] Break up TargetInfo.cpp [4/8]
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. Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D148092
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp28
1 files changed, 7 insertions, 21 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index 4a44265..7cd22bf 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -2476,10 +2476,6 @@ public:
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; }
@@ -2516,7 +2512,7 @@ public:
bool HasAVXType = false;
for (CallArgList::const_iterator
it = args.begin(), ie = args.end(); it != ie; ++it) {
- if (getABIInfo().isPassedUsingAVXType(it->Ty)) {
+ if (getABIInfo<X86_64ABIInfo>().isPassedUsingAVXType(it->Ty)) {
HasAVXType = true;
break;
}
@@ -6388,10 +6384,6 @@ public:
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;
}
@@ -6410,7 +6402,8 @@ public:
}
unsigned getSizeOfUnwindException() const override {
- if (getABIInfo().isEABI()) return 88;
+ if (getABIInfo<ARMABIInfo>().isEABI())
+ return 88;
return TargetCodeGenInfo::getSizeOfUnwindException();
}
@@ -6477,7 +6470,7 @@ public:
Fn->addFnAttr("interrupt", Kind);
- ARMABIKind ABI = cast<ARMABIInfo>(getABIInfo()).getABIKind();
+ ARMABIKind ABI = getABIInfo<ARMABIInfo>().getABIKind();
if (ABI == ARMABIKind::APCS)
return;
@@ -7415,10 +7408,6 @@ public:
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;
@@ -7867,8 +7856,9 @@ bool SystemZTargetCodeGenInfo::isVectorTypeBased(const Type *Ty,
// it will be passed in a vector register. A wide (>16 bytes) vector will
// be passed via "hidden" pointer where any extra alignment is not
// required (per GCC).
- const Type *SingleEltTy =
- getABIInfo().GetSingleElementType(QualType(Ty, 0)).getTypePtr();
+ const Type *SingleEltTy = getABIInfo<SystemZABIInfo>()
+ .GetSingleElementType(QualType(Ty, 0))
+ .getTypePtr();
bool SingleVecEltStruct = SingleEltTy != Ty && SingleEltTy->isVectorType() &&
Ctx.getTypeSize(SingleEltTy) == Ctx.getTypeSize(Ty);
if (Ty->isVectorType() || SingleVecEltStruct)
@@ -11841,10 +11831,6 @@ class BPFTargetCodeGenInfo : public TargetCodeGenInfo {
public:
BPFTargetCodeGenInfo(CodeGenTypes &CGT)
: TargetCodeGenInfo(std::make_unique<BPFABIInfo>(CGT)) {}
-
- const BPFABIInfo &getABIInfo() const {
- return static_cast<const BPFABIInfo&>(TargetCodeGenInfo::getABIInfo());
- }
};
}