[flang-commits] [flang] [flang][OpenMP] Implement flexible OpenMP clause representation (PR #81621)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Tue Feb 20 04:28:37 PST 2024


https://github.com/skatrak commented:

Thank you Krzysztof for this work. I added a few comments inline, but they are rather minor nits and suggestions.

I see that this approach requires representing the complete list of clauses, and that's the reason for the size of this patch. However, these are very much tied to the flang PFT, so I wonder whether it would be feasible to get this to generically work for clang as well and make it part of llvm/Frontend/OpenMP, as it was discussed in yesterday's community call.

For example, the reduction clause is defined here and in the PFT as a `ReductionOperator` and an `ObjectList`, and the `ReductionOperator` is made of a `DefinedOperator` or a `ProcedureDesignator`. In [clang](https://github.com/llvm/llvm-project/blob/main/clang/include/clang/AST/OpenMPClause.h#L3204), the corresponding structure inherits from `OMPVarListClause` and contains a `DeclarationNameInfo`, among others. So I can foresee some issues creating `make()` functions for these structures based on the clang AST, since representations are quite different. Also, the various traits are only used by flang's PFT visitors and the main `Object` class here uses `Fortran::semantics` types, which I'm not sure whether it could be easily templated to contain either flang or clang symbols/expressions.

So I'm not sure whether the list of structures here could be made somewhat more language agnostic and based off of the spec rather than flang's PFT if there's a chance that this approach could be shared by clang and flang.

https://github.com/llvm/llvm-project/pull/81621


More information about the flang-commits mailing list