Halide 22.0.0 Halide compiler and libraries

Public Member Functions | Protected Member Functions | List of all members
Halide::Internal::IRMutator Class Reference

A base class for passes over the IR which modify it (e.g. More...

`#include <IRMutator.h>`

Inheritance diagram for Halide::Internal::IRMutator:

## Public Member Functions
| IRMutator ()=default
virtual | ~IRMutator ()=default
virtual Expr | mutate (const Expr &expr)
| This is the main interface for using a mutator. More...
virtual Stmt | mutate (const Stmt &stmt)
std::pair< std::vector< Expr >, bool > | mutate_with_changes (const std::vector< Expr > &)
std::vector< Expr > | mutate (const std::vector< Expr > &exprs)

## Protected Member Functions
virtual Expr | visit (const IntImm *)
virtual Expr | visit (const UIntImm *)
virtual Expr | visit (const FloatImm *)
virtual Expr | visit (const StringImm *)
virtual Expr | visit (const Cast *)
virtual Expr | visit (const Reinterpret *)
virtual Expr | visit (const Add *)
virtual Expr | visit (const Sub *)
virtual Expr | visit (const Mul *)
virtual Expr | visit (const Div *)
virtual Expr | visit (const Mod *)
virtual Expr | visit (const Min *)
virtual Expr | visit (const Max *)
virtual Expr | visit (const EQ *)
virtual Expr | visit (const NE *)
virtual Expr | visit (const LT *)
virtual Expr | visit (const LE *)
virtual Expr | visit (const GT *)
virtual Expr | visit (const GE *)
virtual Expr | visit (const And *)
virtual Expr | visit (const Or *)
virtual Expr | visit (const Not *)
virtual Expr | visit (const Select *)
virtual Expr | visit (const Load *)
virtual Expr | visit (const Ramp *)
virtual Expr | visit (const Broadcast *)
virtual Expr | visit (const Let *)
virtual Stmt | visit (const LetStmt *)
virtual Stmt | visit (const AssertStmt *)
virtual Stmt | visit (const ProducerConsumer *)
virtual Stmt | visit (const Store *)
virtual Stmt | visit (const Provide *)
virtual Stmt | visit (const Allocate *)
virtual Stmt | visit (const Free *)
virtual Stmt | visit (const Realize *)
virtual Stmt | visit (const Block *)
virtual Stmt | visit (const Fork *)
virtual Stmt | visit (const IfThenElse *)
virtual Stmt | visit (const Evaluate *)
virtual Expr | visit (const Call *)
virtual Expr | visit (const Variable *)
virtual Stmt | visit (const For *)
virtual Stmt | visit (const Acquire *)
virtual Expr | visit (const Shuffle *)
virtual Stmt | visit (const Prefetch *)
virtual Stmt | visit (const HoistedStorage *)
virtual Stmt | visit (const Atomic *)
virtual Expr | visit (const VectorReduce *)

## Detailed Description

A base class for passes over the IR which modify it (e.g.

replacing a variable with a value (Substitute.h), or constant-folding).

Your mutator should override the visit() methods you care about and return the new expression or stmt. The default implementations recursively mutate their children. To mutate sub-expressions and sub-statements you should override the mutate() method, which will dispatch to the appropriate visit() method and then return the value of expr or stmt after the call to visit.

Definition at line 28 of file IRMutator.h.

## Constructor & Destructor Documentation

## ◆ IRMutator()

Halide::Internal::IRMutator::IRMutator | ( |  | ) |
| default

## ◆ ~IRMutator()

virtual Halide::Internal::IRMutator::~IRMutator | ( |  | ) |
| virtualdefault

## Member Function Documentation

## ◆ mutate() [1/3]

virtual Expr Halide::Internal::IRMutator::mutate | ( | const Expr & | expr | ) |
| virtual

This is the main interface for using a mutator.

Also call these in your subclass to mutate sub-expressions and sub-statements.

Reimplemented in Halide::Internal::IRGraphMutator, Halide::Internal::LambdaMutatorGeneric< Lambdas >, and Halide::Internal::IRGraphMutator.

Referenced by Halide::Internal::LambdaMutatorGeneric< Lambdas >::mutate_base(), and Halide::Internal::mutate_with().

## ◆ mutate() [2/3]

virtual Stmt Halide::Internal::IRMutator::mutate | ( | const Stmt & | stmt | ) |
| virtual

Reimplemented in Halide::Internal::LambdaMutatorGeneric< Lambdas >, Halide::Internal::IRGraphMutator, and Halide::Internal::IRGraphMutator.

## ◆ mutate_with_changes()

std::pair< std::vector< Expr >, bool > Halide::Internal::IRMutator::mutate_with_changes | ( | const std::vector< Expr > & |  | ) |

Referenced by mutate().

## ◆ mutate() [3/3]

std::vector< Expr > Halide::Internal::IRMutator::mutate | ( | const std::vector< Expr > & | exprs | ) |
| inline

Definition at line 45 of file IRMutator.h.

References mutate_with_changes().

## ◆ visit() [1/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const IntImm * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

Referenced by Halide::SimdOpCheckTest::check_one(), and Halide::Internal::LambdaMutator< Lambdas >::visit_base().

## ◆ visit() [2/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const UIntImm * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [3/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const FloatImm * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [4/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const StringImm * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [5/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Cast * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [6/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Reinterpret * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [7/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Add * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [8/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Sub * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [9/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Mul * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [10/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Div * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [11/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Mod * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [12/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Min * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [13/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Max * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [14/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const EQ * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [15/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const NE * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [16/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const LT * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [17/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const LE * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [18/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const GT * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [19/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const GE * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [20/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const And * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [21/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Or * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [22/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Not * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [23/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Select * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [24/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Load * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [25/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Ramp * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [26/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Broadcast * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [27/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Let * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [28/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const LetStmt * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [29/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const AssertStmt * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [30/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const ProducerConsumer * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [31/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const Store * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [32/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const Provide * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [33/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const Allocate * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [34/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const Free * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [35/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const Realize * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [36/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const Block * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [37/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const Fork * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [38/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const IfThenElse * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [39/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const Evaluate * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [40/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Call * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [41/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Variable * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [42/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const For * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [43/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const Acquire * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [44/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const Shuffle * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [45/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const Prefetch * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [46/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const HoistedStorage * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [47/48]

virtual Stmt Halide::Internal::IRMutator::visit | ( | const Atomic * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

## ◆ visit() [48/48]

virtual Expr Halide::Internal::IRMutator::visit | ( | const VectorReduce * |  | ) |
| protectedvirtual

Reimplemented in Halide::Internal::LambdaMutator< Lambdas >.

The documentation for this class was generated from the following file:

- src/IRMutator.h