NFC: Update the PassInstrumentation section.

This section has grown stale as the pass infrastructure has been generalized.

PiperOrigin-RevId: 269140863
This commit is contained in:
River Riddle 2019-09-14 22:10:00 -07:00 committed by A. Unique TensorFlower
parent bbc6d48d1c
commit f22011ccba
1 changed files with 10 additions and 3 deletions

View 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)))
...