SeExpr

Public Member Functions | Private Attributes | List of all members
SeExpr2::ExprLocalFunctionNode Class Reference

Node that contains local function. More...

`#include <ExprNode.h>`

Inheritance diagram for SeExpr2::ExprLocalFunctionNode:

## Public Member Functions
| ExprLocalFunctionNode (const Expression *expr, ExprPrototypeNode *prototype, ExprNode *block)
virtual ExprType | prep (bool wantScalar, ExprVarEnvBuilder &envBuilder)
| Preps the definition of this site. More...
virtual ExprType | prep (ExprFuncNode *callerNode, bool scalarWanted, ExprVarEnvBuilder &envBuilder) const
| Preps a caller (i.e. we use callerNode to check arguments) More...
const ExprPrototypeNode * | prototype () const
| TODO: Accessor for prototype (probably not needed when we use prep right) More...
int | buildInterpreter (Interpreter *interpreter) const
| Build the interpreter. More...
int | buildInterpreterForCall (const ExprFuncNode *callerNode, Interpreter *interpreter) const
| Build interpreter if we are called. More...
virtual LLVM_VALUE | codegen (LLVM_BUILDER) LLVM_BODY
Public Member Functions inherited from SeExpr2::ExprNode
| ExprNode (const Expression *expr)
| ExprNode (const Expression *expr, const ExprType &type)
virtual | ~ExprNode ()
bool | isVec () const
| True if node has a vector result. More...
const Expression * | expr () const
| Access expression. More...
std::string | toString () const
| Access to original string representation of current expression. More...
const ExprType & | type () const
| The type of the node. More...
void | addError (const std::string &error) const
| Register error. This will allow users and sophisticated editors to highlight where in code problem was. More...
| ExprNode (const Expression *expr, ExprNode *a)
| ExprNode (const Expression *expr, ExprNode *a, const ExprType &type)
| ExprNode (const Expression *expr, ExprNode *a, ExprNode *b)
| ExprNode (const Expression *expr, ExprNode *a, ExprNode *b, const ExprType &type)
| ExprNode (const Expression *expr, ExprNode *a, ExprNode *b, ExprNode *c)
| ExprNode (const Expression *expr, ExprNode *a, ExprNode *b, ExprNode *c, const ExprType &type)
const ExprNode * | parent () const
| Access parent node - root node has no parent. More...
int | numChildren () const
| Number of children. More...
const ExprNode * | child (size_t i) const
| Get 0 indexed child. More...
ExprNode * | child (size_t i)
| Get 0 indexed child. More...
void | swapChildren (size_t i, size_t j)
| Swap children, do not use unless you know what you are doing. More...
void | removeLastChild ()
| Remove last child and delete the entry. More...
void | addChild (ExprNode *child)
| Add a child to the child list (for parser use only) More...
void | addChildren (ExprNode *surrogate)
| Transfer children from surrogate parent (for parser use only) More...
void | setPosition (const short int startPos, const short int endPos)
| Remember the line and column position in the input string. More...
short int | startPos () const
| Access start position in input string. More...
short int | endPos () const
| Access end position in input string. More...
short int | length () const
| Access length of input string. More...
bool | checkCondition (bool check, const std::string &message, bool &error)
| Checks the boolean value and records an error string with node if it is false. More...
bool | checkIsValue (const ExprType &type, bool &error)
| Checks if the type is a value (i.e. string or float[d]) More...
bool | checkIsFP (const ExprType &type, bool &error)
| Checks if the type is a float[d] for any d. More...
bool | checkIsFP (int d, const ExprType &type, bool &error)
| Checks if the type is a float[d] for a specific d. More...
bool | checkTypesCompatible (const ExprType &first, const ExprType &second, bool &error)
| types match (true if they do) More...

## Private Attributes
int | _procedurePC
int | _returnedDataOp

