Skip to content

Abc

RewriteRule dataclass

RewriteRule()

Bases: ABC

A rewrite rule that matches and rewrites IR nodes.

The rewrite rule is applied to an IR node by calling the instance with the node as an argument. The rewrite rule should mutate the node instead of returning a new node. A RewriteResult should be returned to indicate whether the rewrite rule has done something, whether the rewrite rule should terminate, and whether the rewrite rule has exceeded the maximum number of iterations.