MLIR 23.0.0git
PrintIR.cpp
Go to the documentation of this file.
1//===- PrintIR.cpp - Pass to dump IR on debug stream ----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "mlir/Pass/Pass.h"
11#include "llvm/Support/Debug.h"
12
13namespace mlir {
14#define GEN_PASS_DEF_PRINTIRPASS
15#include "mlir/Transforms/Passes.h.inc"
16} // namespace mlir
17
18namespace mlir {
19namespace {
20
21struct PrintIRPass : public impl::PrintIRPassBase<PrintIRPass> {
22 using impl::PrintIRPassBase<PrintIRPass>::PrintIRPassBase;
23
24 void runOnOperation() override {
25 llvm::dbgs() << "// -----// IR Dump";
26 if (!this->label.empty())
27 llvm::dbgs() << " " << this->label;
28 llvm::dbgs() << " //----- //\n";
29 getOperation()->dump();
30 markAllAnalysesPreserved();
31 }
32};
33
34} // namespace
35
36} // namespace mlir
Include the generated interface declarations.