9 #ifndef CIRCT_SUPPORT_PASSES_H
10 #define CIRCT_SUPPORT_PASSES_H
13 #include "mlir/Pass/Pass.h"
14 #include "mlir/Pass/PassInstrumentation.h"
15 #include "llvm/Support/Chrono.h"
16 #include "llvm/Support/Format.h"
23 template <
class... LoggedOpTypes>
34 if (isa<LoggedOpTypes...>(op)) {
36 auto &os = llvm::errs();
37 os << llvm::format(
"[%s] ",
toolName);
38 os.indent(2 *
level++);
40 pass->printAsTextualPipeline(llvm::errs());
46 using namespace std::chrono;
47 if (isa<LoggedOpTypes...>(op)) {
48 auto &os = llvm::errs();
49 auto elapsed = duration<double>(TimePoint::clock::now() -
52 os << llvm::format(
"[%s] ",
toolName);
53 os.indent(2 * --
level);
54 os <<
"-- Done in " << llvm::format(
"%.3f", elapsed) <<
" sec\n";
llvm::SmallVector< TimePoint > timePoints
void runAfterPass(Pass *pass, Operation *op) override
void runBeforePass(Pass *pass, Operation *op) override
VerbosePassInstrumentation(const char *toolName)
llvm::sys::TimePoint<> TimePoint
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
std::unique_ptr< Pass > createSimpleCanonicalizerPass()
Create a simple canonicalizer pass.