[flang-commits] [PATCH] D134285: [flang][RFC] Adding higher level FIR ops to ease expression lowering

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Sep 21 01:13:41 PDT 2022


jeanPerier added inline comments.


================
Comment at: flang/docs/HighLevelFIR.md:960
+
+It has not been decided if these new operations should be added to FIR or if
+this should be an independent dialect.
----------------
tschuett wrote:
> Isn't this point about the expressiveness of MLIR? What are the engineering costs of adding a FIRX dialect for the higher ops?
> 
> What would be the benefit of having a separate dialect?
The benefit of having a separate dialect is to strongly split the high level ops that require information about Fortran variables to be retrievable in the IR (via the fir.def/fir.ref) and the current operations that are lower level and do not require such information.
After the translation pass of variable related operation, this dialect would be illegal.

There is a precedent in FIR with the fir::cg dialect ops (https://github.com/llvm/llvm-project/blob/main/flang/include/flang/Optimizer/CodeGen/CGOps.td) that helps simplifying the addressing and emboxing operation before codegen.

I think the engineering cost are mostly about having different td files, headers and .cpp for these new ops and types, but also to register the dialect in the passes that will work with it. That last point may be a bit more annoying (it does not matter with the fir::cg dialect because codegen is the only pass meant to be run with this dialect).

I do not have a strong opinion here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134285/new/

https://reviews.llvm.org/D134285



More information about the flang-commits mailing list