[PATCH] D148092: [clang][CodeGen] Break up TargetInfo.cpp [4/6]

Sergei Barannikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 29 09:52:01 PDT 2023


barannikov88 updated this revision to Diff 518191.
barannikov88 added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148092/new/

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
@@ -2483,10 +2483,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; }
@@ -2523,7 +2519,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)
@@ -11857,10 +11850,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.518191.patch
Type: text/x-patch
Size: 3209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230429/bb7be1e9/attachment.bin>


More information about the cfe-commits mailing list