SeExpr
SeExpr2::Interpreter Class Reference

#include <Interpreter.h>

Public Types

typedef std::map< const ExprLocalVar *, int > VarToLoc
 Not needed for eval only building.
 
typedef int(*) OpF(int *, double *, char **, std::vector< int > &)
 Op function pointer arguments are (int* currOpData,double* currD,char** c,std::stack<int>& callStackurrS)
 

Public Member Functions

 Interpreter ()
 
int nextPC ()
 Return the position that the next instruction will be placed at.
 
int addOp (OpF op)
 ! adds an operator to the program (pointing to the data at the current location)
 
void endOp (bool execute=true)
 
int addOperand (int param)
 ! Adds an operand. Note this should be done after doing the addOp!
 
int allocFP (int n)
 ! Allocate a floating point set of data of dimension n
 
int allocPtr ()
 Allocate a pointer location (can be anything, but typically space for char*)
 
void eval (VarBlock *varBlock, bool debug=false)
 Evaluate program.
 
void print (int pc=-1) const
 Debug by printing program.
 
void setPCStart (int pcStart)
 

Public Attributes

std::vector< double > d
 Double data (constants and evaluated)
 
std::vector< char * > s
 constant and evaluated pointer data
 
std::vector< int > opData
 Ooperands to op.
 
VarToLoc varToLoc
 
std::vector< std::pair< OpF, int > > ops
 
std::vector< int > callStack
 

Private Attributes

bool _startedOp
 
int _pcStart
 

Detailed Description

Non-LLVM manual interpreter. This is a simple computation machine. There are no dynamic activation records just fixed locations, because we have no recursion!

Definition at line 40 of file Interpreter.h.

Member Typedef Documentation

◆ OpF

int(*) SeExpr2::Interpreter::OpF(int *, double *, char **, std::vector< int > &)

Op function pointer arguments are (int* currOpData,double* currD,char** c,std::stack<int>& callStackurrS)

Definition at line 54 of file Interpreter.h.

◆ VarToLoc

Not needed for eval only building.

Definition at line 50 of file Interpreter.h.

Constructor & Destructor Documentation

◆ Interpreter()

SeExpr2::Interpreter::Interpreter ( )
inline

Definition at line 64 of file Interpreter.h.

References s.

Member Function Documentation

◆ addOp()

◆ addOperand()

◆ allocFP()

◆ allocPtr()

◆ endOp()

◆ eval()

void SeExpr2::Interpreter::eval ( VarBlock * varBlock,
bool debug = false )

◆ nextPC()

◆ print()

void SeExpr2::Interpreter::print ( int pc = -1) const

Debug by printing program.

Definition at line 69 of file Interpreter.cpp.

References d, opData, ops, and s.

Referenced by SeExpr2::ExprFuncStandard::buildInterpreter(), SeExpr2::Expression::debugPrintInterpreter(), eval(), and SeExpr2::Expression::prep().

◆ setPCStart()

void SeExpr2::Interpreter::setPCStart ( int pcStart)
inline

Definition at line 122 of file Interpreter.h.

References _pcStart.

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

Member Data Documentation

◆ _pcStart

int SeExpr2::Interpreter::_pcStart
private

Definition at line 61 of file Interpreter.h.

Referenced by eval(), and setPCStart().

◆ _startedOp

bool SeExpr2::Interpreter::_startedOp
private

Definition at line 60 of file Interpreter.h.

Referenced by addOp(), addOperand(), and endOp().

◆ callStack

std::vector<int> SeExpr2::Interpreter::callStack

Definition at line 57 of file Interpreter.h.

Referenced by SeExpr2::ExprFuncSimple::buildInterpreter(), endOp(), and eval().

◆ d

std::vector<double> SeExpr2::Interpreter::d

◆ opData

◆ ops

std::vector<std::pair<OpF, int> > SeExpr2::Interpreter::ops

◆ s

◆ varToLoc


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