Re: [PATCH 10/11] fortran: array descriptor: Rename dim subfields internal accessors

Paul Richard Thomas <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <CAGkQGiLRA5_6wbGs2=CMF7Kv=B=WYASNUCFwsTh2xHWuYMRENA@mail.gmail.com>
Hello Mikael,

This is also straightforward and LGTM.

Thanks

Paul

On Sat, 1 Nov 2025 at 20:58, Mikael Morin <[email protected]> wrote:
>
> From: Mikael Morin <[email protected]>
>
> Regression tested on powerpc64le-unknown-linux-gnu.  OK for master?
>
> -- >8 --
>
> Drop the gfc prefix from the internal function giving access to the lbound,
> ubound, and stride fields.  This aligns the function names with the rest of
> the compiler dropping the prefix for static functions.
>
> gcc/fortran/ChangeLog:
>
>         * trans-descriptor.cc (gfc_conv_descriptor_stride): Rename ...
>         (conv_descriptor_stride): ... to this.
>         (gfc_conv_descriptor_stride_get, gfc_conv_descriptor_stride_set):
>         Update caller.
>         (gfc_conv_descriptor_lbound): Rename ...
>         (conv_descriptor_lbound): ... to this.
>         (gfc_conv_descriptor_lbound_get, gfc_conv_descriptor_lbound_set):
>         Update caller.
>         (gfc_conv_descriptor_ubound): Rename ...
>         (conv_descriptor_ubound): ... to this.
>         (gfc_conv_descriptor_ubound_get, gfc_conv_descriptor_ubound_set):
>         Update caller.
> ---
>  gcc/fortran/trans-descriptor.cc | 48 ++++++++++++++++++++++++++-------
>  1 file changed, 39 insertions(+), 9 deletions(-)
>
> diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
> index 05e5e1a9294..450d5add38d 100644
> --- a/gcc/fortran/trans-descriptor.cc
> +++ b/gcc/fortran/trans-descriptor.cc
> @@ -488,14 +488,21 @@ gfc_conv_descriptor_subfield (tree desc, tree dim, unsigned field_idx)
>                           tmp, field, NULL_TREE);
>  }
>
> +
> +/* Return a reference to the stride for the (zero-based) dimension DIM of the
> +   array descriptor DESC.  */
> +
>  static tree
> -gfc_conv_descriptor_stride (tree desc, tree dim)
> +conv_descriptor_stride (tree desc, tree dim)
>  {
>    tree field = gfc_conv_descriptor_subfield (desc, dim, STRIDE_SUBFIELD);
>    gcc_assert (TREE_TYPE (field) == gfc_array_index_type);
>    return field;
>  }
>
> +/* Return the value of the stride for the (zero-based) dimension DIM of the
> +   array represented by descriptor DESC.  */
> +
>  tree
>  gfc_conv_descriptor_stride_get (tree desc, tree dim)
>  {
> @@ -510,58 +517,81 @@ gfc_conv_descriptor_stride_get (tree desc, tree dim)
>           || GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_POINTER_CONT))
>      return gfc_index_one_node;
>
> -  return gfc_conv_descriptor_stride (desc, dim);
> +  return conv_descriptor_stride (desc, dim);
>  }
>
> +/* Add code to BLOCK setting to VALUE the stride for the (zero-based) dimension
> +   DIM of the array descriptor DESC.  */
> +
>  void
>  gfc_conv_descriptor_stride_set (stmtblock_t *block, tree desc,
>                                 tree dim, tree value)
>  {
> -  tree t = gfc_conv_descriptor_stride (desc, dim);
> +  tree t = conv_descriptor_stride (desc, dim);
>    gfc_add_modify (block, t, fold_convert (TREE_TYPE (t), value));
>  }
>
> +
> +/* Return a reference to the lower bound for the (zero-based) dimension DIM of
> +   the array descriptor DESC.  */
> +
>  static tree
> -gfc_conv_descriptor_lbound (tree desc, tree dim)
> +conv_descriptor_lbound (tree desc, tree dim)
>  {
>    tree field = gfc_conv_descriptor_subfield (desc, dim, LBOUND_SUBFIELD);
>    gcc_assert (TREE_TYPE (field) == gfc_array_index_type);
>    return field;
>  }
>
> +/* Return the value of the lower bound for the (zero-based) dimension DIM of the
> +   array represented by descriptor DESC.  */
> +
>  tree
>  gfc_conv_descriptor_lbound_get (tree desc, tree dim)
>  {
> -  return gfc_conv_descriptor_lbound (desc, dim);
> +  return conv_descriptor_lbound (desc, dim);
>  }
>
> +/* Add code to BLOCK setting to VALUE the lower bound for the (zero-based)
> +   dimension DIM of the array descriptor DESC.  */
> +
>  void
>  gfc_conv_descriptor_lbound_set (stmtblock_t *block, tree desc,
>                                 tree dim, tree value)
>  {
> -  tree t = gfc_conv_descriptor_lbound (desc, dim);
> +  tree t = conv_descriptor_lbound (desc, dim);
>    gfc_add_modify (block, t, fold_convert (TREE_TYPE (t), value));
>  }
>
> +
> +/* Return a reference to the upper bound for the (zero-based) dimension DIM of
> +   the array descriptor DESC.  */
> +
>  static tree
> -gfc_conv_descriptor_ubound (tree desc, tree dim)
> +conv_descriptor_ubound (tree desc, tree dim)
>  {
>    tree field = gfc_conv_descriptor_subfield (desc, dim, UBOUND_SUBFIELD);
>    gcc_assert (TREE_TYPE (field) == gfc_array_index_type);
>    return field;
>  }
>
> +/* Return the value of the upper bound for the (zero-based) dimension DIM of the
> +   array represented by descriptor DESC.  */
> +
>  tree
>  gfc_conv_descriptor_ubound_get (tree desc, tree dim)
>  {
> -  return gfc_conv_descriptor_ubound (desc, dim);
> +  return conv_descriptor_ubound (desc, dim);
>  }
>
> +/* Add code to BLOCK setting to VALUE the upper bound for the (zero-based)
> +   dimension DIM of the array descriptor DESC.  */
> +
>  void
>  gfc_conv_descriptor_ubound_set (stmtblock_t *block, tree desc,
>                                 tree dim, tree value)
>  {
> -  tree t = gfc_conv_descriptor_ubound (desc, dim);
> +  tree t = conv_descriptor_ubound (desc, dim);
>    gfc_add_modify (block, t, fold_convert (TREE_TYPE (t), value));
>  }
>
> --
> 2.51.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.