1 //===- mlir-reduce.cpp - The MLIR reducer ---------------------------------===//
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 // This file implements the general framework of the MLIR reducer tool. It
10 // parses the command line arguments, parses the initial MLIR test case and sets
11 // up the testing environment. It  outputs the most reduced test case variant
12 // after executing the reduction passes.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #include "mlir/IR/Dialect.h"
17 #include "mlir/IR/MLIRContext.h"
18 #include "mlir/InitAllDialects.h"
19 #include "mlir/InitAllPasses.h"
20 #include "mlir/Tools/mlir-reduce/MlirReduceMain.h"
21 
22 using namespace mlir;
23 
24 namespace mlir {
25 namespace test {
26 #ifdef MLIR_INCLUDE_TESTS
27 void registerTestDialect(DialectRegistry &);
28 #endif
29 } // namespace test
30 } // namespace mlir
31 
main(int argc,char ** argv)32 int main(int argc, char **argv) {
33   registerAllPasses();
34 
35   DialectRegistry registry;
36   registerAllDialects(registry);
37 #ifdef MLIR_INCLUDE_TESTS
38   test::registerTestDialect(registry);
39 #endif
40   MLIRContext context(registry);
41 
42   return failed(mlirReduceMain(argc, argv, context));
43 }
44