101 std::vector<ExprNode *>::iterator
iter;
109 child->_parent =
this;
174 std::cerr <<
"after create localvar phi " << localVar->
getPhi() << std::endl;
236 "In function result of block '" +
blockType.toString() +
237 "' does not match given return type " +
prototype->returnType().toString(),
268 "Incorrect number of arguments to function call",
376 double first = f->value();
378 double second = s->value();
380 double third =
t->value();
539 if (!
phi->_thenVar->type().isError() && !
phi->_elseVar->type().isError()) {
std::string unescapeString(const std::string &string)
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
const ExprLocalVar * localVar() const
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
Node that calls a function.
bool checkArg(int argIndex, const ExprType &type, ExprVarEnvBuilder &envBuilder)
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
int buildInterpreter(Interpreter *interpreter) const override
builds an interpreter. Returns the location index for the evaluated data
std::vector< int > _promote
const ExprLocalFunctionNode * _localFunc
Extension function spec, used for complicated argument custom functions.
virtual ExprType prep(ExprFuncNode *node, bool scalarWanted, ExprVarEnvBuilder &env) const =0
static const ExprFunc * lookup(const std::string &name)
Lookup a builtin function by name.
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
Node that contains local function.
const ExprPrototypeNode * prototype() const
TODO: Accessor for prototype (probably not needed when we use prep right)
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
Preps the definition of this site.
ExprLocalVar join (merge) references. Remembers which variables are possible assigners to this.
ExprLocalVar reference, all local variables in seexpr are subclasses of this or this itself.
const ExprLocalVar * getPhi() const
get the primary representative phi node (i.e. the global parent of a dependent phi node)
ExprType type() const
returns type of the variable
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
void addChildren(ExprNode *surrogate)
Transfer children from surrogate parent (for parser use only)
virtual ExprType prep(bool dontNeedScalar, ExprVarEnvBuilder &envBuilder)
ExprNode(const Expression *expr)
bool checkIsFP(const ExprType &type, bool &error) const
Checks if the type is a float[d] for any d.
void setTypeWithChildLife(const ExprType &t)
Set's the type to the argument but uses the children to determine lifetime.
const ExprType & type() const
The type of the node.
int numChildren() const
Number of children.
bool checkCondition(bool check, const ErrorCode message, const std::vector< std::string > &ids, bool &error) const
Checks the boolean value and records an error string with node if it is false.
std::vector< ExprNode * > _children
List of children.
bool checkIsValue(const ExprType &type, bool &error) const
Checks if the type is a value (i.e. string or float[d])
const ExprNode * child(size_t i) const
Get 0 indexed child.
bool checkTypesCompatible(const ExprType &first, const ExprType &second, bool &error) const
types match (true if they do)
void addError(const ErrorCode error, const std::vector< std::string > &ids={}) const
Register error. This will allow users and sophisticated editors to highlight where in code problem wa...
const Expression * _expr
Owning expression (node can't modify)
void setType(const ExprType &t)
Set type of parameter.
void addChild(ExprNode *child)
Add a child to the child list (for parser use only)
Node that stores a numeric constant.
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
Node that contains prototype of function.
std::vector< ExprType > _argTypes
void addArgs(ExprNode *surrogate)
ExprType returnType() const
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
void addArgTypes(ExprNode *surrogate)
const std::string & name() const
ExprStrNode(const Expression *expr, const char *str)
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
ExprType & FP(int d)
Mutate this into a floating point type of dimension d.
ExprType & Constant()
Mutate this into a constant lifetime.
ExprType & setLifetime(const ExprType &a)
Assign the lifetime from type a to be my type.
ExprType & String()
Mutate this into a string type.
ExprType & Error()
Mutate this into an error type.
static bool valuesCompatible(const ExprType &a, const ExprType &b)
Checks if value types are compatible.
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
Variable scope builder is used by the type checking and code gen to track visiblity of variables and ...
Variable scope for tracking variable lookup.
Node that references a variable.
const char * name() const
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
virtual ExprType type() const
returns (current) type
ExprType prep(bool wantScalar, ExprVarEnvBuilder &envBuilder) override
A class that lets you register for the variables used by one or more expressions.
@ ConditionalTypesNotCompatible
"Types of conditional are not compatible",
@ UndeclaredFunction
"Function " << _name << " has no definition"
@ ArgumentTypeMismatch
"Expected "<< type << " for argument, got " << childType
@ BadAssignmentOperator
"Assignment operation has bad type: " << _type
@ FunctionTooManyArguments
"Too many args for function " << _name
@ Unknown
Unknown error (message = %1)
@ FunctionTooFewArguments
"Too few args for function " << _name
@ InconsistentDefinition
"Variable " << name() << " defined in conditionals inconsistently."