[gcc(refs/users/mikael/heads/refactor_descriptor_v202)] fortran: array descriptor: Move debug info generation function
Mikael Morin
mikael@gcc.gnu.org
Fri Jun 26 09:51:47 GMT 2026
https://gcc.gnu.org/g:4ddb7eb71d92901cc5f906255605da499459cfc0
commit 4ddb7eb71d92901cc5f906255605da499459cfc0
Author: Mikael Morin <mikael@gcc.gnu.org>
Date: Wed Oct 29 12:56:03 2025 +0100
fortran: array descriptor: Move debug info generation function
Regression tested on powerpc64le-unknown-linux-gnu. OK for master?
-- >8 --
Move the gfc_get_descriptor_offsets_for_info function, which is used
to build debug info of array descriptors, to the trans-descriptor.cc
file.
gcc/fortran/ChangeLog:
* trans-array.cc (gfc_get_descriptor_offsets_for_info): Move
function ...
* trans-descriptor.cc (gfc_get_descriptor_offsets_for_info): ...
to this file.
* trans-array.h (gfc_get_descriptor_offsets_for_info): Move
declaration ...
* trans-descriptor.h (gfc_get_descriptor_offsets_for_info): ...
to this file.
* trans-types.cc: Include trans-descriptor.h.
Diff:
---
gcc/fortran/trans-array.cc | 32 --------------------------------
gcc/fortran/trans-array.h | 5 -----
gcc/fortran/trans-descriptor.cc | 32 ++++++++++++++++++++++++++++++++
gcc/fortran/trans-descriptor.h | 5 +++++
gcc/fortran/trans-types.cc | 1 +
5 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 032821fde804..55f0c35310d2 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -285,38 +285,6 @@ gfc_conv_shift_descriptor_lbound (stmtblock_t* block, tree desc,
}
-/* Obtain offsets for trans-types.cc(gfc_get_array_descr_info). */
-
-void
-gfc_get_descriptor_offsets_for_info (const_tree desc_type, tree *data_off,
- tree *dtype_off, tree *span_off,
- tree *dim_off, tree *dim_size,
- tree *stride_suboff, tree *lower_suboff,
- tree *upper_suboff)
-{
- tree field;
- tree type;
-
- type = TYPE_MAIN_VARIANT (desc_type);
- field = gfc_advance_chain (TYPE_FIELDS (type), DATA_FIELD);
- *data_off = byte_position (field);
- field = gfc_advance_chain (TYPE_FIELDS (type), DTYPE_FIELD);
- *dtype_off = byte_position (field);
- field = gfc_advance_chain (TYPE_FIELDS (type), SPAN_FIELD);
- *span_off = byte_position (field);
- field = gfc_advance_chain (TYPE_FIELDS (type), DIMENSION_FIELD);
- *dim_off = byte_position (field);
- type = TREE_TYPE (TREE_TYPE (field));
- *dim_size = TYPE_SIZE_UNIT (type);
- field = gfc_advance_chain (TYPE_FIELDS (type), STRIDE_SUBFIELD);
- *stride_suboff = byte_position (field);
- field = gfc_advance_chain (TYPE_FIELDS (type), LBOUND_SUBFIELD);
- *lower_suboff = byte_position (field);
- field = gfc_advance_chain (TYPE_FIELDS (type), UBOUND_SUBFIELD);
- *upper_suboff = byte_position (field);
-}
-
-
/* Cleanup those #defines. */
#undef DATA_FIELD
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index 3b466df9380b..721364fb6acf 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -169,11 +169,6 @@ tree gfc_conv_array_ubound (tree, int);
tree gfc_trans_array_bounds (tree, gfc_symbol *, tree *, stmtblock_t *);
void gfc_trans_array_cobounds (tree, stmtblock_t *, const gfc_symbol *);
-/* Build expressions for accessing components of an array descriptor. */
-void gfc_get_descriptor_offsets_for_info (const_tree, tree *, tree *, tree *,
- tree *, tree *, tree *, tree *,
- tree *);
-
/* CFI descriptor. */
tree gfc_get_cfi_desc_base_addr (tree);
tree gfc_get_cfi_desc_elem_len (tree);
diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 649ff2415db2..18603601663f 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -347,6 +347,38 @@ gfc_conv_descriptor_ubound_set (stmtblock_t *block, tree desc,
}
+/* Obtain offsets for trans-types.cc(gfc_get_array_descr_info). */
+
+void
+gfc_get_descriptor_offsets_for_info (const_tree desc_type, tree *data_off,
+ tree *dtype_off, tree *span_off,
+ tree *dim_off, tree *dim_size,
+ tree *stride_suboff, tree *lower_suboff,
+ tree *upper_suboff)
+{
+ tree field;
+ tree type;
+
+ type = TYPE_MAIN_VARIANT (desc_type);
+ field = gfc_advance_chain (TYPE_FIELDS (type), DATA_FIELD);
+ *data_off = byte_position (field);
+ field = gfc_advance_chain (TYPE_FIELDS (type), DTYPE_FIELD);
+ *dtype_off = byte_position (field);
+ field = gfc_advance_chain (TYPE_FIELDS (type), SPAN_FIELD);
+ *span_off = byte_position (field);
+ field = gfc_advance_chain (TYPE_FIELDS (type), DIMENSION_FIELD);
+ *dim_off = byte_position (field);
+ type = TREE_TYPE (TREE_TYPE (field));
+ *dim_size = TYPE_SIZE_UNIT (type);
+ field = gfc_advance_chain (TYPE_FIELDS (type), STRIDE_SUBFIELD);
+ *stride_suboff = byte_position (field);
+ field = gfc_advance_chain (TYPE_FIELDS (type), LBOUND_SUBFIELD);
+ *lower_suboff = byte_position (field);
+ field = gfc_advance_chain (TYPE_FIELDS (type), UBOUND_SUBFIELD);
+ *upper_suboff = byte_position (field);
+}
+
+
/* Cleanup those #defines. */
#undef DATA_FIELD
diff --git a/gcc/fortran/trans-descriptor.h b/gcc/fortran/trans-descriptor.h
index 142499f07ec9..db877ee402b6 100644
--- a/gcc/fortran/trans-descriptor.h
+++ b/gcc/fortran/trans-descriptor.h
@@ -46,4 +46,9 @@ void gfc_conv_descriptor_stride_set (stmtblock_t *, tree, tree, tree);
void gfc_conv_descriptor_lbound_set (stmtblock_t *, tree, tree, tree);
void gfc_conv_descriptor_ubound_set (stmtblock_t *, tree, tree, tree);
+/* Build expressions for accessing components of an array descriptor. */
+void gfc_get_descriptor_offsets_for_info (const_tree, tree *, tree *, tree *,
+ tree *, tree *, tree *, tree *,
+ tree *);
+
#endif /* GFC_TRANS_DESCRIPTOR_H */
diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc
index 5bccea960aaa..9ecf034d34a6 100644
--- a/gcc/fortran/trans-types.cc
+++ b/gcc/fortran/trans-types.cc
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "trans-types.h"
#include "trans-const.h"
#include "trans-array.h"
+#include "trans-descriptor.h"
#include "dwarf2out.h" /* For struct array_descr_info. */
#include "attribs.h"
#include "alias.h"
More information about the Gcc-cvs
mailing list