transformations.derived_types
Transformations dealing with derived types in subroutines and derived-type arguments in complex calling structures.
- DerivedTypeArgumentsTransformation:
Transformation to resolve array-of-structure (AOS) uses of derived-type variables to explicitly expose arrays from which to hoist dimensions.
Functions
|
Utility routine that returns the |
Classes
Transformation to remove derived types from subroutine signatures by replacing the relevant derived arguments with the sub-variables used in the called routine. |
|
Replace calls to type-bound procedures with direct calls to the corresponding subroutines/functions |
|
|
Transformer to carry out the replacement of subroutine and inline function calls to typebound procedures by direct calls to the respective procedures |
- class DerivedTypeArgumentsTransformation
Bases:
Transformation
Transformation to remove derived types from subroutine signatures by replacing the relevant derived arguments with the sub-variables used in the called routine. The equivalent change is also applied to all callers of the transformed subroutines.
Note, due to the dependency between caller and callee, this transformation should be applied atomically to sets of subroutine, if further transformations depend on the accurate signatures and call arguments.
- transform_subroutine(routine, **kwargs)
Defines the transformation to apply to
Subroutine
items.For transformations that modify
Subroutine
objects, this method should be implemented. It gets called via the dispatch methodapply()
.- Parameters:
routine (
Subroutine
) – The subroutine to be transformed.**kwargs (optional) – Keyword arguments for the transformation.
- flatten_derived_args_caller(caller)
Flatten all derived-type call arguments used in the target
Subroutine
for all activeCallStatement
nodes.The convention used is:
derived%var => derived_var
.- Parameters:
caller – The calling
Subroutine
.
- flatten_derived_args_routine(routine)
Unroll all derived-type arguments used in the subroutine signature, declarations and body.
The convention used is:
derived%var => derived_var
- class TypeboundProcedureCallTransformation(fix_intent=True, **kwargs)
Bases:
Transformation
Replace calls to type-bound procedures with direct calls to the corresponding subroutines/functions
Instead of calling a type-bound procedure, e.g.
CALL my_type%proc
, it is possible to import the bound procedure and call it directly, with the derived type as first argument, i.e.CALL proc(my_type)
. This transformation replaces all calls to type-bound procedures accordingly and inserts necessary imports.Also, for some compilers these direct calls seem to require an explicit
INTENT
specification on the polymorphic derived type dummy argument, which is set to INOUT by default, if missing. This behaviour can be switched off by settingfix_intent
to False.- Parameters:
fix_intent (bool) – Supply
INOUT
as intent on polymorphic dummy arguments missing an intent
- inline_call_dependencies
Additional call dependencies identified during the transformer pass that can be registered in the
Scheduler
viaScheduler.add_dependencies
.- Type:
- apply_default_polymorphic_intent(routine)
Utility routine to set a default
INTENT(INOUT)
on polymorphic dummy arguments (i.e. declared viaCLASS
) that don’t have an explicit intent
- add_inline_call_dependency(caller, callee)
Register a new dependency due to an inline call from
caller
tocallee
These dependencies are later on available to query via
inline_call_dependencies
.
- transform_subroutine(routine, **kwargs)
Apply the transformation of calls to the given
routine