From: Mikael Morin <[email protected]>

This is the second version of the second part of the array descriptor series.
The first version was posted in november:
https://gcc.gnu.org/pipermail/gcc-patches/2025-November/699382.html
https://gcc.gnu.org/pipermail/fortran/2025-November/063077.html

v1 to v2 changes:
 - rebase on current master and apply the different refactorings (if applicable)
     to the new code that didn't exist at the time of v1.
 - patch 8: the refactoring of v1 is no longer applicable as the code
     has changed (see PR125998), so the getters and setters are no longer
     necessary and are not added to the API.
 - patch 11/12: New patch renaming span field accessor static function.
 - all patches: Add references to PR122521
 - all patches: Reword function comments, taking into account review on patches
     2 and 5, and update the comments in the other patches as well to use a
     similar grammar everywhere.
 - patch 5: remove redundant assert as suggested in review.
 - patch 11/11 (now 12/12): rename variable as suggested in review.

--

This is the second part of the array descriptor series.

The goal here is to differenciate reads from writes among array descriptor
accesses.  This is important because changes to the array descriptor format
don't have the same impact on the code generated for either access.  Reads
can be translated transparently in the new format by calculating a value
from the new fields if the old field is not present any more.  For writes,
on the contrary, the same direct translation of individual field accesses is
not possible.

These patches introduce getters and setters for descriptor fields that
don't have them already, and replace descriptor fields usage with either
accessor.  Future patches will introduce more high level functions in order
to reduce usage of setters outside of trans-descriptor.cc.

Previous parts in the series:
part 1:
  https://gcc.gnu.org/pipermail/gcc-patches/2026-June/721900.html
  https://gcc.gnu.org/pipermail/fortran/2026-June/064198.html

Mikael Morin (12):
  fortran: array descriptor: Use the setter to modify the offset
    [PR122521]
  fortran: array descriptor: Add accessors for the elem_len field
    [PR122521]
  fortran: array descriptor: Add accessors for the version field
    [PR122521]
  fortran: array descriptor: Add accessors for the rank field [PR122521]
  fortran: array descriptor: Add accessors for the type field [PR122521]
  fortran: array descriptor: Add accessors for the dtype field
    [PR122521]
  fortran: array descriptor: Remove access to the attribute field
    [PR122521]
  fortran: array descriptor: Remove access to dim field elements
    [PR122521]
  fortran: array descriptor: Add a setter for the token field [PR122521]
  fortran: array descriptor: Rename dim subfields internal accessors
    [PR122521]
  fortran: array descriptor: Rename internal field accessor for span
    [PR122521]
  fortran: array descriptor: Add internal field accessor for data
    [PR122521]

 gcc/fortran/trans-array.cc      | 173 +++++++---------
 gcc/fortran/trans-decl.cc       |  40 ++--
 gcc/fortran/trans-descriptor.cc | 341 +++++++++++++++++++++++++++-----
 gcc/fortran/trans-descriptor.h  |  23 ++-
 gcc/fortran/trans-expr.cc       |  91 ++++-----
 gcc/fortran/trans-intrinsic.cc  |  26 +--
 gcc/fortran/trans-openmp.cc     |   8 +-
 gcc/fortran/trans-stmt.cc       |   7 +-
 gcc/fortran/trans.cc            |   5 +-
 9 files changed, 452 insertions(+), 262 deletions(-)

-- 
2.53.0

Reply via email to