Low_level.Access_foldOrdered read-only Low_level traversal. Every policy decision is mandatory. Statements are visited before children and after their reads; Seq is left-to-right. Tile_mma descends through its equivalent fallback. A Prune skips children AND the after hook. Hooks may prune Tile_mma or Scan_loop when the consumer treats them as opaque.
Visit discarded operands is structural; Skip follows rendering. Gated operands are visited in source order (both Where arms) by default. Skip gated operands skips the entire subtree, including hoisted definitions: it is NOT an execution floor. The arms of a Ops.ternop_conditionality.Cond_and_one_arm ternary -- exactly one of which evaluates per visit -- reach the branches hook as one continuation each (in source order, under gated), with the ternary itself as select; the default in_order folds them in sequence, and a consumer with a branch algebra (a per-arm maximum, gh-ocannl-1451; the union of a select the backend blends, gh-ocannl-1775) supplies its own reduction there. Scope bodies reset gated because definitions hoist, while preserving statement guards. Dead-loop bodies visited structurally carry live=false; this does not evaluate constant guards or perform cleanup's placement-dependent setter elimination.
Scan init assignments precede the body; rotation assignments follow it. With scan_implicit = Skip, init expressions are still visited but synthetic Set_local events are absent. Scans must satisfy validate_scan_loops (in particular nonempty ranges). The fold visits a loop body once, not once per iteration; rotation events describe value dependencies rather than simulating simultaneous assignment. implicit identifies synthetic statements and their descendants; scope_depth counts Local_scope bodies; loops lists the enclosing For_loop / Scan_loop binders, innermost first (a scan's init expressions sit outside its binder, its body and rotations inside).
type binder = {index : Indexing.symbol;from_ : Base.int;to_ : Base.int;axis : axis_type Base.option;None: a Scan_loop's index.
}type context = {live : Base.bool;guards : scalar_arg Base.list;gated : Base.bool;scope_depth : Base.int;implicit : implicit;loops : binder Base.list;}The default branches: the arms folded in source order (union semantics).
val hooks : Base.unit -> 'a hooks