summaryrefslogtreecommitdiff
path: root/flang/examples/FeatureList/FeatureList.cpp
AgeCommit message (Collapse)Author
2025-11-05[flang] Adding NOTIFY specifier in image selector and add notify type checks ↵Jean-Didier PAILLEUX
(#148810) This PR adds support for the NOTIFY specifier in the image selector as described in the 2023 standard, and add checks for the NOTIFY_TYPE type.
2025-11-03[flang][OpenMP] Use OmpDirectiveSpecification in ALLOCATE (#165865)Krzysztof Parzyszek
The ALLOCATE directive has two forms: - A declarative form with a standalone directive: ``` !$OMP ALLOCATE (variable-list-item...) ``` - An executable form that consists of several directives followed by an ALLOCATE statement: ``` !$OMP ALLOCATE (variable-list-item...) !$OMP ALLOCATE (variable-list-item...) ... ALLOCATE (...) ``` The second form was deprecated in OpenMP 5.2 in favor of the ALLOCATORS construct. Since in the parse tree every type corresponding to a directive only corresponds to a single directive, the executable form is represented by a sequence of nested OmpAllocateDirectives, e.g. ``` !$OMP ALLOCATE(x) !$OMP ALLOCATE(y) ALLOCATE(x, y) ``` will become ``` OmpAllocateDirective |- ALLOCATE(x) // begin directive `- OmpAllocateDirective // block |- ALLOCATE(y) // begin directive `- ALLOCATE(x, y) // block ``` With this change all AST nodes for directives use OmpDirectiveSpecification as the directive representation.
2025-10-23[flang][OpenMP] Rename some AST classes to follow spec naming, NFC (#164870)Krzysztof Parzyszek
Rename OmpTypeSpecifier to OmpTypeName, since it represents a type-name list item. Also, OpenMP 6.0 introduced type-specifier with a different meaning. Rename OmpReductionCombiner to OmpCombinerExpression.
2025-09-26[flang][OpenMP] Use OmpDirectiveSpecification in DECLARE_TARGET (#160573)Krzysztof Parzyszek
2025-09-19[flang][OpenMP] Use OmpDirectiveSpecification in SECTIONS (#159580)Krzysztof Parzyszek
2025-09-19[flang][OpenMP] Remove no longer used OmpLoopDirective, NFC (#159576)Krzysztof Parzyszek
2025-08-29[flang][OpenMP] Replace OpenMPBlockConstruct with OmpBlockConstruct (#155872)Krzysztof Parzyszek
OpenMPBlockConstruct, somewhat confusingly, represents most but not all block-associated constructs. It's derived from OmpBlockConstruct, as are all the remaining block-associated constructs. It does not correspond to any well-defined group of constructs. It's the collection of constructs that don't have their own types (and those that do have their own types do so for their own reasons). Using the broader OmpBlockConstruct in type-based visitors won't cause issues, because the specific overloads (for classes derived from it) will always be preferred.
2025-08-26[flang][OpenMP] Delete no longer used Omp[End]CriticalDirective, NFC (#155099)Krzysztof Parzyszek
2025-08-04[flang][OpenMP] Remove unused class OmpMemoryOrderClause, NFC (#151759)Krzysztof Parzyszek
2025-08-01[flang][OpenMP] Make all block constructs share the same structure (#150956)Krzysztof Parzyszek
The structure is - OmpBeginDirective (aka OmpDirectiveSpecification) - Block - optional<OmpEndDirective> (aka optional<OmpDirectiveSpecification>) The OmpBeginDirective and OmpEndDirective are effectively different names for OmpDirectiveSpecification. They exist to allow the semantic analyses to distinguish between the beginning and the ending of a block construct without maintaining additional context. The actual changes are in the parser: parse-tree.h and openmp-parser.cpp in particular. The rest is simply changing the way the directive/clause information is accessed (typically for the simpler). All standalone and block constructs now use OmpDirectiveSpecification to store the directive/clause information.
2025-07-31[flang][OpenMP] Store directive information in OpenMPSectionConstruct (#150804)Krzysztof Parzyszek
The OpenMPSectionConstruct corresponds to the `!$omp section` directive, but there is nothing in the AST node that stores the directive information. Even though the only possibility (at the moment) is "section" without any clauses, for improved generality it is helpful to have that information anyway.
2025-07-11[flang][OpenMP] Convert AST node for ALLOCATORS to use Block as body (#148005)Krzysztof Parzyszek
The ALLOCATORS construct is one of the few constructs that require a special form of the associated block. Convert the AST node to use OmpDirectiveSpecification for the directive and the optional end directive, and to use parser::Block as the body: the form of the block is checked in the semantic checks (with a more meaningful message).
2025-06-11[flang][OpenMP] Overhaul implementation of ATOMIC construct (#137852)Krzysztof Parzyszek
The parser will accept a wide variety of illegal attempts at forming an ATOMIC construct, leaving it to the semantic analysis to diagnose any issues. This consolidates the analysis into one place and allows us to produce more informative diagnostics. The parser's outcome will be parser::OpenMPAtomicConstruct object holding the directive, parser::Body, and an optional end-directive. The prior variety of OmpAtomicXyz classes, as well as OmpAtomicClause have been removed. READ, WRITE, etc. are now proper clauses. The semantic analysis consistently operates on "evaluation" representations, mainly evaluate::Expr (as SomeExpr) and evaluate::Assignment. The results of the semantic analysis are stored in a mutable member of the OpenMPAtomicConstruct node. This follows a precedent of having `typedExpr` member in parser::Expr, for example. This allows the lowering code to avoid duplicated handling of AST nodes. Using a BLOCK construct containing multiple statements for an ATOMIC construct that requires multiple statements is now allowed. In fact, any nesting of such BLOCK constructs is allowed. This implementation will parse, and perform semantic checks for both conditional-update and conditional-update-capture, although no MLIR will be generated for those. Instead, a TODO error will be issues prior to lowering. The allowed forms of the ATOMIC construct were based on the OpenMP 6.0 spec.
2025-04-23[flang][OpenMP] Extend common::AtomicDefaultMemOrderType enumeration (#136312)Krzysztof Parzyszek
Add "Acquire" and "Release", and rename it to OmpMemoryOrderType, since memory order type is a concept extending beyond the ATOMIC_DEFAULT_MEM_ORDER clause. When processing a REQUIRES directive (in rewrite-directives.cpp), do not add Acquire or Release to ATOMIC constructs, because handling of those types depends on the OpenMP version, which is not available in that file. This issue will be addressed later.
2025-03-28Revert "Revert "[flang][openmp] Adds Parser and Semantic Support for Interop ↵swatheesh-mcw
Construct, and Init and Use Clauses."" (#132343) Reverts llvm/llvm-project#132005
2025-03-19[flang][OpenMP] Use OmpDirectiveSpecification in simple directives (#131162)Krzysztof Parzyszek
The `OmpDirectiveSpecification` contains directive name, the list of arguments, and the list of clauses. It was introduced to store the directive specification in METADIRECTIVE, and could be reused everywhere a directive representation is needed. In the long term this would unify the handling of common directive properties, as well as creating actual constructs from METADIRECTIVE by linking the contained directive specification with any associated user code.
2025-03-19Revert "[flang][openmp] Adds Parser and Semantic Support for Interop ↵Kiran Chandramohan
Construct, and Init and Use Clauses." (#132005) Reverts llvm/llvm-project#120584 Reverting due to CI failure https://lab.llvm.org/buildbot/#/builders/157/builds/22946
2025-03-19[flang][openmp] Adds Parser and Semantic Support for Interop Construct, and ↵swatheesh-mcw
Init and Use Clauses. (#120584) Adds Parser and Semantic Support for the below construct and clauses: - Interop Construct - Init Clause - Use Clause Note: The other clauses supported by Interop Construct such as Destroy, Use, Depend and Device are added already.
2025-03-10[flang][OpenMP] Parse cancel-directive-name as clause (#130146)Krzysztof Parzyszek
The cancellable construct names on CANCEL or CANCELLATION POINT directives are actually clauses (with the same names as the corresponding constructs). Instead of parsing them into a custom structure, parse them as a clause, which will make CANCEL/CANCELLATION POINT follow the same uniform scheme as other constructs (<directive> [(<arguments>)] [clauses]).
2025-03-05[flang][llvm][openmp]Add Initializer clause to OMP.td (#129540)Mats Petersson
Then use this in the Flang compiler for parsing the OpenMP declare reduction. This has no real functional change to the existing code, it's only moving the declaration itself around. A few tests has been updated, to reflect the new type names.
2025-02-03[flang][OpenMP] Handle directive arguments in OmpDirectiveSpecifier (#124278)Krzysztof Parzyszek
Implement parsing and symbol resolution for directives that take arguments. There are a few, and most of them take objects. Special handling is needed for two that take more specialized arguments: DECLARE MAPPER and DECLARE REDUCTION. This only affects directives in METADIRECTIVE's WHEN and OTHERWISE clauses. Parsing and semantic checks of other cases is unaffected.
2024-12-12[flang][OpenMP] Rework LINEAR clause (#119278)Krzysztof Parzyszek
The OmpLinearClause class was a variant of two classes, one for when the linear modifier was present, and one for when it was absent. These two classes did not follow the conventions for parse tree nodes, (i.e. tuple/wrapper/union formats), which necessitated specialization of the parse tree visitor. The new form of OmpLinearClause is the standard tuple with a list of modifiers and an object list. The specialization of parse tree visitor for it has been removed. Parsing and unparsing of the new form bears additional complexity due to syntactical differences between OpenMP 5.2 and prior versions: in OpenMP 5.2 the argument list is post-modified, while in the prior versions, the step modifier was a post-modifier while the linear modifier had an unusual syntax of `modifier(list)`. With this change the LINEAR clause is no different from any other clauses in terms of its structure and use of modifiers. Modifier validation and all other checks work the same as with other clauses.
2024-12-02[flang][OpenMP] Use new modifiers in IF/LASTPRIVATE (#118128)Krzysztof Parzyszek
The usual changes, added more references to OpenMP specs.
2024-12-02[flang][OpenMP] Use new modifiers in DEPEND/GRAINSIZE/NUM_TASKS (#117917)Krzysztof Parzyszek
The usual changes, added more references to OpenMP specs.
2024-12-02[flang][OpenMP] Use new modifiers with AFFINITY/ALIGNED/DEVICE (#117786)Krzysztof Parzyszek
This is a mostly mechanical change from specific modifiers embedded directly in a clause to the Modifier variant. Additional comments and references to the OpenMP specs were added.
2024-12-02[flang][OpenMP] Rename some `Type` members in OpenMP clauses (#117784)Krzysztof Parzyszek
The intent is to keep names in sync with the terminology from the OpenMP spec: ``` OmpBindClause::Type -> Binding OmpDefaultClause::Type -> DataSharingAttribute OmpDeviceTypeClause::Type -> DeviceTypeDescription OmpProcBindClause::Type -> AffinityPolicy ``` Add more comments with references to the OpenMP specs.
2024-12-02[flang][OpenMP] Use new modifiers in ALLOCATE clause (#117627)Krzysztof Parzyszek
Again, this simplifies the semantic checks and lowering quite a bit. Update the check for positive alignment to use a more informative message, and to highlight the modifier itsef, not the whole clause. Remove the checks for the allocator expression itself being positive: there is nothing in the spec that says that it should be positive. Remove the "simple" modifier from the AllocateT template, since both simple and complex modifiers are the same thing, only differing in syntax.
2024-11-25[flang][OpenMP] Use new modifier infrastructure for MAP/FROM/TO clauses ↵Krzysztof Parzyszek
(#117447) This removes the specialized parsers and helper classes for these clauses, namely ConcatSeparated, MapModifiers, and MotionModifiers. Map and the motion clauses are now handled in the same way as all other clauses with modifiers, with one exception: the commas separating their modifiers are optional. This syntax is deprecated in OpenMP 5.2. Implement version checks for modifiers: for a given modifier on a given clause, check if that modifier is allowed on this clause in the specified OpenMP version. This replaced several individual checks. Add a testcase for handling map modifiers in a different order, and for diagnosing an ultimate modifier out of position.
2024-11-21[flang][OpenMP] Use new modifier code in ORDER and SCHEDULE clauses (#117081)Krzysztof Parzyszek
This actually simplifies the AST node for the schedule clause: the two allowed modifiers can be easily classified as the ordering-modifier and the chunk-modifier during parsing without the need to create additional classes.
2024-11-21[flang][OpenMP] Apply modifier representation to semantic checks (#116658)Krzysztof Parzyszek
Also, define helper macros in parse-tree.h. Apply the new modifier representation to the DEFAULTMAP and REDUCTION clauses, with testcases utilizing the new modifier validation. OpenMP modifier overhaul: #3/3
2024-11-20[flang][OpenMP] Normalize clause modifiers that exist on their own (#116655)Krzysztof Parzyszek
This is the first part of the effort to make parsing of clause modifiers more uniform and robust. Currently, when multiple modifiers are allowed, the parser will expect them to appear in a hard-coded order. Additionally, modifier properties (such as "ultimate") are checked separately for each case. The overall plan is 1. Extract all modifiers into their own top-level classes, and then equip them with sets of common properties that will allow performing the property checks generically, without refering to the specific kind of the modifier. 2. Define a parser (as a separate class) for each modifier. 3. For each clause define a union (std::variant) of all allowable modifiers, and parse the modifiers as a list of these unions. The intent is also to isolate parts of the code that could eventually be auto-generated. OpenMP modifier overhaul: #1/3
2024-11-11[flang][OpenMP] Parse DOACROSS clause (#115396)Krzysztof Parzyszek
Extract the SINK/SOURCE parse tree elements into a separate class `OmpDoacross`, share them between DEPEND and DOACROSS clauses. Most of the changes in Semantics are to accommodate the new contents of OmpDependClause, and a mere introduction of OmpDoacrossClause. There are no semantic checks specifically for DOACROSS.
2024-10-28[flang][OpenMP] Update handling of DEPEND clause (#113620)Krzysztof Parzyszek
Parse the locator list in OmpDependClause as an OmpObjectList (instead of a list of Designators). When a common block appears in the locator list, show an informative message. Implement resolving symbols in DependSinkVec in a dedicated visitor instead of having a visitor for OmpDependClause. Resolve unresolved names common blocks in OmpObjectList. Minor changes to the code organization: - rename OmpDependenceType to OmpTaskDependenceType (to follow 5.2 terminology), - rename Depend::WithLocators to Depend::DepType, - add comments with more detailed spec references to parse-tree.h. --------- Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
2024-10-27[Flang][OpenMP] Add parser support for grainsize and num_tasks clause (#113136)Kiran Chandramohan
These clauses are applicable only for the taskloop directive. Since the directive has a TODO error, skipping the addition of TODOs for these clauses.
2024-10-11[flang][OpenMP] Parsing support for map type modifiers (#111860)Krzysztof Parzyszek
This commit adds parsing of type modifiers for the MAP clause: CLOSE, OMPX_HOLD, and PRESENT. The support for ALWAYS has already existed. The new modifiers are not yet handled in lowering: when present, a TODO message is emitted and compilation stops.
2024-05-30[flang] Add parsing of DO CONCURRENT REDUCE clause (#92518)khaki3
Derived from #92480. This PR supports parsing of the DO CONCURRENT REDUCE clause in Fortran 2023. Following the style of the OpenMP parser in MLIR, the front end accepts both arbitrary operations and procedures for the REDUCE clause. But later Semantics can notify type errors and resolve procedure names.
2024-05-01[flang] Intermix messages from parser and semantic analysis (#90654)Peter Klausler
When there are one or more fatal error messages produced by the parser, semantic analysis is not performed. But when there are messages produced by the parser and none of them are fatal, those messages are emitted to the user before compilation continues with semantic analysis, and any messages produced by semantics are emitted after the messages from parsing. This can be confusing for the user, as the messages may no longer all be in source file location order. It also makes it difficult to write tests that check for both non-fatal messages from parsing as well as messages from semantics using inline CHECK: or other expected messages in test source code. This patch ensures that if semantic analysis is performed, and non-fatal messages were produced by the parser, that all the messages will be combined and emitted in source file order.
2024-01-02[flang] Add notify-type and notify-wait-stmt (#76594)Katherine Rasmussen
Add `notify-type` to `iso_fortran_env` module. Add `notify-wait-stmt` to the parser and add checks for constraints on the statement, `C1177` and `C1178`, from the Fortran 2023 standard. Add three semantics tests for `notify-wait-stmt`.
2023-09-11[Flang][OpenMP][Sema] Support propagation of REQUIRES information across ↵Sergio Afonso
program units Re-land commit 3787fd942f3927345320cc97a479f13e44355805 This patch adds support for storing OpenMP REQUIRES information in the semantics symbols for programs/subprograms and modules/submodules, and populates them during directive resolution. A pass is added to name resolution that makes sure this information is also propagated across top-level programs, functions and subprograms. Storing REQUIRES information inside of semantics symbols will also allow supporting the propagation of this information across Fortran modules. This will come as a separate patch. The `bool DirectiveAttributeVisitor::Pre(const parser::SpecificationPart &x)` method is removed since it resulted in specification parts being visited twice. This is patch 3/5 of a series splitting D149337 to simplify review. Differential Revision: https://reviews.llvm.org/D157983
2023-09-11Revert "[Flang][OpenMP][Sema] Support propagation of REQUIRES information ↵Sergio Afonso
across program units" Changes in this commit make some gfortran tests crash the compiler. It is likely trying to dereference undefined symbol pointers. This reverts commit 3787fd942f3927345320cc97a479f13e44355805.
2023-09-11[Flang][OpenMP][Sema] Support propagation of REQUIRES information across ↵Sergio Afonso
program units This patch adds support for storing OpenMP REQUIRES information in the semantics symbols for programs/subprograms and modules/submodules, and populates them during directive resolution. A pass is added to name resolution that makes sure this information is also propagated across top-level programs, functions and subprograms. Storing REQUIRES information inside of semantics symbols will also allow supporting the propagation of this information across Fortran modules. This will come as a separate patch. The `bool DirectiveAttributeVisitor::Pre(const parser::SpecificationPart &x)` method is removed since it resulted in specification parts being visited twice. This is patch 3/5 of a series splitting D149337 to simplify review. Differential Revision: https://reviews.llvm.org/D157983
2023-06-13[flang][openacc] Add parsing support for dim in gang clauseValentin Clement
Add parsing supprot for dim in gang clause Depends on D151971 Reviewed By: razvanlupusoru, jeanPerier Differential Revision: https://reviews.llvm.org/D151972
2023-05-10[Flang] Syntax support for OMP Allocators ConstructEthan Luis McDonough
OpenMP 5.2 introduces a Fortran specific construct that aims to replace the executable allocate directive. This patch seeks to add parser support for the directive as well as the allocator clause with the [[ https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5-2.pdf#section.6.6 | extended align/complex ]] modifier. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D149727
2023-04-24[flang] Feature list pluginEthan Luis McDonough
Plugin that counts the number of times each tree node occurs in a given program. Used for test coverage. Updated to fix build issues. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D143704
2023-03-22Revert "[flang] Feature list plugin" due to failing buildEthan Luis McDonough
This reverts commit 823ddba1b325f30fc3fb2e9d695c211b856a4d5d.
2023-03-22[flang] Feature list pluginEthan Luis McDonough
Plugin that counts the number of times each tree node occurs in a given program. Used for test coverage. Updated to fix build issues. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D143704
2023-03-17Revert "[flang] Feature list plugin"Valentin Clement
This reverts commit bde91fd03f72a25151caa9f8ee2d4572ff14619b. Failing buildbot: https://lab.llvm.org/buildbot/#/builders/181/builds/15552
2023-03-17[flang] Feature list pluginEthan Luis McDonough
Plugin that counts the number of times each tree node occurs in a given program. Used for test coverage. > One thing we need...is a way to determine what features a code uses. Preferably we would also be able to determine if they are implemented or not. Just the former could be done with a visitor for the parse tree. For the latter we would continue compilation and somehow ignore todo errors but collect them - @jdoerfert Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D143704