Skip to content
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

Fix missing tracing around load/store and move opt passes #40

Open
wants to merge 1 commit into
base: nanomips
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions llvm/lib/Target/Mips/Mips.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ namespace llvm {
void initializeNMOptimizeJumpTablesPass (PassRegistry&);
void initializeNanoMipsRegisterReAllocPass(PassRegistry &);
void initializeRedundantCopyEliminationPass(PassRegistry&);
void initializeNMLoadStoreOptPass(PassRegistry&);
void initializeNMMoveOptPass(PassRegistry&);
} // end namespace llvm;

#endif
2 changes: 2 additions & 0 deletions llvm/lib/Target/Mips/MipsTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMipsTarget() {
initializeMipsPreLegalizerCombinerPass(*PR);
initializeNMOptimizeJumpTablesPass(*PR);
initializeRedundantCopyEliminationPass(*PR);
initializeNMLoadStoreOptPass(*PR);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did we previously register the pass with pass manager? Do you need to remove that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was not explicitly registered, which was the problem. It was just created and added in the MipsPassConfig::addPreSched2() -- so it was run, but otherwise the pass manager didn't know about it.

initializeNMMoveOptPass(*PR);
}

static std::string computeDataLayout(const Triple &TT, StringRef CPU,
Expand Down
7 changes: 5 additions & 2 deletions llvm/lib/Target/Mips/NanoMipsLoadStoreOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

using namespace llvm;

#define NM_LOAD_STORE_OPT_NAME "nanoMIPS load/store optimization pass"
#define PASS_NAME "nanoMIPS load/store optimization pass"
#define DEBUG_TYPE "nmloadstoreopt"

static cl::opt<bool>
DisableNMSaveRestore("disable-nm-save-restore", cl::Hidden, cl::init(false),
Expand Down Expand Up @@ -60,7 +61,7 @@ struct NMLoadStoreOpt : public MachineFunctionPass {
MCRegisterClass RC = MipsMCRegisterClasses[Mips::GPR32NMRegClassID];

NMLoadStoreOpt() : MachineFunctionPass(ID) {}
StringRef getPassName() const override { return NM_LOAD_STORE_OPT_NAME; }
StringRef getPassName() const override { return PASS_NAME; }
bool runOnMachineFunction(MachineFunction &Fn) override;
bool isReturn(MachineInstr &MI);
bool isStackPointerAdjustment(MachineInstr &MI, bool IsRestore);
Expand Down Expand Up @@ -752,6 +753,8 @@ bool NMLoadStoreOpt::generatePCRelative(MachineBasicBlock &MBB) {
return Candidates.size() > 0;
}

INITIALIZE_PASS(NMLoadStoreOpt, DEBUG_TYPE, PASS_NAME, false, false)

namespace llvm {
FunctionPass *createNanoMipsLoadStoreOptimizerPass() {
return new NMLoadStoreOpt();
Expand Down
7 changes: 5 additions & 2 deletions llvm/lib/Target/Mips/NanoMipsMoveOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

using namespace llvm;

#define NM_MOVE_OPT_NAME "nanoMIPS move optimization pass"
#define DEBUG_TYPE "nmmoveopt"
#define PASS_NAME "nanoMIPS move optimization pass"

static cl::opt<bool>
DisableNMMoveOpt("disable-nm-move-opt", cl::Hidden, cl::init(false),
Expand Down Expand Up @@ -56,7 +57,7 @@ struct NMMoveOpt : public MachineFunctionPass {
const MipsSubtarget *STI;
const TargetInstrInfo *TII;
NMMoveOpt() : MachineFunctionPass(ID) {}
StringRef getPassName() const override { return NM_MOVE_OPT_NAME; }
StringRef getPassName() const override { return PASS_NAME; }
bool runOnMachineFunction(MachineFunction &) override;
bool generateMoveP(MachineBasicBlock &);
bool generateMoveBalc(MachineBasicBlock &);
Expand Down Expand Up @@ -353,6 +354,8 @@ bool NMMoveOpt::generateMoveBalc(MachineBasicBlock &MBB) {
return MoveBalcPairs.size() > 0;
}

INITIALIZE_PASS(NMMoveOpt, DEBUG_TYPE, PASS_NAME, false, false)

namespace llvm {
FunctionPass *createNanoMipsMoveOptimizerPass() { return new NMMoveOpt(); }
} // namespace llvm
Loading