Halide 17.0.1
Halide compiler and libraries
|
A common pattern when traversing Halide IR is that you need to keep track of stuff when you find a Let or a LetStmt, and that it should hide previous values with the same name until you leave the Let or LetStmt nodes This class helps with that. More...
#include <Scope.h>
Classes | |
class | const_iterator |
Iterate through the scope. More... | |
Public Member Functions | |
Scope ()=default | |
Scope (Scope &&that) noexcept=default | |
Scope & | operator= (Scope &&that) noexcept=default |
Scope (const Scope< T > &)=delete | |
Scope< T > & | operator= (const Scope< T > &)=delete |
void | set_containing_scope (const Scope< T > *s) |
Set the parent scope. | |
template<typename T2 = T, typename = typename std::enable_if<!std::is_same<T2, void>::value>::type> | |
T2 | get (const std::string &name) const |
Retrieve the value referred to by a name. | |
template<typename T2 = T, typename = typename std::enable_if<!std::is_same<T2, void>::value>::type> | |
T2 & | ref (const std::string &name) |
Return a reference to an entry. | |
bool | contains (const std::string &name) const |
Tests if a name is in scope. | |
size_t | count (const std::string &name) const |
How many nested definitions of a single name exist? | |
template<typename T2 = T, typename = typename std::enable_if<!std::is_same<T2, void>::value>::type> | |
void | push (const std::string &name, T2 &&value) |
Add a new (name, value) pair to the current scope. | |
template<typename T2 = T, typename = typename std::enable_if<std::is_same<T2, void>::value>::type> | |
void | push (const std::string &name) |
void | pop (const std::string &name) |
A name goes out of scope. | |
const_iterator | cbegin () const |
const_iterator | cend () const |
void | swap (Scope< T > &other) |
Static Public Member Functions | |
static const Scope< T > & | empty_scope () |
A const ref to an empty scope. | |
A common pattern when traversing Halide IR is that you need to keep track of stuff when you find a Let or a LetStmt, and that it should hide previous values with the same name until you leave the Let or LetStmt nodes This class helps with that.
|
default |
|
defaultnoexcept |
|
delete |
|
defaultnoexcept |
|
delete |
|
inline |
Set the parent scope.
If lookups fail in this scope, they check the containing scope before returning an error. Caller is responsible for managing the memory of the containing scope.
Definition at line 113 of file Scope.h.
References Halide::cast().
Referenced by Halide::Internal::ExprUsesVars< T >::ExprUsesVars().
|
inlinestatic |
A const ref to an empty scope.
Useful for default function arguments, which would otherwise require a copy constructor (with llvm in c++98 mode)
Definition at line 120 of file Scope.h.
References Halide::cast().
|
inline |
Retrieve the value referred to by a name.
Definition at line 128 of file Scope.h.
References Halide::Internal::Scope< T >::get(), and internal_error.
Referenced by Halide::Internal::Scope< T >::get().
|
inline |
Return a reference to an entry.
Does not consider the containing scope.
Definition at line 144 of file Scope.h.
References internal_error.
|
inline |
Tests if a name is in scope.
Definition at line 154 of file Scope.h.
References Halide::Internal::Scope< T >::contains().
Referenced by Halide::Internal::Scope< T >::contains().
|
inline |
How many nested definitions of a single name exist?
Definition at line 167 of file Scope.h.
References Halide::cast().
|
inline |
Add a new (name, value) pair to the current scope.
Hide old values that have this name until we pop this name.
Definition at line 181 of file Scope.h.
Referenced by Halide::Internal::stmt_or_expr_uses_var().
|
inline |
|
inline |
A name goes out of scope.
Restore whatever its old value was (or remove it entirely if there was nothing else of the same name in an outer scope)
Definition at line 194 of file Scope.h.
References internal_assert.
|
inline |
|
inline |
|
inline |
Definition at line 246 of file Scope.h.
References Halide::cast().