Skip to content

Walk

Walk dataclass

Walk(
    rule: RewriteRule,
    worklist: WorkList[IRNode] = WorkList(),
    skip: Callable[[IRNode], bool] = lambda _: False,
    reverse: bool = False,
    region_first: bool = False,
)

Bases: RewriteRule

Walk through the IR nodes and apply a rewrite rule.

The walk will apply the rewrite rule to each node in the IR tree in a depth-first order.

Parameters
  • map: The rewrite rule to apply.
  • reverse: Whether to traverse the IR tree in reverse order. Default is False.
  • region_first: Whether to traverse the regions before the blocks. Default is False.