Skip to content

[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

Merged
merged 1 commit into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/PowerPC/PPCBranchCoalescing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/PowerPC/PPCBranchSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/PowerPC/PPCEarlyReturn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/PowerPC/PPCExpandAtomicPseudoInsts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 1 addition & 7 deletions llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ struct PPCMIPeephole : public MachineFunctionPass {
MachineRegisterInfo *MRI;
LiveVariables *LV;

PPCMIPeephole() : MachineFunctionPass(ID) {
initializePPCMIPeepholePass(*PassRegistry::getPassRegistry());
}
PPCMIPeephole() : MachineFunctionPass(ID) {}

private:
MachineDominatorTree *MDT;
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 4 additions & 6 deletions llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ static void addIncomingValuesToPHIs(MachineBasicBlock *Successor,
}
}

namespace {
struct BlockSplitInfo {
MachineInstr *OrigBranch;
MachineInstr *SplitBefore;
Expand All @@ -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
Expand Down Expand Up @@ -350,7 +352,6 @@ computeBranchTargetAndInversion(unsigned CROp, unsigned BROp, bool UsingDef1,
namespace {

class PPCReduceCRLogicals : public MachineFunctionPass {

public:
static char ID;
struct CRLogicalOpInfo {
Expand Down Expand Up @@ -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);
Expand All @@ -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() {
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Target/PowerPC/PPCTOCRegDeps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,6 @@ void PPCPassConfig::addMachineSSAOptimization() {

void PPCPassConfig::addPreRegAlloc() {
if (getOptLevel() != CodeGenOptLevel::None) {
initializePPCVSXFMAMutatePass(*PassRegistry::getPassRegistry());
insertPass(VSXFMAMutateEarly ? &RegisterCoalescerID : &MachineSchedulerID,
&PPCVSXFMAMutateID);
}
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Target/PowerPC/PPCVSXCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -151,7 +149,7 @@ namespace {
MachineFunctionPass::getAnalysisUsage(AU);
}
};
}
} // end anonymous namespace

INITIALIZE_PASS(PPCVSXCopy, DEBUG_TYPE,
"PowerPC VSX Copy Legalization", false, false)
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/PowerPC/PPCVSXFMAMutate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 2 additions & 5 deletions llvm/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down