[PM] Add pass run listeners to the pass manager.
[oota-llvm.git] / lib / IR / LLVMContext.cpp
index 588e1217bd45b30946898c5b38286f9f053ec55e..b2d3bc9061e58b14b6f913fd9f8fdf49d0e0819d 100644 (file)
@@ -214,3 +214,23 @@ void LLVMContext::getMDKindNames(SmallVectorImpl<StringRef> &Names) const {
        E = pImpl->CustomMDKindNames.end(); I != E; ++I)
     Names[I->second] = I->first();
 }
+
+//===----------------------------------------------------------------------===//
+// Pass Run Listeners
+//===----------------------------------------------------------------------===//
+/// Notify that we finished running a pass.
+void LLVMContext::notifyPassRun(Pass *P, Module *M, Function *F, BasicBlock *BB)
+{
+  pImpl->notifyPassRun(this, P, M, F, BB);
+}
+/// Register the given PassRunListener to receive notifyPassRun() callbacks
+/// whenever a pass ran. The context will take ownership of the listener and
+/// free it when the context is destroyed.
+void LLVMContext::addRunListener(PassRunListener *L) {
+  pImpl->addRunListener(L);
+}
+/// Unregister a PassRunListener so that it no longer receives notifyPassRun()
+/// callbacks. Remove and free the listener from the context.
+void LLVMContext::removeRunListener(PassRunListener *L) {
+  pImpl->removeRunListener(L);
+}