loki.transformations.inline.functions

Functions

inline_elemental_functions(routine)

Replaces InlineCall expression to elemental functions with the called functions body.

inline_function_calls(routine, calls, ...[, ...])

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

inline_functions(routine[, ...])

Replaces InlineCall expression to functions with the called functions body.

inline_statement_functions(routine)

Replaces InlineCall expression to statement functions with the called statement functions rhs.

inline_elemental_functions(routine)

Replaces InlineCall expression to elemental functions with the called functions body.

Parameters:

routine (Subroutine) – Procedure in which to inline functions.

inline_functions(routine, inline_elementals_only=False, functions=None)

Replaces InlineCall expression to functions with the called functions body. Nested calls are handled/inlined through an iterative approach calling _inline_functions.

Parameters:
  • routine (Subroutine) – Procedure in which to inline functions.

  • inline_elementals_only (bool, optional) – Inline elemental routines/functions only (default: False).

  • functions (tuple, optional) – Inline only functions that are provided here (default: None, thus inline all functions).

inline_statement_functions(routine)

Replaces InlineCall expression to statement functions with the called statement functions rhs.

inline_function_calls(routine, calls, callee, nodes, allowed_aliases=None)

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

This will replace all InlineCall objects to the specified subroutine with an adjusted equivalent of the member routines’ body. For this, argument matching, including partial dimension matching for array references is performed, and all member-specific declarations are hoisted to the containing Subroutine.

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

  • calls (tuple or list of InlineCall) – Set of calls (to the same callee) to be inlined.

  • callee (Subroutine) – The called target function to be inlined in the parent

  • nodes (Node) – The corresponding nodes the functions are called from.

  • 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.