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.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks, I wrote exactly this locally before seeing this patch! :)
Can you also update test/Fir/fir-ops.fir and test/Fir/fir-types.fir to use this? I had changed the run line this way:
// Parse operations and check that we can reparse what we print. // RUN: fir-opt %s | fir-opt | FileCheck %s
flang/tools/fir-opt/CMakeLists.txt | ||
---|---|---|
21 | This list of dependency should be pruned. These two are obvious: FIROptimizer MLIROptLib None of the others are. | |
flang/tools/fir-opt/fir-opt.cpp | ||
23 | Can you replace the two lines above with fir::registerFIRDialects(registry); ? | |
27 | (nit: missing newline) |
flang/tools/fir-opt/CMakeLists.txt | ||
---|---|---|
21 | LG, please separate ${dialect_libs} and MLIRAffineToStandard after a line TODO: these should be transitive dependencies from a target providing "registerFIRPasses()" |
flang/test/Fir/fir-types.fir | ||
---|---|---|
2 ↗ | (On Diff #323124) | Nit: types ;) |
flang/test/Fir/fir-types.fir | ||
---|---|---|
2 ↗ | (On Diff #323124) | My bad :) |
This list of dependency should be pruned.
These two are obvious:
None of the others are.
I suspect the issue is that fir::registerFIRPasses() should not just be an inline function in a header but would better come in an implementation file, with a CMake target that pulls in the minimum number of dependencies to link the desired passes.
Otherwise any user of this function has to know the list of targets, and changing the function requires to change the build configuration of every user.