Skip to main content

Module reduce

Module reduce 

Source
Expand description

Rewrite-rule-driven simplification of MirScalarExpr.

reduce repeatedly applies a fixed set of local rewrite rules to an expression until reaching a fixed point. The per-variant rules live in sibling modules (unary, binary, variadic, if_then); this file owns the fixed-point loop and the pre/post-pass dispatch.

Behavioral parity with the prior imperative implementation is a goal: rule order and the pre-/post-pass split are preserved.

Modulesยง

binary ๐Ÿ”’
Post-order rewrites for CallBinary nodes.
if_then ๐Ÿ”’
Post-order rewrites for If nodes.
unary ๐Ÿ”’
Post-order rewrites for CallUnary nodes.
variadic ๐Ÿ”’
Post-order rewrites for CallVariadic nodes.

Functionsยง

reduce
Reduce expr to a simpler equivalent form by repeatedly applying local rewrite rules until reaching a fixed point.
reduce_post ๐Ÿ”’
Post-order rewrites, applied after children have been reduced.
reduce_pre ๐Ÿ”’
Pre-order rewrites, applied before children are visited.