1 //===- fir-opt.cpp - FIR Optimizer Driver -----------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This is to be like LLVM's opt program, only for FIR. Such a program is
10 // required for roundtrip testing, etc.
12 //===----------------------------------------------------------------------===//
14 #include "mlir/Tools/mlir-opt/MlirOptMain.h"
15 #include "flang/Optimizer/CodeGen/CodeGen.h"
16 #include "flang/Optimizer/HLFIR/Passes.h"
17 #include "flang/Optimizer/Support/InitFIR.h"
18 #include "flang/Optimizer/Transforms/Passes.h"
23 void registerTestFIRAliasAnalysisPass();
27 // Defined in mlir/test, no pulic header.
29 void registerSideEffectTestPasses();
32 int main(int argc
, char **argv
) {
33 fir::support::registerMLIRPassesForFortranTools();
34 fir::registerOptCodeGenPasses();
35 fir::registerOptTransformPasses();
36 hlfir::registerHLFIRPasses();
37 #ifdef FLANG_INCLUDE_TESTS
38 fir::test::registerTestFIRAliasAnalysisPass();
39 mlir::registerSideEffectTestPasses();
41 DialectRegistry registry
;
42 fir::support::registerDialects(registry
);
43 return failed(MlirOptMain(argc
, argv
, "FIR modular optimizer driver\n",