roadrunner
2.0.5
Fast simulator for SBML models
llvm
ASTNodeCodeGen.h
1
/*
2
* ASTNodeCodeGen.h
3
*
4
* Created on: Jun 16, 2013
5
*
6
* Author: Andy Somogyi,
7
* email decode: V1 = "."; V2 = "@"; V3 = V1;
8
* andy V1 somogyi V2 gmail V3 com
9
*/
10
#ifndef ASTNodeCodeGenH
11
#define ASTNodeCodeGenH
12
13
#include "LLVMIncludes.h"
14
#include "CodeGen.h"
15
#include "ModelGeneratorContext.h"
16
17
namespace
libsbml
18
{
19
class
ASTNode;
20
}
21
22
namespace
rrllvm
23
{
27
class
ASTNodeCodeGen
28
{
29
public
:
30
ASTNodeCodeGen
(llvm::IRBuilder<> &builder,
31
LoadSymbolResolver
&resolver,
32
const
ModelGeneratorContext
& ctx,
33
llvm::Value *modelData);
34
~
ASTNodeCodeGen
();
35
36
llvm::Value *codeGen(
const
libsbml::ASTNode *ast);
37
private
:
38
44
llvm::Value *binaryExprCodeGen(
const
libsbml::ASTNode *ast);
45
46
llvm::Value *notImplemented(
const
libsbml::ASTNode *ast);
47
48
llvm::Value *delayExprCodeGen(
const
libsbml::ASTNode *ast);
49
50
llvm::Value *nameExprCodeGen(
const
libsbml::ASTNode *ast);
51
52
llvm::Value *realExprCodeGen(
const
libsbml::ASTNode *ast);
53
57
llvm::Value *distribCodeGen(
const
libsbml::ASTNode *ast);
58
59
65
llvm::Value *integerCodeGen(
const
libsbml::ASTNode *ast);
66
72
llvm::Value *applyArithmeticCodeGen(
const
libsbml::ASTNode *ast);
73
74
llvm::Value *minmaxCodeGen(
const
libsbml::ASTNode *ast);
75
76
// AHu: As of June'18, there is no difference between the two relation CodeGen
77
// functions, so I am refactoring this function to just take two arguments,
78
// and using it to be the only relational switch statement
79
llvm::Value *applyBinaryRelationalCodeGen(
const
libsbml::ASTNode *ast,
80
llvm::Value* left, llvm::Value* right);
81
82
// JKM: NOTE: Not SBML-compliant, needed for idiosyncrasies in some legacy JDesigner models
83
llvm::Value *applyScalarRelationalCodeGen(
const
libsbml::ASTNode *ast);
84
85
// Ahu: I made this just so that later we can have an interface for non-scalar relations
86
llvm::Value *applyRelationalCodeGen(
const
libsbml::ASTNode *ast);
87
88
llvm::Value *applyLogicalCodeGen(
const
libsbml::ASTNode *ast);
89
90
llvm::Value *functionCallCodeGen(
const
libsbml::ASTNode *ast);
91
92
llvm::Value *intrinsicCallCodeGen(
const
libsbml::ASTNode *ast);
93
94
llvm::Value *piecewiseCodeGen(
const
libsbml::ASTNode *ast);
95
101
llvm::Value *toBoolean(llvm::Value *value);
102
108
llvm::Value *toDouble(llvm::Value* value);
109
110
111
llvm::IRBuilder<> &builder;
112
LoadSymbolResolver
&resolver;
113
const
ModelGeneratorContext
& ctx;
114
llvm::Value *modelData;
115
124
llvm::Module *getModule();
125
126
bool
scalar_mode_;
127
128
friend
class
ASTNodeCodeGenScalarTicket
;
129
};
130
131
std::string to_string(
const
libsbml::ASTNode *ast);
132
133
class
ASTNodeCodeGenScalarTicket
{
134
public
:
135
ASTNodeCodeGenScalarTicket
(
ASTNodeCodeGen
& gen,
bool
val, std::string n =
""
);
136
137
~
ASTNodeCodeGenScalarTicket
();
138
139
private
:
140
ASTNodeCodeGen
& z_;
141
bool
v_;
142
std::string nCols_;
143
};
144
145
}
/* namespace rr */
146
147
#endif
/* ASTNodeCodeGenH */
rrllvm::ModelGeneratorContext
All LLVM code generating objects basically need at a minimum three things to operate:
Definition:
ModelGeneratorContext.h:90
rrllvm::LoadSymbolResolver
Definition:
CodeGen.h:31
rrllvm::ASTNodeCodeGen
All of the LLVM IR generation is handled here.
Definition:
ASTNodeCodeGen.h:28
rrllvm::ASTNodeCodeGenScalarTicket
Definition:
ASTNodeCodeGen.h:133
Generated by
1.8.20