roadrunner  2.6.0
Fast simulator for SBML models
CodeGen.h
1 /*
2  * CodeGen.h
3  *
4  * Created on: Jul 2, 2013
5  * Author: andy
6  */
7 
8 #ifndef CodeGenH
9 #define CodeGenH
10 
11 #include "LLVMIncludes.h"
12 #include <stack>
13 #include <string>
14 
15 namespace rrllvm
16 {
20  class CodeGen
21  {
22  public:
23  virtual llvm::Value* codeGen() = 0;
24  protected:
25  ~CodeGen() = default;;
26  };
27 
31 #define SBML_TIME_SYMBOL "\\time"
32 
37  {
38  public:
45  virtual llvm::Value* loadSymbolValue(
46  const std::string& symbol,
47  const llvm::ArrayRef<llvm::Value*>& args = llvm::ArrayRef<llvm::Value*>()) = 0;
48 
49  virtual void recursiveSymbolPush(const std::string& symbol) = 0;
50 
51  virtual void recursiveSymbolPop() = 0;
52 
53  virtual bool isLocalParameter(const std::string& symbol) = 0;
54 
60  virtual size_t pushCacheBlock() { return 0; }
61 
68  virtual size_t popCacheBlock() { return 0; }
69 
70  protected:
71 
72  virtual ~LoadSymbolResolver() {};
73  };
74 
79  {
80  public:
81  virtual llvm::Value* storeSymbolValue(const std::string& symbol,
82  llvm::Value* value) = 0;
83 
84  protected:
85  ~StoreSymbolResolver() {};
86  };
87 
88 
89 
90 } /* namespace rr */
91 #endif /* LLVMCodeGenH */
Base class for code generation.
Definition: CodeGen.h:21
LLVM load instruction class.
Definition: CodeGen.h:37
virtual size_t popCacheBlock()
Pop a scoped cache block, this clears these values, and any subsequent reads re-evaluate the requeste...
Definition: CodeGen.h:68
virtual size_t pushCacheBlock()
nested conditionals (or functions?) can push a local cache block, where symbols would be chached.
Definition: CodeGen.h:60
virtual llvm::Value * loadSymbolValue(const std::string &symbol, const llvm::ArrayRef< llvm::Value * > &args=llvm::ArrayRef< llvm::Value * >())=0
generate an LLVM load instruction.
LLVM store symbol class.
Definition: CodeGen.h:79