hobbes
a language, embedded compiler, and runtime for efficient dynamic expression evaluation, data storage and analysis
Classes | Namespaces | Macros | Functions
func.C File Reference
#include <hobbes/eval/cc.H>
#include <hobbes/eval/func.H>
#include <hobbes/eval/ctype.H>
#include <hobbes/db/file.H>
#include <iostream>
Include dependency graph for func.C:

Classes

class  hobbes::ifexp
 
class  hobbes::alenexp
 
class  hobbes::aconcatexp
 
class  hobbes::asetlen
 
class  hobbes::salenexp
 
class  hobbes::saelem
 
class  hobbes::saacopy
 
class  hobbes::applyCFn
 
class  hobbes::idexp
 
class  hobbes::castexp
 
class  hobbes::newPrimfn
 
class  hobbes::newArrayfn
 
class  hobbes::adjptr
 
class  hobbes::adjvtblptr
 
class  hobbes::recHLabel
 
class  hobbes::recHValue
 
class  hobbes::recTail
 
class  hobbes::varHLabel
 
class  hobbes::varInjH
 
class  hobbes::varSplit
 
class  hobbes::packLongF
 
class  hobbes::packIntF
 
class  hobbes::packShortF
 
class  hobbes::threadF
 
class  hobbes::cptrrefbyF
 

Namespaces

 hobbes
 

Macros

#define IOP(opn, mem, aty0, rty)
 
#define BOP(opn, mem, aty0, aty1, rty)
 
#define CASTOP(opn, cflag, inty, outty)
 
#define IOP1(opn, mem, a0, inty, outty)
 
#define IOP2(opn, mem, a0, a1, inty, outty)
 
#define BINDF(n, v)   c->bindLLFunc(n,v)
 
#define DEC(inst)   BINDF(#inst, new inst##_op())
 

