1 //===-- transform-opt.cpp - Transform dialect tutorial entry point --------===//
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
7 //===----------------------------------------------------------------------===//
9 // This is the top-level file for the Transform dialect tutorial chapter 2.
11 //===----------------------------------------------------------------------===//
13 #include "MyExtension.h"
15 #include "mlir/Dialect/Transform/Transforms/Passes.h"
16 #include "mlir/IR/DialectRegistry.h"
17 #include "mlir/IR/MLIRContext.h"
18 #include "mlir/InitAllDialects.h"
19 #include "mlir/InitAllExtensions.h"
20 #include "mlir/Tools/mlir-opt/MlirOptMain.h"
21 #include "mlir/Transforms/Passes.h"
25 void registerTestTransformDialectExtension(mlir::DialectRegistry
&);
28 int main(int argc
, char **argv
) {
29 // Register all "core" dialects and our transform dialect extension.
30 mlir::DialectRegistry registry
;
31 mlir::registerAllDialects(registry
);
32 mlir::registerAllExtensions(registry
);
33 registerMyExtension(registry
);
35 // Register transform interpreter pass.
36 mlir::transform::registerInterpreterPass();
38 // Register a handful of cleanup passes that we can run to make the output IR
40 mlir::registerCanonicalizerPass();
41 mlir::registerCSEPass();
42 mlir::registerSymbolDCEPass();
44 // Delegate to the MLIR utility for parsing and pass management.
45 return mlir::MlirOptMain(argc
, argv
, "transform-opt-ch2", registry
)