diff options
author | Andre Vehreschild <vehre@gcc.gnu.org> | 2025-02-07 11:25:31 +0100 |
---|---|---|
committer | Andre Vehreschild <vehre@gcc.gnu.org> | 2025-02-20 10:33:54 +0100 |
commit | 8bf0ee8d62b8a08e808344d31354ab713157e15d (patch) | |
tree | a68c67b2929bcfe28f655a54f264f9dde3202589 /gcc/fortran/coarray.cc | |
parent | 69eb02682b80b84dd0f562f19821c8c8c37ad243 (diff) | |
download | gcc-8bf0ee8d62b8a08e808344d31354ab713157e15d.zip gcc-8bf0ee8d62b8a08e808344d31354ab713157e15d.tar.gz gcc-8bf0ee8d62b8a08e808344d31354ab713157e15d.tar.bz2 |
Fortran: Add transfer_between_remotes [PR107635]
Add the last missing coarray data manipulation routine using remote
accessors.
gcc/fortran/ChangeLog:
PR fortran/107635
* coarray.cc (rewrite_caf_send): Rewrite to
transfer_between_remotes when both sides of the assignment have
a coarray.
(coindexed_code_callback): Prevent duplicate rewrite.
* gfortran.texi: Add documentation for transfer_between_remotes.
* intrinsic.cc (add_subroutines): Add intrinsic symbol for
caf_sendget to allow easy rewrite to transfer_between_remotes.
* trans-decl.cc (gfc_build_builtin_function_decls): Add
prototype for transfer_between_remotes.
* trans-intrinsic.cc (conv_caf_vector_subscript_elem): Mark as
deprecated.
(conv_caf_vector_subscript): Same.
(compute_component_offset): Same.
(conv_expr_ref_to_caf_ref): Same.
(conv_stat_and_team): Extract stat and team from expr.
(gfc_conv_intrinsic_caf_get): Use conv_stat_and_team.
(conv_caf_send_to_remote): Same.
(has_ref_after_cafref): Mark as deprecated.
(conv_caf_sendget): Translate to transfer_between_remotes.
* trans.h: Add prototype for transfer_between_remotes.
libgfortran/ChangeLog:
* caf/libcaf.h: Add prototype for transfer_between_remotes.
* caf/single.c: Implement transfer_between_remotes.
gcc/testsuite/ChangeLog:
* gfortran.dg/coarray_lib_comm_1.f90: Fix up scan_trees.
Diffstat (limited to 'gcc/fortran/coarray.cc')
-rw-r--r-- | gcc/fortran/coarray.cc | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/gcc/fortran/coarray.cc b/gcc/fortran/coarray.cc index 5002910..e5648e0 100644 --- a/gcc/fortran/coarray.cc +++ b/gcc/fortran/coarray.cc @@ -1351,12 +1351,6 @@ rewrite_caf_send (gfc_code *c) && arg->next->next && arg->next->next->expr->expr_type == EXPR_VARIABLE) return; - if (gfc_is_coindexed (rhs)) - { - c->resolved_isym->id = GFC_ISYM_CAF_SENDGET; - return; - } - send_to_remote_expr = create_send_callback (lhs, rhs); send_to_remote_hash_expr = gfc_get_expr (); send_to_remote_hash_expr->expr_type = EXPR_CONSTANT; @@ -1372,6 +1366,28 @@ rewrite_caf_send (gfc_code *c) arg = arg->next; arg->expr = send_to_remote_expr; gfc_add_caf_accessor (send_to_remote_hash_expr, send_to_remote_expr); + + if (gfc_is_coindexed (rhs)) + { + gfc_expr *get_from_remote_expr, *get_from_remote_hash_expr; + + c->resolved_isym = gfc_intrinsic_subroutine_by_id (GFC_ISYM_CAF_SENDGET); + get_from_remote_expr = create_get_callback (rhs); + get_from_remote_hash_expr = gfc_get_expr (); + get_from_remote_hash_expr->expr_type = EXPR_CONSTANT; + get_from_remote_hash_expr->ts.type = BT_INTEGER; + get_from_remote_hash_expr->ts.kind = gfc_default_integer_kind; + get_from_remote_hash_expr->where = rhs->where; + mpz_init_set_ui (get_from_remote_hash_expr->value.integer, + gfc_hash_value (get_from_remote_expr->symtree->n.sym)); + arg->next = gfc_get_actual_arglist (); + arg = arg->next; + arg->expr = get_from_remote_hash_expr; + arg->next = gfc_get_actual_arglist (); + arg = arg->next; + arg->expr = get_from_remote_expr; + gfc_add_caf_accessor (get_from_remote_hash_expr, get_from_remote_expr); + } } static int @@ -1451,7 +1467,9 @@ coindexed_code_callback (gfc_code **c, int *walk_subtrees, *walk_subtrees = 0; break; case GFC_ISYM_CAF_SENDGET: - // rewrite_caf_sendget (*c); + /* Seldomly this routine is called again with the symbol already + changed to CAF_SENDGET. Do not process the subtree again. The + rewrite has already been done by rewrite_caf_send (). */ *walk_subtrees = 0; break; case GFC_ISYM_ATOMIC_ADD: |