loki.transformations.constant_propagation module

do_constant_propagation(routine, unroll_loops=False)

Apply constant-propagation over the body of a Subroutine.

class ConstantPropagationMapper(enabled_simplifications=<Simplification.ALL: 31>)

Bases: SimplifyMapper

Mapper for expression-level constant replacement and folding.

map_array(expr, *args, **kwargs)
map_quotient(expr, *args, **kwargs)

Always force-evaluate integer-division

map_scalar(expr, *args, **kwargs)
map_deferred_type_symbol(expr, *args, **kwargs)
class ConstantPropagationTransformer(mapper=None, invalidate_source=True, inplace=False, rebuild_scopes=False)

Bases: Transformer

Apply constant-propagation analysis as a transformation driver.

visit_Assignment(o, **kwargs)
visit_Conditional(o, **kwargs)
visit_Loop(o, **kwargs)
generate_declarations_map(routine)

Build the initial constant map from declaration-time initializers.