The constructor already supports passing an ostream as argument,
so let's make the create function support it too.
Differential Revision: https://reviews.llvm.org/
D127449
/// Creates a pass which prints the list of ops and the number of occurrences in
/// the module.
-std::unique_ptr<Pass> createPrintOpStatsPass();
+std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os = llvm::errs());
/// Creates a pass which inlines calls and callable operations as defined by
/// the CallGraph.
namespace {
struct PrintOpStatsPass : public PrintOpStatsBase<PrintOpStatsPass> {
- explicit PrintOpStatsPass(raw_ostream &os = llvm::errs()) : os(os) {}
+ explicit PrintOpStatsPass(raw_ostream &os) : os(os) {}
// Prints the resultant operation statistics post iterating over the module.
void runOnOperation() override;
}
}
-std::unique_ptr<Pass> mlir::createPrintOpStatsPass() {
- return std::make_unique<PrintOpStatsPass>();
+std::unique_ptr<Pass> mlir::createPrintOpStatsPass(raw_ostream &os) {
+ return std::make_unique<PrintOpStatsPass>(os);
}