19#ifndef TVM_SCRIPT_PRINTER_DOC_H_
20#define TVM_SCRIPT_PRINTER_DOC_H_
22#include <tvm/ffi/dtype.h>
23#include <tvm/ffi/reflection/access_path.h>
24#include <tvm/ffi/reflection/registry.h>
60 namespace refl = tvm::ffi::reflection;
77class Doc :
public ffi::ObjectRef {
119 ffi::Array<ffi::String> kwargs_keys,
120 ffi::Array<ExprDoc, void> kwargs_values)
const;
123 namespace refl = tvm::ffi::reflection;
124 refl::ObjectDef<ExprDocNode>();
145 explicit ExprDoc(ffi::ObjectPtr<ExprDocNode> data) :
Doc(ffi::UnsafeInit{}) {
146 TVM_FFI_ICHECK(data !=
nullptr);
147 data_ = std::move(data);
168 mutable ffi::Optional<ffi::String>
comment{std::nullopt};
171 namespace refl = tvm::ffi::reflection;
202 namespace refl = tvm::ffi::reflection;
241 namespace refl = tvm::ffi::reflection;
303 static LiteralDoc Str(
const ffi::String& v,
const ffi::Optional<AccessPath>& p) {
313 v == DLDataType{kDLOpaqueHandle, 0, 0} ?
"void" : ffi::DLDataTypeToString(v);
322 std::ostringstream os;
341 namespace refl = tvm::ffi::reflection;
375 namespace refl = tvm::ffi::reflection;
410 namespace refl = tvm::ffi::reflection;
411 refl::ObjectDef<AttrAccessDocNode>()
453 namespace refl = tvm::ffi::reflection;
454 refl::ObjectDef<IndexDocNode>()
499 namespace refl = tvm::ffi::reflection;
500 refl::ObjectDef<CallDocNode>()
524 ffi::Array<ffi::String> kwargs_keys, ffi::Array<ExprDoc> kwargs_values);
583 namespace refl = tvm::ffi::reflection;
584 refl::ObjectDef<OperationDocNode>()
623 namespace refl = tvm::ffi::reflection;
624 refl::ObjectDef<LambdaDocNode>()
658 namespace refl = tvm::ffi::reflection;
694 namespace refl = tvm::ffi::reflection;
737 namespace refl = tvm::ffi::reflection;
738 refl::ObjectDef<DictDocNode>()
782 namespace refl = tvm::ffi::reflection;
783 refl::ObjectDef<SliceDocNode>()
805 ffi::Optional<ExprDoc> step);
823 ffi::Optional<ExprDoc>
rhs;
828 namespace refl = tvm::ffi::reflection;
829 refl::ObjectDef<AssignDocNode>()
851 ffi::Optional<ExprDoc> annotation);
870 namespace refl = tvm::ffi::reflection;
871 refl::ObjectDef<IfDocNode>()
893 ffi::Optional<ffi::Array<StmtDoc>> else_branch);
910 namespace refl = tvm::ffi::reflection;
911 refl::ObjectDef<WhileDocNode>()
942 namespace refl = tvm::ffi::reflection;
943 refl::ObjectDef<BreakDocNode>();
971 namespace refl = tvm::ffi::reflection;
972 refl::ObjectDef<ContinueDocNode>();
1011 namespace refl = tvm::ffi::reflection;
1012 refl::ObjectDef<ForDocNode>()
1050 ffi::Optional<ExprDoc>
lhs{std::nullopt};
1059 namespace refl = tvm::ffi::reflection;
1060 refl::ObjectDef<ScopeDocNode>()
1084 bool allow_concise_scoping =
false);
1107 namespace refl = tvm::ffi::reflection;
1138 ffi::Optional<ExprDoc>
msg{std::nullopt};
1141 namespace refl = tvm::ffi::reflection;
1142 refl::ObjectDef<AssertDocNode>()
1176 namespace refl = tvm::ffi::reflection;
1230 namespace refl = tvm::ffi::reflection;
1231 refl::ObjectDef<FunctionDocNode>()
1259 ffi::Array<ExprDoc> decorators,
1260 ffi::Optional<ExprDoc> return_type, ffi::Array<StmtDoc> body,
1261 ffi::Array<Doc> type_params = {});
1280 namespace refl = tvm::ffi::reflection;
1281 refl::ObjectDef<ClassDocNode>()
1303 ffi::Array<StmtDoc> body);
1315 namespace refl = tvm::ffi::reflection;
1316 refl::ObjectDef<CommentDocNode>();
1340 namespace refl = tvm::ffi::reflection;
1341 refl::ObjectDef<DocStringDocNode>();
1368 ffi::reflection::ObjectDef<NamespaceDocNode>().def_ro(
"canonical_name",
Managed reference class to FloatImmNode.
Definition expr.h:232
Managed reference class to IntImmNode.
Definition expr.h:152
static IntImm Int64(ffi::BigInt value, Location loc=UnknownLoc())
Construct a scalar int64 constant.
Definition expr.h:195
static IntImm Bool(bool value, Location loc=UnknownLoc())
Construct a scalar boolean constant.
Definition expr.h:172
static TVM_TIRX_DLL PrimType Float(int bits, int lanes=1)
Construct a floating-point type with fixed lanes.
Doc that represents assert statement.
Definition doc.h:1133
ffi::Optional< ExprDoc > msg
The optional error message when assertion failed.
Definition doc.h:1138
static void RegisterReflection()
Definition doc.h:1140
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.AssertDoc", AssertDocNode, StmtDocNode)
ExprDoc test
The expression to test.
Definition doc.h:1136
Reference type of AssertDocNode.
Definition doc.h:1154
TVM_TIRX_DLL AssertDoc(ExprDoc test, ffi::Optional< ExprDoc > msg=std::nullopt)
Constructor of AssertDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AssertDoc, StmtDoc, AssertDocNode)
Doc that represents assign statement.
Definition doc.h:814
ffi::Optional< ExprDoc > annotation
The type annotation of this assignment.
Definition doc.h:825
ffi::Optional< ExprDoc > rhs
The right hand side of the assignment.
Definition doc.h:823
ExprDoc lhs
The left hand side of the assignment.
Definition doc.h:817
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.AssignDoc", AssignDocNode, StmtDocNode)
static void RegisterReflection()
Definition doc.h:827
Reference type of AssignDocNode.
Definition doc.h:842
TVM_TIRX_DLL 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:402
ffi::String name
The attribute to be accessed.
Definition doc.h:407
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.AttrAccessDoc", AttrAccessDocNode, ExprDocNode)
ExprDoc value
The target expression to be accessed.
Definition doc.h:405
static void RegisterReflection()
Definition doc.h:409
Reference type of AttrAccessDocNode.
Definition doc.h:423
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AttrAccessDoc, ExprDoc, AttrAccessDocNode)
TVM_TIRX_DLL AttrAccessDoc(ExprDoc value, ffi::String name)
Constructor of AttrAccessDoc.
Doc that represents break statement.
Definition doc.h:939
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.BreakDoc", BreakDocNode, StmtDocNode)
static void RegisterReflection()
Definition doc.h:941
Reference type of BreakDocNode.
Definition doc.h:954
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(BreakDoc, StmtDoc, BreakDocNode)
TVM_TIRX_DLL BreakDoc()
Constructor of BreakDoc.
Doc that represents function call.
Definition doc.h:482
ffi::Array< ffi::String > kwargs_keys
The keys of keyword arguments.
Definition doc.h:489
ffi::Array< ExprDoc > kwargs_values
The values of keyword arguments.
Definition doc.h:496
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.CallDoc", CallDocNode, ExprDocNode)
static void RegisterReflection()
Definition doc.h:498
ffi::Array< ExprDoc > args
The positional arguments.
Definition doc.h:487
ExprDoc callee
The callee of this function call.
Definition doc.h:485
Reference type of CallDocNode.
Definition doc.h:514
TVM_TIRX_DLL CallDoc(ExprDoc callee, ffi::Array< ExprDoc > args, ffi::Array< ffi::String > kwargs_keys, ffi::Array< ExprDoc > kwargs_values)
Constructor of CallDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(CallDoc, ExprDoc, CallDocNode)
Doc that represents class definition.
Definition doc.h:1270
ffi::Array< ExprDoc > decorators
Decorators of class.
Definition doc.h:1275
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ClassDoc", ClassDocNode, StmtDocNode)
static void RegisterReflection()
Definition doc.h:1279
IdDoc name
The name of class.
Definition doc.h:1273
ffi::Array< StmtDoc > body
The body of class.
Definition doc.h:1277
Reference type of ClassDocNode.
Definition doc.h:1294
TVM_TIRX_DLL 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 continue statement.
Definition doc.h:968
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ContinueDoc", ContinueDocNode, StmtDocNode)
static void RegisterReflection()
Definition doc.h:970
Reference type of ContinueDocNode.
Definition doc.h:983
TVM_TIRX_DLL ContinueDoc()
Constructor of ContinueDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ContinueDoc, StmtDoc, ContinueDocNode)
Doc that represents dictionary literal.
Definition doc.h:724
ffi::Array< ExprDoc > keys
keys of dictionary
Definition doc.h:727
static void RegisterReflection()
Definition doc.h:736
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.DictDoc", DictDocNode, ExprDocNode)
ffi::Array< ExprDoc > values
Values of dictionary.
Definition doc.h:734
Reference type of DictDocNode.
Definition doc.h:750
TVM_TIRX_DLL DictDoc(ffi::Array< ExprDoc > keys, ffi::Array< ExprDoc > values)
Constructor of DictDoc.
DictDoc()
Create an empty dictionary.
Definition doc.h:755
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(DictDoc, ExprDoc, DictDocNode)
The base class of all Doc.
Definition doc.h:48
static constexpr bool _type_mutable
Definition doc.h:64
virtual ~DocNode()=default
TVM_FFI_DECLARE_OBJECT_INFO("script.printer.Doc", DocNode, ffi::Object)
static void RegisterReflection()
Definition doc.h:59
ffi::Array< AccessPath > source_paths
The list of object paths of the source IR node.
Definition doc.h:57
Doc that represents docstring.
Definition doc.h:1337
static void RegisterReflection()
Definition doc.h:1339
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.DocStringDoc", DocStringDocNode, StmtDocNode)
Reference type of DocStringDocNode.
Definition doc.h:1351
TVM_TIRX_DLL DocStringDoc(ffi::String docs)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(DocStringDoc, StmtDoc, DocStringDocNode)
Reference type of DocNode.
Definition doc.h:77
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Doc, ffi::ObjectRef, DocNode)
The base class of expression doc.
Definition doc.h:92
static void RegisterReflection()
Definition doc.h:122
TVM_FFI_DECLARE_OBJECT_INFO("script.printer.ExprDoc", ExprDocNode, DocNode)
TVM_TIRX_DLL ExprDoc Attr(ffi::String attr) const
Create a doc representing attribute access on the current ExprDoc.
TVM_TIRX_DLL ExprDoc Call(ffi::Array< ExprDoc, void > args) const
Create a doc representing calling the current ExprDoc.
TVM_TIRX_DLL ExprDoc operator[](ffi::Array< Doc > indices) const
Create a doc representing index access on the current ExprDoc.
TVM_TIRX_DLL 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:134
ExprDoc(ffi::ObjectPtr< ExprDocNode > data)
Definition doc.h:145
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ExprDoc, Doc, ExprDocNode)
TVM_TIRX_DLL 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:1101
static void RegisterReflection()
Definition doc.h:1106
ExprDoc expr
The expression represented by this doc.
Definition doc.h:1104
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ExprStmtDoc", ExprStmtDocNode, StmtDocNode)
Reference type of ExprStmtDocNode.
Definition doc.h:1118
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ExprStmtDoc, StmtDoc, ExprStmtDocNode)
TVM_TIRX_DLL ExprStmtDoc(ExprDoc expr)
Constructor of ExprStmtDoc.
Doc that renders an expression as a Python string literal.
Definition doc.h:335
static void RegisterReflection()
Definition doc.h:340
ExprDoc value
The expression to render as a string.
Definition doc.h:338
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ExprStringDoc", ExprStringDocNode, ExprDocNode)
Reference type of ExprStringDocNode.
Definition doc.h:352
TVM_TIRX_DLL ExprStringDoc(ExprDoc value, const ffi::Optional< AccessPath > &object_path)
Constructor of ExprStringDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ExprStringDoc, ExprDoc, ExprStringDocNode)
Doc that represents for statement.
Definition doc.h:1001
ffi::Array< StmtDoc > body
The body of the for statement.
Definition doc.h:1008
ExprDoc lhs
The left hand side of the assignment of iterating variable.
Definition doc.h:1004
static void RegisterReflection()
Definition doc.h:1010
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:1006
Reference type of ForDocNode.
Definition doc.h:1025
TVM_TIRX_DLL 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:1202
ffi::Array< AssignDoc > args
The arguments of function.
Definition doc.h:1213
ffi::Array< Doc > type_params
The PEP 695 type parameters of the function.
Definition doc.h:1227
ffi::Array< StmtDoc > body
The body of function.
Definition doc.h:1219
IdDoc name
The name of function.
Definition doc.h:1205
static void RegisterReflection()
Definition doc.h:1229
ffi::Array< ExprDoc > decorators
Decorators of function.
Definition doc.h:1215
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.FunctionDoc", FunctionDocNode, StmtDocNode)
ffi::Optional< ExprDoc > return_type
The return type of function.
Definition doc.h:1217
Reference type of FunctionDocNode.
Definition doc.h:1247
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(FunctionDoc, StmtDoc, FunctionDocNode)
TVM_TIRX_DLL FunctionDoc(IdDoc name, ffi::Array< AssignDoc > args, ffi::Array< ExprDoc > decorators, ffi::Optional< ExprDoc > return_type, ffi::Array< StmtDoc > body, ffi::Array< Doc > type_params={})
Constructor of FunctionDoc.
Doc that represents identifier.
Definition doc.h:369
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IdDoc", IdDocNode, ExprDocNode)
ffi::String name
The name of the identifier.
Definition doc.h:372
static void RegisterReflection()
Definition doc.h:374
Reference type of IdDocNode.
Definition doc.h:386
IdDoc(std::nullptr_t)
Definition doc.h:393
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IdDoc, ExprDoc, IdDocNode)
TVM_TIRX_DLL IdDoc(ffi::String name)
Constructor of IdDoc.
Doc that represent if-then-else statement.
Definition doc.h:860
static void RegisterReflection()
Definition doc.h:869
ffi::Optional< ffi::Array< StmtDoc > > else_branch
The optional else branch; an empty array represents a present empty branch.
Definition doc.h:867
ffi::Array< StmtDoc > then_branch
The then branch of the if-then-else statement.
Definition doc.h:865
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IfDoc", IfDocNode, StmtDocNode)
ExprDoc predicate
The predicate of the if-then-else statement.
Definition doc.h:863
Reference type of IfDocNode.
Definition doc.h:884
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IfDoc, StmtDoc, IfDocNode)
TVM_TIRX_DLL IfDoc(ExprDoc predicate, ffi::Array< StmtDoc > then_branch, ffi::Optional< ffi::Array< StmtDoc > > else_branch)
Constructor of IfDoc.
Doc that represents index access on another expression.
Definition doc.h:439
static void RegisterReflection()
Definition doc.h:452
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IndexDoc", IndexDocNode, ExprDocNode)
ffi::Array< Doc > indices
The indices to access.
Definition doc.h:450
ExprDoc value
The container value to be accessed.
Definition doc.h:442
Reference type of IndexDocNode.
Definition doc.h:466
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IndexDoc, ExprDoc, IndexDocNode)
TVM_TIRX_DLL IndexDoc(ExprDoc value, ffi::Array< Doc > indices)
Constructor of IndexDoc.
Doc that represents anonymous function.
Definition doc.h:615
static void RegisterReflection()
Definition doc.h:622
ExprDoc body
The body of this anonymous function.
Definition doc.h:620
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.LambdaDoc", LambdaDocNode, ExprDocNode)
ffi::Array< IdDoc > args
The arguments of this anonymous function.
Definition doc.h:618
Reference type of LambdaDocNode.
Definition doc.h:636
TVM_TIRX_DLL LambdaDoc(ffi::Array< IdDoc > args, ExprDoc body)
Constructor of LambdaDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(LambdaDoc, ExprDoc, LambdaDocNode)
Doc that represents list literal.
Definition doc.h:688
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ListDoc", ListDocNode, ExprDocNode)
ffi::Array< ExprDoc > elements
Elements of list.
Definition doc.h:691
static void RegisterReflection()
Definition doc.h:693
Reference type of ListDocNode.
Definition doc.h:705
TVM_TIRX_DLL ListDoc(ffi::Array< ExprDoc > elements)
Constructor of ListDoc.
ListDoc()
Create an empty ListDoc.
Definition doc.h:710
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ListDoc, ExprDoc, ListDocNode)
Doc that represents literal value.
Definition doc.h:227
ffi::Any value
the internal representation of the literal value.
Definition doc.h:238
static void RegisterReflection()
Definition doc.h:240
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.LiteralDoc", LiteralDocNode, ExprDocNode)
Reference type of LiteralDocNode.
Definition doc.h:252
static LiteralDoc DataType(DLDataType v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent string.
Definition doc.h:311
static LiteralDoc Boolean(bool v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent boolean.
Definition doc.h:287
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(LiteralDoc, ExprDoc, LiteralDocNode)
static LiteralDoc Device(const DLDevice &v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent device.
Definition doc.h:321
TVM_TIRX_DLL LiteralDoc(ffi::Any value, const ffi::Optional< AccessPath > &object_path)
static LiteralDoc Int(IntImm v, const ffi::Optional< AccessPath > &p)
Create an integer literal preserving its typed payload.
Definition doc.h:279
static LiteralDoc Int(int64_t v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent integer.
Definition doc.h:269
static LiteralDoc Float(double v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent float.
Definition doc.h:295
static LiteralDoc None(const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent None/null/empty value.
Definition doc.h:261
static LiteralDoc Str(const ffi::String &v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent string.
Definition doc.h:303
A reference to a canonical script namespace.
Definition doc.h:1362
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.NamespaceDoc", NamespaceDocNode, ExprDocNode)
static void RegisterReflection()
Definition doc.h:1367
ffi::String canonical_name
The namespace name before alias resolution.
Definition doc.h:1365
An owning reference to a deferred script namespace.
Definition doc.h:1377
TVM_TIRX_DLL NamespaceDoc(ffi::String canonical_name)
Construct a deferred namespace reference.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(NamespaceDoc, ExprDoc, NamespaceDocNode)
Doc that represents operation.
Definition doc.h:536
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.OperationDoc", OperationDocNode, ExprDocNode)
ffi::Array< ExprDoc > operands
Operands of this expression.
Definition doc.h:580
Kind kind
The kind of operation (operator)
Definition doc.h:578
static void RegisterReflection()
Definition doc.h:582
Reference type of OperationDocNode.
Definition doc.h:596
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(OperationDoc, ExprDoc, OperationDocNode)
TVM_TIRX_DLL OperationDoc(OperationDocNode::Kind kind, ffi::Array< ExprDoc > operands)
Constructor of OperationDoc.
Doc that represents return statement.
Definition doc.h:1170
ExprDoc value
The value to return.
Definition doc.h:1173
static void RegisterReflection()
Definition doc.h:1175
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ReturnDoc", ReturnDocNode, StmtDocNode)
Reference type of ReturnDocNode.
Definition doc.h:1187
TVM_TIRX_DLL ReturnDoc(ExprDoc value)
Constructor of ReturnDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ReturnDoc, StmtDoc, ReturnDocNode)
Doc that represents special scopes.
Definition doc.h:1047
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ScopeDoc", ScopeDocNode, StmtDocNode)
bool allow_concise_scoping
Whether a tail-position renderer may spell this scope concisely.
Definition doc.h:1056
ffi::Optional< ExprDoc > lhs
The name of the scoped variable.
Definition doc.h:1050
ExprDoc rhs
The value of the scoped variable.
Definition doc.h:1052
static void RegisterReflection()
Definition doc.h:1058
ffi::Array< StmtDoc > body
The body of the scope doc.
Definition doc.h:1054
Reference type of ScopeDocNode.
Definition doc.h:1074
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ScopeDoc, StmtDoc, ScopeDocNode)
TVM_TIRX_DLL ScopeDoc(ExprDoc rhs, ffi::Array< StmtDoc > body)
Constructor of ScopeDoc.
TVM_TIRX_DLL ScopeDoc(ffi::Optional< ExprDoc > lhs, ExprDoc rhs, ffi::Array< StmtDoc > body, bool allow_concise_scoping=false)
Constructor of ScopeDoc.
Doc that represents slice in Index expression.
Definition doc.h:772
ffi::Optional< ExprDoc > start
The start of slice.
Definition doc.h:775
ffi::Optional< ExprDoc > step
The step of slice.
Definition doc.h:779
ffi::Optional< ExprDoc > stop
The exclusive end of slice.
Definition doc.h:777
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.SliceDoc", SliceDocNode, DocNode)
static void RegisterReflection()
Definition doc.h:781
Reference type of SliceDocNode.
Definition doc.h:796
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(SliceDoc, Doc, SliceDocNode)
TVM_TIRX_DLL SliceDoc(ffi::Optional< ExprDoc > start, ffi::Optional< ExprDoc > stop, ffi::Optional< ExprDoc > step)
Constructor of SliceDoc.
The container doc that holds a list of StmtDoc.
Definition doc.h:196
static void RegisterReflection()
Definition doc.h:201
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.StmtBlockDoc", StmtBlockDocNode, DocNode)
ffi::Array< StmtDoc > stmts
The list of statements.
Definition doc.h:199
Reference type of StmtBlockDocNode.
Definition doc.h:212
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(StmtBlockDoc, Doc, StmtBlockDocNode)
TVM_TIRX_DLL StmtBlockDoc(ffi::Array< StmtDoc > stmts)
Constructor of StmtBlockDoc.
The base class of statement doc.
Definition doc.h:158
ffi::Optional< ffi::String > comment
The comment of this doc.
Definition doc.h:168
static void RegisterReflection()
Definition doc.h:170
TVM_FFI_DECLARE_OBJECT_INFO("script.printer.StmtDoc", StmtDocNode, DocNode)
Reference type of StmtDocNode.
Definition doc.h:182
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(StmtDoc, Doc, StmtDocNode)
Doc that represents tuple literal.
Definition doc.h:652
ffi::Array< ExprDoc > elements
Elements of tuple.
Definition doc.h:655
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.TupleDoc", TupleDocNode, ExprDocNode)
static void RegisterReflection()
Definition doc.h:657
Reference type of TupleDocNode.
Definition doc.h:669
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(TupleDoc, ExprDoc, TupleDocNode)
TVM_TIRX_DLL TupleDoc(ffi::Array< ExprDoc > elements)
Constructor of TupleDoc.
TupleDoc()
Create an empty TupleDoc.
Definition doc.h:674
Doc that represents while statement.
Definition doc.h:902
static void RegisterReflection()
Definition doc.h:909
ffi::Array< StmtDoc > body
The body of the while statement.
Definition doc.h:907
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.WhileDoc", WhileDocNode, StmtDocNode)
ExprDoc predicate
The predicate of the while statement.
Definition doc.h:905
Reference type of WhileDocNode.
Definition doc.h:923
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(WhileDoc, StmtDoc, WhileDocNode)
TVM_TIRX_DLL WhileDoc(ExprDoc predicate, ffi::Array< StmtDoc > body)
Constructor of WhileDoc.
Abstract device memory management API.
IR/AST nodes for TVM types shared across IR variants.
std::ostream & operator<<(std::ostream &os, DLDevice dev)
Definition device_api.h:313
ffi::reflection::AccessPath AccessPath
Definition doc.h:35
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition attr.h:23
#define TVM_TIRX_DLL
Definition base.h:83