1 //===- standalone-opt.cpp ---------------------------------------*- C++ -*-===// 2 // 3 // This file is licensed 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 #include "mlir/IR/MLIRContext.h" 10 #include "mlir/InitAllDialects.h" 11 #include "mlir/InitAllPasses.h" 12 #include "mlir/Support/FileUtilities.h" 13 #include "mlir/Tools/mlir-opt/MlirOptMain.h" 14 15 #include "Standalone/StandaloneDialect.h" 16 #include "Standalone/StandalonePasses.h" 17 main(int argc,char ** argv)18int main(int argc, char **argv) { 19 mlir::registerAllPasses(); 20 mlir::standalone::registerPasses(); 21 // TODO: Register standalone passes here. 22 23 mlir::DialectRegistry registry; 24 registry.insert<mlir::standalone::StandaloneDialect, 25 mlir::arith::ArithDialect, mlir::func::FuncDialect>(); 26 // Add the following to include *all* MLIR Core dialects, or selectively 27 // include what you need like above. You only need to register dialects that 28 // will be *parsed* by the tool, not the one generated 29 // registerAllDialects(registry); 30 31 return mlir::asMainReturnCode( 32 mlir::MlirOptMain(argc, argv, "Standalone optimizer driver\n", registry)); 33 } 34