loki.transformations.inline.constants

Functions

inline_constant_parameters(routine[, ...])

Replace instances of variables with known constant values by Literals.

inline_constant_parameters(routine, external_only=True)

Replace instances of variables with known constant values by Literals.

Notes

The .type.initial property is used to derive the replacement value,a which means for symbols imported from external modules, the parent Module needs to be supplied in the definitions to the constructor when creating the Subroutine.

Variables that are replaced are also removed from their corresponding import statements, with empty import statements being removed alltogether.

Parameters:
  • routine (Subroutine) – Procedure in which to inline/resolve constant parameters.

  • external_only (bool, optional) – Do not replace variables declared in the local scope (default: True)