[PM] Add pass run listeners to the pass manager.
[oota-llvm.git] / include / llvm / PassSupport.h
index 8efb45f55a24763446e878db2bcd8eaf3b7d07bb..38860ee8c0b952454d38d5eae2abdc4b550b42f7 100644 (file)
@@ -31,6 +31,7 @@
 namespace llvm {
 
 class TargetMachine;
+class LLVMContext;
 //===---------------------------------------------------------------------------
 /// PassInfo class - An instance of this class exists for every pass known by
 /// the system, and can be obtained from a live Pass by calling its
@@ -355,6 +356,21 @@ struct PassRegistrationListener {
   virtual void passEnumerate(const PassInfo *) {}
 };
 
+//===---------------------------------------------------------------------------
+/// PassRunListener class - This class is meant to be derived from by
+/// clients that are interested in which and when passes are run at runtime.
+struct PassRunListener {
+  /// PassRunListener ctor - Add the current object to the list of
+  /// PassRunListeners...
+  PassRunListener(LLVMContext *);
+
+  virtual ~PassRunListener();
+
+  /// Callback function - This functions is invoked whenever a pass has run.
+  virtual void passRun(LLVMContext *, Pass *, Module *, Function *,
+                       BasicBlock *) {}
+};
+
 
 } // End llvm namespace