/// the module.
std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os = llvm::errs());
+/// Creates a pass which prints the list of ops and the number of occurrences in
+/// the module with the output format option.
+std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os, bool printAsJSON);
+
/// Creates a pass which inlines calls and callable operations as defined by
/// the CallGraph.
std::unique_ptr<Pass> createInlinerPass();
struct PrintOpStatsPass : public PrintOpStatsBase<PrintOpStatsPass> {
explicit PrintOpStatsPass(raw_ostream &os) : os(os) {}
+ explicit PrintOpStatsPass(raw_ostream &os, bool printAsJSON) : os(os) {
+ this->printAsJSON = printAsJSON;
+ }
+
// Prints the resultant operation statistics post iterating over the module.
void runOnOperation() override;
std::unique_ptr<Pass> mlir::createPrintOpStatsPass(raw_ostream &os) {
return std::make_unique<PrintOpStatsPass>(os);
}
+
+std::unique_ptr<Pass> mlir::createPrintOpStatsPass(raw_ostream &os,
+ bool printAsJSON) {
+ return std::make_unique<PrintOpStatsPass>(os);
+}