11 #ifndef ModelDataIRBuilderH
12 #define ModelDataIRBuilderH
14 #include "LLVMIncludes.h"
15 #include "LLVMModelDataSymbols.h"
18 #include <llvm/IR/DataLayout.h>
40 llvm::Value* createFloatSpeciesAmtGEP(
const std::string&
id,
41 const llvm::Twine& name =
"");
43 llvm::Value* createBoundSpeciesAmtGEP(
const std::string&
id,
44 const llvm::Twine& name =
"");
46 llvm::Value* createGlobalParamGEP(
const std::string&
id);
53 llvm::Value*
createGEP(ModelDataFields field);
59 llvm::Value*
createGEP(ModelDataFields field,
unsigned index,
60 const llvm::Twine& name =
"");
62 llvm::Value* createLoad(ModelDataFields field,
unsigned index,
63 const llvm::Twine& name =
"");
65 llvm::Value* createStore(ModelDataFields field,
unsigned index,
66 llvm::Value* value,
const llvm::Twine& name =
"");
77 const llvm::Twine& name =
"");
89 const llvm::Twine& name =
"");
95 const llvm::Twine& name =
"");
101 const llvm::Twine& name =
"");
107 const llvm::Twine& name =
"");
125 const llvm::Twine& name =
"");
131 const llvm::Twine& name =
"");
144 const llvm::Twine& name =
"");
150 const llvm::Twine& name =
"");
162 const llvm::Twine& name =
"");
174 const llvm::Twine& name =
"");
186 const llvm::Twine& name =
"");
192 const llvm::Twine& name =
"");
204 const llvm::Twine& name =
"");
216 const llvm::Twine& name =
"");
228 const llvm::Twine& name =
"");
234 const llvm::Twine& name =
"");
246 const llvm::Twine& name =
"");
252 const llvm::Twine& name =
"");
260 llvm::Value* createStoichiometryStore(uint row, uint col,
261 llvm::Value* value,
const llvm::Twine& name =
"");
263 llvm::Value* createStoichiometryLoad(uint row, uint col,
264 const llvm::Twine& name =
"");
277 llvm::Value* csrPtr, llvm::Value* row, llvm::Value* col,
278 llvm::Value* value,
const llvm::Twine& name =
"");
286 llvm::Value* csrPtr, llvm::Value* row, llvm::Value* col,
287 const llvm::Twine& name =
"");
309 llvm::ExecutionEngine* engine = 0);
327 static llvm::StructType*
getStructType(llvm::Module* module);
329 static unsigned getModelDataSize(llvm::Module* module,
const llvm::DataLayout& dl);
331 static const char* LLVMModelDataName;
332 static const char* csr_matrixName;
333 static const char* csr_matrix_set_nzName;
334 static const char* csr_matrix_get_nzName;
340 llvm::Value* modelData;
342 llvm::IRBuilder<>& builder;
355 static llvm::Module* getModule(llvm::IRBuilder<>& builder,
const char* func);
361 void validateStruct(llvm::Value* s,
const char* funcName);
378 void createAccessors(llvm::Module* module);
380 std::pair<llvm::Function*, llvm::Function*> createFloatingSpeciesAccessors(
381 llvm::Module* module,
const std::string
id);
384 static llvm::Function* getDispIntDecl(llvm::Module* module);
385 llvm::CallInst* createDispInt(llvm::Value* intVal);
387 static llvm::Function* getDispDoubleDecl(llvm::Module* module);
388 llvm::CallInst* createDispDouble(llvm::Value* doubleVal);
390 static llvm::Function* getDispCharDecl(llvm::Module* module);
391 llvm::CallInst* createDispChar(llvm::Value* doubleVal);
396 llvm::IRBuilder<>& builder;
testing class
Definition: ModelDataIRBuilder.h:370
stores the names of all the symbols in the sbml model and thier indexes in the ModelData arrays.
Definition: LLVMModelDataSymbols.h:128
The model data IR builder.
Definition: ModelDataIRBuilder.h:32
llvm::Value * createInitCompStore(const std::string &id, llvm::Value *value)
store the compartment value
Definition: ModelDataIRBuilder.cpp:531
llvm::Value * createFloatSpeciesAmtStore(const std::string &id, llvm::Value *value)
store the floating species amount
Definition: ModelDataIRBuilder.cpp:285
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,...
llvm::Value * createInitFloatSpeciesAmtGEP(const std::string &id, const llvm::Twine &name="")
the GEP for a floating species initial amount
Definition: ModelDataIRBuilder.cpp:466
static llvm::StructType * getStructType(llvm::Module *module)
get the ModelData struct type.
Definition: ModelDataIRBuilder.cpp:731
llvm::Value * createCompGEP(const std::string &id)
the GEP for a compartment
Definition: ModelDataIRBuilder.cpp:418
llvm::Value * createInitBoundarySpeciesAmtLoad(const std::string &id, const llvm::Twine &name="")
load the boundary species initial amount value
Definition: ModelDataIRBuilder.cpp:493
llvm::Value * createRateRuleValueLoad(const std::string &id, const llvm::Twine &name="")
load the rate rule value
Definition: ModelDataIRBuilder.cpp:357
llvm::Value * createBoundSpeciesAmtLoad(const std::string &id, const llvm::Twine &name="")
load the floating species amount value
Definition: ModelDataIRBuilder.cpp:426
llvm::Value * createInitGlobalParamLoad(const std::string &id, const llvm::Twine &name="")
load the init global param value
Definition: ModelDataIRBuilder.cpp:548
llvm::Value * createInitFloatSpeciesAmtStore(const std::string &id, llvm::Value *value)
store the floating species initial value
Definition: ModelDataIRBuilder.cpp:500
static llvm::StructType * getCSRSparseStructType(llvm::Module *module, llvm::ExecutionEngine *engine=0)
get the struct type for the CSR sparse storage struct.
Definition: ModelDataIRBuilder.cpp:168
llvm::Value * createRateRuleRateStore(const std::string &id, llvm::Value *value)
store the rate rule rate
Definition: ModelDataIRBuilder.cpp:390
static llvm::Function * getCSRMatrixGetNZDecl(llvm::Module *module)
get the function declaration (prototype) for the csr_matrix_set_nz function.
Definition: ModelDataIRBuilder.cpp:237
llvm::Value * createInitCompLoad(const std::string &id, const llvm::Twine &name="")
load the compartment value
Definition: ModelDataIRBuilder.cpp:524
llvm::Value * createInitCompGEP(const std::string &id, const llvm::Twine &name="")
the GEP for a compartment
Definition: ModelDataIRBuilder.cpp:514
llvm::Value * createInitGlobalParamStore(const std::string &id, llvm::Value *value)
store the init global param value
Definition: ModelDataIRBuilder.cpp:555
llvm::Value * createFloatSpeciesAmtRateStore(const std::string &id, llvm::Value *value)
store the floating species amount
Definition: ModelDataIRBuilder.cpp:309
llvm::Value * createRateRuleValueStore(const std::string &id, llvm::Value *value)
store the rate rule value
Definition: ModelDataIRBuilder.cpp:365
llvm::Value * createRateRuleValueGEP(const std::string &id, const llvm::Twine &name="")
rate rule GEP
Definition: ModelDataIRBuilder.cpp:347
llvm::Value * createCompStore(const std::string &id, llvm::Value *value)
store the compartment value
Definition: ModelDataIRBuilder.cpp:411
static llvm::Function * getCSRMatrixSetNZDecl(llvm::Module *module)
get the function declaration (prototype) for the csr_matrix_set_nz function.
Definition: ModelDataIRBuilder.cpp:215
llvm::Value * createInitBoundarySpeciesAmtStore(const std::string &id, llvm::Value *value)
store the boundary species initial value
Definition: ModelDataIRBuilder.cpp:507
llvm::Value * createGEP(ModelDataFields field)
create a GEP for a ModelData structure field.
Definition: ModelDataIRBuilder.cpp:116
llvm::Value * createBoundSpeciesAmtStore(const std::string &id, llvm::Value *value)
store the floating species amount
Definition: ModelDataIRBuilder.cpp:433
llvm::Value * createInitBoundarySpeciesAmtGEP(const std::string &id, const llvm::Twine &name="")
the GEP for a boundary species initial amount
Definition: ModelDataIRBuilder.cpp:476
ModelDataIRBuilder(llvm::Value *modelData, LLVMModelDataSymbols const &, llvm::IRBuilder<> &)
these only make sense attached to a modelData pointer.
Definition: ModelDataIRBuilder.cpp:95
llvm::Value * createCompLoad(const std::string &id, const llvm::Twine &name="")
load the compartment value
Definition: ModelDataIRBuilder.cpp:404
llvm::Value * createReactionRateLoad(const std::string &id, const llvm::Twine &name="")
load the floating species amount value
Definition: ModelDataIRBuilder.cpp:562
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.
Definition: ModelDataIRBuilder.cpp:331
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.
Definition: ModelDataIRBuilder.cpp:631
llvm::Value * createFloatSpeciesAmtLoad(const std::string &id, const llvm::Twine &name="")
load the floating species amount value
Definition: ModelDataIRBuilder.cpp:278
llvm::Value * createInitFloatSpeciesAmtLoad(const std::string &id, const llvm::Twine &name="")
load the floating species initial amount value
Definition: ModelDataIRBuilder.cpp:486
llvm::Value * createFloatSpeciesAmtRateLoad(const std::string &id, const llvm::Twine &name="")
load the floating species amount value
Definition: ModelDataIRBuilder.cpp:302
llvm::Value * createRandomLoad()
pointer to ModelData::random field.
Definition: ModelDataIRBuilder.cpp:598
llvm::Value * createInitGlobalParamGEP(const std::string &id, const llvm::Twine &name="")
the GEP for a init global params
Definition: ModelDataIRBuilder.cpp:538
llvm::Value * createRateRuleRateLoad(const std::string &id, const llvm::Twine &name="")
load the rate rule rate
Definition: ModelDataIRBuilder.cpp:382
llvm::Value * createReactionRateStore(const std::string &id, llvm::Value *value)
store the floating species amount
Definition: ModelDataIRBuilder.cpp:569
llvm::Value * createRateRuleRateGEP(const std::string &id, const llvm::Twine &name="")
rate rule GEP
Definition: ModelDataIRBuilder.cpp:372
llvm::Value * createGlobalParamStore(const std::string &id, llvm::Value *value)
store the global param value
Definition: ModelDataIRBuilder.cpp:458
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.
Definition: ModelDataIRBuilder.cpp:258
llvm::Value * createFloatSpeciesAmtRateGEP(const std::string &id, const llvm::Twine &name="")
the GEP for the amount rates
Definition: ModelDataIRBuilder.cpp:292
llvm::Value * createGlobalParamLoad(const std::string &id, const llvm::Twine &name="")
load the global param value
Definition: ModelDataIRBuilder.cpp:449