Module Tolk.Gater
Moving gates from indices to memory accesses.
An index where g i invalid (Ops.invalid) addresses i where g holds and nothing elsewhere. No target renders Ops.invalid, so before rendering the condition moves onto the access: a load reads only where its gate holds, and gives an alternate value elsewhere; a store writes only where its gate holds.
#
val pm_move_gates_from_index : (unit, Ops.t) Ops.Pattern_matcher.tpm_move_gates_from_index moves gates onto loads and stores, with g a boolean node:
- a load or a store through an
Op.t.IndexorOp.t.Shrinkwhose first index iswhere g i invalidbecomes the same access with each of its sourceswhere g j invalidreplaced byj, gated byg; - a load gated this way reads
0where its gate fails; where g l a, withla load gated byg, islreadinga, cast tol's type, wheregfails.where g a l, withlgated bynot g, is the same.