[gcc(refs/users/mikael/heads/refactor_descriptor_v03)] Refactoring gfc_conv_descriptor_sm_get.
Mikael Morin
mikael@gcc.gnu.org
Fri Mar 14 16:10:53 GMT 2025
https://gcc.gnu.org/g:ef00016ef0be85e426529bdf09c9ebfebd2262c8
commit ef00016ef0be85e426529bdf09c9ebfebd2262c8
Author: Mikael Morin <mikael@gcc.gnu.org>
Date: Wed Jan 22 21:59:46 2025 +0100
Refactoring gfc_conv_descriptor_sm_get.
Diff:
---
gcc/fortran/trans-array.cc | 11 +++++++++++
gcc/fortran/trans-array.h | 1 +
gcc/fortran/trans-expr.cc | 4 +---
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index cc785b39d817..e40c1dbf2783 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -591,6 +591,17 @@ gfc_conv_descriptor_extent_get (tree desc, tree dim)
}
+tree
+gfc_conv_descriptor_sm_get (tree desc, tree dim)
+{
+ tree stride = gfc_conv_descriptor_stride_get (desc, dim);
+ tree span = gfc_conv_descriptor_span_get (desc);
+
+ return fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type,
+ stride, span);
+}
+
+
static int
get_type_info (const bt &type)
{
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index 1d694989b4c3..296a8052dd73 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -195,6 +195,7 @@ tree gfc_conv_descriptor_stride_get (tree, tree);
tree gfc_conv_descriptor_lbound_get (tree, tree);
tree gfc_conv_descriptor_ubound_get (tree, tree);
tree gfc_conv_descriptor_extent_get (tree, tree);
+tree gfc_conv_descriptor_sm_get (tree, tree);
tree gfc_conv_descriptor_token (tree);
void gfc_conv_descriptor_data_set (stmtblock_t *, tree, tree);
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index bdf4dedc3293..4451ce1d7ba0 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -6426,9 +6426,7 @@ gfc_conv_gfc_desc_to_cfi_desc (gfc_se *parmse, gfc_expr *e, gfc_symbol *fsym)
tmp = gfc_conv_descriptor_extent_get (gfc, idx);
gfc_add_modify (&loop_body, gfc_get_cfi_dim_extent (cfi, idx), tmp);
/* d->dim[n].sm = gfc->dim[i].stride * gfc->span); */
- tmp = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type,
- gfc_conv_descriptor_stride_get (gfc, idx),
- gfc_conv_descriptor_span_get (gfc));
+ tmp = gfc_conv_descriptor_sm_get (gfc, idx);
gfc_add_modify (&loop_body, gfc_get_cfi_dim_sm (cfi, idx), tmp);
/* Generate loop. */
More information about the Gcc-cvs
mailing list