loki.transformations.sanitise
A small selection of utility transformations that resolve certain code constructs to unify code structure and make reasoning about Fortran code easier.
Functions
|
Check if an array argument, arg, is passed to an array dummy argument, dummy, using scalar syntax. |
|
Resolve |
|
Housekeeping routine to replace scalar syntax when passing arrays as arguments For example, a call like |
Check if call contains the sequence association pattern in one of the arguments, and if so, add the necessary transform data to call_map. |
Classes
|
|
|
|
- class SanitiseTransformation(resolve_associate_mappings=True, resolve_sequence_association=False)
Bases:
Transformation
Transformation
object to apply several code sanitisation steps when batch-processing large source trees via theScheduler
.- Parameters:
- 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.
- resolve_associates(routine)
Resolve
Associate
mappings in the body of a given routine.- Parameters:
routine (
Subroutine
) – The subroutine for which to resolve all associate blocks.
- class ResolveAssociatesTransformer(mapper=None, invalidate_source=True, inplace=False, rebuild_scopes=False)
Bases:
NestedTransformer
Transformer
class to resolveAssociate
nodes in IR treesThis will replace each
Associate
node with its own body, where all identifier symbols have been replaced with the corresponding selector expression defined inassociations
.- visit_Associate(o, **kwargs)
- transform_sequence_association(routine)
Housekeeping routine to replace scalar syntax when passing arrays as arguments For example, a call like
real :: a(m,n) call myroutine(a(i,j))
where myroutine looks like
subroutine myroutine(a) real :: a(5) end subroutine myroutine
should be changed to
call myroutine(a(i:m,j)
- Parameters:
routine (
Subroutine
) – The subroutine where calls will be changed
- transform_sequence_association_append_map(call_map, call)
Check if call contains the sequence association pattern in one of the arguments, and if so, add the necessary transform data to call_map.