23 std::vector<int> operands;
28 std::cerr<<
"we are "<<node->
promote(c)<<
" "<<c<<std::endl;
31 interpreter->
addOp(getTemplatizedOp<Promote>(node->
promote(c)));
35 operand = promotedOperand;
38 operands.push_back(operand);
41 int nargsData = interpreter->
allocFP(1);
46 outoperand = interpreter->
allocPtr();
51 int ptrLoc = interpreter->
allocPtr();
52 int ptrDataLoc = interpreter->
allocPtr();
53 interpreter->
s[ptrLoc] = (
char *)
this;
58 for (
int operand : operands) {
61 interpreter->
endOp(
false);
64 int pc = interpreter->
nextPC() - 1;
65 int *opCurr = (&interpreter->
opData[0]) + interpreter->
ops[pc].second;
70 interpreter->
s[ptrDataLoc] =
reinterpret_cast<char *
>(data);
109 strArg[0] =
reinterpret_cast<char *
>(funcSimple);
111 std::vector<int> callStack;
114 handle.
data = funcSimple->evalConstant(node, handle);
115 *funcdata =
reinterpret_cast<void *
>(handle.
data);
121 funcSimple->eval(handle);
void KSeExprLLVMEvalCustomFunction(int *opDataArg, double *fpArg, char **strArg, void **funcdata, const KSeExpr::ExprFuncNode *node)
Node that calls a function.
const ExprFunc * func() const
void setData(Data *data) const
associate blind data with this node (subsequently owned by this object)
ExprFuncNode::Data * data
static int EvalOp(int *opData, double *fp, char **c, std::vector< int > &callStack)
int buildInterpreter(const ExprFuncNode *node, Interpreter *interpreter) const override
Build an interpreter to evaluate the expression.
virtual ExprFuncNode::Data * evalConstant(const ExprFuncNode *node, ArgHandle args) const =0
Extension function spec, used for complicated argument custom functions.
Function Definition, used in parse tree and func table.
const ExprFuncX * funcx() const
return pointer to the funcx
virtual int buildInterpreter(Interpreter *interpreter) const
builds an interpreter. Returns the location index for the evaluated data
int numChildren() const
Number of children.
const ExprType & type() const
The type of the node.
const ExprNode * child(size_t i) const
Get 0 indexed child.
bool isFP() const
Direct is predicate checks.
std::vector< std::pair< OpF, int > > ops
std::vector< double > d
Double data (constants and evaluated)
int addOp(OpF op)
! adds an operator to the program (pointing to the data at the current location)
void endOp(bool execute=true)
std::vector< int > callStack
std::vector< char * > s
constant and evaluated pointer data
int allocFP(int n)
! Allocate a floating point set of data of dimension n
int nextPC() const
Return the position that the next instruction will be placed at.
int allocPtr()
Allocate a pointer location (can be anything, but typically space for char*)
std::vector< int > opData
Ooperands to op.
int addOperand(int param)
! Adds an operand. Note this should be done after doing the addOp!
base class for custom instance data