loki.transformations.constant_propagation

Functions

do_constant_propagation(routine[, unroll_loops])

Apply constant-propagation gover the body of a Subroutine.

invalidate_constants_map(lhs, constants_map)

update_constants_map(lhs, value, constants_map)

Classes

ConstantPropagationMapper([...])

Mapper for expression-level constant replacement and folding.

ConstantPropagationTransformer([mapper, ...])

Apply constant-propagation analysis as a transformation driver.

do_constant_propagation(routine, unroll_loops=False)

Apply constant-propagation gover 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.