[flang][OpenMP] Lower iterator modifiers in map and motion clauses
Add iterator lowering for `target data`, `target enter/exit data`,
`target update`, and map clauses inside `declare mapper`.
For example:
```fortran
!$omp target update to(iterator(i=1:n): a(i), b)
```
Conceptually, this becomes:
```text
entries = omp.iterator(i = 1 through n) {
yield map_info(base = a, bounds = element i)
}
target_update(iterated_maps = entries, ordinary_maps = [b])
```
Keeping the array base and expressing selections through bounds lets the
same approach handle array elements, sections, and descriptor-backed arrays.
Each locator is expanded only over the iterators that appear in it:
```text
iterator(i=1:n, j=1:m): a(i), b(j), c(i,j)
| | |
i j i x j
```
Iterator ranges use the same canonical loop semantics throughout lowering:
```text
trip_count = canonicalTripCount(lower, upper, step, inclusive)
if any trip_count == 0:
result = []
skip iterator region
```
These rules preserve source behavior in edge cases. Fortran ranges include
the endpoint, so lowering marks them inclusive instead of dropping the last
entry. A range such as `5:1:1` is empty and yields no entries instead of being
mistaken for a large range. Bounds and reconstructed iterator values keep
their source integer width, preventing `INTEGER(16)` values from being
truncated.
Supports explicit and default mappers, including mapper declarations
imported from other modules.
This PR stacked on top of #197047 and #197752.
This patch is part of feature work for #188061.
Assisted with codex.
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.