SeExpr
Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
SeExpr2::Interpreter Class Reference

#include <Interpreter.h>

Public Types

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

Public Member Functions

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

Public Attributes

std::vector< double > d
 Double data (constants and evaluated) More...
 
std::vector< char * > s
 constant and evaluated pointer data More...
 
std::vector< int > opData
 Ooperands to op. More...
 
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

typedef 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.

Not needed for eval only building.

Definition at line 50 of file Interpreter.h.

Constructor & Destructor Documentation

SeExpr2::Interpreter::Interpreter ( )
inline

Definition at line 64 of file Interpreter.h.

References s.

Member Function Documentation

int SeExpr2::Interpreter::addOp ( OpF  op)
inline
int SeExpr2::Interpreter::addOperand ( int  param)
inline
int SeExpr2::Interpreter::allocFP ( int  n)
inline
int SeExpr2::Interpreter::allocPtr ( )
inline
void SeExpr2::Interpreter::endOp ( bool  execute = true)
inline
void SeExpr2::Interpreter::eval ( VarBlock varBlock,
bool  debug = false 
)
int SeExpr2::Interpreter::nextPC ( )
inline
void SeExpr2::Interpreter::print ( int  pc = -1) const

Debug by printing program.

Definition at line 48 of file Interpreter.cpp.

References d, opData, ops, and s.

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

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

Definition at line 122 of file Interpreter.h.

References _pcStart.

Member Data Documentation

int SeExpr2::Interpreter::_pcStart
private

Definition at line 61 of file Interpreter.h.

Referenced by eval(), and setPCStart().

bool SeExpr2::Interpreter::_startedOp
private

Definition at line 60 of file Interpreter.h.

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

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

Definition at line 57 of file Interpreter.h.

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

std::vector<double> SeExpr2::Interpreter::d
std::vector<int> SeExpr2::Interpreter::opData
std::vector<std::pair<OpF, int> > SeExpr2::Interpreter::ops
std::vector<char*> SeExpr2::Interpreter::s
VarToLoc SeExpr2::Interpreter::varToLoc

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