[PM] Add names to passes under the new pass manager, and a debug output
[oota-llvm.git] / include / llvm / IR / PassManager.h
index b85f7f176273d6fbfd248f2620572fae1a4f0c62..09eb10b8464d2db37e22a7f46f6d156382c50de1 100644 (file)
@@ -168,6 +168,9 @@ template <typename IRUnitT, typename AnalysisManagerT> struct PassConcept {
   /// desired. Also that the analysis manager may be null if there is no
   /// analysis manager in the pass pipeline.
   virtual PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) = 0;
+
+  /// \brief Polymorphic method to access the name of a pass.
+  virtual StringRef name() = 0;
 };
 
 /// \brief SFINAE metafunction for computing whether \c PassT has a run method
@@ -208,6 +211,7 @@ struct PassModel<IRUnitT, AnalysisManagerT, PassT,
   virtual PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) {
     return Pass.run(IR, AM);
   }
+  virtual StringRef name() { return PassT::name(); }
   PassT Pass;
 };
 
@@ -221,6 +225,7 @@ struct PassModel<IRUnitT, AnalysisManagerT, PassT,
   virtual PreservedAnalyses run(IRUnitT IR, AnalysisManagerT *AM) {
     return Pass.run(IR);
   }
+  virtual StringRef name() { return PassT::name(); }
   PassT Pass;
 };
 
@@ -403,6 +408,8 @@ public:
     Passes.push_back(new ModulePassModel<ModulePassT>(llvm_move(Pass)));
   }
 
+  static StringRef name() { return "ModulePassManager"; }
+
 private:
   // Pull in the concept type and model template specialized for modules.
   typedef detail::PassConcept<Module *, ModuleAnalysisManager> ModulePassConcept;
@@ -428,6 +435,8 @@ public:
 
   PreservedAnalyses run(Function *F, FunctionAnalysisManager *AM = 0);
 
+  static StringRef name() { return "FunctionPassManager"; }
+
 private:
   // Pull in the concept type and model template specialized for functions.
   typedef detail::PassConcept<Function *, FunctionAnalysisManager>
@@ -808,6 +817,8 @@ public:
     return PA;
   }
 
+  static StringRef name() { return "ModuleToFunctionPassAdaptor"; }
+
 private:
   FunctionPassT Pass;
 };