summaryrefslogtreecommitdiff
path: root/flang/lib/Semantics/check-omp-loop.cpp
AgeCommit message (Collapse)Author
2025-11-22[flang][OpenMP] Implement loop nest parser (#168884)Krzysztof Parzyszek
Previously, loop constructs were parsed in a piece-wise manner: the begin directive, the body, and the end directive were parsed separately. Later on in canonicalization they were all coalesced into a loop construct. To facilitate that end-loop directives were given a special treatment, namely they were parsed as OpenMP constructs. As a result syntax errors caused by misplaced end-loop directives were handled differently from those cause by misplaced non-loop end directives. The new loop nest parser constructs the complete loop construct, removing the need for the canonicalization step. Additionally, it is the basis for parsing loop-sequence-associated constructs in the future. It also removes the need for the special treatment of end-loop directives. While this patch temporarily degrades the error messaging for misplaced end-loop directives, it enables uniform handling of any misplaced end-directives in the future.
2025-11-21[Flang][OpenMP] Add semantic support for Loop Sequences and OpenMP loop fuse ↵Ferran Toda
(#161213) This patch adds semantics for the `omp fuse` directive in flang, as specified in OpenMP 6.0. This patch also enables semantic support for loop sequences which are needed for the fuse directive along with semantics for the `looprange` clause. These changes are only semantic. Relevant tests have been added , and previous behavior is retained with no changes. --------- Co-authored-by: Ferran Toda <ferran.todacasaban@bsc.es> Co-authored-by: Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com>
2025-11-17[flang][OpenMP] Store Block in OpenMPLoopConstruct, add access functions ↵Krzysztof Parzyszek
(#168078) Instead of storing a variant with specific types, store parser::Block as the body. Add two access functions to make the traversal of the nest simpler. This will allow storing loop-nest sequences in the future.
2025-10-20[flang] Move parse tree tool to Parser/tools.h (#163998)Peter Klausler
Move the parse tree utility function semantics::getDesignatorNameIfDataRef to Parser/tools.h and rename it to comply with the local style.
2025-10-20[flang][OpenMP]: Allow orphaned distribute construct (#163546)CHANDRA GHALE
If there is a call inside a TEAMS construct, and that call contains a DISTRIBUTE construct, the DISTRIBUTE region is considered to be enclosed by the TEAMS region (based on the dynamic extent of the construct). Currently, Flang diagnoses this as an error, which is incorrect. For eg : ``` subroutine f !$omp distribute do i = 1, 100 ... end do end subroutine subroutine g !$omp teams call f ! this call is ok, distribute enclosed by teams !$omp end teams end subroutine ``` This patch adjusts the nesting check for the OpenMP DISTRIBUTE directive. It retains the error for DISTRIBUTE directives that are incorrectly nested lexically but downgrades it to a warning for orphaned directives to allow dynamic nesting, such as when a subroutine with DISTRIBUTE is called from within a TEAMS region. Co-authored-by: Chandra Ghale <ghale@pe31.hpc.amslabs.hpecorp.net>
2025-09-22[flang][OpenMP] Reject blank common blocks more gracefully (#159626)Krzysztof Parzyszek
Parse them as "invalid" OmpObjects, then emit a diagnostic in semantic checks.
2025-09-16[flang][OpenMP] Use OmpDirectiveSpecification in Omp[Begin|End]LoopDi… ↵Krzysztof Parzyszek
(#159087) …rective This makes accessing directive components, such as directive name or the list of clauses simpler and more uniform across different directives. It also makes the parser simpler, since it reuses existing parsing functionality. The changes are scattered over a number of files, but they all share the same nature: - getting the begin/end directive from OpenMPLoopConstruct, - getting the llvm::omp::Directive enum, and the source location, - getting the clause list.
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-07[flang][OpenMP] Make OpenMPCriticalConstruct follow block structure (#152007)Krzysztof Parzyszek
This allows not having the END CRITICAL directive in certain situations. Update semantic checks and symbol resolution.
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-01[flang][OpenMP] Split check-omp-structure.cpp into smaller files, NFC (#146359)Krzysztof Parzyszek
Create these new files in flang/lib/Semantics: openmp-utils.cpp/.h - Common utilities check-omp-atomic.cpp - Atomic-related checks check-omp-loop.cpp - Loop constructs/clauses check-omp-metadirective.cpp - Metadirective-related checks Update lists of included headers, std in particular. --------- Co-authored-by: Jack Styles <jack.styles@arm.com>