tvm
Classes | Namespaces | Macros | Functions
printer.h File Reference

Entry-point header for TVMScript printing. More...

#include <tvm/ir/node_functor.h>
#include <tvm/script/printer/config.h>
Include dependency graph for printer.h:

Go to the source code of this file.

Classes

class  tvm::TVMScriptPrinter
 Dispatch vtable used by per-dialect printers to register their object-type printing functions. Internal, but exposed here because TVM_REGISTER_SCRIPT_AS_REPR refers to it. More...
 

Namespaces

 tvm
 An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
 

Macros

#define TVM_REGISTER_SCRIPT_AS_REPR(ObjectType, Method)
 Register Script as the kRepr callback for ObjectType and install the per-type dispatch entry in TVMScriptPrinter::vtable(). More...
 

Functions

std::string tvm::Script (const ffi::ObjectRef &node, const ffi::Optional< PrinterConfig > &config=std::nullopt)
 Print node as TVMScript with the given config. More...
 

Detailed Description

Entry-point header for TVMScript printing.

Declares the free function tvm::Script(node, optional_config) and the dispatch vtable TVMScriptPrinter::vtable() used by per-dialect printers. PrinterConfig and its dataclass helpers live in config.h; this header is what callers include to invoke printing.

Macro Definition Documentation

◆ TVM_REGISTER_SCRIPT_AS_REPR

#define TVM_REGISTER_SCRIPT_AS_REPR (   ObjectType,
  Method 
)
Value:
TVM_FFI_STATIC_INIT_BLOCK() { \
namespace refl = tvm::ffi::reflection; \
refl::TypeAttrDef<ObjectType>().def(refl::type_attr::kRepr, \
[](ffi::ObjectRef obj, ffi::Function) -> ffi::String { \
}); \
} \
TVM_STATIC_IR_FUNCTOR(TVMScriptPrinter, vtable).set_dispatch<ObjectType>(Method)
tvm::relax::Function Function
Definition: transform.h:38
AnyType ObjectType
Definition: type.h:117
std::string RedirectedReprPrinterMethod(const ffi::ObjectRef &obj)
The fallback body used by TVM_REGISTER_SCRIPT_AS_REPR (defined in printer.h).

Register Script as the kRepr callback for ObjectType and install the per-type dispatch entry in TVMScriptPrinter::vtable().

Parameters
ObjectTypeThe concrete object node type (e.g. tirx::VarNode).
MethodThe TVMScriptPrinter vtable dispatch function.