loki.transformations.inline.constants
Functions
|
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 parentModule
needs to be supplied in thedefinitions
to the constructor when creating theSubroutine
.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)