Go to the documentation of this file. 1 #ifndef HALIDE_EXPR_USES_VAR_H
2 #define HALIDE_EXPR_USES_VAR_H
15 template<
typename T =
void>
22 void include(
const Expr &e)
override {
29 void include(
const Stmt &s)
override {
36 void visit_name(
const std::string &name) {
40 include(scope.
get(name));
44 void visit(
const Variable *op)
override {
48 void visit(
const Load *op)
override {
53 void visit(
const Store *op)
override {
58 void visit(
const Call *op)
override {
63 void visit(
const Provide *op)
override {
68 void visit(
const LetStmt *op)
override {
73 void visit(
const Let *op)
override {
78 void visit(
const Realize *op)
override {
83 void visit(
const Allocate *op)
override {
100 template<
typename StmtOrExpr,
typename T>
112 template<
typename StmtOrExpr>
117 return stmt_or_expr_uses_vars<StmtOrExpr, void>(e, vars, s);
Allocate a scratch area called with the given name, type, and size.
bool stmt_uses_vars(const Stmt &stmt, const Scope< T > &v, const Scope< Expr > &s=Scope< Expr >::empty_scope())
Test if a statement references or defines any of the variables in a scope, additionally considering v...
bool contains(const std::string &name) const
Tests if a name is in scope.
The statement form of a let node.
T2 get(const std::string &name) const
Retrieve the value referred to by a name.
A common pattern when traversing Halide IR is that you need to keep track of stuff when you find a Le...
void set_containing_scope(const Scope< T > *s)
Set the parent scope.
A reference-counted handle to a statement node.
Load a value from a named symbol if predicate is true.
Allocate a multi-dimensional buffer of the given type and size.
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
bool stmt_uses_var(const Stmt &stmt, const std::string &v, const Scope< Expr > &s=Scope< Expr >::empty_scope())
Test if a statement references or defines the given variable, additionally considering variables boun...
This defines the value of a function at a multi-dimensional location.
@ Internal
Not visible externally, similar to 'static' linkage in C.
A let expression, like you might find in a functional language.
void visit(const IntImm *) override
These methods should call 'include' on the children to only visit them if they haven't been visited a...
Store a 'value' to the buffer called 'name' at a given 'index' if 'predicate' is true.
void push(const std::string &name, T2 &&value)
Add a new (name, value) pair to the current scope.
bool expr_uses_vars(const Expr &e, const Scope< T > &v, const Scope< Expr > &s=Scope< Expr >::empty_scope())
Test if an expression references or defines any of the variables in a scope, additionally considering...
bool expr_uses_var(const Expr &e, const std::string &v, const Scope< Expr > &s=Scope< Expr >::empty_scope())
Test if an expression references or defines the given variable, additionally considering variables bo...
bool stmt_or_expr_uses_var(const StmtOrExpr &e, const std::string &v, const Scope< Expr > &s=Scope< Expr >::empty_scope())
Test if a statement or expression references or defines the given variable, additionally considering ...
A fragment of Halide syntax.
A base class for algorithms that walk recursively over the IR without visiting the same node twice.
virtual void include(const Expr &)
By default these methods add the node to the visited set, and return whether or not it was already th...
bool stmt_or_expr_uses_vars(const StmtOrExpr &e, const Scope< T > &v, const Scope< Expr > &s=Scope< Expr >::empty_scope())
Test if a statement or expression references or defines any of the variables in a scope,...
ExprUsesVars(const Scope< T > &v, const Scope< Expr > *s=nullptr)