[llvm] [NFC][LLVM][Hexagon] Cleanup pass initialization for Hexagon (PR #134431)

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 4 15:31:26 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-hexagon

Author: Rahul Joshi (jurahul)

<details>
<summary>Changes</summary>

- Remove pass initialization calls from pass constructors.
- Move pass initialization and creation function declarations to Hexagon.h and remove them from individual .cpp files.
- Add calls for pass initialization in Hexagon target initialization.
- https://github.com/llvm/llvm-project/issues/111767

---

Patch is 48.19 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/134431.diff


37 Files Affected:

- (modified) llvm/lib/Target/Hexagon/Hexagon.h (+95-6) 
- (modified) llvm/lib/Target/Hexagon/HexagonBitSimplify.cpp (+4-19) 
- (modified) llvm/lib/Target/Hexagon/HexagonBranchRelaxation.cpp (+1-10) 
- (modified) llvm/lib/Target/Hexagon/HexagonCFGOptimizer.cpp (+1-10) 
- (modified) llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp (+3-9) 
- (modified) llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp (-5) 
- (modified) llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp (-7) 
- (modified) llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp (+1-8) 
- (modified) llvm/lib/Target/Hexagon/HexagonCopyToCombine.cpp (-6) 
- (modified) llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp (-7) 
- (modified) llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp (+2-14) 
- (modified) llvm/lib/Target/Hexagon/HexagonFixupHwLoops.cpp (+1-8) 
- (modified) llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp (+1-11) 
- (modified) llvm/lib/Target/Hexagon/HexagonGenExtract.cpp (+2-10) 
- (modified) llvm/lib/Target/Hexagon/HexagonGenInsert.cpp (+2-10) 
- (modified) llvm/lib/Target/Hexagon/HexagonGenMemAbsolute.cpp (+1-8) 
- (modified) llvm/lib/Target/Hexagon/HexagonGenMux.cpp (+1-7) 
- (modified) llvm/lib/Target/Hexagon/HexagonGenPredicate.cpp (+6-14) 
- (modified) llvm/lib/Target/Hexagon/HexagonHardwareLoops.cpp (+1-7) 
- (modified) llvm/lib/Target/Hexagon/HexagonLoadStoreWidening.cpp (+3-15) 
- (modified) llvm/lib/Target/Hexagon/HexagonLoopAlign.cpp (+2-8) 
- (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+2-12) 
- (modified) llvm/lib/Target/Hexagon/HexagonMask.cpp (+6-12) 
- (modified) llvm/lib/Target/Hexagon/HexagonNewValueJump.cpp (-7) 
- (modified) llvm/lib/Target/Hexagon/HexagonOptAddrMode.cpp (+1-7) 
- (modified) llvm/lib/Target/Hexagon/HexagonOptimizeSZextends.cpp (+1-8) 
- (modified) llvm/lib/Target/Hexagon/HexagonPeephole.cpp (+1-8) 
- (modified) llvm/lib/Target/Hexagon/HexagonRDFOpt.cpp (+1-7) 
- (modified) llvm/lib/Target/Hexagon/HexagonSplitConst32AndConst64.cpp (+2-9) 
- (modified) llvm/lib/Target/Hexagon/HexagonSplitDouble.cpp (+1-7) 
- (modified) llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp (+20-73) 
- (modified) llvm/lib/Target/Hexagon/HexagonTfrCleanup.cpp (+3-9) 
- (modified) llvm/lib/Target/Hexagon/HexagonVExtract.cpp (-5) 
- (modified) llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp (-7) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp (+1-5) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp (+2-11) 
- (modified) llvm/lib/Target/Hexagon/HexagonVectorPrint.cpp (+2-10) 


``````````diff
diff --git a/llvm/lib/Target/Hexagon/Hexagon.h b/llvm/lib/Target/Hexagon/Hexagon.h
index 4a290c798c27e..11b6f0d0d92ca 100644
--- a/llvm/lib/Target/Hexagon/Hexagon.h
+++ b/llvm/lib/Target/Hexagon/Hexagon.h
@@ -14,15 +14,104 @@
 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGON_H
 #define LLVM_LIB_TARGET_HEXAGON_HEXAGON_H
 
+#include "llvm/Support/CodeGen.h"
+
 namespace llvm {
-  class HexagonTargetMachine;
-  class ImmutablePass;
-  class PassRegistry;
+class HexagonTargetMachine;
+class ImmutablePass;
+class PassRegistry;
+class FunctionPass;
+class Pass;
+
+extern char &HexagonCopyHoistingID;
+extern char &HexagonExpandCondsetsID;
+extern char &HexagonTfrCleanupID;
+void initializeHexagonBitSimplifyPass(PassRegistry &);
+void initializeHexagonBranchRelaxationPass(PassRegistry &);
+void initializeHexagonCFGOptimizerPass(PassRegistry &);
+void initializeHexagonCommonGEPPass(PassRegistry &);
+void initializeHexagonCopyHoistingPass(PassRegistry &);
+void initializeHexagonConstExtendersPass(PassRegistry &);
+void initializeHexagonConstPropagationPass(PassRegistry &);
+void initializeHexagonCopyToCombinePass(PassRegistry &);
+void initializeHexagonDAGToDAGISelLegacyPass(PassRegistry &);
+void initializeHexagonEarlyIfConversionPass(PassRegistry &);
+void initializeHexagonExpandCondsetsPass(PassRegistry &);
+void initializeHexagonGenMemAbsolutePass(PassRegistry &);
+void initializeHexagonGenMuxPass(PassRegistry &);
+void initializeHexagonHardwareLoopsPass(PassRegistry &);
+void initializeHexagonLoopIdiomRecognizeLegacyPassPass(PassRegistry &);
+void initializeHexagonLoopAlignPass(PassRegistry &);
+void initializeHexagonLoopReschedulingPass(PassRegistry &);
+void initializeHexagonMaskPass(PassRegistry &);
+void initializeHexagonMergeActivateWeightPass(PassRegistry &);
+void initializeHexagonNewValueJumpPass(PassRegistry &);
+void initializeHexagonOptAddrModePass(PassRegistry &);
+void initializeHexagonPacketizerPass(PassRegistry &);
+void initializeHexagonRDFOptPass(PassRegistry &);
+void initializeHexagonSplitDoubleRegsPass(PassRegistry &);
+void initializeHexagonTfrCleanupPass(PassRegistry &);
+void initializeHexagonVExtractPass(PassRegistry &);
+void initializeHexagonVectorCombineLegacyPass(PassRegistry &);
+void initializeHexagonVectorLoopCarriedReuseLegacyPassPass(PassRegistry &);
+void initializeHexagonFixupHwLoopsPass(PassRegistry &);
+void initializeHexagonCallFrameInformationPass(PassRegistry &);
+void initializeHexagonGenExtractPass(PassRegistry &);
+void initializeHexagonGenInsertPass(PassRegistry &);
+void initializeHexagonGenPredicatePass(PassRegistry &);
+void initializeHexagonLoadWideningPass(PassRegistry &);
+void initializeHexagonStoreWideningPass(PassRegistry &);
+void initializeHexagonOptimizeSZextendsPass(PassRegistry &);
+void initializeHexagonPeepholePass(PassRegistry &);
+void initializeHexagonSplitConst32AndConst64Pass(PassRegistry &);
+void initializeHexagonVectorPrintPass(PassRegistry &);
+
+Pass *createHexagonLoopIdiomPass();
+Pass *createHexagonVectorLoopCarriedReuseLegacyPass();
+
+/// Creates a Hexagon-specific Target Transformation Info pass.
+ImmutablePass *
+createHexagonTargetTransformInfoPass(const HexagonTargetMachine *TM);
 
-  /// Creates a Hexagon-specific Target Transformation Info pass.
-  ImmutablePass *createHexagonTargetTransformInfoPass(const HexagonTargetMachine *TM);
+FunctionPass *createHexagonBitSimplify();
+FunctionPass *createHexagonBranchRelaxation();
+FunctionPass *createHexagonCallFrameInformation();
+FunctionPass *createHexagonCFGOptimizer();
+FunctionPass *createHexagonCommonGEP();
+FunctionPass *createHexagonConstExtenders();
+FunctionPass *createHexagonConstPropagationPass();
+FunctionPass *createHexagonCopyHoisting();
+FunctionPass *createHexagonCopyToCombine();
+FunctionPass *createHexagonEarlyIfConversion();
+FunctionPass *createHexagonFixupHwLoops();
+FunctionPass *createHexagonGenExtract();
+FunctionPass *createHexagonGenInsert();
+FunctionPass *createHexagonGenMemAbsolute();
+FunctionPass *createHexagonGenMux();
+FunctionPass *createHexagonGenPredicate();
+FunctionPass *createHexagonHardwareLoops();
+FunctionPass *createHexagonISelDag(HexagonTargetMachine &TM,
+                                   CodeGenOptLevel OptLevel);
+FunctionPass *createHexagonLoopAlign();
+FunctionPass *createHexagonLoopRescheduling();
+FunctionPass *createHexagonMask();
+FunctionPass *createHexagonMergeActivateWeight();
+FunctionPass *createHexagonNewValueJump();
+FunctionPass *createHexagonOptAddrMode();
+FunctionPass *createHexagonOptimizeSZextends();
+FunctionPass *createHexagonPacketizer(bool Minimal);
+FunctionPass *createHexagonPeephole();
+FunctionPass *createHexagonRDFOpt();
+FunctionPass *createHexagonSplitConst32AndConst64();
+FunctionPass *createHexagonSplitDoubleRegs();
+FunctionPass *createHexagonStoreWidening();
+FunctionPass *createHexagonLoadWidening();
+FunctionPass *createHexagonTfrCleanup();
+FunctionPass *createHexagonVectorCombineLegacyPass();
+FunctionPass *createHexagonVectorPrint();
+FunctionPass *createHexagonVExtract();
+FunctionPass *createHexagonExpandCondsets();
 
-  void initializeHexagonDAGToDAGISelLegacyPass(PassRegistry &);
 } // end namespace llvm;
 
 #endif
diff --git a/llvm/lib/Target/Hexagon/HexagonBitSimplify.cpp b/llvm/lib/Target/Hexagon/HexagonBitSimplify.cpp
index 7e8cee0d0bd55..3b7bd1cd1ba94 100644
--- a/llvm/lib/Target/Hexagon/HexagonBitSimplify.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonBitSimplify.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "BitTracker.h"
+#include "Hexagon.h"
 #include "HexagonBitTracker.h"
 #include "HexagonInstrInfo.h"
 #include "HexagonRegisterInfo.h"
@@ -50,13 +51,6 @@ static unsigned CountBitSplit = 0;
 static cl::opt<unsigned> RegisterSetLimit("hexbit-registerset-limit",
   cl::Hidden, cl::init(1000));
 
-namespace llvm {
-
-  void initializeHexagonBitSimplifyPass(PassRegistry& Registry);
-  FunctionPass *createHexagonBitSimplify();
-
-} // end namespace llvm
-
 namespace {
 
   // Set of virtual registers, based on BitVector.
@@ -2897,22 +2891,13 @@ bool HexagonBitSimplify::runOnMachineFunction(MachineFunction &MF) {
 //   r5:4 = memd(r0++#8)
 // }:endloop0
 
-namespace llvm {
-
-  FunctionPass *createHexagonLoopRescheduling();
-  void initializeHexagonLoopReschedulingPass(PassRegistry&);
-
-} // end namespace llvm
-
 namespace {
 
   class HexagonLoopRescheduling : public MachineFunctionPass {
   public:
     static char ID;
 
-    HexagonLoopRescheduling() : MachineFunctionPass(ID) {
-      initializeHexagonLoopReschedulingPass(*PassRegistry::getPassRegistry());
-    }
+    HexagonLoopRescheduling() : MachineFunctionPass(ID) {}
 
     bool runOnMachineFunction(MachineFunction &MF) override;
 
@@ -2957,8 +2942,8 @@ namespace {
 
 char HexagonLoopRescheduling::ID = 0;
 
-INITIALIZE_PASS(HexagonLoopRescheduling, "hexagon-loop-resched",
-  "Hexagon Loop Rescheduling", false, false)
+INITIALIZE_PASS(HexagonLoopRescheduling, "hexagon-loop-resched-pass",
+                "Hexagon Loop Rescheduling", false, false)
 
 HexagonLoopRescheduling::PhiInfo::PhiInfo(MachineInstr &P,
       MachineBasicBlock &B) {
diff --git a/llvm/lib/Target/Hexagon/HexagonBranchRelaxation.cpp b/llvm/lib/Target/Hexagon/HexagonBranchRelaxation.cpp
index ca7fddb0ebe51..4246603a0b929 100644
--- a/llvm/lib/Target/Hexagon/HexagonBranchRelaxation.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonBranchRelaxation.cpp
@@ -37,22 +37,13 @@ static cl::opt<uint32_t>
     BranchRelaxSafetyBuffer("branch-relax-safety-buffer", cl::init(200),
                             cl::Hidden, cl::desc("safety buffer size"));
 
-namespace llvm {
-
-  FunctionPass *createHexagonBranchRelaxation();
-  void initializeHexagonBranchRelaxationPass(PassRegistry&);
-
-} // end namespace llvm
-
 namespace {
 
   struct HexagonBranchRelaxation : public MachineFunctionPass {
   public:
     static char ID;
 
-    HexagonBranchRelaxation() : MachineFunctionPass(ID) {
-      initializeHexagonBranchRelaxationPass(*PassRegistry::getPassRegistry());
-    }
+    HexagonBranchRelaxation() : MachineFunctionPass(ID) {}
 
     bool runOnMachineFunction(MachineFunction &MF) override;
 
diff --git a/llvm/lib/Target/Hexagon/HexagonCFGOptimizer.cpp b/llvm/lib/Target/Hexagon/HexagonCFGOptimizer.cpp
index 7ec1b6a66d74a..1aa6690332366 100644
--- a/llvm/lib/Target/Hexagon/HexagonCFGOptimizer.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonCFGOptimizer.cpp
@@ -24,13 +24,6 @@ using namespace llvm;
 
 #define DEBUG_TYPE "hexagon_cfg"
 
-namespace llvm {
-
-FunctionPass *createHexagonCFGOptimizer();
-void initializeHexagonCFGOptimizerPass(PassRegistry&);
-
-} // end namespace llvm
-
 namespace {
 
 class HexagonCFGOptimizer : public MachineFunctionPass {
@@ -41,9 +34,7 @@ class HexagonCFGOptimizer : public MachineFunctionPass {
 public:
   static char ID;
 
-  HexagonCFGOptimizer() : MachineFunctionPass(ID) {
-    initializeHexagonCFGOptimizerPass(*PassRegistry::getPassRegistry());
-  }
+  HexagonCFGOptimizer() : MachineFunctionPass(ID) {}
 
   StringRef getPassName() const override { return "Hexagon CFG Optimizer"; }
   bool runOnMachineFunction(MachineFunction &Fn) override;
diff --git a/llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp b/llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
index ea16489da8cb1..102f1c65e16c6 100644
--- a/llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "Hexagon.h"
+
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/GraphTraits.h"
@@ -58,12 +60,6 @@ static cl::opt<bool> OptEnableInv("commgep-inv", cl::init(true), cl::Hidden);
 static cl::opt<bool> OptEnableConst("commgep-const", cl::init(true),
                                     cl::Hidden);
 
-namespace llvm {
-
-  void initializeHexagonCommonGEPPass(PassRegistry&);
-
-} // end namespace llvm
-
 namespace {
 
   struct GepNode;
@@ -97,9 +93,7 @@ namespace {
   public:
     static char ID;
 
-    HexagonCommonGEP() : FunctionPass(ID) {
-      initializeHexagonCommonGEPPass(*PassRegistry::getPassRegistry());
-    }
+    HexagonCommonGEP() : FunctionPass(ID) {}
 
     bool runOnFunction(Function &F) override;
     StringRef getPassName() const override { return "Hexagon Common GEP"; }
diff --git a/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp b/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp
index aaed78184b29d..d430b52bd138d 100644
--- a/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp
@@ -37,11 +37,6 @@ static cl::opt<unsigned>
     ReplaceLimit("hexagon-cext-limit", cl::init(0), cl::Hidden,
                  cl::desc("Maximum number of replacements"));
 
-namespace llvm {
-  void initializeHexagonConstExtendersPass(PassRegistry&);
-  FunctionPass *createHexagonConstExtenders();
-}
-
 static int32_t adjustUp(int32_t V, uint8_t A, uint8_t O) {
   assert(isPowerOf2_32(A));
   int32_t U = (V & -A) + O;
diff --git a/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp b/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp
index 04aac43a2ed02..a0a67bed45e74 100644
--- a/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp
@@ -1827,13 +1827,6 @@ bool MachineConstEvaluator::evaluateSplati(const APInt &A1, unsigned Bits,
 // ----------------------------------------------------------------------
 // Hexagon-specific code.
 
-namespace llvm {
-
-  FunctionPass *createHexagonConstPropagationPass();
-  void initializeHexagonConstPropagationPass(PassRegistry &Registry);
-
-} // end namespace llvm
-
 namespace {
 
   class HexagonConstEvaluator : public MachineConstEvaluator {
diff --git a/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp b/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp
index 7c18c524d2d64..3b810d0b65fab 100644
--- a/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp
@@ -28,20 +28,13 @@ using namespace llvm;
 static cl::opt<std::string> CPHoistFn("cphoistfn", cl::Hidden, cl::desc(""),
                                       cl::init(""));
 
-namespace llvm {
-void initializeHexagonCopyHoistingPass(PassRegistry &Registry);
-FunctionPass *createHexagonCopyHoisting();
-} // namespace llvm
-
 namespace {
 
 class HexagonCopyHoisting : public MachineFunctionPass {
 
 public:
   static char ID;
-  HexagonCopyHoisting() : MachineFunctionPass(ID), MFN(nullptr), MRI(nullptr) {
-    initializeHexagonCopyHoistingPass(*PassRegistry::getPassRegistry());
-  }
+  HexagonCopyHoisting() : MachineFunctionPass(ID), MFN(nullptr), MRI(nullptr) {}
 
   StringRef getPassName() const override { return "Hexagon Copy Hoisting"; }
 
diff --git a/llvm/lib/Target/Hexagon/HexagonCopyToCombine.cpp b/llvm/lib/Target/Hexagon/HexagonCopyToCombine.cpp
index 3b157006d9224..ab03433160d36 100644
--- a/llvm/lib/Target/Hexagon/HexagonCopyToCombine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonCopyToCombine.cpp
@@ -48,12 +48,6 @@ MaxNumOfInstsBetweenNewValueStoreAndTFR("max-num-inst-between-tfr-and-nv-store",
                    cl::desc("Maximum distance between a tfr feeding a store we "
                             "consider the store still to be newifiable"));
 
-namespace llvm {
-  FunctionPass *createHexagonCopyToCombine();
-  void initializeHexagonCopyToCombinePass(PassRegistry&);
-}
-
-
 namespace {
 
 class HexagonCopyToCombine : public MachineFunctionPass  {
diff --git a/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp b/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
index 9ddeb0565c764..14a7ae722954b 100644
--- a/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
@@ -91,13 +91,6 @@
 
 using namespace llvm;
 
-namespace llvm {
-
-  FunctionPass *createHexagonEarlyIfConversion();
-  void initializeHexagonEarlyIfConversionPass(PassRegistry& Registry);
-
-} // end namespace llvm
-
 static cl::opt<bool> EnableHexagonBP("enable-hexagon-br-prob", cl::Hidden,
   cl::init(true), cl::desc("Enable branch probability info"));
 static cl::opt<unsigned> SizeLimit("eif-limit", cl::init(6), cl::Hidden,
diff --git a/llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp b/llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp
index 3f5e068e65ebe..d09213d774cb4 100644
--- a/llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp
@@ -85,6 +85,7 @@
 // however, is that finding the locations where the implicit uses need
 // to be added, and updating the live ranges will be more involved.
 
+#include "Hexagon.h"
 #include "HexagonInstrInfo.h"
 #include "HexagonRegisterInfo.h"
 #include "llvm/ADT/DenseMap.h"
@@ -128,13 +129,6 @@ static cl::opt<unsigned> OptTfrLimit("expand-condsets-tfr-limit",
 static cl::opt<unsigned> OptCoaLimit("expand-condsets-coa-limit",
   cl::init(~0U), cl::Hidden, cl::desc("Max number of segment coalescings"));
 
-namespace llvm {
-
-  void initializeHexagonExpandCondsetsPass(PassRegistry&);
-  FunctionPass *createHexagonExpandCondsets();
-
-} // end namespace llvm
-
 namespace {
 
   class HexagonExpandCondsets : public MachineFunctionPass {
@@ -146,7 +140,6 @@ namespace {
         CoaLimitActive = true, CoaLimit = OptCoaLimit;
       if (OptTfrLimit.getPosition())
         TfrLimitActive = true, TfrLimit = OptTfrLimit;
-      initializeHexagonExpandCondsetsPass(*PassRegistry::getPassRegistry());
     }
 
     StringRef getPassName() const override { return "Hexagon Expand Condsets"; }
@@ -245,12 +238,7 @@ namespace {
 } // end anonymous namespace
 
 char HexagonExpandCondsets::ID = 0;
-
-namespace llvm {
-
-  char &HexagonExpandCondsetsID = HexagonExpandCondsets::ID;
-
-} // end namespace llvm
+char &llvm::HexagonExpandCondsetsID = HexagonExpandCondsets::ID;
 
 INITIALIZE_PASS_BEGIN(HexagonExpandCondsets, "expand-condsets",
   "Hexagon Expand Condsets", false, false)
diff --git a/llvm/lib/Target/Hexagon/HexagonFixupHwLoops.cpp b/llvm/lib/Target/Hexagon/HexagonFixupHwLoops.cpp
index 97a4b351af669..d55bc833c2e20 100644
--- a/llvm/lib/Target/Hexagon/HexagonFixupHwLoops.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonFixupHwLoops.cpp
@@ -28,19 +28,12 @@ static cl::opt<unsigned> MaxLoopRange(
     "hexagon-loop-range", cl::Hidden, cl::init(200),
     cl::desc("Restrict range of loopN instructions (testing only)"));
 
-namespace llvm {
-  FunctionPass *createHexagonFixupHwLoops();
-  void initializeHexagonFixupHwLoopsPass(PassRegistry&);
-}
-
 namespace {
   struct HexagonFixupHwLoops : public MachineFunctionPass {
   public:
     static char ID;
 
-    HexagonFixupHwLoops() : MachineFunctionPass(ID) {
-      initializeHexagonFixupHwLoopsPass(*PassRegistry::getPassRegistry());
-    }
+    HexagonFixupHwLoops() : MachineFunctionPass(ID) {}
 
     bool runOnMachineFunction(MachineFunction &MF) override;
 
diff --git a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
index a11452cb86cda..bad451eff1d85 100644
--- a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
@@ -196,23 +196,13 @@ static cl::opt<unsigned> SpillOptMax("spill-opt-max", cl::Hidden,
 static unsigned SpillOptCount = 0;
 #endif
 
-namespace llvm {
-
-  void initializeHexagonCallFrameInformationPass(PassRegistry&);
-  FunctionPass *createHexagonCallFrameInformation();
-
-} // end namespace llvm
-
 namespace {
 
   class HexagonCallFrameInformation : public MachineFunctionPass {
   public:
     static char ID;
 
-    HexagonCallFrameInformation() : MachineFunctionPass(ID) {
-      PassRegistry &PR = *PassRegistry::getPassRegistry();
-      initializeHexagonCallFrameInformationPass(PR);
-    }
+    HexagonCallFrameInformation() : MachineFunctionPass(ID) {}
 
     bool runOnMachineFunction(MachineFunction &MF) override;
 
diff --git a/llvm/lib/Target/Hexagon/HexagonGenExtract.cpp b/llvm/lib/Target/Hexagon/HexagonGenExtract.cpp
index 0f0788616860e..fcd0429eae8e9 100644
--- a/llvm/lib/Target/Hexagon/HexagonGenExtract.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonGenExtract.cpp
@@ -6,6 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "Hexagon.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/IR/BasicBlock.h"
@@ -46,22 +47,13 @@ static cl::opt<bool> NoSR0("extract-nosr0", cl::init(true), cl::Hidden,
 static cl::opt<bool> NeedAnd("extract-needand", cl::init(true), cl::Hidden,
   cl::desc("Require & in extract patterns"));
 
-namespace llvm {
-
-void initializeHexagonGenExtractPass(PassRegistry&);
-FunctionPass *createHexagonGenExtract();
-
-} // end namespace llvm
-
 namespace {
 
   class HexagonGenExtract : public FunctionPass {
   public:
     static char ID;
 
-    HexagonGenExtract() : FunctionPass(ID) {
-      initializeHexagonGenExtractPass(*PassRegistry::getPassRegistry());
-    }
+    HexagonGenExtract() : FunctionPass(ID) {}
 
     StringRef getPassName() const override {
       return "Hexagon generate \"extract\" instructions";
diff --git a/llvm/lib/Target/Hexagon/HexagonGenInsert.cpp b/llvm/lib/Target/Hexagon/HexagonGenInsert.cpp
index cc9485789d211..a9201460d8e2e 100644
--- a/llvm/lib/Target/Hexagon/HexagonGenInsert.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonGenInsert.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "BitTracker.h"
+#include "Hexagon.h"
 #include "HexagonBitTracker.h"
 #include "HexagonInstrInfo.h"
 #include "HexagonRegisterInfo.h"
@@ -493,22 +494,13 @@ namespace {
 
 } // end anonymous namespace
 
-namespace llvm {
-
-  void initializeHexagonGenInsertPass(PassRegistry&);
-  FunctionPass *createHexagonGenInsert();
-
-} // end namespace llvm
-
 namespace {
 
   class HexagonGenInsert : public MachineFunctionPass {
   public:
     static char ID;
 
-    HexagonGenInsert() : MachineFunctionPass(ID) {
-      initializeHexagonGenInsertPass(*PassRegistry::getPassRegistry());
-    }
+    HexagonGenInsert() : MachineFunctionPass(ID) {}
 
     StringRef getPassName() const override {
       return "Hexagon generate \"insert\" instructions";
diff --git a/llvm/lib/Target/Hexagon/HexagonGenMemAbsolute.cpp b/llvm/lib/Target/Hexagon/HexagonGenMemAbsolute.cpp
index 9aea7a9e07623..93418f7e15e8d 100644
--- a/llvm/lib/Target/Hexagon/HexagonGenM...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/134431


More information about the llvm-commits mailing list