[PATCH] D38355: [X86][NFC] Add X86CmovConverterPass to the pass registry

Amjad Aboud via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 05:27:56 PDT 2017


aaboud created this revision.

When use -print-after-all, the pass X86CmovConverterPass was not printing the function, make it harder to debug the pass.
The reason, was that it is was not registered as a pass.
This patch is solving that problem.

Notice, that I did not see any other target specific pass that is registered.
Please, let me know if that is intended and we should not register this pass as well.


https://reviews.llvm.org/D38355

Files:
  include/llvm/InitializePasses.h
  lib/Target/X86/X86CmovConversion.cpp


Index: lib/Target/X86/X86CmovConversion.cpp
===================================================================
--- lib/Target/X86/X86CmovConversion.cpp
+++ lib/Target/X86/X86CmovConversion.cpp
@@ -80,17 +80,20 @@
 /// Converts X86 cmov instructions into branches when profitable.
 class X86CmovConverterPass : public MachineFunctionPass {
 public:
-  X86CmovConverterPass() : MachineFunctionPass(ID) {}
+  X86CmovConverterPass() : MachineFunctionPass(ID) {
+    initializeX86CmovConverterPassPass(*PassRegistry::getPassRegistry());
+  }
   ~X86CmovConverterPass() {}
 
   StringRef getPassName() const override { return "X86 cmov Conversion"; }
   bool runOnMachineFunction(MachineFunction &MF) override;
   void getAnalysisUsage(AnalysisUsage &AU) const override;
 
-private:
   /// Pass identification, replacement for typeid.
   static char ID;
 
+private:
+
   MachineRegisterInfo *MRI;
   const TargetInstrInfo *TII;
   const TargetRegisterInfo *TRI;
@@ -125,8 +128,6 @@
   void convertCmovInstsToBranches(SmallVectorImpl<MachineInstr *> &Group) const;
 };
 
-char X86CmovConverterPass::ID = 0;
-
 void X86CmovConverterPass::getAnalysisUsage(AnalysisUsage &AU) const {
   MachineFunctionPass::getAnalysisUsage(AU);
   AU.addRequired<MachineLoopInfo>();
@@ -797,6 +798,14 @@
 
 } // End anonymous namespace.
 
+char X86CmovConverterPass::ID = 0;
+
+INITIALIZE_PASS_BEGIN(X86CmovConverterPass, DEBUG_TYPE, "X86 cmov Conversion",
+                      false, false)
+INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo)
+INITIALIZE_PASS_END(X86CmovConverterPass, DEBUG_TYPE, "X86 cmov Conversion",
+                    false, false)
+
 FunctionPass *llvm::createX86CmovConverterPass() {
   return new X86CmovConverterPass();
 }
Index: include/llvm/InitializePasses.h
===================================================================
--- include/llvm/InitializePasses.h
+++ include/llvm/InitializePasses.h
@@ -377,6 +377,7 @@
 void initializeWriteBitcodePassPass(PassRegistry&);
 void initializeWriteThinLTOBitcodePass(PassRegistry&);
 void initializeXRayInstrumentationPass(PassRegistry&);
+void initializeX86CmovConverterPassPass(PassRegistry&);
 
 } // end namespace llvm
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38355.116973.patch
Type: text/x-patch
Size: 2224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170928/3bb16fc1/attachment.bin>


More information about the llvm-commits mailing list