ASTNodeCodeGen

class ASTNodeCodeGen

All of the LLVM IR generation is handled here.

Public Functions

ASTNodeCodeGen(llvm::IRBuilder<> &builder, LoadSymbolResolver &resolver, const ModelGeneratorContext &ctx, llvm::Value *modelData)
~ASTNodeCodeGen()
llvm::Value *codeGenDouble(const libsbml::ASTNode *ast)
llvm::Value *codeGenBoolean(const libsbml::ASTNode *ast)

Private Functions

llvm::Value *codeGen(const libsbml::ASTNode *ast)
llvm::Value *binaryExprCodeGen(const libsbml::ASTNode *ast)

sbml ASTNode does not contain as assigment ‘=’ type, assigment is handled by other sbml elements such as initialAssigment.

llvm::Value *notImplemented(const libsbml::ASTNode *ast)
llvm::Value *delayExprCodeGen(const libsbml::ASTNode *ast)
llvm::Value *rateOfCodeGen(const libsbml::ASTNode *ast)
llvm::Value *nameExprCodeGen(const libsbml::ASTNode *ast)
llvm::Value *realExprCodeGen(const libsbml::ASTNode *ast)
llvm::Value *distribCodeGen(const libsbml::ASTNode *ast)

Support new AST nodes for distributions.

llvm::Value *integerCodeGen(const libsbml::ASTNode *ast)

for now, just convert to double,

TODO: is this right???

llvm::Value *applyArithmeticCodeGen(const libsbml::ASTNode *ast)

would have made the most sense using templated pointer to a IRBuilder member function, but many compilers seem to have trouble with such templates.

llvm::Value *minmaxCodeGen(const libsbml::ASTNode *ast)
llvm::Value *applyBinaryRelationalCodeGen(const libsbml::ASTNode *ast, llvm::Value *left, llvm::Value *right)
llvm::Value *applyScalarRelationalCodeGen(const libsbml::ASTNode *ast)
llvm::Value *applyRelationalCodeGen(const libsbml::ASTNode *ast)
llvm::Value *applyLogicalCodeGen(const libsbml::ASTNode *ast)
llvm::Value *functionCallCodeGen(const libsbml::ASTNode *ast)
llvm::Value *intrinsicCallCodeGen(const libsbml::ASTNode *ast)
llvm::Value *piecewiseCodeGen(const libsbml::ASTNode *ast)
llvm::Value *toBoolean(llvm::Value *value)

coerces a value to a boolean single bit.

If value is already a boolean, it is unchanged.

llvm::Value *toDouble(llvm::Value *value)

coerces a value to a double

If value is already a double, it is unchanged.

llvm::Module *getModule()

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

Parameters:

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

Returns:

a module on success, throws exeption on failure.

Private Members

llvm::IRBuilder &builder
LoadSymbolResolver &resolver
const ModelGeneratorContext &ctx
llvm::Value *modelData
bool scalar_mode_

Friends

friend class ASTNodeCodeGenScalarTicket