loki.transformations.inline.procedures

Functions

inline_internal_procedures(routine[, ...])

Inline internal subroutines contained in an individual Subroutine.

inline_marked_subroutines(routine[, ...])

Inline Subroutine objects guided by pragma annotations.

inline_member_procedures(routine[, ...])

Inline internal subroutines contained in an individual Subroutine.

inline_subroutine_calls(routine, calls, callee)

Inline a set of call to an individual Subroutine at source level.

map_call_to_procedure_body(call, caller[, ...])

Resolve arguments of a call and map to the called procedure body.

resolve_sequence_association_for_inlined_calls(...)

Resolve sequence association in calls to all member procedures (if inline_internals = True) or in calls to procedures that have been marked with an inline pragma (if inline_marked = True).

inline_internal_procedures(routine, allowed_aliases=None)

Inline internal subroutines contained in an individual Subroutine.

Please note that internal functions are not yet supported!

Parameters:
  • routine (Subroutine) – The subroutine in which to inline all member routines

  • allowed_aliases (tuple or list of str or Expression, optional) – List of variables that will not be renamed in the parent scope, even if they alias with a local declaration.

inline_member_procedures(routine, allowed_aliases=None)

Inline internal subroutines contained in an individual Subroutine.

Please note that internal functions are not yet supported!

Parameters:
  • routine (Subroutine) – The subroutine in which to inline all member routines

  • allowed_aliases (tuple or list of str or Expression, optional) – List of variables that will not be renamed in the parent scope, even if they alias with a local declaration.

inline_marked_subroutines(routine, allowed_aliases=None, adjust_imports=True)

Inline Subroutine objects guided by pragma annotations.

When encountering CallStatement objects that are marked with a !$loki inline pragma, this utility will attempt to replace the call with the body of the called procedure and remap all passed arguments into the calling procedures scope.

Please note that this utility requires CallStatement objects to be “enriched” with external type information.

Parameters:
  • routine (Subroutine) – The subroutine in which to look for pragma-marked procedures to inline

  • allowed_aliases (tuple or list of str or Expression, optional) – List of variables that will not be renamed in the parent scope, even if they alias with a local declaration.

  • adjust_imports (bool) – Adjust imports by removing the symbol of the inlined routine or adding imports needed by the imported routine (optional, default: True)

resolve_sequence_association_for_inlined_calls(routine, inline_internals, inline_marked)

Resolve sequence association in calls to all member procedures (if inline_internals = True) or in calls to procedures that have been marked with an inline pragma (if inline_marked = True). If both inline_internals and inline_marked are False, no processing is done.