-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch introduce the fir-opt tool. Similar to mlir-opt for FIR. It will be used in following patches to test fir opt and round-trip. Reviewed By: schweitz, mehdi_amini Differential Revision: https://reviews.llvm.org/D96535
- Loading branch information
1 parent
1e007cf
commit 8260232
Showing
6 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
add_flang_tool(fir-opt fir-opt.cpp) | ||
llvm_update_compile_flags(fir-opt) | ||
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) | ||
|
||
target_link_libraries(fir-opt PRIVATE | ||
FIROptimizer | ||
${dialect_libs} | ||
|
||
# TODO: these should be transitive dependencies from a target providing | ||
# "registerFIRPasses()" | ||
MLIRAffineToStandard | ||
MLIROptLib | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//===- fir-opt.cpp - FIR Optimizer Driver -----------------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This is to be like LLVM's opt program, only for FIR. Such a program is | ||
// required for roundtrip testing, etc. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "mlir/Support/MlirOptMain.h" | ||
#include "flang/Optimizer/Support/InitFIR.h" | ||
|
||
using namespace mlir; | ||
|
||
int main(int argc, char **argv) { | ||
fir::support::registerFIRPasses(); | ||
DialectRegistry registry; | ||
fir::support::registerDialects(registry); | ||
return failed(MlirOptMain(argc, argv, "FIR modular optimizer driver\n", | ||
registry, /*preloadDialectsInContext*/ false)); | ||
} |