Fortran: Array descriptor initialization logic refactored
Fortran array descriptor initialization code is refactored into separate functions for clarity and maintainability.
Several functions related to Fortran array descriptor initialization have been refactored to improve code organization. Specific initialization logic for scalars and coarray descriptors has been moved into new, dedicated functions within trans-descriptor.cc and trans-types.cc. This change aims to make the code more modular and easier to understand.
In Details
The Fortran front-end refactors array descriptor initialization logic. Functions like gfc_conv_scalar_to_descriptor, gfc_conv_derived_to_class, and gfc_conv_class_to_class had inline descriptor setup code. This commit extracts scalar initialization into gfc_set_descriptor_from_scalar and gfc_set_descriptor_from_scalar_class, type creation into gfc_get_scalar_to_descriptor_type, and coarray copying into gfc_copy_coarray_desc_part. The changes primarily affect trans-expr.cc, trans-descriptor.cc, and trans-types.cc.
- array descriptor
- A data structure used in Fortran to represent an array, containing information about its base address, dimensions, strides, and other properties.
- scalar
- In programming, a scalar is a single value (e.g., an integer, float, or character) as opposed to an aggregate data type like an array or structure.
- coarray
- A Fortran language feature that allows for parallel programming by providing a way to access data on remote processors directly.
- trans-expr.cc
- A GCC source file containing code for translating Fortran expressions into intermediate representation.
- trans-descriptor.cc
- A GCC source file containing code related to the manipulation and creation of Fortran array descriptors.
- trans-types.cc
- A GCC source file responsible for handling type-related operations in the Fortran front-end.