1 //===- fir-opt.cpp - FIR Optimizer Driver -----------------------*- C++ -*-===// 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 is to be like LLVM's opt program, only for FIR. Such a program is 10 // required for roundtrip testing, etc. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "mlir/Tools/mlir-opt/MlirOptMain.h" 15 #include "flang/Optimizer/CodeGen/CodeGen.h" 16 #include "flang/Optimizer/Support/InitFIR.h" 17 #include "flang/Optimizer/Transforms/Passes.h" 18 19 using namespace mlir; 20 main(int argc,char ** argv)21int main(int argc, char **argv) { 22 fir::support::registerMLIRPassesForFortranTools(); 23 fir::registerOptCodeGenPasses(); 24 fir::registerOptTransformPasses(); 25 DialectRegistry registry; 26 fir::support::registerDialects(registry); 27 return failed(MlirOptMain(argc, argv, "FIR modular optimizer driver\n", 28 registry, /*preloadDialectsInContext=*/false)); 29 } 30