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>
74 static constexpr
const char*
_type_key =
"script.printer.Doc";
88 class Doc :
public ObjectRef {
130 Array<String> kwargs_keys,
131 Array<ExprDoc, void> kwargs_values)
const;
135 refl::ObjectDef<ExprDocNode>();
138 static constexpr
const char*
_type_key =
"script.printer.ExprDoc";
177 mutable Optional<String>
comment{std::nullopt};
184 static constexpr
const char*
_type_key =
"script.printer.StmtDoc";
218 static constexpr
const char*
_type_key =
"script.printer.StmtBlockDoc";
260 static constexpr
const char*
_type_key =
"script.printer.LiteralDoc";
272 explicit LiteralDoc(ffi::Any value,
const Optional<AccessPath>& object_path);
316 std::string dtype = v.
is_void() ?
"void" : runtime::DLDataTypeToString(v);
325 std::ostringstream os;
348 static constexpr
const char*
_type_key =
"script.printer.IdDoc";
383 refl::ObjectDef<AttrAccessDocNode>()
388 static constexpr
const char*
_type_key =
"script.printer.AttrAccessDoc";
429 refl::ObjectDef<IndexDocNode>()
434 static constexpr
const char*
_type_key =
"script.printer.IndexDoc";
478 refl::ObjectDef<CallDocNode>()
485 static constexpr
const char*
_type_key =
"script.printer.CallDoc";
505 Array<ExprDoc> kwargs_values);
564 refl::ObjectDef<OperationDocNode>()
569 static constexpr
const char*
_type_key =
"script.printer.OperationDoc";
607 refl::ObjectDef<LambdaDocNode>()
612 static constexpr
const char*
_type_key =
"script.printer.LambdaDoc";
648 static constexpr
const char*
_type_key =
"script.printer.TupleDoc";
687 static constexpr
const char*
_type_key =
"script.printer.ListDoc";
730 refl::ObjectDef<DictDocNode>()
735 static constexpr
const char*
_type_key =
"script.printer.DictDoc";
756 explicit DictDoc(Array<ExprDoc> keys, Array<ExprDoc> values);
778 refl::ObjectDef<SliceDocNode>()
784 static constexpr
const char*
_type_key =
"script.printer.SliceDoc";
802 explicit SliceDoc(Optional<ExprDoc> start, Optional<ExprDoc> stop, Optional<ExprDoc> step);
826 refl::ObjectDef<AssignDocNode>()
832 static constexpr
const char*
_type_key =
"script.printer.AssignDoc";
870 refl::ObjectDef<IfDocNode>()
876 static constexpr
const char*
_type_key =
"script.printer.IfDoc";
894 explicit IfDoc(
ExprDoc predicate, Array<StmtDoc> then_branch, Array<StmtDoc> else_branch);
912 refl::ObjectDef<WhileDocNode>()
917 static constexpr
const char*
_type_key =
"script.printer.WhileDoc";
958 refl::ObjectDef<ForDocNode>()
964 static constexpr
const char*
_type_key =
"script.printer.ForDoc";
999 Optional<ExprDoc>
lhs{std::nullopt};
1007 refl::ObjectDef<ScopeDocNode>()
1013 static constexpr
const char*
_type_key =
"script.printer.ScopeDoc";
1058 static constexpr
const char*
_type_key =
"script.printer.ExprStmtDoc";
1088 Optional<ExprDoc>
msg{std::nullopt};
1092 refl::ObjectDef<AssertDocNode>()
1097 static constexpr
const char*
_type_key =
"script.printer.AssertDoc";
1133 static constexpr
const char*
_type_key =
"script.printer.ReturnDoc";
1179 refl::ObjectDef<FunctionDocNode>()
1187 static constexpr
const char*
_type_key =
"script.printer.FunctionDoc";
1208 Optional<ExprDoc> return_type, Array<StmtDoc> body);
1228 refl::ObjectDef<ClassDocNode>()
1234 static constexpr
const char*
_type_key =
"script.printer.ClassDoc";
1265 refl::ObjectDef<CommentDocNode>();
1268 static constexpr
const char*
_type_key =
"script.printer.CommentDoc";
1292 refl::ObjectDef<DocStringDocNode>();
1295 static constexpr
const char*
_type_key =
"script.printer.DocStringDoc";
Managed reference class to FloatImmNode.
Definition: expr.h:557
Managed reference class to IntImmNode.
Definition: expr.h:520
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:1083
static void RegisterReflection()
Definition: doc.h:1090
ExprDoc test
The expression to test.
Definition: doc.h:1086
TVM_DECLARE_FINAL_OBJECT_INFO(AssertDocNode, StmtDocNode)
static constexpr const char * _type_key
Definition: doc.h:1097
Optional< ExprDoc > msg
The optional error message when assertion failed.
Definition: doc.h:1088
Reference type of AssertDocNode.
Definition: doc.h:1107
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(AssertDoc, StmtDoc, AssertDocNode)
AssertDoc(ExprDoc test, Optional< ExprDoc > msg=std::nullopt)
Constructor of AssertDoc.
Doc that represents assign statement.
Definition: doc.h:811
Optional< ExprDoc > annotation
The type annotation of this assignment.
Definition: doc.h:822
Optional< ExprDoc > rhs
The right hand side of the assignment.
Definition: doc.h:820
ExprDoc lhs
The left hand side of the assignment.
Definition: doc.h:814
static constexpr const char * _type_key
Definition: doc.h:832
TVM_DECLARE_FINAL_OBJECT_INFO(AssignDocNode, StmtDocNode)
static void RegisterReflection()
Definition: doc.h:824
Reference type of AssignDocNode.
Definition: doc.h:842
AssignDoc(ExprDoc lhs, Optional< ExprDoc > rhs, Optional< ExprDoc > annotation)
Constructor of AssignDoc.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(AssignDoc, StmtDoc, AssignDocNode)
Doc that represents attribute access on another expression.
Definition: doc.h:374
static constexpr const char * _type_key
Definition: doc.h:388
String name
The attribute to be accessed.
Definition: doc.h:379
ExprDoc value
The target expression to be accessed.
Definition: doc.h:377
static void RegisterReflection()
Definition: doc.h:381
TVM_DECLARE_FINAL_OBJECT_INFO(AttrAccessDocNode, ExprDocNode)
Reference type of AttrAccessDocNode.
Definition: doc.h:398
AttrAccessDoc(ExprDoc value, String name)
Constructor of AttrAccessDoc.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(AttrAccessDoc, ExprDoc, AttrAccessDocNode)
Doc that represents function call.
Definition: doc.h:460
Array< ExprDoc > kwargs_values
The values of keyword arguments.
Definition: doc.h:474
Array< ExprDoc > args
The positional arguments.
Definition: doc.h:465
TVM_DECLARE_FINAL_OBJECT_INFO(CallDocNode, ExprDocNode)
static constexpr const char * _type_key
Definition: doc.h:485
Array< String > kwargs_keys
The keys of keyword arguments.
Definition: doc.h:467
static void RegisterReflection()
Definition: doc.h:476
ExprDoc callee
The callee of this function call.
Definition: doc.h:463
Reference type of CallDocNode.
Definition: doc.h:495
CallDoc(ExprDoc callee, Array< ExprDoc > args, Array< String > kwargs_keys, Array< ExprDoc > kwargs_values)
Constructor of CallDoc.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(CallDoc, ExprDoc, CallDocNode)
Doc that represents class definition.
Definition: doc.h:1217
static constexpr const char * _type_key
Definition: doc.h:1234
Array< ExprDoc > decorators
Decorators of class.
Definition: doc.h:1222
TVM_DECLARE_FINAL_OBJECT_INFO(ClassDocNode, StmtDocNode)
Array< StmtDoc > body
The body of class.
Definition: doc.h:1224
static void RegisterReflection()
Definition: doc.h:1226
IdDoc name
The name of class.
Definition: doc.h:1220
Reference type of ClassDocNode.
Definition: doc.h:1244
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(ClassDoc, StmtDoc, ClassDocNode)
ClassDoc(IdDoc name, Array< ExprDoc > decorators, Array< StmtDoc > body)
Constructor of ClassDoc.
Doc that represents dictionary literal.
Definition: doc.h:716
Array< ExprDoc > values
Values of dictionary.
Definition: doc.h:726
static void RegisterReflection()
Definition: doc.h:728
Array< ExprDoc > keys
keys of dictionary
Definition: doc.h:719
static constexpr const char * _type_key
Definition: doc.h:735
TVM_DECLARE_FINAL_OBJECT_INFO(DictDocNode, ExprDocNode)
Reference type of DictDocNode.
Definition: doc.h:745
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(DictDoc, ExprDoc, DictDocNode)
DictDoc(Array< ExprDoc > keys, Array< ExprDoc > values)
Constructor of DictDoc.
DictDoc()
Create an empty dictionary.
Definition: doc.h:750
The base class of all Doc.
Definition: doc.h:58
static constexpr bool _type_mutable
Definition: doc.h:75
Array< ffi::reflection::AccessPath > source_paths
The list of object paths of the source IR node.
Definition: doc.h:67
virtual ~DocNode()=default
TVM_DECLARE_BASE_OBJECT_INFO(DocNode, Object)
static void RegisterReflection()
Definition: doc.h:69
static constexpr const char * _type_key
Definition: doc.h:74
Doc that represents docstring.
Definition: doc.h:1288
static void RegisterReflection()
Definition: doc.h:1290
static constexpr const char * _type_key
Definition: doc.h:1295
TVM_DECLARE_FINAL_OBJECT_INFO(DocStringDocNode, StmtDocNode)
Reference type of DocStringDocNode.
Definition: doc.h:1304
DocStringDoc(String docs)
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(DocStringDoc, StmtDoc, DocStringDocNode)
Reference type of DocNode.
Definition: doc.h:88
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(Doc, ObjectRef, DocNode)
The base class of expression doc.
Definition: doc.h:103
static constexpr const char * _type_key
Definition: doc.h:138
TVM_DECLARE_BASE_OBJECT_INFO(ExprDocNode, DocNode)
static void RegisterReflection()
Definition: doc.h:133
ExprDoc Attr(String attr) const
Create a doc representing attribute access on the current ExprDoc.
ExprDoc Call(Array< ExprDoc, void > args) const
Create a doc representing calling the current ExprDoc.
ExprDoc operator[](Array< Doc > indices) const
Create a doc representing index access on the current ExprDoc.
ExprDoc Call(Array< ExprDoc, void > args, Array< String > kwargs_keys, Array< ExprDoc, void > kwargs_values) const
Create a doc representing attribute access on the current ExprDoc.
Reference type of ExprDocNode.
Definition: doc.h:148
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(ExprDoc, Doc, ExprDocNode)
ExprDoc operator[](Array< Doc > indices) const
Create a doc representing index access on the current ExprDoc.
Doc that represents an expression as statement.
Definition: doc.h:1048
static constexpr const char * _type_key
Definition: doc.h:1058
static void RegisterReflection()
Definition: doc.h:1053
TVM_DECLARE_FINAL_OBJECT_INFO(ExprStmtDocNode, StmtDocNode)
ExprDoc expr
The expression represented by this doc.
Definition: doc.h:1051
Reference type of ExprStmtDocNode.
Definition: doc.h:1068
ExprStmtDoc(ExprDoc expr)
Constructor of ExprStmtDoc.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(ExprStmtDoc, StmtDoc, ExprStmtDocNode)
Doc that represents for statement.
Definition: doc.h:947
ExprDoc lhs
The left hand side of the assignment of iterating variable.
Definition: doc.h:950
static void RegisterReflection()
Definition: doc.h:956
static constexpr const char * _type_key
Definition: doc.h:964
ExprDoc rhs
The right hand side of the assignment of iterating variable.
Definition: doc.h:952
Array< StmtDoc > body
The body of the for statement.
Definition: doc.h:954
TVM_DECLARE_FINAL_OBJECT_INFO(ForDocNode, StmtDocNode)
Reference type of ForDocNode.
Definition: doc.h:974
ForDoc(ExprDoc lhs, ExprDoc rhs, Array< StmtDoc > body)
Constructor of ForDoc.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(ForDoc, StmtDoc, ForDocNode)
Doc that represents function definition.
Definition: doc.h:1158
TVM_DECLARE_FINAL_OBJECT_INFO(FunctionDocNode, StmtDocNode)
Optional< ExprDoc > return_type
The return type of function.
Definition: doc.h:1173
Array< ExprDoc > decorators
Decorators of function.
Definition: doc.h:1171
Array< StmtDoc > body
The body of function.
Definition: doc.h:1175
Array< AssignDoc > args
The arguments of function.
Definition: doc.h:1169
IdDoc name
The name of function.
Definition: doc.h:1161
static constexpr const char * _type_key
Definition: doc.h:1187
static void RegisterReflection()
Definition: doc.h:1177
Reference type of FunctionDocNode.
Definition: doc.h:1197
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(FunctionDoc, StmtDoc, FunctionDocNode)
FunctionDoc(IdDoc name, Array< AssignDoc > args, Array< ExprDoc > decorators, Optional< ExprDoc > return_type, Array< StmtDoc > body)
Constructor of FunctionDoc.
Doc that represents identifier.
Definition: doc.h:338
TVM_DECLARE_FINAL_OBJECT_INFO(IdDocNode, ExprDocNode)
String name
The name of the identifier.
Definition: doc.h:341
static void RegisterReflection()
Definition: doc.h:343
static constexpr const char * _type_key
Definition: doc.h:348
Reference type of IdDocNode.
Definition: doc.h:358
IdDoc(std::nullptr_t)
Definition: doc.h:365
IdDoc(String name)
Constructor of IdDoc.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(IdDoc, ExprDoc, IdDocNode)
Doc that represent if-then-else statement.
Definition: doc.h:859
static void RegisterReflection()
Definition: doc.h:868
TVM_DECLARE_FINAL_OBJECT_INFO(IfDocNode, StmtDocNode)
Array< StmtDoc > else_branch
The else branch of the if-then-else statement.
Definition: doc.h:866
static constexpr const char * _type_key
Definition: doc.h:876
Array< StmtDoc > then_branch
The then branch of the if-then-else statement.
Definition: doc.h:864
ExprDoc predicate
The predicate of the if-then-else statement.
Definition: doc.h:862
Reference type of IfDocNode.
Definition: doc.h:886
IfDoc(ExprDoc predicate, Array< StmtDoc > then_branch, Array< StmtDoc > else_branch)
Constructor of IfDoc.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(IfDoc, StmtDoc, IfDocNode)
Doc that represents index access on another expression.
Definition: doc.h:414
static constexpr const char * _type_key
Definition: doc.h:434
static void RegisterReflection()
Definition: doc.h:427
TVM_DECLARE_FINAL_OBJECT_INFO(IndexDocNode, ExprDocNode)
ExprDoc value
The container value to be accessed.
Definition: doc.h:417
Array< Doc > indices
The indices to access.
Definition: doc.h:425
Reference type of IndexDocNode.
Definition: doc.h:444
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(IndexDoc, ExprDoc, IndexDocNode)
IndexDoc(ExprDoc value, Array< Doc > indices)
Constructor of IndexDoc.
Doc that represents anonymous function.
Definition: doc.h:598
Array< IdDoc > args
The arguments of this anonymous function.
Definition: doc.h:601
static void RegisterReflection()
Definition: doc.h:605
ExprDoc body
The body of this anonymous function.
Definition: doc.h:603
static constexpr const char * _type_key
Definition: doc.h:612
TVM_DECLARE_FINAL_OBJECT_INFO(LambdaDocNode, ExprDocNode)
Reference type of LambdaDocNode.
Definition: doc.h:622
LambdaDoc(Array< IdDoc > args, ExprDoc body)
Constructor of LambdaDoc.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(LambdaDoc, ExprDoc, LambdaDocNode)
Doc that represents list literal.
Definition: doc.h:677
Array< ExprDoc > elements
Elements of list.
Definition: doc.h:680
TVM_DECLARE_FINAL_OBJECT_INFO(ListDocNode, ExprDocNode)
static constexpr const char * _type_key
Definition: doc.h:687
static void RegisterReflection()
Definition: doc.h:682
Reference type of ListDocNode.
Definition: doc.h:697
ListDoc()
Create an empty ListDoc.
Definition: doc.h:702
ListDoc(Array< ExprDoc > elements)
Constructor of ListDoc.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(ListDoc, ExprDoc, ListDocNode)
Doc that represents literal value.
Definition: doc.h:242
static constexpr const char * _type_key
Definition: doc.h:260
ffi::Any value
the internal representation of the literal value.
Definition: doc.h:253
static void RegisterReflection()
Definition: doc.h:255
TVM_DECLARE_FINAL_OBJECT_INFO(LiteralDocNode, ExprDocNode)
Reference type of LiteralDocNode.
Definition: doc.h:270
static LiteralDoc DataType(const runtime::DataType &v, const Optional< AccessPath > &p)
Create a LiteralDoc to represent string.
Definition: doc.h:315
static LiteralDoc Boolean(bool v, const Optional< AccessPath > &p)
Create a LiteralDoc to represent boolean.
Definition: doc.h:293
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(LiteralDoc, ExprDoc, LiteralDocNode)
static LiteralDoc Int(int64_t v, const Optional< AccessPath > &p)
Create a LiteralDoc to represent integer.
Definition: doc.h:285
static LiteralDoc None(const Optional< AccessPath > &p)
Create a LiteralDoc to represent None/null/empty value.
Definition: doc.h:279
static LiteralDoc Float(double v, const Optional< AccessPath > &p)
Create a LiteralDoc to represent float.
Definition: doc.h:301
static LiteralDoc Device(const DLDevice &v, const Optional< AccessPath > &p)
Create a LiteralDoc to represent device.
Definition: doc.h:324
LiteralDoc(ffi::Any value, const Optional< AccessPath > &object_path)
static LiteralDoc Str(const String &v, const Optional< AccessPath > &p)
Create a LiteralDoc to represent string.
Definition: doc.h:309
Doc that represents operation.
Definition: doc.h:517
TVM_DECLARE_FINAL_OBJECT_INFO(OperationDocNode, ExprDocNode)
Array< ExprDoc > operands
Operands of this expression.
Definition: doc.h:560
static constexpr const char * _type_key
Definition: doc.h:569
Kind kind
The kind of operation (operator)
Definition: doc.h:558
Kind
Definition: doc.h:519
static void RegisterReflection()
Definition: doc.h:562
Reference type of OperationDocNode.
Definition: doc.h:579
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(OperationDoc, ExprDoc, OperationDocNode)
OperationDoc(OperationDocNode::Kind kind, Array< ExprDoc > operands)
Constructor of OperationDoc.
Doc that represents return statement.
Definition: doc.h:1123
ExprDoc value
The value to return.
Definition: doc.h:1126
static void RegisterReflection()
Definition: doc.h:1128
TVM_DECLARE_FINAL_OBJECT_INFO(ReturnDocNode, StmtDocNode)
static constexpr const char * _type_key
Definition: doc.h:1133
Reference type of ReturnDocNode.
Definition: doc.h:1143
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(ReturnDoc, StmtDoc, ReturnDocNode)
ReturnDoc(ExprDoc value)
Constructor of ReturnDoc.
Doc that represents special scopes.
Definition: doc.h:996
TVM_DECLARE_FINAL_OBJECT_INFO(ScopeDocNode, StmtDocNode)
Optional< ExprDoc > lhs
The name of the scoped variable.
Definition: doc.h:999
static constexpr const char * _type_key
Definition: doc.h:1013
ExprDoc rhs
The value of the scoped variable.
Definition: doc.h:1001
Array< StmtDoc > body
The body of the scope doc.
Definition: doc.h:1003
static void RegisterReflection()
Definition: doc.h:1005
Reference type of ScopeDocNode.
Definition: doc.h:1023
ScopeDoc(ExprDoc rhs, Array< StmtDoc > body)
Constructor of ScopeDoc.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(ScopeDoc, StmtDoc, ScopeDocNode)
ScopeDoc(Optional< ExprDoc > lhs, ExprDoc rhs, Array< StmtDoc > body)
Constructor of ScopeDoc.
Doc that represents slice in Index expression.
Definition: doc.h:767
Optional< ExprDoc > start
The start of slice.
Definition: doc.h:770
static constexpr const char * _type_key
Definition: doc.h:784
Optional< ExprDoc > step
The step of slice.
Definition: doc.h:774
Optional< ExprDoc > stop
The exclusive end of slice.
Definition: doc.h:772
TVM_DECLARE_FINAL_OBJECT_INFO(SliceDocNode, DocNode)
static void RegisterReflection()
Definition: doc.h:776
Reference type of SliceDocNode.
Definition: doc.h:794
SliceDoc(Optional< ExprDoc > start, Optional< ExprDoc > stop, Optional< ExprDoc > step)
Constructor of SliceDoc.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(SliceDoc, Doc, SliceDocNode)
The container doc that holds a list of StmtDoc.
Definition: doc.h:208
TVM_DECLARE_FINAL_OBJECT_INFO(StmtBlockDocNode, DocNode)
Array< StmtDoc > stmts
The list of statements.
Definition: doc.h:211
static void RegisterReflection()
Definition: doc.h:213
static constexpr const char * _type_key
Definition: doc.h:218
Reference type of StmtBlockDocNode.
Definition: doc.h:227
StmtBlockDoc(Array< StmtDoc > stmts)
Constructor of StmtBlockDoc.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(StmtBlockDoc, Doc, StmtBlockDocNode)
The base class of statement doc.
Definition: doc.h:167
TVM_DECLARE_BASE_OBJECT_INFO(StmtDocNode, DocNode)
static constexpr const char * _type_key
Definition: doc.h:184
Optional< String > comment
The comment of this doc.
Definition: doc.h:177
static void RegisterReflection()
Definition: doc.h:179
Reference type of StmtDocNode.
Definition: doc.h:194
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(StmtDoc, Doc, StmtDocNode)
Doc that represents tuple literal.
Definition: doc.h:638
Array< ExprDoc > elements
Elements of tuple.
Definition: doc.h:641
static constexpr const char * _type_key
Definition: doc.h:648
static void RegisterReflection()
Definition: doc.h:643
TVM_DECLARE_FINAL_OBJECT_INFO(TupleDocNode, ExprDocNode)
Reference type of TupleDocNode.
Definition: doc.h:658
TupleDoc(Array< ExprDoc > elements)
Constructor of TupleDoc.
TupleDoc()
Create an empty TupleDoc.
Definition: doc.h:663
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(TupleDoc, ExprDoc, TupleDocNode)
Doc that represents while statement.
Definition: doc.h:903
static void RegisterReflection()
Definition: doc.h:910
static constexpr const char * _type_key
Definition: doc.h:917
Array< StmtDoc > body
The body of the while statement.
Definition: doc.h:908
TVM_DECLARE_FINAL_OBJECT_INFO(WhileDocNode, StmtDocNode)
ExprDoc predicate
The predicate of the while statement.
Definition: doc.h:906
Reference type of WhileDocNode.
Definition: doc.h:927
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(WhileDoc, StmtDoc, WhileDocNode)
WhileDoc(ExprDoc predicate, 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::reflection::AccessPath AccessPath
Definition: doc.h:35
String DocToPythonScript(Doc doc, const PrinterConfig &cfg)
Convert Doc into Python script.
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:37
Definitions and helper macros for IR/AST nodes.