ONE - On-device Neural Engine
Loading...
Searching...
No Matches
coco::InstrManager Class Referencefinal

#include <InstrManager.h>

Collaboration diagram for coco::InstrManager:

Public Member Functions

 InstrManager (Module *m=nullptr)
 
template<typename Ins >
Ins * create (void)
 
void destroy (Instr *)
 Destroy (= deallocate) an Instr instance.
 
- Public Member Functions inherited from coco::PtrManager< Instr >
uint32_t size (void) const
 Return the number of managed objects.
 
Instrat (uint32_t n) const
 
- Public Member Functions inherited from coco::EntityBuilder
virtual ~EntityBuilder ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from coco::PtrManager< Instr >
U * take (std::unique_ptr< U > &&o)
 
std::unique_ptr< Instrrelease (Instr *ptr)
 
- Protected Member Functions inherited from coco::EntityBuilder
Modulemodule (void) const
 
void module (Module *m)
 
void modulize (Entity *entity) const
 

Detailed Description

Definition at line 36 of file InstrManager.h.

Constructor & Destructor Documentation

◆ InstrManager()

coco::InstrManager::InstrManager ( Module m = nullptr)
inline

Definition at line 39 of file InstrManager.h.

39{ module(m); }
Module * module(void) const

References m, and coco::EntityBuilder::module().

Member Function Documentation

◆ create()

template<typename Ins >
Ins * coco::InstrManager::create ( void  )

Definition at line 57 of file InstrManager.h.

58{
59 auto ins = new Ins;
60 modulize(ins);
61 return take(std::unique_ptr<Ins>(ins));
62}
void modulize(Entity *entity) const
U * take(std::unique_ptr< U > &&o)
Definition PtrManager.h:38

References coco::EntityBuilder::modulize(), and coco::PtrManager< Instr >::take().

Referenced by InstrBuilder::copy(), and InstrBuilder::eval().

◆ destroy()

void coco::InstrManager::destroy ( Instr ins)

Destroy (= deallocate) an Instr instance.

NOTE destroy(ins) WILL NOT update ins->parent(). An Instruction SHOULD BE detacted from a module before destroy call

Definition at line 26 of file InstrManager.cpp.

27{
28 // ins SHOULD BE detached from any block before destroy call
29 assert(ins->parent() == nullptr);
30 release(ins);
31}
std::unique_ptr< Instr > release(Instr *ptr)
Definition PtrManager.h:46

References coco::DLinkedList< Child, Parent >::Node::parent(), and coco::PtrManager< Instr >::release().


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