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/Dialect/Arithmetic/IR/Arithmetic.h" 10 #include "mlir/IR/Dialect.h" 11 #include "mlir/IR/MLIRContext.h" 12 #include "mlir/InitAllDialects.h" 13 #include "mlir/InitAllPasses.h" 14 #include "mlir/Pass/Pass.h" 15 #include "mlir/Pass/PassManager.h" 16 #include "mlir/Support/FileUtilities.h" 17 #include "mlir/Tools/mlir-opt/MlirOptMain.h" 18 #include "llvm/Support/CommandLine.h" 19 #include "llvm/Support/InitLLVM.h" 20 #include "llvm/Support/SourceMgr.h" 21 #include "llvm/Support/ToolOutputFile.h" 22 23 #include "Standalone/StandaloneDialect.h" 24 main(int argc,char ** argv)25int main(int argc, char **argv) { 26 mlir::registerAllPasses(); 27 // TODO: Register standalone passes here. 28 29 mlir::DialectRegistry registry; 30 registry.insert<mlir::standalone::StandaloneDialect, 31 mlir::arith::ArithmeticDialect, mlir::func::FuncDialect>(); 32 // Add the following to include *all* MLIR Core dialects, or selectively 33 // include what you need like above. You only need to register dialects that 34 // will be *parsed* by the tool, not the one generated 35 // registerAllDialects(registry); 36 37 return mlir::asMainReturnCode( 38 mlir::MlirOptMain(argc, argv, "Standalone optimizer driver\n", registry)); 39 } 40