## Additional Inherited Members
Protected Member Functions inherited from SeExpr2::ExprNode
void | setType (const ExprType &t)
| Set type of parameter. More...
void | setTypeWithChildLife (const ExprType &t)
| Set's the type to the argument but uses the children to determine lifetime. More...
Protected Attributes inherited from SeExpr2::ExprNode
const Expression * | _expr
| Owning expression (node can't modify) More...
ExprNode * | _parent
| Parent node (null if this the the root) More...
std::vector< ExprNode * > | _children
| List of children. More...
bool | _isVec
| True if node has a vector result. More...
ExprType | _type
int | _maxChildDim
unsigned short int | _startPos
| Position line and collumn. More...
unsigned short int | _endPos

## Detailed Description

Node that contains local function.

Definition at line 307 of file ExprNode.h.

## Constructor & Destructor Documentation

## ◆ ExprLocalFunctionNode()

SeExpr2::ExprLocalFunctionNode::ExprLocalFunctionNode | ( | const Expression * | expr,
|  | ExprPrototypeNode * | prototype,
|  | ExprNode * | block
| ) |  |
| inline

Definition at line 309 of file ExprNode.h.

## Member Function Documentation

## ◆ buildInterpreter()

int SeExpr2::ExprLocalFunctionNode::buildInterpreter | ( | Interpreter * | interpreter | ) | const
| virtual

Build the interpreter.

Reimplemented from SeExpr2::ExprNode.

Definition at line 472 of file Interpreter.cpp.

References _procedurePC, _returnedDataOp, SeExpr2::Interpreter::addOp(), SeExpr2::Interpreter::addOperand(), SeExpr2::ExprNode::buildInterpreter(), SeExpr2::ExprNode::child(), SeExpr2::Interpreter::endOp(), SeExpr2::Interpreter::nextPC(), and SeExpr2::ExprNode::numChildren().

## ◆ buildInterpreterForCall()

int SeExpr2::ExprLocalFunctionNode::buildInterpreterForCall | ( | const ExprFuncNode * | callerNode,
|  | Interpreter * | interpreter
| ) |  | const

Build interpreter if we are called.

Definition at line 487 of file Interpreter.cpp.

References _procedurePC, _returnedDataOp, SeExpr2::Interpreter::addOp(), SeExpr2::Interpreter::addOperand(), SeExpr2::Interpreter::allocFP(), SeExpr2::Interpreter::allocPtr(), SeExpr2::ExprNode::buildInterpreter(), SeExpr2::ExprNode::child(), SeExpr2::ExprType::dim(), SeExpr2::Interpreter::endOp(), SeExpr2::ExprType::isFP(), SeExpr2::ExprType::isString(), SeExpr2::Interpreter::nextPC(), SeExpr2::ExprNode::numChildren(), SeExpr2::Interpreter::opData, SeExpr2::ExprFuncNode::promote(), prototype(), and SeExpr2::ExprNode::type().

Referenced by SeExpr2::ExprFuncNode::buildInterpreter().

## ◆ codegen()

virtual LLVM_VALUE SeExpr2::ExprLocalFunctionNode::codegen | ( | LLVM_BUILDER |  | ) |
| virtual

Reimplemented from SeExpr2::ExprNode.

## ◆ prep() [1/2]

ExprType SeExpr2::ExprLocalFunctionNode::prep | ( | bool | wantScalar,
|  | ExprVarEnvBuilder & | envBuilder
| ) |  |
| virtual

Preps the definition of this site.

Reimplemented from SeExpr2::ExprNode.

Definition at line 188 of file ExprNode.cpp.

References SeExpr2::ExprNode::_type, SeExpr2::ExprNode::checkCondition(), SeExpr2::ExprNode::child(), SeExpr2::ExprType::isFP(), SeExpr2::ExprPrototypeNode::isReturnTypeSet(), SeExpr2::ExprType::isValid(), SeExpr2::ExprPrototypeNode::name(), SeExpr2::ExprNode::prep(), SeExpr2::ExprPrototypeNode::prep(), prototype(), SeExpr2::ExprVarEnv::resetAndSetParent(), SeExpr2::ExprPrototypeNode::returnType(), SeExpr2::ExprPrototypeNode::setReturnType(), SeExpr2::ExprNode::setType(), and SeExpr2::ExprType::toString().

## ◆ prep() [2/2]

ExprType SeExpr2::ExprLocalFunctionNode::prep | ( | ExprFuncNode * | callerNode,
|  | bool | scalarWanted,
|  | ExprVarEnvBuilder & | envBuilder
| ) |  | const
| virtual

Preps a caller (i.e. we use callerNode to check arguments)

Definition at line 238 of file ExprNode.cpp.

References SeExpr2::ExprFuncNode::checkArg(), SeExpr2::ExprNode::checkCondition(), SeExpr2::ExprType::Error(), SeExpr2::ExprNode::numChildren(), prototype(), and SeExpr2::ExprPrototypeNode::returnType().

## ◆ prototype()

const ExprPrototypeNode* SeExpr2::ExprLocalFunctionNode::prototype | ( |  | ) | const
| inline

TODO: Accessor for prototype (probably not needed when we use prep right)

Definition at line 317 of file ExprNode.h.

References SeExpr2::ExprNode::child().

Referenced by buildInterpreterForCall(), and prep().

## Member Data Documentation

## ◆ _procedurePC

int SeExpr2::ExprLocalFunctionNode::_procedurePC
| mutable private

Definition at line 326 of file ExprNode.h.

Referenced by buildInterpreter(), and buildInterpreterForCall().

## ◆ _returnedDataOp

int SeExpr2::ExprLocalFunctionNode::_returnedDataOp
| mutable private

Definition at line 327 of file ExprNode.h.

Referenced by buildInterpreter(), and buildInterpreterForCall().

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

- /build/seexpr/src/SeExpr/src/SeExpr2/ExprNode.h
- /build/seexpr/src/SeExpr/src/SeExpr2/ExprNode.cpp
- /build/seexpr/src/SeExpr/src/SeExpr2/Interpreter.cpp