roadrunner  2.6.0
Fast simulator for SBML models
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
rrllvm::LoadSymbolResolverBase Class Reference

provide common sbml model functionality to three kinds of resolvers. More...

#include <LoadSymbolResolverBase.h>

Inheritance diagram for rrllvm::LoadSymbolResolverBase:
rrllvm::LoadSymbolResolver rrllvm::SBMLInitialValueSymbolResolver

Public Member Functions

llvm::Value * loadReactionRate (const libsbml::Reaction *)
 shortcut to get a reaction rate, performance wise, quicker than going through all the loadSymbolValue types.
 
void recursiveSymbolPush (const std::string &symbol) override
 
void recursiveSymbolPop () override
 
virtual bool isLocalParameter (const std::string &symbol) override
 
void flushCache ()
 Flush the symbol cache. More...
 
size_t pushCacheBlock () override
 nested conditionals (or functions?) can push a local cache block, where symbols would be chached. More...
 
size_t popCacheBlock () override
 Pop a scoped cache block, this clears these values, and any subsequent reads re-evaluate the requested symbol. More...
 
- Public Member Functions inherited from rrllvm::LoadSymbolResolver
virtual llvm::Value * loadSymbolValue (const std::string &symbol, const llvm::ArrayRef< llvm::Value * > &args=llvm::ArrayRef< llvm::Value * >())=0
 generate an LLVM load instruction. More...
 

Protected Types

typedef std::list< std::string > StringStack
 
typedef std::unordered_map< std::string, llvm::Value * > ValueMap
 
typedef std::deque< ValueMap > ValueMapStack
 

Protected Member Functions

 LoadSymbolResolverBase (const ModelGeneratorContext &ctx, llvm::Value *modelData)
 
llvm::Value * cacheValue (const std::string &symbol, const llvm::ArrayRef< llvm::Value * > &args, llvm::Value *value=nullptr)
 check in the symbol cache if the symbol exists, if so return it. More...
 

Protected Attributes

const ModelGeneratorContextmodelGenContext
 
const libsbml::Model * model
 
const LLVMModelDataSymbolsmodelDataSymbols
 
const LLVMModelSymbolsmodelSymbols
 
llvm::IRBuilder & builder
 
llvm::Value * modelData
 
StringStack symbolStack
 
ValueMapStack symbolCache
 

Detailed Description

provide common sbml model functionality to three kinds of resolvers.

This has common functionality such as dealing with sbml elements such as reactions, species and so forth.

Member Function Documentation

◆ cacheValue()

llvm::Value * rrllvm::LoadSymbolResolverBase::cacheValue ( const std::string &  symbol,
const llvm::ArrayRef< llvm::Value * > &  args,
llvm::Value *  value = nullptr 
)
protected

check in the symbol cache if the symbol exists, if so return it.

If the value is not NULL, it is cached and returned.

Cached function args not currently supported (just return NULL).

◆ flushCache()

void rrllvm::LoadSymbolResolverBase::flushCache ( )

Flush the symbol cache.

This is required in branches and switch blocks as a symbol used in a previous block can not be re-used in the current block.

◆ popCacheBlock()

size_t rrllvm::LoadSymbolResolverBase::popCacheBlock ( )
overridevirtual

Pop a scoped cache block, this clears these values, and any subsequent reads re-evaluate the requested symbol.

Will throw an exception if an empty stack pop is attempted.

Reimplemented from rrllvm::LoadSymbolResolver.

◆ pushCacheBlock()

size_t rrllvm::LoadSymbolResolverBase::pushCacheBlock ( )
overridevirtual

nested conditionals (or functions?) can push a local cache block, where symbols would be chached.

These need to be popped as these symbols are not valid outside of the local conditional or scope block.

Reimplemented from rrllvm::LoadSymbolResolver.


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