[llvm] [NFC][LLVM][Mips] Cleanup pass initialization for Mips (PR #134446)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 4 14:01:52 PDT 2025


https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/134446

- Remove calls to pass initialization from pass constructors.

>From 0ef51cbd044aa66f2e7dd3bcfcfe6ddb4ab4349b Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Fri, 4 Apr 2025 13:59:36 -0700
Subject: [PATCH] [NFC][LLVM][Mips] Cleanup pass initialization for Mips

- Remove calls to pass initialization from pass constructors.
---
 llvm/lib/Target/Mips/MipsBranchExpansion.cpp       |  5 ++---
 llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp       |  4 +---
 llvm/lib/Target/Mips/MipsMulMulBugPass.cpp         |  4 +---
 llvm/lib/Target/Mips/MipsPostLegalizerCombiner.cpp |  6 +-----
 llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp  | 10 +++-------
 5 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/llvm/lib/Target/Mips/MipsBranchExpansion.cpp b/llvm/lib/Target/Mips/MipsBranchExpansion.cpp
index eb7f3f8792bfb..8089972642bd3 100644
--- a/llvm/lib/Target/Mips/MipsBranchExpansion.cpp
+++ b/llvm/lib/Target/Mips/MipsBranchExpansion.cpp
@@ -135,9 +135,8 @@ class MipsBranchExpansion : public MachineFunctionPass {
 public:
   static char ID;
 
-  MipsBranchExpansion() : MachineFunctionPass(ID), ABI(MipsABIInfo::Unknown()) {
-    initializeMipsBranchExpansionPass(*PassRegistry::getPassRegistry());
-  }
+  MipsBranchExpansion()
+      : MachineFunctionPass(ID), ABI(MipsABIInfo::Unknown()) {}
 
   StringRef getPassName() const override {
     return "Mips Branch Expansion Pass";
diff --git a/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp b/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
index 258010d331181..7592634117dc1 100644
--- a/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
+++ b/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
@@ -208,9 +208,7 @@ namespace {
 
   class MipsDelaySlotFiller : public MachineFunctionPass {
   public:
-    MipsDelaySlotFiller() : MachineFunctionPass(ID) {
-      initializeMipsDelaySlotFillerPass(*PassRegistry::getPassRegistry());
-    }
+    MipsDelaySlotFiller() : MachineFunctionPass(ID) {}
 
     StringRef getPassName() const override { return "Mips Delay Slot Filler"; }
 
diff --git a/llvm/lib/Target/Mips/MipsMulMulBugPass.cpp b/llvm/lib/Target/Mips/MipsMulMulBugPass.cpp
index fdc797b30d5ed..5251c86d105b9 100644
--- a/llvm/lib/Target/Mips/MipsMulMulBugPass.cpp
+++ b/llvm/lib/Target/Mips/MipsMulMulBugPass.cpp
@@ -35,9 +35,7 @@ namespace {
 
 class MipsMulMulBugFix : public MachineFunctionPass {
 public:
-  MipsMulMulBugFix() : MachineFunctionPass(ID) {
-    initializeMipsMulMulBugFixPass(*PassRegistry::getPassRegistry());
-  }
+  MipsMulMulBugFix() : MachineFunctionPass(ID) {}
 
   StringRef getPassName() const override { return "Mips VR4300 mulmul bugfix"; }
 
diff --git a/llvm/lib/Target/Mips/MipsPostLegalizerCombiner.cpp b/llvm/lib/Target/Mips/MipsPostLegalizerCombiner.cpp
index 682d89018aec0..bb7482c5555ef 100644
--- a/llvm/lib/Target/Mips/MipsPostLegalizerCombiner.cpp
+++ b/llvm/lib/Target/Mips/MipsPostLegalizerCombiner.cpp
@@ -117,8 +117,6 @@ void MipsPostLegalizerCombiner::getAnalysisUsage(AnalysisUsage &AU) const {
 
 MipsPostLegalizerCombiner::MipsPostLegalizerCombiner(bool IsOptNone)
     : MachineFunctionPass(ID), IsOptNone(IsOptNone) {
-  initializeMipsPostLegalizerCombinerPass(*PassRegistry::getPassRegistry());
-
   if (!RuleConfig.parseCommandLineOption())
     report_fatal_error("Invalid rule identifier");
 }
@@ -157,8 +155,6 @@ INITIALIZE_PASS_END(MipsPostLegalizerCombiner, DEBUG_TYPE,
                     "Combine Mips machine instrs after legalization", false,
                     false)
 
-namespace llvm {
-FunctionPass *createMipsPostLegalizeCombiner(bool IsOptNone) {
+FunctionPass *llvm::createMipsPostLegalizeCombiner(bool IsOptNone) {
   return new MipsPostLegalizerCombiner(IsOptNone);
 }
-} // end namespace llvm
diff --git a/llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp b/llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp
index b94d61c9608bf..a1ae66ef09770 100644
--- a/llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp
+++ b/llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp
@@ -56,7 +56,6 @@ class MipsPreLegalizerCombinerImpl : public Combiner {
   }
 
   bool tryCombineAll(MachineInstr &MI) const override {
-
     switch (MI.getOpcode()) {
     default:
       return false;
@@ -110,9 +109,8 @@ void MipsPreLegalizerCombiner::getAnalysisUsage(AnalysisUsage &AU) const {
   MachineFunctionPass::getAnalysisUsage(AU);
 }
 
-MipsPreLegalizerCombiner::MipsPreLegalizerCombiner() : MachineFunctionPass(ID) {
-  initializeMipsPreLegalizerCombinerPass(*PassRegistry::getPassRegistry());
-}
+MipsPreLegalizerCombiner::MipsPreLegalizerCombiner()
+    : MachineFunctionPass(ID) {}
 
 bool MipsPreLegalizerCombiner::runOnMachineFunction(MachineFunction &MF) {
   if (MF.getProperties().hasProperty(
@@ -141,8 +139,6 @@ INITIALIZE_PASS_END(MipsPreLegalizerCombiner, DEBUG_TYPE,
                     "Combine Mips machine instrs before legalization", false,
                     false)
 
-namespace llvm {
-FunctionPass *createMipsPreLegalizeCombiner() {
+FunctionPass *llvm::createMipsPreLegalizeCombiner() {
   return new MipsPreLegalizerCombiner();
 }
-} // end namespace llvm



More information about the llvm-commits mailing list