Frederik Gossen bdb955b307 [MLIR] Add print-ir pass for debugging purposes
Add pass to print the entire IR on the debug stream.
This is meant for debugging purposes to inspect the IR at a specific point in the pipeline.

Differential Revision: https://reviews.llvm.org/D144918
2023-03-01 14:42:10 -05:00

29 lines
785 B
C++

//===- PrintIR.cpp - Pass to dump IR on debug stream ----------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "mlir/Pass/Pass.h"
namespace mlir {
namespace {
#define GEN_PASS_DEF_PRINTIRPASS
#include "mlir/Transforms/Passes.h.inc"
struct PrintIRPass : public impl::PrintIRPassBase<PrintIRPass> {
PrintIRPass() = default;
void runOnOperation() override { getOperation()->dump(); }
};
} // namespace
std::unique_ptr<Pass> createPrintIRPass() {
return std::make_unique<PrintIRPass>();
}
} // namespace mlir