Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
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:
CheckCalls Halide::Internal::IRGraphMutator

Public Member Functions

 IRMutator ()=default
 
virtual ~IRMutator ()=default
 
virtual Expr mutate (const Expr &expr)
 This is the main interface for using a mutator.
 
virtual Stmt mutate (const Stmt &stmt)
 
std::pair< std::vector< Expr >, bool > mutate_with_changes (const std::vector< Expr > &)
 
std::vector< Exprmutate (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 Variable *)
 
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 Call *)
 
virtual Expr visit (const Let *)
 
virtual Expr visit (const Shuffle *)
 
virtual Expr visit (const VectorReduce *)
 
virtual Stmt visit (const LetStmt *)
 
virtual Stmt visit (const AssertStmt *)
 
virtual Stmt visit (const ProducerConsumer *)
 
virtual Stmt visit (const For *)
 
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 IfThenElse *)
 
virtual Stmt visit (const Evaluate *)
 
virtual Stmt visit (const Prefetch *)
 
virtual Stmt visit (const Acquire *)
 
virtual Stmt visit (const Fork *)
 
virtual Stmt visit (const Atomic *)
 
virtual Stmt visit (const HoistedStorage *)
 

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 26 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.

Referenced by Halide::Internal::IRGraphMutator::mutate().

◆ mutate() [2/3]

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

◆ 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 43 of file IRMutator.h.

References mutate_with_changes().

◆ visit() [1/48]

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

◆ visit() [2/48]

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

◆ visit() [3/48]

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

◆ visit() [4/48]

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

◆ visit() [5/48]

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

◆ visit() [6/48]

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

◆ visit() [7/48]

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

◆ visit() [8/48]

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

◆ visit() [9/48]

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

◆ visit() [10/48]

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

◆ visit() [11/48]

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

◆ visit() [12/48]

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

◆ visit() [13/48]

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

◆ visit() [14/48]

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

◆ visit() [15/48]

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

◆ visit() [16/48]

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

◆ visit() [17/48]

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

◆ visit() [18/48]

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

◆ visit() [19/48]

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

◆ visit() [20/48]

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

◆ visit() [21/48]

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

◆ visit() [22/48]

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

◆ visit() [23/48]

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

◆ visit() [24/48]

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

◆ visit() [25/48]

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

◆ visit() [26/48]

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

◆ visit() [27/48]

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

◆ visit() [28/48]

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

◆ visit() [29/48]

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

◆ visit() [30/48]

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

◆ visit() [31/48]

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

◆ visit() [32/48]

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

◆ visit() [33/48]

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

◆ visit() [34/48]

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

◆ visit() [35/48]

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

◆ visit() [36/48]

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

◆ visit() [37/48]

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

◆ visit() [38/48]

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

◆ visit() [39/48]

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

◆ visit() [40/48]

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

◆ visit() [41/48]

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

◆ visit() [42/48]

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

◆ visit() [43/48]

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

◆ visit() [44/48]

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

◆ visit() [45/48]

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

◆ visit() [46/48]

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

◆ visit() [47/48]

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

◆ visit() [48/48]

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

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