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:

## 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< 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 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 | ( |  | ) |

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.

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

## mutate() [2/3]

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

virtual

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

References mutate_with_changes().

## visit() [1/48]

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

protected virtual

Referenced by Halide::SimdOpCheckTest::check_one().

## visit() [2/48]

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

protected virtual

## visit() [3/48]

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

protected virtual

## visit() [4/48]

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

protected virtual

## visit() [5/48]

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

protected virtual

## visit() [6/48]

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

protected virtual

## visit() [7/48]

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

protected virtual

## visit() [8/48]

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

protected virtual

## visit() [9/48]

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

protected virtual

## visit() [10/48]

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

protected virtual

## visit() [11/48]

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

protected virtual

## visit() [12/48]

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

protected virtual

## visit() [13/48]

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

protected virtual

## visit() [14/48]

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

protected virtual

## visit() [15/48]

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

protected virtual

## visit() [16/48]

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

protected virtual

## visit() [17/48]

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

protected virtual

## visit() [18/48]

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

protected virtual

## visit() [19/48]

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

protected virtual

## visit() [20/48]

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

protected virtual

## visit() [21/48]

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

protected virtual

## visit() [22/48]

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

protected virtual

## visit() [23/48]

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

protected virtual

## visit() [24/48]

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

protected virtual

## visit() [25/48]

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

protected virtual

## visit() [26/48]

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

protected virtual

## visit() [27/48]

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

protected virtual

## visit() [28/48]

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

protected virtual

## visit() [29/48]

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

protected virtual

## visit() [30/48]

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

protected virtual

## visit() [31/48]

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

protected virtual

## visit() [32/48]

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

protected virtual

## visit() [33/48]

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

protected virtual

## visit() [34/48]

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

protected virtual

## visit() [35/48]

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

protected virtual

## visit() [36/48]

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

protected virtual

## visit() [37/48]

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

protected virtual

## visit() [38/48]

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

protected virtual

## visit() [39/48]

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

protected virtual

## visit() [40/48]

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

protected virtual

## visit() [41/48]

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

protected virtual

## visit() [42/48]

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

protected virtual

## visit() [43/48]

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

protected virtual

## visit() [44/48]

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

protected virtual

## visit() [45/48]

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

protected virtual

## visit() [46/48]

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

protected virtual

## visit() [47/48]

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

protected virtual

## visit() [48/48]

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

protected virtual

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

- src/IRMutator.h