SeExpr

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

Node that contains prototype of function. More...

`#include <ExprNode.h>`

Inheritance diagram for SeExpr2::ExprPrototypeNode:

## Public Member Functions
| ExprPrototypeNode (const Expression *expr, const std::string &name, const ExprType &retType)
| ExprPrototypeNode (const Expression *expr, const std::string &name)
virtual ExprType | prep (bool wantScalar, ExprVarEnvBuilder &envBuilder)
void | addArgTypes (ExprNode *surrogate)
void | addArgs (ExprNode *surrogate)
void | setReturnType (const ExprType &type)
bool | isReturnTypeSet () const
ExprType | returnType () const
ExprType | argType (int i) const
const ExprNode * | arg (int i) const
const std::string & | name () const
int | buildInterpreter (Interpreter *interpreter) const
| Build the interpreter. More...
virtual LLVM_VALUE | codegen (LLVM_BUILDER) LLVM_BODY
int | interpreterOps (int c) const
| Return op for interpreter. More...
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
std::string | _name
bool | _retTypeSet
ExprType | _retType
std::vector< ExprType > | _argTypes
std::vector< int > | _interpreterOps

## 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 prototype of function.

Definition at line 255 of file ExprNode.h.

## Constructor & Destructor Documentation

## ◆ ExprPrototypeNode() [1/2]

SeExpr2::ExprPrototypeNode::ExprPrototypeNode | ( | const Expression * | expr,
|  | const std::string & | name,
|  | const ExprType & | retType
| ) |  |
| inline

Definition at line 257 of file ExprNode.h.

## ◆ ExprPrototypeNode() [2/2]

SeExpr2::ExprPrototypeNode::ExprPrototypeNode | ( | const Expression * | expr,
|  | const std::string & | name
| ) |  |
| inline

Definition at line 260 of file ExprNode.h.

## Member Function Documentation

## ◆ addArgs()

void SeExpr2::ExprPrototypeNode::addArgs | ( | ExprNode * | surrogate | ) |

Definition at line 173 of file ExprNode.cpp.

References _argTypes, SeExpr2::ExprNode::addChildren(), SeExpr2::ExprNode::child(), name(), SeExpr2::ExprNode::numChildren(), and SeExpr2::ExprNode::type().

## ◆ addArgTypes()

void SeExpr2::ExprPrototypeNode::addArgTypes | ( | ExprNode * | surrogate | ) |

Definition at line 166 of file ExprNode.cpp.

References _argTypes, SeExpr2::ExprNode::addChildren(), SeExpr2::ExprNode::child(), SeExpr2::ExprNode::numChildren(), and SeExpr2::ExprNode::type().

## ◆ arg()

const ExprNode* SeExpr2::ExprPrototypeNode::arg | ( | int | i | ) | const
| inline

Definition at line 284 of file ExprNode.h.

References SeExpr2::ExprNode::child().

## ◆ argType()

ExprType SeExpr2::ExprPrototypeNode::argType | ( | int | i | ) | const
| inline

Definition at line 281 of file ExprNode.h.

References _argTypes.

## ◆ buildInterpreter()

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

Build the interpreter.

Reimplemented from SeExpr2::ExprNode.

Definition at line 910 of file Interpreter.cpp.

## ◆ codegen()

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

Reimplemented from SeExpr2::ExprNode.

## ◆ interpreterOps()

int SeExpr2::ExprPrototypeNode::interpreterOps | ( | int | c | ) | const
| inline

Return op for interpreter.

Definition at line 294 of file ExprNode.h.

References _interpreterOps.

## ◆ isReturnTypeSet()

bool SeExpr2::ExprPrototypeNode::isReturnTypeSet | ( |  | ) | const
| inline

Definition at line 273 of file ExprNode.h.

References _retTypeSet.

Referenced by SeExpr2::ExprLocalFunctionNode::prep().

## ◆ name()

const std::string& SeExpr2::ExprPrototypeNode::name | ( |  | ) | const
| inline

Definition at line 288 of file ExprNode.h.

References _name.

Referenced by addArgs(), prep(), and SeExpr2::ExprLocalFunctionNode::prep().

## ◆ prep()

ExprType SeExpr2::ExprPrototypeNode::prep | ( | bool | dontNeedScalar,
|  | ExprVarEnvBuilder & | envBuilder
| ) |  |
| virtual

Prepare the node (for parser use only). See the discussion at the start of SeExprNode.cpp for more info.

Default is to call prep on children (giving AnyType as desired type). If all children return valid types, returns NoneType. Otherwise, returns ErrorType. Note: Ignores wanted type.

Reimplemented from SeExpr2::ExprNode.

Definition at line 139 of file ExprNode.cpp.

References _argTypes, _retTypeSet, SeExpr2::ExprNode::_type, SeExpr2::ExprVarEnv::add(), SeExpr2::ExprNode::checkCondition(), SeExpr2::ExprNode::child(), SeExpr2::ExprVarEnvBuilder::current(), SeExpr2::ExprLocalVar::getPhi(), SeExpr2::ExprType::isValid(), isValid(), name(), SeExpr2::ExprNode::numChildren(), SeExpr2::ExprNode::prep(), returnType(), SeExpr2::ExprNode::setType(), and SeExpr2::ExprNode::type().

Referenced by SeExpr2::ExprLocalFunctionNode::prep().

## ◆ returnType()

ExprType SeExpr2::ExprPrototypeNode::returnType | ( |  | ) | const
| inline

Definition at line 277 of file ExprNode.h.

References _retType, and _retTypeSet.

Referenced by prep(), and SeExpr2::ExprLocalFunctionNode::prep().

## ◆ setReturnType()

void SeExpr2::ExprPrototypeNode::setReturnType | ( | const ExprType & | type | ) |
| inline

Definition at line 268 of file ExprNode.h.

References _retType, _retTypeSet, and SeExpr2::ExprNode::type().

Referenced by SeExpr2::ExprLocalFunctionNode::prep().

## Member Data Documentation

## ◆ _argTypes

std::vector<ExprType> SeExpr2::ExprPrototypeNode::_argTypes
| private

Definition at line 300 of file ExprNode.h.

Referenced by addArgs(), addArgTypes(), argType(), and prep().

## ◆ _interpreterOps

std::vector<int> SeExpr2::ExprPrototypeNode::_interpreterOps
| mutable private

Definition at line 301 of file ExprNode.h.

Referenced by interpreterOps().

## ◆ _name

std::string SeExpr2::ExprPrototypeNode::_name
| private

Definition at line 297 of file ExprNode.h.

Referenced by name().

## ◆ _retType

ExprType SeExpr2::ExprPrototypeNode::_retType
| private

Definition at line 299 of file ExprNode.h.

Referenced by returnType(), and setReturnType().

## ◆ _retTypeSet

bool SeExpr2::ExprPrototypeNode::_retTypeSet
| private

Definition at line 298 of file ExprNode.h.

Referenced by isReturnTypeSet(), prep(), returnType(), and setReturnType().

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