tvm
Public Member Functions | Static Public Member Functions | List of all members
tvm::script::ir_builder::IRBuilder Class Reference

Managed reference to an IRBuilderNode. More...

#include <base.h>

Inheritance diagram for tvm::script::ir_builder::IRBuilder:
Collaboration diagram for tvm::script::ir_builder::IRBuilder:

Public Member Functions

 IRBuilder ()
 Creates an IRBuilder. More...
 
 TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS (IRBuilder, ObjectRef, IRBuilderNode)
 
void EnterWithScope ()
 Puts the current IRBuilder into a thread-local scope, which can be retrieved using IRBuilder::Current(). More...
 
void ExitWithScope ()
 Exit the RAII scope. More...
 
- Public Member Functions inherited from tvm::runtime::ObjectRef
 ObjectRef ()=default
 default constructor More...
 
 ObjectRef (ObjectPtr< Object > data)
 Constructor from existing object ptr. More...
 
bool same_as (const ObjectRef &other) const
 Comparator. More...
 
bool operator== (const ObjectRef &other) const
 Comparator. More...
 
bool operator!= (const ObjectRef &other) const
 Comparator. More...
 
bool operator< (const ObjectRef &other) const
 Comparator. More...
 
bool defined () const
 
const Objectget () const
 
const Objectoperator-> () const
 
bool unique () const
 
int use_count () const
 
template<typename ObjectType , typename = std::enable_if_t<std::is_base_of_v<Object, ObjectType>>>
const ObjectType * as () const
 Try to downcast the internal Object to a raw pointer of a corresponding type. More...
 
template<typename ObjectRefType , typename = std::enable_if_t<std::is_base_of_v<ObjectRef, ObjectRefType>>>
Optional< ObjectRefType > as () const
 Try to downcast the ObjectRef to a Optional<T> of the requested type. More...
 

Static Public Member Functions

static IRBuilder Current ()
 Get the current IRBuilder in the current thread-local scope. More...
 
static bool IsInScope ()
 See if the current thread-local scope has an IRBuilder. More...
 
template<class TObjectRef >
static TObjectRef Name (String name, TObjectRef obj)
 Give a string name to the obj More...
 

Additional Inherited Members

- Public Types inherited from tvm::runtime::ObjectRef
using ContainerType = Object
 type indicate the container type. More...
 
- Static Public Attributes inherited from tvm::runtime::ObjectRef
static constexpr bool _type_is_nullable = true
 
- Protected Member Functions inherited from tvm::runtime::ObjectRef
Objectget_mutable () const
 
- Static Protected Member Functions inherited from tvm::runtime::ObjectRef
template<typename T >
static T DowncastNoCheck (ObjectRef ref)
 Internal helper function downcast a ref without check. More...
 
static void FFIClearAfterMove (ObjectRef *ref)
 Clear the object ref data field without DecRef after we successfully moved the field. More...
 
template<typename ObjectType >
static ObjectPtr< ObjectType > GetDataPtr (const ObjectRef &ref)
 Internal helper function get data_ as ObjectPtr of ObjectType. More...
 
- Protected Attributes inherited from tvm::runtime::ObjectRef
ObjectPtr< Objectdata_
 Internal pointer that backs the reference. More...
 

Detailed Description

Managed reference to an IRBuilderNode.

See also
IRBuilderNode

Constructor & Destructor Documentation

◆ IRBuilder()

tvm::script::ir_builder::IRBuilder::IRBuilder ( )

Member Function Documentation

◆ Current()

static IRBuilder tvm::script::ir_builder::IRBuilder::Current ( )
static

Get the current IRBuilder in the current thread-local scope.

Returns
The current IRBuilder.
See also
IRBuilder::EnterWithScope
IRBuilder::ExitWithScope
tvm::support::With
Examples
/workspace/include/tvm/script/ir_builder/base.h.

◆ EnterWithScope()

void tvm::script::ir_builder::IRBuilder::EnterWithScope ( )

Puts the current IRBuilder into a thread-local scope, which can be retrieved using IRBuilder::Current().

IRBuilder builder;
{
With<IRBuilder> _(builder);
// IRBuilder::Current() == builder
}
// IRBuilder::Current() == nullptr
IRBuilder()
Creates an IRBuilder.
See also
IRBuilder::Current
IRBuilder::ExitWithScope
tvm::support::With
Examples
/workspace/include/tvm/script/ir_builder/base.h.

◆ ExitWithScope()

void tvm::script::ir_builder::IRBuilder::ExitWithScope ( )

Exit the RAII scope.

See also
IRBuilder::EnterWithScope
IRBuilder::Current
tvm::support::With
Examples
/workspace/include/tvm/script/ir_builder/base.h.

◆ IsInScope()

static bool tvm::script::ir_builder::IRBuilder::IsInScope ( )
static

See if the current thread-local scope has an IRBuilder.

Examples
/workspace/include/tvm/script/ir_builder/base.h.

◆ Name()

template<class TObjectRef >
TObjectRef tvm::script::ir_builder::IRBuilder::Name ( String  name,
TObjectRef  obj 
)
inlinestatic

Give a string name to the obj

Template Parameters
TObjectRefThe type of the object to name.
Parameters
nameThe name to give to the object.
objThe object to name.
Examples
/workspace/include/tvm/script/ir_builder/base.h.

◆ TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS()

tvm::script::ir_builder::IRBuilder::TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS ( IRBuilder  ,
ObjectRef  ,
IRBuilderNode   
)

The documentation for this class was generated from the following file: