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 | ( |  | ) |
| virtual default

## 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 * |  | ) |
| protected virtual

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 * |  | ) |
| protected virtual

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

## ◆ visit() [3/48]

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

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

## ◆ visit() [4/48]

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

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

## ◆ visit() [5/48]

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

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

## ◆ visit() [6/48]

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

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

## ◆ visit() [7/48]

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

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

## ◆ visit() [8/48]

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

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

## ◆ visit() [9/48]

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

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

## ◆ visit() [10/48]

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

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

## ◆ visit() [11/48]

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

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

## ◆ visit() [12/48]

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

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

## ◆ visit() [13/48]

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

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

## ◆ visit() [14/48]

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

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

## ◆ visit() [15/48]

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

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

## ◆ visit() [16/48]

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

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

## ◆ visit() [17/48]

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

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

## ◆ visit() [18/48]

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

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

## ◆ visit() [19/48]

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

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

## ◆ visit() [20/48]

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

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

## ◆ visit() [21/48]

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

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

## ◆ visit() [22/48]

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

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

## ◆ visit() [23/48]

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

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

## ◆ visit() [24/48]

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

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

## ◆ visit() [25/48]

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

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

## ◆ visit() [26/48]

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

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

## ◆ visit() [27/48]

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

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

## ◆ visit() [28/48]

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

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

## ◆ visit() [29/48]

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

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

## ◆ visit() [30/48]

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

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

## ◆ visit() [31/48]

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

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

## ◆ visit() [32/48]

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

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

## ◆ visit() [33/48]

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

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

## ◆ visit() [34/48]

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

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

## ◆ visit() [35/48]

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

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

## ◆ visit() [36/48]

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

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

## ◆ visit() [37/48]

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

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

## ◆ visit() [38/48]

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

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

## ◆ visit() [39/48]

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

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

## ◆ visit() [40/48]

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

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

## ◆ visit() [41/48]

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

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

## ◆ visit() [42/48]

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

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

## ◆ visit() [43/48]

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

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

## ◆ visit() [44/48]

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

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

## ◆ visit() [45/48]

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

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

## ◆ visit() [46/48]

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

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

## ◆ visit() [47/48]

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

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

## ◆ visit() [48/48]

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

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

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

- src/IRMutator.h