From: River Riddle Date: Sun, 15 Sep 2019 05:10:00 +0000 (-0700) Subject: NFC: Update the PassInstrumentation section. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f22011ccbad1a8a55260069d195a17d5ae275b41;p=platform%2Fupstream%2Fllvm.git NFC: Update the PassInstrumentation section. This section has grown stale as the pass infrastructure has been generalized. PiperOrigin-RevId: 269140863 --- diff --git a/mlir/g3doc/WritingAPass.md b/mlir/g3doc/WritingAPass.md index bb6c3d8..ec89c38 100644 --- a/mlir/g3doc/WritingAPass.md +++ b/mlir/g3doc/WritingAPass.md @@ -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(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))) ...