xref: /llvm-project/mlir/tools/mlir-reduce/mlir-reduce.cpp (revision 7776b19eed44906e9973bfb240b6279d6feaab41)
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 test {
25 #ifdef MLIR_INCLUDE_TESTS
26 void registerTestDialect(DialectRegistry &);
27 #endif
28 } // namespace test
29 
main(int argc,char ** argv)30 int main(int argc, char **argv) {
31   registerAllPasses();
32 
33   DialectRegistry registry;
34   registerAllDialects(registry);
35 #ifdef MLIR_INCLUDE_TESTS
36   test::registerTestDialect(registry);
37 #endif
38   MLIRContext context(registry);
39 
40   return failed(mlirReduceMain(argc, argv, context));
41 }
42