23#ifndef TVM_SCRIPT_PRINTER_SUPPORT_H_
24#define TVM_SCRIPT_PRINTER_SUPPORT_H_
26#include <tvm/ffi/extra/dataclass.h>
27#include <tvm/ffi/extra/visit_error_context.h>
28#include <tvm/ffi/reflection/registry.h>
53 const ffi::ObjectRef& root);
56template <
typename ObjectType>
58 namespace refl = ffi::reflection;
59 refl::TypeAttrDef<ObjectType>()
60 .def(ffi::type_attr::kRepr.name,
61 [](ffi::ObjectRef obj, ffi::Function) -> ffi::String {
64 .def(ffi::type_attr::kEnrichVisitError.name, [](ffi::Error error, ffi::ObjectRef root) {
89 const ffi::Object* destination);
108 ffi::Optional<ffi::Array<ExprDoc>> translated_args = std::nullopt);
#define TVM_TIRX_DLL
Definition base.h:55
Call corresponds to callable invocation.
Definition expr.h:788
Managed reference to VarObj.
Definition expr.h:571
Eager translation context shared by registered hooks. Hooks construct Docs, use explicit lexical scop...
Definition doc_translator.h:124
Reference type of ExprDocObj.
Definition doc.h:135
Reference type of IdDocObj.
Definition doc.h:387
Configuration object for the TVMScript printer.
Translator from IR values to printer docs.
TVM_TIRX_DLL IdDoc VarDoc(DocTranslatorObj *d, const Var &var, bool explicit_def=true)
Allocate or retrieve a variable identifier and record its origin.
TVM_TIRX_DLL ffi::Optional< ExprDoc > StandardCallDocTranslate(DocTranslatorObj *d, const CallObj *call)
Translate named Op-call syntax, falling back to an explicit call as needed.
TVM_TIRX_DLL ffi::Optional< ExprDoc > VarDocTranslate(DocTranslatorObj *d, ffi::AnyView input, const ffi::Object *destination)
Translate a Var using the normal translation-hook signature.
void RegisterScriptRepr()
Register TVMScript repr and visit-error rendering for ObjectType.
Definition support.h:57
TVM_TIRX_DLL ExprDoc AddMetadata(DocTranslatorObj *d, ffi::Any value)
Store a non-null value in the initialized metadata table.
TVM_TIRX_DLL ffi::String RedirectReprPrinterMethod(const ffi::ObjectRef &obj)
Render an IR object for its registered repr callback.
TVM_TIRX_DLL ffi::Error RedirectVisitErrorEnrichMethod(const ffi::Error &error, const ffi::ObjectRef &root)
Render visit-error context through the shared IR error renderer.
TVM_TIRX_DLL ExprDoc RawCallDocTranslate(DocTranslatorObj *d, const CallObj *call, ffi::Optional< ffi::Array< ExprDoc > > translated_args=std::nullopt)
Emit an explicit Call constructor preserving all call fields.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analysis.h:41