|
18 | 18 | #include "mlir/IR/Threading.h" |
19 | 19 | #include "mlir/IR/Verifier.h" |
20 | 20 | #include "mlir/Support/FileUtilities.h" |
| 21 | +#include "mlir/Support/IndentedOstream.h" |
21 | 22 | #include "llvm/ADT/Hashing.h" |
22 | 23 | #include "llvm/ADT/STLExtras.h" |
23 | 24 | #include "llvm/ADT/ScopeExit.h" |
@@ -392,18 +393,28 @@ StringRef OpPassManager::getOpAnchorName() const { |
392 | 393 | /// Prints out the passes of the pass manager as the textual representation |
393 | 394 | /// of pipelines. |
394 | 395 | void printAsTextualPipeline( |
395 | | - raw_ostream &os, StringRef anchorName, |
| 396 | + raw_indented_ostream &os, StringRef anchorName, |
396 | 397 | const llvm::iterator_range<OpPassManager::pass_iterator> &passes) { |
397 | | - os << anchorName << "("; |
| 398 | + os << anchorName << "(\n"; |
| 399 | + os.indent(); |
398 | 400 | llvm::interleave( |
399 | 401 | passes, [&](mlir::Pass &pass) { pass.printAsTextualPipeline(os); }, |
400 | | - [&]() { os << ","; }); |
| 402 | + [&]() { os << ",\n"; }); |
| 403 | + os << "\n"; |
| 404 | + os.unindent(); |
401 | 405 | os << ")"; |
402 | 406 | } |
| 407 | +void printAsTextualPipeline( |
| 408 | + raw_ostream &os, StringRef anchorName, |
| 409 | + const llvm::iterator_range<OpPassManager::pass_iterator> &passes) { |
| 410 | + raw_indented_ostream indentedOS(os); |
| 411 | + printAsTextualPipeline(indentedOS, anchorName, passes); |
| 412 | +} |
403 | 413 | void OpPassManager::printAsTextualPipeline(raw_ostream &os) const { |
404 | 414 | StringRef anchorName = getOpAnchorName(); |
| 415 | + raw_indented_ostream indentedOS(os); |
405 | 416 | ::printAsTextualPipeline( |
406 | | - os, anchorName, |
| 417 | + indentedOS, anchorName, |
407 | 418 | {MutableArrayRef<std::unique_ptr<Pass>>{impl->passes}.begin(), |
408 | 419 | MutableArrayRef<std::unique_ptr<Pass>>{impl->passes}.end()}); |
409 | 420 | } |
|
0 commit comments