23#ifndef TVM_SCRIPT_PRINTER_DOC_H_
24#define TVM_SCRIPT_PRINTER_DOC_H_
26#include <tvm/ffi/dtype.h>
27#include <tvm/ffi/reflection/access_path.h>
28#include <tvm/ffi/reflection/registry.h>
64 namespace refl = tvm::ffi::reflection;
78class Doc :
public ffi::ObjectRef {
120 ffi::Array<ffi::String> kwargs_keys,
121 ffi::Array<ExprDoc, void> kwargs_values)
const;
124 namespace refl = tvm::ffi::reflection;
125 refl::ObjectDef<ExprDocObj>();
146 explicit ExprDoc(ffi::ObjectPtr<ExprDocObj> data) :
Doc(ffi::UnsafeInit{}) {
147 TVM_FFI_ICHECK(data !=
nullptr);
148 data_ = std::move(data);
169 mutable ffi::Optional<ffi::String>
comment{std::nullopt};
172 namespace refl = tvm::ffi::reflection;
203 namespace refl = tvm::ffi::reflection;
242 namespace refl = tvm::ffi::reflection;
304 static LiteralDoc Str(
const ffi::String& v,
const ffi::Optional<AccessPath>& p) {
314 v == DLDataType{kDLOpaqueHandle, 0, 0} ?
"void" : ffi::DLDataTypeToString(v);
323 std::ostringstream os;
342 namespace refl = tvm::ffi::reflection;
376 namespace refl = tvm::ffi::reflection;
411 namespace refl = tvm::ffi::reflection;
412 refl::ObjectDef<AttrAccessDocObj>()
454 namespace refl = tvm::ffi::reflection;
455 refl::ObjectDef<IndexDocObj>()
500 namespace refl = tvm::ffi::reflection;
501 refl::ObjectDef<CallDocObj>()
525 ffi::Array<ffi::String> kwargs_keys, ffi::Array<ExprDoc> kwargs_values);
584 namespace refl = tvm::ffi::reflection;
585 refl::ObjectDef<OperationDocObj>()
624 namespace refl = tvm::ffi::reflection;
625 refl::ObjectDef<LambdaDocObj>()
659 namespace refl = tvm::ffi::reflection;
695 namespace refl = tvm::ffi::reflection;
738 namespace refl = tvm::ffi::reflection;
739 refl::ObjectDef<DictDocObj>()
783 namespace refl = tvm::ffi::reflection;
784 refl::ObjectDef<SliceDocObj>()
806 ffi::Optional<ExprDoc> step);
824 ffi::Optional<ExprDoc>
rhs;
829 namespace refl = tvm::ffi::reflection;
830 refl::ObjectDef<AssignDocObj>()
852 ffi::Optional<ExprDoc> annotation);
871 namespace refl = tvm::ffi::reflection;
872 refl::ObjectDef<IfDocObj>()
894 ffi::Optional<ffi::Array<StmtDoc>> else_branch);
911 namespace refl = tvm::ffi::reflection;
912 refl::ObjectDef<WhileDocObj>()
943 namespace refl = tvm::ffi::reflection;
944 refl::ObjectDef<BreakDocObj>();
972 namespace refl = tvm::ffi::reflection;
973 refl::ObjectDef<ContinueDocObj>();
1012 namespace refl = tvm::ffi::reflection;
1013 refl::ObjectDef<ForDocObj>()
1051 ffi::Optional<ExprDoc>
lhs{std::nullopt};
1060 namespace refl = tvm::ffi::reflection;
1061 refl::ObjectDef<ScopeDocObj>()
1085 bool allow_concise_scoping =
false);
1108 namespace refl = tvm::ffi::reflection;
1139 ffi::Optional<ExprDoc>
msg{std::nullopt};
1142 namespace refl = tvm::ffi::reflection;
1143 refl::ObjectDef<AssertDocObj>()
1177 namespace refl = tvm::ffi::reflection;
1231 namespace refl = tvm::ffi::reflection;
1232 refl::ObjectDef<FunctionDocObj>()
1260 ffi::Array<ExprDoc> decorators,
1261 ffi::Optional<ExprDoc> return_type, ffi::Array<StmtDoc> body,
1262 ffi::Array<Doc> type_params = {});
1281 namespace refl = tvm::ffi::reflection;
1282 refl::ObjectDef<ClassDocObj>()
1304 ffi::Array<StmtDoc> body);
1316 namespace refl = tvm::ffi::reflection;
1317 refl::ObjectDef<CommentDocObj>();
1341 namespace refl = tvm::ffi::reflection;
1342 refl::ObjectDef<DocStringDocObj>();
1369 ffi::reflection::ObjectDef<NamespaceDocObj>().def_ro(
"canonical_name",
IR/AST nodes for TVM types shared across IR variants.
#define TVM_TIRX_DLL
Definition base.h:55
Managed reference class to FloatImmObj.
Definition expr.h:411
Managed reference class to IntImmObj.
Definition expr.h:331
static IntImm Int64(ffi::BigInt value, Location loc=UnknownLoc())
Construct a scalar int64 constant.
Definition expr.h:374
static IntImm Bool(bool value, Location loc=UnknownLoc())
Construct a scalar boolean constant.
Definition expr.h:351
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:1134
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.AssertDoc", AssertDocObj, StmtDocObj)
static void RegisterReflection()
Definition doc.h:1141
ffi::Optional< ExprDoc > msg
The optional error message when assertion failed.
Definition doc.h:1139
ExprDoc test
The expression to test.
Definition doc.h:1137
Reference type of AssertDocObj.
Definition doc.h:1155
TVM_TIRX_DLL AssertDoc(ExprDoc test, ffi::Optional< ExprDoc > msg=std::nullopt)
Constructor of AssertDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AssertDoc, StmtDoc, AssertDocObj)
Doc that represents assign statement.
Definition doc.h:815
static void RegisterReflection()
Definition doc.h:828
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.AssignDoc", AssignDocObj, StmtDocObj)
ffi::Optional< ExprDoc > annotation
The type annotation of this assignment.
Definition doc.h:826
ExprDoc lhs
The left hand side of the assignment.
Definition doc.h:818
ffi::Optional< ExprDoc > rhs
The right hand side of the assignment.
Definition doc.h:824
Reference type of AssignDocObj.
Definition doc.h:843
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AssignDoc, StmtDoc, AssignDocObj)
TVM_TIRX_DLL AssignDoc(ExprDoc lhs, ffi::Optional< ExprDoc > rhs, ffi::Optional< ExprDoc > annotation)
Constructor of AssignDoc.
Doc that represents attribute access on another expression.
Definition doc.h:403
ffi::String name
The attribute to be accessed.
Definition doc.h:408
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.AttrAccessDoc", AttrAccessDocObj, ExprDocObj)
static void RegisterReflection()
Definition doc.h:410
ExprDoc value
The target expression to be accessed.
Definition doc.h:406
Reference type of AttrAccessDocObj.
Definition doc.h:424
TVM_TIRX_DLL AttrAccessDoc(ExprDoc value, ffi::String name)
Constructor of AttrAccessDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(AttrAccessDoc, ExprDoc, AttrAccessDocObj)
Doc that represents break statement.
Definition doc.h:940
static void RegisterReflection()
Definition doc.h:942
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.BreakDoc", BreakDocObj, StmtDocObj)
Reference type of BreakDocObj.
Definition doc.h:955
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(BreakDoc, StmtDoc, BreakDocObj)
TVM_TIRX_DLL BreakDoc()
Constructor of BreakDoc.
Doc that represents function call.
Definition doc.h:483
ffi::Array< ExprDoc > kwargs_values
The values of keyword arguments.
Definition doc.h:497
ExprDoc callee
The callee of this function call.
Definition doc.h:486
ffi::Array< ffi::String > kwargs_keys
The keys of keyword arguments.
Definition doc.h:490
static void RegisterReflection()
Definition doc.h:499
ffi::Array< ExprDoc > args
The positional arguments.
Definition doc.h:488
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.CallDoc", CallDocObj, ExprDocObj)
Reference type of CallDocObj.
Definition doc.h:515
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, CallDocObj)
Doc that represents class definition.
Definition doc.h:1271
ffi::Array< StmtDoc > body
The body of class.
Definition doc.h:1278
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ClassDoc", ClassDocObj, StmtDocObj)
ffi::Array< ExprDoc > decorators
Decorators of class.
Definition doc.h:1276
IdDoc name
The name of class.
Definition doc.h:1274
static void RegisterReflection()
Definition doc.h:1280
Reference type of ClassDocObj.
Definition doc.h:1295
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ClassDoc, StmtDoc, ClassDocObj)
TVM_TIRX_DLL ClassDoc(IdDoc name, ffi::Array< ExprDoc > decorators, ffi::Array< StmtDoc > body)
Constructor of ClassDoc.
Doc that represents continue statement.
Definition doc.h:969
static void RegisterReflection()
Definition doc.h:971
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ContinueDoc", ContinueDocObj, StmtDocObj)
Reference type of ContinueDocObj.
Definition doc.h:984
TVM_TIRX_DLL ContinueDoc()
Constructor of ContinueDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ContinueDoc, StmtDoc, ContinueDocObj)
Doc that represents dictionary literal.
Definition doc.h:725
ffi::Array< ExprDoc > keys
keys of dictionary
Definition doc.h:728
ffi::Array< ExprDoc > values
Values of dictionary.
Definition doc.h:735
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.DictDoc", DictDocObj, ExprDocObj)
static void RegisterReflection()
Definition doc.h:737
Reference type of DictDocObj.
Definition doc.h:751
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(DictDoc, ExprDoc, DictDocObj)
TVM_TIRX_DLL DictDoc(ffi::Array< ExprDoc > keys, ffi::Array< ExprDoc > values)
Constructor of DictDoc.
DictDoc()
Create an empty dictionary.
Definition doc.h:756
The base class of all Doc.
Definition doc.h:52
ffi::Array< AccessPath > source_paths
The list of object paths of the source IR node.
Definition doc.h:61
static constexpr bool _type_mutable
Definition doc.h:68
static void RegisterReflection()
Definition doc.h:63
TVM_FFI_DECLARE_OBJECT_INFO("script.printer.Doc", DocObj, ffi::Object)
Doc that represents docstring.
Definition doc.h:1338
static void RegisterReflection()
Definition doc.h:1340
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.DocStringDoc", DocStringDocObj, StmtDocObj)
Reference type of DocStringDocObj.
Definition doc.h:1352
TVM_TIRX_DLL DocStringDoc(ffi::String docs)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(DocStringDoc, StmtDoc, DocStringDocObj)
Reference type of DocObj.
Definition doc.h:78
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Doc, ffi::ObjectRef, DocObj)
The base class of expression doc.
Definition doc.h:93
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.
TVM_TIRX_DLL ExprDoc Attr(ffi::String attr) const
Create a doc representing attribute access on the current ExprDoc.
TVM_FFI_DECLARE_OBJECT_INFO("script.printer.ExprDoc", ExprDocObj, DocObj)
static void RegisterReflection()
Definition doc.h:123
Reference type of ExprDocObj.
Definition doc.h:135
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ExprDoc, Doc, ExprDocObj)
ExprDoc(ffi::ObjectPtr< ExprDocObj > data)
Definition doc.h:146
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:1102
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ExprStmtDoc", ExprStmtDocObj, StmtDocObj)
static void RegisterReflection()
Definition doc.h:1107
ExprDoc expr
The expression represented by this doc.
Definition doc.h:1105
Reference type of ExprStmtDocObj.
Definition doc.h:1119
TVM_TIRX_DLL ExprStmtDoc(ExprDoc expr)
Constructor of ExprStmtDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ExprStmtDoc, StmtDoc, ExprStmtDocObj)
Doc that renders an expression as a Python string literal.
Definition doc.h:336
ExprDoc value
The expression to render as a string.
Definition doc.h:339
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ExprStringDoc", ExprStringDocObj, ExprDocObj)
static void RegisterReflection()
Definition doc.h:341
Reference type of ExprStringDocObj.
Definition doc.h:353
TVM_TIRX_DLL ExprStringDoc(ExprDoc value, const ffi::Optional< AccessPath > &object_path)
Constructor of ExprStringDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ExprStringDoc, ExprDoc, ExprStringDocObj)
Doc that represents for statement.
Definition doc.h:1002
ffi::Array< StmtDoc > body
The body of the for statement.
Definition doc.h:1009
ExprDoc lhs
The left hand side of the assignment of iterating variable.
Definition doc.h:1005
ExprDoc rhs
The right hand side of the assignment of iterating variable.
Definition doc.h:1007
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ForDoc", ForDocObj, StmtDocObj)
static void RegisterReflection()
Definition doc.h:1011
Reference type of ForDocObj.
Definition doc.h:1026
TVM_TIRX_DLL ForDoc(ExprDoc lhs, ExprDoc rhs, ffi::Array< StmtDoc > body)
Constructor of ForDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ForDoc, StmtDoc, ForDocObj)
Doc that represents function definition.
Definition doc.h:1203
ffi::Array< StmtDoc > body
The body of function.
Definition doc.h:1220
ffi::Array< Doc > type_params
The PEP 695 type parameters of the function.
Definition doc.h:1228
IdDoc name
The name of function.
Definition doc.h:1206
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.FunctionDoc", FunctionDocObj, StmtDocObj)
ffi::Array< ExprDoc > decorators
Decorators of function.
Definition doc.h:1216
static void RegisterReflection()
Definition doc.h:1230
ffi::Array< AssignDoc > args
The arguments of function.
Definition doc.h:1214
ffi::Optional< ExprDoc > return_type
The return type of function.
Definition doc.h:1218
Reference type of FunctionDocObj.
Definition doc.h:1248
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.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(FunctionDoc, StmtDoc, FunctionDocObj)
Doc that represents identifier.
Definition doc.h:370
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IdDoc", IdDocObj, ExprDocObj)
ffi::String name
The name of the identifier.
Definition doc.h:373
static void RegisterReflection()
Definition doc.h:375
Reference type of IdDocObj.
Definition doc.h:387
IdDoc(std::nullptr_t)
Definition doc.h:394
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IdDoc, ExprDoc, IdDocObj)
TVM_TIRX_DLL IdDoc(ffi::String name)
Constructor of IdDoc.
Doc that represent if-then-else statement.
Definition doc.h:861
ffi::Optional< ffi::Array< StmtDoc > > else_branch
The optional else branch; an empty array represents a present empty branch.
Definition doc.h:868
static void RegisterReflection()
Definition doc.h:870
ExprDoc predicate
The predicate of the if-then-else statement.
Definition doc.h:864
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IfDoc", IfDocObj, StmtDocObj)
ffi::Array< StmtDoc > then_branch
The then branch of the if-then-else statement.
Definition doc.h:866
Reference type of IfDocObj.
Definition doc.h:885
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IfDoc, StmtDoc, IfDocObj)
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:440
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.IndexDoc", IndexDocObj, ExprDocObj)
ExprDoc value
The container value to be accessed.
Definition doc.h:443
static void RegisterReflection()
Definition doc.h:453
ffi::Array< Doc > indices
The indices to access.
Definition doc.h:451
Reference type of IndexDocObj.
Definition doc.h:467
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IndexDoc, ExprDoc, IndexDocObj)
TVM_TIRX_DLL IndexDoc(ExprDoc value, ffi::Array< Doc > indices)
Constructor of IndexDoc.
Doc that represents anonymous function.
Definition doc.h:616
ExprDoc body
The body of this anonymous function.
Definition doc.h:621
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.LambdaDoc", LambdaDocObj, ExprDocObj)
ffi::Array< IdDoc > args
The arguments of this anonymous function.
Definition doc.h:619
static void RegisterReflection()
Definition doc.h:623
Reference type of LambdaDocObj.
Definition doc.h:637
TVM_TIRX_DLL LambdaDoc(ffi::Array< IdDoc > args, ExprDoc body)
Constructor of LambdaDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(LambdaDoc, ExprDoc, LambdaDocObj)
Doc that represents list literal.
Definition doc.h:689
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ListDoc", ListDocObj, ExprDocObj)
ffi::Array< ExprDoc > elements
Elements of list.
Definition doc.h:692
static void RegisterReflection()
Definition doc.h:694
Reference type of ListDocObj.
Definition doc.h:706
TVM_TIRX_DLL ListDoc(ffi::Array< ExprDoc > elements)
Constructor of ListDoc.
ListDoc()
Create an empty ListDoc.
Definition doc.h:711
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ListDoc, ExprDoc, ListDocObj)
Doc that represents literal value.
Definition doc.h:228
static void RegisterReflection()
Definition doc.h:241
ffi::Any value
the internal representation of the literal value.
Definition doc.h:239
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.LiteralDoc", LiteralDocObj, ExprDocObj)
Reference type of LiteralDocObj.
Definition doc.h:253
static LiteralDoc DataType(DLDataType v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent string.
Definition doc.h:312
static LiteralDoc Boolean(bool v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent boolean.
Definition doc.h:288
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(LiteralDoc, ExprDoc, LiteralDocObj)
static LiteralDoc Device(const DLDevice &v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent device.
Definition doc.h:322
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:280
static LiteralDoc Int(int64_t v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent integer.
Definition doc.h:270
static LiteralDoc Float(double v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent float.
Definition doc.h:296
static LiteralDoc None(const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent None/null/empty value.
Definition doc.h:262
static LiteralDoc Str(const ffi::String &v, const ffi::Optional< AccessPath > &p)
Create a LiteralDoc to represent string.
Definition doc.h:304
A reference to a canonical script namespace.
Definition doc.h:1363
ffi::String canonical_name
The namespace name before alias resolution.
Definition doc.h:1366
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.NamespaceDoc", NamespaceDocObj, ExprDocObj)
static void RegisterReflection()
Definition doc.h:1368
An owning reference to a deferred script namespace.
Definition doc.h:1378
TVM_TIRX_DLL NamespaceDoc(ffi::String canonical_name)
Construct a deferred namespace reference.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(NamespaceDoc, ExprDoc, NamespaceDocObj)
Doc that represents operation.
Definition doc.h:537
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.OperationDoc", OperationDocObj, ExprDocObj)
ffi::Array< ExprDoc > operands
Operands of this expression.
Definition doc.h:581
Kind kind
The kind of operation (operator)
Definition doc.h:579
static void RegisterReflection()
Definition doc.h:583
Reference type of OperationDocObj.
Definition doc.h:597
TVM_TIRX_DLL OperationDoc(OperationDocObj::Kind kind, ffi::Array< ExprDoc > operands)
Constructor of OperationDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(OperationDoc, ExprDoc, OperationDocObj)
Doc that represents return statement.
Definition doc.h:1171
static void RegisterReflection()
Definition doc.h:1176
ExprDoc value
The value to return.
Definition doc.h:1174
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ReturnDoc", ReturnDocObj, StmtDocObj)
Reference type of ReturnDocObj.
Definition doc.h:1188
TVM_TIRX_DLL ReturnDoc(ExprDoc value)
Constructor of ReturnDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ReturnDoc, StmtDoc, ReturnDocObj)
Doc that represents special scopes.
Definition doc.h:1048
static void RegisterReflection()
Definition doc.h:1059
ffi::Optional< ExprDoc > lhs
The name of the scoped variable.
Definition doc.h:1051
ffi::Array< StmtDoc > body
The body of the scope doc.
Definition doc.h:1055
bool allow_concise_scoping
Whether a tail-position renderer may spell this scope concisely.
Definition doc.h:1057
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.ScopeDoc", ScopeDocObj, StmtDocObj)
ExprDoc rhs
The value of the scoped variable.
Definition doc.h:1053
Reference type of ScopeDocObj.
Definition doc.h:1075
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ScopeDoc, StmtDoc, ScopeDocObj)
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:773
ffi::Optional< ExprDoc > stop
The exclusive end of slice.
Definition doc.h:778
ffi::Optional< ExprDoc > start
The start of slice.
Definition doc.h:776
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.SliceDoc", SliceDocObj, DocObj)
ffi::Optional< ExprDoc > step
The step of slice.
Definition doc.h:780
static void RegisterReflection()
Definition doc.h:782
Reference type of SliceDocObj.
Definition doc.h:797
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(SliceDoc, Doc, SliceDocObj)
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:197
ffi::Array< StmtDoc > stmts
The list of statements.
Definition doc.h:200
static void RegisterReflection()
Definition doc.h:202
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.StmtBlockDoc", StmtBlockDocObj, DocObj)
Reference type of StmtBlockDocObj.
Definition doc.h:213
TVM_TIRX_DLL StmtBlockDoc(ffi::Array< StmtDoc > stmts)
Constructor of StmtBlockDoc.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(StmtBlockDoc, Doc, StmtBlockDocObj)
The base class of statement doc.
Definition doc.h:159
ffi::Optional< ffi::String > comment
The comment of this doc.
Definition doc.h:169
static void RegisterReflection()
Definition doc.h:171
TVM_FFI_DECLARE_OBJECT_INFO("script.printer.StmtDoc", StmtDocObj, DocObj)
Reference type of StmtDocObj.
Definition doc.h:183
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(StmtDoc, Doc, StmtDocObj)
Doc that represents tuple literal.
Definition doc.h:653
static void RegisterReflection()
Definition doc.h:658
ffi::Array< ExprDoc > elements
Elements of tuple.
Definition doc.h:656
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.TupleDoc", TupleDocObj, ExprDocObj)
Reference type of TupleDocObj.
Definition doc.h:670
TVM_TIRX_DLL TupleDoc(ffi::Array< ExprDoc > elements)
Constructor of TupleDoc.
TupleDoc()
Create an empty TupleDoc.
Definition doc.h:675
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(TupleDoc, ExprDoc, TupleDocObj)
Doc that represents while statement.
Definition doc.h:903
ffi::Array< StmtDoc > body
The body of the while statement.
Definition doc.h:908
static void RegisterReflection()
Definition doc.h:910
ExprDoc predicate
The predicate of the while statement.
Definition doc.h:906
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.printer.WhileDoc", WhileDocObj, StmtDocObj)
Reference type of WhileDocObj.
Definition doc.h:924
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(WhileDoc, StmtDoc, WhileDocObj)
TVM_TIRX_DLL WhileDoc(ExprDoc predicate, ffi::Array< StmtDoc > body)
Constructor of WhileDoc.
Abstract device memory management API.
std::ostream & operator<<(std::ostream &os, DLDevice dev)
Definition device_api.h:322
ffi::reflection::AccessPath AccessPath
Definition doc.h:39
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analysis.h:41