19 #ifndef TVM_SCRIPT_PRINTER_DOC_H_
20 #define TVM_SCRIPT_PRINTER_DOC_H_
22 #include <tvm/ffi/reflection/access_path.h>
23 #include <tvm/ffi/reflection/registry.h>
87 class Doc :
public ObjectRef {
90 explicit Doc(ObjectPtr<DocNode> data) : ObjectRef(data) {}
130 ffi::Array<ffi::String> kwargs_keys,
131 ffi::Array<ExprDoc, void> kwargs_values)
const;
135 refl::ObjectDef<ExprDocNode>();
156 explicit ExprDoc(ObjectPtr<ExprDocNode> data) :
Doc(data) { TVM_FFI_ICHECK(data !=
nullptr); }
176 mutable ffi::Optional<ffi::String>
comment{std::nullopt};
262 explicit LiteralDoc(ffi::Any value,
const ffi::Optional<AccessPath>& object_path);
301 static LiteralDoc Str(
const ffi::String& v,
const ffi::Optional<AccessPath>& p) {
310 std::string dtype = v.
is_void() ?
"void" : runtime::DLDataTypeToString(v);
319 std::ostringstream os;
374 refl::ObjectDef<AttrAccessDocNode>()
417 refl::ObjectDef<IndexDocNode>()
463 refl::ObjectDef<CallDocNode>()
486 CallDoc(
ExprDoc callee, ffi::Array<ExprDoc> args, ffi::Array<ffi::String> kwargs_keys,
487 ffi::Array<ExprDoc> kwargs_values);
546 refl::ObjectDef<OperationDocNode>()
586 refl::ObjectDef<LambdaDocNode>()
677 explicit ListDoc(ffi::Array<ExprDoc> elements);
700 refl::ObjectDef<DictDocNode>()
723 explicit DictDoc(ffi::Array<ExprDoc> keys, ffi::Array<ExprDoc> values);
745 refl::ObjectDef<SliceDocNode>()
766 explicit SliceDoc(ffi::Optional<ExprDoc> start, ffi::Optional<ExprDoc> stop,
767 ffi::Optional<ExprDoc> step);
785 ffi::Optional<ExprDoc>
rhs;
791 refl::ObjectDef<AssignDocNode>()
812 explicit AssignDoc(
ExprDoc lhs, ffi::Optional<ExprDoc> rhs, ffi::Optional<ExprDoc> annotation);
832 refl::ObjectDef<IfDocNode>()
854 ffi::Array<StmtDoc> else_branch);
872 refl::ObjectDef<WhileDocNode>()
915 refl::ObjectDef<ForDocNode>()
953 ffi::Optional<ExprDoc>
lhs{std::nullopt};
961 refl::ObjectDef<ScopeDocNode>()
1036 ffi::Optional<ExprDoc>
msg{std::nullopt};
1040 refl::ObjectDef<AssertDocNode>()
1121 refl::ObjectDef<FunctionDocNode>()
1147 ffi::Optional<ExprDoc> return_type, ffi::Array<StmtDoc> body);
1167 refl::ObjectDef<ClassDocNode>()
1188 explicit ClassDoc(
IdDoc name, ffi::Array<ExprDoc> decorators, ffi::Array<StmtDoc> body);
1201 refl::ObjectDef<CommentDocNode>();
1226 refl::ObjectDef<DocStringDocNode>();
Managed reference class to FloatImmNode.
Definition: expr.h:545
Managed reference class to IntImmNode.
Definition: expr.h:510
Definition: script_printer.h:155
Runtime primitive data type.
Definition: data_type.h:47
static DataType Float(int bits, int lanes=1)
Construct an float type.
Definition: data_type.h:291
static DataType Bool(int lanes=1, bool is_scalable=false)
Construct a bool type.
Definition: data_type.h:383
static DataType Int(int bits, int lanes=1)
Construct an int type.
Definition: data_type.h:274
bool is_void() const
Definition: data_type.h:209
Doc that represents assert statement.
Definition: doc.h:1031
ffi::Optional< ExprDoc > msg
The optional error message when assertion failed.
Definition: doc.h:1036
static void RegisterReflection()
Definition: doc.h:1038
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.AssertDoc", AssertDocNode, StmtDocNode)
ExprDoc test
The expression to test.
Definition: doc.h:1034
Reference type of AssertDocNode.
Definition: doc.h:1052
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AssertDoc, StmtDoc, AssertDocNode)
AssertDoc(ExprDoc test, ffi::Optional< ExprDoc > msg=std::nullopt)
Constructor of AssertDoc.
Doc that represents assign statement.
Definition: doc.h:776
ffi::Optional< ExprDoc > annotation
The type annotation of this assignment.
Definition: doc.h:787
ffi::Optional< ExprDoc > rhs
The right hand side of the assignment.
Definition: doc.h:785
ExprDoc lhs
The left hand side of the assignment.
Definition: doc.h:779
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.AssignDoc", AssignDocNode, StmtDocNode)
static void RegisterReflection()
Definition: doc.h:789
Reference type of AssignDocNode.
Definition: doc.h:804
AssignDoc(ExprDoc lhs, ffi::Optional< ExprDoc > rhs, ffi::Optional< ExprDoc > annotation)
Constructor of AssignDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AssignDoc, StmtDoc, AssignDocNode)
Doc that represents attribute access on another expression.
Definition: doc.h:365
ffi::String name
The attribute to be accessed.
Definition: doc.h:370
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.AttrAccessDoc", AttrAccessDocNode, ExprDocNode)
ExprDoc value
The target expression to be accessed.
Definition: doc.h:368
static void RegisterReflection()
Definition: doc.h:372
Reference type of AttrAccessDocNode.
Definition: doc.h:386
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AttrAccessDoc, ExprDoc, AttrAccessDocNode)
AttrAccessDoc(ExprDoc value, ffi::String name)
Constructor of AttrAccessDoc.
Doc that represents function call.
Definition: doc.h:445
ffi::Array< ffi::String > kwargs_keys
The keys of keyword arguments.
Definition: doc.h:452
ffi::Array< ExprDoc > kwargs_values
The values of keyword arguments.
Definition: doc.h:459
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.CallDoc", CallDocNode, ExprDocNode)
static void RegisterReflection()
Definition: doc.h:461
ffi::Array< ExprDoc > args
The positional arguments.
Definition: doc.h:450
ExprDoc callee
The callee of this function call.
Definition: doc.h:448
Reference type of CallDocNode.
Definition: doc.h:477
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(CallDoc, ExprDoc, CallDocNode)
CallDoc(ExprDoc callee, ffi::Array< ExprDoc > args, ffi::Array< ffi::String > kwargs_keys, ffi::Array< ExprDoc > kwargs_values)
Constructor of CallDoc.
Doc that represents class definition.
Definition: doc.h:1156
ffi::Array< ExprDoc > decorators
Decorators of class.
Definition: doc.h:1161
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ClassDoc", ClassDocNode, StmtDocNode)
static void RegisterReflection()
Definition: doc.h:1165
IdDoc name
The name of class.
Definition: doc.h:1159
ffi::Array< StmtDoc > body
The body of class.
Definition: doc.h:1163
Reference type of ClassDocNode.
Definition: doc.h:1180
ClassDoc(IdDoc name, ffi::Array< ExprDoc > decorators, ffi::Array< StmtDoc > body)
Constructor of ClassDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ClassDoc, StmtDoc, ClassDocNode)
Doc that represents dictionary literal.
Definition: doc.h:686
ffi::Array< ExprDoc > keys
keys of dictionary
Definition: doc.h:689
static void RegisterReflection()
Definition: doc.h:698
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.DictDoc", DictDocNode, ExprDocNode)
ffi::Array< ExprDoc > values
Values of dictionary.
Definition: doc.h:696
Reference type of DictDocNode.
Definition: doc.h:712
DictDoc(ffi::Array< ExprDoc > keys, ffi::Array< ExprDoc > values)
Constructor of DictDoc.
DictDoc()
Create an empty dictionary.
Definition: doc.h:717
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(DictDoc, ExprDoc, DictDocNode)
The base class of all Doc.
Definition: doc.h:58
TVM_FFI_DECLARE_OBJECT_INFO("script.printer.Doc", DocNode, Object)
static constexpr bool _type_mutable
Definition: doc.h:74
virtual ~DocNode()=default
static void RegisterReflection()
Definition: doc.h:69
ffi::Array< ffi::reflection::AccessPath > source_paths
The list of object paths of the source IR node.
Definition: doc.h:67
Doc that represents docstring.
Definition: doc.h:1222
static void RegisterReflection()
Definition: doc.h:1224
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.DocStringDoc", DocStringDocNode, StmtDocNode)
Reference type of DocStringDocNode.
Definition: doc.h:1236
DocStringDoc(ffi::String docs)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(DocStringDoc, StmtDoc, DocStringDocNode)
Reference type of DocNode.
Definition: doc.h:87
Doc(ObjectPtr< DocNode > data)
Definition: doc.h:90
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Doc, ObjectRef, DocNode)
The base class of expression doc.
Definition: doc.h:103
ExprDoc Attr(ffi::String attr) const
Create a doc representing attribute access on the current ExprDoc.
static void RegisterReflection()
Definition: doc.h:133
TVM_FFI_DECLARE_OBJECT_INFO("script.printer.ExprDoc", ExprDocNode, DocNode)
ExprDoc Call(ffi::Array< ExprDoc, void > args) const
Create a doc representing calling the current ExprDoc.
ExprDoc operator[](ffi::Array< Doc > indices) const
Create a doc representing index access on the current ExprDoc.
ExprDoc Call(ffi::Array< ExprDoc, void > args, ffi::Array< ffi::String > kwargs_keys, ffi::Array< ExprDoc, void > kwargs_values) const
Create a doc representing attribute access on the current ExprDoc.
Reference type of ExprDocNode.
Definition: doc.h:145
ExprDoc(ObjectPtr< ExprDocNode > data)
Definition: doc.h:156
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ExprDoc, Doc, ExprDocNode)
ExprDoc operator[](ffi::Array< Doc > indices) const
Create a doc representing index access on the current ExprDoc.
Doc that represents an expression as statement.
Definition: doc.h:999
static void RegisterReflection()
Definition: doc.h:1004
ExprDoc expr
The expression represented by this doc.
Definition: doc.h:1002
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ExprStmtDoc", ExprStmtDocNode, StmtDocNode)
Reference type of ExprStmtDocNode.
Definition: doc.h:1016
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ExprStmtDoc, StmtDoc, ExprStmtDocNode)
ExprStmtDoc(ExprDoc expr)
Constructor of ExprStmtDoc.
Doc that represents for statement.
Definition: doc.h:904
ffi::Array< StmtDoc > body
The body of the for statement.
Definition: doc.h:911
ExprDoc lhs
The left hand side of the assignment of iterating variable.
Definition: doc.h:907
static void RegisterReflection()
Definition: doc.h:913
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ForDoc", ForDocNode, StmtDocNode)
ExprDoc rhs
The right hand side of the assignment of iterating variable.
Definition: doc.h:909
Reference type of ForDocNode.
Definition: doc.h:928
ForDoc(ExprDoc lhs, ExprDoc rhs, ffi::Array< StmtDoc > body)
Constructor of ForDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ForDoc, StmtDoc, ForDocNode)
Doc that represents function definition.
Definition: doc.h:1100
ffi::Array< AssignDoc > args
The arguments of function.
Definition: doc.h:1111
ffi::Array< StmtDoc > body
The body of function.
Definition: doc.h:1117
IdDoc name
The name of function.
Definition: doc.h:1103
static void RegisterReflection()
Definition: doc.h:1119
ffi::Array< ExprDoc > decorators
Decorators of function.
Definition: doc.h:1113
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.FunctionDoc", FunctionDocNode, StmtDocNode)
ffi::Optional< ExprDoc > return_type
The return type of function.
Definition: doc.h:1115
Reference type of FunctionDocNode.
Definition: doc.h:1136
FunctionDoc(IdDoc name, ffi::Array< AssignDoc > args, ffi::Array< ExprDoc > decorators, ffi::Optional< ExprDoc > return_type, ffi::Array< StmtDoc > body)
Constructor of FunctionDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(FunctionDoc, StmtDoc, FunctionDocNode)
Doc that represents identifier.
Definition: doc.h:332
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IdDoc", IdDocNode, ExprDocNode)
ffi::String name
The name of the identifier.
Definition: doc.h:335
static void RegisterReflection()
Definition: doc.h:337
Reference type of IdDocNode.
Definition: doc.h:349
IdDoc(std::nullptr_t)
Definition: doc.h:356
IdDoc(ffi::String name)
Constructor of IdDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IdDoc, ExprDoc, IdDocNode)
Doc that represent if-then-else statement.
Definition: doc.h:821
static void RegisterReflection()
Definition: doc.h:830
ffi::Array< StmtDoc > else_branch
The else branch of the if-then-else statement.
Definition: doc.h:828
ffi::Array< StmtDoc > then_branch
The then branch of the if-then-else statement.
Definition: doc.h:826
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IfDoc", IfDocNode, StmtDocNode)
ExprDoc predicate
The predicate of the if-then-else statement.
Definition: doc.h:824
Reference type of IfDocNode.
Definition: doc.h:845
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IfDoc, StmtDoc, IfDocNode)
IfDoc(ExprDoc predicate, ffi::Array< StmtDoc > then_branch, ffi::Array< StmtDoc > else_branch)
Constructor of IfDoc.
Doc that represents index access on another expression.
Definition: doc.h:402
static void RegisterReflection()
Definition: doc.h:415
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IndexDoc", IndexDocNode, ExprDocNode)
ffi::Array< Doc > indices
The indices to access.
Definition: doc.h:413
ExprDoc value
The container value to be accessed.
Definition: doc.h:405
Reference type of IndexDocNode.
Definition: doc.h:429
IndexDoc(ExprDoc value, ffi::Array< Doc > indices)
Constructor of IndexDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IndexDoc, ExprDoc, IndexDocNode)
Doc that represents anonymous function.
Definition: doc.h:577
static void RegisterReflection()
Definition: doc.h:584
ExprDoc body
The body of this anonymous function.
Definition: doc.h:582
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.LambdaDoc", LambdaDocNode, ExprDocNode)
ffi::Array< IdDoc > args
The arguments of this anonymous function.
Definition: doc.h:580
Reference type of LambdaDocNode.
Definition: doc.h:598
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(LambdaDoc, ExprDoc, LambdaDocNode)
LambdaDoc(ffi::Array< IdDoc > args, ExprDoc body)
Constructor of LambdaDoc.
Doc that represents list literal.
Definition: doc.h:650
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ListDoc", ListDocNode, ExprDocNode)
ffi::Array< ExprDoc > elements
Elements of list.
Definition: doc.h:653
static void RegisterReflection()
Definition: doc.h:655
Reference type of ListDocNode.
Definition: doc.h:667
ListDoc()
Create an empty ListDoc.
Definition: doc.h:672
ListDoc(ffi::Array< ExprDoc > elements)
Constructor of ListDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ListDoc, ExprDoc, ListDocNode)
Doc that represents literal value.
Definition: doc.h:235
ffi::Any value
the internal representation of the literal value.
Definition: doc.h:246
static void RegisterReflection()
Definition: doc.h:248
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.LiteralDoc", LiteralDocNode, ExprDocNode)
Reference type of LiteralDocNode.
Definition: doc.h:260
LiteralDoc(ffi::Any value, const ffi::Optional< AccessPath > &object_path)
static LiteralDoc Boolean(bool v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent boolean.
Definition: doc.h:285
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(LiteralDoc, ExprDoc, LiteralDocNode)
static LiteralDoc DataType(const runtime::DataType &v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent string.
Definition: doc.h:309
static LiteralDoc Device(const DLDevice &v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent device.
Definition: doc.h:318
static LiteralDoc Int(int64_t v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent integer.
Definition: doc.h:277
static LiteralDoc Float(double v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent float.
Definition: doc.h:293
static LiteralDoc None(const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent None/null/empty value.
Definition: doc.h:269
static LiteralDoc Str(const ffi::String &v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent string.
Definition: doc.h:301
Doc that represents operation.
Definition: doc.h:499
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.OperationDoc", OperationDocNode, ExprDocNode)
ffi::Array< ExprDoc > operands
Operands of this expression.
Definition: doc.h:542
Kind kind
The kind of operation (operator)
Definition: doc.h:540
Kind
Definition: doc.h:501
static void RegisterReflection()
Definition: doc.h:544
Reference type of OperationDocNode.
Definition: doc.h:558
OperationDoc(OperationDocNode::Kind kind, ffi::Array< ExprDoc > operands)
Constructor of OperationDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(OperationDoc, ExprDoc, OperationDocNode)
Doc that represents return statement.
Definition: doc.h:1068
ExprDoc value
The value to return.
Definition: doc.h:1071
static void RegisterReflection()
Definition: doc.h:1073
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ReturnDoc", ReturnDocNode, StmtDocNode)
Reference type of ReturnDocNode.
Definition: doc.h:1085
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ReturnDoc, StmtDoc, ReturnDocNode)
ReturnDoc(ExprDoc value)
Constructor of ReturnDoc.
Doc that represents special scopes.
Definition: doc.h:950
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ScopeDoc", ScopeDocNode, StmtDocNode)
ffi::Optional< ExprDoc > lhs
The name of the scoped variable.
Definition: doc.h:953
ExprDoc rhs
The value of the scoped variable.
Definition: doc.h:955
static void RegisterReflection()
Definition: doc.h:959
ffi::Array< StmtDoc > body
The body of the scope doc.
Definition: doc.h:957
Reference type of ScopeDocNode.
Definition: doc.h:974
ScopeDoc(ffi::Optional< ExprDoc > lhs, ExprDoc rhs, ffi::Array< StmtDoc > body)
Constructor of ScopeDoc.
ScopeDoc(ExprDoc rhs, ffi::Array< StmtDoc > body)
Constructor of ScopeDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ScopeDoc, StmtDoc, ScopeDocNode)
Doc that represents slice in Index expression.
Definition: doc.h:734
ffi::Optional< ExprDoc > start
The start of slice.
Definition: doc.h:737
ffi::Optional< ExprDoc > step
The step of slice.
Definition: doc.h:741
ffi::Optional< ExprDoc > stop
The exclusive end of slice.
Definition: doc.h:739
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.SliceDoc", SliceDocNode, DocNode)
static void RegisterReflection()
Definition: doc.h:743
Reference type of SliceDocNode.
Definition: doc.h:758
SliceDoc(ffi::Optional< ExprDoc > start, ffi::Optional< ExprDoc > stop, ffi::Optional< ExprDoc > step)
Constructor of SliceDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(SliceDoc, Doc, SliceDocNode)
The container doc that holds a list of StmtDoc.
Definition: doc.h:204
static void RegisterReflection()
Definition: doc.h:209
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.StmtBlockDoc", StmtBlockDocNode, DocNode)
ffi::Array< StmtDoc > stmts
The list of statements.
Definition: doc.h:207
Reference type of StmtBlockDocNode.
Definition: doc.h:220
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(StmtBlockDoc, Doc, StmtBlockDocNode)
StmtBlockDoc(ffi::Array< StmtDoc > stmts)
Constructor of StmtBlockDoc.
The base class of statement doc.
Definition: doc.h:166
ffi::Optional< ffi::String > comment
The comment of this doc.
Definition: doc.h:176
static void RegisterReflection()
Definition: doc.h:178
TVM_FFI_DECLARE_OBJECT_INFO("script.printer.StmtDoc", StmtDocNode, DocNode)
Reference type of StmtDocNode.
Definition: doc.h:190
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(StmtDoc, Doc, StmtDocNode)
Doc that represents tuple literal.
Definition: doc.h:614
ffi::Array< ExprDoc > elements
Elements of tuple.
Definition: doc.h:617
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.TupleDoc", TupleDocNode, ExprDocNode)
static void RegisterReflection()
Definition: doc.h:619
Reference type of TupleDocNode.
Definition: doc.h:631
TupleDoc(ffi::Array< ExprDoc > elements)
Constructor of TupleDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(TupleDoc, ExprDoc, TupleDocNode)
TupleDoc()
Create an empty TupleDoc.
Definition: doc.h:636
Doc that represents while statement.
Definition: doc.h:863
static void RegisterReflection()
Definition: doc.h:870
ffi::Array< StmtDoc > body
The body of the while statement.
Definition: doc.h:868
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.WhileDoc", WhileDocNode, StmtDocNode)
ExprDoc predicate
The predicate of the while statement.
Definition: doc.h:866
Reference type of WhileDocNode.
Definition: doc.h:884
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(WhileDoc, StmtDoc, WhileDocNode)
WhileDoc(ExprDoc predicate, ffi::Array< StmtDoc > body)
Constructor of WhileDoc.
Abstract device memory management API.
Definition: repr_printer.h:91
std::ostream & operator<<(std::ostream &os, const DataType &dtype)
Definition: data_type.h:453
ffi::String DocToPythonScript(Doc doc, const PrinterConfig &cfg)
Convert Doc into Python script.
ffi::reflection::AccessPath AccessPath
Definition: doc.h:35
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:37
Definitions and helper macros for IR/AST nodes.