Functions

 hobbes::IOP (not, CreateNot, bool, bool)
 
 hobbes::IOP (bnot, CreateNot, unsigned char, unsigned char)
 
 hobbes::CASTOP (b2i, llvm::Instruction::ZExt, unsigned char, int)
 
 hobbes::CASTOP (b2l, llvm::Instruction::ZExt, unsigned char, long)
 
 hobbes::CASTOP (i2d, llvm::Instruction::SIToFP, int, double)
 
 hobbes::CASTOP (i2f, llvm::Instruction::SIToFP, int, float)
 
 hobbes::CASTOP (i2l, llvm::Instruction::SExt, int, long)
 
 hobbes::CASTOP (l2d, llvm::Instruction::SIToFP, long, double)
 
 hobbes::CASTOP (l2f, llvm::Instruction::SIToFP, long, float)
 
 hobbes::CASTOP (s2i, llvm::Instruction::SExt, short, int)
 
 hobbes::CASTOP (f2d, llvm::Instruction::FPExt, float, double)
 
 hobbes::CASTOP (tl2i, llvm::Instruction::Trunc, long, int)
 
 hobbes::CASTOP (ti2s, llvm::Instruction::Trunc, int, short)
 
 hobbes::CASTOP (ti2b, llvm::Instruction::Trunc, int, unsigned char)
 
 hobbes::CASTOP (tl2b, llvm::Instruction::Trunc, long, unsigned char)
 
 hobbes::IOP (sneg, CreateNeg, short, short)
 
 hobbes::IOP (ineg, CreateNeg, int, int)
 
 hobbes::IOP (lneg, CreateNeg, long, long)
 
 hobbes::IOP (fneg, CreateFNeg, float, float)
 
 hobbes::IOP (dneg, CreateFNeg, double, double)
 
 hobbes::BOP (ceq, CreateICmpEQ, char, char, bool)
 
 hobbes::BOP (cneq, CreateICmpNE, char, char, bool)
 
 hobbes::BOP (clt, CreateICmpULT, char, char, bool)
 
 hobbes::BOP (clte, CreateICmpULE, char, char, bool)
 
 hobbes::BOP (cgt, CreateICmpUGT, char, char, bool)
 
 hobbes::BOP (cgte, CreateICmpUGE, char, char, bool)
 
 hobbes::BOP (beq, CreateICmpEQ, unsigned char, unsigned char, bool)
 
 hobbes::BOP (bneq, CreateICmpNE, unsigned char, unsigned char, bool)
 
 hobbes::BOP (blt, CreateICmpULT, unsigned char, unsigned char, bool)
 
 hobbes::BOP (blte, CreateICmpULE, unsigned char, unsigned char, bool)
 
 hobbes::BOP (bgt, CreateICmpUGT, unsigned char, unsigned char, bool)
 
 hobbes::BOP (bgte, CreateICmpUGE, unsigned char, unsigned char, bool)
 
 hobbes::BOP (bshl, CreateShl, unsigned char, unsigned char, unsigned char)
 
 hobbes::BOP (blshr, CreateLShr, unsigned char, unsigned char, unsigned char)
 
 hobbes::BOP (bashr, CreateAShr, unsigned char, unsigned char, unsigned char)
 
 hobbes::BOP (band, CreateAnd, unsigned char, unsigned char, unsigned char)
 
 hobbes::BOP (bor, CreateOr, unsigned char, unsigned char, unsigned char)
 
 hobbes::BOP (bxor, CreateXor, unsigned char, unsigned char, unsigned char)
 
 hobbes::BOP (cadd, CreateAdd, char, char, char)
 
 hobbes::BOP (csub, CreateSub, char, char, char)
 
 hobbes::BOP (cmul, CreateMul, char, char, char)
 
 hobbes::BOP (cdiv, CreateSDiv, char, char, char)
 
 hobbes::BOP (crem, CreateSRem, char, char, char)
 
 hobbes::BOP (badd, CreateAdd, unsigned char, unsigned char, unsigned char)
 
 hobbes::BOP (bsub, CreateSub, unsigned char, unsigned char, unsigned char)
 
 hobbes::BOP (bmul, CreateMul, unsigned char, unsigned char, unsigned char)
 
 hobbes::BOP (bdiv, CreateSDiv, unsigned char, unsigned char, unsigned char)
 
 hobbes::BOP (brem, CreateSRem, unsigned char, unsigned char, unsigned char)
 
 hobbes::BOP (sadd, CreateAdd, short, short, short)
 
 hobbes::BOP (ssub, CreateSub, short, short, short)
 
 hobbes::BOP (smul, CreateMul, short, short, short)
 
 hobbes::BOP (sdiv, CreateSDiv, short, short, short)
 
 hobbes::BOP (srem, CreateSRem, short, short, short)
 
 hobbes::BOP (seq, CreateICmpEQ, short, short, bool)
 
 hobbes::BOP (sneq, CreateICmpNE, short, short, bool)
 
 hobbes::BOP (slt, CreateICmpSLT, short, short, bool)
 
 hobbes::BOP (slte, CreateICmpSLE, short, short, bool)
 
 hobbes::BOP (sgt, CreateICmpSGT, short, short, bool)
 
 hobbes::BOP (sgte, CreateICmpSGE, short, short, bool)
 
 hobbes::BOP (iadd, CreateAdd, int, int, int)
 
 hobbes::BOP (isub, CreateSub, int, int, int)
 
 hobbes::BOP (imul, CreateMul, int, int, int)
 
 hobbes::BOP (idiv, CreateSDiv, int, int, int)
 
 hobbes::BOP (irem, CreateSRem, int, int, int)
 
 hobbes::BOP (ishl, CreateShl, int, int, int)
 
 hobbes::BOP (ilshr, CreateLShr, int, int, int)
 
 hobbes::BOP (iashr, CreateAShr, int, int, int)
 
 hobbes::BOP (iand, CreateAnd, int, int, int)
 
 hobbes::BOP (ior, CreateOr, int, int, int)
 
 hobbes::BOP (ixor, CreateXor, int, int, int)
 
 hobbes::BOP (ieq, CreateICmpEQ, int, int, bool)
 
 hobbes::BOP (ineq, CreateICmpNE, int, int, bool)
 
 hobbes::BOP (ilt, CreateICmpSLT, int, int, bool)
 
 hobbes::BOP (ilte, CreateICmpSLE, int, int, bool)
 
 hobbes::BOP (igt, CreateICmpSGT, int, int, bool)
 
 hobbes::BOP (igte, CreateICmpSGE, int, int, bool)
 
 hobbes::BOP (ladd, CreateAdd, long, long, long)
 
 hobbes::BOP (lsub, CreateSub, long, long, long)
 
 hobbes::BOP (lmul, CreateMul, long, long, long)
 
 hobbes::BOP (ldiv, CreateSDiv, long, long, long)
 
 hobbes::BOP (lrem, CreateSRem, long, long, long)
 
 hobbes::BOP (lshl, CreateShl, long, long, long)
 
 hobbes::BOP (llshr, CreateLShr, long, long, long)
 
 hobbes::BOP (lashr, CreateAShr, long, long, long)
 
 hobbes::BOP (land, CreateAnd, long, long, long)
 
 hobbes::BOP (lor, CreateOr, long, long, long)
 
 hobbes::BOP (lxor, CreateXor, long, long, long)
 
 hobbes::BOP (leq, CreateICmpEQ, long, long, bool)
 
 hobbes::BOP (lneq, CreateICmpNE, long, long, bool)
 
 hobbes::BOP (llt, CreateICmpSLT, long, long, bool)
 
 hobbes::BOP (llte, CreateICmpSLE, long, long, bool)
 
 hobbes::BOP (lgt, CreateICmpSGT, long, long, bool)
 
 hobbes::BOP (lgte, CreateICmpSGE, long, long, bool)
 
 hobbes::BOP (fadd, CreateFAdd, float, float, float)
 
 hobbes::BOP (fsub, CreateFSub, float, float, float)
 
 hobbes::BOP (fmul, CreateFMul, float, float, float)
 
 hobbes::BOP (fdiv, CreateFDiv, float, float, float)
 
 hobbes::BOP (feq, CreateFCmpOEQ, float, float, bool)
 
 hobbes::BOP (fneq, CreateFCmpONE, float, float, bool)
 
 hobbes::BOP (flt, CreateFCmpOLT, float, float, bool)
 
 hobbes::BOP (flte, CreateFCmpOLE, float, float, bool)
 
 hobbes::BOP (fgt, CreateFCmpOGT, float, float, bool)
 
 hobbes::BOP (fgte, CreateFCmpOGE, float, float, bool)
 
 hobbes::BOP (dadd, CreateFAdd, double, double, double)
 
 hobbes::BOP (dsub, CreateFSub, double, double, double)
 
 hobbes::BOP (dmul, CreateFMul, double, double, double)
 
 hobbes::BOP (ddiv, CreateFDiv, double, double, double)
 
 hobbes::BOP (deq, CreateFCmpOEQ, double, double, bool)
 
 hobbes::BOP (dneq, CreateFCmpONE, double, double, bool)
 
 hobbes::BOP (dlt, CreateFCmpOLT, double, double, bool)
 
 hobbes::BOP (dlte, CreateFCmpOLE, double, double, bool)
 
 hobbes::BOP (dgt, CreateFCmpOGT, double, double, bool)
 
 hobbes::BOP (dgte, CreateFCmpOGE, double, double, bool)
 
size_t hobbes::stdstrsize (const std::string &x)
 
char hobbes::stdstrelem (const std::string &x, size_t i)
 
void hobbes::initDefOperators (cc *)
 

Macro Definition Documentation

◆ BINDF

#define BINDF (   n,
 
)    c->bindLLFunc(n,v)

◆ BOP

#define BOP (   opn,
  mem,
  aty0,
  aty1,
  rty 
)
Value:
class opn##_op : public op { \
public: \
llvm::Value* apply(jitcc* c, const MonoTypes&, const MonoTypePtr&, const Exprs& es) { \
llvm::Value* left = c->compile(es[0]); \
llvm::Value* right = c->compile(es[1]); \
return c->builder()->mem(left, right, "t"); \
} \
PolyTypePtr type(typedb& tenv) const { \
return polytype(prim<rty(aty0,aty1)>()); \
} \
}
MonoTypePtr prim()
Definition: tylift.H:232
Definition: terminal.H:71
void apply(const transition_lookahead &tl, parserdef *p)
Definition: lalr.C:564
std::vector< ExprPtr > Exprs
Definition: expr.H:59
MonoType::ptr MonoTypePtr
Definition: type.H:71
Definition: terminal.H:71
PolyTypePtr polytype(int tvs, const QualTypePtr &qt)
Definition: type.H:1036
std::vector< MonoTypePtr > MonoTypes
Definition: type.H:72

◆ CASTOP

#define CASTOP (   opn,
  cflag,
  inty,
  outty 
)
Value:
class opn##_op : public op { \
public: \
llvm::Value* apply(jitcc* c, const MonoTypes&, const MonoTypePtr&, const Exprs& es) { \
llvm::Value* e = c->compile(es[0]); \
return c->builder()->CreateCast(cflag, e, toLLVM(prim<outty>()), "t"); \
} \
PolyTypePtr type(typedb& tenv) const { \
return polytype(prim<outty(inty)>()); \
} \
}
MonoTypePtr prim()
Definition: tylift.H:232
void apply(const transition_lookahead &tl, parserdef *p)
Definition: lalr.C:564
std::vector< ExprPtr > Exprs
Definition: expr.H:59
MonoType::ptr MonoTypePtr
Definition: type.H:71
llvm::Value * toLLVM(jitcc *, const ExprPtr &exp)
Definition: cexpr.C:617
PolyTypePtr polytype(int tvs, const QualTypePtr &qt)
Definition: type.H:1036
std::vector< MonoTypePtr > MonoTypes
Definition: type.H:72

◆ DEC

#define DEC (   inst)    BINDF(#inst, new inst##_op())

◆ IOP

#define IOP (   opn,
  mem,
  aty0,
  rty 
)
Value:
class opn##_op : public op { \
public: \
llvm::Value* apply(jitcc* c, const MonoTypes&, const MonoTypePtr&, const Exprs& es) { \
llvm::Value* x = c->compile(es[0]); \
return c->builder()->mem(x, "t"); \
} \
PolyTypePtr type(typedb& tenv) const { \
return polytype(prim<rty(aty0)>()); \
} \
}
MonoTypePtr prim()
Definition: tylift.H:232
void apply(const transition_lookahead &tl, parserdef *p)
Definition: lalr.C:564
std::vector< ExprPtr > Exprs
Definition: expr.H:59
MonoType::ptr MonoTypePtr
Definition: type.H:71
PolyTypePtr polytype(int tvs, const QualTypePtr &qt)
Definition: type.H:1036
std::vector< MonoTypePtr > MonoTypes
Definition: type.H:72

◆ IOP1

#define IOP1 (   opn,
  mem,
  a0,
  inty,
  outty 
)
Value:
class opn##_op : public op { \
public: \
llvm::Value* apply(jitcc* c, const MonoTypes&, const MonoTypePtr&, const Exprs& es) { \
llvm::Value* x = c->compile(es[0]); \
return c->builder()->mem(x, a0, "t"); \
} \
PolyTypePtr type(typedb& tenv) const { \
return polytype(prim<outty(inty)>()); \
} \
}
MonoTypePtr prim()
Definition: tylift.H:232
void apply(const transition_lookahead &tl, parserdef *p)
Definition: lalr.C:564
std::vector< ExprPtr > Exprs
Definition: expr.H:59
MonoType::ptr MonoTypePtr
Definition: type.H:71
PolyTypePtr polytype(int tvs, const QualTypePtr &qt)
Definition: type.H:1036
std::vector< MonoTypePtr > MonoTypes
Definition: type.H:72

◆ IOP2

#define IOP2 (   opn,
  mem,
  a0,
  a1,
  inty,
  outty 
)
Value:
class opn##_op : public op { \
public: \
llvm::Value* apply(jitcc* c, const MonoTypes&, const MonoTypePtr&, const Exprs& es) { \
llvm::Value* x = c->compile(es[0]); \
return c->builder()->mem(x, a0, a1, "t"); \
} \
PolyTypePtr type(typedb& tenv) const { \
return polytype(prim<outty(inty)>()); \
} \
}
MonoTypePtr prim()
Definition: tylift.H:232
void apply(const transition_lookahead &tl, parserdef *p)
Definition: lalr.C:564
std::vector< ExprPtr > Exprs
Definition: expr.H:59
MonoType::ptr MonoTypePtr
Definition: type.H:71
PolyTypePtr polytype(int tvs, const QualTypePtr &qt)
Definition: type.H:1036
std::vector< MonoTypePtr > MonoTypes
Definition: type.H:72