|
ONE - On-device Neural Engine
|
Represents a block of instructions. More...
#include <ArtifactModel.h>

Public Member Functions | |
| bool | isBlock () const override |
| If this entity represents something containing a block of instructions. | |
| void | accept (IArtifactGenerator *g) const override |
| This is the core function of each artifact entity and is implemented by all concrete classes in the hierarchy. | |
| void | addStatement (const std::shared_ptr< ArtifactEntity > &statement) |
| const std::list< std::shared_ptr< ArtifactEntity > > & | getStatements () const |
| std::shared_ptr< ArtifactVariable > | var (const std::string &type_name, const std::string &var_name, const std::list< std::shared_ptr< ArtifactExpr > > &dimensions={}, const std::list< std::shared_ptr< ArtifactExpr > > &initializers={}) |
| Creates a new variable and place it to the block. | |
| std::shared_ptr< ArtifactFunctionCall > | call (const std::string &func_name, const std::list< std::shared_ptr< ArtifactExpr > > ¶m_list, std::shared_ptr< ArtifactExpr > call_on=nullptr, ArtifactCallType call_type=ArtifactCallType::obj) |
| Creates a function call. | |
| std::shared_ptr< ArtifactRet > | ret (std::shared_ptr< ArtifactExpr > expr) |
| Creates a return from function statement. | |
| std::shared_ptr< ArtifactBreak > | brk () |
| Creates a break from a loop instruction. | |
| std::shared_ptr< ArtifactCont > | cont () |
| Creates a continue in a loop instruction. | |
| std::shared_ptr< ArtifactForLoop > | forLoop (std::shared_ptr< ArtifactVariable > init=nullptr, std::shared_ptr< ArtifactExpr > cond=nullptr, std::shared_ptr< ArtifactExpr > iter=nullptr) |
| Creates a for loop instruction. | |
| std::shared_ptr< ArtifactIf > | ifCond (std::shared_ptr< ArtifactExpr > cond) |
| Creates an 'if' blocks. | |
| std::shared_ptr< ArtifactUnaryExpr > | un (ArtifactUnOp op, std::shared_ptr< ArtifactExpr > expr) |
| Creates an unary operation expression. | |
| std::shared_ptr< ArtifactBinaryExpr > | bin (ArtifactBinOp op, std::shared_ptr< ArtifactExpr > left, std::shared_ptr< ArtifactExpr > right) |
| Creates a binary operation expression. | |
| std::shared_ptr< ArtifactUnaryExpr > | heapNew (std::shared_ptr< ArtifactExpr > expr) |
| Creates a heap new operation expression. | |
| std::shared_ptr< ArtifactUnaryExpr > | heapFree (std::shared_ptr< ArtifactExpr > expr) |
| Creates a heap free operation expression. | |
Public Member Functions inherited from nnc::ArtifactEntity | |
| virtual | ~ArtifactEntity ()=default |
Additional Inherited Members | |
Protected Member Functions inherited from nnc::ArtifactEntity | |
| ArtifactEntity ()=default | |
Represents a block of instructions.
Definition at line 352 of file ArtifactModel.h.
|
inlineoverridevirtual |
This is the core function of each artifact entity and is implemented by all concrete classes in the hierarchy.
Implements nnc::ArtifactEntity.
Definition at line 357 of file ArtifactModel.h.
Referenced by TEST(), nnc::ArtifactGeneratorCppCode::visit(), nnc::ArtifactGeneratorCppCode::visit(), nnc::ArtifactGeneratorCppCode::visit(), and nnc::ArtifactGeneratorCppCode::visit().
|
inline |
Definition at line 359 of file ArtifactModel.h.
| shared_ptr< ArtifactBinaryExpr > nnc::ArtifactBlock::bin | ( | ArtifactBinOp | op, |
| std::shared_ptr< ArtifactExpr > | left, | ||
| std::shared_ptr< ArtifactExpr > | right | ||
| ) |
Creates a binary operation expression.
| op | |
| left | |
| right |
Definition at line 97 of file ArtifactModel.cpp.
References bin().
Referenced by bin().
| shared_ptr< ArtifactBreak > nnc::ArtifactBlock::brk | ( | ) |
Creates a break from a loop instruction.
Definition at line 60 of file ArtifactModel.cpp.
References brk().
Referenced by brk().
| shared_ptr< ArtifactFunctionCall > nnc::ArtifactBlock::call | ( | const std::string & | func_name, |
| const std::list< std::shared_ptr< ArtifactExpr > > & | param_list, | ||
| std::shared_ptr< ArtifactExpr > | call_on = nullptr, |
||
| ArtifactCallType | call_type = ArtifactCallType::obj |
||
| ) |
Creates a function call.
| func_name | - the function name. |
| param_list | - the parameters which are used for the call. |
| call_on | - optional object on which the function is called (if it is a member function). |
| call_type | - (for member functions only) call through: '.', '->', or '::'. |
Definition at line 45 of file ArtifactModel.cpp.
Referenced by nnc::AclCppOpGenerator::generate(), and nnc::AclCppOpGenerator::visit().
| shared_ptr< ArtifactCont > nnc::ArtifactBlock::cont | ( | ) |
Creates a continue in a loop instruction.
Definition at line 67 of file ArtifactModel.cpp.
References cont().
Referenced by cont().
| shared_ptr< ArtifactForLoop > nnc::ArtifactBlock::forLoop | ( | std::shared_ptr< ArtifactVariable > | init = nullptr, |
| std::shared_ptr< ArtifactExpr > | cond = nullptr, |
||
| std::shared_ptr< ArtifactExpr > | iter = nullptr |
||
| ) |
Creates a for loop instruction.
| init | - initialize for loop. |
| cond | - condition to check for stay looping. |
| iter | - change when transiting to the next iteration. |
Definition at line 74 of file ArtifactModel.cpp.
|
inline |
Definition at line 364 of file ArtifactModel.h.
Referenced by nnc::ArtifactGeneratorCppCode::visit(), and nnc::ArtifactGeneratorCppCode::visit().
| shared_ptr< ArtifactUnaryExpr > nnc::ArtifactBlock::heapFree | ( | std::shared_ptr< ArtifactExpr > | expr | ) |
Creates a heap free operation expression.
| expr |
Definition at line 112 of file ArtifactModel.cpp.
References nnc::heapFree.
| shared_ptr< ArtifactUnaryExpr > nnc::ArtifactBlock::heapNew | ( | std::shared_ptr< ArtifactExpr > | expr | ) |
Creates a heap new operation expression.
| expr |
Definition at line 105 of file ArtifactModel.cpp.
References nnc::heapNew.
| shared_ptr< ArtifactIf > nnc::ArtifactBlock::ifCond | ( | std::shared_ptr< ArtifactExpr > | cond | ) |
Creates an 'if' blocks.
| cond | - condition expression |
Definition at line 83 of file ArtifactModel.cpp.
Referenced by nnc::AclCppOpGenerator::generate().
|
inlineoverridevirtual |
If this entity represents something containing a block of instructions.
Reimplemented from nnc::ArtifactEntity.
Definition at line 355 of file ArtifactModel.h.
| shared_ptr< ArtifactRet > nnc::ArtifactBlock::ret | ( | std::shared_ptr< ArtifactExpr > | expr | ) |
Creates a return from function statement.
| expr | - value to return in generated code. |
Definition at line 53 of file ArtifactModel.cpp.
References ret().
Referenced by ret().
| shared_ptr< ArtifactUnaryExpr > nnc::ArtifactBlock::un | ( | ArtifactUnOp | op, |
| std::shared_ptr< ArtifactExpr > | expr | ||
| ) |
Creates an unary operation expression.
| op | |
| expr |
Definition at line 90 of file ArtifactModel.cpp.
References un().
Referenced by un().
| shared_ptr< ArtifactVariable > nnc::ArtifactBlock::var | ( | const std::string & | type_name, |
| const std::string & | var_name, | ||
| const std::list< std::shared_ptr< ArtifactExpr > > & | dimensions = {}, |
||
| const std::list< std::shared_ptr< ArtifactExpr > > & | initializers = {} |
||
| ) |
Creates a new variable and place it to the block.
| type_name | - the variable type name. |
| var_name | - the varibale name. |
| dimensions | - optional dimensions, if the declared variable is an array. |
| initializers | - optional arguments of the object constructor. |
Definition at line 35 of file ArtifactModel.cpp.
References var().
Referenced by nnc::AclCppOpGenerator::genPadStrideInfo(), nnc::AclCppOpGenerator::genVectorInitializedVar(), var(), and nnc::AclCppOpGenerator::visit().