virtual LogicalResult initializeOptions(StringRef options);
/// Prints out the pass in the textual representation of pipelines. If this is
- /// an adaptor pass, print with the op_name(sub_pass,...) format.
+ /// an adaptor pass, print its pass managers.
void printAsTextualPipeline(raw_ostream &os);
//===--------------------------------------------------------------------===//
}
/// Prints out the pass in the textual representation of pipelines. If this is
-/// an adaptor pass, print with the op_name(sub_pass,...) format.
+/// an adaptor pass, print its pass managers.
void Pass::printAsTextualPipeline(raw_ostream &os) {
- // Special case for adaptors to use the 'op_name(sub_passes)' format.
+ // Special case for adaptors to print its pass managers.
if (auto *adaptor = dyn_cast<OpToOpPassAdaptor>(this)) {
llvm::interleave(
adaptor->getPassManagers(),
- [&](OpPassManager &pm) {
- os << pm.getOpAnchorName() << "(";
- pm.printAsTextualPipeline(os);
- os << ")";
- },
+ [&](OpPassManager &pm) { pm.printAsTextualPipeline(os); },
[&] { os << ","; });
return;
}
return impl->getOpAnchorName();
}
-/// Prints out the given passes as the textual representation of a pipeline.
-static void printAsTextualPipeline(ArrayRef<std::unique_ptr<Pass>> passes,
- raw_ostream &os) {
+/// Prints out the passes of the pass manager as the textual representation
+/// of pipelines.
+void OpPassManager::printAsTextualPipeline(raw_ostream &os) const {
+ os << getOpAnchorName() << "(";
llvm::interleave(
- passes,
+ impl->passes,
[&](const std::unique_ptr<Pass> &pass) {
pass->printAsTextualPipeline(os);
},
- [&] { os << ","; });
-}
-
-/// Prints out the passes of the pass manager as the textual representation
-/// of pipelines.
-void OpPassManager::printAsTextualPipeline(raw_ostream &os) const {
- ::printAsTextualPipeline(impl->passes, os);
+ [&]() { os << ","; });
+ os << ")";
}
void OpPassManager::dump() {
llvm::errs() << "Pass Manager with " << impl->passes.size() << " passes: ";
- ::printAsTextualPipeline(impl->passes, llvm::errs());
+ printAsTextualPipeline(llvm::errs());
llvm::errs() << "\n";
}
mlirOpPassManagerAddOwnedPass(nestedFuncPm, printOpStatPass);
// Print the top level pass manager
- // CHECK: Top-level: builtin.module(func.func(print-op-stats{json=false}))
+ // CHECK: Top-level: builtin.module(
+ // CHECK-SAME: builtin.module(func.func(print-op-stats{json=false}))
+ // CHECK-SAME: )
fprintf(stderr, "Top-level: ");
mlirPrintPassPipeline(mlirPassManagerGetAsOpPassManager(pm), printToStderr,
NULL);
fprintf(stderr, "\n");
// Print the pipeline nested one level down
- // CHECK: Nested Module: func.func(print-op-stats{json=false})
+ // CHECK: Nested Module: builtin.module(func.func(print-op-stats{json=false}))
fprintf(stderr, "Nested Module: ");
mlirPrintPassPipeline(nestedModulePm, printToStderr, NULL);
fprintf(stderr, "\n");
// Print the pipeline nested two levels down
- // CHECK: Nested Module>Func: print-op-stats
+ // CHECK: Nested Module>Func: func.func(print-op-stats{json=false})
fprintf(stderr, "Nested Module>Func: ");
mlirPrintPassPipeline(nestedFuncPm, printToStderr, NULL);
fprintf(stderr, "\n");
exit(EXIT_FAILURE);
}
- // CHECK: Round-trip: builtin.module(func.func(print-op-stats{json=false}),
- // func.func(print-op-stats{json=false}))
+ // CHECK: Round-trip: builtin.module(builtin.module(
+ // CHECK-SAME: func.func(print-op-stats{json=false}),
+ // CHECK-SAME: func.func(print-op-stats{json=false})
+ // CHECK-SAME: ))
fprintf(stderr, "Round-trip: ");
mlirPrintPassPipeline(mlirPassManagerGetAsOpPassManager(pm), printToStderr,
NULL);
// CHECK_1: test-options-pass{list=1,2,3,4,5 string=nested_pipeline{arg1=10 arg2=" {} " arg3=true} string-list=a,b,c,d}
// CHECK_2: test-options-pass{list=1 string= string-list=a,b}
-// CHECK_3: builtin.module(func.func(test-options-pass{list=3 string= }),func.func(test-options-pass{list=1,2,3,4 string= }))
+// CHECK_3: builtin.module(builtin.module(func.func(test-options-pass{list=3 string= }),func.func(test-options-pass{list=1,2,3,4 string= })))
# A registered pass should parse successfully.
pm = PassManager.parse("builtin.module(func.func(print-op-stats{json=false}))")
- # CHECK: Roundtrip: builtin.module(func.func(print-op-stats{json=false}))
+ # CHECK: Roundtrip: builtin.module(builtin.module(func.func(print-op-stats{json=false})))
log("Roundtrip: ", pm)
run(testParseSuccess)