17#ifndef __IR_BUILDER_H__
18#define __IR_BUILDER_H__
34 assert(_module !=
nullptr);
41 bool empty(
void)
const {
return _stack.empty(); }
48 assert(_stack.size() > 0);
49 return _stack.front();
60 _stack.push_front(op);
118 assert(_stack.size() > 0);
119 auto op = _stack.front();
125 template <
typename ConcreteOp>
OpBuilder &binary()
127 assert(_stack.size() >= 2);
141 std::deque<coco::Op *> _stack;
153 assert(_module !=
nullptr);
OpBuilder op_builder(coco::Module *m)
InstrBuilder instr_builder(coco::Module *m)
InstrBuilder(coco::Module *module)
coco::Eval * eval(coco::Object *out, coco::Op *op) const
Create "Eval" instruction with a given "Object" and "Op".
OpBuilder & load(coco::Object *obj)
Create "Load" op and push it onto the internal stack.
coco::Op * top(void) const
Return the operation at the top of the internal stack.
OpBuilder & mul(void)
Create "Mul" op and push it onto the internal stack.
OpBuilder & sub(void)
Create "Sub" op and push it onto the internal stack.
OpBuilder & push(coco::Op *op)
Push op onto the internal stack.
coco::Op * pop(void)
Pop op from the internal stack.
OpBuilder & add(void)
Create "Add" op and push it onto the internal stack.
OpBuilder(coco::Module *module)
bool empty(void) const
Return true if the internal stack is empty.
OpBuilder & div(void)
Create "Div" op and push it onto the internal stack.
Evaluate an Object from a given Op.
Top-level element of coco IR which represents a neural network.
virtual EntityManager * entity(void)=0
Base interface on all typed NN values.
virtual OpManager * op(void)=0
virtual InstrManager * instr(void)=0
Base interface on all supported NN operations.