template<typename T>
class tvm::ScopeStack< T >
A scope stack for maintaining hierarchical state during IR visiting.
During IR tree traversal, visitors often need to track scope-local state (e.g., active constraints, variable bindings) that should be automatically cleaned up when leaving a scope. ScopeStack provides this via WithNewScope, which pushes a new element on entry and pops it on exit.
constraints.
Current().Emplace(analyzer, condition);
return StmtExprMutator::VisitStmt_(op);
});
A scope stack for maintaining hierarchical state during IR visiting.
Definition scope_stack.h:55
auto WithNewScope(F &&body) -> decltype(body())
Execute body within a new scope.
Definition scope_stack.h:98
T & Current()
Access the current (innermost) scope element.
Definition scope_stack.h:78
Container of all statements.
Definition stmt.h:62
- Template Parameters
-
| T | The element type stored on the stack. Must be default-constructible. |