[flang-commits] [flang] [llvm] [flang][openmp] Adds Parser and Semantic Support for Interop Construct, and Init and Use Clauses. (PR #120584)
via flang-commits
flang-commits at lists.llvm.org
Mon Jan 6 05:20:39 PST 2025
swatheesh-mcw wrote:
> Please follow the common method for implementing modifiers, for example as in #117786.
>
> 1. The two modifiers should be prefixed with Omp, i.e. `OmpInteropPreference` and `OmpInteropType`. Please put them in the "modifiers" namespace in parse-tree.h (all classes are ordered alphabetically). When a modifier is a wrapper for ENUM_CLASS, the name of the enum should be `Value`, e.g. `ENUM_CLASS(Value, Something, SomethingElse)`.
>
> 2. In `OmpInitClause`, please add a line `MODIFIER_BOILERPLATE(OmpInteropPreference, OmpInteropType);`, and delete the WRAPPER_CLASS definitions. Please do not create nested wrapper classes for individual objects, i.e. delete the InteropVar. The tuple in the class should then be `std::tuple<MODIFIERS(), OmpObject>`. These macros will define a nested type "Modifier" in the class which is a variant with the two given members. The tuple will contain an "optional<list>" in place of the MODIFIERS macro.
>
> 3. In openmp-parsers.cpp there is a section with parsers for the individual modifiers, in your case, OmpInteropPreference and OmpInteropType. Please add the parsers there. Then, in the section below, where all the "OmpXyzClause::Modifier" are parsed, please add a parser for OmpInitClause::Modifier (it's just an alternative parser for the two modifiers). Then the parser for the OmpInitClause itself would just be `maybe(nonemptyList(Parser<OmpInitClause::Modifier>{}) / ":"), Parser<OmpObject>{}`.
>
> 4. In openmp-modifiers.h please add the two new modifiers to the DECLARE_DESCRIPTOR list (in alphabetical order). In openmp-modifiers.cpp, please add descriptors for these modifiers (also in alphabetical order). The definitions of the descriptors should be pretty clear based on the other definitions. The "name" refers to the name in the spec, i.e. "interop-preference" and "interop-type". The properties for the modifiers are "OmpUnique" for "interop-preference" and "OmpRequired" for the other one.
>
> 5. In check-omp-structure.cpp please call `OmpVerifyModifiers`. To get the optional list of modifiers use `OmpGetModifiers`, and to get a unique modifier, use `OmpGetUniqueModifier`. To iterate over repeatable modifiers use `OmpGetRepeatableModifier`. You can find examples of their use in that source file.
Hi @kparzysz , I have addressed the review comments on [#9e748a6](https://github.com/llvm/llvm-project/pull/120584/commits/9e748a6cc5c42de4a674d0be7082738fae49b7ca). Please let me know if any changes are required. Thanks!
https://github.com/llvm/llvm-project/pull/120584
More information about the flang-commits
mailing list