CodeGenBase

template<typename FunctionPtrType>
class CodeGenBase

a convenience class to pull the vars out of a context, and store them as ivars.

It can get tedious alwasy typing mgc.getThis and mgc.getThat. Furthermore, its faster to access them as ivars as it does not incur a func call each time.

Subclassed by rrllvm::GetEventValueCodeGenBase< GetEventTriggerCodeGen, GetEventTriggerCodeGen_FunctionPtr >

Public Types

typedef FunctionPtrType FunctionPtr

Public Functions

inline llvm::Function *createFunction()

Protected Functions

inline CodeGenBase(const ModelGeneratorContext &mgc)
virtual llvm::Value *codeGen() = 0
template<size_t N>
inline llvm::BasicBlock *codeGenHeader(const char *functionName, llvm::Type *retType, llvm::Type *(&argTypes)[N], const char *(&argNames)[N], llvm::Value *(&args)[N])
inline llvm::BasicBlock *codeGenVoidModelDataHeader(const char *functionName, llvm::Value *&modelData)

the most common type of generated function takes a ModelData*, and returns void.

inline llvm::Function *verifyFunction()
inline virtual ~CodeGenBase()

Protected Attributes

const ModelGeneratorContext &modelGenContext
const libsbml::Model *model

could potentially be null, everything else is guaranteed to be valid

const LLVMModelDataSymbols &dataSymbols
const LLVMModelSymbols &modelSymbols
llvm::LLVMContext &context
llvm::Module *module
llvm::IRBuilder &builder
llvm::Function *function
llvm::legacy::FunctionPassManager *functionPassManager

function pass manager.

Null if no optimization.

const unsigned options

the options bit field that was passed into the top level load method.