[PATCH] D148089: [clang][CodeGen] Break up TargetInfo.cpp [1/6]

Sergei Barannikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 12 03:34:21 PDT 2023


barannikov88 created this revision.
Herald added a subscriber: pengfei.
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.

`CCState` is a helper class originally used by the x86 implementation
but has since been abused by other implementations.
Remove this dependency by implementing customized versions of the class
for implementations that need such functionality.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148089

Files:
  clang/lib/CodeGen/TargetInfo.cpp


Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -9071,13 +9071,17 @@
 
 namespace {
 class LanaiABIInfo : public DefaultABIInfo {
+  struct CCState {
+    unsigned FreeRegs;
+  };
+
 public:
   LanaiABIInfo(CodeGen::CodeGenTypes &CGT) : DefaultABIInfo(CGT) {}
 
   bool shouldUseInReg(QualType Ty, CCState &State) const;
 
   void computeInfo(CGFunctionInfo &FI) const override {
-    CCState State(FI);
+    CCState State;
     // Lanai uses 4 registers to pass arguments unless the function has the
     // regparm attribute set.
     if (FI.getHasRegParm()) {
@@ -10092,6 +10096,10 @@
 namespace {
 
 class ARCABIInfo : public DefaultABIInfo {
+  struct CCState {
+    unsigned FreeRegs;
+  };
+
 public:
   using DefaultABIInfo::DefaultABIInfo;
 
@@ -10114,7 +10122,7 @@
   }
 
   void computeInfo(CGFunctionInfo &FI) const override {
-    CCState State(FI);
+    CCState State;
     // ARC uses 8 registers to pass arguments.
     State.FreeRegs = 8;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148089.512713.patch
Type: text/x-patch
Size: 1095 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230412/43d9ff52/attachment.bin>


More information about the cfe-commits mailing list