ONE - On-device Neural Engine
Loading...
Searching...
No Matches
InstrBuilder Class Reference

#include <IRBuilder.h>

Public Member Functions

 InstrBuilder (coco::Module *module)
 
coco::Evaleval (coco::Object *out, coco::Op *op) const
 Create "Eval" instruction with a given "Object" and "Op".
 
 InstrBuilder (coco::Module *module)
 
coco::Evaleval (coco::Object *out, coco::Op *op) const
 Create "Eval" instruction with a given "Object" and "Op".
 
coco::Copycopy (coco::Object *into, coco::Object *from) const
 Create "Copy" instruction with given two "Object".
 

Detailed Description

Definition at line 147 of file IRBuilder.h.

Constructor & Destructor Documentation

◆ InstrBuilder() [1/2]

InstrBuilder::InstrBuilder ( coco::Module module)
inline

Definition at line 150 of file IRBuilder.h.

150 : _module{module}
151 {
152 // NOTE _module SHOULD be valid
153 assert(_module != nullptr);
154 }

◆ InstrBuilder() [2/2]

InstrBuilder::InstrBuilder ( coco::Module module)
inline

Definition at line 136 of file IRBuilder.h.

136 : _module{module}
137 {
138 // NOTE _module SHOULD be valid
139 assert(_module != nullptr);
140 }

Member Function Documentation

◆ copy()

coco::Copy * InstrBuilder::copy ( coco::Object into,
coco::Object from 
) const
inline

Create "Copy" instruction with given two "Object".

Note
"copy(into, from)" will create "%into <- Copy(%from)" instruction

Definition at line 161 of file IRBuilder.h.

162 {
163 auto ins = _module->entity()->instr()->create<coco::Copy>();
164 ins->from(from);
165 ins->into(into);
166 return ins;
167 }
Index-wise element transfer between two objects.
Definition Instrs.h:85
Object * from(void) const
Definition Instrs.h:100
Ins * create(void)
virtual EntityManager * entity(void)=0
virtual InstrManager * instr(void)=0

References coco::InstrManager::create(), coco::Module::entity(), coco::Copy::from(), and coco::EntityManager::instr().

Referenced by tflimport::ConcatenationGraphBuilder::build(), tflimport::Conv2DGraphBuilder::build(), tflimport::DepthwiseConv2DGraphBuilder::build(), and tflimport::build_activation().

◆ eval() [1/2]

◆ eval() [2/2]

coco::Eval * InstrBuilder::eval ( coco::Object out,
coco::Op op 
) const
inline

Create "Eval" instruction with a given "Object" and "Op".

Note
"eval(out, op)" will create "%out <- Eval(op)" instruction

Definition at line 148 of file IRBuilder.h.

149 {
150 auto ins = _module->entity()->instr()->create<coco::Eval>();
151 ins->op(op);
152 ins->out(out);
153 return ins;
154 }

References coco::InstrManager::create(), coco::Module::entity(), coco::EntityManager::instr(), and coco::Eval::op().


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