-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[NFC][LLVM][PowerPC] Cleanup pass initialization for PowerPC #134422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
jurahul
commented
Apr 4, 2025
- Remove calls to pass initialization from pass constructors.
- [LLVM][Transforms] Remove calls to pass initialization from pass constructors #111767
- Remove calls to pass initialization from pass constructors.
@llvm/pr-subscribers-backend-powerpc Author: Rahul Joshi (jurahul) Changes
Full diff: https://github.com/llvm/llvm-project/pull/134422.diff 16 Files Affected:
diff --git a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
index a86da814f10e9..47bb20f4aa073 100644
--- a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
+++ b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
@@ -178,9 +178,7 @@ class PPCBoolRetToInt : public FunctionPass {
public:
static char ID;
- PPCBoolRetToInt() : FunctionPass(ID) {
- initializePPCBoolRetToIntPass(*PassRegistry::getPassRegistry());
- }
+ PPCBoolRetToInt() : FunctionPass(ID) {}
bool runOnFunction(Function &F) override {
if (skipFunction(F))
diff --git a/llvm/lib/Target/PowerPC/PPCBranchCoalescing.cpp b/llvm/lib/Target/PowerPC/PPCBranchCoalescing.cpp
index 53b2d2aa86246..3644e75609fc3 100644
--- a/llvm/lib/Target/PowerPC/PPCBranchCoalescing.cpp
+++ b/llvm/lib/Target/PowerPC/PPCBranchCoalescing.cpp
@@ -160,9 +160,7 @@ class PPCBranchCoalescing : public MachineFunctionPass {
public:
static char ID;
- PPCBranchCoalescing() : MachineFunctionPass(ID) {
- initializePPCBranchCoalescingPass(*PassRegistry::getPassRegistry());
- }
+ PPCBranchCoalescing() : MachineFunctionPass(ID) {}
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<MachineDominatorTreeWrapperPass>();
diff --git a/llvm/lib/Target/PowerPC/PPCBranchSelector.cpp b/llvm/lib/Target/PowerPC/PPCBranchSelector.cpp
index 92a73f945cbef..cc844f3417791 100644
--- a/llvm/lib/Target/PowerPC/PPCBranchSelector.cpp
+++ b/llvm/lib/Target/PowerPC/PPCBranchSelector.cpp
@@ -37,9 +37,7 @@ STATISTIC(NumPrefixedAligned,
namespace {
struct PPCBSel : public MachineFunctionPass {
static char ID;
- PPCBSel() : MachineFunctionPass(ID) {
- initializePPCBSelPass(*PassRegistry::getPassRegistry());
- }
+ PPCBSel() : MachineFunctionPass(ID) {}
// The sizes of the basic blocks in the function (the first
// element of the pair); the second element of the pair is the amount of the
diff --git a/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp b/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
index 47df85dcc9caa..1033f0ce68f89 100644
--- a/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
+++ b/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
@@ -57,9 +57,7 @@ class PPCCTRLoops : public MachineFunctionPass {
public:
static char ID;
- PPCCTRLoops() : MachineFunctionPass(ID) {
- initializePPCCTRLoopsPass(*PassRegistry::getPassRegistry());
- }
+ PPCCTRLoops() : MachineFunctionPass(ID) {}
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<MachineLoopInfoWrapperPass>();
diff --git a/llvm/lib/Target/PowerPC/PPCEarlyReturn.cpp b/llvm/lib/Target/PowerPC/PPCEarlyReturn.cpp
index cc4bed7b3dde2..8339c00aa975a 100644
--- a/llvm/lib/Target/PowerPC/PPCEarlyReturn.cpp
+++ b/llvm/lib/Target/PowerPC/PPCEarlyReturn.cpp
@@ -33,9 +33,7 @@ namespace {
// branch-to-blr sequences.
struct PPCEarlyReturn : public MachineFunctionPass {
static char ID;
- PPCEarlyReturn() : MachineFunctionPass(ID) {
- initializePPCEarlyReturnPass(*PassRegistry::getPassRegistry());
- }
+ PPCEarlyReturn() : MachineFunctionPass(ID) {}
const TargetInstrInfo *TII;
diff --git a/llvm/lib/Target/PowerPC/PPCExpandAtomicPseudoInsts.cpp b/llvm/lib/Target/PowerPC/PPCExpandAtomicPseudoInsts.cpp
index dd6ec293befc2..0e095cc692caa 100644
--- a/llvm/lib/Target/PowerPC/PPCExpandAtomicPseudoInsts.cpp
+++ b/llvm/lib/Target/PowerPC/PPCExpandAtomicPseudoInsts.cpp
@@ -32,9 +32,7 @@ class PPCExpandAtomicPseudo : public MachineFunctionPass {
const PPCRegisterInfo *TRI;
static char ID;
- PPCExpandAtomicPseudo() : MachineFunctionPass(ID) {
- initializePPCExpandAtomicPseudoPass(*PassRegistry::getPassRegistry());
- }
+ PPCExpandAtomicPseudo() : MachineFunctionPass(ID) {}
bool runOnMachineFunction(MachineFunction &MF) override;
diff --git a/llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp b/llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
index 26cca52c2c480..1df16dff7ccc7 100644
--- a/llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
+++ b/llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
@@ -221,13 +221,7 @@ namespace {
public:
static char ID; // Pass ID, replacement for typeid
- PPCLoopInstrFormPrep() : FunctionPass(ID) {
- initializePPCLoopInstrFormPrepPass(*PassRegistry::getPassRegistry());
- }
-
- PPCLoopInstrFormPrep(PPCTargetMachine &TM) : FunctionPass(ID), TM(&TM) {
- initializePPCLoopInstrFormPrepPass(*PassRegistry::getPassRegistry());
- }
+ PPCLoopInstrFormPrep(PPCTargetMachine &TM) : FunctionPass(ID), TM(&TM) {}
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addPreserved<DominatorTreeWrapperPass>();
diff --git a/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp b/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
index 1b6da5781ac6b..750fbb05547a1 100644
--- a/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
+++ b/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
@@ -112,9 +112,7 @@ struct PPCMIPeephole : public MachineFunctionPass {
MachineRegisterInfo *MRI;
LiveVariables *LV;
- PPCMIPeephole() : MachineFunctionPass(ID) {
- initializePPCMIPeepholePass(*PassRegistry::getPassRegistry());
- }
+ PPCMIPeephole() : MachineFunctionPass(ID) {}
private:
MachineDominatorTree *MDT;
diff --git a/llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp b/llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
index 67832e3583212..0d408a7c6bd66 100644
--- a/llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
+++ b/llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
@@ -95,9 +95,7 @@ static bool hasPCRelativeForm(MachineInstr &Use) {
class PPCPreEmitPeephole : public MachineFunctionPass {
public:
static char ID;
- PPCPreEmitPeephole() : MachineFunctionPass(ID) {
- initializePPCPreEmitPeepholePass(*PassRegistry::getPassRegistry());
- }
+ PPCPreEmitPeephole() : MachineFunctionPass(ID) {}
void getAnalysisUsage(AnalysisUsage &AU) const override {
MachineFunctionPass::getAnalysisUsage(AU);
diff --git a/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp b/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp
index 0bfcba9a52486..5445e3e53a4c1 100644
--- a/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp
+++ b/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp
@@ -104,6 +104,7 @@ static void addIncomingValuesToPHIs(MachineBasicBlock *Successor,
}
}
+namespace {
struct BlockSplitInfo {
MachineInstr *OrigBranch;
MachineInstr *SplitBefore;
@@ -127,6 +128,7 @@ struct BlockSplitInfo {
return true;
}
};
+} // end anonymous namespace
/// Splits a MachineBasicBlock to branch before \p SplitBefore. The original
/// branch is \p OrigBranch. The target of the new branch can either be the same
@@ -350,7 +352,6 @@ computeBranchTargetAndInversion(unsigned CROp, unsigned BROp, bool UsingDef1,
namespace {
class PPCReduceCRLogicals : public MachineFunctionPass {
-
public:
static char ID;
struct CRLogicalOpInfo {
@@ -405,9 +406,7 @@ class PPCReduceCRLogicals : public MachineFunctionPass {
}
public:
- PPCReduceCRLogicals() : MachineFunctionPass(ID) {
- initializePPCReduceCRLogicalsPass(*PassRegistry::getPassRegistry());
- }
+ PPCReduceCRLogicals() : MachineFunctionPass(ID) {}
MachineInstr *lookThroughCRCopy(unsigned Reg, unsigned &Subreg,
MachineInstr *&CpDef);
@@ -431,6 +430,7 @@ class PPCReduceCRLogicals : public MachineFunctionPass {
MachineFunctionPass::getAnalysisUsage(AU);
}
};
+} // end anonymous namespace
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void PPCReduceCRLogicals::CRLogicalOpInfo::dump() {
@@ -726,8 +726,6 @@ void PPCReduceCRLogicals::collectCRLogicals() {
}
}
-} // end anonymous namespace
-
INITIALIZE_PASS_BEGIN(PPCReduceCRLogicals, DEBUG_TYPE,
"PowerPC Reduce CR logical Operation", false, false)
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
diff --git a/llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp b/llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp
index 982ab941f0b40..9b6ea276e1303 100644
--- a/llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp
@@ -38,9 +38,7 @@ using namespace llvm;
namespace {
struct PPCTLSDynamicCall : public MachineFunctionPass {
static char ID;
- PPCTLSDynamicCall() : MachineFunctionPass(ID) {
- initializePPCTLSDynamicCallPass(*PassRegistry::getPassRegistry());
- }
+ PPCTLSDynamicCall() : MachineFunctionPass(ID) {}
const PPCInstrInfo *TII;
diff --git a/llvm/lib/Target/PowerPC/PPCTOCRegDeps.cpp b/llvm/lib/Target/PowerPC/PPCTOCRegDeps.cpp
index 31ebda66816a9..5a45df736fdc1 100644
--- a/llvm/lib/Target/PowerPC/PPCTOCRegDeps.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTOCRegDeps.cpp
@@ -80,11 +80,9 @@ namespace {
// branch-to-blr sequences.
struct PPCTOCRegDeps : public MachineFunctionPass {
static char ID;
- PPCTOCRegDeps() : MachineFunctionPass(ID) {
- initializePPCTOCRegDepsPass(*PassRegistry::getPassRegistry());
- }
+ PPCTOCRegDeps() : MachineFunctionPass(ID) {}
-protected:
+ protected:
bool hasTOCLoReloc(const MachineInstr &MI) {
if (MI.getOpcode() == PPC::LDtocL || MI.getOpcode() == PPC::ADDItocL8 ||
MI.getOpcode() == PPC::LWZtocL)
diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
index 5ee13a92cf993..2107153962f5c 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -561,7 +561,6 @@ void PPCPassConfig::addMachineSSAOptimization() {
void PPCPassConfig::addPreRegAlloc() {
if (getOptLevel() != CodeGenOptLevel::None) {
- initializePPCVSXFMAMutatePass(*PassRegistry::getPassRegistry());
insertPass(VSXFMAMutateEarly ? &RegisterCoalescerID : &MachineSchedulerID,
&PPCVSXFMAMutateID);
}
diff --git a/llvm/lib/Target/PowerPC/PPCVSXCopy.cpp b/llvm/lib/Target/PowerPC/PPCVSXCopy.cpp
index 0349a5929c106..794095cd43769 100644
--- a/llvm/lib/Target/PowerPC/PPCVSXCopy.cpp
+++ b/llvm/lib/Target/PowerPC/PPCVSXCopy.cpp
@@ -34,9 +34,7 @@ namespace {
// copies into subregister copies with other restrictions.
struct PPCVSXCopy : public MachineFunctionPass {
static char ID;
- PPCVSXCopy() : MachineFunctionPass(ID) {
- initializePPCVSXCopyPass(*PassRegistry::getPassRegistry());
- }
+ PPCVSXCopy() : MachineFunctionPass(ID) {}
const TargetInstrInfo *TII;
@@ -151,7 +149,7 @@ namespace {
MachineFunctionPass::getAnalysisUsage(AU);
}
};
-}
+ } // end anonymous namespace
INITIALIZE_PASS(PPCVSXCopy, DEBUG_TYPE,
"PowerPC VSX Copy Legalization", false, false)
diff --git a/llvm/lib/Target/PowerPC/PPCVSXFMAMutate.cpp b/llvm/lib/Target/PowerPC/PPCVSXFMAMutate.cpp
index e620637288eb6..9d7f2c4175ab6 100644
--- a/llvm/lib/Target/PowerPC/PPCVSXFMAMutate.cpp
+++ b/llvm/lib/Target/PowerPC/PPCVSXFMAMutate.cpp
@@ -55,9 +55,7 @@ namespace {
// copies into subregister copies with other restrictions.
struct PPCVSXFMAMutate : public MachineFunctionPass {
static char ID;
- PPCVSXFMAMutate() : MachineFunctionPass(ID) {
- initializePPCVSXFMAMutatePass(*PassRegistry::getPassRegistry());
- }
+ PPCVSXFMAMutate() : MachineFunctionPass(ID) {}
LiveIntervals *LIS;
const PPCInstrInfo *TII;
diff --git a/llvm/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp b/llvm/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp
index 573b30ccbcf2e..2bf05e7518803 100644
--- a/llvm/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp
+++ b/llvm/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp
@@ -110,9 +110,7 @@ struct PPCVSXSwapRemoval : public MachineFunctionPass {
// Swap entries are represented by their VSEId fields.
EquivalenceClasses<int> *EC;
- PPCVSXSwapRemoval() : MachineFunctionPass(ID) {
- initializePPCVSXSwapRemovalPass(*PassRegistry::getPassRegistry());
- }
+ PPCVSXSwapRemoval() : MachineFunctionPass(ID) {}
private:
// Initialize data structures.
@@ -211,6 +209,7 @@ struct PPCVSXSwapRemoval : public MachineFunctionPass {
return Changed;
}
};
+} // end anonymous namespace
// Initialize data structures for this pass. In particular, clear the
// swap vector and allocate the equivalence class mapping before
@@ -1061,8 +1060,6 @@ LLVM_DUMP_METHOD void PPCVSXSwapRemoval::dumpSwapVector() {
}
#endif
-} // end default namespace
-
INITIALIZE_PASS_BEGIN(PPCVSXSwapRemoval, DEBUG_TYPE,
"PowerPC VSX Swap Removal", false, false)
INITIALIZE_PASS_END(PPCVSXSwapRemoval, DEBUG_TYPE,
|
Friendly ping |
Adding @topperc and @s-barannikov as well. This is similar to other changes I made to other backends last week, so hoping one of you can approve. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks |
…4422) - Remove calls to pass initialization from pass constructors. - llvm#111767