4949#define TVM_ARITH_ITER_AFFINE_MAP_H_
5050
5151#include < tvm/arith/analyzer.h>
52+ #include < tvm/ffi/reflection/reflection.h>
5253#include < tvm/ir/diagnostic.h>
5354#include < tvm/ir/expr.h>
5455#include < tvm/tir/var.h>
@@ -65,9 +66,7 @@ namespace arith {
6566 */
6667class IterMapExprNode : public PrimExprNode {
6768 public:
68- // overrides
69- void VisitAttrs (tvm::AttrVisitor* v) {}
70-
69+ static constexpr bool _type_has_method_visit_attrs = false ;
7170 static constexpr const char * _type_key = " arith.IterMapExpr" ;
7271 static constexpr const uint32_t _type_child_slots = 2 ;
7372 TVM_DECLARE_BASE_OBJECT_INFO (IterMapExprNode, PrimExprNode);
@@ -100,12 +99,15 @@ class IterMarkNode : public Object {
10099 */
101100 PrimExpr extent;
102101
103- // overrides
104- void VisitAttrs (tvm::AttrVisitor* v) {
105- v->Visit (" source" , &source);
106- v->Visit (" extent" , &extent);
102+ static void RegisterReflection () {
103+ namespace refl = tvm::ffi::reflection;
104+ refl::ObjectDef<IterMarkNode>()
105+ .def_ro (" source" , &IterMarkNode::source)
106+ .def_ro (" extent" , &IterMarkNode::extent);
107107 }
108108
109+ static constexpr bool _type_has_method_visit_attrs = false ;
110+
109111 bool SEqualReduce (const IterMarkNode* other, SEqualReducer equal) const {
110112 equal->MarkGraphNode ();
111113 return equal (source, other->source ) && equal (extent, other->extent );
@@ -156,14 +158,17 @@ class IterSplitExprNode : public IterMapExprNode {
156158 /* ! \brief Additional scale. */
157159 PrimExpr scale;
158160
159- // overrides
160- void VisitAttrs (tvm::AttrVisitor* v) {
161- v->Visit (" source" , &source);
162- v->Visit (" lower_factor" , &lower_factor);
163- v->Visit (" extent" , &extent);
164- v->Visit (" scale" , &scale);
161+ static void RegisterReflection () {
162+ namespace refl = tvm::ffi::reflection;
163+ refl::ObjectDef<IterSplitExprNode>()
164+ .def_ro (" source" , &IterSplitExprNode::source)
165+ .def_ro (" lower_factor" , &IterSplitExprNode::lower_factor)
166+ .def_ro (" extent" , &IterSplitExprNode::extent)
167+ .def_ro (" scale" , &IterSplitExprNode::scale);
165168 }
166169
170+ static constexpr bool _type_has_method_visit_attrs = false ;
171+
167172 bool SEqualReduce (const IterSplitExprNode* other, SEqualReducer equal) const {
168173 return equal (source, other->source ) && equal (lower_factor, other->lower_factor ) &&
169174 equal (extent, other->extent ) && equal (scale, other->scale );
@@ -223,12 +228,15 @@ class IterSumExprNode : public IterMapExprNode {
223228 /* ! \brief The base offset. */
224229 PrimExpr base;
225230
226- // overrides
227- void VisitAttrs (tvm::AttrVisitor* v) {
228- v->Visit (" args" , &args);
229- v->Visit (" base" , &base);
231+ static void RegisterReflection () {
232+ namespace refl = tvm::ffi::reflection;
233+ refl::ObjectDef<IterSumExprNode>()
234+ .def_ro (" args" , &IterSumExprNode::args)
235+ .def_ro (" base" , &IterSumExprNode::base);
230236 }
231237
238+ static constexpr bool _type_has_method_visit_attrs = false ;
239+
232240 bool SEqualReduce (const IterSumExprNode* other, SEqualReducer equal) const {
233241 return equal (args, other->args ) && equal (base, other->base );
234242 }
@@ -291,13 +299,16 @@ class IterMapResultNode : public Object {
291299 */
292300 PrimExpr padding_predicate;
293301
294- // overrides
295- void VisitAttrs (tvm::AttrVisitor* v) {
296- v->Visit (" errors" , &errors);
297- v->Visit (" indices" , &indices);
298- v->Visit (" padding_predicate" , &padding_predicate);
302+ static void RegisterReflection () {
303+ namespace refl = tvm::ffi::reflection;
304+ refl::ObjectDef<IterMapResultNode>()
305+ .def_ro (" indices" , &IterMapResultNode::indices)
306+ .def_ro (" errors" , &IterMapResultNode::errors)
307+ .def_ro (" padding_predicate" , &IterMapResultNode::padding_predicate);
299308 }
300309
310+ static constexpr bool _type_has_method_visit_attrs = false ;
311+
301312 static constexpr const char * _type_key = " arith.IterMapResult" ;
302313 TVM_DECLARE_FINAL_OBJECT_INFO (IterMapResultNode, Object);
303314};
0 commit comments