NFC: Update the PassInstrumentation section.
authorRiver Riddle <riverriddle@google.com>
Sun, 15 Sep 2019 05:10:00 +0000 (22:10 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Sun, 15 Sep 2019 05:10:28 +0000 (22:10 -0700)
This section has grown stale as the pass infrastructure has been generalized.

PiperOrigin-RevId: 269140863

mlir/g3doc/WritingAPass.md

index bb6c3d8..ec89c38 100644 (file)
@@ -358,6 +358,12 @@ MLIR provides a customizable framework to instrument pass execution and analysis
 computation. This is provided via the `PassInstrumentation` class. This class
 provides hooks into the PassManager that observe various pass events:
 
+*   `runBeforePipeline`
+    *   This callback is run just before a pass pipeline, i.e. pass manager, is
+        executed.
+*   `runAfterPipeline`
+    *   This callback is run right after a pass pipeline has been executed,
+        successfully or not.
 *   `runBeforePass`
     *   This callback is run just before a pass is executed.
 *   `runAfterPass`
@@ -389,15 +395,16 @@ struct DominanceCounterInstrumentation : public PassInstrumentation {
   }
 };
 
-PassManager pm;
+MLIRContext *ctx = ...;
+PassManager pm(ctx);
 
 // Add the instrumentation to the pass manager.
 unsigned domInfoCount;
 pm.addInstrumentation(
     std::make_unique<DominanceCounterInstrumentation>(domInfoCount));
 
-// Run the pass manager on a module.
-Module m = ...;
+// Run the pass manager on a module operation.
+ModuleOp m = ...;
 if (failed(pm.run(m)))
     ...