ModelDataIRBuilder

class ModelDataIRBuilder

The model data IR builder.

(Sorry, this is very old code.)

Public Functions

ModelDataIRBuilder(llvm::Value *modelData, LLVMModelDataSymbols const&, llvm::IRBuilder<>&)

these only make sense attached to a modelData pointer.

llvm::Value *createFloatSpeciesAmtGEP(const std::string &id, const llvm::Twine &name = "")
llvm::Value *createBoundSpeciesAmtGEP(const std::string &id, const llvm::Twine &name = "")
llvm::Value *createGlobalParamGEP(const std::string &id)
llvm::Value *createGEP(ModelDataFields field)

create a GEP for a ModelData structure field.

Parameters:

field – value for a ModelData pointer type.

llvm::Value *createGEP(ModelDataFields field, unsigned index, const llvm::Twine &name = "")

create a GEP for an array which belongs to the ModelData struct, only valid for arrays, will crash on non-array fields.

llvm::Value *createLoad(ModelDataFields field, unsigned index, const llvm::Twine &name = "")
llvm::Value *createStore(ModelDataFields field, unsigned index, llvm::Value *value, const llvm::Twine &name = "")
llvm::Value *createCompGEP(const std::string &id)

the GEP for a compartment

llvm::Value *createCompLoad(const std::string &id, const llvm::Twine &name = "")

load the compartment value

llvm::Value *createCompStore(const std::string &id, llvm::Value *value)

store the compartment value

llvm::Value *createInitFloatSpeciesAmtGEP(const std::string &id, const llvm::Twine &name = "")

the GEP for a floating species initial amount

llvm::Value *createInitBoundarySpeciesAmtGEP(const std::string &id, const llvm::Twine &name = "")

the GEP for a boundary species initial amount

llvm::Value *createInitFloatSpeciesAmtLoad(const std::string &id, const llvm::Twine &name = "")

load the floating species initial amount value

llvm::Value *createInitBoundarySpeciesAmtLoad(const std::string &id, const llvm::Twine &name = "")

load the boundary species initial amount value

llvm::Value *createInitFloatSpeciesAmtStore(const std::string &id, llvm::Value *value)

store the floating species initial value

llvm::Value *createInitBoundarySpeciesAmtStore(const std::string &id, llvm::Value *value)

store the boundary species initial value

llvm::Value *createInitCompGEP(const std::string &id, const llvm::Twine &name = "")

the GEP for a compartment

llvm::Value *createInitCompLoad(const std::string &id, const llvm::Twine &name = "")

load the compartment value

llvm::Value *createInitCompStore(const std::string &id, llvm::Value *value)

store the compartment value

llvm::Value *createInitGlobalParamGEP(const std::string &id, const llvm::Twine &name = "")

the GEP for a init global params

llvm::Value *createInitGlobalParamLoad(const std::string &id, const llvm::Twine &name = "")

load the init global param value

llvm::Value *createInitGlobalParamStore(const std::string &id, llvm::Value *value)

store the init global param value

llvm::Value *createGlobalParamLoad(const std::string &id, const llvm::Twine &name = "")

load the global param value

llvm::Value *createGlobalParamStore(const std::string &id, llvm::Value *value)

store the global param value

llvm::Value *createFloatSpeciesAmtLoad(const std::string &id, const llvm::Twine &name = "")

load the floating species amount value

llvm::Value *createFloatSpeciesAmtStore(const std::string &id, llvm::Value *value)

store the floating species amount

llvm::Value *createFloatSpeciesAmtRateGEP(const std::string &id, const llvm::Twine &name = "")

the GEP for the amount rates

llvm::Value *createFloatSpeciesAmtRateLoad(const std::string &id, const llvm::Twine &name = "")

load the floating species amount value

llvm::Value *createFloatSpeciesAmtRateStore(const std::string &id, llvm::Value *value)

store the floating species amount

llvm::Value *createBoundSpeciesAmtLoad(const std::string &id, const llvm::Twine &name = "")

load the floating species amount value

