Template Function tvm::tirx::StructuralWalkWithConstraintContext

Template Function tvm::tirx::StructuralWalkWithConstraintContext#

Function Documentation#

template<ffi::WalkOrder order, typename ...Callbacks>
ffi::Optional<ffi::VisitInterrupt> tvm::tirx::StructuralWalkWithConstraintContext(ffi::AnyView root, Callbacks&&... callbacks)#

Walk every occurrence with (value, const sym::ConstraintContext&) callbacks. A trailing TVMFFIDefRegionKind is optional, as in ffi::StructuralWalk. Return Expected<WalkResult>; pre-order Skip prunes descent and Interrupt stops the walk. Post callbacks see a scoped node after its internal scope is restored. Sequence traversal visits its statements directly in order; lazy calls visit their arguments directly so each branch has its own scope. These two hooks do not dispatch a callback for their intermediate Array containers.

StructuralWalkWithConstraintContext<ffi::WalkOrder::kPreOrder>(stmt,
  [](const Var& var, const sym::ConstraintContext& facts)
      -> ffi::Expected<ffi::WalkResult> {
auto snapshot = facts->ToArray();
return ffi::WalkResult::Advance();
  });