12 Commits

Author SHA1 Message Date
Krzysztof Parzyszek
755f298ddc
[flang][OpenMP] Implement COMBINER clause (#172036)
This adds parsing and lowering of the COMBINER clause. It utilizes the
existing lowering code for combiner-expression to lower the COMBINER
clause as well.
2025-12-18 08:04:28 -06:00
Krzysztof Parzyszek
41ceaf968f
[flang][OpenMP] Implement loop construct iterator range (#170734)
Since we're trying to preserve compiler directives in loop constructs,
not every element of the associated parser::Block needs to be a loop or
an OpenMP loop construct. Implement a helper class `LoopRange` to make
it easy to iterate over elements of parser::Block that are loops or loop
constructs.
2025-12-11 10:18:13 -06:00
Krzysztof Parzyszek
68caa8b2ef
[flang][OpenMP] Add explicit return type to visitor function (#170677)
This fixes a build break with older compilers after PR170351.
2025-12-04 09:47:39 -06:00
Krzysztof Parzyszek
04bc0af103
[flang][OpenMP] Expand GetOmpObjectList to all subclasses of OmpClause (#170351)
Use GetOmpObjectList instead of extracting the object list by hand.
2025-12-04 07:37:13 -06:00
Krzysztof Parzyszek
c81a189c50
[flang][OpenMP] Canonicalize loops with intervening OpenMP constructs (#169191)
Example based on the gfortran test a.6.1.f90
```
  do 100 i = 1,10
  !$omp do
    do 100 j = 1,10
      call work(i,j)
    100 continue
```

During canonicalization of label-DO loops, if the body of an OpenMP
construct ends with a label, treat the label as ending the construct
itself.

This will also allow handling of cases like
```
  do 100 i = 1, 10
  !$omp atomic write
  100 x = i
```
which we were unable to before.
2025-11-22 16:51:00 -06:00
Krzysztof Parzyszek
ebb0c9c559
[flang][OpenMP] Move some utilities from openmp-parsers to openmp-uti… (#169188)
…ls, NFC
2025-11-22 15:26:17 -06:00
Ferran Toda
f4ebee0ca9
[Flang][OpenMP] Add semantic support for Loop Sequences and OpenMP loop fuse (#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-21 08:16:30 -06:00
Krzysztof Parzyszek
c88ae6eb21
[flang][OpenMP] Move two utilities from Semantics to Parser, NFC (#168549)
Move `GetInnermostExecPart` and `IsStrictlyStructuredBlock` from
Semantics/openmp-utils.* to Parser/openmp-utils.*. These two only depend
on the AST contents and properties.
2025-11-18 11:44:03 -06:00
Krzysztof Parzyszek
3d3fab17f5
[flang][OpenMP] Use OmpDirectiveSpecification in ALLOCATE (#165865)
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-11-03 07:37:13 -06:00
Krzysztof Parzyszek
cd40bc487a
[flang][OpenMP] Implement OpenMP stylized expressions (#165049)
Consider OpenMP stylized expression to be a template to be instantiated
with a series of types listed on the containing directive (currently
DECLARE_REDUCTION). Create a series of instantiations in the parser,
allowing OpenMP special variables to be declared separately for each
type.

---------

Co-authored-by: Tom Eccles <tom.eccles@arm.com>
2025-10-28 12:45:04 -05:00
Krzysztof Parzyszek
13547a9a77
[flang][OpenMP] Turn IsStrictlyStructuredBlock into utility function,… (#158111)
… NFC
2025-09-12 08:39:16 -05:00
Krzysztof Parzyszek
9f1679190e
[flang][OpenMP] Update GetOmpObjectList, move to parser utils (#154389)
`GetOmpObjectList` takes a clause, and returns the pointer to the
contained OmpObjectList, or nullptr if the clause does not contain one.
Some clauses with object list were not recognized: handle all clauses,
and move the implementation to flang/Parser/openmp-utils.cpp.
2025-08-20 12:41:26 -05:00