[PATCH v3 3/5] fortran: simplify elemental arguments walking

Mikael Morin mikael@gcc.gnu.org
Sun Nov 7 16:16:34 GMT 2021

This adds two functions working with the wrapper struct gfc_dummy_arg
and makes usage of them to simplify a bit the walking of elemental
procedure arguments for scalarization.  As information about dummy arguments
can be obtained from the actual argument through the just-introduced
associated_dummy field, there is no need to carry around the procedure
interface and walk dummy arguments manually together with actual arguments.

	* interface.c (gfc_dummy_arg_get_typespec,
	gfc_dummy_arg_is_optional): New functions.
	* gfortran.h (gfc_dummy_arg_get_typespec,
	gfc_dummy_arg_is_optional): Declare them.
	* trans.h (gfc_ss_info::dummy_arg): Use the wrapper type
	as declaration type.
	* trans-array.c (gfc_scalar_elemental_arg_saved_as_reference):
	use gfc_dummy_arg_get_typespec function to get the type.
	(gfc_walk_elemental_function_args): Remove proc_ifc argument.
	Get info about the dummy arg using the associated_dummy field.
	* trans-array.h (gfc_walk_elemental_function_args): Update declaration.
	* trans-intrinsic.c (gfc_walk_intrinsic_function):
	Update call to gfc_walk_elemental_function_args.
	* trans-stmt.c (gfc_trans_call): Ditto.
	(get_proc_ifc_for_call): Remove.
 gcc/fortran/gfortran.h        |  4 ++++
 gcc/fortran/interface.c       | 34 ++++++++++++++++++++++++++++++++++
 gcc/fortran/trans-array.c     | 19 ++++++-------------
 gcc/fortran/trans-array.h     |  2 +-
 gcc/fortran/trans-intrinsic.c |  2 +-
 gcc/fortran/trans-stmt.c      | 22 ----------------------
 gcc/fortran/trans.h           |  4 ++--
 7 files changed, 48 insertions(+), 39 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-fortran-simplify-elemental-arguments-walking.patch
Type: text/x-patch
Size: 7147 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20211107/1034fa8a/attachment.bin>

More information about the Gcc-patches mailing list