llvm::Value *createBoundSpeciesAmtStore(const std::string &id, llvm::Value *value)

store the floating species amount

llvm::Value *createReactionRateLoad(const std::string &id, const llvm::Twine &name = "")

load the floating species amount value

llvm::Value *createReactionRateStore(const std::string &id, llvm::Value *value)

store the floating species amount

llvm::Value *createRateRuleValueGEP(const std::string &id, const llvm::Twine &name = "")

rate rule GEP

llvm::Value *createRateRuleValueLoad(const std::string &id, const llvm::Twine &name = "")

load the rate rule value

llvm::Value *createRateRuleValueStore(const std::string &id, llvm::Value *value)

store the rate rule value

llvm::Value *createRateRuleRateGEP(const std::string &id, const llvm::Twine &name = "")

rate rule GEP

llvm::Value *createRateRuleRateLoad(const std::string &id, const llvm::Twine &name = "")

load the rate rule rate

llvm::Value *createRateRuleRateStore(const std::string &id, llvm::Value *value)

store the rate rule rate

llvm::Value *createStoichiometryStore(uint row, uint col, llvm::Value *value, const llvm::Twine &name = "")
llvm::Value *createStoichiometryLoad(uint row, uint col, const llvm::Twine &name = "")
llvm::Value *createRandomLoad()

pointer to ModelData::random field.

Public Static Functions

static llvm::CallInst *createCSRMatrixSetNZ(llvm::IRBuilder<>&, llvm::Value *csrPtr, llvm::Value *row, llvm::Value *col, llvm::Value *value, const llvm::Twine &name = "")

create a call to the csr_matrix_set_nz function.

only valid whilst a basic block is being filled.

static llvm::CallInst *createCSRMatrixGetNZ(llvm::IRBuilder<>&, llvm::Value *csrPtr, llvm::Value *row, llvm::Value *col, const llvm::Twine &name = "")

create a call to the csr_matrix_get_nz function.

only valid whilst a basic block is being filled.

static llvm::Function *getCSRMatrixSetNZDecl(llvm::Module *module)

get the function declaration (prototype) for the csr_matrix_set_nz function.

create if not found.

static llvm::Function *getCSRMatrixGetNZDecl(llvm::Module *module)

get the function declaration (prototype) for the csr_matrix_set_nz function.

create if not found

static llvm::StructType *getCSRSparseStructType(llvm::Module *module, llvm::ExecutionEngine *engine = 0)

get the struct type for the CSR sparse storage struct.

create if not found

static llvm::StructType *createModelDataStructType(llvm::Module *module, llvm::ExecutionEngine *engine, LLVMModelDataSymbols const &symbols)

Creates a ModelData struct for the given sbml symbols in the llvm Module.

This must be called before any model accessing code is generated.

static llvm::StructType *getStructType(llvm::Module *module)

get the ModelData struct type.

createModelDataStructType must have been called for this to work.

Throws an exception if the ModelData struct could not be obtained.

static unsigned getModelDataSize(llvm::Module *module, const llvm::DataLayout &dl)

Public Static Attributes

static const char *LLVMModelDataName = "rr_LLVMModelData"
static const char *csr_matrixName = "rr_csr_matrix"
static const char *csr_matrix_set_nzName = "csr_matrix_set_nz"
static const char *csr_matrix_get_nzName = "csr_matrix_get_nz"

Private Functions

void validateStruct(llvm::Value *s, const char *funcName)

check to see that s is a ModelData struct pointer, throw an exception if not.

Private Members

llvm::Value *modelData

the model data struct we generate the loads / stores relative to.

llvm::IRBuilder &builder
LLVMModelDataSymbols const &symbols

Private Static Functions

static llvm::Module *getModule(llvm::IRBuilder<> &builder, const char *func)

get the module, only valid whilst a BasicBlock is begin filled.

Parameters:
  • builder – the name of the calling function, used for generating exception

  • func – name of the calling function, used for generating exception on failure.

Returns:

a module on success, throws exeption on failure.

Friends

friend class LLVMModelDataIRBuilderTesting