[mlir] Add operator<< for printing Block (#92550)

Turns out it was already in Analysis/CFGLoopInfo, so just move it
to IR/AsmPrinter.
This commit is contained in:
Krzysztof Parzyszek
2024-05-18 08:03:19 -05:00
committed by GitHub
parent 4b62afca64
commit 33550b43f4
4 changed files with 8 additions and 7 deletions

View File

@@ -49,8 +49,6 @@ public:
CFGLoopInfo(const llvm::DominatorTreeBase<mlir::Block, false> &domTree);
};
raw_ostream &operator<<(raw_ostream &os, mlir::Block &block);
} // namespace mlir
#endif // MLIR_ANALYSIS_LOOPINFO_H

View File

@@ -18,6 +18,7 @@
namespace llvm {
class BitVector;
class raw_ostream;
} // namespace llvm
namespace mlir {
@@ -401,6 +402,8 @@ private:
friend struct llvm::ilist_traits<Block>;
};
raw_ostream &operator<<(raw_ostream &, Block &);
} // namespace mlir
#endif // MLIR_IR_BLOCK_H

View File

@@ -23,8 +23,3 @@ CFGLoopInfo::CFGLoopInfo(
const llvm::DominatorTreeBase<mlir::Block, false> &domTree) {
analyze(domTree);
}
raw_ostream &mlir::operator<<(raw_ostream &os, mlir::Block &block) {
block.print(os);
return os;
}

View File

@@ -3984,6 +3984,11 @@ void Block::printAsOperand(raw_ostream &os, AsmState &state) {
printer.printBlockName(this);
}
raw_ostream &mlir::operator<<(raw_ostream &os, Block &block) {
block.print(os);
return os;
}
//===--------------------------------------------------------------------===//
// Custom printers
//===--------------------------------------------------------------------===//