Native visiting with exact dispatch and structural fallback.
More...
#include <object_functor.h>
|
| | ObjectVisitor () |
| | Construct a visitor using structural fallback for every value.
|
| |
| | ObjectVisitor (const ObjectVisitor &other)=delete |
| |
| ObjectVisitor & | operator= (const ObjectVisitor &other)=delete |
| |
| virtual ffi::Optional< VisitInterrupt > | Visit (ffi::AnyView value) |
| | Visit a borrowed object or inline value, throwing on failure.
|
| |
| Expected< ffi::Optional< VisitInterrupt > > | VisitExpected (ffi::AnyView value) noexcept |
| | Adapt the virtual throwing entrypoint to the structural ABI.
|
| |
|
| | ObjectVisitor (const VTable *vtable) |
| | Construct a visitor with a finalized native dispatch table.
|
| |
|
| static void | InitVTable (VTable *vtable) |
| | Initialize the base registrations in a fresh mutable table.
|
| |
| template<typename Self , typename Node > |
| static void | SetDispatch (VTable *vtable) |
| | Register an exact node type in a fresh table initialized by its parent. Derived node types require separate registrations.
|
| |
Native visiting with exact dispatch and structural fallback.
Allocate visitors with ffi::make_object<Derived>(). Inputs are borrowed; interrupts and errors own their values. A hook controls descent into its node. One visitor must not be shared by overlapping traversals.
◆ VTable
Exact native dispatch table with owning interrupt results.
◆ ObjectVisitor() [1/3]
| tvm::ObjectVisitor::ObjectVisitor |
( |
| ) |
|
|
inline |
Construct a visitor using structural fallback for every value.
◆ ObjectVisitor() [2/3]
◆ ObjectVisitor() [3/3]
| tvm::ObjectVisitor::ObjectVisitor |
( |
const VTable * |
vtable | ) |
|
|
inlineexplicitprotected |
Construct a visitor with a finalized native dispatch table.
- Parameters
-
| vtable | The immutable table, which must outlive this visitor. |
◆ InitVTable()
| static void tvm::ObjectVisitor::InitVTable |
( |
VTable * |
vtable | ) |
|
|
inlinestaticprotected |
Initialize the base registrations in a fresh mutable table.
- Parameters
-
| vtable | The table to initialize before adding derived registrations. |
◆ operator=()
◆ SetDispatch()
template<typename Self , typename Node >
| static void tvm::ObjectVisitor::SetDispatch |
( |
VTable * |
vtable | ) |
|
|
inlinestaticprotected |
Register an exact node type in a fresh table initialized by its parent. Derived node types require separate registrations.
- Template Parameters
-
| Self | The visitor implementing the hook. |
| Node | The exact node type handled by the hook. |
- Parameters
-
| vtable | The mutable table to receive the registration. |
◆ Visit()
| virtual ffi::Optional< VisitInterrupt > tvm::ObjectVisitor::Visit |
( |
ffi::AnyView |
value | ) |
|
|
inlinevirtual |
Visit a borrowed object or inline value, throwing on failure.
- Parameters
-
| value | The borrowed value to visit. |
- Returns
- None on completion or an owning interrupt that halts traversal.
- Note
- A qualified Parent::Visit bypasses this entry override only; recursive child visits still use virtual dispatch.
Reimplemented in tvm::ExprVisitor, and tvm::tirx::SRefTreeCreator.
◆ VisitExpected()
| Expected< ffi::Optional< VisitInterrupt > > tvm::ObjectVisitor::VisitExpected |
( |
ffi::AnyView |
value | ) |
|
|
inlinenoexcept |
Adapt the virtual throwing entrypoint to the structural ABI.
- Parameters
-
| value | The borrowed value to visit. |
- Returns
- Completion, interrupt, or the caught error.
- Note
- Follows the FFI safe-call exception contract: Error retains its identity, and other standard exceptions become InternalError.
The documentation for this class was generated from the following file: