hobbes
a language, embedded compiler, and runtime for efficient dynamic expression evaluation, data storage and analysis
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
hobbes::jitcc Class Reference

#include <jitcc.H>

Collaboration diagram for hobbes::jitcc:
Collaboration graph

Classes

struct  Constant
 
struct  Global
 
struct  UCF
 

Public Types

typedef std::vector< uint8_t > bytes
 

Public Member Functions

 jitcc ()
 
 ~jitcc ()
 
llvm::IRBuilder * builder () const
 
llvm::Module * module ()
 
void * getSymbolAddress (const std::string &)
 
void dump () const
 
void defineGlobal (const std::string &vname, const ExprPtr &unsweetExp)
 
void bindGlobal (const std::string &vn, const MonoTypePtr &ty, void *v)
 
bool isDefined (const std::string &) const
 
llvm::Value * compile (const ExprPtr &exp)
 
llvm::Value * compile (const std::string &vname, const ExprPtr &exp)
 
llvm::Value * compileAtGlobalScope (const ExprPtr &exp)
 
llvm::Function * compileFunction (const std::string &name, const str::seq &argns, const MonoTypes &argtys, const ExprPtr &exp)
 
void compileFunctions (const LetRec::Bindings &, std::vector< llvm::Function *> *result)
 
void compileFunctions (const LetRec::Bindings &)
 
llvm::Value * compileAllocStmt (size_t sz, llvm::Type *mty, bool zeroMem=false)
 
llvm::Value * compileAllocStmt (llvm::Value *sz, llvm::Type *mty, bool zeroMem=false)
 
llvm::Function * allocFunction (const std::string &fname, const MonoTypes &argl, const MonoTypePtr &rty)
 
void pushScope ()
 
void bindScope (const std::string &vn, llvm::Value *v)
 
void popScope ()
 
void * reifyMachineCodeForFn (const MonoTypePtr &reqTy, const str::seq &names, const MonoTypes &tys, const ExprPtr &exp)
 
void releaseMachineCode (void *)
 
void bindInstruction (const std::string &, op *)
 
oplookupOp (const std::string &) const
 
llvm::Value * lookupVar (const std::string &, const MonoTypePtr &)
 
llvm::Function * lookupFunction (const std::string &)
 
llvm::GlobalVariable * lookupVarRef (const std::string &)
 
llvm::Value * internConstString (const std::string &)
 
bytes machineCodeForExpr (const ExprPtr &)
 
ExprPtr inlineGlobals (const ExprPtr &)
 

Private Types

typedef std::vector< llvm::Module * > Modules
 
typedef std::map< std::string, op * > FuncEnv
 
typedef std::map< std::string, llvm::Value * > VarBindings
 
typedef std::vector< VarBindingsVarBindingStack
 
typedef std::vector< UCFUCFS
 
typedef std::map< std::string, GlobalGlobals
 
typedef std::map< std::string, ConstantConstants
 
typedef std::unordered_map< std::string, std::string > InternConstVars
 
typedef std::map< std::string, ExprPtrGlobalExprs
 

Private Member Functions

void * getMachineCode (llvm::Function *, llvm::JITEventListener *listener=0)
 
void unsafeCompileFunctions (UCFS *)
 
size_t pushGlobalRegion ()
 
void popGlobalRegion (size_t x)
 
llvm::Value * loadConstant (const std::string &)
 
llvm::GlobalVariable * maybeRefGlobal (const std::string &)
 
llvm::GlobalVariable * refGlobal (const std::string &, llvm::GlobalVariable *)
 
llvm::Value * maybeRefGlobalV (llvm::Value *)
 

Private Attributes

llvm::Module * currentModule
 
Modules modules
 
llvm::IRBuilder * irbuilder
 
FuncEnv fenv
 
VarBindingStack vtenv
 
bool ignoreLocalScope
 
Globals globals
 
region globalData
 
Constants constants
 
InternConstVars internConstVars
 
GlobalExprs globalExprs
 

Member Typedef Documentation

◆ bytes

typedef std::vector<uint8_t> hobbes::jitcc::bytes

◆ Constants

typedef std::map<std::string, Constant> hobbes::jitcc::Constants
private

◆ FuncEnv

typedef std::map<std::string, op*> hobbes::jitcc::FuncEnv
private

◆ GlobalExprs

typedef std::map<std::string, ExprPtr> hobbes::jitcc::GlobalExprs
private

◆ Globals

typedef std::map<std::string, Global> hobbes::jitcc::Globals
private

◆ InternConstVars

typedef std::unordered_map<std::string, std::string> hobbes::jitcc::InternConstVars
private

◆ Modules

typedef std::vector<llvm::Module*> hobbes::jitcc::Modules
private

◆ UCFS

typedef std::vector<UCF> hobbes::jitcc::UCFS
private

◆ VarBindings

typedef std::map<std::string, llvm::Value*> hobbes::jitcc::VarBindings
private

◆ VarBindingStack

typedef std::vector<VarBindings> hobbes::jitcc::VarBindingStack
private

Constructor & Destructor Documentation

◆ jitcc()

hobbes::jitcc::jitcc ( )

◆ ~jitcc()

hobbes::jitcc::~jitcc ( )

Member Function Documentation

◆ allocFunction()

llvm::Function * hobbes::jitcc::allocFunction ( const std::string &  fname,
const MonoTypes argl,
const MonoTypePtr rty 
)

◆ bindGlobal()

void hobbes::jitcc::bindGlobal ( const std::string &  vn,
const MonoTypePtr ty,
void *  v 
)

◆ bindInstruction()

void hobbes::jitcc::bindInstruction ( const std::string &  vn,
op f 
)

◆ bindScope()

void hobbes::jitcc::bindScope ( const std::string &  vn,
llvm::Value *  v 
)

◆ builder()

llvm::IRBuilder * hobbes::jitcc::builder ( ) const

◆ compile() [1/2]

llvm::Value * hobbes::jitcc::compile ( const ExprPtr exp)

◆ compile() [2/2]

llvm::Value * hobbes::jitcc::compile ( const std::string &  vname,
const ExprPtr exp 
)

◆ compileAllocStmt() [1/2]

llvm::Value * hobbes::jitcc::compileAllocStmt ( size_t  sz,
llvm::Type *  mty,
bool  zeroMem = false 
)

◆ compileAllocStmt() [2/2]

llvm::Value * hobbes::jitcc::compileAllocStmt ( llvm::Value *  sz,
llvm::Type *  mty,
bool  zeroMem = false 
)

◆ compileAtGlobalScope()

llvm::Value * hobbes::jitcc::compileAtGlobalScope ( const ExprPtr exp)

◆ compileFunction()

llvm::Function * hobbes::jitcc::compileFunction ( const std::string &  name,
const str::seq argns,
const MonoTypes argtys,
const ExprPtr exp 
)

◆ compileFunctions() [1/2]

void hobbes::jitcc::compileFunctions ( const LetRec::Bindings bs,
std::vector< llvm::Function *> *  result 
)

◆ compileFunctions() [2/2]

void hobbes::jitcc::compileFunctions ( const LetRec::Bindings bs)

◆ defineGlobal()

void hobbes::jitcc::defineGlobal ( const std::string &  vname,
const ExprPtr unsweetExp 
)

◆ dump()

void hobbes::jitcc::dump ( ) const

◆ getMachineCode()

void * hobbes::jitcc::getMachineCode ( llvm::Function *  f,
llvm::JITEventListener *  listener = 0 
)
private

◆ getSymbolAddress()

void * hobbes::jitcc::getSymbolAddress ( const std::string &  vn)

◆ inlineGlobals()

ExprPtr hobbes::jitcc::inlineGlobals ( const ExprPtr e)

◆ internConstString()

llvm::Value * hobbes::jitcc::internConstString ( const std::string &  x)

◆ isDefined()

bool hobbes::jitcc::isDefined ( const std::string &  vn) const

◆ loadConstant()

llvm::Value * hobbes::jitcc::loadConstant ( const std::string &  vn)
private

◆ lookupFunction()

llvm::Function * hobbes::jitcc::lookupFunction ( const std::string &  fn)

◆ lookupOp()

op * hobbes::jitcc::lookupOp ( const std::string &  vn) const

◆ lookupVar()

llvm::Value * hobbes::jitcc::lookupVar ( const std::string &  vn,
const MonoTypePtr vty 
)

◆ lookupVarRef()

llvm::GlobalVariable * hobbes::jitcc::lookupVarRef ( const std::string &  vn)

◆ machineCodeForExpr()

jitcc::bytes hobbes::jitcc::machineCodeForExpr ( const ExprPtr e)

◆ maybeRefGlobal()

llvm::GlobalVariable * hobbes::jitcc::maybeRefGlobal ( const std::string &  vn)
private

◆ maybeRefGlobalV()

llvm::Value * hobbes::jitcc::maybeRefGlobalV ( llvm::Value *  v)
private

◆ module()

llvm::Module * hobbes::jitcc::module ( )

◆ popGlobalRegion()

void hobbes::jitcc::popGlobalRegion ( size_t  x)
private

◆ popScope()

void hobbes::jitcc::popScope ( )

◆ pushGlobalRegion()

size_t hobbes::jitcc::pushGlobalRegion ( )
private

◆ pushScope()

void hobbes::jitcc::pushScope ( )

◆ refGlobal()

llvm::GlobalVariable * hobbes::jitcc::refGlobal ( const std::string &  vn,
llvm::GlobalVariable *  gv 
)
private

◆ reifyMachineCodeForFn()

void * hobbes::jitcc::reifyMachineCodeForFn ( const MonoTypePtr reqTy,
const str::seq names,
const MonoTypes tys,
const ExprPtr exp 
)

◆ releaseMachineCode()

void hobbes::jitcc::releaseMachineCode ( void *  )

◆ unsafeCompileFunctions()

void hobbes::jitcc::unsafeCompileFunctions ( UCFS ufs)
private

Member Data Documentation

◆ constants

Constants hobbes::jitcc::constants
private

◆ currentModule

llvm::Module* hobbes::jitcc::currentModule
private

◆ fenv

FuncEnv hobbes::jitcc::fenv
private

◆ globalData

region hobbes::jitcc::globalData
private

◆ globalExprs

GlobalExprs hobbes::jitcc::globalExprs
private

◆ globals

Globals hobbes::jitcc::globals
private

◆ ignoreLocalScope

bool hobbes::jitcc::ignoreLocalScope
private

◆ internConstVars

InternConstVars hobbes::jitcc::internConstVars
private

◆ irbuilder

llvm::IRBuilder* hobbes::jitcc::irbuilder
private

◆ modules

Modules hobbes::jitcc::modules
private

◆ vtenv

VarBindingStack hobbes::jitcc::vtenv
private

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