Skip to content

Latest commit

 

History

History
22227 lines (22227 loc) · 1.23 MB

HISTORY.md

File metadata and controls

22227 lines (22227 loc) · 1.23 MB

-The LLVM backend and refactoring of the core was designed and undertaken by option (BUILD_LLVM "Build the LLVM back end" ON)

should we use LLVM ?

option (BUILD_LLVM "Build the LLVM back end" ON) @@ -81,7 +92,6 @@ if(BUILD_LLVM AND NOT LLVM_FOUND) message(STATUS "NOT using LLVM") endif(BUILD_LLVM)

  • * Only used in the LLVM version.
    
  • * In the LLVM version, this is just a pointer to a data block
    
  • * LLVM specific
    

-#if defined(BUILD_LLVM) -#include "llvm/LLVMModelGenerator.h" -#include "llvm/LLVMCompiler.h" -#if defined(BUILD_LLVM)

  • return "LLVM";
  • return new rrllvm::LLVMCompiler();
  • return rrllvm::LLVMModelGenerator::createModel(sbml, opt.modelGeneratorOpt); -#if defined(BUILD_LLVM) && !defined(BUILD_LEGACY_C)
  • Log(Logger::LOG_INFORMATION) << "Creating LLVM based model generator.";
  • return new rrllvm::LLVMModelGenerator(); -#if defined(BUILD_LLVM) && defined(BUILD_LEGACY_C)
  • if (ucomp == "LLVM")
  •    Log(Logger::LOG_INFORMATION) << "Creating LLVM based model generator.";
    
  •    return new rrllvm::LLVMModelGenerator();
    

-#if !defined(BUILD_LLVM) && defined(BUILD_LEGACY_C) -#if !defined(BUILD_LLVM) && !defined(BUILD_LEGACY_C) -#error Must built at least one ModelGenerator backend, either BUILD_LLVM or BUILD_LEGACY_C

  • * Only used in the LLVM version.
    
  • * In the LLVM version, this is just a pointer to a data block
    
  • * LLVM specific
    

@@ -133,36 +133,13 @@ if(BUILD_LLVM) endif(BUILD_LLVM) ${LLVM_LIBRARIES} endif(BUILD_LLVM) if(BUILD_LLVM)

  •    ${LLVM_LIBRARIES}
    
  • target_link_libraries(${target}-static ${LLVM_LIBRARIES}) endif(BUILD_LLVM)
  • if(BUILD_LLVM)
  •    add_subdirectory(llvm_testing)
    
  • endif(BUILD_LLVM)
  • if(BUILD_LLVM)
  • add_subdirectory(llvm_testing)
  • endif(BUILD_LLVM) +#if defined(BUILD_LLVM) +#include "llvm/LLVMModelGenerator.h" +#include "llvm/LLVMCompiler.h" +#if defined(BUILD_LLVM)
  • return "LLVM";
  • return new rrllvm::LLVMCompiler();
  • return rrllvm::LLVMModelGenerator::createModel(sbml, opt.modelGeneratorOpt); +#include "llvm/LLVMModelDataSymbols.h" diff --git a/source/llvm_testing/run_cpp_tests.sh b/src/fbc_testing/run_cpp_tests.sh rename from source/llvm_testing/run_cpp_tests.sh diff --git a/source/llvm_testing/src/Args.cpp b/src/fbc_testing/src/Args.cpp rename from source/llvm_testing/src/Args.cpp diff --git a/source/llvm_testing/src/Args.h b/src/fbc_testing/src/Args.h rename from source/llvm_testing/src/Args.h diff --git a/source/llvm_testing/src/CSRMatrixTest.cpp b/src/fbc_testing/src/CSRMatrixTest.cpp rename from source/llvm_testing/src/CSRMatrixTest.cpp diff --git a/source/llvm_testing/src/CSRMatrixTest.h b/src/fbc_testing/src/CSRMatrixTest.h rename from source/llvm_testing/src/CSRMatrixTest.h diff --git a/source/llvm_testing/src/ConfigurableTest.cpp b/src/fbc_testing/src/ConfigurableTest.cpp rename from source/llvm_testing/src/ConfigurableTest.cpp --- a/source/llvm_testing/src/ConfigurableTest.cpp diff --git a/source/llvm_testing/src/ConfigurableTest.h b/src/fbc_testing/src/ConfigurableTest.h rename from source/llvm_testing/src/ConfigurableTest.h diff --git a/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp b/src/fbc_testing/src/GetBoundarySpeciesAmountTest.cpp rename from source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp diff --git a/source/llvm_testing/src/GetBoundarySpeciesAmountTest.h b/src/fbc_testing/src/GetBoundarySpeciesAmountTest.h rename from source/llvm_testing/src/GetBoundarySpeciesAmountTest.h diff --git a/source/llvm_testing/src/LLVMCSRMatrixTest.cpp b/src/fbc_testing/src/LLVMCSRMatrixTest.cpp rename from source/llvm_testing/src/LLVMCSRMatrixTest.cpp rename to src/fbc_testing/src/LLVMCSRMatrixTest.cpp diff --git a/source/llvm_testing/src/LLVMCSRMatrixTest.h b/src/fbc_testing/src/LLVMCSRMatrixTest.h rename from source/llvm_testing/src/LLVMCSRMatrixTest.h rename to src/fbc_testing/src/LLVMCSRMatrixTest.h diff --git a/source/llvm_testing/src/TestBase.h b/src/fbc_testing/src/TestBase.h rename from source/llvm_testing/src/TestBase.h diff --git a/source/llvm_testing/src/TestCapabilities.h b/src/fbc_testing/src/TestCapabilities.h rename from source/llvm_testing/src/TestCapabilities.h diff --git a/source/llvm_testing/src/TestEvalInitialConditions.cpp b/src/fbc_testing/src/TestEvalInitialConditions.cpp rename from source/llvm_testing/src/TestEvalInitialConditions.cpp diff --git a/source/llvm_testing/src/TestEvalInitialConditions.h b/src/fbc_testing/src/TestEvalInitialConditions.h rename from source/llvm_testing/src/TestEvalInitialConditions.h diff --git a/source/llvm_testing/src/TestEvalModel.cpp b/src/fbc_testing/src/TestEvalModel.cpp rename from source/llvm_testing/src/TestEvalModel.cpp diff --git a/source/llvm_testing/src/TestEvalModel.h b/src/fbc_testing/src/TestEvalModel.h rename from source/llvm_testing/src/TestEvalModel.h diff --git a/source/llvm_testing/src/TestEvalReactionRates.cpp b/src/fbc_testing/src/TestEvalReactionRates.cpp rename from source/llvm_testing/src/TestEvalReactionRates.cpp --- a/source/llvm_testing/src/TestEvalReactionRates.cpp diff --git a/source/llvm_testing/src/TestEvalReactionRates.h b/src/fbc_testing/src/TestEvalReactionRates.h rename from source/llvm_testing/src/TestEvalReactionRates.h diff --git a/source/llvm_testing/src/TestGetSetValues.cpp b/src/fbc_testing/src/TestGetSetValues.cpp rename from source/llvm_testing/src/TestGetSetValues.cpp diff --git a/source/llvm_testing/src/TestGetSetValues.h b/src/fbc_testing/src/TestGetSetValues.h rename from source/llvm_testing/src/TestGetSetValues.h diff --git a/source/llvm_testing/src/TestPluginManager.h b/src/fbc_testing/src/TestPluginManager.h rename from source/llvm_testing/src/TestPluginManager.h diff --git a/source/llvm_testing/src/TestVariant.h b/src/fbc_testing/src/TestVariant.h rename from source/llvm_testing/src/TestVariant.h diff --git a/source/llvm_testing/src/cpplapack.cpp b/src/fbc_testing/src/cpplapack.cpp rename from source/llvm_testing/src/cpplapack.cpp diff --git a/source/llvm_testing/src/cpplapack.h b/src/fbc_testing/src/cpplapack.h rename from source/llvm_testing/src/cpplapack.h diff --git a/source/llvm_testing/src/rrTestUtils.cpp b/src/fbc_testing/src/rrTestUtils.cpp rename from source/llvm_testing/src/rrTestUtils.cpp diff --git a/source/llvm_testing/src/rrTestUtils.h b/src/fbc_testing/src/rrTestUtils.h rename from source/llvm_testing/src/rrTestUtils.h diff --git a/source/llvm_testing/src/test_compiler.cpp b/src/fbc_testing/src/test_compiler.cpp rename from source/llvm_testing/src/test_compiler.cpp diff --git a/source/llvm_testing/src/test_compiler.h b/src/fbc_testing/src/test_compiler.h rename from source/llvm_testing/src/test_compiler.h diff --git a/source/llvm_testing/src/tests.cpp b/src/fbc_testing/src/tests.cpp rename from source/llvm_testing/src/tests.cpp diff --git a/source/llvm_testing/src/tests.h b/src/fbc_testing/src/tests.h rename from source/llvm_testing/src/tests.h diff --git a/source/llvm/ASTNodeCodeGen.cpp b/src/llvm/ASTNodeCodeGen.cpp rename from source/llvm/ASTNodeCodeGen.cpp rename to src/llvm/ASTNodeCodeGen.cpp diff --git a/source/llvm/ASTNodeCodeGen.h b/src/llvm/ASTNodeCodeGen.h rename from source/llvm/ASTNodeCodeGen.h rename to src/llvm/ASTNodeCodeGen.h diff --git a/source/llvm/ASTNodeFactory.cpp b/src/llvm/ASTNodeFactory.cpp rename from source/llvm/ASTNodeFactory.cpp rename to src/llvm/ASTNodeFactory.cpp diff --git a/source/llvm/ASTNodeFactory.h b/src/llvm/ASTNodeFactory.h rename from source/llvm/ASTNodeFactory.h rename to src/llvm/ASTNodeFactory.h diff --git a/source/llvm/AssignmentRuleEvaluator.cpp b/src/llvm/AssignmentRuleEvaluator.cpp rename from source/llvm/AssignmentRuleEvaluator.cpp rename to src/llvm/AssignmentRuleEvaluator.cpp diff --git a/source/llvm/AssignmentRuleEvaluator.h b/src/llvm/AssignmentRuleEvaluator.h rename from source/llvm/AssignmentRuleEvaluator.h rename to src/llvm/AssignmentRuleEvaluator.h diff --git a/source/llvm/CodeGen.h b/src/llvm/CodeGen.h rename from source/llvm/CodeGen.h rename to src/llvm/CodeGen.h diff --git a/source/llvm/CodeGenBase.cpp b/src/llvm/CodeGenBase.cpp rename from source/llvm/CodeGenBase.cpp rename to src/llvm/CodeGenBase.cpp diff --git a/source/llvm/CodeGenBase.h b/src/llvm/CodeGenBase.h rename from source/llvm/CodeGenBase.h rename to src/llvm/CodeGenBase.h diff --git a/source/llvm/DistribFunctionResolver.cpp b/src/llvm/DistribFunctionResolver.cpp rename from source/llvm/DistribFunctionResolver.cpp rename to src/llvm/DistribFunctionResolver.cpp diff --git a/source/llvm/DistribFunctionResolver.h b/src/llvm/DistribFunctionResolver.h rename from source/llvm/DistribFunctionResolver.h rename to src/llvm/DistribFunctionResolver.h diff --git a/source/llvm/EvalConversionFactorCodeGen.cpp b/src/llvm/EvalConversionFactorCodeGen.cpp rename from source/llvm/EvalConversionFactorCodeGen.cpp rename to src/llvm/EvalConversionFactorCodeGen.cpp diff --git a/source/llvm/EvalConversionFactorCodeGen.h b/src/llvm/EvalConversionFactorCodeGen.h rename from source/llvm/EvalConversionFactorCodeGen.h rename to src/llvm/EvalConversionFactorCodeGen.h diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/src/llvm/EvalInitialConditionsCodeGen.cpp rename from source/llvm/EvalInitialConditionsCodeGen.cpp rename to src/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/src/llvm/EvalInitialConditionsCodeGen.cpp diff --git a/source/llvm/EvalInitialConditionsCodeGen.h b/src/llvm/EvalInitialConditionsCodeGen.h rename from source/llvm/EvalInitialConditionsCodeGen.h rename to src/llvm/EvalInitialConditionsCodeGen.h diff --git a/source/llvm/EvalRateRuleRatesCodeGen.cpp b/src/llvm/EvalRateRuleRatesCodeGen.cpp rename from source/llvm/EvalRateRuleRatesCodeGen.cpp rename to src/llvm/EvalRateRuleRatesCodeGen.cpp diff --git a/source/llvm/EvalRateRuleRatesCodeGen.h b/src/llvm/EvalRateRuleRatesCodeGen.h rename from source/llvm/EvalRateRuleRatesCodeGen.h rename to src/llvm/EvalRateRuleRatesCodeGen.h diff --git a/source/llvm/EvalReactionRatesCodeGen.cpp b/src/llvm/EvalReactionRatesCodeGen.cpp rename from source/llvm/EvalReactionRatesCodeGen.cpp rename to src/llvm/EvalReactionRatesCodeGen.cpp diff --git a/source/llvm/EvalReactionRatesCodeGen.h b/src/llvm/EvalReactionRatesCodeGen.h rename from source/llvm/EvalReactionRatesCodeGen.h rename to src/llvm/EvalReactionRatesCodeGen.h diff --git a/source/llvm/EvalVolatileStoichCodeGen.cpp b/src/llvm/EvalVolatileStoichCodeGen.cpp rename from source/llvm/EvalVolatileStoichCodeGen.cpp rename to src/llvm/EvalVolatileStoichCodeGen.cpp diff --git a/source/llvm/EvalVolatileStoichCodeGen.h b/src/llvm/EvalVolatileStoichCodeGen.h rename from source/llvm/EvalVolatileStoichCodeGen.h rename to src/llvm/EvalVolatileStoichCodeGen.h diff --git a/source/llvm/EventAssignCodeGen.cpp b/src/llvm/EventAssignCodeGen.cpp rename from source/llvm/EventAssignCodeGen.cpp rename to src/llvm/EventAssignCodeGen.cpp diff --git a/source/llvm/EventAssignCodeGen.h b/src/llvm/EventAssignCodeGen.h rename from source/llvm/EventAssignCodeGen.h rename to src/llvm/EventAssignCodeGen.h diff --git a/source/llvm/EventCodeGenBase.h b/src/llvm/EventCodeGenBase.h rename from source/llvm/EventCodeGenBase.h rename to src/llvm/EventCodeGenBase.h diff --git a/source/llvm/EventQueue.cpp b/src/llvm/EventQueue.cpp rename from source/llvm/EventQueue.cpp rename to src/llvm/EventQueue.cpp diff --git a/source/llvm/EventQueue.h b/src/llvm/EventQueue.h rename from source/llvm/EventQueue.h rename to src/llvm/EventQueue.h diff --git a/source/llvm/EventTriggerCodeGen.cpp b/src/llvm/EventTriggerCodeGen.cpp rename from source/llvm/EventTriggerCodeGen.cpp rename to src/llvm/EventTriggerCodeGen.cpp diff --git a/source/llvm/EventTriggerCodeGen.h b/src/llvm/EventTriggerCodeGen.h rename from source/llvm/EventTriggerCodeGen.h rename to src/llvm/EventTriggerCodeGen.h diff --git a/source/llvm/FunctionResolver.cpp b/src/llvm/FunctionResolver.cpp rename from source/llvm/FunctionResolver.cpp rename to src/llvm/FunctionResolver.cpp diff --git a/source/llvm/FunctionResolver.h b/src/llvm/FunctionResolver.h rename from source/llvm/FunctionResolver.h rename to src/llvm/FunctionResolver.h diff --git a/source/llvm/GetEventValuesCodeGen.cpp b/src/llvm/GetEventValuesCodeGen.cpp rename from source/llvm/GetEventValuesCodeGen.cpp rename to src/llvm/GetEventValuesCodeGen.cpp diff --git a/source/llvm/GetEventValuesCodeGen.h b/src/llvm/GetEventValuesCodeGen.h rename from source/llvm/GetEventValuesCodeGen.h rename to src/llvm/GetEventValuesCodeGen.h diff --git a/source/llvm/GetInitialValueCodeGenBase.h b/src/llvm/GetInitialValueCodeGenBase.h rename from source/llvm/GetInitialValueCodeGenBase.h rename to src/llvm/GetInitialValueCodeGenBase.h diff --git a/source/llvm/GetInitialValuesCodeGen.cpp b/src/llvm/GetInitialValuesCodeGen.cpp rename from source/llvm/GetInitialValuesCodeGen.cpp rename to src/llvm/GetInitialValuesCodeGen.cpp diff --git a/source/llvm/GetInitialValuesCodeGen.h b/src/llvm/GetInitialValuesCodeGen.h rename from source/llvm/GetInitialValuesCodeGen.h rename to src/llvm/GetInitialValuesCodeGen.h diff --git a/source/llvm/GetValueCodeGenBase.h b/src/llvm/GetValueCodeGenBase.h rename from source/llvm/GetValueCodeGenBase.h rename to src/llvm/GetValueCodeGenBase.h diff --git a/source/llvm/GetValuesCodeGen.cpp b/src/llvm/GetValuesCodeGen.cpp rename from source/llvm/GetValuesCodeGen.cpp rename to src/llvm/GetValuesCodeGen.cpp diff --git a/source/llvm/GetValuesCodeGen.h b/src/llvm/GetValuesCodeGen.h rename from source/llvm/GetValuesCodeGen.h rename to src/llvm/GetValuesCodeGen.h diff --git a/source/llvm/KineticLawParameterResolver.cpp b/src/llvm/KineticLawParameterResolver.cpp rename from source/llvm/KineticLawParameterResolver.cpp rename to src/llvm/KineticLawParameterResolver.cpp diff --git a/source/llvm/KineticLawParameterResolver.h b/src/llvm/KineticLawParameterResolver.h rename from source/llvm/KineticLawParameterResolver.h rename to src/llvm/KineticLawParameterResolver.h diff --git a/source/llvm/LLVMCompiler.cpp b/src/llvm/LLVMCompiler.cpp rename from source/llvm/LLVMCompiler.cpp rename to src/llvm/LLVMCompiler.cpp diff --git a/source/llvm/LLVMCompiler.h b/src/llvm/LLVMCompiler.h rename from source/llvm/LLVMCompiler.h rename to src/llvm/LLVMCompiler.h diff --git a/source/llvm/LLVMException.h b/src/llvm/LLVMException.h rename from source/llvm/LLVMException.h rename to src/llvm/LLVMException.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/src/llvm/LLVMExecutableModel.cpp rename from source/llvm/LLVMExecutableModel.cpp rename to src/llvm/LLVMExecutableModel.cpp diff --git a/source/llvm/LLVMExecutableModel.h b/src/llvm/LLVMExecutableModel.h rename from source/llvm/LLVMExecutableModel.h rename to src/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMIncludes.h b/src/llvm/LLVMIncludes.h rename from source/llvm/LLVMIncludes.h rename to src/llvm/LLVMIncludes.h diff --git a/source/llvm/LLVMModelData.cpp b/src/llvm/LLVMModelData.cpp rename from source/llvm/LLVMModelData.cpp rename to src/llvm/LLVMModelData.cpp diff --git a/source/llvm/LLVMModelData.h b/src/llvm/LLVMModelData.h rename from source/llvm/LLVMModelData.h rename to src/llvm/LLVMModelData.h diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/src/llvm/LLVMModelDataSymbols.cpp rename from source/llvm/LLVMModelDataSymbols.cpp rename to src/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/src/llvm/LLVMModelDataSymbols.cpp
  • LLVMModelDataSymbols.cpp diff --git a/source/llvm/LLVMModelDataSymbols.h b/src/llvm/LLVMModelDataSymbols.h rename from source/llvm/LLVMModelDataSymbols.h rename to src/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMModelGenerator.cpp b/src/llvm/LLVMModelGenerator.cpp rename from source/llvm/LLVMModelGenerator.cpp rename to src/llvm/LLVMModelGenerator.cpp diff --git a/source/llvm/LLVMModelGenerator.h b/src/llvm/LLVMModelGenerator.h rename from source/llvm/LLVMModelGenerator.h rename to src/llvm/LLVMModelGenerator.h --- a/source/llvm/LLVMModelGenerator.h +++ b/src/llvm/LLVMModelGenerator.h #ifndef rrLLVMModelGeneratorH #define rrLLVMModelGeneratorH #include "LLVMCompiler.h" diff --git a/source/llvm/LLVMModelSymbols.cpp b/src/llvm/LLVMModelSymbols.cpp rename from source/llvm/LLVMModelSymbols.cpp rename to src/llvm/LLVMModelSymbols.cpp diff --git a/source/llvm/LLVMModelSymbols.h b/src/llvm/LLVMModelSymbols.h rename from source/llvm/LLVMModelSymbols.h rename to src/llvm/LLVMModelSymbols.h diff --git a/source/llvm/LoadSymbolResolverBase.cpp b/src/llvm/LoadSymbolResolverBase.cpp rename from source/llvm/LoadSymbolResolverBase.cpp rename to src/llvm/LoadSymbolResolverBase.cpp diff --git a/source/llvm/LoadSymbolResolverBase.h b/src/llvm/LoadSymbolResolverBase.h rename from source/llvm/LoadSymbolResolverBase.h rename to src/llvm/LoadSymbolResolverBase.h diff --git a/source/llvm/ModelDataIRBuilder.cpp b/src/llvm/ModelDataIRBuilder.cpp rename from source/llvm/ModelDataIRBuilder.cpp rename to src/llvm/ModelDataIRBuilder.cpp diff --git a/source/llvm/ModelDataIRBuilder.h b/src/llvm/ModelDataIRBuilder.h rename from source/llvm/ModelDataIRBuilder.h rename to src/llvm/ModelDataIRBuilder.h diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/src/llvm/ModelDataSymbolResolver.cpp rename from source/llvm/ModelDataSymbolResolver.cpp rename to src/llvm/ModelDataSymbolResolver.cpp diff --git a/source/llvm/ModelDataSymbolResolver.h b/src/llvm/ModelDataSymbolResolver.h rename from source/llvm/ModelDataSymbolResolver.h rename to src/llvm/ModelDataSymbolResolver.h diff --git a/source/llvm/ModelGeneratorContext.cpp b/src/llvm/ModelGeneratorContext.cpp rename from source/llvm/ModelGeneratorContext.cpp rename to src/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/src/llvm/ModelGeneratorContext.cpp diff --git a/source/llvm/ModelGeneratorContext.h b/src/llvm/ModelGeneratorContext.h rename from source/llvm/ModelGeneratorContext.h rename to src/llvm/ModelGeneratorContext.h diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/src/llvm/ModelInitialValueSymbolResolver.cpp rename from source/llvm/ModelInitialValueSymbolResolver.cpp rename to src/llvm/ModelInitialValueSymbolResolver.cpp diff --git a/source/llvm/ModelInitialValueSymbolResolver.h b/src/llvm/ModelInitialValueSymbolResolver.h rename from source/llvm/ModelInitialValueSymbolResolver.h rename to src/llvm/ModelInitialValueSymbolResolver.h diff --git a/source/llvm/ModelResources.cpp b/src/llvm/ModelResources.cpp rename from source/llvm/ModelResources.cpp rename to src/llvm/ModelResources.cpp diff --git a/source/llvm/ModelResources.h b/src/llvm/ModelResources.h rename from source/llvm/ModelResources.h rename to src/llvm/ModelResources.h diff --git a/source/llvm/Random.cpp b/src/llvm/Random.cpp rename from source/llvm/Random.cpp rename to src/llvm/Random.cpp diff --git a/source/llvm/Random.h b/src/llvm/Random.h rename from source/llvm/Random.h rename to src/llvm/Random.h diff --git a/source/llvm/SBMLInitialValueSymbolResolver.cpp b/src/llvm/SBMLInitialValueSymbolResolver.cpp rename from source/llvm/SBMLInitialValueSymbolResolver.cpp rename to src/llvm/SBMLInitialValueSymbolResolver.cpp diff --git a/source/llvm/SBMLInitialValueSymbolResolver.h b/src/llvm/SBMLInitialValueSymbolResolver.h rename from source/llvm/SBMLInitialValueSymbolResolver.h rename to src/llvm/SBMLInitialValueSymbolResolver.h diff --git a/source/llvm/SBMLSupportFunctions.cpp b/src/llvm/SBMLSupportFunctions.cpp rename from source/llvm/SBMLSupportFunctions.cpp rename to src/llvm/SBMLSupportFunctions.cpp diff --git a/source/llvm/SBMLSupportFunctions.h b/src/llvm/SBMLSupportFunctions.h rename from source/llvm/SBMLSupportFunctions.h rename to src/llvm/SBMLSupportFunctions.h diff --git a/source/llvm/SetInitialValueCodeGenBase.h b/src/llvm/SetInitialValueCodeGenBase.h rename from source/llvm/SetInitialValueCodeGenBase.h rename to src/llvm/SetInitialValueCodeGenBase.h diff --git a/source/llvm/SetInitialValuesCodeGen.cpp b/src/llvm/SetInitialValuesCodeGen.cpp rename from source/llvm/SetInitialValuesCodeGen.cpp rename to src/llvm/SetInitialValuesCodeGen.cpp diff --git a/source/llvm/SetInitialValuesCodeGen.h b/src/llvm/SetInitialValuesCodeGen.h rename from source/llvm/SetInitialValuesCodeGen.h rename to src/llvm/SetInitialValuesCodeGen.h diff --git a/source/llvm/SetValueCodeGenBase.h b/src/llvm/SetValueCodeGenBase.h rename from source/llvm/SetValueCodeGenBase.h rename to src/llvm/SetValueCodeGenBase.h diff --git a/source/llvm/SetValuesCodeGen.cpp b/src/llvm/SetValuesCodeGen.cpp rename from source/llvm/SetValuesCodeGen.cpp rename to src/llvm/SetValuesCodeGen.cpp diff --git a/source/llvm/SetValuesCodeGen.h b/src/llvm/SetValuesCodeGen.h rename from source/llvm/SetValuesCodeGen.h rename to src/llvm/SetValuesCodeGen.h diff --git a/source/llvm/SymbolForest.h b/src/llvm/SymbolForest.h rename from source/llvm/SymbolForest.h rename to src/llvm/SymbolForest.h diff --git a/source/llvm_testing/CMakeLists.txt b/src/llvm_testing/CMakeLists.txt rename from source/llvm_testing/CMakeLists.txt rename to src/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/src/llvm_testing/CMakeLists.txt -set(target llvm_testing)
  • src/LLVMCSRMatrixTest +set(target llvm_testing)
  • src/LLVMCSRMatrixTest diff --git a/source/llvm_testing/main.cpp b/src/llvm_testing/main.cpp rename from source/llvm_testing/main.cpp rename to src/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/src/llvm_testing/main.cpp cout << "usage: llvm_testing jacobian fname"; cout << "usage: llvm_testing jacobian fname"; diff --git a/src/llvm_testing/run_cpp_tests.bat b/src/llvm_testing/run_cpp_tests.bat +++ b/src/llvm_testing/run_cpp_tests.bat diff --git a/src/llvm_testing/run_cpp_tests.sh b/src/llvm_testing/run_cpp_tests.sh +++ b/src/llvm_testing/run_cpp_tests.sh diff --git a/source/testing/src/Args.cpp b/src/llvm_testing/src/Args.cpp rename to src/llvm_testing/src/Args.cpp diff --git a/source/testing/src/Args.h b/src/llvm_testing/src/Args.h rename to src/llvm_testing/src/Args.h diff --git a/src/llvm_testing/src/CSRMatrixTest.cpp b/src/llvm_testing/src/CSRMatrixTest.cpp +++ b/src/llvm_testing/src/CSRMatrixTest.cpp +#include "llvm/ModelGeneratorContext.h" +#include "llvm/LLVMModelDataSymbols.h" +#include "llvm/ModelDataIRBuilder.h" +#include "llvm/LLVMIncludes.h" +#include "llvm/AssignmentRuleEvaluator.h" +#include "llvm/EvalInitialConditionsCodeGen.h" +#include "llvm/LLVMModelData.h" +using namespace llvm; diff --git a/src/llvm_testing/src/CSRMatrixTest.h b/src/llvm_testing/src/CSRMatrixTest.h +++ b/src/llvm_testing/src/CSRMatrixTest.h diff --git a/src/llvm_testing/src/ConfigurableTest.cpp b/src/llvm_testing/src/ConfigurableTest.cpp +++ b/src/llvm_testing/src/ConfigurableTest.cpp +} /* namespace rrllvm */ diff --git a/src/llvm_testing/src/ConfigurableTest.h b/src/llvm_testing/src/ConfigurableTest.h +++ b/src/llvm_testing/src/ConfigurableTest.h diff --git a/src/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp b/src/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp +++ b/src/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp +#include "llvm/GetValuesCodeGen.h" +#include "llvm/ModelGeneratorContext.h"
  • LLVMModelGeneratorContext ctx;
  • LLVMGetBoundarySpeciesAmountCodeGen bsa(ctx);
  • LLVMGetBoundarySpeciesAmountCodeGen::FunctionPtr functionPtr = diff --git a/src/llvm_testing/src/GetBoundarySpeciesAmountTest.h b/src/llvm_testing/src/GetBoundarySpeciesAmountTest.h +++ b/src/llvm_testing/src/GetBoundarySpeciesAmountTest.h diff --git a/src/llvm_testing/src/LLVMCSRMatrixTest.cpp b/src/llvm_testing/src/LLVMCSRMatrixTest.cpp +++ b/src/llvm_testing/src/LLVMCSRMatrixTest.cpp
    • LLVMCSRMatrixTest.cpp +#include "LLVMCSRMatrixTest.h" +#include "llvm/ModelDataIRBuilder.h" +using namespace llvm; +LLVMCSRMatrixTest::LLVMCSRMatrixTest() : +LLVMCSRMatrixTest::~LLVMCSRMatrixTest() +bool LLVMCSRMatrixTest::callCSRMatrixSetNZ(csr_matrix* mat, int row, int col, +double LLVMCSRMatrixTest::callCSRMatrixGetNZ(csr_matrix* mat, int row, int col) +llvm::Function* LLVMCSRMatrixTest::getCSRMatrixSetNZTestFunc()
  • LLVMContext &ctx = context.getContext();
  •    LLVMModelDataIRBuilderTesting mdirbuilder(LLVMModelDataSymbols(), builder);
    

+bool runLLVMCSRMatrixTest(const std::string& version, int caseNumber)

  • LLVMCSRMatrixTest tester; +bool runLLVMCSRMatrixTest(const int m, const int n, const int nnz)
  • LLVMCSRMatrixTest tester; +llvm::Function* LLVMCSRMatrixTest::getCSRMatrixGetNZTestFunc()
  • LLVMContext &ctx = context.getContext();
  •    LLVMModelDataIRBuilderTesting mdirbuilder(LLVMModelDataSymbols(), builder);
    

diff --git a/src/llvm_testing/src/LLVMCSRMatrixTest.h b/src/llvm_testing/src/LLVMCSRMatrixTest.h +++ b/src/llvm_testing/src/LLVMCSRMatrixTest.h

    • LLVMCSRMatrixTest.h +#ifndef LLVMCSRMATRIXTEST_H_ +#define LLVMCSRMATRIXTEST_H_ +#include "llvm/LLVMIncludes.h" +#include "llvm/ModelGeneratorContext.h" +using namespace rrllvm; +class LLVMCSRMatrixTest
  • LLVMCSRMatrixTest();
  • virtual ~LLVMCSRMatrixTest();
  • llvm::Function *getCSRMatrixSetNZTestFunc();
  • llvm::Function *getCSRMatrixGetNZTestFunc();
  • llvm::Function *setFunc;
  • llvm::Function getFunc; +bool runLLVMCSRMatrixTest(const int m, const int n, const int nnz); +#endif / LLVMCSRMATRIXTEST_H_ */ diff --git a/source/llvm_testing/src/TestBase.cpp b/src/llvm_testing/src/TestBase.cpp rename from source/llvm_testing/src/TestBase.cpp rename to src/llvm_testing/src/TestBase.cpp --- a/source/llvm_testing/src/TestBase.cpp +++ b/src/llvm_testing/src/TestBase.cpp diff --git a/src/llvm_testing/src/TestBase.h b/src/llvm_testing/src/TestBase.h +++ b/src/llvm_testing/src/TestBase.h +#include "llvm/LLVMModelGenerator.h" +#include "llvm/LLVMExecutableModel.h" diff --git a/source/llvm_testing/src/TestCapabilities.cpp b/src/llvm_testing/src/TestCapabilities.cpp rename from source/llvm_testing/src/TestCapabilities.cpp rename to src/llvm_testing/src/TestCapabilities.cpp --- a/source/llvm_testing/src/TestCapabilities.cpp +++ b/src/llvm_testing/src/TestCapabilities.cpp diff --git a/src/llvm_testing/src/TestCapabilities.h b/src/llvm_testing/src/TestCapabilities.h +++ b/src/llvm_testing/src/TestCapabilities.h diff --git a/src/llvm_testing/src/TestEvalInitialConditions.cpp b/src/llvm_testing/src/TestEvalInitialConditions.cpp +++ b/src/llvm_testing/src/TestEvalInitialConditions.cpp diff --git a/src/llvm_testing/src/TestEvalInitialConditions.h b/src/llvm_testing/src/TestEvalInitialConditions.h +++ b/src/llvm_testing/src/TestEvalInitialConditions.h diff --git a/src/llvm_testing/src/TestEvalModel.cpp b/src/llvm_testing/src/TestEvalModel.cpp +++ b/src/llvm_testing/src/TestEvalModel.cpp diff --git a/src/llvm_testing/src/TestEvalModel.h b/src/llvm_testing/src/TestEvalModel.h +++ b/src/llvm_testing/src/TestEvalModel.h diff --git a/src/llvm_testing/src/TestEvalReactionRates.cpp b/src/llvm_testing/src/TestEvalReactionRates.cpp +++ b/src/llvm_testing/src/TestEvalReactionRates.cpp diff --git a/src/llvm_testing/src/TestEvalReactionRates.h b/src/llvm_testing/src/TestEvalReactionRates.h +++ b/src/llvm_testing/src/TestEvalReactionRates.h diff --git a/src/llvm_testing/src/TestGetSetValues.cpp b/src/llvm_testing/src/TestGetSetValues.cpp +++ b/src/llvm_testing/src/TestGetSetValues.cpp diff --git a/src/llvm_testing/src/TestGetSetValues.h b/src/llvm_testing/src/TestGetSetValues.h +++ b/src/llvm_testing/src/TestGetSetValues.h diff --git a/source/llvm_testing/src/TestPluginManager.cpp b/src/llvm_testing/src/TestPluginManager.cpp rename from source/llvm_testing/src/TestPluginManager.cpp rename to src/llvm_testing/src/TestPluginManager.cpp --- a/source/llvm_testing/src/TestPluginManager.cpp +++ b/src/llvm_testing/src/TestPluginManager.cpp diff --git a/src/llvm_testing/src/TestPluginManager.h b/src/llvm_testing/src/TestPluginManager.h +++ b/src/llvm_testing/src/TestPluginManager.h diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/src/llvm_testing/src/TestRoadRunner.cpp rename from source/llvm_testing/src/TestRoadRunner.cpp rename to src/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/src/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/src/llvm_testing/src/TestRoadRunner.h rename from source/llvm_testing/src/TestRoadRunner.h rename to src/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/src/llvm_testing/src/TestRoadRunner.h diff --git a/source/llvm_testing/src/TestVariant.cpp b/src/llvm_testing/src/TestVariant.cpp rename from source/llvm_testing/src/TestVariant.cpp rename to src/llvm_testing/src/TestVariant.cpp --- a/source/llvm_testing/src/TestVariant.cpp +++ b/src/llvm_testing/src/TestVariant.cpp diff --git a/src/llvm_testing/src/TestVariant.h b/src/llvm_testing/src/TestVariant.h +++ b/src/llvm_testing/src/TestVariant.h diff --git a/src/llvm_testing/src/cpplapack.cpp b/src/llvm_testing/src/cpplapack.cpp +++ b/src/llvm_testing/src/cpplapack.cpp diff --git a/src/llvm_testing/src/cpplapack.h b/src/llvm_testing/src/cpplapack.h +++ b/src/llvm_testing/src/cpplapack.h diff --git a/source/testing/src/rrTestUtils.cpp b/src/llvm_testing/src/rrTestUtils.cpp rename to src/llvm_testing/src/rrTestUtils.cpp diff --git a/src/llvm_testing/src/rrTestUtils.h b/src/llvm_testing/src/rrTestUtils.h +++ b/src/llvm_testing/src/rrTestUtils.h diff --git a/src/llvm_testing/src/test_compiler.cpp b/src/llvm_testing/src/test_compiler.cpp +++ b/src/llvm_testing/src/test_compiler.cpp diff --git a/src/llvm_testing/src/test_compiler.h b/src/llvm_testing/src/test_compiler.h +++ b/src/llvm_testing/src/test_compiler.h diff --git a/src/llvm_testing/src/tests.cpp b/src/llvm_testing/src/tests.cpp +++ b/src/llvm_testing/src/tests.cpp +#include "llvm/ModelGeneratorContext.h" +#include "llvm/LLVMModelDataSymbols.h" +#include "llvm/ModelDataIRBuilder.h" +#include "llvm/LLVMIncludes.h" +#include "llvm/AssignmentRuleEvaluator.h" +#include "llvm/EvalInitialConditionsCodeGen.h" +#include "llvm/LLVMModelData.h" +using namespace llvm; +using namespace rrllvm;
  • LLVMModelData *md = 0;
  • LLVMModelData *md;
  • LLVMModelDataIRBuilderTesting builder(c.getModelDataSymbols(), c.getBuilder());
  • int (pfunc)(LLVMModelData) = (int ()(LLVMModelData))engine.getPointerToFunction(getFunc);
  •    double (*pfunc)(LLVMModelData*) = (double (*)(LLVMModelData*))engine.getPointerToFunction(getFunc);
    
  •    void (*psetfunc)(LLVMModelData*,double) = (void (*)(LLVMModelData*,double))engine.getPointerToFunction(setFunc);
    
  • LLVMModelData_free(md); diff --git a/src/llvm_testing/src/tests.h b/src/llvm_testing/src/tests.h +++ b/src/llvm_testing/src/tests.h diff --git a/source/llvm_testing/run_cpp_tests.bat b/src/testing/run_cpp_tests.bat rename from source/llvm_testing/run_cpp_tests.bat

Add the LLVM sources to compilation

 return rrllvm::LLVMModelGenerator::createModel(sbml, opt.modelGeneratorOpt);

+* Introduce new LLVM symbol caching optimiztion and scoped cache blocks for read combining diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp

  •    Log(Logger::LOG_NOTICE) << "Using LLVM symbol/value cache";
    
  •    Log(Logger::LOG_INFORMATION) << "Using LLVM symbol/value cache";
    
  •    Log(Logger::LOG_NOTICE) << "Not using LLVM symbol/value cache";
    
  •    Log(Logger::LOG_INFORMATION) << "Not using LLVM symbol/value cache";
    
  •    Log(Logger::LOG_NOTICE) << "Using LLVM symbol/value cache";
    
  •    Log(Logger::LOG_INFORMATION) << "Using LLVM symbol/value cache";
    
  •    Log(Logger::LOG_NOTICE) << "Not using LLVM symbol/value cache";
    
  •    Log(Logger::LOG_INFORMATION) << "Not using LLVM symbol/value cache";
    

diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1859,65 +1859,45 @@ int LLVMExecutableModel::getEventTriggers(int len, const int indx, unsigned cha -void LLVMExecutableModel::applyEvents(double timeEnd, +int LLVMExecutableModel::applyEvents(double timeEnd, -int LLVMExecutableModel::applyPendingEvents(const double stateVector, void LLVMExecutableModel::getEventRoots(double time, const double y, double gdot) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/Random.cpp b/source/llvm/Random.cpp --- a/source/llvm/Random.cpp +++ b/source/llvm/Random.cpp diff --git a/source/llvm/Random.h b/source/llvm/Random.h --- a/source/llvm/Random.h +++ b/source/llvm/Random.h find_package(LLVM) diff --git a/cmake/FindLLVM.cmake b/cmake/FindLLVM.cmake --- a/cmake/FindLLVM.cmake +++ b/cmake/FindLLVM.cmake @@ -170,6 +170,15 @@ if (LLVM_CONFIG_EXECUTABLE) #message("LLVM_LIBRARIES: ${LLVM_LIBRARIES}") set(LLVM_LIBRARIES "${LLVM_LIBRARIES};${CURSES_LIBRARIES}")

  •        # LLVM 3.5 seems to require zlib, at least on OSX 10.9. 
    
  •        if (LLVM_VERSION_MINOR GREATER 4)
    
  •            message("LLVM > 3.4, looking for zlib")
    
  •            set (LLVM_LIBRARIES "${LLVM_LIBRARIES};${ZLIB_LIBRARY}")
           message("LLVM_LIBRARIES: ${LLVM_LIBRARIES}")
    

diff --git a/source/llvm/Random.cpp b/source/llvm/Random.cpp --- a/source/llvm/Random.cpp +++ b/source/llvm/Random.cpp diff --git a/source/llvm/Random.h b/source/llvm/Random.h --- a/source/llvm/Random.h +++ b/source/llvm/Random.h find_package(LLVM) diff --git a/source/llvm/Random.h b/source/llvm/Random.h --- a/source/llvm/Random.h +++ b/source/llvm/Random.h diff --git a/source/llvm/Random.h b/source/llvm/Random.h --- a/source/llvm/Random.h +++ b/source/llvm/Random.h diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h #include "LLVMModelData.h" diff --git a/source/llvm/Random.cpp b/source/llvm/Random.cpp --- a/source/llvm/Random.cpp +++ b/source/llvm/Random.cpp breaking change for llvm 3.5 api diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp // we only support LLVM >= 3.1 #if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR == 1) +#elif (LLVM_VERSION_MINOR <= 4) +#else // LLVM_VERSION_MINOR > 4

  • // Needed for LLVM 3.5 regardless of architecture
  • // also, should use DataLayoutPass(module) per Renato (http://reviews.llvm.org/D4607) diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMModelGenerator.h b/source/llvm/LLVMModelGenerator.h --- a/source/llvm/LLVMModelGenerator.h +++ b/source/llvm/LLVMModelGenerator.h #include "LLVMCompiler.h" @@ -107,7 +107,6 @@ if(BUILD_LLVM) llvm/EventQueue llvm/FunctionResolver llvm/LLVMExecutableModel
  •    llvm/GetRateRuleValuesCodeGen
       llvm/GetValuesCodeGen
       llvm/LoadSymbolResolverBase
       llvm/GetInitialValuesCodeGen
    

@@ -121,7 +120,6 @@ if(BUILD_LLVM) llvm/LLVMModelGenerator llvm/ModelGeneratorContext llvm/LLVMModelSymbols

  •    llvm/SetRateRuleValuesCodeGen
       llvm/SetValuesCodeGen
       llvm/SetInitialValuesCodeGen
       llvm/SBMLSupportFunctions
    

diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -789,13 +789,19 @@ llvm::Value* ASTNodeCodeGen::piecewiseCodeGen(const libsbml::ASTNode* ast) @@ -818,7 +824,9 @@ llvm::Value* ASTNodeCodeGen::piecewiseCodeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/CodeGen.h b/source/llvm/CodeGen.h --- a/source/llvm/CodeGen.h +++ b/source/llvm/CodeGen.h diff --git a/source/llvm/GetRateRuleValuesCodeGen.cpp b/source/llvm/GetRateRuleValuesCodeGen.cpp --- a/source/llvm/GetRateRuleValuesCodeGen.cpp -namespace rrllvm diff --git a/source/llvm/GetRateRuleValuesCodeGen.h b/source/llvm/GetRateRuleValuesCodeGen.h --- a/source/llvm/GetRateRuleValuesCodeGen.h -namespace rrllvm

  • typedef void (FunctionPtr)(LLVMModelData); diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp -static std::vectorstd::string getIds(const rrllvm::LLVMModelDataSymbols::StringUIntMap & m, +static std::vectorstd::string getIds(const rrllvm::LLVMModelDataSymbols::StringUIntMap & m) for(rrllvm::LLVMModelDataSymbols::StringUIntMap::const_iterator i = m.begin(); namespace rrllvm @@ -374,16 +371,14 @@ const std::vector& LLVMModelDataSymbols::getStoichColIndx() const -std::vectorstd::string LLVMModelDataSymbols::getCompartmentIds(bool onlyInd) const +std::vectorstd::string LLVMModelDataSymbols::getCompartmentIds() const -std::vectorstd::string LLVMModelDataSymbols::getBoundarySpeciesIds(bool onlyInd) const +std::vectorstd::string LLVMModelDataSymbols::getBoundarySpeciesIds() const uint LLVMModelDataSymbols::getReactionIndex(const std::string& id) const @@ -401,7 +396,7 @@ uint LLVMModelDataSymbols::getReactionIndex(const std::string& id) const std::vectorstd::string LLVMModelDataSymbols::getReactionIds() const uint LLVMModelDataSymbols::getReactionSize() const @@ -470,16 +465,14 @@ void LLVMModelDataSymbols::print() const -std::vectorstd::string LLVMModelDataSymbols::getGlobalParameterIds(bool onlyInd) const +std::vectorstd::string LLVMModelDataSymbols::getGlobalParameterIds() const -std::vectorstd::string LLVMModelDataSymbols::getFloatingSpeciesIds(bool onlyInd) const +std::vectorstd::string LLVMModelDataSymbols::getFloatingSpeciesIds() const std::string LLVMModelDataSymbols::getFloatingSpeciesId(uint indx) const @@ -1501,7 +1494,7 @@ uint LLVMModelDataSymbols::getInitGlobalParameterSize() const std::vectorstd::string LLVMModelDataSymbols::getEventIds() const std::string LLVMModelDataSymbols::getEventId(uint indx) const diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LoadSymbolResolverBase.cpp b/source/llvm/LoadSymbolResolverBase.cpp --- a/source/llvm/LoadSymbolResolverBase.cpp +++ b/source/llvm/LoadSymbolResolverBase.cpp @@ -55,7 +57,6 @@ llvm::Value* LoadSymbolResolverBase::loadReactionRate( llvm::Value* LoadSymbolResolverBase::cacheValue(const std::string& symbol, @@ -93,17 +110,29 @@ llvm::Value* LoadSymbolResolverBase::cacheValue(const std::string& symbol, } /* namespace rrllvm / diff --git a/source/llvm/LoadSymbolResolverBase.h b/source/llvm/LoadSymbolResolverBase.h --- a/source/llvm/LoadSymbolResolverBase.h +++ b/source/llvm/LoadSymbolResolverBase.h typedef cxx11_ns::unordered_map<std::string, llvm::Value> ValueMap; diff --git a/source/llvm/SetRateRuleValuesCodeGen.cpp b/source/llvm/SetRateRuleValuesCodeGen.cpp --- a/source/llvm/SetRateRuleValuesCodeGen.cpp -namespace rrllvm diff --git a/source/llvm/SetRateRuleValuesCodeGen.h b/source/llvm/SetRateRuleValuesCodeGen.h --- a/source/llvm/SetRateRuleValuesCodeGen.h -#ifndef LLVMSETRATERULEVALUESCODEGEN_H_ -#define LLVMSETRATERULEVALUESCODEGEN_H_ -namespace rrllvm
  • typedef void (FunctionPtr)(LLVMModelData); -#endif /* LLVMSETRATERULEVALUESCODEGEN_H_ */ diff --git a/source/llvm/SetValuesCodeGen.cpp b/source/llvm/SetValuesCodeGen.cpp --- a/source/llvm/SetValuesCodeGen.cpp +++ b/source/llvm/SetValuesCodeGen.cpp @@ -33,13 +33,8 @@ namespace rrllvm static StringIntVector independentElements(const LLVMModelDataSymbols &dataSymbols, @@ -48,7 +43,6 @@ static StringIntVector independentElements(const LLVMModelDataSymbols &dataSymbo

Add the LLVM sources to compilation

#if defined(BUILD_LLVM) #include "llvm/LLVMModelGenerator.h" +#include "llvm/LLVMCompiler.h"

  • return new rrllvm::LLVMCompiler();
  • return rrllvm::LLVMModelGenerator::createModel(sbml, opt.modelGeneratorOpt); #if defined(BUILD_LLVM) && !defined(BUILD_LEGACY_C) #if !defined(BUILD_LLVM) && !defined(BUILD_LEGACY_C) #error Must built at least one ModelGenerator backend, either BUILD_LLVM or BUILD_LEGACY_C
  • * @param compiler: the textual name of the compiler. If this is "llvm", then then
    
  • * the LLVM ModelGenerator is created, otherwise, A C based model generator is
    
  • * C files and objects here, not used for LLVM.
    
  • * not used in LLVM.
    
  •     * The LLVM ModelGenerator maintins a hash table of currently running
    
  •     * Use the LLVM MCJIT JIT engine.
    
  •     * The MCJIT is the new LLVM JIT engine, it is not as well tested as the
    
  •     * original JIT engine. Does NOT work on LLVM 3.1
    
  •    LLVM_SYMBOL_CACHE =               (0x1 << 11)
    

diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp namespace rrllvm diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp #include "LLVMException.h" @@ -190,7 +190,7 @@ LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model model, @@ -200,7 +200,7 @@ LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model model, diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp namespace rrllvm -LLVMModelGenerator::LLVMModelGenerator() -LLVMModelGenerator::~LLVMModelGenerator() -bool LLVMModelGenerator::setTemporaryDirectory(const string& path) -string LLVMModelGenerator::getTemporaryDirectory() ExecutableModel LLVMModelGenerator::createModel(const std::string& sbml, @@ -124,7 +82,7 @@ ExecutableModel LLVMModelGenerator::createModel(const std::string& sbml, @@ -209,7 +167,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -239,7 +197,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -351,15 +309,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, return new LLVMExecutableModel(rc, modelData); -Compiler* LLVMModelGenerator::getCompiler() -bool LLVMModelGenerator::setCompiler(const string& compiler) /************ LLVM Utility Functions, TODO: Move To Separate File ************/ diff --git a/source/llvm/LLVMModelGenerator.h b/source/llvm/LLVMModelGenerator.h --- a/source/llvm/LLVMModelGenerator.h +++ b/source/llvm/LLVMModelGenerator.h #ifndef rrLLVMModelGeneratorH #define rrLLVMModelGeneratorH #include "LLVMCompiler.h" @@ -34,48 +34,15 @@ namespace rrllvm -class RR_DECLSPEC LLVMModelGenerator: public rr::ModelGenerator +class RR_DECLSPEC LLVMModelGenerator

  • LLVMModelGenerator();
  • virtual ~LLVMModelGenerator();
  • * No effect on LLVM generator.
    
  • LLVMCompiler compiler; diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp #include "LLVMException.h" namespace rrllvm @@ -425,12 +425,12 @@ const LLVMModelSymbols& ModelGeneratorContext::getModelSymbols() const
  • return (options & rr::ModelGenerator::LLVM_SYMBOL_CACHE) != 0;
  • return (options & LoadSBMLOptions::LLVM_SYMBOL_CACHE) != 0; llvm::FunctionPassManager* ModelGeneratorContext::getFunctionPassManager() const @@ -440,7 +440,7 @@ llvm::FunctionPassManager* ModelGeneratorContext::getFunctionPassManager() const diff --git a/source/llvm_testing/src/TestBase.cpp b/source/llvm_testing/src/TestBase.cpp --- a/source/llvm_testing/src/TestBase.cpp +++ b/source/llvm_testing/src/TestBase.cpp diff --git a/source/llvm_testing/src/test_compiler.cpp b/source/llvm_testing/src/test_compiler.cpp --- a/source/llvm_testing/src/test_compiler.cpp +++ b/source/llvm_testing/src/test_compiler.cpp
  • ModelGenerator *mg = ModelGenerator::New("LLVM");
  • if (Config::getBool(Config::LLVM_SYMBOL_CACHE))
  •    modelGeneratorOpt |= LoadSBMLOptions::LLVM_SYMBOL_CACHE;
    
  • if (Config::getBool(Config::LLVM_SYMBOL_CACHE))
  •    modelGeneratorOpt |= LoadSBMLOptions::LLVM_SYMBOL_CACHE;
    
  • setItem("compiler", "LLVM"); * Use the LLVM MCJIT JIT engine. diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp namespace rrllvm @@ -188,7 +198,8 @@ LLVMExecutableModel::LLVMExecutableModel() : @@ -230,7 +241,8 @@ LLVMExecutableModel::LLVMExecutableModel( @@ -328,7 +340,9 @@ void LLVMExecutableModel::getStateVectorRate(double time, const double y, doubl @@ -362,6 +376,7 @@ void LLVMExecutableModel::getStateVectorRate(double time, const double y, doubl @@ -800,21 +815,7 @@ int LLVMExecutableModel::setStateVector(const double stateVector) @@ -1620,7 +1621,17 @@ int LLVMExecutableModel::getReactionRates(int len, const int indx, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h
  • Variant(true) // LLVM_SYMBOL_CACHE
  • Variant(true), // LLVM_SYMBOL_CACHE keys["LLVM_SYMBOL_CACHE"] = rr::Config::LLVM_SYMBOL_CACHE; LLVM_SYMBOL_CACHE, diff --git a/source/llvm/Random.h b/source/llvm/Random.h --- a/source/llvm/Random.h +++ b/source/llvm/Random.h #ifndef RRLLVM_RANDOM_H #define RRLLVM_RANDOM_H namespace rrllvm created new LLVM symbol caching optimiztion * The MCJIT is the new LLVM JIT engine, it is not as well tested as the * original JIT engine. Does NOT work on LLVM 3.1
  •    LLVM_SYMBOL_CACHE =               (0x1 << 11)
    

diff --git a/source/llvm/GetEventValuesCodeGen.h b/source/llvm/GetEventValuesCodeGen.h --- a/source/llvm/GetEventValuesCodeGen.h +++ b/source/llvm/GetEventValuesCodeGen.h @@ -109,6 +109,7 @@ llvm::Value *GetEventValueCodeGenBase<Derived, FunctionPtrType>::codeGen() llvm::BasicBlock block = llvm::BasicBlock::Create(this->context, block_name, this->function); diff --git a/source/llvm/GetValueCodeGenBase.h b/source/llvm/GetValueCodeGenBase.h --- a/source/llvm/GetValueCodeGenBase.h +++ b/source/llvm/GetValueCodeGenBase.h @@ -88,6 +88,7 @@ llvm::Value GetValueCodeGenBase<Derived, substanceUnits>::codeGen() llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, ids[i] + "_block", this->function); llvm::Value value = resolver.loadSymbolValue(ids[i]); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h namespace rrllvm diff --git a/source/llvm/LoadSymbolResolverBase.cpp b/source/llvm/LoadSymbolResolverBase.cpp --- a/source/llvm/LoadSymbolResolverBase.cpp +++ b/source/llvm/LoadSymbolResolverBase.cpp +llvm::Value LoadSymbolResolverBase::cacheValue(const std::string& symbol,

  •    const llvm::ArrayRef<llvm::Value*>& args,
    
  •    llvm::Value* value)
    

} /* namespace rrllvm */ diff --git a/source/llvm/LoadSymbolResolverBase.h b/source/llvm/LoadSymbolResolverBase.h --- a/source/llvm/LoadSymbolResolverBase.h +++ b/source/llvm/LoadSymbolResolverBase.h #include "LLVMModelSymbols.h"

  • typedef cxx11_ns::unordered_map<std::string, llvm::Value*> ValueMap; const LLVMModelSymbols &modelSymbols; llvm::IRBuilder<> &builder;
  • llvm::Value* cacheValue(const std::string& symbol,
  •        const llvm::ArrayRef<llvm::Value*>& args,
    
  •        llvm::Value* value = NULL);
    

diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp @@ -49,6 +49,11 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue( const llvm::ArrayRefllvm::Value*& args) @@ -59,7 +64,7 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue( @@ -85,7 +90,7 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue( @@ -120,7 +125,7 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue( @@ -128,24 +133,24 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue( @@ -173,7 +178,7 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue( @@ -182,7 +187,7 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue( diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp

  •    Log(Logger::LOG_NOTICE) << "Using LLVM symbol/value cache";
    
  •    Log(Logger::LOG_NOTICE) << "Not using LLVM symbol/value cache";
    
  •    Log(Logger::LOG_NOTICE) << "Using LLVM symbol/value cache";
    
  •    Log(Logger::LOG_NOTICE) << "Not using LLVM symbol/value cache";
    

@@ -413,7 +425,12 @@ const LLVMModelSymbols& ModelGeneratorContext::getModelSymbols() const

  • return (options & rr::ModelGenerator::LLVM_SYMBOL_CACHE) != 0; llvm::FunctionPassManager* ModelGeneratorContext::getFunctionPassManager() const diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h diff --git a/source/llvm/SetValueCodeGenBase.h b/source/llvm/SetValueCodeGenBase.h --- a/source/llvm/SetValueCodeGenBase.h +++ b/source/llvm/SetValueCodeGenBase.h @@ -92,6 +92,7 @@ llvm::Value* SetValueCodeGenBase<Derived, substanceUnits>::codeGen() llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, ids[i].first + "_block", this->function);
  • Variant(true) // LLVM_SYMBOL_CACHE
  • keys["LLVM_SYMBOL_CACHE"] = rr::Config::LLVM_SYMBOL_CACHE;
  •     * cache llvm symbols durring sbml compilation.
    
  •    LLVM_SYMBOL_CACHE,
    
  • if (Config::getBool(Config::LLVM_SYMBOL_CACHE))
  •    modelGeneratorOpt |= LoadSBMLOptions::LLVM_SYMBOL_CACHE;
        * The MCJIT is the new LLVM JIT engine, it is not as well tested as the
        * original JIT engine. Does NOT work on LLVM 3.1
    
  •    LLVM_SYMBOL_CACHE =               (0x1 << 11)
    

diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp

  • llvm::Type *argTypes[] = {
  •    llvm::PointerType::get(ModelDataIRBuilder::getStructType(this->module), 0),
    
  •    llvm::Type::getInt32Ty(this->context)
    
  • llvm::Value *args[] = {0, 0};
  • llvm::BasicBlock *entry = codeGenHeader(FunctionName,
  •        llvm::Type::getVoidTy(context),
    

diff --git a/source/llvm/EvalInitialConditionsCodeGen.h b/source/llvm/EvalInitialConditionsCodeGen.h --- a/source/llvm/EvalInitialConditionsCodeGen.h +++ b/source/llvm/EvalInitialConditionsCodeGen.h namespace rrllvm -typedef void (EvalInitialConditions_FunctionPtr)(LLVMModelData); +typedef void (EvalInitialConditions_FunctionPtr)(LLVMModelData, uint32_t); diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -303,20 +303,6 @@ int LLVMExecutableModel::getNumReactions() -int LLVMExecutableModel::getNumLocalParameters(int reactionId) -void LLVMExecutableModel::convertToAmounts() -void LLVMExecutableModel::computeConservedTotals() int LLVMExecutableModel::getFloatingSpeciesConcentrations(int len, int const *indx, @@ -328,19 +314,6 @@ void LLVMExecutableModel::getRateRuleValues(double *rateRuleValues) -void LLVMExecutableModel::convertToConcentrations() -void LLVMExecutableModel::updateDependentSpeciesValues() -void LLVMExecutableModel::computeAllRatesOfChange() void LLVMExecutableModel::getStateVectorRate(double time, const double y, double dydt) @@ -636,9 +609,9 @@ string LLVMExecutableModel::getReactionId(int id) -void LLVMExecutableModel::evalInitialConditions() +void LLVMExecutableModel::evalInitialConditions(uint32_t flags) void LLVMExecutableModel::reset() @@ -650,12 +623,10 @@ void LLVMExecutableModel::reset() void LLVMExecutableModel::reset(int opt) @@ -696,11 +667,6 @@ void LLVMExecutableModel::reset(int opt) @@ -714,19 +680,24 @@ void LLVMExecutableModel::reset(int opt) @@ -781,15 +752,6 @@ void LLVMExecutableModel::reset(int opt) -bool LLVMExecutableModel::getConservedSumChanged() -void LLVMExecutableModel::setConservedSumChanged(bool val) int LLVMExecutableModel::getStateVector(double stateVector) @@ -952,11 +914,13 @@ void LLVMExecutableModel::getIds(int types, std::liststd::string &ids) @@ -967,7 +931,7 @@ void LLVMExecutableModel::getIds(int types, std::liststd::string &ids) @@ -1461,10 +1425,6 @@ LLVMExecutableModel LLVMExecutableModel::dummy() return new LLVMExecutableModel(); -void LLVMExecutableModel::evalReactionRates() int LLVMExecutableModel::getNumRateRules() diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp -static std::vectorstd::string getIds(const rrllvm::LLVMModelDataSymbols::StringUIntMap & m) +static std::vectorstd::string getIds(const rrllvm::LLVMModelDataSymbols::StringUIntMap & m, for(rrllvm::LLVMModelDataSymbols::StringUIntMap::const_iterator i = m.begin(); @@ -372,14 +374,16 @@ const std::vector& LLVMModelDataSymbols::getStoichColIndx() const -std::vectorstd::string LLVMModelDataSymbols::getCompartmentIds() const +std::vectorstd::string LLVMModelDataSymbols::getCompartmentIds(bool onlyInd) const -std::vectorstd::string LLVMModelDataSymbols::getBoundarySpeciesIds() const +std::vectorstd::string LLVMModelDataSymbols::getBoundarySpeciesIds(bool onlyInd) const uint LLVMModelDataSymbols::getReactionIndex(const std::string& id) const @@ -397,7 +401,7 @@ uint LLVMModelDataSymbols::getReactionIndex(const std::string& id) const std::vectorstd::string LLVMModelDataSymbols::getReactionIds() const uint LLVMModelDataSymbols::getReactionSize() const @@ -466,14 +470,16 @@ void LLVMModelDataSymbols::print() const -std::vectorstd::string LLVMModelDataSymbols::getGlobalParameterIds() const +std::vectorstd::string LLVMModelDataSymbols::getGlobalParameterIds(bool onlyInd) const -std::vectorstd::string LLVMModelDataSymbols::getFloatingSpeciesIds() const +std::vectorstd::string LLVMModelDataSymbols::getFloatingSpeciesIds(bool onlyInd) const std::string LLVMModelDataSymbols::getFloatingSpeciesId(uint indx) const @@ -1455,6 +1461,11 @@ bool LLVMModelDataSymbols::isIndependentInitGlobalParameter( +bool LLVMModelDataSymbols::isIndependentInitGlobalParameter(uint id) const bool LLVMModelDataSymbols::isIndependentInitElement( @@ -1490,7 +1501,7 @@ uint LLVMModelDataSymbols::getInitGlobalParameterSize() const std::vectorstd::string LLVMModelDataSymbols::getEventIds() const std::string LLVMModelDataSymbols::getEventId(uint indx) const @@ -1564,5 +1575,3 @@ uint LLVMModelDataSymbols::getConservedMoietyIndex( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/SetValuesCodeGen.cpp b/source/llvm/SetValuesCodeGen.cpp --- a/source/llvm/SetValuesCodeGen.cpp +++ b/source/llvm/SetValuesCodeGen.cpp @@ -33,8 +33,13 @@ namespace rrllvm static StringIntVector independentElements(const LLVMModelDataSymbols &dataSymbols, @@ -43,6 +48,7 @@ static StringIntVector independentElements(const LLVMModelDataSymbols &dataSymbo diff --git a/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp b/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp --- a/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp +++ b/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp diff --git a/source/llvm_testing/src/TestEvalInitialConditions.cpp b/source/llvm_testing/src/TestEvalInitialConditions.cpp --- a/source/llvm_testing/src/TestEvalInitialConditions.cpp +++ b/source/llvm_testing/src/TestEvalInitialConditions.cpp diff --git a/source/llvm_testing/src/TestEvalModel.cpp b/source/llvm_testing/src/TestEvalModel.cpp --- a/source/llvm_testing/src/TestEvalModel.cpp +++ b/source/llvm_testing/src/TestEvalModel.cpp diff --git a/source/llvm_testing/src/TestEvalReactionRates.cpp b/source/llvm_testing/src/TestEvalReactionRates.cpp --- a/source/llvm_testing/src/TestEvalReactionRates.cpp +++ b/source/llvm_testing/src/TestEvalReactionRates.cpp diff --git a/source/llvm_testing/src/TestGetSetValues.cpp b/source/llvm_testing/src/TestGetSetValues.cpp --- a/source/llvm_testing/src/TestGetSetValues.cpp +++ b/source/llvm_testing/src/TestGetSetValues.cpp diff --git a/source/llvm_testing/src/tests.cpp b/source/llvm_testing/src/tests.cpp --- a/source/llvm_testing/src/tests.cpp +++ b/source/llvm_testing/src/tests.cpp

  • * here only for compatability, does nothing in LLVM.
    

diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/ConfigurableTest.cpp b/source/llvm_testing/src/ConfigurableTest.cpp --- a/source/llvm_testing/src/ConfigurableTest.cpp +++ b/source/llvm_testing/src/ConfigurableTest.cpp } /* namespace rrllvm / diff --git a/source/llvm_testing/src/ConfigurableTest.h b/source/llvm_testing/src/ConfigurableTest.h --- a/source/llvm_testing/src/ConfigurableTest.h +++ b/source/llvm_testing/src/ConfigurableTest.h -} / namespace rrllvm / diff --git a/source/llvm_testing/src/TestCapabilities.cpp b/source/llvm_testing/src/TestCapabilities.cpp --- a/source/llvm_testing/src/TestCapabilities.cpp +++ b/source/llvm_testing/src/TestCapabilities.cpp diff --git a/source/llvm_testing/src/TestVariant.cpp b/source/llvm_testing/src/TestVariant.cpp --- a/source/llvm_testing/src/TestVariant.cpp +++ b/source/llvm_testing/src/TestVariant.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestEvalReactionRates.cpp b/source/llvm_testing/src/TestEvalReactionRates.cpp --- a/source/llvm_testing/src/TestEvalReactionRates.cpp +++ b/source/llvm_testing/src/TestEvalReactionRates.cpp diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/source/llvm/ModelInitialValueSymbolResolver.cpp --- a/source/llvm/ModelInitialValueSymbolResolver.cpp +++ b/source/llvm/ModelInitialValueSymbolResolver.cpp @@ -128,7 +128,16 @@ llvm::Value ModelInitialValueSymbolResolver::loadSymbolValue( @@ -146,7 +155,16 @@ llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue( diff --git a/source/llvm/SetValuesCodeGen.cpp b/source/llvm/SetValuesCodeGen.cpp --- a/source/llvm/SetValuesCodeGen.cpp +++ b/source/llvm/SetValuesCodeGen.cpp @@ -23,6 +23,10 @@ namespace rrllvm @@ -34,7 +38,7 @@ static StringIntVector independentElements(const LLVMModelDataSymbols &dataSymbo @@ -43,26 +47,7 @@ static StringIntVector independentElements(const LLVMModelDataSymbols &dataSymbo -static StringIntVector nonRateElements(const LLVMModelDataSymbols &dataSymbols, diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp

  • When the LLVM back end is used (default) this always returns the current state of the -When the LLVM back end is used (default) this always returns the current state of the diff --git a/source/llvm/Random.cpp b/source/llvm/Random.cpp --- a/source/llvm/Random.cpp +++ b/source/llvm/Random.cpp diff --git a/source/llvm/Random.h b/source/llvm/Random.h --- a/source/llvm/Random.h +++ b/source/llvm/Random.h namespace rrllvm diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -2179,4 +2179,61 @@ int LLVMExecutableModel::getGlobalParameterInitValues(int len, const int *indx, +void LLVMExecutableModel::setRandomSeed(int64_t seed)
  • // by LLVMModelData_free +int64_t LLVMExecutableModel::getRandomSeed()
  • // by LLVMModelData_free +double LLVMExecutableModel::getRandom()
  • // by LLVMModelData_free diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/Random.cpp b/source/llvm/Random.cpp --- a/source/llvm/Random.cpp +++ b/source/llvm/Random.cpp llvm::FunctionType *funcType, Module module); } / namespace rrllvm */ diff --git a/source/llvm/Random.h b/source/llvm/Random.h --- a/source/llvm/Random.h +++ b/source/llvm/Random.h diff --git a/source/llvm/Random.h b/source/llvm/Random.h --- a/source/llvm/Random.h +++ b/source/llvm/Random.h diff --git a/source/llvm/DistribFunctionResolver.cpp b/source/llvm/DistribFunctionResolver.cpp --- a/source/llvm/DistribFunctionResolver.cpp +++ b/source/llvm/DistribFunctionResolver.cpp using namespace llvm; namespace rrllvm const ModelGeneratorContext& ctx, llvm::Value modelData) : @@ -37,7 +38,7 @@ llvm::Value DistribFunctionResolver::loadSymbolValue( llvm::Value randomPtr = mdbuilder.createRandomLoad(); @@ -47,11 +48,38 @@ llvm::Value DistribFunctionResolver::loadSymbolValue( throw_llvm_exception("invalid number of args");
  • llvm::Value *funcArgs[] = {randomPtr, args[0], args[1]};
  • llvm::Value *func = module->getFunction("rr_distrib_uniform");
  •    llvm::Value *funcArgs[] = {randomPtr, args[0], args[1]};
    
  •    llvm::Value *func = module->getFunction("rr_distrib_uniform");
    
  •    llvm::Value *funcArgs[] = {randomPtr, args[0], args[1]};
    
  •    llvm::Value *func = module->getFunction("rr_distrib_normal");
    
  •    throw_llvm_exception("Unsupported distribution: " + name);
    

diff --git a/source/llvm/Random.cpp b/source/llvm/Random.cpp --- a/source/llvm/Random.cpp +++ b/source/llvm/Random.cpp @@ -21,6 +22,8 @@ using namespace llvm; namespace rrllvm llvm::FunctionType *funcType, Module *module); LLVMContext& context = module->getContext(); llvm::ExecutionEngine executionEngine = &ctx.getExecutionEngine(); // LLVM does not appear to have a true void ptr, so just use a pointer } / namespace rrllvm / diff --git a/source/llvm/Random.h b/source/llvm/Random.h --- a/source/llvm/Random.h +++ b/source/llvm/Random.h diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -307,12 +307,6 @@ ExecutableModel LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/Random.cpp b/source/llvm/Random.cpp --- a/source/llvm/Random.cpp +++ b/source/llvm/Random.cpp @@ -21,6 +21,8 @@ using namespace llvm; namespace rrllvm llvm::FunctionType *funcType, Module module) } / namespace rrllvm */ diff --git a/source/llvm/Random.h b/source/llvm/Random.h --- a/source/llvm/Random.h +++ b/source/llvm/Random.h diff --git a/source/llvm/Random.cpp b/source/llvm/Random.cpp --- a/source/llvm/Random.cpp +++ b/source/llvm/Random.cpp llvm::FunctionType *funcType, Module module) } / namespace rrllvm / diff --git a/source/llvm/Random.h b/source/llvm/Random.h --- a/source/llvm/Random.h +++ b/source/llvm/Random.h diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -148,7 +148,7 @@ ExecutableModel LLVMModelGenerator::createModel(const std::string& sbml,

  •        return new LLVMExecutableModel(sp, createModelData(*sp->symbols));
    
  •        return new LLVMExecutableModel(sp, createModelData(*sp->symbols, sp->random));
    

@@ -283,7 +283,8 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml,

  • LLVMModelData *modelData = createModelData(context.getModelDataSymbols());
  • LLVMModelData *modelData = createModelData(context.getModelDataSymbols(), uint llvmsize = ModelDataIRBuilder::getModelDataSize(context.getModule(), @@ -379,7 +380,8 @@ std::string to_string(const llvm::Value *value) -LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) +LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols, uint modelDataBaseSize = sizeof(LLVMModelData); @@ -473,6 +475,9 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h -LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols); +LLVMModelData createModelData(const rrllvm::LLVMModelDataSymbols &symbols, diff --git a/source/llvm/Random.cpp b/source/llvm/Random.cpp --- a/source/llvm/Random.cpp +++ b/source/llvm/Random.cpp #include "LLVMIncludes.h" using namespace llvm; } / namespace rrllvm */ diff --git a/source/llvm_testing/src/tests.cpp b/source/llvm_testing/src/tests.cpp --- a/source/llvm_testing/src/tests.cpp +++ b/source/llvm_testing/src/tests.cpp LLVMModelDataIRBuilderTesting builder(c.getModelDataSymbols(), c.getBuilder()); diff --git a/source/llvm/DistribFunctionResolver.cpp b/source/llvm/DistribFunctionResolver.cpp --- a/source/llvm/DistribFunctionResolver.cpp +++ b/source/llvm/DistribFunctionResolver.cpp +#include "LLVMException.h" using namespace llvm; @@ -19,9 +19,12 @@ namespace rrllvm
  •    const ModelGeneratorContext& ctx, llvm::Value *modelData) :
    

@@ -33,9 +36,27 @@ llvm::Value* DistribFunctionResolver::loadSymbolValue(

  • llvm::Value *randomPtr = mdbuilder.createRandomLoad();
  •    throw_llvm_exception("invalid number of args");
    
  • llvm::Value *funcArgs[] = {randomPtr, args[0], args[1]};
  • llvm::Value func = module->getFunction("rr_distrib_uniform"); } / namespace rrllvm */ diff --git a/source/llvm/DistribFunctionResolver.h b/source/llvm/DistribFunctionResolver.h --- a/source/llvm/DistribFunctionResolver.h +++ b/source/llvm/DistribFunctionResolver.h @@ -22,7 +22,8 @@ namespace rrllvm
  •        llvm::Value *modelData);
    
    llvm::Value *loadSymbolValue(const libsbml::FunctionDefinition *funcDef, llvm::IRBuilder<> &builder;
  • llvm::Value* modelData;
  • const LLVMModelDataSymbols &modelDataSymbols;
  • llvm::Module module; } / namespace rrllvm */ diff --git a/source/llvm/FunctionResolver.cpp b/source/llvm/FunctionResolver.cpp --- a/source/llvm/FunctionResolver.cpp +++ b/source/llvm/FunctionResolver.cpp
  •    llvm::Value *modelData,
    

@@ -65,7 +67,7 @@ llvm::Value* FunctionResolver::loadSymbolValue(const std::string& symbol, diff --git a/source/llvm/FunctionResolver.h b/source/llvm/FunctionResolver.h --- a/source/llvm/FunctionResolver.h +++ b/source/llvm/FunctionResolver.h

  •        llvm::Value *modelData,
    
    llvm::IRBuilder<> &builder;
  • llvm::Value modelData; diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -529,6 +529,13 @@ llvm::Value ModelDataIRBuilder::createStoichiometryLoad(uint row, uint col, +llvm::Value *ModelDataIRBuilder::createRandomLoad()
  • LLVMContext &context = builder.getContext(); void ModelDataIRBuilder::validateStruct(llvm::Value* s, diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h const llvm::Twine& name = "");
  • llvm::Value createRandomLoad(); diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp @@ -67,7 +67,7 @@ llvm::Value ModelDataLoadSymbolResolver::loadSymbolValue( diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp using namespace llvm; modelSymbols = new LLVMModelSymbols(getModel(), *symbols); // initialize LLVM
  •    // Random adds mappings, need call after llvm objs created
    
  •    // Random adds mappings, need call after llvm objs created
    

diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/source/llvm/ModelInitialValueSymbolResolver.cpp --- a/source/llvm/ModelInitialValueSymbolResolver.cpp +++ b/source/llvm/ModelInitialValueSymbolResolver.cpp @@ -62,7 +62,7 @@ llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue( diff --git a/source/llvm/Random.cpp b/source/llvm/Random.cpp --- a/source/llvm/Random.cpp +++ b/source/llvm/Random.cpp +#include "LLVMIncludes.h" +using namespace llvm; namespace rrllvm

  •    llvm::FunctionType *funcType, Module *module);
    
  •    llvm::FunctionType *funcType, Module *module)
    
  • llvm::Module *module = ctx.getModule();
  • LLVMContext& context = module->getContext();
  • llvm::ExecutionEngine *executionEngine = &ctx.getExecutionEngine();
  • // LLVM does not appear to have a true void ptr, so just use a pointer
  • // used for the LLVMModelData::random which is not accessed by
  • // generated llvm code anyway.
  • // see also, llvm::StructType ModelDataIRBuilder::createModelDataStructType(...) } / namespace rrllvm / diff --git a/source/llvm/Random.h b/source/llvm/Random.h --- a/source/llvm/Random.h +++ b/source/llvm/Random.h #ifndef RRLLVM_RANDOM_H #define RRLLVM_RANDOM_H namespace rrllvm } / namespace rrllvm / #endif / RRLLVM_RANDOM_H / diff --git a/source/llvm/SBMLInitialValueSymbolResolver.cpp b/source/llvm/SBMLInitialValueSymbolResolver.cpp --- a/source/llvm/SBMLInitialValueSymbolResolver.cpp +++ b/source/llvm/SBMLInitialValueSymbolResolver.cpp @@ -42,7 +42,7 @@ llvm::Value SBMLInitialValueSymbolResolver::loadSymbolValue( diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp
  •        cout << "usage: llvm_testing distrib fname";
    

diff --git a/source/llvm/CodeGenBase.h b/source/llvm/CodeGenBase.h --- a/source/llvm/CodeGenBase.h +++ b/source/llvm/CodeGenBase.h diff --git a/source/llvm/DistribFunctionResolver.cpp b/source/llvm/DistribFunctionResolver.cpp --- a/source/llvm/DistribFunctionResolver.cpp +++ b/source/llvm/DistribFunctionResolver.cpp #include <llvm/DistribFunctionResolver.h> +using namespace llvm; namespace rrllvm +llvm::Value* DistribFunctionResolver::loadSymbolValue(

  •    const llvm::ArrayRef<llvm::Value*>& args)
    

} /* namespace rrllvm */ diff --git a/source/llvm/DistribFunctionResolver.h b/source/llvm/DistribFunctionResolver.h --- a/source/llvm/DistribFunctionResolver.h +++ b/source/llvm/DistribFunctionResolver.h +#include "LLVMIncludes.h" namespace rrllvm

  • llvm::Value *loadSymbolValue(const libsbml::FunctionDefinition *funcDef,
  •        const llvm::ArrayRef<llvm::Value*>& args =
    
  •                llvm::ArrayRef<llvm::Value*>());
    
  • llvm::IRBuilder<> &builder; } /* namespace rrllvm */ diff --git a/source/llvm/EvalConversionFactorCodeGen.cpp b/source/llvm/EvalConversionFactorCodeGen.cpp --- a/source/llvm/EvalConversionFactorCodeGen.cpp +++ b/source/llvm/EvalConversionFactorCodeGen.cpp diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp
  •    llvm::Value *modelData, ModelDataStoreSymbolResolver& modelDataResolver)
    
  •    llvm::Value *modelData, ModelDataStoreSymbolResolver& modelDataResolver,
    

diff --git a/source/llvm/EvalInitialConditionsCodeGen.h b/source/llvm/EvalInitialConditionsCodeGen.h --- a/source/llvm/EvalInitialConditionsCodeGen.h +++ b/source/llvm/EvalInitialConditionsCodeGen.h void codeGenStoichiometry(llvm::Value *modelData, diff --git a/source/llvm/EvalRateRuleRatesCodeGen.cpp b/source/llvm/EvalRateRuleRatesCodeGen.cpp --- a/source/llvm/EvalRateRuleRatesCodeGen.cpp +++ b/source/llvm/EvalRateRuleRatesCodeGen.cpp diff --git a/source/llvm/EvalReactionRatesCodeGen.cpp b/source/llvm/EvalReactionRatesCodeGen.cpp --- a/source/llvm/EvalReactionRatesCodeGen.cpp +++ b/source/llvm/EvalReactionRatesCodeGen.cpp diff --git a/source/llvm/EvalVolatileStoichCodeGen.cpp b/source/llvm/EvalVolatileStoichCodeGen.cpp --- a/source/llvm/EvalVolatileStoichCodeGen.cpp +++ b/source/llvm/EvalVolatileStoichCodeGen.cpp diff --git a/source/llvm/EventAssignCodeGen.cpp b/source/llvm/EventAssignCodeGen.cpp --- a/source/llvm/EventAssignCodeGen.cpp +++ b/source/llvm/EventAssignCodeGen.cpp @@ -31,8 +31,7 @@ bool EventAssignCodeGen::eventCodeGen(llvm::Value *modelData, llvm::Value *data, const libsbml::Event *event) diff --git a/source/llvm/EventTriggerCodeGen.cpp b/source/llvm/EventTriggerCodeGen.cpp --- a/source/llvm/EventTriggerCodeGen.cpp +++ b/source/llvm/EventTriggerCodeGen.cpp @@ -31,8 +31,7 @@ bool EventTriggerCodeGen::eventCodeGen(llvm::Value *modelData, llvm::Value data, const libsbml::Event event) diff --git a/source/llvm/FunctionResolver.cpp b/source/llvm/FunctionResolver.cpp --- a/source/llvm/FunctionResolver.cpp +++ b/source/llvm/FunctionResolver.cpp #include "LLVMException.h" namespace rrllvm

  •    const libsbml::Model* model, llvm::IRBuilder<>& builder) :
    

@@ -49,6 +57,19 @@ llvm::Value* FunctionResolver::loadSymbolValue(const std::string& symbol, diff --git a/source/llvm/FunctionResolver.h b/source/llvm/FunctionResolver.h --- a/source/llvm/FunctionResolver.h +++ b/source/llvm/FunctionResolver.h

  •        const libsbml::Model *model, llvm::IRBuilder<> &builder);
    
    llvm::IRBuilder<> &builder; diff --git a/source/llvm/GetEventValuesCodeGen.h b/source/llvm/GetEventValuesCodeGen.h --- a/source/llvm/GetEventValuesCodeGen.h +++ b/source/llvm/GetEventValuesCodeGen.h @@ -86,8 +86,7 @@ llvm::Value GetEventValueCodeGenBase<Derived, FunctionPtrType>::codeGen() diff --git a/source/llvm/GetInitialValueCodeGenBase.h b/source/llvm/GetInitialValueCodeGenBase.h --- a/source/llvm/GetInitialValueCodeGenBase.h +++ b/source/llvm/GetInitialValueCodeGenBase.h @@ -70,8 +70,7 @@ llvm::Value GetInitialValueCodeGenBase<Derived, substanceUnits>::codeGen() llvm::BasicBlock def = llvm::BasicBlock::Create(this->context, "default", this->function); diff --git a/source/llvm/GetValueCodeGenBase.h b/source/llvm/GetValueCodeGenBase.h --- a/source/llvm/GetValueCodeGenBase.h +++ b/source/llvm/GetValueCodeGenBase.h @@ -70,9 +70,7 @@ llvm::Value GetValueCodeGenBase<Derived, substanceUnits>::codeGen() llvm::BasicBlock *def = llvm::BasicBlock::Create(this->context, "default", this->function); diff --git a/source/llvm/LoadSymbolResolverBase.cpp b/source/llvm/LoadSymbolResolverBase.cpp --- a/source/llvm/LoadSymbolResolverBase.cpp +++ b/source/llvm/LoadSymbolResolverBase.cpp @@ -23,14 +23,12 @@ namespace rrllvm
  •    const LLVMModelSymbols& modelSymbols,
    
  •    const LLVMModelDataSymbols& modelDataSymbols,
    
  •    llvm::IRBuilder<>& builder) :
    

diff --git a/source/llvm/LoadSymbolResolverBase.h b/source/llvm/LoadSymbolResolverBase.h --- a/source/llvm/LoadSymbolResolverBase.h +++ b/source/llvm/LoadSymbolResolverBase.h #include "LLVMIncludes.h" #include "LLVMModelDataSymbols.h" #include "LLVMModelSymbols.h"

  •        const LLVMModelSymbols &modelSymbols,
    
  •        const LLVMModelDataSymbols &modelDataSymbols,
    
  •        llvm::IRBuilder<> &builder);
    
    const LLVMModelDataSymbols &modelDataSymbols; const LLVMModelSymbols &modelSymbols; diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp @@ -23,11 +23,8 @@ namespace rrllvm ModelDataLoadSymbolResolver::ModelDataLoadSymbolResolver(llvm::Value *modelData,
  •    const LLVMModelSymbols &modelSymbols,
    
  •    const LLVMModelDataSymbols &modelDataSymbols,
    
  •    llvm::IRBuilder<> &builder) :
    

@@ -70,7 +67,7 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue( diff --git a/source/llvm/ModelDataSymbolResolver.h b/source/llvm/ModelDataSymbolResolver.h --- a/source/llvm/ModelDataSymbolResolver.h +++ b/source/llvm/ModelDataSymbolResolver.h ModelDataLoadSymbolResolver(llvm::Value *modelData,

  •        const libsbml::Model *model, const LLVMModelSymbols &modelSymbols,
    
  •        const LLVMModelDataSymbols &modelDataSymbols,
    
  •        llvm::IRBuilder<> &builder);
    

diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/source/llvm/ModelInitialValueSymbolResolver.cpp --- a/source/llvm/ModelInitialValueSymbolResolver.cpp +++ b/source/llvm/ModelInitialValueSymbolResolver.cpp @@ -20,11 +20,8 @@ namespace rrllvm llvm::Value *modelData,

  •    const LLVMModelSymbols &modelSymbols,
    
  •    const LLVMModelDataSymbols &modelDataSymbols,
    
  •    llvm::IRBuilder<> &builder) :
    

@@ -65,7 +62,7 @@ llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue( diff --git a/source/llvm/ModelInitialValueSymbolResolver.h b/source/llvm/ModelInitialValueSymbolResolver.h --- a/source/llvm/ModelInitialValueSymbolResolver.h +++ b/source/llvm/ModelInitialValueSymbolResolver.h ModelInitialValueSymbolResolver(llvm::Value *modelData,

  •        const libsbml::Model *model, const LLVMModelSymbols &modelSymbols,
    
  •        const LLVMModelDataSymbols &modelDataSymbols,
    
  •        llvm::IRBuilder<> &builder);
    

diff --git a/source/llvm/SBMLInitialValueSymbolResolver.cpp b/source/llvm/SBMLInitialValueSymbolResolver.cpp --- a/source/llvm/SBMLInitialValueSymbolResolver.cpp +++ b/source/llvm/SBMLInitialValueSymbolResolver.cpp @@ -19,11 +19,9 @@ namespace rrllvm

  •    const LLVMModelDataSymbols& modelDataSymbols,
    
  •    const LLVMModelSymbols& modelSymbols,
    
  •    llvm::IRBuilder<>& builder) :
    
  •    llvm::Value *modelData,
    

@@ -44,7 +42,7 @@ llvm::Value* SBMLInitialValueSymbolResolver::loadSymbolValue( diff --git a/source/llvm/SBMLInitialValueSymbolResolver.h b/source/llvm/SBMLInitialValueSymbolResolver.h --- a/source/llvm/SBMLInitialValueSymbolResolver.h +++ b/source/llvm/SBMLInitialValueSymbolResolver.h @@ -27,9 +27,14 @@ namespace rrllvm

  •        const LLVMModelDataSymbols &modelDataSymbols,
    
  •        const LLVMModelSymbols &modelSymbols, llvm::IRBuilder<> &builder);
    
  • SBMLInitialValueSymbolResolver(llvm::Value *modelData, const llvm::ArrayRefllvm::Value*& args = llvm::ArrayRefllvm::Value*());
  • llvm::Value modelData; diff --git a/source/llvm/SetInitialValueCodeGenBase.h b/source/llvm/SetInitialValueCodeGenBase.h --- a/source/llvm/SetInitialValueCodeGenBase.h +++ b/source/llvm/SetInitialValueCodeGenBase.h @@ -74,8 +74,7 @@ llvm::Value SetInitialValueCodeGenBase<Derived, substanceUnits>::codeGen() diff --git a/source/llvm/SetValueCodeGenBase.h b/source/llvm/SetValueCodeGenBase.h --- a/source/llvm/SetValueCodeGenBase.h +++ b/source/llvm/SetValueCodeGenBase.h @@ -70,8 +70,7 @@ llvm::Value* SetValueCodeGenBase<Derived, substanceUnits>::codeGen() Removed unused fields from LLVMModelData structure, added field for pointer to Random object. @@ -126,6 +126,8 @@ if(BUILD_LLVM) llvm/SBMLSupportFunctions llvm/EvalVolatileStoichCodeGen llvm/SBMLInitialValueSymbolResolver
  •    llvm/Random
    
  •    llvm/DistribFunctionResolver
    

endif(BUILD_LLVM) diff --git a/source/llvm/DistribFunctionResolver.cpp b/source/llvm/DistribFunctionResolver.cpp +++ b/source/llvm/DistribFunctionResolver.cpp +#include <llvm/DistribFunctionResolver.h> +namespace rrllvm +} /* namespace rrllvm / diff --git a/source/llvm/DistribFunctionResolver.h b/source/llvm/DistribFunctionResolver.h +++ b/source/llvm/DistribFunctionResolver.h +namespace rrllvm +} / namespace rrllvm */ diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp @@ -103,6 +101,7 @@ void LLVMModelData_free(LLVMModelData *data) diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h @@ -20,7 +20,6 @@ namespace rrllvm @@ -74,49 +73,47 @@ struct LLVMModelData

  • * The rrllvm::Random class holds a RNG and caches random distributions
    

@@ -180,15 +177,14 @@ struct LLVMModelData @@ -202,7 +198,7 @@ struct LLVMModelData @@ -213,23 +209,22 @@ struct LLVMModelData diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -309,11 +307,6 @@ uint LLVMModelDataSymbols::getBoundarySpeciesSize() const -uint LLVMModelDataSymbols::getConservedSpeciesSize() const uint LLVMModelDataSymbols::getGlobalParameterIndex( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp #include "LLVMIncludes.h" @@ -158,8 +159,6 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -305,7 +304,14 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -379,7 +385,6 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) @@ -397,7 +402,6 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) @@ -414,7 +418,6 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) @@ -438,9 +441,6 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -566,7 +566,6 @@ llvm::StructType *ModelDataIRBuilder::createModelDataStructType(llvm::Module *mo @@ -588,6 +587,12 @@ llvm::StructType *ModelDataIRBuilder::createModelDataStructType(llvm::Module *mo

  •    // LLVM does not appear to have a true void ptr, so just use a pointer
    
  •    // used for the LLVMModelData::random which is not accessed by
    
  •    // generated llvm code anyway.
    

@@ -595,18 +600,18 @@ llvm::StructType *ModelDataIRBuilder::createModelDataStructType(llvm::Module *mo @@ -617,27 +622,25 @@ llvm::StructType ModelDataIRBuilder::createModelDataStructType(llvm::Module mo diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp @@ -356,7 +367,7 @@ llvm::IRBuilder<> &ModelGeneratorContext::getBuilder() const void ModelGeneratorContext::stealThePeach(const LLVMModelDataSymbols sym, const llvm::LLVMContext ctx, const llvm::ExecutionEngine eng, @@ -364,6 +375,8 @@ void ModelGeneratorContext::stealThePeach(const LLVMModelDataSymbols **sym, diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h #include "LLVMIncludes.h" #include "LLVMModelDataSymbols.h" #include "LLVMModelSymbols.h" void stealThePeach(const LLVMModelDataSymbols **sym, const llvm::LLVMContext **ctx, const llvm::ExecutionEngine **eng, llvm::FunctionPassManager *functionPassManager; diff --git a/source/llvm/ModelResources.cpp b/source/llvm/ModelResources.cpp --- a/source/llvm/ModelResources.cpp +++ b/source/llvm/ModelResources.cpp @@ -16,7 +17,7 @@ namespace rrllvm diff --git a/source/llvm/ModelResources.h b/source/llvm/ModelResources.h --- a/source/llvm/ModelResources.h +++ b/source/llvm/ModelResources.h const LLVMModelDataSymbols *symbols; const llvm::LLVMContext *context; const llvm::ExecutionEngine executionEngine; diff --git a/source/llvm/Random.cpp b/source/llvm/Random.cpp +++ b/source/llvm/Random.cpp +namespace rrllvm +} / namespace rrllvm */ diff --git a/source/llvm/Random.h b/source/llvm/Random.h +++ b/source/llvm/Random.h

    • LLVMRandom.h +#ifndef RRLLVM_RANDOM_H +#define RRLLVM_RANDOM_H +namespace rrllvm +} /* namespace rrllvm / +#endif / RRLLVM_RANDOM_H */

Add the LLVM sources to compilation

if(BUILD_LLVM)

  •    llvm/AssignmentRuleEvaluator.cpp
    
  •    llvm/ASTNodeCodeGen.cpp
    
  •    llvm/ASTNodeFactory.cpp
    
  •    llvm/ModelResources.cpp
    
  •    llvm/CodeGenBase.cpp
    
  •    llvm/LLVMCompiler.cpp
    
  •    llvm/EvalConversionFactorCodeGen.cpp
    
  •    llvm/EvalInitialConditionsCodeGen.cpp
    
  •    llvm/EvalRateRuleRatesCodeGen.cpp
    
  •    llvm/EvalReactionRatesCodeGen.cpp
    
  •    llvm/EventAssignCodeGen.cpp
    
  •    llvm/EventTriggerCodeGen.cpp
    
  •    llvm/EventQueue.cpp
    
  •    llvm/FunctionResolver.cpp
    
  •    llvm/LLVMExecutableModel.cpp
    
  •    llvm/GetRateRuleValuesCodeGen.cpp
    
  •    llvm/GetValuesCodeGen.cpp
    
  •    llvm/LoadSymbolResolverBase.cpp
    
  •    llvm/GetInitialValuesCodeGen.cpp
    
  •    llvm/GetEventValuesCodeGen.cpp
    
  •    llvm/KineticLawParameterResolver.cpp
    
  •    llvm/LLVMModelData.cpp
    
  •    llvm/ModelDataIRBuilder.cpp
    
  •    llvm/ModelDataSymbolResolver.cpp
    
  •    llvm/ModelInitialValueSymbolResolver.cpp
    
  •    llvm/LLVMModelDataSymbols.cpp
    
  •    llvm/LLVMModelGenerator.cpp
    
  •    llvm/ModelGeneratorContext.cpp
    
  •    llvm/LLVMModelSymbols.cpp
    
  •    llvm/SetRateRuleValuesCodeGen.cpp
    
  •    llvm/SetValuesCodeGen.cpp
    
  •    llvm/SetInitialValuesCodeGen.cpp
    
  •    llvm/SBMLSupportFunctions.cpp
    
  •    llvm/EvalVolatileStoichCodeGen.cpp
    
  •    llvm/SBMLInitialValueSymbolResolver.cpp
    
  •    llvm/AssignmentRuleEvaluator.h
    
  •    llvm/ASTNodeCodeGen.h
    
  •    llvm/ASTNodeFactory.h
    
  •    llvm/ModelResources.h
    
  •    llvm/CodeGenBase.h
    
  •    llvm/LLVMCompiler.h
    
  •    llvm/EvalConversionFactorCodeGen.h
    
  •    llvm/EvalInitialConditionsCodeGen.h
    
  •    llvm/EvalRateRuleRatesCodeGen.h
    
  •    llvm/EvalReactionRatesCodeGen.h
    
  •    llvm/EventAssignCodeGen.h
    
  •    llvm/EventTriggerCodeGen.h
    
  •    llvm/EventQueue.h
    
  •    llvm/FunctionResolver.h
    
  •    llvm/LLVMExecutableModel.h
    
  •    llvm/GetRateRuleValuesCodeGen.h
    
  •    llvm/GetValuesCodeGen.h
    
  •    llvm/LoadSymbolResolverBase.h
    
  •    llvm/GetInitialValuesCodeGen.h
    
  •    llvm/GetEventValuesCodeGen.h
    
  •    llvm/KineticLawParameterResolver.h
    
  •    llvm/LLVMModelData.h
    
  •    llvm/ModelDataIRBuilder.h
    
  •    llvm/ModelDataSymbolResolver.h
    
  •    llvm/ModelInitialValueSymbolResolver.h
    
  •    llvm/LLVMModelDataSymbols.h
    
  •    llvm/LLVMModelGenerator.h
    
  •    llvm/ModelGeneratorContext.h
    
  •    llvm/LLVMModelSymbols.h
    
  •    llvm/SetRateRuleValuesCodeGen.h
    
  •    llvm/SetValuesCodeGen.h
    
  •    llvm/SetInitialValuesCodeGen.h
    
  •    llvm/SBMLSupportFunctions.h
    
  •    llvm/EvalVolatileStoichCodeGen.h
    
  •    llvm/SBMLInitialValueSymbolResolver.h
    
  •    llvm/AssignmentRuleEvaluator
    
  •    llvm/ASTNodeCodeGen
    
  •    llvm/ASTNodeFactory
    
  •    llvm/ModelResources
    
  •    llvm/CodeGenBase
    
  •    llvm/LLVMCompiler
    
  •    llvm/EvalConversionFactorCodeGen
    
  •    llvm/EvalInitialConditionsCodeGen
    
  •    llvm/EvalRateRuleRatesCodeGen
    
  •    llvm/EvalReactionRatesCodeGen
    
  •    llvm/EventAssignCodeGen
    
  •    llvm/EventTriggerCodeGen
    
  •    llvm/EventQueue
    
  •    llvm/FunctionResolver
    
  •    llvm/LLVMExecutableModel
    
  •    llvm/GetRateRuleValuesCodeGen
    
  •    llvm/GetValuesCodeGen
    
  •    llvm/LoadSymbolResolverBase
    
  •    llvm/GetInitialValuesCodeGen
    
  •    llvm/GetEventValuesCodeGen
    
  •    llvm/KineticLawParameterResolver
    
  •    llvm/LLVMModelData
    
  •    llvm/ModelDataIRBuilder
    
  •    llvm/ModelDataSymbolResolver
    
  •    llvm/ModelInitialValueSymbolResolver
    
  •    llvm/LLVMModelDataSymbols
    
  •    llvm/LLVMModelGenerator
    
  •    llvm/ModelGeneratorContext
    
  •    llvm/LLVMModelSymbols
    
  •    llvm/SetRateRuleValuesCodeGen
    
  •    llvm/SetValuesCodeGen
    
  •    llvm/SetInitialValuesCodeGen
    
  •    llvm/SBMLSupportFunctions
    
  •    llvm/EvalVolatileStoichCodeGen
    
  •    llvm/SBMLInitialValueSymbolResolver
    

endif(BUILD_LLVM) diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt

  • src/LLVMCSRMatrixTest.cpp
  • src/LLVMCSRMatrixTest.h
  • src/LLVMCSRMatrixTest +#ifdef BUILD_LLVM

Add the LLVM sources to compilation

if(BUILD_LLVM)

  •    llvm/AssignmentRuleEvaluator
    
  •    llvm/ASTNodeCodeGen
    
  •    llvm/ASTNodeFactory
    
  •    llvm/ModelResources
    
  •    llvm/CodeGenBase
    
  •    llvm/LLVMCompiler
    
  •    llvm/EvalConversionFactorCodeGen
    
  •    llvm/EvalInitialConditionsCodeGen
    
  •    llvm/EvalRateRuleRatesCodeGen
    
  •    llvm/EvalReactionRatesCodeGen
    
  •    llvm/EventAssignCodeGen
    
  •    llvm/EventTriggerCodeGen
    
  •    llvm/EventQueue
    
  •    llvm/FunctionResolver
    
  •    llvm/LLVMExecutableModel
    
  •    llvm/GetRateRuleValuesCodeGen
    
  •    llvm/GetValuesCodeGen
    
  •    llvm/LoadSymbolResolverBase
    
  •    llvm/GetInitialValuesCodeGen
    
  •    llvm/GetEventValuesCodeGen
    
  •    llvm/KineticLawParameterResolver
    
  •    llvm/LLVMModelData
    
  •    llvm/ModelDataIRBuilder
    
  •    llvm/ModelDataSymbolResolver
    
  •    llvm/ModelInitialValueSymbolResolver
    
  •    llvm/LLVMModelDataSymbols
    
  •    llvm/LLVMModelGenerator
    
  •    llvm/ModelGeneratorContext
    
  •    llvm/LLVMModelSymbols
    
  •    llvm/SetRateRuleValuesCodeGen
    
  •    llvm/SetValuesCodeGen
    
  •    llvm/SetInitialValuesCodeGen
    
  •    llvm/SBMLSupportFunctions
    
  •    llvm/EvalVolatileStoichCodeGen
    
  •    llvm/SBMLInitialValueSymbolResolver
    
  •    llvm/AssignmentRuleEvaluator.cpp
    
  •    llvm/ASTNodeCodeGen.cpp
    
  •    llvm/ASTNodeFactory.cpp
    
  •    llvm/ModelResources.cpp
    
  •    llvm/CodeGenBase.cpp
    
  •    llvm/LLVMCompiler.cpp
    
  •    llvm/EvalConversionFactorCodeGen.cpp
    
  •    llvm/EvalInitialConditionsCodeGen.cpp
    
  •    llvm/EvalRateRuleRatesCodeGen.cpp
    
  •    llvm/EvalReactionRatesCodeGen.cpp
    
  •    llvm/EventAssignCodeGen.cpp
    
  •    llvm/EventTriggerCodeGen.cpp
    
  •    llvm/EventQueue.cpp
    
  •    llvm/FunctionResolver.cpp
    
  •    llvm/LLVMExecutableModel.cpp
    
  •    llvm/GetRateRuleValuesCodeGen.cpp
    
  •    llvm/GetValuesCodeGen.cpp
    
  •    llvm/LoadSymbolResolverBase.cpp
    
  •    llvm/GetInitialValuesCodeGen.cpp
    
  •    llvm/GetEventValuesCodeGen.cpp
    
  •    llvm/KineticLawParameterResolver.cpp
    
  •    llvm/LLVMModelData.cpp
    
  •    llvm/ModelDataIRBuilder.cpp
    
  •    llvm/ModelDataSymbolResolver.cpp
    
  •    llvm/ModelInitialValueSymbolResolver.cpp
    
  •    llvm/LLVMModelDataSymbols.cpp
    
  •    llvm/LLVMModelGenerator.cpp
    
  •    llvm/ModelGeneratorContext.cpp
    
  •    llvm/LLVMModelSymbols.cpp
    
  •    llvm/SetRateRuleValuesCodeGen.cpp
    
  •    llvm/SetValuesCodeGen.cpp
    
  •    llvm/SetInitialValuesCodeGen.cpp
    
  •    llvm/SBMLSupportFunctions.cpp
    
  •    llvm/EvalVolatileStoichCodeGen.cpp
    
  •    llvm/SBMLInitialValueSymbolResolver.cpp
    
  •    llvm/AssignmentRuleEvaluator.h
    
  •    llvm/ASTNodeCodeGen.h
    
  •    llvm/ASTNodeFactory.h
    
  •    llvm/ModelResources.h
    
  •    llvm/CodeGenBase.h
    
  •    llvm/LLVMCompiler.h
    
  •    llvm/EvalConversionFactorCodeGen.h
    
  •    llvm/EvalInitialConditionsCodeGen.h
    
  •    llvm/EvalRateRuleRatesCodeGen.h
    
  •    llvm/EvalReactionRatesCodeGen.h
    
  •    llvm/EventAssignCodeGen.h
    
  •    llvm/EventTriggerCodeGen.h
    
  •    llvm/EventQueue.h
    
  •    llvm/FunctionResolver.h
    
  •    llvm/LLVMExecutableModel.h
    
  •    llvm/GetRateRuleValuesCodeGen.h
    
  •    llvm/GetValuesCodeGen.h
    
  •    llvm/LoadSymbolResolverBase.h
    
  •    llvm/GetInitialValuesCodeGen.h
    
  •    llvm/GetEventValuesCodeGen.h
    
  •    llvm/KineticLawParameterResolver.h
    
  •    llvm/LLVMModelData.h
    
  •    llvm/ModelDataIRBuilder.h
    
  •    llvm/ModelDataSymbolResolver.h
    
  •    llvm/ModelInitialValueSymbolResolver.h
    
  •    llvm/LLVMModelDataSymbols.h
    
  •    llvm/LLVMModelGenerator.h
    
  •    llvm/ModelGeneratorContext.h
    
  •    llvm/LLVMModelSymbols.h
    
  •    llvm/SetRateRuleValuesCodeGen.h
    
  •    llvm/SetValuesCodeGen.h
    
  •    llvm/SetInitialValuesCodeGen.h
    
  •    llvm/SBMLSupportFunctions.h
    
  •    llvm/EvalVolatileStoichCodeGen.h
    
  •    llvm/SBMLInitialValueSymbolResolver.h
    

endif(BUILD_LLVM) diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt

  • src/LLVMCSRMatrixTest
  • src/LLVMCSRMatrixTest.cpp
  • src/LLVMCSRMatrixTest.h +#ifdef BUILD_LLVM diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp
  •        cout << "usage: llvm_testing validate fname";
    

diff --git a/source/llvm_testing/src/ConfigurableTest.cpp b/source/llvm_testing/src/ConfigurableTest.cpp --- a/source/llvm_testing/src/ConfigurableTest.cpp +++ b/source/llvm_testing/src/ConfigurableTest.cpp diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -320,14 +320,14 @@ llvm::Value* ASTNodeCodeGen::applyArithmeticCodeGen( @@ -351,8 +351,8 @@ llvm::Value* ASTNodeCodeGen::applyArithmeticCodeGen( llvm::Value* ASTNodeCodeGen::applyRelationalCodeGen(const libsbml::ASTNode* ast) @@ -456,7 +456,7 @@ llvm::Value* ASTNodeCodeGen::functionCallCodeGen(const libsbml::ASTNode* ast) @@ -632,7 +632,7 @@ llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode ast) @@ -713,7 +713,24 @@ llvm::Value ASTNodeCodeGen::toBoolean(llvm::Value* value)

  • throw_llvm_exception("unsupported type conversion to boolean"); +llvm::Value* ASTNodeCodeGen::toDouble(llvm::Value* value)
  • throw_llvm_exception("unsupported type convertion to double"); @@ -772,13 +789,13 @@ llvm::Value* ASTNodeCodeGen::piecewiseCodeGen(const libsbml::ASTNode* ast) @@ -801,7 +818,7 @@ llvm::Value* ASTNodeCodeGen::piecewiseCodeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/ASTNodeCodeGen.h b/source/llvm/ASTNodeCodeGen.h --- a/source/llvm/ASTNodeCodeGen.h +++ b/source/llvm/ASTNodeCodeGen.h llvm::Value *toBoolean(llvm::Value *value);
  • llvm::Value toDouble(llvm::Value value); llvm::IRBuilder<> &builder;
  • If LLVM build is enabled, setting compiler to "llvm" enables llvm based diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1536,13 +1536,62 @@ int LLVMExecutableModel::setFloatingSpeciesAmounts(int len, int const *indx, int LLVMExecutableModel::setFloatingSpeciesConcentrations(int len,
  •            &LLVMExecutableModel::getFloatingSpeciesId, len, indx, values);
    
  •            throw_llvm_exception(s.str());
    

int LLVMExecutableModel::getBoundarySpeciesAmounts(int len, const int* indx, diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1476,6 +1476,63 @@ int LLVMExecutableModel::getFloatingSpeciesAmounts(int len, const int* indx, +int LLVMExecutableModel::setFloatingSpeciesAmounts(int len, int const *indx,

  •        throw_llvm_exception(s.str());
    

int LLVMExecutableModel::setFloatingSpeciesConcentrations(int len, @@ -1689,19 +1746,6 @@ int LLVMExecutableModel::getRateRueRates(int len, -int LLVMExecutableModel::setFloatingSpeciesAmounts(int len, int const *indx,

  •            &LLVMExecutableModel::getFloatingSpeciesId, len, indx, values);
    

int LLVMExecutableModel::setCompartmentVolumes(int len, const int* indx, diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -864,6 +864,22 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, @@ -1031,6 +1047,17 @@ uint LLVMModelDataSymbols::getCompartmentIndexForFloatingSpecies( +bool LLVMModelDataSymbols::isConservedMoietySpecies(uint id, uint& result) const diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h #include "LLVMModelData.h" diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -239,11 +239,7 @@ LLVMExecutableModel::LLVMExecutableModel( LLVMExecutableModel::~LLVMExecutableModel() @@ -648,12 +644,29 @@ void LLVMExecutableModel::evalInitialConditions() void LLVMExecutableModel::reset() +void LLVMExecutableModel::reset(int opt) @@ -668,7 +681,7 @@ void LLVMExecutableModel::reset() @@ -703,13 +716,18 @@ void LLVMExecutableModel::reset() @@ -751,10 +769,7 @@ void LLVMExecutableModel::reset() @@ -1518,6 +1533,10 @@ int LLVMExecutableModel::setGlobalParameterValues(int len, const int* indx, @@ -1971,7 +1990,8 @@ int LLVMExecutableModel::setFloatingSpeciesInitConcentrations(int len, @@ -2000,7 +2020,7 @@ int LLVMExecutableModel::setFloatingSpeciesInitAmounts(int len, int const *indx, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp @@ -54,7 +54,34 @@ LLVMModelSymbols::LLVMModelSymbols(const libsbml::Model *m, LLVMModelDataSymbols diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp

  •        cout << "usage: llvm_testing reset fname what";
    

diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1338,9 +1338,18 @@ int LLVMExecutableModel::getFloatingSpeciesConcentrationRates(int len, diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1313,8 +1313,46 @@ void LLVMExecutableModel::setValue(const std::string& id, double value) int LLVMExecutableModel::getFloatingSpeciesConcentrationRates(int len,

  • throw LLVMException(string(FUNC) + " not implemented"); int LLVMExecutableModel::setBoundarySpeciesAmounts(int len, const int* indx, @@ -1581,7 +1619,11 @@ int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -185,7 +185,7 @@ LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model model, @@ -885,6 +885,27 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model model,
  •        throw_llvm_exception("species " + s->getId() +
    

@@ -1000,6 +1021,16 @@ std::string LLVMModelDataSymbols::getGlobalParameterId(uint indx) const +uint LLVMModelDataSymbols::getCompartmentIndexForFloatingSpecies( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -187,7 +187,8 @@ LLVMExecutableModel::LLVMExecutableModel() : @@ -228,7 +229,8 @@ LLVMExecutableModel::LLVMExecutableModel( @@ -686,39 +688,67 @@ void LLVMExecutableModel::reset() @@ -730,6 +760,9 @@ void LLVMExecutableModel::reset() @@ -1431,6 +1464,15 @@ int LLVMExecutableModel::setGlobalParameterValues(int len, const int* indx, &LLVMExecutableModel::getGlobalParameterId, len, indx, values); @@ -1513,8 +1555,14 @@ int LLVMExecutableModel::getConservedMoietyValues(int len, const int* indx, int LLVMExecutableModel::setConservedMoietyValues(int len, const int* indx,

  • throw_llvm_exception("conserved moieties are read only"); int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, @@ -1868,6 +1916,8 @@ int LLVMExecutableModel::setFloatingSpeciesInitConcentrations(int len, &LLVMExecutableModel::getFloatingSpeciesId, len, indx, values); @@ -1895,6 +1945,8 @@ int LLVMExecutableModel::setFloatingSpeciesInitAmounts(int len, int const *indx, &LLVMExecutableModel::getFloatingSpeciesId, len, indx, values); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1481,7 +1481,15 @@ int LLVMExecutableModel::getNumConservedMoieties() int LLVMExecutableModel::getConservedMoietyIndex(const string& name) string LLVMExecutableModel::getConservedMoietyId(int index) diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -1496,6 +1496,7 @@ uint LLVMModelDataSymbols::getConservedMoietyIndex( @@ -1508,9 +1509,7 @@ uint LLVMModelDataSymbols::getConservedMoietyIndex( +#if defined(BUILD_LLVM)
  • return "LLVM"; diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp -#if defined(BUILD_LLVM)
  • string compiler = "LLVM" ; -#if defined(BUILD_LLVM)
  • string compiler = _compiler.empty() ? "LLVM" : _compiler; diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp
  •    cout << "usage: llvm_testing test";
    
  •    cout << "usage: llvm_testing test" << endl;
    

diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -990,7 +990,9 @@ void LLVMExecutableModel::getIds(int types, std::liststd::string &ids) diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -990,6 +990,13 @@ void LLVMExecutableModel::getIds(int types, std::liststd::string &ids) int LLVMExecutableModel::getSupportedIdTypes() @@ -1467,29 +1474,37 @@ int LLVMExecutableModel::getReactionRates(int len, const int* indx, int LLVMExecutableModel::getNumConservedMoieties() int LLVMExecutableModel::getConservedMoietyIndex(const string& name) string LLVMExecutableModel::getConservedMoietyId(int index) int LLVMExecutableModel::getConservedMoietyValues(int len, const int* indx, int LLVMExecutableModel::setConservedMoietyValues(int len, const int* indx,

  • throw_llvm_exception("conserved moieties are read only"); int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -667,6 +667,9 @@ void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model* model, @@ -679,8 +682,13 @@ void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model* model, @@ -1461,5 +1469,50 @@ uint LLVMModelDataSymbols::getEventIndex(const std::string& id) const +uint LLVMModelDataSymbols::getConservedMoietySize() const +uint LLVMModelDataSymbols::getConservedMoietyGlobalParameterIndex( +std::string LLVMModelDataSymbols::getConservedMoietyId(uint indx) const +uint LLVMModelDataSymbols::getConservedMoietyIndex( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp
  •        cout << "usage: llvm_testing jacobian fname";
    
  • * in LLVM back end as everything is automatically handled
    

diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1361,9 +1361,9 @@ void LLVMExecutableModel::evalReactionRates() -int LLVMExecutableModel::getNumRules() +int LLVMExecutableModel::getNumRateRules() int LLVMExecutableModel::getFloatingSpeciesAmounts(int len, const int* indx, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp

  •    cout << "usage: llvm_testing fname num_ensembles" << endl;
    
  •    cout << "usage: llvm_testing ensemble fname num_ensembles" << endl;
    
  •        cout << "usage: llvm_testing jacobian fname";
    
  •    cout << "usage: llvm_testing test";
    

diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp -//#include "rrLLVMModelDataIRBuilder.h" -//#include "LLVMCSRMatrixTest.h"

  •    cout << "usage: llvm_testing fname num_ensembles" << endl;
    
  •    LLVMModelGeneratorContext c(doc, true);
    
  •    //StructType *s = LLVMModelDataValue::getStructType(c.getModule(), c.getExecutionEngine());
    
  •    LLVMModelDataSymbols symbols(doc->getModel(), true);
    
    fix for llvm 3.2 diff --git a/source/llvm/LLVMCompiler.cpp b/source/llvm/LLVMCompiler.cpp --- a/source/llvm/LLVMCompiler.cpp +++ b/source/llvm/LLVMCompiler.cpp @@ -63,10 +63,10 @@ std::string LLVMCompiler::getDefaultTargetTriple() std::string LLVMCompiler::getProcessTriple() -#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 2) +#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR > 2) return llvm::sys::getProcessTriple();
  • return "getProcessTriple() is not support on LLVM < 3.2";
  • return "getProcessTriple() is not support on LLVM <= 3.2"; diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp @@ -39,12 +39,6 @@ static void createLibraryFunction(llvm::LibFunc::Func funcId, llvm::FunctionType *funcType, Module *module);
  • throw LLVMException(what + help); diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp
  •            throw_llvm_exception("error setting conserved moiety converter document");
    
  •            throw_llvm_exception("error converting document to conserved moieties");
    
  •                throw_llvm_exception("error setting conserved moiety converter document");
    
  •                throw_llvm_exception("error converting document to conserved moieties");
    
  • symbols = new LLVMModelDataSymbols(doc->getModel(), options);
  •    symbols = new LLVMModelDataSymbols(doc->getModel(), options);
    
  • modelSymbols = new LLVMModelSymbols(getModel(), *symbols);
  •    modelSymbols = new LLVMModelSymbols(getModel(), *symbols);
    
  • // initialize LLVM
  •    // initialize LLVM
    
  • context = new LLVMContext();
  • module = new Module("LLVM Module", *context);
  •    context = new LLVMContext();
    
  •    module = new Module("LLVM Module", *context);
       symbols(new LLVMModelDataSymbols(doc->getModel(), options)),
       modelSymbols(new LLVMModelSymbols(getModel(), *symbols)),
    
  •        throw_llvm_exception("error setting conserved moiety converter document");
    
  •            throw_llvm_exception("error setting conserved moiety converter document");
    
  •        throw_llvm_exception("error converting document to conserved moieties");
    
  •            throw_llvm_exception("error converting document to conserved moieties");
    
  • symbols = new LLVMModelDataSymbols(doc->getModel(), options);
  •    symbols = new LLVMModelDataSymbols(doc->getModel(), options);
    
  • modelSymbols = new LLVMModelSymbols(getModel(), *symbols);
  •    modelSymbols = new LLVMModelSymbols(getModel(), *symbols);
    
  • // initialize LLVM
  •    // initialize LLVM
    
  • context = new LLVMContext();
  • module = new Module("LLVM Module", *context);
  •    context = new LLVMContext();
    
  •    module = new Module("LLVM Module", *context);
    

llvm::LLVMContext &ModelGeneratorContext::getContext() const diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -519,6 +519,13 @@ bool LLVMModelDataSymbols::isIndependentBoundarySpecies( +bool LLVMModelDataSymbols::isBoundarySpecies( bool LLVMModelDataSymbols::isIndependentGlobalParameter( @@ -1032,7 +1039,7 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) @@ -1107,7 +1114,7 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) @@ -1177,7 +1184,7 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) -bool LLVMModelDataSymbols::isValidSpeciesReference( +bool LLVMModelDataSymbols::isValidFloatingSpeciesReference( @@ -1187,46 +1194,34 @@ bool LLVMModelDataSymbols::isValidSpeciesReference( void LLVMModelDataSymbols::displayCompartmentInfo() diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/source/llvm/ModelInitialValueSymbolResolver.cpp --- a/source/llvm/ModelInitialValueSymbolResolver.cpp +++ b/source/llvm/ModelInitialValueSymbolResolver.cpp @@ -96,7 +96,10 @@ llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue( @@ -123,15 +126,35 @@ llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue( diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -970,6 +970,13 @@ void LLVMExecutableModel::getIds(int types, std::liststd::string &ids) @@ -1038,6 +1045,9 @@ double LLVMExecutableModel::getValue(const std::string& id) @@ -1146,7 +1156,9 @@ const rr::SelectionRecord& LLVMExecutableModel::getSelection(const std::string&

  •            throw LLVMException("Invalid id '" + str + "' for floating amount rate");
    

@@ -1505,6 +1517,35 @@ int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, +int LLVMExecutableModel::getRateRueRates(int len, int LLVMExecutableModel::setFloatingSpeciesAmounts(int len, int const indx, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispIntDecl(module), (void)dispInt); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispDoubleDecl(module), (void*)dispDouble); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispCharDecl(module), (void*)dispChar); diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispIntDecl(module), (void*)dispInt); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispDoubleDecl(module), (void*)dispDouble); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispCharDecl(module), (void*)dispChar); diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -237,6 +237,8 @@ LLVMExecutableModel::LLVMExecutableModel( diff --git a/source/llvm/FunctionResolver.cpp b/source/llvm/FunctionResolver.cpp --- a/source/llvm/FunctionResolver.cpp +++ b/source/llvm/FunctionResolver.cpp #include "LLVMException.h" namespace rrllvm @@ -80,7 +81,11 @@ llvm::Value* FunctionResolver::loadSymbolValue(const std::string& symbol, diff --git a/source/llvm/CodeGenBase.h b/source/llvm/CodeGenBase.h --- a/source/llvm/CodeGenBase.h +++ b/source/llvm/CodeGenBase.h namespace rrllvm diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp diff --git a/source/llvm/EvalInitialConditionsCodeGen.h b/source/llvm/EvalInitialConditionsCodeGen.h --- a/source/llvm/EvalInitialConditionsCodeGen.h +++ b/source/llvm/EvalInitialConditionsCodeGen.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -186,7 +186,8 @@ LLVMExecutableModel::LLVMExecutableModel() : @@ -226,6 +227,7 @@ LLVMExecutableModel::LLVMExecutableModel( @@ -579,16 +581,7 @@ int LLVMExecutableModel::getGlobalParameterIndex(const string& id) string LLVMExecutableModel::getGlobalParameterId(int id)

  •    throw_llvm_exception("index out of range");
    

int LLVMExecutableModel::getCompartmentIndex(const string& id) @@ -909,6 +902,27 @@ void LLVMExecutableModel::getIds(int types, std::liststd::string &ids) @@ -1031,8 +1045,11 @@ double LLVMExecutableModel::getValue(const std::string& id) @@ -1142,10 +1159,15 @@ const rr::SelectionRecord& LLVMExecutableModel::getSelection(const std::string&

  •        case LLVMModelDataSymbols::GLOBAL_PARAMETER:
               throw LLVMException(msg);
    

@@ -1223,6 +1245,9 @@ void LLVMExecutableModel::setValue(const std::string& id, double value) throw LLVMException("Invalid selection '" + sel.to_string() + "' for setting value"); @@ -1842,6 +1867,18 @@ int LLVMExecutableModel::getCompartmentInitVolumes(int len, const int indx, +int LLVMExecutableModel::setGlobalParameterInitValues(int len, const int indx,

  •            &LLVMExecutableModel::getGlobalParameterId, len, indx, values);
    

int LLVMExecutableModel::getGlobalParameterInitValues(int len, const int indx, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h typedef string (LLVMExecutableModel::GetNameFuncPtr)(int); diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -625,6 +625,9 @@ void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model model, @@ -641,6 +644,15 @@ void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model model, @@ -675,8 +687,24 @@ void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model* model, @@ -943,6 +971,20 @@ bool LLVMModelDataSymbols::isRateRuleGlobalParameter(uint gid) const +std::string LLVMModelDataSymbols::getGlobalParameterId(uint indx) const @@ -1312,8 +1354,21 @@ uint LLVMModelDataSymbols::getCompartmentInitIndex( throw LLVMException("could not find init compartment with id " + symbol); +uint LLVMModelDataSymbols::getGlobalParameterInitIndex(

  •    throw LLVMException("could not find init global parameter with id " + symbol);
    

@@ -1338,6 +1393,14 @@ bool LLVMModelDataSymbols::isIndependentInitCompartment( +bool LLVMModelDataSymbols::isIndependentInitGlobalParameter( bool LLVMModelDataSymbols::isIndependentInitElement( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -259,6 +259,8 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -272,6 +274,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -472,6 +472,29 @@ llvm::Value* ModelDataIRBuilder::createInitCompStore(const std::string& id, +llvm::Value* ModelDataIRBuilder::createInitGlobalParamGEP(const std::string& id,

  •    const llvm::Twine& name)
    

+llvm::Value* ModelDataIRBuilder::createInitGlobalParamLoad(

  •    const std::string& id, const llvm::Twine& name)
    

+llvm::Value* ModelDataIRBuilder::createInitGlobalParamStore(

  •    const std::string& id, llvm::Value* value)
    

llvm::Value* ModelDataIRBuilder::createReactionRateLoad(const std::string& id, const llvm::Twine& name) @@ -506,6 +529,8 @@ llvm::Value* ModelDataIRBuilder::createStoichiometryLoad(uint row, uint col, void ModelDataIRBuilder::validateStruct(llvm::Value* s, diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h llvm::Value *createInitCompStore(const std::string &id, llvm::Value *value);

  • llvm::Value* createInitGlobalParamGEP(const std::string& id,
  •        const llvm::Twine &name = "");
    
  • llvm::Value *createInitGlobalParamLoad(const std::string& id,
  •        const llvm::Twine& name ="");
    
  • llvm::Value *createInitGlobalParamStore(const std::string &id,
  •        llvm::Value *value);
    

diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/source/llvm/ModelInitialValueSymbolResolver.cpp --- a/source/llvm/ModelInitialValueSymbolResolver.cpp +++ b/source/llvm/ModelInitialValueSymbolResolver.cpp @@ -123,11 +123,17 @@ llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue( @@ -196,6 +202,11 @@ llvm::Value* ModelInitialValueStoreSymbolResolver::storeSymbolValue( diff --git a/source/llvm/ModelResources.h b/source/llvm/ModelResources.h --- a/source/llvm/ModelResources.h +++ b/source/llvm/ModelResources.h } /* namespace rrllvm / diff --git a/source/llvm/SetInitialValueCodeGenBase.h b/source/llvm/SetInitialValueCodeGenBase.h --- a/source/llvm/SetInitialValueCodeGenBase.h +++ b/source/llvm/SetInitialValueCodeGenBase.h @@ -69,7 +69,7 @@ llvm::Value SetInitialValueCodeGenBase<Derived, substanceUnits>::codeGen() llvm::BasicBlock entry = this->codeGenHeader(Derived::FunctionName, llvm::Type::getInt8Ty(this->context), @@ -95,14 +95,14 @@ llvm::Value SetInitialValueCodeGenBase<Derived, substanceUnits>::codeGen()

  •    llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, ids[i].second + "_block", this->function);
    
  •    llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, ids[i].first + "_block", this->function);
       llvm::Value *value = args[2];
    

@@ -122,7 +122,7 @@ llvm::Value* SetInitialValueCodeGenBase<Derived, substanceUnits>::codeGen() @@ -131,17 +131,17 @@ llvm::Value* SetInitialValueCodeGenBase<Derived, substanceUnits>::codeGen() this->builder.CreateRet(llvm::ConstantInt::get(llvm::Type::getInt8Ty(this->context), 1));

  •    s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), ids[i].first), block);
    
  •    s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), ids[i].second), block);
    

diff --git a/source/llvm/SetInitialValuesCodeGen.cpp b/source/llvm/SetInitialValuesCodeGen.cpp --- a/source/llvm/SetInitialValuesCodeGen.cpp +++ b/source/llvm/SetInitialValuesCodeGen.cpp namespace rrllvm -static std::vector<std::pair<uint, std::string> > independentElements(const LLVMModelDataSymbols &dataSymbols, diff --git a/source/llvm/SetInitialValuesCodeGen.h b/source/llvm/SetInitialValuesCodeGen.h --- a/source/llvm/SetInitialValuesCodeGen.h +++ b/source/llvm/SetInitialValuesCodeGen.h diff --git a/source/llvm/SetValueCodeGenBase.h b/source/llvm/SetValueCodeGenBase.h --- a/source/llvm/SetValueCodeGenBase.h +++ b/source/llvm/SetValueCodeGenBase.h @@ -23,8 +23,6 @@ namespace rrllvm typedef bool (SetValueCodeGenBase_FunctionPtr)(LLVMModelData, int32_t, double); diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp #include "LLVMException.h" @@ -110,7 +112,7 @@ int LLVMExecutableModel::getValues(double (funcPtr)(LLVMModelData, int), @@ -648,6 +650,11 @@ void LLVMExecutableModel::evalInitialConditions() void LLVMExecutableModel::reset() @@ -659,19 +666,62 @@ void LLVMExecutableModel::reset() diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -200,7 +200,7 @@ LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model model, @@ -620,11 +620,15 @@ uint LLVMModelDataSymbols::getGlobalParametersSize() const -void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model model) +void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model* model, @@ -638,11 +642,27 @@ void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model* model) @@ -650,6 +670,9 @@ void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model* model) @@ -908,6 +931,18 @@ void LLVMModelDataSymbols::initCompartments(const libsbml::Model model) +bool LLVMModelDataSymbols::isConservedMoietyParameter(uint id) const +bool LLVMModelDataSymbols::isRateRuleGlobalParameter(uint gid) const @@ -995,7 +1030,7 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model model) @@ -1067,7 +1102,7 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/SetValueCodeGenBase.h b/source/llvm/SetValueCodeGenBase.h --- a/source/llvm/SetValueCodeGenBase.h +++ b/source/llvm/SetValueCodeGenBase.h @@ -23,6 +23,8 @@ namespace rrllvm typedef bool (SetValueCodeGenBase_FunctionPtr)(LLVMModelData, int32_t, double); llvm::Value codeGen(); @@ -69,7 +70,7 @@ llvm::Value SetValueCodeGenBase<Derived, substanceUnits>::codeGen() llvm::BasicBlock entry = this->codeGenHeader(Derived::FunctionName, llvm::Type::getInt8Ty(this->context), @@ -92,7 +93,7 @@ llvm::Value SetValueCodeGenBase<Derived, substanceUnits>::codeGen()

  •    llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, ids[i] + "_block", this->function);
    
  •    llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, ids[i].first + "_block", this->function);
    

@@ -102,7 +103,7 @@ llvm::Value* SetValueCodeGenBase<Derived, substanceUnits>::codeGen() @@ -113,7 +114,7 @@ llvm::Value* SetValueCodeGenBase<Derived, substanceUnits>::codeGen() llvm::Value comp = loadResolver.loadSymbolValue(species->getCompartment()); @@ -123,17 +124,17 @@ llvm::Value SetValueCodeGenBase<Derived, substanceUnits>::codeGen() llvm::Value *comp = loadResolver.loadSymbolValue(species->getCompartment()); this->builder.CreateRet(llvm::ConstantInt::get(llvm::Type::getInt8Ty(this->context), 1));

  •    s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), i), block);
    
  •    s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), ids[i].second), block);
    

diff --git a/source/llvm/SetValuesCodeGen.cpp b/source/llvm/SetValuesCodeGen.cpp --- a/source/llvm/SetValuesCodeGen.cpp +++ b/source/llvm/SetValuesCodeGen.cpp @@ -26,17 +26,38 @@ namespace rrllvm -static std::vector independentElements(const LLVMModelDataSymbols &dataSymbols, +static StringIntVector independentElements(const LLVMModelDataSymbols &dataSymbols, +static StringIntVector nonRateElements(const LLVMModelDataSymbols &dataSymbols, diff --git a/source/llvm/SetValuesCodeGen.h b/source/llvm/SetValuesCodeGen.h --- a/source/llvm/SetValuesCodeGen.h +++ b/source/llvm/SetValuesCodeGen.h

  • gets the name of the JIT compiler, i.e. "LLVM" means we are using the
  • LLVM JIT compiler.
  • that is a LLVM historical convention.
  • getHostCPUName - Get the LLVM name for the host CPU. The particular format +* Added LLVM info to version info +* Added support for compiling with LLVM 3.5, we now support LLVM version 3.1 - 3.5 diff --git a/source/llvm/LLVMCompiler.cpp b/source/llvm/LLVMCompiler.cpp --- a/source/llvm/LLVMCompiler.cpp +++ b/source/llvm/LLVMCompiler.cpp @@ -56,14 +56,12 @@ bool LLVMCompiler::setSupportCodeFolder(const std::string& path) -std::string rrllvm::LLVMCompiler::getDefaultTargetTriple() +std::string LLVMCompiler::getDefaultTargetTriple() return llvm::sys::getDefaultTargetTriple(); -std::string rrllvm::LLVMCompiler::getProcessTriple() +std::string LLVMCompiler::getProcessTriple() #if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 2) return llvm::sys::getProcessTriple(); @@ -72,14 +70,18 @@ std::string rrllvm::LLVMCompiler::getProcessTriple() -std::string rrllvm::LLVMCompiler::getHostCPUName() +std::string LLVMCompiler::getHostCPUName() return llvm::sys::getHostCPUName(); -std::string rrllvm::LLVMCompiler::getVersion() +std::string LLVMCompiler::getVersion() ss << LLVM_VERSION_MAJOR << "." << LLVM_VERSION_MINOR; tweaks to compile with LLVM 3.1 diff --git a/source/llvm/LLVMCompiler.cpp b/source/llvm/LLVMCompiler.cpp --- a/source/llvm/LLVMCompiler.cpp +++ b/source/llvm/LLVMCompiler.cpp @@ -65,7 +65,11 @@ std::string rrllvm::LLVMCompiler::getDefaultTargetTriple() std::string rrllvm::LLVMCompiler::getProcessTriple() +#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 2) return llvm::sys::getProcessTriple();
  • return "getProcessTriple() is not support on LLVM < 3.2"; std::string rrllvm::LLVMCompiler::getHostCPUName() diff --git a/source/llvm/LLVMIncludes.h b/source/llvm/LLVMIncludes.h --- a/source/llvm/LLVMIncludes.h +++ b/source/llvm/LLVMIncludes.h #include <llvm/IR/Module.h> #include <llvm/IR/Intrinsics.h> #include <llvm/IR/Verifier.h> -#elif (LLVM_VERSION_MAJOR == 3) && ((LLVM_VERSION_MINOR == 3) || (LLVM_VERSION_MINOR == 4))) +#elif (LLVM_VERSION_MAJOR == 3) && ((LLVM_VERSION_MINOR == 3) || (LLVM_VERSION_MINOR == 4)) #include <llvm/IR/DataLayout.h> #include <llvm/IR/DerivedTypes.h> #include <llvm/IR/IRBuilder.h> #include <llvm/Module.h> #include <llvm/Intrinsics.h> #include <llvm/Analysis/Verifier.h> -//#elif (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 1) +#elif (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR == 1) #include <llvm/DerivedTypes.h> #include <llvm/ExecutionEngine/ExecutionEngine.h> #include <llvm/ExecutionEngine/JIT.h> #include <llvm/Support/IRBuilder.h> #include <llvm/Support/TargetSelect.h> #include <llvm/Analysis/Verifier.h> +#error "Unsupported LLVM Version, require LLVM >= 3.1" #include <llvm/Analysis/Passes.h> updates to compile with LLVM 3.5 diff --git a/source/llvm/CodeGenBase.h b/source/llvm/CodeGenBase.h --- a/source/llvm/CodeGenBase.h +++ b/source/llvm/CodeGenBase.h +#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR >= 5)
  •    if (llvm::verifyFunction(*function))
       if (llvm::verifyFunction(*function, llvm::AbortProcessAction))
    

diff --git a/source/llvm/LLVMIncludes.h b/source/llvm/LLVMIncludes.h --- a/source/llvm/LLVMIncludes.h +++ b/source/llvm/LLVMIncludes.h -#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 3) +#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR >= 5) +#include <llvm/IR/DataLayout.h> +#include <llvm/IR/DerivedTypes.h> +#include <llvm/IR/IRBuilder.h> +#include <llvm/IR/LLVMContext.h> +#include <llvm/IR/Module.h> +#include <llvm/IR/Intrinsics.h> +#include <llvm/IR/Verifier.h> +#elif (LLVM_VERSION_MAJOR == 3) && ((LLVM_VERSION_MINOR == 3) || (LLVM_VERSION_MINOR == 4))) #include <llvm/IR/DataLayout.h> #include <llvm/IR/DerivedTypes.h> #include <llvm/IR/IRBuilder.h> #include <llvm/IR/LLVMContext.h> #include <llvm/IR/Module.h> #include <llvm/IR/Intrinsics.h> -#elif (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 2) +#include <llvm/Analysis/Verifier.h> +#elif (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR == 2) #include <llvm/DataLayout.h> #include <llvm/DerivedTypes.h> #include <llvm/IRBuilder.h> #include <llvm/LLVMContext.h> #include <llvm/Module.h> #include <llvm/Intrinsics.h> +#include <llvm/Analysis/Verifier.h> //#elif (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 1) #include <llvm/DerivedTypes.h> #include <llvm/LLVMContext.h> #include <llvm/Module.h> #include <llvm/PassManager.h> -#include <llvm/Analysis/Verifier.h> -#include <llvm/Analysis/Passes.h> #include <llvm/Target/TargetData.h> #include <llvm/Transforms/Scalar.h> #include <llvm/Support/IRBuilder.h> #include <llvm/Support/TargetSelect.h> +#include <llvm/Analysis/Verifier.h> #include <llvm/Analysis/Passes.h> -#include <llvm/Analysis/Verifier.h> #include <llvm/ExecutionEngine/ExecutionEngine.h> #include <llvm/ExecutionEngine/JIT.h> #include <llvm/PassManager.h> diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -110,9 +110,8 @@ int LLVMExecutableModel::getValues(double (funcPtr)(LLVMModelData, int),

  •        throw_llvm_exception(s.str());
    
    update cmake to work with LLVM 3.4, use c++ sstream for str cat diff --git a/cmake/FindLLVM.cmake b/cmake/FindLLVM.cmake --- a/cmake/FindLLVM.cmake +++ b/cmake/FindLLVM.cmake @@ -155,6 +155,30 @@ if (LLVM_CONFIG_EXECUTABLE) STRING(REGEX REPLACE "[\n\t\r ]+" ";" LLVM_LIBRARIES ${LLVM_LIBRARIES}) message(STATUS "LLVM_LIBRARIES: ${LLVM_LIBRARIES}")
  • starting with LLVM 3.4 (at least on Ubuntu) it requres functions in

  • if (((LLVM_VERSION_MAJOR GREATER 3) OR (LLVM_VERSION_MAJOR EQUAL 3)) AND
  •        (LLVM_VERSION_MINOR GREATER 4) OR (LLVM_VERSION_MINOR EQUAL 4))
    
  •        message("LLVM VERSION >= 3.4, looking for curses library")
    
  •        #message("LLVM_LIBRARIES: ${LLVM_LIBRARIES}")
    
  •        set(LLVM_LIBRARIES "${LLVM_LIBRARIES};${CURSES_LIBRARIES}")
    
  •        message("LLVM_LIBRARIES: ${LLVM_LIBRARIES}")
    
  •    #message("LLVM VERSION < 3.4")
    
    if(LLVM_INCLUDE_DIRS) set(LLVM_FOUND TRUE) diff --git a/source/llvm/LLVMCompiler.cpp b/source/llvm/LLVMCompiler.cpp --- a/source/llvm/LLVMCompiler.cpp +++ b/source/llvm/LLVMCompiler.cpp #include "LLVMCompiler.h" #include "LLVMIncludes.h" @@ -75,7 +75,7 @@ std::string rrllvm::LLVMCompiler::getHostCPUName() std::string rrllvm::LLVMCompiler::getVersion()
  • snprintf(buffer, sizeof(buffer)/sizeof(char), "%d.%d", LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR);
  • ss << LLVM_VERSION_MAJOR << "." << LLVM_VERSION_MINOR; diff --git a/source/llvm/LLVMCompiler.cpp b/source/llvm/LLVMCompiler.cpp --- a/source/llvm/LLVMCompiler.cpp +++ b/source/llvm/LLVMCompiler.cpp #include "LLVMCompiler.h" +#include "LLVMIncludes.h" @@ -55,3 +57,25 @@ bool LLVMCompiler::setSupportCodeFolder(const std::string& path) +std::string rrllvm::LLVMCompiler::getDefaultTargetTriple()
  • return llvm::sys::getDefaultTargetTriple(); +std::string rrllvm::LLVMCompiler::getProcessTriple()
  • return llvm::sys::getProcessTriple(); +std::string rrllvm::LLVMCompiler::getHostCPUName()
  • return llvm::sys::getHostCPUName(); +std::string rrllvm::LLVMCompiler::getVersion()
  • snprintf(buffer, sizeof(buffer)/sizeof(char), "%d.%d", LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR); diff --git a/source/llvm/LLVMCompiler.h b/source/llvm/LLVMCompiler.h --- a/source/llvm/LLVMCompiler.h +++ b/source/llvm/LLVMCompiler.h
  • * getHostCPUName - Get the LLVM name for the host CPU. The particular format
    

diff --git a/source/llvm/LLVMIncludes.h b/source/llvm/LLVMIncludes.h --- a/source/llvm/LLVMIncludes.h +++ b/source/llvm/LLVMIncludes.h #include <llvm/Support/raw_ostream.h> #include <llvm/Target/TargetLibraryInfo.h> #include <llvm/Support/raw_ostream.h> +#include <llvm/Support/Host.h>

  • * getHostCPUName - Get the LLVM name for the host CPU. The particular format
      causes that value to cascade down to the terminal cells. The LLVM back end roadruner
    

diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp using namespace llvm; @@ -104,7 +102,7 @@ bool LLVMModelSymbols::visit(const libsbml::Species& x) bool LLVMModelSymbols::visit(const libsbml::AssignmentRule& x) @@ -123,7 +121,7 @@ bool LLVMModelSymbols::visit(const libsbml::AssignmentRule& x) bool LLVMModelSymbols::visit(const libsbml::InitialAssignment& x) @@ -132,7 +130,7 @@ bool LLVMModelSymbols::visit(const libsbml::InitialAssignment& x) bool LLVMModelSymbols::visit(const libsbml::RateRule& rule) @@ -171,14 +169,16 @@ void LLVMModelSymbols::processElement(SymbolForest& currentSymbols, bool LLVMModelSymbols::visit(const libsbml::Rule& x) @@ -309,13 +309,14 @@ void LLVMModelSymbols::processSpecies(SymbolForest &currentSymbols, @@ -350,11 +351,11 @@ void LLVMModelSymbols::processSpecies(SymbolForest &currentSymbols, @@ -522,9 +523,9 @@ ASTNode* LLVMModelSymbols::createStoichiometryNode(int row, int col) const diff --git a/source/llvm_testing/src/Args.cpp b/source/llvm_testing/src/Args.cpp --- a/source/llvm_testing/src/Args.cpp +++ b/source/llvm_testing/src/Args.cpp diff --git a/source/llvm_testing/src/rrTestUtils.cpp b/source/llvm_testing/src/rrTestUtils.cpp --- a/source/llvm_testing/src/rrTestUtils.cpp +++ b/source/llvm_testing/src/rrTestUtils.cpp diff --git a/source/llvm_testing/src/rrTestUtils.h b/source/llvm_testing/src/rrTestUtils.h --- a/source/llvm_testing/src/rrTestUtils.h +++ b/source/llvm_testing/src/rrTestUtils.h -#if defined(llvm) -#if defined(GNUC) && !defined(llvm) +#if defined(llvm) +#if defined(GNUC) && !defined(llvm)

  • If LLVM build is enabled, setting compiler to "llvm" enables llvm based
  • If LLVM build is enabled, setting compiler to "llvm" enables llvm based diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -163,8 +163,11 @@ LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model model, @@ -934,6 +937,11 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model model) diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp @@ -81,8 +81,15 @@ bool LLVMModelSymbols::visit(const libsbml::Compartment& x) @@ -208,7 +215,7 @@ bool LLVMModelSymbols::visit(const libsbml::Reaction& r) catch (LLVMException&) @@ -299,10 +306,16 @@ void LLVMModelSymbols::processSpecies(SymbolForest &currentSymbols, @@ -334,10 +347,16 @@ void LLVMModelSymbols::processSpecies(SymbolForest &currentSymbols, diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -198,9 +200,11 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -222,11 +226,28 @@ llvm::Value* ASTNodeCodeGen::notImplemented(const libsbml::ASTNode* ast)
  • throw_llvm_exception("AST type Not Implemented Yet: " + str);
  • throw_llvm_exception("AST type not implemented yet: " + str); +llvm::Value* ASTNodeCodeGen::delayExprCodeGen(const libsbml::ASTNode* ast)
  •    throw_llvm_exception("AST type 'delay' requires two children.");
    

llvm::Value* ASTNodeCodeGen::nameExprCodeGen(const libsbml::ASTNode* ast) @@ -266,18 +287,32 @@ llvm::Value* ASTNodeCodeGen::applyArithmeticCodeGen( throw_llvm_exception(err.str()); @@ -351,7 +386,9 @@ llvm::Value* ASTNodeCodeGen::applyRelationalCodeGen(const libsbml::ASTNode* ast) llvm::Value* ASTNodeCodeGen::applyLogicalCodeGen(const libsbml::ASTNode* ast) @@ -366,19 +403,27 @@ llvm::Value* ASTNodeCodeGen::applyLogicalCodeGen(const libsbml::ASTNode* ast)

  •    throw_llvm_exception(msg);
    

diff --git a/source/llvm/ASTNodeCodeGen.h b/source/llvm/ASTNodeCodeGen.h --- a/source/llvm/ASTNodeCodeGen.h +++ b/source/llvm/ASTNodeCodeGen.h llvm::Value *notImplemented(const libsbml::ASTNode *ast);

  • llvm::Value *delayExprCodeGen(const libsbml::ASTNode *ast); llvm::Value *nameExprCodeGen(const libsbml::ASTNode *ast); llvm::Value realExprCodeGen(const libsbml::ASTNode ast); diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -985,8 +985,9 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model model) @@ -1056,10 +1057,11 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model model) diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -982,6 +982,12 @@ double LLVMExecutableModel::getValue(const std::string& id) @@ -1037,6 +1043,10 @@ const rr::SelectionRecord& LLVMExecutableModel::getSelection(const std::string&
  •        case LLVMModelDataSymbols::EVENT:
               throw LLVMException("No sbml element exists for symbol '" + str + "'");
    

diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -243,6 +243,11 @@ LLVMModelDataSymbols::SymbolIndexType LLVMModelDataSymbols::getSymbolIndex( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/SymbolForest.h b/source/llvm/SymbolForest.h --- a/source/llvm/SymbolForest.h +++ b/source/llvm/SymbolForest.h namespace rrllvm diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp diff --git a/source/llvm/SymbolForest.h b/source/llvm/SymbolForest.h --- a/source/llvm/SymbolForest.h +++ b/source/llvm/SymbolForest.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -982,6 +982,12 @@ double LLVMExecutableModel::getValue(const std::string& id) @@ -1037,6 +1043,10 @@ const rr::SelectionRecord& LLVMExecutableModel::getSelection(const std::string&

  •        case LLVMModelDataSymbols::EVENT:
               throw LLVMException("No sbml element exists for symbol '" + str + "'");
    

diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -243,6 +243,11 @@ LLVMModelDataSymbols::SymbolIndexType LLVMModelDataSymbols::getSymbolIndex( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h @@ -72,7 +72,8 @@ if(BUILD_LLVM) llvm/LLVMExecutableModel llvm/GetRateRuleValuesCodeGen llvm/GetValuesCodeGen

  • llvm/GetInitialValuesCodeGen
  •    llvm/LoadSymbolResolverBase
    
  •    llvm/GetInitialValuesCodeGen
       llvm/GetEventValuesCodeGen
       llvm/KineticLawParameterResolver
       llvm/LLVMModelData
    

diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -237,7 +237,7 @@ llvm::Value* ASTNodeCodeGen::nameExprCodeGen(const libsbml::ASTNode* ast) throw_llvm_exception(string(ast->getName()) + diff --git a/source/llvm/CodeGen.h b/source/llvm/CodeGen.h --- a/source/llvm/CodeGen.h +++ b/source/llvm/CodeGen.h #include "LLVMIncludes.h" namespace rrllvm

  • * generate an LLVM load instruction.
    
    virtual llvm::Value loadSymbolValue(const std::string& symbol, const llvm::ArrayRefllvm::Value*& args = llvm::ArrayRefllvm::Value*()) = 0; #endif / LLVMCodeGenH / diff --git a/source/llvm/EvalReactionRatesCodeGen.cpp b/source/llvm/EvalReactionRatesCodeGen.cpp --- a/source/llvm/EvalReactionRatesCodeGen.cpp +++ b/source/llvm/EvalReactionRatesCodeGen.cpp diff --git a/source/llvm/FunctionResolver.cpp b/source/llvm/FunctionResolver.cpp --- a/source/llvm/FunctionResolver.cpp +++ b/source/llvm/FunctionResolver.cpp llvm::Value FunctionResolver::loadSymbolValue(const std::string& symbol, const llvm::ArrayRefllvm::Value*& args) @@ -51,6 +48,8 @@ llvm::Value* FunctionResolver::loadSymbolValue(const std::string& symbol, @@ -93,10 +92,23 @@ llvm::Value* FunctionResolver::loadSymbolValue(const std::string& symbol, diff --git a/source/llvm/FunctionResolver.h b/source/llvm/FunctionResolver.h --- a/source/llvm/FunctionResolver.h +++ b/source/llvm/FunctionResolver.h const libsbml::Model *model, llvm::IRBuilder<> &builder); virtual llvm::Value *loadSymbolValue(const std::string& symbol,
  •            const llvm::ArrayRef<llvm::Value*>& args =
    
  •                    llvm::ArrayRef<llvm::Value*>());
    
  •        const llvm::ArrayRef<llvm::Value*>& args =
    
  •                llvm::ArrayRef<llvm::Value*>());
    

diff --git a/source/llvm/KineticLawParameterResolver.cpp b/source/llvm/KineticLawParameterResolver.cpp --- a/source/llvm/KineticLawParameterResolver.cpp +++ b/source/llvm/KineticLawParameterResolver.cpp llvm::Value* KineticLawParameterResolver::loadSymbolValue(

  •    const std::string& symbol, const llvm::ArrayRef<llvm::Value*>& args)
    
  •    const llvm::ArrayRef<llvm::Value*>& args)
    

@@ -56,4 +57,14 @@ llvm::Value* KineticLawParameterResolver::loadSymbolValue( diff --git a/source/llvm/KineticLawParameterResolver.h b/source/llvm/KineticLawParameterResolver.h --- a/source/llvm/KineticLawParameterResolver.h +++ b/source/llvm/KineticLawParameterResolver.h const libsbml::KineticLaw &kineticLaw, llvm::IRBuilder<> &builder); virtual llvm::Value *loadSymbolValue(const std::string& symbol,

  •            const llvm::ArrayRef<llvm::Value*>& args =
    
  •                    llvm::ArrayRef<llvm::Value*>());
    
  •        const llvm::ArrayRef<llvm::Value*>& args =
    
  •                llvm::ArrayRef<llvm::Value*>());
    

diff --git a/source/llvm/LoadSymbolResolverBase.cpp b/source/llvm/LoadSymbolResolverBase.cpp +++ b/source/llvm/LoadSymbolResolverBase.cpp +#include "LLVMException.h" +using namespace llvm; +namespace rrllvm

  •    const LLVMModelSymbols& modelSymbols,
    
  •    const LLVMModelDataSymbols& modelDataSymbols,
    
  •    llvm::IRBuilder<>& builder) :
    

+llvm::Value* LoadSymbolResolverBase::loadReactionRate(

  •        throw LLVMException(msg, __FUNC__);
    

+} /* namespace rrllvm */ diff --git a/source/llvm/LoadSymbolResolverBase.h b/source/llvm/LoadSymbolResolverBase.h +++ b/source/llvm/LoadSymbolResolverBase.h +#include "LLVMIncludes.h" +#include "LLVMModelDataSymbols.h" +#include "LLVMModelSymbols.h" +namespace rrllvm

  • llvm::Value* loadReactionRate(const libsbml::Reaction*);
  •        const LLVMModelSymbols &modelSymbols,
    
  •        const LLVMModelDataSymbols &modelDataSymbols,
    
  •        llvm::IRBuilder<> &builder);
    
  • const LLVMModelDataSymbols &modelDataSymbols;
  • const LLVMModelSymbols &modelSymbols;
  • llvm::IRBuilder<> &builder; +} /* namespace rrllvm / diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp #include "LLVMException.h" using namespace llvm; namespace rrllvm @@ -23,11 +27,8 @@ ModelDataLoadSymbolResolver::ModelDataLoadSymbolResolver(llvm::Value modelData, const LLVMModelSymbols &modelSymbols, const LLVMModelDataSymbols &modelDataSymbols, llvm::IRBuilder<> &builder) : @@ -47,7 +48,8 @@ ModelDataStoreSymbolResolver::ModelDataStoreSymbolResolver(llvm::Value modelDat -llvm::Value ModelDataLoadSymbolResolver::loadSymbolValue(const std::string& symbol, +llvm::Value ModelDataLoadSymbolResolver::loadSymbolValue( const llvm::ArrayRefllvm::Value*& args) @@ -56,10 +58,10 @@ llvm::Value ModelDataLoadSymbolResolver::loadSymbolValue(const std::string& sym @@ -83,7 +85,10 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue(const std::string& sym @@ -130,23 +135,23 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue(const std::string& sym const LLVMModelDataSymbols::SpeciesReferenceInfo &info = @@ -174,6 +179,16 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue(const std::string& sym @@ -184,6 +199,8 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue(const std::string& sym llvm::Value* ModelDataStoreSymbolResolver::storeSymbolValue( const std::string& symbol, llvm::Value *value) diff --git a/source/llvm/ModelDataSymbolResolver.h b/source/llvm/ModelDataSymbolResolver.h --- a/source/llvm/ModelDataSymbolResolver.h +++ b/source/llvm/ModelDataSymbolResolver.h #include "LLVMIncludes.h" #include "LLVMModelDataSymbols.h" #include "LLVMModelSymbols.h" namespace rrllvm ModelDataLoadSymbolResolver(llvm::Value *modelData, virtual llvm::Value *loadSymbolValue(const std::string& symbol, const llvm::ArrayRefllvm::Value*& args = llvm::ArrayRefllvm::Value*()); llvm::Value *modelData;
  • const LLVMModelSymbols &modelSymbols;
  • const LLVMModelDataSymbols &modelDataSymbols;
  • llvm::IRBuilder<> &builder; diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/source/llvm/ModelInitialValueSymbolResolver.cpp --- a/source/llvm/ModelInitialValueSymbolResolver.cpp +++ b/source/llvm/ModelInitialValueSymbolResolver.cpp const LLVMModelSymbols &modelSymbols, const LLVMModelDataSymbols &modelDataSymbols, llvm::IRBuilder<> &builder) : @@ -48,11 +45,9 @@ ModelInitialValueStoreSymbolResolver::ModelInitialValueStoreSymbolResolver(llvm: -llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue(const std::string& symbol, +llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue( const llvm::ArrayRefllvm::Value*& args) @@ -60,7 +55,7 @@ llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue(const std::string& @@ -85,7 +80,10 @@ llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue(const std::string& @@ -143,6 +141,15 @@ llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue(const std::string& diff --git a/source/llvm/ModelInitialValueSymbolResolver.h b/source/llvm/ModelInitialValueSymbolResolver.h --- a/source/llvm/ModelInitialValueSymbolResolver.h +++ b/source/llvm/ModelInitialValueSymbolResolver.h #include "LLVMIncludes.h" #include "LLVMModelDataSymbols.h" #include "LLVMModelSymbols.h" @@ -24,7 +24,7 @@ namespace rrllvm const LLVMModelDataSymbols &modelDataSymbols, llvm::IRBuilder<> &builder); virtual llvm::Value *loadSymbolValue(const std::string& symbol, const llvm::ArrayRefllvm::Value*& args = llvm::ArrayRefllvm::Value*()); llvm::Value *modelData;
  • const LLVMModelDataSymbols &modelDataSymbols;
  • const LLVMModelSymbols &modelSymbols;
  • llvm::IRBuilder<> &builder; diff --git a/source/llvm/SBMLInitialValueSymbolResolver.cpp b/source/llvm/SBMLInitialValueSymbolResolver.cpp --- a/source/llvm/SBMLInitialValueSymbolResolver.cpp +++ b/source/llvm/SBMLInitialValueSymbolResolver.cpp const LLVMModelDataSymbols& modelDataSymbols, const LLVMModelSymbols& modelSymbols, llvm::IRBuilder<>& builder) : -llvm::Value* SBMLInitialValueSymbolResolver::loadSymbolValue(const std::string& symbol, +llvm::Value* SBMLInitialValueSymbolResolver::loadSymbolValue( const llvm::ArrayRefllvm::Value*& args) @@ -51,6 +45,7 @@ llvm::Value* SBMLInitialValueSymbolResolver::loadSymbolValue(const std::string& @@ -66,7 +61,10 @@ llvm::Value* SBMLInitialValueSymbolResolver::loadSymbolValue(const std::string& @@ -83,6 +81,15 @@ llvm::Value* SBMLInitialValueSymbolResolver::loadSymbolValue(const std::string& diff --git a/source/llvm/SBMLInitialValueSymbolResolver.h b/source/llvm/SBMLInitialValueSymbolResolver.h --- a/source/llvm/SBMLInitialValueSymbolResolver.h +++ b/source/llvm/SBMLInitialValueSymbolResolver.h #include "LLVMIncludes.h" #include "LLVMModelDataSymbols.h" #include "LLVMModelSymbols.h" @@ -24,24 +24,19 @@ namespace rrllvm const LLVMModelDataSymbols &modelDataSymbols, const LLVMModelSymbols &modelSymbols, llvm::IRBuilder<> &builder); virtual llvm::Value *loadSymbolValue(const std::string& symbol, const llvm::ArrayRefllvm::Value*& args = llvm::ArrayRefllvm::Value*());
  • const LLVMModelDataSymbols &modelDataSymbols;
  • const LLVMModelSymbols &modelSymbols;
  • llvm::IRBuilder<> &builder;

if LLVM is enabled, LLVM is the default compiler

diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.2_Debug_gfeature-llvm_2013-07-11_21-25.xml b/reports/macosx_amd64/c_tests_GNU_4.7.2_Debug_gfeature-llvm_2013-07-11_21-25.xml --- a/reports/macosx_amd64/c_tests_GNU_4.7.2_Debug_gfeature-llvm_2013-07-11_21-25.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-06-23_19-13.xml b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-06-23_19-13.xml --- a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-06-23_19-13.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-09_18-30.xml b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-09_18-30.xml --- a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-09_18-30.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-11_00-05.xml b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-11_00-05.xml --- a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-11_00-05.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.2_Debug_gfeature-llvm_2013-07-11_21-25.xml b/reports/macosx_amd64/c_tests_GNU_4.7.2_Debug_gfeature-llvm_2013-07-11_21-25.xml --- a/reports/macosx_amd64/c_tests_GNU_4.7.2_Debug_gfeature-llvm_2013-07-11_21-25.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-06-23_19-13.xml b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-06-23_19-13.xml --- a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-06-23_19-13.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-09_18-30.xml b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-09_18-30.xml --- a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-09_18-30.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-11_00-05.xml b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-11_00-05.xml --- a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-11_00-05.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.2_Debug_gfeature-llvm_2013-07-11_21-25.xml b/reports/macosx_amd64/c_tests_GNU_4.7.2_Debug_gfeature-llvm_2013-07-11_21-25.xml --- a/reports/macosx_amd64/c_tests_GNU_4.7.2_Debug_gfeature-llvm_2013-07-11_21-25.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-06-23_19-13.xml b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-06-23_19-13.xml --- a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-06-23_19-13.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-09_18-30.xml b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-09_18-30.xml --- a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-09_18-30.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-11_00-05.xml b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-11_00-05.xml --- a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-11_00-05.xml diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -191,7 +191,7 @@ LLVMExecutableModel::LLVMExecutableModel() : LLVMExecutableModel::LLVMExecutableModel(

  • const std::tr1::shared_ptr& rc, LLVMModelData* modelData) :
  • const cxx11_ns::shared_ptr& rc, LLVMModelData* modelData) : diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h
    • takes ownership of the LLVMModelData pointer.
  • LLVMExecutableModel(const std::tr1::shared_ptr &resources,
  • LLVMExecutableModel(const cxx11_ns::shared_ptr &resources, LLVMModelData* modelData); LLVMModelData *modelData; const LLVMModelDataSymbols *symbols; diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -916,7 +918,7 @@ void LLVMModelDataSymbols::setNamedSpeciesReferenceInfo(uint row, uint column, typedef std::vectorLLVMModelDataSymbols::SpeciesReferenceType::size_type ssize_type; diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp namespace rrllvm diff --git a/source/llvm/LLVMModelGenerator.h b/source/llvm/LLVMModelGenerator.h --- a/source/llvm/LLVMModelGenerator.h +++ b/source/llvm/LLVMModelGenerator.h #include "LLVMCompiler.h" namespace rrllvm diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1715,6 +1715,10 @@ int LLVMExecutableModel::setFloatingSpeciesInitConcentrations(int len, &LLVMExecutableModel::getFloatingSpeciesId, len, indx, values); diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp diff --git a/source/llvm/GetInitialValuesCodeGen.cpp b/source/llvm/GetInitialValuesCodeGen.cpp --- a/source/llvm/GetInitialValuesCodeGen.cpp +++ b/source/llvm/GetInitialValuesCodeGen.cpp diff --git a/source/llvm/GetInitialValuesCodeGen.h b/source/llvm/GetInitialValuesCodeGen.h --- a/source/llvm/GetInitialValuesCodeGen.h +++ b/source/llvm/GetInitialValuesCodeGen.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -184,7 +184,8 @@ LLVMExecutableModel::LLVMExecutableModel() : @@ -223,6 +224,7 @@ LLVMExecutableModel::LLVMExecutableModel( @@ -650,13 +652,16 @@ void LLVMExecutableModel::reset() @@ -664,6 +669,12 @@ void LLVMExecutableModel::reset() @@ -1727,6 +1738,10 @@ int LLVMExecutableModel::setFloatingSpeciesInitAmounts(int len, int const *indx, &LLVMExecutableModel::getFloatingSpeciesId, len, indx, values); @@ -1764,6 +1779,17 @@ int LLVMExecutableModel::getCompartmentInitVolumes(int len, const int *indx, +int LLVMExecutableModel::getGlobalParameterInitValues(int len, const int indx, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h typedef string (LLVMExecutableModel::GetNameFuncPtr)(int); diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -256,6 +256,9 @@ ExecutableModel LLVMModelGenerator::createModel(const std::string& sbml, @@ -267,6 +270,8 @@ ExecutableModel LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp
  •        throw_llvm_exception("error setting conserved moiety converter document");
    
  •        throw_llvm_exception("error converting document to conserved moieties");
    
  •            throw_llvm_exception("error setting conserved moiety converter document");
    
  •            throw_llvm_exception("error converting document to conserved moieties");
    

diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/source/llvm/ModelInitialValueSymbolResolver.cpp --- a/source/llvm/ModelInitialValueSymbolResolver.cpp +++ b/source/llvm/ModelInitialValueSymbolResolver.cpp @@ -160,13 +160,6 @@ llvm::Value* ModelInitialValueStoreSymbolResolver::storeSymbolValue( diff --git a/source/llvm/ModelResources.h b/source/llvm/ModelResources.h --- a/source/llvm/ModelResources.h +++ b/source/llvm/ModelResources.h } /* namespace rrllvm / diff --git a/source/llvm/SetInitialValuesCodeGen.cpp b/source/llvm/SetInitialValuesCodeGen.cpp --- a/source/llvm/SetInitialValuesCodeGen.cpp +++ b/source/llvm/SetInitialValuesCodeGen.cpp @@ -34,7 +34,7 @@ static std::vector<std::pair<uint, std::string> > independentElements(const LLVM diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp if(BUILD_LLVM) diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1444,36 +1444,43 @@ double LLVMExecutableModel::getStoichiometry(int speciesIndex, int reactionIndex int LLVMExecutableModel::getStoichiometryMatrix(int pRows, int* pCols,

  • throw_llvm_exception("invalid args"); diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -266,10 +275,9 @@ uint LLVMModelDataSymbols::getFloatingSpeciesIndex(
  •    throw LLVMException("could not find floating species with id " + id);
    
  •    throw LLVMException(msg);
    

uint LLVMModelDataSymbols::getBoundarySpeciesIndex( @@ -890,6 +898,27 @@ void LLVMModelDataSymbols::initCompartments(const libsbml::Model model) +void LLVMModelDataSymbols::setNamedSpeciesReferenceInfo(uint row, uint column, +typedef std::vectorLLVMModelDataSymbols::SpeciesReferenceType::size_type ssize_type; void LLVMModelDataSymbols::initReactions(const libsbml::Model model) @@ -900,6 +929,9 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) @@ -912,26 +944,65 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model)

  •                        throw_llvm_exception(msg);
    
  •                    throw_llvm_exception(msg);
    
  •                        throw_llvm_exception(msg);
    

@@ -946,26 +1017,63 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model)

  •                        throw_llvm_exception(msg);
    
  •                    throw_llvm_exception(msg);
    
  •                        throw_llvm_exception(msg);
    

diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp @@ -153,6 +153,15 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue(const std::string& sym

  •    if (info.type == LLVMModelDataSymbols::MultiReactantProduct)
    
  •        throw_llvm_exception(msg);
       if (info.type == LLVMModelDataSymbols::Reactant)
    

@@ -262,6 +271,15 @@ llvm::Value* ModelDataStoreSymbolResolver::storeSymbolValue( const LLVMModelDataSymbols::SpeciesReferenceInfo &info =

  •    if (info.type == LLVMModelDataSymbols::MultiReactantProduct)
    
  •        throw_llvm_exception(msg);
       if (info.type == LLVMModelDataSymbols::Reactant)
    

diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/cmake/FindLLVM.cmake b/cmake/FindLLVM.cmake --- a/cmake/FindLLVM.cmake +++ b/cmake/FindLLVM.cmake @@ -124,6 +124,22 @@ if (LLVM_CONFIG_EXECUTABLE) STRING(REPLACE "-Wcast-qual" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS}) STRING(REPLACE "-Woverloaded-virtual" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS})

  • some LLVMs add these options

  • STRING(REPLACE "-Wall" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS})
  • STRING(REPLACE "-W " "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS})
  • STRING(REPLACE "-Wno-unused-parameter" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS})
  • STRING(REPLACE "-Wwrite-strings" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS})
  • STRING(REPLACE "-Wno-missing-field-initializers" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS})
  • STRING(REPLACE "-pedantic" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS})
  • STRING(REPLACE "-Wno-long-long" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS})
  • STRING(REPLACE "-Wno-uninitialized" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS})
  • STRING(REPLACE "-Wnon-virtual-dtor" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS}) MESSAGE(STATUS "LLVM_DEFINITIONS: " ${LLVM_DEFINITIONS}) diff --git a/cmake/FindLLVM.cmake b/cmake/FindLLVM.cmake --- a/cmake/FindLLVM.cmake +++ b/cmake/FindLLVM.cmake @@ -119,6 +119,11 @@ if (LLVM_CONFIG_EXECUTABLE)

    should be OK linking to LLVM as this just results in a slightly larger lib (I think, I hope...)

    string(REPLACE "-fvisibility-inlines-hidden" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS})
  • remove extra warnings that the llvm-config added

  • STRING(REPLACE "-Wcast-qual" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS})
  • STRING(REPLACE "-Woverloaded-virtual" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS}) MESSAGE(STATUS "LLVM_DEFINITIONS: " ${LLVM_DEFINITIONS}) diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -186,7 +186,7 @@ LLVMExecutableModel::LLVMExecutableModel() : LLVMExecutableModel::LLVMExecutableModel( @@ -228,7 +228,7 @@ LLVMExecutableModel::LLVMExecutableModel( diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -163,10 +163,10 @@ llvm::StructType* ModelDataIRBuilder::getCSRSparseStructType( #if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 2)
  •        size_t llvm_size = dl->getTypeStoreSize(structType);
    
  •        uint64_t llvm_size = dl->getTypeStoreSize(structType);
    
  •        size_t llvm_size = td->getTypeStoreSize(structType);
    
  •        uint64_t llvm_size = td->getTypeStoreSize(structType);
           if (sizeof(csr_matrix) != llvm_size)
    

@@ -648,13 +648,14 @@ unsigned ModelDataIRBuilder::getModelDataSize(llvm::Module *module, llvm::Execut #if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 2)

  • size_t llvm_size = dl->getTypeStoreSize(structType);
  • uint64_t llvm_size = dl->getTypeStoreSize(structType);
  • size_t llvm_size = td->getTypeStoreSize(structType);
  • uint64_t llvm_size = td->getTypeStoreSize(structType);
  • return llvm_size;
  • return (unsigned)llvm_size; printf("TestStruct size: %i, , LLVM Size: %i\n", sizeof(ModelData), llvm_size); diff --git a/source/llvm/SBMLSupportFunctions.cpp b/source/llvm/SBMLSupportFunctions.cpp --- a/source/llvm/SBMLSupportFunctions.cpp +++ b/source/llvm/SBMLSupportFunctions.cpp
  • * in LLVM back end as everything is automatically handled
    
  • * in LLVM back end as everything is automatically handled
    

#if defined(BUILD_LLVM) diff --git a/source/llvm_testing/src/TestVariant.cpp b/source/llvm_testing/src/TestVariant.cpp --- a/source/llvm_testing/src/TestVariant.cpp +++ b/source/llvm_testing/src/TestVariant.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestVariant.cpp b/source/llvm_testing/src/TestVariant.cpp --- a/source/llvm_testing/src/TestVariant.cpp +++ b/source/llvm_testing/src/TestVariant.cpp diff --git a/source/llvm_testing/src/TestVariant.h b/source/llvm_testing/src/TestVariant.h --- a/source/llvm_testing/src/TestVariant.h +++ b/source/llvm_testing/src/TestVariant.h diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt set(target llvm_testing) diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp

  •    cout << "usage llvm_tester path_to_model" << std::endl;
    

diff --git a/source/llvm_testing/src/TestVariant.cpp b/source/llvm_testing/src/TestVariant.cpp +++ b/source/llvm_testing/src/TestVariant.cpp diff --git a/source/llvm_testing/src/TestVariant.h b/source/llvm_testing/src/TestVariant.h +++ b/source/llvm_testing/src/TestVariant.h diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp @@ -76,7 +76,15 @@ LLVMModelSymbols::~LLVMModelSymbols() bool LLVMModelSymbols::visit(const libsbml::Compartment& x) diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestEvalReactionRates.cpp b/source/llvm_testing/src/TestEvalReactionRates.cpp --- a/source/llvm_testing/src/TestEvalReactionRates.cpp +++ b/source/llvm_testing/src/TestEvalReactionRates.cpp diff --git a/source/llvm_testing/src/TestEvalReactionRates.h b/source/llvm_testing/src/TestEvalReactionRates.h --- a/source/llvm_testing/src/TestEvalReactionRates.h +++ b/source/llvm_testing/src/TestEvalReactionRates.h @@ -70,7 +71,7 @@ if(BUILD_LLVM) llvm/LLVMExecutableModel llvm/GetRateRuleValuesCodeGen llvm/GetValuesCodeGen

  • llvm/GetInitialValuesCodeGen
  • llvm/GetInitialValuesCodeGen llvm/GetEventValuesCodeGen llvm/KineticLawParameterResolver llvm/LLVMModelData #if defined(BUILD_LLVM) #if defined(BUILD_LLVM) && !defined(BUILD_LEGACY_C)
  • * @param compiler: the textual name of the compiler. If this is "llvm", then then
    
  • * the LLVM ModelGenerator is created, otherwise, A C based model generator is
    
  • * C files and objects here, not used for LLVM.
    
  • * not used in LLVM.
    

diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp #include "LLVMException.h" diff --git a/source/llvm/LLVMModelGenerator.h b/source/llvm/LLVMModelGenerator.h --- a/source/llvm/LLVMModelGenerator.h +++ b/source/llvm/LLVMModelGenerator.h #ifndef rrLLVMModelGeneratorH #define rrLLVMModelGeneratorH #include "LLVMCompiler.h" diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp #include "LLVMException.h" using namespace llvm; diff --git a/source/llvm_testing/src/TestBase.cpp b/source/llvm_testing/src/TestBase.cpp --- a/source/llvm_testing/src/TestBase.cpp +++ b/source/llvm_testing/src/TestBase.cpp diff --git a/source/llvm_testing/src/test_compiler.cpp b/source/llvm_testing/src/test_compiler.cpp --- a/source/llvm_testing/src/test_compiler.cpp +++ b/source/llvm_testing/src/test_compiler.cpp

  • ModelGenerator *mg = ModelGeneratorFactory::createModelGenerator("LLVM");
  • ModelGenerator *mg = ModelGenerator::New("LLVM");
    • Currently we have two concrete Model implmentations, an LLVM JIT compiled
  • * @param compiler: the textual name of the compiler. If this is "llvm", then then
    
  • * the LLVM ModelGenerator is created, otherwise, A C based model generator is
    
  • * C files and objects here, not used for LLVM.
    
  • * not used in LLVM.
    

diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -156,6 +156,7 @@ int LLVMExecutableModel::setValues(bool (funcPtr)(LLVMModelData, int, double), LLVMExecutableModel::LLVMExecutableModel() : @@ -193,6 +194,7 @@ LLVMExecutableModel::LLVMExecutableModel( @@ -348,7 +350,7 @@ void LLVMExecutableModel::getStateVectorRate(double time, const double *y, doubl @@ -381,7 +383,7 @@ void LLVMExecutableModel::getStateVectorRate(double time, const double *y, doubl @@ -424,6 +426,17 @@ void LLVMExecutableModel::getStateVectorRate(double time, const double *y, doubl +double LLVMExecutableModel::getFloatingSpeciesAmountRate(int index,

  •    throw_llvm_exception("index out of range");
    

void LLVMExecutableModel::testConstraints() @@ -658,8 +671,6 @@ void LLVMExecutableModel::reset() @@ -1239,7 +1250,6 @@ LLVMExecutableModel* LLVMExecutableModel::dummy() void LLVMExecutableModel::evalReactionRates() int LLVMExecutableModel::getNumRules() @@ -1318,19 +1328,30 @@ int LLVMExecutableModel::getReactionRates(int len, const int* indx,

  •            throw LLVMException("index out of range");
    
  •        throw LLVMException("index out of range");
    
  •        throw_llvm_exception("invalid length, length must be <= numReactions");
    

diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h

  • * This needs to be moved into an LLVM generated function instead of a
    

diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp

  •    cout << "usage llvm_tester path_to_model log_level" << std::endl;
    
  •    cout << "usage llvm_tester path_to_model" << std::endl;
    

diff --git a/source/llvm_testing/src/TestEvalReactionRates.cpp b/source/llvm_testing/src/TestEvalReactionRates.cpp --- a/source/llvm_testing/src/TestEvalReactionRates.cpp +++ b/source/llvm_testing/src/TestEvalReactionRates.cpp diff --git a/source/llvm_testing/src/TestEvalReactionRates.h b/source/llvm_testing/src/TestEvalReactionRates.h --- a/source/llvm_testing/src/TestEvalReactionRates.h +++ b/source/llvm_testing/src/TestEvalReactionRates.h -The LLVM ModelGenerator maintins a hash table of currently running +The LLVM ModelGenerator maintains a hash table of currently running diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp

  • The LLVM ModelGenerator maintins a hash table of currently running
  • The LLVM ModelGenerator maintains a hash table of currently running diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -112,6 +112,9 @@ LLVMModelDataSymbols::LLVMModelDataSymbols() : LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model model, @@ -125,6 +128,10 @@ LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model model, diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -371,8 +371,8 @@ llvm::Value ModelDataIRBuilder::createStore(ModelDataFields field, llvm::Value ModelDataIRBuilder::createCompLoad(const std::string& id, const llvm::Twine& name) llvm::Value* ModelDataIRBuilder::createCompStore(const std::string& id, @@ -382,13 +382,11 @@ llvm::Value* ModelDataIRBuilder::createCompStore(const std::string& id, -llvm::Value* ModelDataIRBuilder::createCompGEP(const std::string& id,
  •    const llvm::Twine& name)
    

+llvm::Value* ModelDataIRBuilder::createCompGEP(const std::string& id) llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtLoad( @@ -583,8 +581,7 @@ llvm::StructType *ModelDataIRBuilder::createModelDataStructType(llvm::Module *mo @@ -602,25 +599,18 @@ llvm::StructType *ModelDataIRBuilder::createModelDataStructType(llvm::Module *mo diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h

  • llvm::Value* createCompGEP(const std::string& id,
  •        const llvm::Twine &name = "");
    
  • llvm::Value* createCompGEP(const std::string& id); diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp throw_llvm_exception("Fatal SBML error, no model, errors in sbml document: " + errors); throw_llvm_exception("readSBMLFromString returned NULL, no further information available");
  • throw LLVMException(what + help);
  •        throw_llvm_exception(msg);
    
  •        throw_llvm_exception(msg);
    
  •            throw_llvm_exception(msg);
    
  •            throw_llvm_exception(msg);
    
  •            throw_llvm_exception(msg);
    
  •            throw_llvm_exception(msg);
    
  • The LLVM ModelGenerator maintins a hash table of currently running +The LLVM ModelGenerator maintins a hash table of currently running When the LLVM back end is used (default) this always returns the current state of the +The LLVM ModelGenerator maintins a hash table of currently running +Use the LLVM MCJIT JIT engine. +The MCJIT is the new LLVM JIT engine, it is not as well tested as the +original JIT engine. Does NOT work on LLVM 3.1 When the LLVM back end is used (default) this always returns the current state of the The LLVM ModelGenerator maintins a hash table of currently running
  • The LLVM ModelGenerator maintins a hash table of currently running
  • Use the LLVM MCJIT JIT engine.
  • The MCJIT is the new LLVM JIT engine, it is not as well tested as the
  • original JIT engine. Does NOT work on LLVM 3.1 create conserved moiety validator function, improve error handling, improve LLVMException, improve steady state error handling, add warning to steady state if conserved moieties are not enabled, fix few issues in Config, ran OSX tests diff --git a/source/llvm/LLVMException.h b/source/llvm/LLVMException.h --- a/source/llvm/LLVMException.h +++ b/source/llvm/LLVMException.h explicit LLVMException(const std::string& what) : explicit LLVMException(const std::string& what, const std::string &where) : #define throw_llvm_exception(what) \
  •      throw LLVMException(_err_msg); }
    
  •        Log(rr::Logger::LOG_INFORMATION) << "LLVMException, what: " \
    
  •            throw LLVMException(what, __FUNC__); \
    

diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -127,6 +123,11 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp @@ -188,7 +188,12 @@ llvm::Value* ModelDataStoreSymbolResolver::storeSymbolValue(

  •    throw_llvm_exception("Attempt to store a value in symbol \""
    

diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp llvm::FunctionType *funcType, Module *module); throw_llvm_exception("error setting conserved moiety converter document");

  •        throw_llvm_exception(msg);
    
  •        throw_llvm_exception(msg);
    
  •            throw_llvm_exception(msg);
    
  •            throw_llvm_exception(msg);
    
  •            throw_llvm_exception(msg);
    
  •            throw_llvm_exception(msg);
    
  •     * The LLVM ModelGenerator maintins a hash table of currently running
    
  •     * Use the LLVM MCJIT JIT engine.
    
  •     * The MCJIT is the new LLVM JIT engine, it is not as well tested as the
    
  •     * original JIT engine. Does NOT work on LLVM 3.1
    

diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1486,7 +1486,7 @@ int LLVMExecutableModel::getEventTriggers(int len, const int indx, unsigned cha -void LLVMExecutableModel::evalEvents(double timeEnd, +void LLVMExecutableModel::applyEvents(double timeEnd, @@ -1545,7 +1545,7 @@ int LLVMExecutableModel::applyPendingEvents(const double stateVector, -void LLVMExecutableModel::evalEventRoots(double time, const double y, double gdot) +void LLVMExecutableModel::getEventRoots(double time, const double* y, double* gdot) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h

  •     * Use the LLVM MCJIT JIT engine.
    
  •     * The MCJIT is the new LLVM JIT engine, it is not as well tested as the
    
  •     * original JIT engine. Does NOT work on LLVM 3.1
    
  •     * Use the LLVM MCJIT JIT engine.
    
  •     * The MCJIT is the new LLVM JIT engine, it is not as well tested as the
    
  •     * original JIT engine. Does NOT work on LLVM 3.1
    

diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h --- a/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h LLVMExecutableModel& model; diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1493,6 +1493,8 @@ void LLVMExecutableModel::evalEvents(double timeEnd, @@ -1501,7 +1503,6 @@ void LLVMExecutableModel::evalEvents(double timeEnd, @@ -1533,7 +1534,6 @@ int LLVMExecutableModel::applyPendingEvents(const double stateVector, @@ -1622,7 +1622,7 @@ bool LLVMExecutableModel::applyEvents(unsigned char prevEventState, bool LLVMExecutableModel::getEventTieBreak(uint eventA, uint eventB) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -451,7 +451,7 @@ llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode ast) @@ -516,7 +516,7 @@ llvm::Value ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode ast) @@ -527,10 +527,10 @@ llvm::Value ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode ast) diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp namespace rrllvm -const char ModelDataIRBuilder::LLVMModelDataName = "rr::LLVMModelData"; +const char* ModelDataIRBuilder::LLVMModelDataName = "rr_LLVMModelData"; diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp When the LLVM back end is used (default) this always returns the current state of the -- fixed iPhone build config for Xcode 4.2 (compiler name changed to llvm-g++) -CC = $(shell ls $(TOOL_PREFIX)/llvm-gcc-$(GCC_VER)* | tail -1) -CXX = $(shell ls $(TOOL_PREFIX)/llvm-g++-$(GCC_VER)* | tail -1)

    • fixed iPhone build config for Xcode 4.2 (compiler name changed to llvm-g++) @@ -68,7 +68,7 @@ if(BUILD_LLVM) llvm/LLVMExecutableModel llvm/GetRateRuleValuesCodeGen llvm/GetValuesCodeGen
  •   llvm/GetInitialValuesCodeGen
    
  • llvm/GetInitialValuesCodeGen llvm/GetEventValuesCodeGen llvm/KineticLawParameterResolver llvm/LLVMModelData diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt +- fixed iPhone build config for Xcode 4.2 (compiler name changed to llvm-g++) +** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on +#elif !defined(GNUC) /* Works for compilers other than LLVM / +// Adapted for POCO from LLVM Compiler Infrastructure code: +// The LLVM Compiler Infrastructure +CC = $(shell ls $(TOOL_PREFIX)/llvm-gcc-$(GCC_VER) | tail -1) +CXX = $(shell ls $(TOOL_PREFIX)/llvm-g++-$(GCC_VER)* | tail -1) +!!!Code from the LLVM Compiler Infrastructure
  •    LLVM Team
    
  •    http://llvm.org
    
  •    * Neither the names of the LLVM Team, University of Illinois at
    
    • fixed iPhone build config for Xcode 4.2 (compiler name changed to llvm-g++) +

      Code from the LLVM Compiler Infrastructure

  • LLVM Team
  • http://llvm.org
    • Neither the names of the LLVM Team, University of Illinois at +if(BUILD_LLVM)
  •    ${LLVM_LIBRARIES}
    

+endif(BUILD_LLVM) -if(BUILD_LLVM)

  •    ${LLVM_LIBRARIES}
    

-endif(BUILD_LLVM) #if defined(BUILD_LLVM) #include "llvm/LLVMModelGenerator.h"

should we use LLVM ?

option (BUILD_LLVM "Build the LLVM back end" ON) @@ -77,6 +80,7 @@ if(BUILD_LLVM AND NOT LLVM_FOUND) message(STATUS "NOT using LLVM") endif(BUILD_LLVM) @@ -113,6 +88,38 @@ if(BUILD_LLVM) endif(BUILD_LLVM) -#if defined(BUILD_LLVM) +#if defined(BUILD_LLVM) && !defined(BUILD_LEGACY_C)

  • Log(Logger::LOG_INFORMATION) << "Creating LLVM based model generator.";
  • return new rrllvm::LLVMModelGenerator(); +#if defined(BUILD_LLVM) && defined(BUILD_LEGACY_C) Log(Logger::LOG_INFORMATION) << "Creating LLVM based model generator."; return new rrllvm::LLVMModelGenerator(); +#if !defined(BUILD_LLVM) && defined(BUILD_LEGACY_C) +#if !defined(BUILD_LLVM) && !defined(BUILD_LEGACY_C) +#error Must built at least one ModelGenerator backend, either BUILD_LLVM or BUILD_LEGACY_C diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -221,7 +221,7 @@ LLVMExecutableModel::LLVMExecutableModel( @@ -1205,13 +1205,13 @@ std::string LLVMExecutableModel::getEventId(int indx) -void LLVMExecutableModel::setEventHandler(int index, +void LLVMExecutableModel::setEventListener(int index, @@ -1219,16 +1219,16 @@ void LLVMExecutableModel::setEventHandler(int index, -rr::EventHandlerPtr LLVMExecutableModel::getEventHandler(int index) +rr::EventListenerPtr LLVMExecutableModel::getEventListener(int index) throw_llvm_exception("index " + rr::toString(index) + " out of range"); @@ -1607,13 +1607,13 @@ bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, pendingEvents.push(rrllvm::Event(this, i)); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h #if defined(BUILD_LLVM) diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1609,7 +1610,11 @@ bool LLVMExecutableModel::applyEvents(unsigned char prevEventState, pendingEvents.push(rrllvm::Event(*this, i)); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h ran Linux 64 tests with LLVM 3.4 diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp #include "LLVMException.h" @@ -216,8 +219,10 @@ LLVMExecutableModel::LLVMExecutableModel( @@ -532,7 +537,15 @@ int LLVMExecutableModel::getBoundarySpeciesIndex(const string& id) string LLVMExecutableModel::getBoundarySpeciesId(int indx)
  •    throw_llvm_exception("index out of range");
    

int LLVMExecutableModel::getGlobalParameterIndex(const string& id) @@ -876,6 +889,12 @@ void LLVMExecutableModel::getIds(int types, std::liststd::string &ids) int LLVMExecutableModel::getSupportedIdTypes() @@ -1159,6 +1178,59 @@ std::string LLVMExecutableModel::getStateVectorId(int index) +int LLVMExecutableModel::getEventIndex(const std::string& eventId)

  • catch(LLVMException&) +std::string LLVMExecutableModel::getEventId(int indx)
  •    throw_llvm_exception("index out of range");
    

+void LLVMExecutableModel::setEventHandler(int index,

  •    throw_llvm_exception("index " + rr::toString(index) + " out of range");
    

+rr::EventHandlerPtr LLVMExecutableModel::getEventHandler(int index)

  •    throw_llvm_exception("index " + rr::toString(index) + " out of range");
    

LLVMExecutableModel* LLVMExecutableModel::dummy() return new LLVMExecutableModel(); @@ -1534,6 +1606,11 @@ bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, pendingEvents.push(rrllvm::Event(this, i)); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h int getValues(double (funcPtr)(LLVMModelData, int), int len, diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -1076,6 +1076,11 @@ void LLVMModelDataSymbols::initEvents(const libsbml::Model model) @@ -1199,6 +1204,37 @@ uint LLVMModelDataSymbols::getInitGlobalParameterSize() const +std::vectorstd::string LLVMModelDataSymbols::getEventIds() const +std::string LLVMModelDataSymbols::getEventId(uint indx) const +uint LLVMModelDataSymbols::getEventIndex(const std::string& id) const

  •    throw LLVMException("could not find event with id " + id, __FUNC__);
    

diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h When the LLVM back end is used (default) this always returns the current state of the diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -404,16 +404,19 @@ llvm::Value* ASTNodeCodeGen::applyLogicalCodeGen(const libsbml::ASTNode* ast) llvm::Value* ASTNodeCodeGen::functionCallCodeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/FunctionResolver.cpp b/source/llvm/FunctionResolver.cpp --- a/source/llvm/FunctionResolver.cpp +++ b/source/llvm/FunctionResolver.cpp @@ -46,22 +46,30 @@ llvm::Value* FunctionResolver::loadSymbolValue(const std::string& symbol,

  •        throw_llvm_exception(symbol + ", math elemetn of function definition must be a lambda");
    
  •        throw_llvm_exception(symbol + ", math element of function definition must be a lambda");
    
  •        throw_llvm_exception("function node " + symbol + " must have at least one child node, "
           throw_llvm_exception(symbol + ", argument count does not match, expected " +
    

@@ -69,7 +77,8 @@ llvm::Value* FunctionResolver::loadSymbolValue(const std::string& symbol, @@ -77,7 +86,11 @@ llvm::Value* FunctionResolver::loadSymbolValue(const std::string& symbol, diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -225,6 +225,8 @@ LLVMExecutableModel::LLVMExecutableModel( LLVMExecutableModel::~LLVMExecutableModel() @@ -680,14 +682,14 @@ int LLVMExecutableModel::getStateVector(double* stateVector) diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp

  • //cout << "RoadRunner LLVM SBML Test Suite" << endl;
  • const char* compiler = "llvm";
  •    cout << "usage llvm_tester path_to_model log_level" << std::endl;
    
  • //runLLVMCSRMatrixTest(33, 323, 50);
  •    TestEvalModel test("llvm", pairs[testCase].first, pairs[testCase].second);
    
  • printf("LLVM Model Used %0.2f seconds of CPU time. \n", (double)(stopc - startc)/CLOCKS_PER_SEC);
  • printf("LLVM Model Finished in about %.0f seconds. \n", difftime(stop, start));
  • :param compiler: if LLVM build is enabled, the compiler defaults to LLVM. @@ -383,12 +385,78 @@ When the LLVM back end is used (default) this always returns the current state o -:param compiler: if LLVM build is enabled, the compiler defaults to LLVM. diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp #include "LLVMException.h" @@ -896,102 +895,49 @@ int LLVMExecutableModel::getSupportedIdTypes() double LLVMExecutableModel::getValue(const std::string& id)
  •    throw LLVMException("invalid selection string " + id);
    
  •    case LLVMModelDataSymbols::FLOATING_SPECIES:
    
  •    case LLVMModelDataSymbols::BOUNDARY_SPECIES:
    
  •    case LLVMModelDataSymbols::COMPARTMENT:
    
  •    case LLVMModelDataSymbols::GLOBAL_PARAMETER:
    
  •    case LLVMModelDataSymbols::REACTION:
    
  •        throw LLVMException("No sbml element exists for symbol '" + id + "'");
    
  •    case LLVMModelDataSymbols::FLOATING_SPECIES:
    
  •    case LLVMModelDataSymbols::BOUNDARY_SPECIES:
    
  •        throw LLVMException(msg);
    
  •    if (symbols->getSymbolIndex(sel.p1, index) == LLVMModelDataSymbols::FLOATING_SPECIES)
    
  •        throw LLVMException("Invalid id '" + id + "' for floating amount rate");
    
  •    case LLVMModelDataSymbols::FLOATING_SPECIES:
    
  •    case LLVMModelDataSymbols::COMPARTMENT:
    
  •        throw LLVMException(msg);
    
  •    if (symbols->getSymbolIndex(sel.p1, index) == LLVMModelDataSymbols::FLOATING_SPECIES)
    
  •        throw LLVMException("Invalid id '" + id + "' for inital floating species concentration");
    

@@ -1002,106 +948,179 @@ double LLVMExecutableModel::getValue(const std::string& id) -void LLVMExecutableModel::setValue(const std::string& id, double value) +const rr::SelectionRecord& LLVMExecutableModel::getSelection(const std::string& str)

  •    throw LLVMException("invalid selection string " + id);
    
  •        throw LLVMException("The sbml id '" + id +
    
  •        throw LLVMException("Invalid or non-existant sbml id  '" + id + "' for set value");
    
  •        throw LLVMException("invalid selection string " + str);
    
  •        throw LLVMException(msg);
    
  •        case LLVMModelDataSymbols::FLOATING_SPECIES:
    
  •        case LLVMModelDataSymbols::BOUNDARY_SPECIES:
    
  •        case LLVMModelDataSymbols::COMPARTMENT:
    
  •        case LLVMModelDataSymbols::GLOBAL_PARAMETER:
    
  •        case LLVMModelDataSymbols::REACTION:
    
  •            throw LLVMException("No sbml element exists for symbol '" + str + "'");
    
  •        case LLVMModelDataSymbols::FLOATING_SPECIES:
    
  •        case LLVMModelDataSymbols::BOUNDARY_SPECIES:
    
  •            throw LLVMException(msg);
    
  •        if (symbols->getSymbolIndex(sel.p1, index) == LLVMModelDataSymbols::FLOATING_SPECIES)
    
  •            throw LLVMException("Invalid id '" + str + "' for floating amount rate");
    
  •        throw LLVMException("Invalid id '" + id + "' for floating amount rate");
    
  •        case LLVMModelDataSymbols::FLOATING_SPECIES:
    
  •        case LLVMModelDataSymbols::COMPARTMENT:
    
  •            throw LLVMException(msg);
    
  •        if (symbols->getSymbolIndex(sel.p1, index) == LLVMModelDataSymbols::FLOATING_SPECIES)
    
  •            throw LLVMException("Invalid id '" + str + "' for inital floating species concentration");
    
  •        throw LLVMException("Invalid id '" + id + "' for floating species");
    
  •        throw LLVMException("Invalid selection '" + str + "' for setting value");
    

+void LLVMExecutableModel::setValue(const std::string& id, double value)

  •    throw LLVMException("The sbml id '" + id +
       throw LLVMException("Invalid selection '" + sel.to_string() + "' for setting value");
    

@@ -1110,7 +1129,7 @@ void LLVMExecutableModel::setValue(const std::string& id, double value) int LLVMExecutableModel::getFloatingSpeciesConcentrationRates(int len,

  • throw LLVMException(string(FUNC) + " not implemented"); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h typedef string (LLVMExecutableModel::*GetNameFuncPtr)(int); diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp diff --git a/source/llvm/LLVMException.h b/source/llvm/LLVMException.h --- a/source/llvm/LLVMException.h +++ b/source/llvm/LLVMException.h #define RRLLVMEXCEPTION_H_ namespace rrllvm explicit LLVMException(const std::string& what) : explicit LLVMException(const std::string& what, const std::string &where) : #define throw_llvm_exception(what)
    throw LLVMException(_err_msg); } diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -868,12 +868,13 @@ void LLVMExecutableModel::getIds(int types, std::liststd::string &ids) int LLVMExecutableModel::getSupportedIdTypes() @@ -888,8 +889,8 @@ int LLVMExecutableModel::getSupportedIdTypes() @@ -914,94 +915,82 @@ double LLVMExecutableModel::getValue(const std::string& id)
  •    case LLVMModelDataSymbols::FLOATING_SPECIES:
    
  •    case LLVMModelDataSymbols::BOUNDARY_SPECIES:
    
  •    case LLVMModelDataSymbols::COMPARTMENT:
    
  •    case LLVMModelDataSymbols::GLOBAL_PARAMETER:
    
  •    case LLVMModelDataSymbols::REACTION:
           throw LLVMException("No sbml element exists for symbol '" + id + "'");
    
  •    case LLVMModelDataSymbols::FLOATING_SPECIES:
    
  •    case LLVMModelDataSymbols::BOUNDARY_SPECIES:
           throw LLVMException(msg);
    
  •    if (symbols->getSymbolIndex(sel.p1, index) == LLVMModelDataSymbols::FLOATING_SPECIES)
           throw LLVMException("Invalid id '" + id + "' for floating amount rate");
    
  •    case LLVMModelDataSymbols::FLOATING_SPECIES:
    
  •        throw LLVMException("Invalid id '" + id + "' for floating amount rate");
    
  •    case LLVMModelDataSymbols::COMPARTMENT:
    
  •        throw LLVMException(msg);
    
  •    if (symbols->getSymbolIndex(sel.p1, index) == LLVMModelDataSymbols::FLOATING_SPECIES)
    
  •        throw LLVMException("Invalid id '" + id + "' for floating species");
    
  •        throw LLVMException("Invalid id '" + id + "' for inital floating species concentration");
    

@@ -1083,7 +1072,7 @@ void LLVMExecutableModel::setValue(const std::string& id, double value) @@ -1099,7 +1088,7 @@ void LLVMExecutableModel::setValue(const std::string& id, double value) throw LLVMException("Invalid id '" + id + "' for floating amount rate"); diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -195,6 +195,41 @@ const std::string& LLVMModelDataSymbols::getModelName() const +LLVMModelDataSymbols::SymbolIndexType LLVMModelDataSymbols::getSymbolIndex( uint LLVMModelDataSymbols::getCompartmentIndex( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -314,10 +314,6 @@ void LLVMExecutableModel::getRateRuleValues(double rateRuleValues) -void LLVMExecutableModel::setRateRuleValues(const double rateRuleValues) void LLVMExecutableModel::convertToConcentrations() @@ -517,8 +513,7 @@ int LLVMExecutableModel::getFloatingSpeciesIndex(const string& id) string LLVMExecutableModel::getFloatingSpeciesId(int index) int LLVMExecutableModel::getBoundarySpeciesIndex(const string& id) @@ -872,6 +867,13 @@ void LLVMExecutableModel::getIds(int types, std::liststd::string &ids) int LLVMExecutableModel::getSupportedIdTypes() @@ -1135,6 +1137,18 @@ int LLVMExecutableModel::setBoundarySpeciesAmounts(int len, const int indx, +std::string LLVMExecutableModel::getStateVectorId(int index) LLVMExecutableModel LLVMExecutableModel::dummy() return new LLVMExecutableModel(); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -422,6 +423,21 @@ std::vectorstd::string LLVMModelDataSymbols::getFloatingSpeciesIds() const +std::string LLVMModelDataSymbols::getFloatingSpeciesId(uint indx) const uint LLVMModelDataSymbols::getIndependentFloatingSpeciesSize() const @@ -503,6 +519,21 @@ uint LLVMModelDataSymbols::getRateRuleSize() const +std::string rrllvm::LLVMModelDataSymbols::getRateRuleId(uint indx) const bool LLVMModelDataSymbols::isIndependentElement(const std::string& id) const @@ -901,6 +932,7 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) bool LLVMModelDataSymbols::isValidSpeciesReference( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h +#if defined(BUILD_LLVM)

  • string compiler = "LLVM" ;
  • * @param compiler: If LLVM build is enabled, the compiler defaults to LLVM.
    
  • * in LLVM back end as everything is automatically handled
    
  • * @param compiler: If LLVM build is enabled, the compiler defaults to LLVM.
    
  • * in LLVM back end as everything is automatically handled
    

diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -302,23 +302,6 @@ void LLVMExecutableModel::computeConservedTotals() -double LLVMExecutableModel::getFloatingSpeciesConcentration(int index) int LLVMExecutableModel::getFloatingSpeciesConcentrations(int len, int const *indx, @@ -348,7 +331,7 @@ void LLVMExecutableModel::computeAllRatesOfChange() -void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) +void LLVMExecutableModel::getStateVectorRate(double time, const double *y, double *dydt) @@ -1068,6 +1051,12 @@ void LLVMExecutableModel::setValue(const std::string& id, double value)

  •        throw LLVMException("The sbml id '" + id +
           throw LLVMException("Invalid or non-existant sbml id  '" + id + "' for set value");
    

@@ -1120,10 +1109,8 @@ void LLVMExecutableModel::setValue(const std::string& id, double value) throw LLVMException("Invalid selection '" + sel.to_string() + "' for setting value"); @@ -1287,7 +1274,7 @@ int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h typedef string (LLVMExecutableModel::*GetNameFuncPtr)(int); diff --git a/source/llvm_testing/src/TestEvalModel.cpp b/source/llvm_testing/src/TestEvalModel.cpp --- a/source/llvm_testing/src/TestEvalModel.cpp +++ b/source/llvm_testing/src/TestEvalModel.cpp @@ -264,20 +272,17 @@ endif(BUILD_LLVM) -if(BUILD_LLVM)

  • add_subdirectory(llvm_testing) -endif(BUILD_LLVM)
  • if(BUILD_LLVM)
  •    add_subdirectory(llvm_testing)
    
  • endif(BUILD_LLVM) diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt
  • Defaults to LLVM code generation on the backend, resulting is very fast simulation times
  • -When using the LLVM back end, all model state calculation are automatically -causes that value to cascade down to the terminal cells. The LLVM back end roadruner + When using the LLVM back end, all model state calculation are automatically + causes that value to cascade down to the terminal cells. The LLVM back end roadruner -3. Defaults to LLVM code generation on the backend, resulting is very fast simulation times. source/llvm/ModelGeneratorContext.cpp diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp llvm runs more than twice as fast compared to tcc stuff 48 seconds versus 101 seconds, and with no errors diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp @@ -19,7 +19,7 @@ The LLVM backend and refactoring of the core was designed and undertaken by -- Defaults to LLVM code generation on the backend, resulting is very fast simulation times +- Defaults to LLVM code generation on the backend, resulting is very fast simulation times -- Defaults to LLVM code generation on the backend, resulting is very fast simulation times diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp LLVMModelDataSymbols::SpeciesReferenceInfo nz = *i; diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -566,7 +566,7 @@ void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model* model) @@ -623,9 +623,9 @@ void LLVMModelDataSymbols::initBoundarySpecies(const libsbml::Model* model) @@ -955,9 +955,9 @@ bool LLVMModelDataSymbols::isValidSpeciesReference( void LLVMModelDataSymbols::displayCompartmentInfo() diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -315,7 +315,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -328,7 +328,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -176,12 +176,19 @@ endif (${BUILD_LLVM}) endif(BUILD_LLVM) -The LLVM backend and refactoring of the core was designed and undertaken by -LLVM - LLVM Team - http://llvm.org -- Defaults to LLVM code generation on the backend, resulting is very fast simulation times +llvm_testing.exe The LLVM backend and refactoring of the core was designed and undertaken by # should we use LLVM ? -option (BUILD_LLVM "Build the LLVM back end" OFF) +option (BUILD_LLVM "Build the LLVM back end" ON) if(BUILD_LLVM AND NOT LLVM_FOUND) message(FATAL_ERROR "BUILD_LLVM is enabled, but no LLVM installation was found") -- Defaults to LLVM code generation on the backend, resulting is very fast simulation times +- Defaults to LLVM code generation on the backend, resulting is very fast simulation times +- Defaults to LLVM code generation on the backend, resulting is very fast simulation times find_package(LLVM) -# should we use LLVM ? # should we use LLVM ? # should we use LLVM ? +# should we use LLVM ? option (BUILD_LLVM "Build the LLVM back end" OFF) @@ -278,7 +278,7 @@ if(BUILD_LLVM) add_subdirectory(llvm_testing) endif(BUILD_LLVM)
  • Defaults to LLVM code generation on the backend, resulting is very fast simulation times
  • @@ -65,4 +74,22 @@ LLVM +LLVM + LLVM Team + http://llvm.org @@ -19,7 +19,11 @@ The LLVM backend and refactoring of the core was designed and undertaken by +- Defaults to LLVM code generation on the backend, resulting is very fast simulation times +
  • Defaults to LLVM code generation on the backend, resulting is very fast simulation times
  • - [in]compilermay be NULL, if NULL, uses default compiler. If LLVM build is enabled, setting compiler to "llvm" enables llvm based model generation. -\mbox{\tt in} & {\em compiler} & may be N\-U\-L\-L, if N\-U\-L\-L, uses default compiler. If L\-L\-V\-M build is enabled, setting compiler to \char`\"{}llvm\char`\"{} enables llvm based model generation. \\ -

    In the C generating model sytem, an external C compiler is used to compile generated C code. However, in the LLVM system, there is no code generation nor compilation, so this interface is not really usefull, but is implemented for compatiblity with the C system.

    -

    Currently we have two concrete Model implmentations, an LLVM JIT compiled model and the older C file generating shared library model.

    - compiler,:the textual name of the compiler. If this is "llvm", then then the LLVM ModelGenerator is created, otherwise, A C based model generator is created. - tmpDirThe C version stores all the generated temporary C files and objects here, not used for LLVM. - supportCodeDirLocation where roadrunner include files are, not used in LLVM. - compiler,:If LLVM build is enabled, the compiler defaults to LLVM. -

    The C back end requires this to be called to update model variables if anyting is changes. Does nothing in LLVM back end as everything is automatically handled with lazy evaluation.

    -
    11 #if defined(__llvm__)
    -
    15 #if defined(__GNUC__) && !defined(__llvm__)
    -

    Should the model be recompiled? The LLVM ModelGenerator maintins a hash table of currently running models. If this flag is NOT set, then the generator will look to see if there is already a running instance of the given model and use the generated code from that one.

    -{\em compiler,\-:} & the textual name of the compiler. If this is \char`\"{}llvm\char`\"{}, then then the L\-L\-V\-M \hyperlink{classrr_1_1_model_generator}{Model\-Generator} is created, otherwise, A C based model generator is created.\\ diff --git a/source/llvm/FunctionResolver.cpp b/source/llvm/FunctionResolver.cpp --- a/source/llvm/FunctionResolver.cpp +++ b/source/llvm/FunctionResolver.cpp #include "LLVMException.h" namespace rrllvm @@ -54,12 +55,16 @@ llvm::Value* FunctionResolver::loadSymbolValue(const std::string& symbol, - throw_llvm_exception("math elemetn of function definition must be a lambda"); + throw_llvm_exception(symbol + ", math elemetn of function definition must be a lambda"); - throw_llvm_exception("argument count does not match"); + throw_llvm_exception(symbol + ", argument count does not match, expected " + diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp - // we only support LLVM >= 3.1 + // we only support LLVM >= 3.1 #if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR == 1) + [in]compilermay be NULL, if NULL, uses default compiler. If LLVM build is enabled, setting compiler to "llvm" enables llvm based model generation. +\mbox{\tt in} & {\em compiler} & may be N\-U\-L\-L, if N\-U\-L\-L, uses default compiler. If L\-L\-V\-M build is enabled, setting compiler to \char`\"{}llvm\char`\"{} enables llvm based model generation. \\ -// If LLVM build is enabled, setting compiler to "llvm" enables llvm based + If LLVM build is enabled, setting compiler to "llvm" enables llvm based tweak to complile with LLVM 3.1 diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp + // we only support LLVM >= 3.1 +#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR == 1) diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp ran 32 bit Linux tests (LLVM 3.1) diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp const char* compiler = "llvm"; diff --git a/source/llvm_testing/src/ConfigurableTest.cpp b/source/llvm_testing/src/ConfigurableTest.cpp --- a/source/llvm_testing/src/ConfigurableTest.cpp +++ b/source/llvm_testing/src/ConfigurableTest.cpp diff --git a/source/llvm_testing/src/ConfigurableTest.h b/source/llvm_testing/src/ConfigurableTest.h --- a/source/llvm_testing/src/ConfigurableTest.h +++ b/source/llvm_testing/src/ConfigurableTest.h } /* namespace rrllvm */ diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp @@ -328,7 +328,7 @@ llvm::FunctionPassManager* ModelGeneratorContext::getFunctionPassManager() const diff --git a/source/llvm/CodeGenBase.h b/source/llvm/CodeGenBase.h --- a/source/llvm/CodeGenBase.h +++ b/source/llvm/CodeGenBase.h llvm::Function *func = (llvm::Function*)codeGen(); llvm::Function *function; + llvm::FunctionPassManager *functionPassManager; diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp namespace rrllvm modelSymbols(new LLVMModelSymbols(getModel(), *symbols)), symbols(new LLVMModelDataSymbols(doc->getModel(), 0)), modelSymbols(new LLVMModelSymbols(getModel(), *symbols)), // initialize LLVM +llvm::FunctionPassManager* ModelGeneratorContext::getFunctionPassManager() const diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h llvm::Module *getModule() const; + llvm::FunctionPassManager *getFunctionPassManager() const; llvm::IRBuilder<> &getBuilder() const; llvm::IRBuilder<> *builder; + llvm::FunctionPassManager *functionPassManager; + * The LLVM ModelGenerator maintins a hash table of currently running diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -648,7 +648,7 @@ void LLVMExecutableModel::reset() diff --git a/source/llvm/CodeGenBase.h b/source/llvm/CodeGenBase.h --- a/source/llvm/CodeGenBase.h +++ b/source/llvm/CodeGenBase.h llvm::ExecutionEngine &engine; llvm::Function *function; virtual llvm::Value *codeGen() = 0; diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp namespace rrllvm diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -643,17 +643,27 @@ void LLVMExecutableModel::reset() @@ -661,7 +671,7 @@ void LLVMExecutableModel::reset() bool LLVMExecutableModel::getConservedSumChanged() diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -267,8 +267,12 @@ llvm::Value* ASTNodeCodeGen::applyArithmeticCodeGen( throw_llvm_exception(err.str()); tweaks for MSVC compile, ran win32 tests with default LLVM backend enabled moiety conservation in LLVM, LLVM is now default compiler in c tests, 100% compliance diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp #include "LLVMException.h" @@ -23,6 +24,8 @@ using namespace llvm; namespace rrllvm - symbols(new LLVMModelDataSymbols(doc->getModel(), options)), - modelSymbols(new LLVMModelSymbols(getModel(), *symbols)), + throw_llvm_exception("error setting conserved moiety converter document"); + throw_llvm_exception("error converting document to conserved moieties"); + symbols = new LLVMModelDataSymbols(doc->getModel(), options); + modelSymbols = new LLVMModelSymbols(getModel(), *symbols); // initialize LLVM symbols(new LLVMModelDataSymbols(doc->getModel(), options)), modelSymbols(new LLVMModelSymbols(getModel(), *symbols)), + throw_llvm_exception("error setting conserved moiety converter document"); + throw_llvm_exception("error converting document to conserved moieties"); + symbols = new LLVMModelDataSymbols(doc->getModel(), options); + modelSymbols = new LLVMModelSymbols(getModel(), *symbols); // initialize LLVM diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h namespace rrllvm llvm::IRBuilder<> *builder; +# if LLVM is enabled, LLVM is the default compiler diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm/SetInitialValuesCodeGen.cpp b/source/llvm/SetInitialValuesCodeGen.cpp --- a/source/llvm/SetInitialValuesCodeGen.cpp +++ b/source/llvm/SetInitialValuesCodeGen.cpp @@ -34,7 +34,7 @@ static std::vector > independentElements(const LLVM diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/source/llvm/ModelInitialValueSymbolResolver.cpp --- a/source/llvm/ModelInitialValueSymbolResolver.cpp +++ b/source/llvm/ModelInitialValueSymbolResolver.cpp @@ -92,6 +92,7 @@ llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue(const std::string& diff --git a/source/llvm/SBMLInitialValueSymbolResolver.cpp b/source/llvm/SBMLInitialValueSymbolResolver.cpp --- a/source/llvm/SBMLInitialValueSymbolResolver.cpp +++ b/source/llvm/SBMLInitialValueSymbolResolver.cpp @@ -60,6 +60,7 @@ llvm::Value* SBMLInitialValueSymbolResolver::loadSymbolValue(const std::string& diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp @@ -49,6 +51,7 @@ LLVMModelSymbols::LLVMModelSymbols(const libsbml::Model *m, LLVMModelDataSymbols @@ -229,11 +232,8 @@ bool LLVMModelSymbols::visit(const libsbml::Reaction& r) catch (LLVMException&) diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -670,7 +673,14 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, @@ -678,6 +688,10 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, @@ -1064,9 +1078,9 @@ uint LLVMModelDataSymbols::getCompartmentInitIndex( -bool LLVMModelDataSymbols::isConservedMoiety(const std::string& symbol) const +bool LLVMModelDataSymbols::isConservedMoietySpecies(const std::string& symbol) const bool LLVMModelDataSymbols::isIndependentInitFloatingSpecies( @@ -1088,8 +1102,9 @@ bool LLVMModelDataSymbols::isIndependentInitCompartment( bool LLVMModelDataSymbols::isIndependentInitElement( bool LLVMModelDataSymbols::hasInitialAssignmentRule(const std::string& id) const diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -875,7 +875,7 @@ void LLVMExecutableModel::getIds(int types, std::list &ids) diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp if (ucomp == "LLVM") - Log(Logger::LOG_NOTICE) << "Creating LLVM based model generator."; + Log(Logger::LOG_INFORMATION) << "Creating LLVM based model generator."; return new rrllvm::LLVMModelGenerator(); fixed bugs in moiety converter, enabled setting boundary species in llvm model diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1053,6 +1053,11 @@ void LLVMExecutableModel::setValue(const std::string& id, double value) throw LLVMException("Invalid or non-existant sbml id '" + id + "' for set value"); @@ -1121,6 +1126,18 @@ int LLVMExecutableModel::getFloatingSpeciesConcentrationRates(int len, +int LLVMExecutableModel::setBoundarySpeciesAmounts(int len, const int* indx, + &LLVMExecutableModel::getBoundarySpeciesId, len, indx, values); LLVMExecutableModel* LLVMExecutableModel::dummy() return new LLVMExecutableModel(); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp const char* compiler = "llvm"; make loadsbml options consistent, get llvm generator ready conserved moiety converter diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp #include "LLVMException.h" @@ -110,7 +111,7 @@ LLVMModelDataSymbols::LLVMModelDataSymbols() : LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model *model, @@ -164,7 +165,7 @@ LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model *model, diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h LLVMModelDataSymbols(); - LLVMModelDataSymbols(libsbml::Model const* model, + LLVMModelDataSymbols(libsbml::Model const* model, unsigned options); virtual ~LLVMModelDataSymbols(); diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -116,9 +116,9 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -157,7 +157,9 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -207,7 +209,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp #include "LLVMException.h" - symbols(new LLVMModelDataSymbols(doc->getModel(), + symbols(new LLVMModelDataSymbols(doc->getModel(), options)), modelSymbols(new LLVMModelSymbols(getModel(), *symbols)), // initialize LLVM - symbols(new LLVMModelDataSymbols(doc->getModel(), + symbols(new LLVMModelDataSymbols(doc->getModel(), options)), modelSymbols(new LLVMModelSymbols(getModel(), *symbols)), // initialize LLVM - symbols(new LLVMModelDataSymbols(doc->getModel(), false)), + symbols(new LLVMModelDataSymbols(doc->getModel(), 0)), modelSymbols(new LLVMModelSymbols(getModel(), *symbols)), // initialize LLVM @@ -225,6 +227,11 @@ const LLVMModelSymbols& ModelGeneratorContext::getModelSymbols() const diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h const llvm::LLVMContext **ctx, const llvm::ExecutionEngine **eng, llvm::Module *module; llvm::IRBuilder<> *builder; diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -1224,28 +1224,28 @@ int LLVMExecutableModel::getReactionRates(int len, const int* indx, -int LLVMExecutableModel::getNumConservedSums() +int LLVMExecutableModel::getNumConservedMoieties() -int LLVMExecutableModel::getConservedSumIndex(const string& name) +int LLVMExecutableModel::getConservedMoietyIndex(const string& name) -string LLVMExecutableModel::getConservedSumId(int index) +string LLVMExecutableModel::getConservedMoietyId(int index) -int LLVMExecutableModel::getConservedSums(int len, const int* indx, +int LLVMExecutableModel::getConservedMoietyValues(int len, const int* indx, -int LLVMExecutableModel::setConservedSums(int len, const int* indx, +int LLVMExecutableModel::setConservedMoietyValues(int len, const int* indx, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp namespace rrllvm @@ -730,47 +746,142 @@ void LLVMExecutableModel::print(std::ostream &stream) -void LLVMExecutableModel::getIds(uint32_t types, std::list &ids) +void LLVMExecutableModel::getIds(int types, std::list &ids) -uint32_t LLVMExecutableModel::getSupportedIdTypes() +int LLVMExecutableModel::getSupportedIdTypes() diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -789,8 +789,6 @@ uint32_t LLVMExecutableModel::getSupportedIdTypes() double LLVMExecutableModel::getValue(const std::string& id) @@ -805,34 +803,34 @@ double LLVMExecutableModel::getValue(const std::string& id) @@ -841,14 +839,14 @@ double LLVMExecutableModel::getValue(const std::string& id) @@ -859,9 +857,9 @@ double LLVMExecutableModel::getValue(const std::string& id) @@ -871,14 +869,14 @@ double LLVMExecutableModel::getValue(const std::string& id) @@ -887,9 +885,9 @@ double LLVMExecutableModel::getValue(const std::string& id) @@ -911,8 +909,6 @@ double LLVMExecutableModel::getValue(const std::string& id) void LLVMExecutableModel::setValue(const std::string& id, double value) @@ -926,24 +922,24 @@ void LLVMExecutableModel::setValue(const std::string& id, double value) @@ -952,14 +948,14 @@ void LLVMExecutableModel::setValue(const std::string& id, double value) @@ -971,14 +967,14 @@ void LLVMExecutableModel::setValue(const std::string& id, double value) @@ -987,9 +983,9 @@ void LLVMExecutableModel::setValue(const std::string& id, double value) diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -772,7 +772,8 @@ void LLVMExecutableModel::getIds(uint32_t types, std::list &ids) uint32_t LLVMExecutableModel::getSupportedIdTypes() diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -767,25 +768,242 @@ void LLVMExecutableModel::getIds(uint32_t types, std::list &ids) uint32_t LLVMExecutableModel::getSupportedIdTypes() double LLVMExecutableModel::getValue(const std::string& id) + throw LLVMException("invalid selection string " + id); + throw LLVMException("No sbml element exists for symbol '" + id + "'"); + throw LLVMException(msg); + throw LLVMException("Invalid id '" + id + "' for floating amount rate"); + throw LLVMException("Invalid id '" + id + "' for floating amount rate"); + throw LLVMException("Invalid id '" + id + "' for floating species"); + throw LLVMException("Invalid selection '" + id + "' for setting value"); void LLVMExecutableModel::setValue(const std::string& id, double value) + throw LLVMException("invalid selection string " + id); + throw LLVMException("Invalid or non-existant sbml id '" + id + "' for set value"); + throw LLVMException(msg); + throw LLVMException("Invalid id '" + id + "' for floating amount rate"); + throw LLVMException("Invalid id '" + id + "' for floating species"); + throw LLVMException("Invalid selection '" + sel.to_string() + "' for setting value"); int LLVMExecutableModel::getFloatingSpeciesConcentrationRates(int len, diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -792,6 +792,7 @@ int LLVMExecutableModel::getFloatingSpeciesConcentrationRates(int len, LLVMExecutableModel* LLVMExecutableModel::dummy() diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -762,6 +762,12 @@ void LLVMExecutableModel::getIds(uint32_t types, std::list &ids) diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp #include "LLVMException.h" namespace rrllvm @@ -711,6 +729,65 @@ void LLVMExecutableModel::print(std::ostream &stream) +void LLVMExecutableModel::getIds(uint32_t types, std::list &ids) +uint32_t LLVMExecutableModel::getSupportedIdTypes() +double LLVMExecutableModel::getValue(const std::string& id) +void LLVMExecutableModel::setValue(const std::string& id, double value) +int LLVMExecutableModel::getFloatingSpeciesConcentrationRates(int len, LLVMExecutableModel* LLVMExecutableModel::dummy() return new LLVMExecutableModel(); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMCompiler.cpp b/source/llvm/LLVMCompiler.cpp --- a/source/llvm/LLVMCompiler.cpp +++ b/source/llvm/LLVMCompiler.cpp @@ -36,7 +36,7 @@ bool LLVMCompiler::setCompiler(const std::string& compiler) std::string LLVMCompiler::getCompilerLocation() const bool LLVMCompiler::setCompilerLocation(const std::string& path) @@ -46,7 +46,7 @@ bool LLVMCompiler::setCompilerLocation(const std::string& path) std::string LLVMCompiler::getSupportCodeFolder() const bool LLVMCompiler::setSupportCodeFolder(const std::string& path) @@ -54,24 +54,4 @@ bool LLVMCompiler::setSupportCodeFolder(const std::string& path) -std::string LLVMCompiler::gurgle() diff --git a/source/llvm/LLVMCompiler.h b/source/llvm/LLVMCompiler.h --- a/source/llvm/LLVMCompiler.h +++ b/source/llvm/LLVMCompiler.h - * All these file paths are useless to LLVM, so make some use out diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -88,7 +88,7 @@ bool LLVMModelGenerator::setTemporaryDirectory(const string& path) string LLVMModelGenerator::getTemporaryDirectory() - return LLVMCompiler::gurgle(); diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -821,7 +821,7 @@ int LLVMExecutableModel::getNumConservedSums() int LLVMExecutableModel::getConservedSumIndex(const string& name) string LLVMExecutableModel::getConservedSumId(int index) diff --git a/source/llvm/GetInitialValuesCodeGen.cpp b/source/llvm/GetInitialValuesCodeGen.cpp --- a/source/llvm/GetInitialValuesCodeGen.cpp +++ b/source/llvm/GetInitialValuesCodeGen.cpp diff --git a/source/llvm/GetInitialValuesCodeGen.h b/source/llvm/GetInitialValuesCodeGen.h --- a/source/llvm/GetInitialValuesCodeGen.h +++ b/source/llvm/GetInitialValuesCodeGen.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -140,10 +140,12 @@ LLVMExecutableModel::LLVMExecutableModel() : @@ -175,10 +177,12 @@ LLVMExecutableModel::LLVMExecutableModel( @@ -607,8 +611,13 @@ void LLVMExecutableModel::reset() @@ -1154,13 +1163,24 @@ int LLVMExecutableModel::getFloatingSpeciesInitConcentrations(int len, int LLVMExecutableModel::setFloatingSpeciesInitAmounts(int len, int const *indx, + &LLVMExecutableModel::getFloatingSpeciesId, len, indx, values); int LLVMExecutableModel::getFloatingSpeciesInitAmounts(int len, int const *indx, int LLVMExecutableModel::setCompartmentInitVolumes(int len, const int *indx, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -239,21 +239,31 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/ModelResources.h b/source/llvm/ModelResources.h --- a/source/llvm/ModelResources.h +++ b/source/llvm/ModelResources.h } /* namespace rrllvm */ diff --git a/source/llvm/SetInitialValuesCodeGen.cpp b/source/llvm/SetInitialValuesCodeGen.cpp --- a/source/llvm/SetInitialValuesCodeGen.cpp +++ b/source/llvm/SetInitialValuesCodeGen.cpp diff --git a/source/llvm/SetInitialValuesCodeGen.h b/source/llvm/SetInitialValuesCodeGen.h --- a/source/llvm/SetInitialValuesCodeGen.h +++ b/source/llvm/SetInitialValuesCodeGen.h moved get/set values to class methods in LLVMExecutableModel, improved getInfo / print so LLVMExecutableModel displays better. fixed names of LLVMModelData enum fields. @@ -96,6 +96,7 @@ if(BUILD_LLVM) llvm/LLVMExecutableModel llvm/GetRateRuleValuesCodeGen llvm/GetValuesCodeGen + llvm/GetInitialValuesCodeGen llvm/GetEventValuesCodeGen llvm/KineticLawParameterResolver llvm/LLVMModelData diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp #include "LLVMException.h" diff --git a/source/llvm/EvalInitialConditionsCodeGen.h b/source/llvm/EvalInitialConditionsCodeGen.h --- a/source/llvm/EvalInitialConditionsCodeGen.h +++ b/source/llvm/EvalInitialConditionsCodeGen.h void codeGenStoichiometry(llvm::Value *modelData, diff --git a/source/llvm/GetInitialValueCodeGenBase.h b/source/llvm/GetInitialValueCodeGenBase.h +++ b/source/llvm/GetInitialValueCodeGenBase.h +#ifndef RRLLVM_GETINITIALVALUECODEGENBASE_H_ +#define RRLLVM_GETINITIALVALUECODEGENBASE_H_ +#include "LLVMException.h" +namespace rrllvm +typedef double (*GetInitialValueCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); + llvm::Value *codeGen(); +llvm::Value* GetInitialValueCodeGenBase::codeGen() + llvm::Type *argTypes[] = { + llvm::PointerType::get(ModelDataIRBuilder::getStructType(this->module), 0), + llvm::Type::getInt32Ty(this->context) + llvm::Value *args[] = {0, 0}; + llvm::BasicBlock *entry = this->codeGenHeader(Derived::FunctionName, llvm::Type::getDoubleTy(this->context), + llvm::BasicBlock *def = llvm::BasicBlock::Create(this->context, "default", this->function); + this->builder.CreateRet(llvm::ConstantFP::get(this->context, + llvm::APFloat::getQNaN(llvm::APFloat::IEEEdouble))); + llvm::SwitchInst *s = this->builder.CreateSwitch(args[1], def, ids.size()); + llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, ids[i] + "_block", this->function); + llvm::Value *value = resolver.loadSymbolValue(ids[i]); + llvm::Value *comp = resolver.loadSymbolValue(species->getCompartment()); + llvm::Value *comp = resolver.loadSymbolValue(species->getCompartment()); + s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), i), block); +#endif /* RRLLVM_GETINITIALVALUECODEGENBASE_H_ */ diff --git a/source/llvm/GetInitialValuesCodeGen.cpp b/source/llvm/GetInitialValuesCodeGen.cpp +++ b/source/llvm/GetInitialValuesCodeGen.cpp +#include "LLVMException.h" +using namespace llvm; +namespace rrllvm diff --git a/source/llvm/GetInitialValuesCodeGen.h b/source/llvm/GetInitialValuesCodeGen.h +++ b/source/llvm/GetInitialValuesCodeGen.h +#ifndef RRLLVM_GETINITIALVALUESCODEGEN_H_ +#define RRLLVM_GETINITIALVALUESCODEGEN_H_ +namespace rrllvm +#endif /* RRLLVM_GETINITIALVALUESCODEGEN_H_ */ diff --git a/source/llvm/GetValueCodeGenBase.h b/source/llvm/GetValueCodeGenBase.h --- a/source/llvm/GetValueCodeGenBase.h +++ b/source/llvm/GetValueCodeGenBase.h @@ -76,7 +76,9 @@ llvm::Value* GetValueCodeGenBase::codeGen() llvm::BasicBlock *def = llvm::BasicBlock::Create(this->context, "default", this->function); - this->builder.CreateRet(llvm::ConstantFP::get(this->context, llvm::APFloat(123.456))); + this->builder.CreateRet(llvm::ConstantFP::get(this->context, + llvm::APFloat::getQNaN(llvm::APFloat::IEEEdouble))); diff --git a/source/llvm/GetValuesCodeGen.h b/source/llvm/GetValuesCodeGen.h --- a/source/llvm/GetValuesCodeGen.h +++ b/source/llvm/GetValuesCodeGen.h -#ifndef RRLLVMGETBOUNDARYSPECIESAMOUNTSCODEGEN_H_ -#define RRLLVMGETBOUNDARYSPECIESAMOUNTSCODEGEN_H_ +#ifndef RRLLVM_GETVALUESCODEGEN_H_ +#define RRLLVM_GETVALUESCODEGEN_H_ -#endif /* RRLLVMGETBOUNDARYSPECIESAMOUNTSCODEGEN_H_ */ +#endif /* RRLLVM_GETVALUESCODEGEN_H_ */ diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp namespace rrllvm -static int getValues(LLVMModelData* modelData, double (*funcPtr)(LLVMModelData*, int), +int LLVMExecutableModel::getValues(double (*funcPtr)(LLVMModelData*, int), + throw_llvm_exception(s.str()); -static int setValues(LLVMModelData* modelData, bool (*funcPtr)(LLVMModelData*, int, double), +int LLVMExecutableModel::setValues(bool (*funcPtr)(LLVMModelData*, int, double), + throw_llvm_exception(s.str()); LLVMExecutableModel::LLVMExecutableModel() : @@ -110,7 +141,9 @@ LLVMExecutableModel::LLVMExecutableModel() : @@ -143,13 +176,17 @@ LLVMExecutableModel::LLVMExecutableModel( LLVMExecutableModel::~LLVMExecutableModel() @@ -247,7 +284,7 @@ double LLVMExecutableModel::getFloatingSpeciesConcentration(int index) int LLVMExecutableModel::getFloatingSpeciesConcentrations(int len, int const *indx, void LLVMExecutableModel::getRateRuleValues(double *rateRuleValues) @@ -370,8 +407,6 @@ string LLVMExecutableModel::getInfo() @@ -388,22 +423,20 @@ string LLVMExecutableModel::getInfo() @@ -413,25 +446,37 @@ string LLVMExecutableModel::getInfo() @@ -559,7 +604,13 @@ void LLVMExecutableModel::reset() @@ -648,7 +699,7 @@ int LLVMExecutableModel::setStateVector(const double* stateVector) void LLVMExecutableModel::print(std::ostream &stream) stream << "LLVMExecutableModel" << endl; LLVMExecutableModel* LLVMExecutableModel::dummy() @@ -669,7 +720,7 @@ int LLVMExecutableModel::getNumRules() int LLVMExecutableModel::getFloatingSpeciesAmounts(int len, const int* indx, int LLVMExecutableModel::setFloatingSpeciesConcentrations(int len, @@ -678,7 +729,8 @@ int LLVMExecutableModel::setFloatingSpeciesConcentrations(int len, + &LLVMExecutableModel::getFloatingSpeciesId, len, indx, values); @@ -686,13 +738,13 @@ int LLVMExecutableModel::setFloatingSpeciesConcentrations(int len, int LLVMExecutableModel::getBoundarySpeciesAmounts(int len, const int* indx, int LLVMExecutableModel::getBoundarySpeciesConcentrations(int len, int LLVMExecutableModel::setBoundarySpeciesConcentrations(int len, @@ -701,7 +753,8 @@ int LLVMExecutableModel::setBoundarySpeciesConcentrations(int len, + &LLVMExecutableModel::getBoundarySpeciesId, len, indx, values); @@ -709,7 +762,7 @@ int LLVMExecutableModel::setBoundarySpeciesConcentrations(int len, int LLVMExecutableModel::getGlobalParameterValues(int len, const int* indx, int LLVMExecutableModel::setGlobalParameterValues(int len, const int* indx, @@ -718,7 +771,8 @@ int LLVMExecutableModel::setGlobalParameterValues(int len, const int* indx, + &LLVMExecutableModel::getGlobalParameterId, len, indx, values); @@ -726,7 +780,7 @@ int LLVMExecutableModel::setGlobalParameterValues(int len, const int* indx, int LLVMExecutableModel::getCompartmentVolumes(int len, const int* indx, int LLVMExecutableModel::getReactionRates(int len, const int* indx, @@ -809,7 +863,8 @@ int LLVMExecutableModel::setFloatingSpeciesAmounts(int len, int const *indx, + &LLVMExecutableModel::getFloatingSpeciesId, len, indx, values); @@ -821,7 +876,8 @@ int LLVMExecutableModel::setCompartmentVolumes(int len, const int* indx, + &LLVMExecutableModel::getCompartmentId, len, indx, values); @@ -1078,7 +1134,8 @@ int LLVMExecutableModel::setFloatingSpeciesInitConcentrations(int len, + &LLVMExecutableModel::getFloatingSpeciesId, len, indx, values); @@ -1086,36 +1143,47 @@ int LLVMExecutableModel::setFloatingSpeciesInitConcentrations(int len, int LLVMExecutableModel::getFloatingSpeciesInitConcentrations(int len, int LLVMExecutableModel::setFloatingSpeciesInitAmounts(int len, int const *indx, int LLVMExecutableModel::getFloatingSpeciesInitAmounts(int len, int const *indx, -int LLVMExecutableModel::setCompartmentInitVolumes(int len, int const *indx, +int LLVMExecutableModel::setCompartmentInitVolumes(int len, const int *indx, + &LLVMExecutableModel::getCompartmentId, len, indx, values); -int LLVMExecutableModel::getCompartmentInitVolumes(int len, int const *indx, +int LLVMExecutableModel::getCompartmentInitVolumes(int len, const int *indx, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h + typedef string (LLVMExecutableModel::*GetNameFuncPtr)(int); + int getValues(double (*funcPtr)(LLVMModelData*, int), int len, + int setValues(bool (*funcPtr)(LLVMModelData*, int, double), GetNameFuncPtr, int len, static LLVMExecutableModel* dummy(); friend class LLVMModelGenerator; diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp @@ -48,39 +48,53 @@ namespace rrllvm std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) - os << "LLVMModelData:" << endl; + os << "LLVMModelData:" << endl; diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -707,9 +713,9 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, @@ -721,6 +727,11 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -240,14 +240,20 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -389,6 +395,12 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/source/llvm/ModelInitialValueSymbolResolver.cpp --- a/source/llvm/ModelInitialValueSymbolResolver.cpp +++ b/source/llvm/ModelInitialValueSymbolResolver.cpp llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue(const std::string& symbol, const llvm::ArrayRef& args) @@ -99,6 +101,34 @@ llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue(const std::string& @@ -165,6 +195,7 @@ llvm::Value* ModelInitialValueStoreSymbolResolver::storeSymbolValue( diff --git a/source/llvm/ModelResources.h b/source/llvm/ModelResources.h --- a/source/llvm/ModelResources.h +++ b/source/llvm/ModelResources.h } /* namespace rrllvm */ diff --git a/source/llvm/SetInitialValuesCodeGen.cpp b/source/llvm/SetInitialValuesCodeGen.cpp --- a/source/llvm/SetInitialValuesCodeGen.cpp +++ b/source/llvm/SetInitialValuesCodeGen.cpp @@ -46,16 +46,16 @@ static std::vector > independentElements(const LLVM diff --git a/source/llvm/SetInitialValuesCodeGen.h b/source/llvm/SetInitialValuesCodeGen.h --- a/source/llvm/SetInitialValuesCodeGen.h +++ b/source/llvm/SetInitialValuesCodeGen.h namespace rrllvm diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp const char* compiler = "llvm"; + TestEvalModel test("llvm", pairs[testCase].first, pairs[testCase].second); diff --git a/source/llvm_testing/src/TestBase.cpp b/source/llvm_testing/src/TestBase.cpp --- a/source/llvm_testing/src/TestBase.cpp +++ b/source/llvm_testing/src/TestBase.cpp diff --git a/source/llvm_testing/src/TestEvalModel.cpp b/source/llvm_testing/src/TestEvalModel.cpp --- a/source/llvm_testing/src/TestEvalModel.cpp +++ b/source/llvm_testing/src/TestEvalModel.cpp diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -1018,9 +1018,6 @@ const LLVMModelDataSymbols::SpeciesReferenceInfo& -std::vector LLVMModelDataSymbols::getFloatingSpeciesInitIds() const uint LLVMModelDataSymbols::getFloatingSpeciesInitIndex( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -87,15 +87,6 @@ static std::vector getIds(const rrllvm::LLVMModelDataSymbols::Strin namespace rrllvm @@ -674,11 +665,11 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, @@ -757,11 +748,11 @@ void LLVMModelDataSymbols::initCompartments(const libsbml::Model *model) @@ -1063,31 +1054,10 @@ uint LLVMModelDataSymbols::getCompartmentInitIndex( -bool LLVMModelDataSymbols::isInitSymbol(const std::string& symbol) const -std::string LLVMModelDataSymbols::getInitSymbolId( - throw LLVMException(symbol + " is not an initial value sybmol"); -std::string LLVMModelDataSymbols::getInitSymbol(const std::string& id) const bool LLVMModelDataSymbols::isConservedMoiety(const std::string& symbol) const bool LLVMModelDataSymbols::isIndependentInitFloatingSpecies( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -432,7 +432,7 @@ llvm::Value* ModelDataIRBuilder::createInitFloatSpeciesAmtGEP( const std::string& id, const llvm::Twine& name) @@ -455,7 +455,7 @@ llvm::Value* ModelDataIRBuilder::createInitCompGEP(const std::string& id, const llvm::Twine& name) diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/source/llvm/ModelInitialValueSymbolResolver.cpp --- a/source/llvm/ModelInitialValueSymbolResolver.cpp +++ b/source/llvm/ModelInitialValueSymbolResolver.cpp @@ -139,8 +139,7 @@ llvm::Value* ModelInitialValueStoreSymbolResolver::storeSymbolValue( @@ -152,8 +151,7 @@ llvm::Value* ModelInitialValueStoreSymbolResolver::storeSymbolValue( diff --git a/source/llvm/SetInitialValueCodeGenBase.h b/source/llvm/SetInitialValueCodeGenBase.h --- a/source/llvm/SetInitialValueCodeGenBase.h +++ b/source/llvm/SetInitialValueCodeGenBase.h @@ -102,7 +102,7 @@ llvm::Value* SetInitialValueCodeGenBase::codeGen() llvm::Value *value = args[2]; @@ -113,9 +113,6 @@ llvm::Value* SetInitialValueCodeGenBase::codeGen() llvm::Value *comp = loadResolver.loadSymbolValue(compId); diff --git a/source/llvm/SetInitialValuesCodeGen.cpp b/source/llvm/SetInitialValuesCodeGen.cpp --- a/source/llvm/SetInitialValuesCodeGen.cpp +++ b/source/llvm/SetInitialValuesCodeGen.cpp @@ -36,7 +36,7 @@ static std::vector > independentElements(const LLVM diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -644,26 +644,13 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, @@ -684,6 +671,15 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, @@ -701,8 +697,24 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, @@ -1060,8 +1072,8 @@ std::string LLVMModelDataSymbols::getInitSymbolId( @@ -1081,6 +1093,17 @@ bool LLVMModelDataSymbols::isConservedMoiety(const std::string& symbol) const bool LLVMModelDataSymbols::isIndependentInitFloatingSpecies( +bool LLVMModelDataSymbols::isIndependentInitCompartment( bool LLVMModelDataSymbols::isIndependentInitElement( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/source/llvm/ModelInitialValueSymbolResolver.cpp --- a/source/llvm/ModelInitialValueSymbolResolver.cpp +++ b/source/llvm/ModelInitialValueSymbolResolver.cpp @@ -19,14 +19,32 @@ namespace rrllvm - const LLVMModelDataSymbols& modelDataSymbols, - const LLVMModelSymbols& modelSymbols, - llvm::IRBuilder<>& builder) : + llvm::Value *modelData, + const LLVMModelSymbols &modelSymbols, + const LLVMModelDataSymbols &modelDataSymbols, + llvm::IRBuilder<> &builder) : +ModelInitialValueStoreSymbolResolver::ModelInitialValueStoreSymbolResolver(llvm::Value *modelData, + const LLVMModelSymbols &modelSymbols, + const LLVMModelDataSymbols &modelDataSymbols, + llvm::IRBuilder<> &builder, @@ -102,6 +120,64 @@ llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue(const std::string& +llvm::Value* ModelInitialValueStoreSymbolResolver::storeSymbolValue( + const std::string& symbol, llvm::Value *value) + throw_llvm_exception(msg); diff --git a/source/llvm/ModelInitialValueSymbolResolver.h b/source/llvm/ModelInitialValueSymbolResolver.h --- a/source/llvm/ModelInitialValueSymbolResolver.h +++ b/source/llvm/ModelInitialValueSymbolResolver.h @@ -22,14 +22,17 @@ namespace rrllvm + ModelInitialValueSymbolResolver(llvm::Value *modelData, + const libsbml::Model *model, const LLVMModelSymbols &modelSymbols, const LLVMModelDataSymbols &modelDataSymbols, - const LLVMModelSymbols &modelSymbols, llvm::IRBuilder<> &builder); + llvm::IRBuilder<> &builder); llvm::ArrayRef()); + llvm::Value *modelData; const LLVMModelDataSymbols &modelDataSymbols; const LLVMModelSymbols &modelSymbols; llvm::IRBuilder<> &builder; + ModelInitialValueStoreSymbolResolver(llvm::Value *modelData, + const libsbml::Model *model, const LLVMModelSymbols &modelSymbols, + const LLVMModelDataSymbols &modelDataSymbols, + llvm::IRBuilder<> &builder, + virtual llvm::Value *storeSymbolValue(const std::string& symbol, + llvm::Value *value); + llvm::Value *modelData; + const LLVMModelSymbols &modelSymbols; + const LLVMModelDataSymbols &modelDataSymbols; + llvm::IRBuilder<> &builder; diff --git a/source/llvm/SetInitialValueCodeGenBase.h b/source/llvm/SetInitialValueCodeGenBase.h --- a/source/llvm/SetInitialValueCodeGenBase.h +++ b/source/llvm/SetInitialValueCodeGenBase.h #include "LLVMException.h" @@ -74,10 +74,10 @@ llvm::Value* SetInitialValueCodeGenBase::codeGen() diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -87,6 +87,16 @@ static std::vector getIds(const rrllvm::LLVMModelDataSymbols::Strin namespace rrllvm @@ -735,11 +745,11 @@ void LLVMModelDataSymbols::initCompartments(const libsbml::Model *model) @@ -1012,23 +1022,56 @@ std::vector LLVMModelDataSymbols::getFloatingSpeciesInitIds() const uint LLVMModelDataSymbols::getFloatingSpeciesInitIndex( + throw LLVMException("could not find init floating species with id " + symbol); uint LLVMModelDataSymbols::getCompartmentInitIndex( + throw LLVMException("could not find init compartment with id " + symbol); bool LLVMModelDataSymbols::isInitSymbol(const std::string& symbol) const -std::string LLVMModelDataSymbols::getInitSymbolId(const std::string& symbol) const +std::string LLVMModelDataSymbols::getInitSymbolId( + throw LLVMException(symbol + " is not an initial value sybmol"); std::string LLVMModelDataSymbols::getInitSymbol(const std::string& id) const bool LLVMModelDataSymbols::isConservedMoiety(const std::string& symbol) const Added function pointers to LLVMExecutableModel for setting init conc and comp volumes. New fields to LLVMModelData to indicate length of init cond arrays. Pick out independent and dependent init conditions in LLVMModelDataSymbols. diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -108,7 +108,9 @@ LLVMExecutableModel::LLVMExecutableModel() : @@ -139,7 +141,9 @@ LLVMExecutableModel::LLVMExecutableModel( @@ -822,17 +826,7 @@ int LLVMExecutableModel::setCompartmentVolumes(int len, const int* indx, -int LLVMExecutableModel::setFloatingSpeciesInitConcentrations(int len, -int LLVMExecutableModel::getFloatingSpeciesInitConcentrations(int len, double LLVMExecutableModel::getStoichiometry(int speciesIndex, int reactionIndex) @@ -1073,5 +1067,60 @@ bool LLVMExecutableModel::getEventTieBreak(uint eventA, uint eventB) +int LLVMExecutableModel::setFloatingSpeciesInitConcentrations(int len, +int LLVMExecutableModel::getFloatingSpeciesInitConcentrations(int len, +int LLVMExecutableModel::setFloatingSpeciesInitAmounts(int len, int const *indx, +int LLVMExecutableModel::getFloatingSpeciesInitAmounts(int len, int const *indx, +int LLVMExecutableModel::setCompartmentInitVolumes(int len, int const *indx, +int LLVMExecutableModel::getCompartmentInitVolumes(int len, int const *indx, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h static LLVMExecutableModel* dummy(); diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h @@ -108,32 +108,37 @@ struct LLVMModelData @@ -144,7 +149,7 @@ struct LLVMModelData @@ -154,7 +159,7 @@ struct LLVMModelData @@ -164,8 +169,8 @@ struct LLVMModelData @@ -173,17 +178,17 @@ struct LLVMModelData @@ -197,7 +202,7 @@ struct LLVMModelData @@ -208,23 +213,23 @@ struct LLVMModelData diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -88,19 +91,27 @@ namespace rrllvm LLVMModelDataSymbols::LLVMModelDataSymbols() : LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model *model, @@ -136,7 +147,7 @@ LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model *model, @@ -704,6 +715,10 @@ void LLVMModelDataSymbols::initCompartments(const libsbml::Model *model) @@ -717,7 +732,17 @@ void LLVMModelDataSymbols::initCompartments(const libsbml::Model *model) @@ -732,8 +757,25 @@ void LLVMModelDataSymbols::initCompartments(const libsbml::Model *model) @@ -977,15 +1019,15 @@ uint LLVMModelDataSymbols::getCompartmentInitIndex( -bool LLVMModelDataSymbols::isInitSymbol(const std::string& symbol) +bool LLVMModelDataSymbols::isInitSymbol(const std::string& symbol) const -std::string LLVMModelDataSymbols::getInitSymbolId(const std::string& symbol) +std::string LLVMModelDataSymbols::getInitSymbolId(const std::string& symbol) const -std::string LLVMModelDataSymbols::createInitSymbol(const std::string& id) +std::string LLVMModelDataSymbols::getInitSymbol(const std::string& id) const @@ -993,12 +1035,43 @@ bool LLVMModelDataSymbols::isConservedMoiety(const std::string& symbol) const -bool LLVMModelDataSymbols::isIndependentFloatingSpeciesInit( +bool LLVMModelDataSymbols::isIndependentInitFloatingSpecies( +bool LLVMModelDataSymbols::isIndependentInitElement( +bool LLVMModelDataSymbols::hasInitialAssignmentRule(const std::string& id) const +uint LLVMModelDataSymbols::getInitCompartmentSize() const +uint LLVMModelDataSymbols::getInitFloatingSpeciesSize() const +uint LLVMModelDataSymbols::getInitBoundarySpeciesSize() const +uint LLVMModelDataSymbols::getInitGlobalParameterSize() const diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -237,6 +237,19 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -337,24 +350,35 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) uint modelDataBaseSize = sizeof(LLVMModelData); LLVMModelData *modelData = (LLVMModelData*)calloc( @@ -375,26 +399,26 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -428,49 +428,49 @@ llvm::Value* ModelDataIRBuilder::createGlobalParamStore( -llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtInitGEP( +llvm::Value* ModelDataIRBuilder::createInitFloatSpeciesAmtGEP( const std::string& id, const llvm::Twine& name) -llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtInitLoad( +llvm::Value* ModelDataIRBuilder::createInitFloatSpeciesAmtLoad( const std::string& id, const llvm::Twine& name) -llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtInitStore( +llvm::Value* ModelDataIRBuilder::createInitFloatSpeciesAmtStore( const std::string& id, llvm::Value* value) -llvm::Value* ModelDataIRBuilder::createCompInitGEP(const std::string& id, +llvm::Value* ModelDataIRBuilder::createInitCompGEP(const std::string& id, const llvm::Twine& name) -llvm::Value* ModelDataIRBuilder::createCompInitLoad(const std::string& id, +llvm::Value* ModelDataIRBuilder::createInitCompLoad(const std::string& id, const llvm::Twine& name) -llvm::Value* ModelDataIRBuilder::createCompInitStore(const std::string& id, +llvm::Value* ModelDataIRBuilder::createInitCompStore(const std::string& id, llvm::Value* value) @@ -547,6 +547,11 @@ llvm::StructType *ModelDataIRBuilder::createModelDataStructType(llvm::Module *mo @@ -572,45 +577,52 @@ llvm::StructType *ModelDataIRBuilder::createModelDataStructType(llvm::Module *mo diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h - llvm::Value *createFloatSpeciesAmtInitGEP(const std::string& id, + llvm::Value *createInitFloatSpeciesAmtGEP(const std::string& id, const llvm::Twine &name = ""); - llvm::Value *createFloatSpeciesAmtInitLoad(const std::string& id, + llvm::Value *createInitFloatSpeciesAmtLoad(const std::string& id, const llvm::Twine& name =""); - llvm::Value *createFloatSpeciesAmtInitStore(const std::string &id, + llvm::Value *createInitFloatSpeciesAmtStore(const std::string &id, llvm::Value *value); - llvm::Value* createCompInitGEP(const std::string& id, + llvm::Value* createInitCompGEP(const std::string& id, const llvm::Twine &name = ""); - llvm::Value *createCompInitLoad(const std::string& id, + llvm::Value *createInitCompLoad(const std::string& id, const llvm::Twine& name =""); - llvm::Value *createCompInitStore(const std::string &id, + llvm::Value *createInitCompStore(const std::string &id, llvm::Value *value); diff --git a/source/llvm/ModelResources.h b/source/llvm/ModelResources.h --- a/source/llvm/ModelResources.h +++ b/source/llvm/ModelResources.h } /* namespace rrllvm */ diff --git a/source/llvm/SetInitialValueCodeGenBase.h b/source/llvm/SetInitialValueCodeGenBase.h --- a/source/llvm/SetInitialValueCodeGenBase.h +++ b/source/llvm/SetInitialValueCodeGenBase.h @@ -102,7 +102,7 @@ llvm::Value* SetInitialValueCodeGenBase::codeGen() llvm::Value *value = args[2]; - std::string element = isInit ? LLVMModelDataSymbols::getInitSymbolId(ids[i].second) : ids[i].second; @@ -114,7 +114,7 @@ llvm::Value* SetInitialValueCodeGenBase::codeGen() - compId = LLVMModelDataSymbols::createInitSymbol(compId); llvm::Value *comp = loadResolver.loadSymbolValue(compId); diff --git a/source/llvm/SetInitialValuesCodeGen.cpp b/source/llvm/SetInitialValuesCodeGen.cpp --- a/source/llvm/SetInitialValuesCodeGen.cpp +++ b/source/llvm/SetInitialValuesCodeGen.cpp @@ -34,9 +34,9 @@ static std::vector > independentElements(const LLVM @@ -46,21 +46,38 @@ static std::vector > independentElements(const LLVM diff --git a/source/llvm/SetInitialValuesCodeGen.h b/source/llvm/SetInitialValuesCodeGen.h --- a/source/llvm/SetInitialValuesCodeGen.h +++ b/source/llvm/SetInitialValuesCodeGen.h namespace rrllvm - * here only for compatability, does nothing in LLVM. + * here only for compatability, does nothing in LLVM. diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -88,7 +88,6 @@ namespace rrllvm LLVMModelDataSymbols::LLVMModelDataSymbols() : @@ -98,7 +97,6 @@ LLVMModelDataSymbols::LLVMModelDataSymbols() : LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model *model, @@ -130,6 +128,18 @@ LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model *model, @@ -612,10 +622,26 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, @@ -665,9 +691,6 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, @@ -940,6 +963,41 @@ const LLVMModelDataSymbols::SpeciesReferenceInfo& +std::vector LLVMModelDataSymbols::getFloatingSpeciesInitIds() const +uint LLVMModelDataSymbols::getFloatingSpeciesInitIndex( +uint LLVMModelDataSymbols::getCompartmentInitIndex( +bool LLVMModelDataSymbols::isInitSymbol(const std::string& symbol) +std::string LLVMModelDataSymbols::getInitSymbolId(const std::string& symbol) +std::string LLVMModelDataSymbols::createInitSymbol(const std::string& id) +bool LLVMModelDataSymbols::isConservedMoiety(const std::string& symbol) const +bool LLVMModelDataSymbols::isIndependentFloatingSpeciesInit( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -428,38 +428,50 @@ llvm::Value* ModelDataIRBuilder::createGlobalParamStore( -llvm::Value* ModelDataIRBuilder::createFlotSpeciesAmtInitGEP( +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtInitGEP( const std::string& id, const llvm::Twine& name) -llvm::Value* ModelDataIRBuilder::createFlotSpeciesAmtInitLoad( +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtInitLoad( const std::string& id, const llvm::Twine& name) -llvm::Value* ModelDataIRBuilder::createFlotSpeciesAmtInitStore( +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtInitStore( const std::string& id, llvm::Value* value) llvm::Value* ModelDataIRBuilder::createCompInitGEP(const std::string& id, const llvm::Twine& name) llvm::Value* ModelDataIRBuilder::createCompInitLoad(const std::string& id, const llvm::Twine& name) llvm::Value* ModelDataIRBuilder::createCompInitStore(const std::string& id, llvm::Value* value) llvm::Value* ModelDataIRBuilder::createReactionRateLoad(const std::string& id, const llvm::Twine& name) diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h - llvm::Value *createFlotSpeciesAmtInitGEP(const std::string& id, + llvm::Value *createFloatSpeciesAmtInitGEP(const std::string& id, const llvm::Twine &name = ""); - llvm::Value *createFlotSpeciesAmtInitLoad(const std::string& id, + llvm::Value *createFloatSpeciesAmtInitLoad(const std::string& id, const llvm::Twine& name =""); - llvm::Value *createFlotSpeciesAmtInitStore(const std::string &id, + llvm::Value *createFloatSpeciesAmtInitStore(const std::string &id, llvm::Value *value); diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -241,31 +241,8 @@ llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtGEP( - LLVMContext &context = builder.getContext(); llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtLoad( @@ -451,6 +428,40 @@ llvm::Value* ModelDataIRBuilder::createGlobalParamStore( +llvm::Value* ModelDataIRBuilder::createFlotSpeciesAmtInitGEP( + const std::string& id, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createFlotSpeciesAmtInitLoad( + const std::string& id, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createFlotSpeciesAmtInitStore( + const std::string& id, llvm::Value* value) +llvm::Value* ModelDataIRBuilder::createCompInitGEP(const std::string& id, + const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createCompInitLoad(const std::string& id, + const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createCompInitStore(const std::string& id, + llvm::Value* value) llvm::Value* ModelDataIRBuilder::createReactionRateLoad(const std::string& id, const llvm::Twine& name) @@ -1215,3 +1226,5 @@ void LLVMModelDataIRBuilderTesting::test(Module *module, IRBuilder<> *build, diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h llvm::Value *value); + llvm::Value *createFlotSpeciesAmtInitGEP(const std::string& id, + const llvm::Twine &name = ""); + llvm::Value *createFlotSpeciesAmtInitLoad(const std::string& id, + const llvm::Twine& name =""); + llvm::Value *createFlotSpeciesAmtInitStore(const std::string &id, + llvm::Value *value); + llvm::Value* createCompInitGEP(const std::string& id, + const llvm::Twine &name = ""); + llvm::Value *createCompInitLoad(const std::string& id, + const llvm::Twine& name =""); + llvm::Value *createCompInitStore(const std::string &id, + llvm::Value *value); llvm::Value *createGlobalParamLoad(const std::string& id, const llvm::Twine& name = ""); llvm::Value *createGlobalParamStore(const std::string &id, llvm::Value *value); diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h @@ -169,24 +169,21 @@ struct LLVMModelData @@ -194,26 +191,40 @@ struct LLVMModelData - * Only used in the LLVM version. diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -378,9 +378,6 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) @@ -399,11 +396,14 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) "LLVMModelData size not equal to base size + data"); diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp const LLVMModelDataSymbols &symbols, @@ -51,7 +98,7 @@ llvm::Value* ModelDataIRBuilder::createGlobalParamGEP(const std::string& id) @@ -66,10 +113,27 @@ llvm::Value* ModelDataIRBuilder::createGEP(ModelDataFields field, llvm::Value* ModelDataIRBuilder::createGEP(ModelDataFields field, - Twine fieldName = LLVMModelDataSymbols::getFieldName(field); + Twine fieldName = LLVMModelDataSymbols::getFieldName(field); + LLVMContext &context = builder.getContext(); @@ -176,8 +240,32 @@ llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtGEP( + LLVMContext &context = builder.getContext(); llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtLoad( @@ -322,7 +410,7 @@ llvm::Value* ModelDataIRBuilder::createCompGEP(const std::string& id, @@ -345,14 +433,14 @@ llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtGEP( llvm::Value* ModelDataIRBuilder::createGlobalParamLoad( const std::string& id, const llvm::Twine& name) @@ -360,19 +448,19 @@ llvm::Value* ModelDataIRBuilder::createGlobalParamStore( const std::string& id, llvm::Value* value) llvm::Value* ModelDataIRBuilder::createReactionRateLoad(const std::string& id, const llvm::Twine& name) llvm::Value* ModelDataIRBuilder::createReactionRateStore(const std::string& id, llvm::Value* value) llvm::Value* ModelDataIRBuilder::createStoichiometryStore(uint row, uint col, @@ -468,33 +556,38 @@ llvm::StructType *ModelDataIRBuilder::createModelDataStructType(llvm::Module *mo @@ -749,26 +842,6 @@ llvm::Function* LLVMModelDataIRBuilderTesting::getDispIntDecl(llvm::Module* modu -llvm::Value* LLVMModelDataIRBuilderTesting::createFloatSpeciesConcGEP(const std::string& id) -llvm::Value* LLVMModelDataIRBuilderTesting::createFloatSpeciesConcStore(const string& id, Value *conc) diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h void test(llvm::Module *module, llvm::IRBuilder<> *build, llvm::ExecutionEngine * engine); - llvm::Value *createFloatSpeciesConcGEP(const std::string &id); - llvm::Value *createFloatSpeciesConcStore(const std::string &id, - llvm::Value *value); static llvm::Function *getDispIntDecl(llvm::Module *module); llvm::CallInst *createDispInt(llvm::Value *intVal); @@ -108,6 +108,7 @@ if(BUILD_LLVM) llvm/LLVMModelSymbols llvm/SetRateRuleValuesCodeGen llvm/SetValuesCodeGen + llvm/SetInitialValuesCodeGen llvm/SBMLSupportFunctions llvm/EvalVolatileStoichCodeGen llvm/SBMLInitialValueSymbolResolver diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelInitialValueSymbolResolver.h b/source/llvm/ModelInitialValueSymbolResolver.h --- a/source/llvm/ModelInitialValueSymbolResolver.h +++ b/source/llvm/ModelInitialValueSymbolResolver.h #include "LLVMIncludes.h" diff --git a/source/llvm/SBMLInitialValueSymbolResolver.h b/source/llvm/SBMLInitialValueSymbolResolver.h --- a/source/llvm/SBMLInitialValueSymbolResolver.h +++ b/source/llvm/SBMLInitialValueSymbolResolver.h #include "LLVMIncludes.h" diff --git a/source/llvm/SetInitialValueCodeGenBase.h b/source/llvm/SetInitialValueCodeGenBase.h +++ b/source/llvm/SetInitialValueCodeGenBase.h +#include "LLVMException.h" +namespace rrllvm +typedef bool (*SetInitialValueCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t, double); + llvm::Value *codeGen(); +llvm::Value* SetInitialValueCodeGenBase::codeGen() + llvm::Type *argTypes[] = { + llvm::PointerType::get(ModelDataIRBuilder::getStructType(this->module), 0), + llvm::Type::getInt32Ty(this->context), + llvm::Type::getDoubleTy(this->context) + llvm::Value *args[] = {0, 0, 0}; + llvm::BasicBlock *entry = this->codeGenHeader(Derived::FunctionName, llvm::Type::getInt8Ty(this->context), + llvm::BasicBlock *def = llvm::BasicBlock::Create(this->context, "default", this->function); + this->builder.CreateRet(llvm::ConstantInt::get(llvm::Type::getInt8Ty(this->context), 0)); + llvm::SwitchInst *s = this->builder.CreateSwitch(args[1], def, ids.size()); + llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, ids[i].second + "_block", this->function); + llvm::Value *value = args[2]; + std::string element = isInit ? LLVMModelDataSymbols::getInitSymbolId(ids[i].second) : ids[i].second; + compId = LLVMModelDataSymbols::createInitSymbol(compId); + llvm::Value *comp = loadResolver.loadSymbolValue(compId); + this->builder.CreateRet(llvm::ConstantInt::get(llvm::Type::getInt8Ty(this->context), 1)); + s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), ids[i].first), block); +} /* namespace rrllvm */ diff --git a/source/llvm/SetInitialValuesCodeGen.cpp b/source/llvm/SetInitialValuesCodeGen.cpp +++ b/source/llvm/SetInitialValuesCodeGen.cpp +#include "LLVMException.h" +using namespace llvm; +namespace rrllvm +static std::vector > independentElements(const LLVMModelDataSymbols &dataSymbols, diff --git a/source/llvm/SetInitialValuesCodeGen.h b/source/llvm/SetInitialValuesCodeGen.h +++ b/source/llvm/SetInitialValuesCodeGen.h +#ifndef RRLLVMSETINITIALVALUESCODEGEN_H_ +#define RRLLVMSETINITIALVALUESCODEGEN_H_ +namespace rrllvm +} /* namespace rrllvm */ +#endif /* RRLLVMSETINITIALVALUESCODEGEN_H_ */ diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h class LLVMModelDataSymbols diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -152,7 +152,7 @@ LLVMExecutableModel::~LLVMExecutableModel() - LLVMModelData::free(modelData); + LLVMModelData_free(modelData); diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp @@ -46,13 +46,6 @@ namespace rrllvm -void LLVMModelData::init(LLVMModelData &data) - memset(&data, 0, sizeof(LLVMModelData)); std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) os << "LLVMModelData:" << endl; @@ -91,7 +84,7 @@ std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) -void LLVMModelData::free(LLVMModelData *data) +void LLVMModelData_free(LLVMModelData *data) diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h @@ -73,6 +73,13 @@ struct LLVMModelData @@ -81,52 +88,52 @@ struct LLVMModelData @@ -137,7 +144,7 @@ struct LLVMModelData @@ -147,7 +154,7 @@ struct LLVMModelData @@ -157,24 +164,29 @@ struct LLVMModelData @@ -184,21 +196,32 @@ struct LLVMModelData * Only used in the LLVM version. - static void init(LLVMModelData&); - static void free(LLVMModelData*); +void LLVMModelData_free(LLVMModelData*); diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -214,6 +216,10 @@ uint LLVMModelDataSymbols::getBoundarySpeciesSize() const +uint LLVMModelDataSymbols::getConservedSpeciesSize() const uint LLVMModelDataSymbols::getGlobalParameterIndex( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -256,7 +256,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, s << "LLVM Model Data size " << llvmsize << " is different from " << "C++ size of LLVM ModelData, " << modelData->size; - LLVMModelData::free(modelData); + LLVMModelData_free(modelData); @@ -340,6 +340,7 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) @@ -353,7 +354,7 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) LLVMModelData *modelData = (LLVMModelData*)calloc( @@ -362,6 +363,7 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) @@ -382,6 +384,9 @@ LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -432,6 +432,7 @@ llvm::StructType *ModelDataIRBuilder::createModelDataStructType(llvm::Module *mo @@ -455,42 +456,45 @@ llvm::StructType *ModelDataIRBuilder::createModelDataStructType(llvm::Module *mo diff --git a/source/llvm_testing/src/tests.cpp b/source/llvm_testing/src/tests.cpp --- a/source/llvm_testing/src/tests.cpp +++ b/source/llvm_testing/src/tests.cpp - LLVMModelData::free(md); + LLVMModelData_free(md); @@ -97,11 +97,11 @@ if(BUILD_LLVM) llvm/GetRateRuleValuesCodeGen llvm/GetValuesCodeGen llvm/GetEventValuesCodeGen - llvm/InitialValueSymbolResolver llvm/KineticLawParameterResolver llvm/LLVMModelData llvm/ModelDataIRBuilder llvm/ModelDataSymbolResolver + llvm/ModelInitialValueSymbolResolver llvm/LLVMModelDataSymbols llvm/LLVMModelGenerator llvm/ModelGeneratorContext @@ -110,6 +110,7 @@ if(BUILD_LLVM) llvm/SetValuesCodeGen llvm/SBMLSupportFunctions llvm/EvalVolatileStoichCodeGen + llvm/SBMLInitialValueSymbolResolver endif(BUILD_LLVM) diff --git a/source/llvm/CodeGen.h b/source/llvm/CodeGen.h --- a/source/llvm/CodeGen.h +++ b/source/llvm/CodeGen.h virtual llvm::Value *storeSymbolValue(const std::string& symbol, llvm::Value *value) = 0; diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp #include "LLVMException.h" diff --git a/source/llvm/EvalInitialConditionsCodeGen.h b/source/llvm/EvalInitialConditionsCodeGen.h --- a/source/llvm/EvalInitialConditionsCodeGen.h +++ b/source/llvm/EvalInitialConditionsCodeGen.h diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp @@ -57,8 +57,13 @@ LLVMModelSymbols::LLVMModelSymbols(const libsbml::Model *m, LLVMModelDataSymbols LLVMModelSymbols::~LLVMModelSymbols() @@ -103,6 +108,7 @@ bool LLVMModelSymbols::visit(const libsbml::InitialAssignment& x) @@ -571,6 +577,11 @@ const SymbolForest& LLVMModelSymbols::getRateRules() const +const SymbolForest& LLVMModelSymbols::getInitialAssignmentRules() const diff --git a/source/llvm/LLVMModelSymbols.h b/source/llvm/LLVMModelSymbols.h --- a/source/llvm/LLVMModelSymbols.h +++ b/source/llvm/LLVMModelSymbols.h diff --git a/source/llvm/ModelInitialValueSymbolResolver.cpp b/source/llvm/ModelInitialValueSymbolResolver.cpp +++ b/source/llvm/ModelInitialValueSymbolResolver.cpp +#include "LLVMException.h" +using namespace llvm; +namespace rrllvm + const LLVMModelDataSymbols& modelDataSymbols, + const LLVMModelSymbols& modelSymbols, + llvm::IRBuilder<>& builder) : +llvm::Value* ModelInitialValueSymbolResolver::loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args) + throw_llvm_exception(msg); diff --git a/source/llvm/ModelInitialValueSymbolResolver.h b/source/llvm/ModelInitialValueSymbolResolver.h +++ b/source/llvm/ModelInitialValueSymbolResolver.h +#include "LLVMIncludes.h" +#include "LLVMModelDataSymbols.h" +#include "LLVMModelSymbols.h" +namespace rrllvm + const LLVMModelDataSymbols &modelDataSymbols, + const LLVMModelSymbols &modelSymbols, llvm::IRBuilder<> &builder); + virtual llvm::Value *loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args = + llvm::ArrayRef()); + const LLVMModelDataSymbols &modelDataSymbols; + const LLVMModelSymbols &modelSymbols; + llvm::IRBuilder<> &builder; diff --git a/source/llvm/InitialValueSymbolResolver.cpp b/source/llvm/SBMLInitialValueSymbolResolver.cpp rename from source/llvm/InitialValueSymbolResolver.cpp rename to source/llvm/SBMLInitialValueSymbolResolver.cpp --- a/source/llvm/InitialValueSymbolResolver.cpp +++ b/source/llvm/SBMLInitialValueSymbolResolver.cpp #include "LLVMException.h" @@ -18,7 +18,7 @@ using namespace llvm; namespace rrllvm const LLVMModelDataSymbols& modelDataSymbols, const LLVMModelSymbols& modelSymbols, -llvm::Value* InitialValueSymbolResolver::loadSymbolValue(const std::string& symbol, +llvm::Value* SBMLInitialValueSymbolResolver::loadSymbolValue(const std::string& symbol, const llvm::ArrayRef& args) diff --git a/source/llvm/InitialValueSymbolResolver.h b/source/llvm/SBMLInitialValueSymbolResolver.h rename from source/llvm/InitialValueSymbolResolver.h rename to source/llvm/SBMLInitialValueSymbolResolver.h --- a/source/llvm/InitialValueSymbolResolver.h +++ b/source/llvm/SBMLInitialValueSymbolResolver.h namespace rrllvm const LLVMModelDataSymbols &modelDataSymbols, const LLVMModelSymbols &modelSymbols, llvm::IRBuilder<> &builder); virtual llvm::Value *loadSymbolValue(const std::string& symbol, const llvm::ArrayRef& args = diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -178,12 +178,12 @@ double LLVMExecutableModel::getTime() -int LLVMExecutableModel::getNumIndependentSpecies() +int LLVMExecutableModel::getNumIndFloatingSpecies() -int LLVMExecutableModel::getNumDependentSpecies() +int LLVMExecutableModel::getNumDepFloatingSpecies() diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMIncludes.h b/source/llvm/LLVMIncludes.h --- a/source/llvm/LLVMIncludes.h +++ b/source/llvm/LLVMIncludes.h #if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 3) #include #include #include #include diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h namespace rrllvm -struct LLVMModelData; @@ -194,6 +197,10 @@ struct LLVMModelData static void free(LLVMModelData*); std::ostream& operator <<(std::ostream& os, const LLVMModelData& data); diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp - cout << "RoadRunner LLVM SBML Test Suite" << endl; + //cout << "RoadRunner LLVM SBML Test Suite" << endl; const char* compiler = "llvm"; Changes llvm model data struct to be dynamically defined for each model and allocated as a single memory block. diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -86,6 +86,7 @@ static int setValues(LLVMModelData* modelData, bool (*funcPtr)(LLVMModelData*, i LLVMExecutableModel::LLVMExecutableModel() : @@ -109,18 +110,14 @@ LLVMExecutableModel::LLVMExecutableModel() : - LLVMModelData::init(modelData); LLVMExecutableModel::LLVMExecutableModel( + const std::tr1::shared_ptr& rc, LLVMModelData* modelData) : @@ -144,21 +141,18 @@ LLVMExecutableModel::LLVMExecutableModel( - LLVMModelData::init(modelData); LLVMExecutableModel::~LLVMExecutableModel() - LLVMModelData::freeBuffers(modelData); + LLVMModelData::free(modelData); @@ -170,22 +164,22 @@ string LLVMExecutableModel::getModelName() void LLVMExecutableModel::setTime(double time) double LLVMExecutableModel::getTime() -int LLVMExecutableModel::getNumIndependentSpecies() +int LLVMExecutableModel::getNumIndependentFloatingSpecies() -int LLVMExecutableModel::getNumDependentSpecies() +int LLVMExecutableModel::getNumDependentFloatingSpecies() int LLVMExecutableModel::getNumFloatingSpecies() @@ -210,7 +204,7 @@ int LLVMExecutableModel::getNumCompartments() int LLVMExecutableModel::getNumReactions() int LLVMExecutableModel::getNumLocalParameters(int reactionId) @@ -229,11 +223,11 @@ void LLVMExecutableModel::computeConservedTotals() double LLVMExecutableModel::getFloatingSpeciesConcentration(int index) @@ -247,17 +241,17 @@ double LLVMExecutableModel::getFloatingSpeciesConcentration(int index) int LLVMExecutableModel::getFloatingSpeciesConcentrations(int len, int const *indx, void LLVMExecutableModel::getRateRuleValues(double *rateRuleValues) void LLVMExecutableModel::setRateRuleValues(const double *rateRuleValues) void LLVMExecutableModel::convertToConcentrations() @@ -274,40 +268,40 @@ void LLVMExecutableModel::computeAllRatesOfChange() void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) @@ -317,26 +311,26 @@ void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) @@ -347,13 +341,13 @@ void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) @@ -552,7 +546,7 @@ string LLVMExecutableModel::getReactionId(int id) void LLVMExecutableModel::evalInitialConditions() void LLVMExecutableModel::reset() @@ -583,15 +577,15 @@ int LLVMExecutableModel::getStateVector(double* stateVector) @@ -602,13 +596,13 @@ int LLVMExecutableModel::getStateVector(double* stateVector) int LLVMExecutableModel::setStateVector(const double* stateVector) @@ -618,13 +612,13 @@ int LLVMExecutableModel::setStateVector(const double* stateVector) @@ -635,14 +629,14 @@ int LLVMExecutableModel::setStateVector(const double* stateVector) void LLVMExecutableModel::print(std::ostream &stream) @@ -658,7 +652,7 @@ LLVMExecutableModel* LLVMExecutableModel::dummy() void LLVMExecutableModel::evalReactionRates() int LLVMExecutableModel::getNumRules() @@ -669,7 +663,7 @@ int LLVMExecutableModel::getNumRules() int LLVMExecutableModel::getFloatingSpeciesAmounts(int len, const int* indx, int LLVMExecutableModel::setFloatingSpeciesConcentrations(int len, @@ -678,7 +672,7 @@ int LLVMExecutableModel::setFloatingSpeciesConcentrations(int len, @@ -686,13 +680,13 @@ int LLVMExecutableModel::setFloatingSpeciesConcentrations(int len, int LLVMExecutableModel::getBoundarySpeciesAmounts(int len, const int* indx, int LLVMExecutableModel::getBoundarySpeciesConcentrations(int len, int LLVMExecutableModel::setBoundarySpeciesConcentrations(int len, @@ -701,7 +695,7 @@ int LLVMExecutableModel::setBoundarySpeciesConcentrations(int len, @@ -709,7 +703,7 @@ int LLVMExecutableModel::setBoundarySpeciesConcentrations(int len, int LLVMExecutableModel::getGlobalParameterValues(int len, const int* indx, int LLVMExecutableModel::setGlobalParameterValues(int len, const int* indx, @@ -718,7 +712,7 @@ int LLVMExecutableModel::setGlobalParameterValues(int len, const int* indx, @@ -726,7 +720,7 @@ int LLVMExecutableModel::setGlobalParameterValues(int len, const int* indx, int LLVMExecutableModel::getCompartmentVolumes(int len, const int* indx, int LLVMExecutableModel::getReactionRates(int len, const int* indx, @@ -739,9 +733,9 @@ int LLVMExecutableModel::getReactionRates(int len, const int* indx, @@ -781,20 +775,20 @@ int LLVMExecutableModel::setConservedSums(int len, const int* indx, int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, @@ -809,7 +803,7 @@ int LLVMExecutableModel::setFloatingSpeciesAmounts(int len, int const *indx, @@ -821,7 +815,7 @@ int LLVMExecutableModel::setCompartmentVolumes(int len, const int* indx, @@ -840,7 +834,7 @@ int LLVMExecutableModel::getFloatingSpeciesInitConcentrations(int len, double LLVMExecutableModel::getStoichiometry(int speciesIndex, int reactionIndex) @@ -849,11 +843,11 @@ int LLVMExecutableModel::getStoichiometryMatrix(int* pRows, int* pCols, @@ -883,21 +877,21 @@ int LLVMExecutableModel::getStoichiometryMatrix(int* pRows, int* pCols, int LLVMExecutableModel::getNumEvents() int LLVMExecutableModel::getEventTriggers(int len, const int *indx, unsigned char *values) @@ -914,13 +908,13 @@ void LLVMExecutableModel::evalEvents(double timeEnd, @@ -946,11 +940,11 @@ int LLVMExecutableModel::applyPendingEvents(const double *stateVector, @@ -971,34 +965,34 @@ int LLVMExecutableModel::applyPendingEvents(const double *stateVector, void LLVMExecutableModel::evalEventRoots(double time, const double* y, double* gdot) @@ -1020,7 +1014,7 @@ void LLVMExecutableModel::resetEvents() bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h LLVMExecutableModel(); - LLVMExecutableModel(const std::tr1::shared_ptr &resources); + * takes ownership of the LLVMModelData pointer. + LLVMExecutableModel(const std::tr1::shared_ptr &resources, + LLVMModelData* modelData); virtual ~LLVMExecutableModel(); - LLVMModelData modelData; + LLVMModelData *modelData; const LLVMModelDataSymbols *symbols; diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp @@ -59,33 +59,31 @@ std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) @@ -93,17 +91,13 @@ std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) -void LLVMModelData::freeBuffers(LLVMModelData &data) +void LLVMModelData::free(LLVMModelData *data) diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h @@ -56,25 +56,40 @@ struct LLVMModelData @@ -82,43 +97,46 @@ struct LLVMModelData - * Only used in the LLVM version. - * In the LLVM version, this is just a pointer to a data block @@ -126,62 +144,58 @@ struct LLVMModelData + * Only used in the LLVM version. static void init(LLVMModelData&); - static void freeBuffers(LLVMModelData&); + static void free(LLVMModelData*); std::ostream& operator <<(std::ostream& os, const LLVMModelData& data); diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -217,44 +229,56 @@ uint LLVMModelDataSymbols::getGlobalParameterIndex( void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const LLVMModelData::init(m); +const std::vector& LLVMModelDataSymbols::getStoichRowIndx() const +const std::vector& LLVMModelDataSymbols::getStoichColIndx() const std::vector LLVMModelDataSymbols::getCompartmentIds() const @@ -398,7 +422,7 @@ bool LLVMModelDataSymbols::isIndependentCompartment(const std::string& id) const const char* LLVMModelDataSymbols::getFieldName(ModelDataFields field) diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h - void initAllocModelDataBuffers(LLVMModelData& m) const; + //void initAllocModelDataBuffers(LLVMModelData& m) const; diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -144,7 +146,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, - return new LLVMExecutableModel(sp); + return new LLVMExecutableModel(sp, createModelData(*sp->symbols)); @@ -242,6 +244,25 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, + LLVMModelData *modelData = createModelData(context.getModelDataSymbols()); + uint llvmsize = ModelDataIRBuilder::getModelDataSize(context.getModule(), + if (llvmsize != modelData->size) + s << "LLVM Model Data size " << llvmsize << " is different from " << + "C++ size of LLVM ModelData, " << modelData->size; + LLVMModelData::free(modelData); + throw_llvm_exception(s.str()); @@ -286,7 +307,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, - return new LLVMExecutableModel(rc); + return new LLVMExecutableModel(rc, modelData); Compiler* LLVMModelGenerator::getCompiler() @@ -312,6 +333,87 @@ std::string to_string(const llvm::Value *value) +LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols) + uint modelDataBaseSize = sizeof(LLVMModelData); + LLVMModelData *modelData = (LLVMModelData*)calloc( + "LLVMModelData size not equal to base size + data"); +} /* namespace rrllvm */ diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -51,7 +51,7 @@ llvm::Value* ModelDataIRBuilder::createGlobalParamGEP(const std::string& id) @@ -176,7 +176,7 @@ llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtGEP( @@ -253,7 +253,7 @@ llvm::Value* ModelDataIRBuilder::createRateRuleValueGEP(const std::string& id, @@ -322,7 +322,7 @@ llvm::Value* ModelDataIRBuilder::createCompGEP(const std::string& id, @@ -345,14 +345,14 @@ llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtGEP( llvm::Value* ModelDataIRBuilder::createGlobalParamLoad( const std::string& id, const llvm::Twine& name) @@ -360,19 +360,19 @@ llvm::Value* ModelDataIRBuilder::createGlobalParamStore( const std::string& id, llvm::Value* value) llvm::Value* ModelDataIRBuilder::createReactionRateLoad(const std::string& id, const llvm::Twine& name) llvm::Value* ModelDataIRBuilder::createReactionRateStore(const std::string& id, llvm::Value* value) llvm::Value* ModelDataIRBuilder::createStoichiometryStore(uint row, uint col, @@ -422,83 +422,133 @@ void ModelDataIRBuilder::validateStruct(llvm::Value* s, throw LLVMException(err.str()); -llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module, llvm::ExecutionEngine *engine) +llvm::StructType *ModelDataIRBuilder::createModelDataStructType(llvm::Module *module, + llvm::ExecutionEngine *engine, LLVMModelDataSymbols const& symbols) StructType *structType = module->getTypeByName(LLVMModelDataName); LLVMContext &context = module->getContext(); + // the code in llvm 3.3 does this. structType = StructType::create(context, elements, LLVMModelDataName); + assert(module->getTypeByName(LLVMModelDataName) && + "Could not get LLVMModelData struct from llvm module after createing it"); +llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module) + StructType *structType = module->getTypeByName(LLVMModelDataName); + throw_llvm_exception("Could not get LLVMModelData struct type from llvm Module, " +unsigned ModelDataIRBuilder::getModelDataSize(llvm::Module *module, llvm::ExecutionEngine *engine) #if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 2) - size_t llvm_size = dl->getTypeStoreSize(structType); + size_t llvm_size = dl->getTypeStoreSize(structType); - size_t llvm_size = td->getTypeStoreSize(structType); + size_t llvm_size = td->getTypeStoreSize(structType); - if (sizeof(LLVMModelData) != llvm_size) - err << "llvm rr::ModelData size " << llvm_size << - sizeof(LLVMModelData); - throw LLVMException(err.str(), __FUNC__); + return llvm_size; - printf("TestStruct size: %i, , LLVM Size: %i\n", sizeof(ModelData), llvm_size); + printf("TestStruct size: %i, , LLVM Size: %i\n", sizeof(ModelData), llvm_size); - printf("C++ bool size: %i, LLVM bool size: %i\n", sizeof(bool), dl->getTypeStoreSize(boolType)); - printf("C++ bool* size: %i, LLVM bool* size: %i\n", sizeof(bool*), dl->getTypeStoreSize(boolPtrType)); - printf("C++ char** size: %i, LLVM char** size: %i\n", sizeof(char**), dl->getTypeStoreSize(charStarStarType)); - printf("C++ void* size: %i, LLVM void* size: %i\n", sizeof(void*), dl->getTypeStoreSize(voidPtrType)); + printf("C++ bool size: %i, LLVM bool size: %i\n", sizeof(bool), dl->getTypeStoreSize(boolType)); + printf("C++ bool* size: %i, LLVM bool* size: %i\n", sizeof(bool*), dl->getTypeStoreSize(boolPtrType)); + printf("C++ char** size: %i, LLVM char** size: %i\n", sizeof(char**), dl->getTypeStoreSize(charStarStarType)); + printf("C++ void* size: %i, LLVM void* size: %i\n", sizeof(void*), dl->getTypeStoreSize(voidPtrType)); diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h llvm::ExecutionEngine *engine = 0); + * llvm Module. + static llvm::StructType *createModelDataStructType(llvm::Module *module, + llvm::ExecutionEngine *engine, LLVMModelDataSymbols const& symbols); - static llvm::StructType *getStructType(llvm::Module *module, - llvm::ExecutionEngine *engine = 0); + static llvm::StructType *getStructType(llvm::Module *module); + static unsigned getModelDataSize(llvm::Module *module, llvm::ExecutionEngine *engine); static const char* LLVMModelDataName; diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h llvm::IRBuilder<> *builder; +LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols); diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp const char* compiler = "llvm"; diff --git a/source/llvm_testing/src/tests.cpp b/source/llvm_testing/src/tests.cpp --- a/source/llvm_testing/src/tests.cpp +++ b/source/llvm_testing/src/tests.cpp - LLVMModelData md = {0}; + LLVMModelData *md = 0; - LLVMModelData md; + LLVMModelData *md; - md.size = sizeof(LLVMModelData); LLVMModelDataIRBuilderTesting builder(c.getModelDataSymbols(), c.getBuilder()); int (*pfunc)(LLVMModelData*) = (int (*)(LLVMModelData*))engine.getPointerToFunction(getFunc); double (*pfunc)(LLVMModelData*) = (double (*)(LLVMModelData*))engine.getPointerToFunction(getFunc); void (*psetfunc)(LLVMModelData*,double) = (void (*)(LLVMModelData*,double))engine.getPointerToFunction(setFunc); - LLVMModelData::freeBuffers(md); + LLVMModelData::free(md); diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -594,7 +594,7 @@ int LLVMExecutableModel::getStateVector(double* stateVector) diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -753,7 +753,7 @@ llvm::Value* ASTNodeCodeGen::piecewiseCodeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp LLVMModelDataSymbols::SpeciesReferenceInfo nz = *i; diff --git a/source/llvm/EvalRateRuleRatesCodeGen.cpp b/source/llvm/EvalRateRuleRatesCodeGen.cpp --- a/source/llvm/EvalRateRuleRatesCodeGen.cpp +++ b/source/llvm/EvalRateRuleRatesCodeGen.cpp diff --git a/source/llvm/EvalVolatileStoichCodeGen.cpp b/source/llvm/EvalVolatileStoichCodeGen.cpp --- a/source/llvm/EvalVolatileStoichCodeGen.cpp +++ b/source/llvm/EvalVolatileStoichCodeGen.cpp diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp @@ -56,7 +56,7 @@ Event::Event(LLVMExecutableModel& model, uint id) : diff --git a/source/llvm/KineticLawParameterResolver.cpp b/source/llvm/KineticLawParameterResolver.cpp --- a/source/llvm/KineticLawParameterResolver.cpp +++ b/source/llvm/KineticLawParameterResolver.cpp @@ -43,7 +43,7 @@ llvm::Value* KineticLawParameterResolver::loadSymbolValue( diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -160,7 +160,7 @@ LLVMExecutableModel::~LLVMExecutableModel() LLVMModelData::freeBuffers(modelData); string LLVMExecutableModel::getModelName() @@ -237,7 +237,7 @@ double LLVMExecutableModel::getFloatingSpeciesConcentration(int index) @@ -340,9 +340,9 @@ void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) @@ -566,7 +566,7 @@ void LLVMExecutableModel::reset() bool LLVMExecutableModel::getConservedSumChanged() @@ -582,7 +582,7 @@ int LLVMExecutableModel::getStateVector(double* stateVector) @@ -594,9 +594,9 @@ int LLVMExecutableModel::getStateVector(double* stateVector) @@ -627,9 +627,9 @@ int LLVMExecutableModel::setStateVector(const double* stateVector) @@ -1025,7 +1025,7 @@ bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, @@ -1066,7 +1066,7 @@ bool LLVMExecutableModel::getEventTieBreak(uint eventA, uint eventB) diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -502,9 +502,9 @@ void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model* model) @@ -561,9 +561,9 @@ void LLVMModelDataSymbols::initBoundarySpecies(const libsbml::Model* model) @@ -627,9 +627,9 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, @@ -808,12 +808,12 @@ bool LLVMModelDataSymbols::isValidSpeciesReference( @@ -821,9 +821,9 @@ bool LLVMModelDataSymbols::isValidSpeciesReference( void LLVMModelDataSymbols::displayCompartmentInfo() diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp LLVMModelGenerator::LLVMModelGenerator() LLVMModelGenerator::~LLVMModelGenerator() @@ -143,12 +143,12 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, return new LLVMExecutableModel(sp); @@ -263,7 +263,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -276,7 +276,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp @@ -49,7 +49,7 @@ LLVMModelSymbols::LLVMModelSymbols(const libsbml::Model *m, LLVMModelDataSymbols @@ -90,7 +90,7 @@ bool LLVMModelSymbols::visit(const libsbml::AssignmentRule& x) @@ -227,7 +227,7 @@ bool LLVMModelSymbols::visit(const libsbml::Reaction& r) @@ -255,7 +255,7 @@ void LLVMModelSymbols::processSpecies(SymbolForest ¤tSymbols, diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp diff --git a/source/llvm/ModelResources.cpp b/source/llvm/ModelResources.cpp --- a/source/llvm/ModelResources.cpp +++ b/source/llvm/ModelResources.cpp - Log(Logger::WARNING) << "Non-empty LLVM ExecutionEngine error string: " << *errStr; + Log(Logger::LOG_WARNING) << "Non-empty LLVM ExecutionEngine error string: " << *errStr; diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp b/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp --- a/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp +++ b/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp diff --git a/source/llvm_testing/src/TestBase.cpp b/source/llvm_testing/src/TestBase.cpp --- a/source/llvm_testing/src/TestBase.cpp +++ b/source/llvm_testing/src/TestBase.cpp diff --git a/source/llvm_testing/src/TestCapabilities.cpp b/source/llvm_testing/src/TestCapabilities.cpp --- a/source/llvm_testing/src/TestCapabilities.cpp +++ b/source/llvm_testing/src/TestCapabilities.cpp diff --git a/source/llvm_testing/src/TestEvalInitialConditions.cpp b/source/llvm_testing/src/TestEvalInitialConditions.cpp --- a/source/llvm_testing/src/TestEvalInitialConditions.cpp +++ b/source/llvm_testing/src/TestEvalInitialConditions.cpp diff --git a/source/llvm_testing/src/TestEvalModel.cpp b/source/llvm_testing/src/TestEvalModel.cpp --- a/source/llvm_testing/src/TestEvalModel.cpp +++ b/source/llvm_testing/src/TestEvalModel.cpp diff --git a/source/llvm_testing/src/TestEvalReactionRates.cpp b/source/llvm_testing/src/TestEvalReactionRates.cpp --- a/source/llvm_testing/src/TestEvalReactionRates.cpp +++ b/source/llvm_testing/src/TestEvalReactionRates.cpp diff --git a/source/llvm_testing/src/TestGetSetValues.cpp b/source/llvm_testing/src/TestGetSetValues.cpp --- a/source/llvm_testing/src/TestGetSetValues.cpp +++ b/source/llvm_testing/src/TestGetSetValues.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp if (ucomp == "LLVM") - Log(Logger::NOTICE) << "Creating LLVM based model generator."; + Log(Logger::LOG_NOTICE) << "Creating LLVM based model generator."; return new rrllvm::LLVMModelGenerator(); diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -753,7 +753,7 @@ llvm::Value* ASTNodeCodeGen::piecewiseCodeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp LLVMModelDataSymbols::SpeciesReferenceInfo nz = *i; diff --git a/source/llvm/EvalRateRuleRatesCodeGen.cpp b/source/llvm/EvalRateRuleRatesCodeGen.cpp --- a/source/llvm/EvalRateRuleRatesCodeGen.cpp +++ b/source/llvm/EvalRateRuleRatesCodeGen.cpp diff --git a/source/llvm/EvalVolatileStoichCodeGen.cpp b/source/llvm/EvalVolatileStoichCodeGen.cpp --- a/source/llvm/EvalVolatileStoichCodeGen.cpp +++ b/source/llvm/EvalVolatileStoichCodeGen.cpp diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp @@ -56,7 +56,7 @@ Event::Event(LLVMExecutableModel& model, uint id) : diff --git a/source/llvm/KineticLawParameterResolver.cpp b/source/llvm/KineticLawParameterResolver.cpp --- a/source/llvm/KineticLawParameterResolver.cpp +++ b/source/llvm/KineticLawParameterResolver.cpp @@ -43,7 +43,7 @@ llvm::Value* KineticLawParameterResolver::loadSymbolValue( diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -160,7 +160,7 @@ LLVMExecutableModel::~LLVMExecutableModel() LLVMModelData::freeBuffers(modelData); string LLVMExecutableModel::getModelName() @@ -566,7 +566,7 @@ void LLVMExecutableModel::reset() bool LLVMExecutableModel::getConservedSumChanged() @@ -582,7 +582,7 @@ int LLVMExecutableModel::getStateVector(double* stateVector) @@ -594,9 +594,9 @@ int LLVMExecutableModel::getStateVector(double* stateVector) @@ -1025,7 +1025,7 @@ bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, @@ -1066,7 +1066,7 @@ bool LLVMExecutableModel::getEventTieBreak(uint eventA, uint eventB) diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -507,9 +507,9 @@ void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model* model) @@ -566,9 +566,9 @@ void LLVMModelDataSymbols::initBoundarySpecies(const libsbml::Model* model) @@ -632,9 +632,9 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, @@ -813,12 +813,12 @@ bool LLVMModelDataSymbols::isValidSpeciesReference( @@ -826,9 +826,9 @@ bool LLVMModelDataSymbols::isValidSpeciesReference( void LLVMModelDataSymbols::displayCompartmentInfo() diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp LLVMModelGenerator::LLVMModelGenerator() LLVMModelGenerator::~LLVMModelGenerator() @@ -143,12 +143,12 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, return new LLVMExecutableModel(sp); @@ -263,7 +263,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -276,7 +276,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp @@ -49,7 +49,7 @@ LLVMModelSymbols::LLVMModelSymbols(const libsbml::Model *m, LLVMModelDataSymbols @@ -214,7 +214,7 @@ bool LLVMModelSymbols::visit(const libsbml::Reaction& r) @@ -242,7 +242,7 @@ void LLVMModelSymbols::processSpecies(SymbolForest ¤tSymbols, diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp diff --git a/source/llvm/ModelResources.cpp b/source/llvm/ModelResources.cpp --- a/source/llvm/ModelResources.cpp +++ b/source/llvm/ModelResources.cpp - Log(Logger::PRIO_WARNING) << "Non-empty LLVM ExecutionEngine error string: " << *errStr; + Log(Logger::WARNING) << "Non-empty LLVM ExecutionEngine error string: " << *errStr; diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp b/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp --- a/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp +++ b/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp diff --git a/source/llvm_testing/src/TestBase.cpp b/source/llvm_testing/src/TestBase.cpp --- a/source/llvm_testing/src/TestBase.cpp +++ b/source/llvm_testing/src/TestBase.cpp diff --git a/source/llvm_testing/src/TestCapabilities.cpp b/source/llvm_testing/src/TestCapabilities.cpp --- a/source/llvm_testing/src/TestCapabilities.cpp +++ b/source/llvm_testing/src/TestCapabilities.cpp diff --git a/source/llvm_testing/src/TestEvalInitialConditions.cpp b/source/llvm_testing/src/TestEvalInitialConditions.cpp --- a/source/llvm_testing/src/TestEvalInitialConditions.cpp +++ b/source/llvm_testing/src/TestEvalInitialConditions.cpp diff --git a/source/llvm_testing/src/TestEvalModel.cpp b/source/llvm_testing/src/TestEvalModel.cpp --- a/source/llvm_testing/src/TestEvalModel.cpp +++ b/source/llvm_testing/src/TestEvalModel.cpp diff --git a/source/llvm_testing/src/TestEvalReactionRates.cpp b/source/llvm_testing/src/TestEvalReactionRates.cpp --- a/source/llvm_testing/src/TestEvalReactionRates.cpp +++ b/source/llvm_testing/src/TestEvalReactionRates.cpp diff --git a/source/llvm_testing/src/TestGetSetValues.cpp b/source/llvm_testing/src/TestGetSetValues.cpp --- a/source/llvm_testing/src/TestGetSetValues.cpp +++ b/source/llvm_testing/src/TestGetSetValues.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp if (ucomp == "LLVM") - Log(Logger::PRIO_NOTICE) << "Creating LLVM based model generator."; + Log(Logger::NOTICE) << "Creating LLVM based model generator."; return new rrllvm::LLVMModelGenerator(); +The LLVM backend and refactoring of the core was designed and undertaken by diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp const char* compiler = "llvm"; diff --git a/source/llvm_testing/src/TestBase.cpp b/source/llvm_testing/src/TestBase.cpp --- a/source/llvm_testing/src/TestBase.cpp +++ b/source/llvm_testing/src/TestBase.cpp diff --git a/source/llvm_testing/src/TestBase.h b/source/llvm_testing/src/TestBase.h --- a/source/llvm_testing/src/TestBase.h +++ b/source/llvm_testing/src/TestBase.h diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp const char* compiler = "llvm"; diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp const char* compiler = "llvm"; diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp const char* compiler = "llvm"; diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h + * here only for compatability, does nothing in LLVM. Improved error handling in LLVM genertors for mal-formed sbml. diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp static std::vector getIds(const rrllvm::LLVMModelDataSymbols::StringUIntMap & m) for(rrllvm::LLVMModelDataSymbols::StringUIntMap::const_iterator i = m.begin(); diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp @@ -83,7 +83,18 @@ bool LLVMModelSymbols::visit(const libsbml::AssignmentRule& x) @@ -116,6 +127,8 @@ void LLVMModelSymbols::processElement(SymbolForest& currentSymbols, diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp const char* compiler = "llvm"; diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h tweak for VS LLVM build, ran Win32 tests diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp const char* compiler = "llvm"; diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h # Add the LLVM sources to compilation diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestPluginManager.cpp b/source/llvm_testing/src/TestPluginManager.cpp --- a/source/llvm_testing/src/TestPluginManager.cpp +++ b/source/llvm_testing/src/TestPluginManager.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h # Add the LLVM sources to compilation diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp namespace rrllvm @@ -359,7 +368,72 @@ void LLVMExecutableModel::testConstraints() string LLVMExecutableModel::getInfo() int LLVMExecutableModel::getFloatingSpeciesIndex(const string& id) @@ -658,6 +732,10 @@ int LLVMExecutableModel::getCompartmentVolumes(int len, const int* indx, int LLVMExecutableModel::getReactionRates(int len, const int* indx, In rrModelGeneratorFactory -> Include llvm headers only if LLVM being built/needed. +#if defined(BUILD_LLVM) #include "llvm/LLVMModelGenerator.h" diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp #include "LLVMException.h" diff --git a/source/llvm/ASTNodeFactory.cpp b/source/llvm/ASTNodeFactory.cpp --- a/source/llvm/ASTNodeFactory.cpp +++ b/source/llvm/ASTNodeFactory.cpp diff --git a/source/llvm/AssignmentRuleEvaluator.cpp b/source/llvm/AssignmentRuleEvaluator.cpp --- a/source/llvm/AssignmentRuleEvaluator.cpp +++ b/source/llvm/AssignmentRuleEvaluator.cpp diff --git a/source/llvm/CodeGenBase.cpp b/source/llvm/CodeGenBase.cpp --- a/source/llvm/CodeGenBase.cpp +++ b/source/llvm/CodeGenBase.cpp #include "LLVMException.h" diff --git a/source/llvm/EvalConversionFactorCodeGen.cpp b/source/llvm/EvalConversionFactorCodeGen.cpp --- a/source/llvm/EvalConversionFactorCodeGen.cpp +++ b/source/llvm/EvalConversionFactorCodeGen.cpp #include "LLVMException.h" diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp #include "LLVMException.h" diff --git a/source/llvm/EvalRateRuleRatesCodeGen.cpp b/source/llvm/EvalRateRuleRatesCodeGen.cpp --- a/source/llvm/EvalRateRuleRatesCodeGen.cpp +++ b/source/llvm/EvalRateRuleRatesCodeGen.cpp #include "LLVMException.h" diff --git a/source/llvm/EvalReactionRatesCodeGen.cpp b/source/llvm/EvalReactionRatesCodeGen.cpp --- a/source/llvm/EvalReactionRatesCodeGen.cpp +++ b/source/llvm/EvalReactionRatesCodeGen.cpp #include "LLVMException.h" diff --git a/source/llvm/EvalVolatileStoichCodeGen.cpp b/source/llvm/EvalVolatileStoichCodeGen.cpp --- a/source/llvm/EvalVolatileStoichCodeGen.cpp +++ b/source/llvm/EvalVolatileStoichCodeGen.cpp #include "LLVMException.h" diff --git a/source/llvm/EventAssignCodeGen.cpp b/source/llvm/EventAssignCodeGen.cpp --- a/source/llvm/EventAssignCodeGen.cpp +++ b/source/llvm/EventAssignCodeGen.cpp diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp #include "LLVMExecutableModel.h" diff --git a/source/llvm/EventTriggerCodeGen.cpp b/source/llvm/EventTriggerCodeGen.cpp --- a/source/llvm/EventTriggerCodeGen.cpp +++ b/source/llvm/EventTriggerCodeGen.cpp diff --git a/source/llvm/FunctionResolver.cpp b/source/llvm/FunctionResolver.cpp --- a/source/llvm/FunctionResolver.cpp +++ b/source/llvm/FunctionResolver.cpp #include "LLVMException.h" diff --git a/source/llvm/GetEventValuesCodeGen.cpp b/source/llvm/GetEventValuesCodeGen.cpp --- a/source/llvm/GetEventValuesCodeGen.cpp +++ b/source/llvm/GetEventValuesCodeGen.cpp #include "LLVMException.h" diff --git a/source/llvm/GetRateRuleValuesCodeGen.cpp b/source/llvm/GetRateRuleValuesCodeGen.cpp --- a/source/llvm/GetRateRuleValuesCodeGen.cpp +++ b/source/llvm/GetRateRuleValuesCodeGen.cpp namespace rrllvm diff --git a/source/llvm/GetValuesCodeGen.cpp b/source/llvm/GetValuesCodeGen.cpp --- a/source/llvm/GetValuesCodeGen.cpp +++ b/source/llvm/GetValuesCodeGen.cpp #include "LLVMException.h" diff --git a/source/llvm/InitialValueSymbolResolver.cpp b/source/llvm/InitialValueSymbolResolver.cpp --- a/source/llvm/InitialValueSymbolResolver.cpp +++ b/source/llvm/InitialValueSymbolResolver.cpp #include "LLVMException.h" diff --git a/source/llvm/KineticLawParameterResolver.cpp b/source/llvm/KineticLawParameterResolver.cpp --- a/source/llvm/KineticLawParameterResolver.cpp +++ b/source/llvm/KineticLawParameterResolver.cpp #include "LLVMIncludes.h" diff --git a/source/llvm/LLVMCompiler.cpp b/source/llvm/LLVMCompiler.cpp --- a/source/llvm/LLVMCompiler.cpp +++ b/source/llvm/LLVMCompiler.cpp #include "LLVMCompiler.h" diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp #include "LLVMExecutableModel.h" #include "LLVMIncludes.h" diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp #include "LLVMModelData.h" diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp #include "LLVMModelDataSymbols.h" #include "LLVMException.h" diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp #include "LLVMModelGenerator.h" #include "LLVMExecutableModel.h" diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp #include "LLVMModelSymbols.h" #include "LLVMException.h" diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp #include "LLVMException.h" diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp #include "LLVMException.h" diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp #include "LLVMIncludes.h" diff --git a/source/llvm/ModelResources.cpp b/source/llvm/ModelResources.cpp --- a/source/llvm/ModelResources.cpp +++ b/source/llvm/ModelResources.cpp diff --git a/source/llvm/SBMLSupportFunctions.cpp b/source/llvm/SBMLSupportFunctions.cpp --- a/source/llvm/SBMLSupportFunctions.cpp +++ b/source/llvm/SBMLSupportFunctions.cpp diff --git a/source/llvm/SetRateRuleValuesCodeGen.cpp b/source/llvm/SetRateRuleValuesCodeGen.cpp --- a/source/llvm/SetRateRuleValuesCodeGen.cpp +++ b/source/llvm/SetRateRuleValuesCodeGen.cpp namespace rrllvm diff --git a/source/llvm/SetValuesCodeGen.cpp b/source/llvm/SetValuesCodeGen.cpp --- a/source/llvm/SetValuesCodeGen.cpp +++ b/source/llvm/SetValuesCodeGen.cpp #include "LLVMException.h" diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/CSRMatrixTest.cpp b/source/llvm_testing/src/CSRMatrixTest.cpp --- a/source/llvm_testing/src/CSRMatrixTest.cpp +++ b/source/llvm_testing/src/CSRMatrixTest.cpp diff --git a/source/llvm_testing/src/ConfigurableTest.cpp b/source/llvm_testing/src/ConfigurableTest.cpp --- a/source/llvm_testing/src/ConfigurableTest.cpp +++ b/source/llvm_testing/src/ConfigurableTest.cpp diff --git a/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp b/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp --- a/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp +++ b/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp #include "llvm/GetValuesCodeGen.h" #include "llvm/ModelGeneratorContext.h" diff --git a/source/llvm_testing/src/LLVMCSRMatrixTest.cpp b/source/llvm_testing/src/LLVMCSRMatrixTest.cpp --- a/source/llvm_testing/src/LLVMCSRMatrixTest.cpp +++ b/source/llvm_testing/src/LLVMCSRMatrixTest.cpp #include "LLVMCSRMatrixTest.h" #include "llvm/ModelDataIRBuilder.h" diff --git a/source/llvm_testing/src/TestBase.cpp b/source/llvm_testing/src/TestBase.cpp --- a/source/llvm_testing/src/TestBase.cpp +++ b/source/llvm_testing/src/TestBase.cpp diff --git a/source/llvm_testing/src/TestCapabilities.cpp b/source/llvm_testing/src/TestCapabilities.cpp --- a/source/llvm_testing/src/TestCapabilities.cpp +++ b/source/llvm_testing/src/TestCapabilities.cpp diff --git a/source/llvm_testing/src/TestEvalInitialConditions.cpp b/source/llvm_testing/src/TestEvalInitialConditions.cpp --- a/source/llvm_testing/src/TestEvalInitialConditions.cpp +++ b/source/llvm_testing/src/TestEvalInitialConditions.cpp diff --git a/source/llvm_testing/src/TestEvalModel.cpp b/source/llvm_testing/src/TestEvalModel.cpp --- a/source/llvm_testing/src/TestEvalModel.cpp +++ b/source/llvm_testing/src/TestEvalModel.cpp diff --git a/source/llvm_testing/src/TestEvalReactionRates.cpp b/source/llvm_testing/src/TestEvalReactionRates.cpp --- a/source/llvm_testing/src/TestEvalReactionRates.cpp +++ b/source/llvm_testing/src/TestEvalReactionRates.cpp diff --git a/source/llvm_testing/src/TestGetSetValues.cpp b/source/llvm_testing/src/TestGetSetValues.cpp --- a/source/llvm_testing/src/TestGetSetValues.cpp +++ b/source/llvm_testing/src/TestGetSetValues.cpp diff --git a/source/llvm_testing/src/TestPluginManager.cpp b/source/llvm_testing/src/TestPluginManager.cpp --- a/source/llvm_testing/src/TestPluginManager.cpp +++ b/source/llvm_testing/src/TestPluginManager.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/cpplapack.cpp b/source/llvm_testing/src/cpplapack.cpp --- a/source/llvm_testing/src/cpplapack.cpp +++ b/source/llvm_testing/src/cpplapack.cpp diff --git a/source/llvm_testing/src/test_compiler.cpp b/source/llvm_testing/src/test_compiler.cpp --- a/source/llvm_testing/src/test_compiler.cpp +++ b/source/llvm_testing/src/test_compiler.cpp #include "llvm/LLVMModelGenerator.h" diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -703,22 +703,25 @@ int LLVMExecutableModel::setConservedSums(int len, const int* indx, int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, - throw LLVMException("index out of range"); diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h @@ -122,6 +122,9 @@ struct LLVMModelData diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp - throw_llvm_exception("Errors in sbml document: " + errors); + throw_llvm_exception("Fatal SBML error, no model, errors in sbml document: " + errors); diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp using namespace llvm; @@ -35,12 +33,18 @@ static void createLibraryFunction(llvm::LibFunc::Func funcId, llvm::FunctionType *funcType, Module *module); symbols(new LLVMModelDataSymbols(doc->getModel(), + throw_llvm_exception("Errors in sbml document: " + errors); + throw_llvm_exception("readSBMLFromString returned NULL, no further information available"); diff --git a/source/llvm/ModelResources.cpp b/source/llvm/ModelResources.cpp --- a/source/llvm/ModelResources.cpp +++ b/source/llvm/ModelResources.cpp Log(Logger::PRIO_WARNING) << "Non-empty LLVM ExecutionEngine error string: " << *errStr; diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -364,11 +364,6 @@ std::vector LLVMModelDataSymbols::getFloatingSpeciesIds() const -uint LLVMModelDataSymbols::getLinearlyIndependentFloatingSpeciesSize() const uint LLVMModelDataSymbols::getIndependentFloatingSpeciesSize() const @@ -594,38 +589,20 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, - throw_llvm_exception(msg); diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -304,6 +304,31 @@ void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h 3. Defaults to LLVM code generation on the backend, resulting is very fast simulation times. 3. Defaults to LLVM code generation on the backend, resulting is very fast simulation times. +3. Defaults to LLVM code generation on the backend, resulting is very fast simulation times. diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -726,9 +732,10 @@ int LLVMExecutableModel::getFloatingSpeciesInitConcentrations(int len, -double LLVMExecutableModel::getStoichiometry(int index) +double LLVMExecutableModel::getStoichiometry(int speciesIndex, int reactionIndex) int LLVMExecutableModel::getStoichiometryMatrix(int* pRows, int* pCols, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h When the LLVM back end is used (default) this always returns the current state of the When the LLVM back end is used (default) this always returns the current state of the diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt set(target llvm_testing) diff --git a/source/llvm_testing/tests/base.cpp b/source/llvm_testing/tests/base.cpp --- a/source/llvm_testing/tests/base.cpp diff --git a/source/llvm_testing/tests/from_api_tester.cpp b/source/llvm_testing/tests/from_api_tester.cpp --- a/source/llvm_testing/tests/from_api_tester.cpp diff --git a/source/llvm_testing/tests/sbml_test_suite.cpp b/source/llvm_testing/tests/sbml_test_suite.cpp --- a/source/llvm_testing/tests/sbml_test_suite.cpp diff --git a/source/llvm_testing/tests/steady_state.cpp b/source/llvm_testing/tests/steady_state.cpp --- a/source/llvm_testing/tests/steady_state.cpp diff --git a/source/llvm_testing/tests/stoichiometric.cpp b/source/llvm_testing/tests/stoichiometric.cpp --- a/source/llvm_testing/tests/stoichiometric.cpp diff --git a/source/llvm_testing/tests/three_species.cpp b/source/llvm_testing/tests/three_species.cpp --- a/source/llvm_testing/tests/three_species.cpp + When the LLVM back end is used (default) this always returns the current state of the +When the LLVM back end is used (default) this always returns the current state of the diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -731,6 +731,39 @@ double LLVMExecutableModel::getStoichiometry(int index) +int LLVMExecutableModel::getStoichiometryMatrix(int* pRows, int* pCols, @@ -933,5 +966,3 @@ bool LLVMExecutableModel::getEventTieBreak(uint eventA, uint eventB) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h * These funcs are used by the generated LLVM model. :param compiler: if LLVM build is enabled, the compiler defaults to LLVM. :param compiler: if LLVM build is enabled, the compiler defaults to LLVM. - :param compiler: if LLVM build is enabled, the compiler defaults to LLVM. fixed bug in LLVMExecutableModel in getting floating species ids diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -335,7 +335,7 @@ int LLVMExecutableModel::getFloatingSpeciesIndex(const string& id) catch (LLVMException&) diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -167,31 +167,24 @@ uint LLVMModelDataSymbols::getCompartmentIndex( uint LLVMModelDataSymbols::getFloatingSpeciesIndex( + throw LLVMException(msg); - throw LLVMException("could not find floating species with id " + id, __FUNC__); + throw LLVMException("could not find floating species with id " + id); uint LLVMModelDataSymbols::getBoundarySpeciesIndex( diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/tests/steady_state.cpp b/source/llvm_testing/tests/steady_state.cpp --- a/source/llvm_testing/tests/steady_state.cpp +++ b/source/llvm_testing/tests/steady_state.cpp diff --git a/source/llvm_testing/tests/three_species.cpp b/source/llvm_testing/tests/three_species.cpp --- a/source/llvm_testing/tests/three_species.cpp +++ b/source/llvm_testing/tests/three_species.cpp + :param compiler: if LLVM build is enabled, the compiler defaults to LLVM. diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h +When using the LLVM back end, all model state calculation are automatically +causes that value to cascade down to the terminal cells. The LLVM back end roadruner + :param compiler: if LLVM build is enabled, the compiler defaults to LLVM. diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp cout << "RoadRunner LLVM SBML Test Suite" << endl; const char* compiler = "llvm"; diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h +:param compiler: if LLVM build is enabled, the compiler defaults to LLVM. - if LLVM build is enabled, the compiler defaults to LLVM. fixed llvm_testing build for msvc, ran win32 tests diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h --- a/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h +

    In the C generating model sytem, an external C compiler is used to compile generated C code. However, in the LLVM system, there is no code generation nor compilation, so this interface is not really usefull, but is implemented for compatiblity with the C system.

    +

    Currently we have two concrete Model implmentations, an LLVM JIT compiled model and the older C file generating shared library model.

    + compiler,:the textual name of the compiler. If this is "llvm", then then the LLVM ModelGenerator is created, otherwise, A C based model generator is created. + tmpDirThe C version stores all the generated temporary C files and objects here, not used for LLVM. + supportCodeDirLocation where roadrunner include files are, not used in LLVM. + compiler,:If LLVM build is enabled, the compiler defaults to LLVM. +

    The C back end requires this to be called to update model variables if anyting is changes. Does nothing in LLVM back end as everything is automatically handled with lazy evaluation.

    +
    11 #if defined(__llvm__)
    +
    15 #if defined(__GNUC__) && !defined(__llvm__)
    +

    Should the model be recompiled? The LLVM ModelGenerator maintins a hash table of currently running models. If this flag is NOT set, then the generator will look to see if there is already a running instance of the given model and use the generated code from that one.

    +{\em compiler,\-:} & the textual name of the compiler. If this is \char`\"{}llvm\char`\"{}, then then the L\-L\-V\-M \hyperlink{classrr_1_1_model_generator}{Model\-Generator} is created, otherwise, A C based model generator is created.\\ diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/tests/sbml_test_suite.cpp b/source/llvm_testing/tests/sbml_test_suite.cpp --- a/source/llvm_testing/tests/sbml_test_suite.cpp +++ b/source/llvm_testing/tests/sbml_test_suite.cpp diff --git a/source/llvm_testing/tests/steady_state.cpp b/source/llvm_testing/tests/steady_state.cpp --- a/source/llvm_testing/tests/steady_state.cpp +++ b/source/llvm_testing/tests/steady_state.cpp diff --git a/source/llvm_testing/tests/three_species.cpp b/source/llvm_testing/tests/three_species.cpp --- a/source/llvm_testing/tests/three_species.cpp +++ b/source/llvm_testing/tests/three_species.cpp + * Currently we have two concrete Model implmentations, an LLVM JIT compiled + * in LLVM back end as everything is automatically handled diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp const char* compiler = "llvm"; diff --git a/source/llvm_testing/src/TestPluginManager.cpp b/source/llvm_testing/src/TestPluginManager.cpp +++ b/source/llvm_testing/src/TestPluginManager.cpp diff --git a/source/llvm_testing/src/TestPluginManager.h b/source/llvm_testing/src/TestPluginManager.h +++ b/source/llvm_testing/src/TestPluginManager.h diff --git a/source/llvm_testing/src/TestCapabilities.cpp b/source/llvm_testing/src/TestCapabilities.cpp --- a/source/llvm_testing/src/TestCapabilities.cpp +++ b/source/llvm_testing/src/TestCapabilities.cpp #if defined(BUILD_LLVM) string compiler = _compiler.empty() ? "LLVM" : _compiler; diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp const char* compiler = "llvm"; diff --git a/source/llvm_testing/src/ConfigurableTest.cpp b/source/llvm_testing/src/ConfigurableTest.cpp +++ b/source/llvm_testing/src/ConfigurableTest.cpp +} /* namespace rrllvm */ diff --git a/source/llvm_testing/src/ConfigurableTest.h b/source/llvm_testing/src/ConfigurableTest.h +++ b/source/llvm_testing/src/ConfigurableTest.h +} /* namespace rrllvm */ if (${BUILD_LLVM}) - @param compiler: if LLVM build is enabled, the compiler defaults to LLVM. + if LLVM build is enabled, the compiler defaults to LLVM. diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -176,6 +176,7 @@ uint LLVMModelDataSymbols::getFloatingSpeciesIndex( @@ -187,6 +188,7 @@ uint LLVMModelDataSymbols::getFloatingSpeciesIndex( throw LLVMException("could not find floating species with id " + id, __FUNC__); @@ -836,7 +838,7 @@ bool LLVMModelDataSymbols::isValidSpeciesReference( diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestCapabilities.cpp b/source/llvm_testing/src/TestCapabilities.cpp +++ b/source/llvm_testing/src/TestCapabilities.cpp diff --git a/source/llvm_testing/src/TestCapabilities.h b/source/llvm_testing/src/TestCapabilities.h +++ b/source/llvm_testing/src/TestCapabilities.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -331,11 +331,16 @@ string LLVMExecutableModel::getInfo() -int LLVMExecutableModel::getFloatingSpeciesIndex(const string& allocator) +int LLVMExecutableModel::getFloatingSpeciesIndex(const string& id) - throw LLVMException(string("Not Implemented: ") + __FUNCTION__); + catch (LLVMException&) string LLVMExecutableModel::getFloatingSpeciesId(int index) @@ -346,7 +351,14 @@ string LLVMExecutableModel::getFloatingSpeciesId(int index) int LLVMExecutableModel::getBoundarySpeciesIndex(const string& id) + catch (LLVMException&) string LLVMExecutableModel::getBoundarySpeciesId(int indx) @@ -355,18 +367,16 @@ string LLVMExecutableModel::getBoundarySpeciesId(int indx) -int LLVMExecutableModel::getBoundarySpeciesCompartmentIndex(int int1) - throw LLVMException(string("Not Implemented: ") + __FUNCTION__); -int LLVMExecutableModel::getGlobalParameterIndex(const string& allocator) +int LLVMExecutableModel::getGlobalParameterIndex(const string& id) - throw LLVMException(string("Not Implemented: ") + __FUNCTION__); + catch(LLVMException&) string LLVMExecutableModel::getGlobalParameterId(int id) @@ -383,11 +393,16 @@ string LLVMExecutableModel::getGlobalParameterId(int id) -int LLVMExecutableModel::getCompartmentIndex(const string& allocator) +int LLVMExecutableModel::getCompartmentIndex(const string& id) - throw LLVMException(string("Not Implemented: ") + __FUNCTION__); + catch (LLVMException&) string LLVMExecutableModel::getCompartmentId(int id) @@ -404,11 +419,16 @@ string LLVMExecutableModel::getCompartmentId(int id) -int LLVMExecutableModel::getReactionIndex(const string& allocator) +int LLVMExecutableModel::getReactionIndex(const string& id) - throw LLVMException(string("Not Implemented: ") + __FUNCTION__); + catch (LLVMException&) string LLVMExecutableModel::getReactionId(int id) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/SetValuesCodeGen.cpp b/source/llvm/SetValuesCodeGen.cpp --- a/source/llvm/SetValuesCodeGen.cpp +++ b/source/llvm/SetValuesCodeGen.cpp using namespace llvm; namespace rrllvm +static std::vector independentElements(const LLVMModelDataSymbols &dataSymbols, diff --git a/source/llvm/SetValuesCodeGen.h b/source/llvm/SetValuesCodeGen.h --- a/source/llvm/SetValuesCodeGen.h +++ b/source/llvm/SetValuesCodeGen.h @@ -114,6 +114,7 @@ if(BUILD_LLVM) llvm/ModelGeneratorContext llvm/LLVMModelSymbols llvm/SetRateRuleValuesCodeGen + llvm/SetValuesCodeGen llvm/SBMLSupportFunctions llvm/EvalVolatileStoichCodeGen diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -57,6 +57,18 @@ static int getValues(LLVMModelData* modelData, double (*funcPtr)(LLVMModelData*, +static int setValues(LLVMModelData* modelData, bool (*funcPtr)(LLVMModelData*, int, double), LLVMExecutableModel::LLVMExecutableModel() : @@ -74,7 +86,13 @@ LLVMExecutableModel::LLVMExecutableModel() : LLVMModelData::init(modelData); @@ -103,7 +121,13 @@ LLVMExecutableModel::LLVMExecutableModel( LLVMModelData::init(modelData); @@ -526,9 +550,12 @@ int LLVMExecutableModel::getFloatingSpeciesAmounts(int len, const int* indx, int LLVMExecutableModel::setFloatingSpeciesConcentrations(int len, - throw LLVMException(string("Not Implemented: ") + __FUNCTION__); int LLVMExecutableModel::getBoundarySpeciesAmounts(int len, const int* indx, @@ -546,9 +573,12 @@ int LLVMExecutableModel::getBoundarySpeciesConcentrations(int len, int LLVMExecutableModel::setBoundarySpeciesConcentrations(int len, - throw LLVMException(string("Not Implemented: ") + __FUNCTION__); int LLVMExecutableModel::getGlobalParameterValues(int len, const int* indx, @@ -560,20 +590,20 @@ int LLVMExecutableModel::getGlobalParameterValues(int len, const int* indx, int LLVMExecutableModel::setGlobalParameterValues(int len, const int* indx, - throw LLVMException(string("Not Implemented: ") + __FUNCTION__); int LLVMExecutableModel::getCompartmentVolumes(int len, const int* indx, int LLVMExecutableModel::getReactionRates(int len, const int* indx, @@ -644,14 +674,24 @@ int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, int LLVMExecutableModel::setFloatingSpeciesAmounts(int len, int const *indx, int LLVMExecutableModel::setCompartmentVolumes(int len, const int* indx, int LLVMExecutableModel::setFloatingSpeciesInitConcentrations(int len, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h static LLVMExecutableModel* dummy(); diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -204,6 +204,36 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/ModelResources.h b/source/llvm/ModelResources.h --- a/source/llvm/ModelResources.h +++ b/source/llvm/ModelResources.h } /* namespace rrllvm */ diff --git a/source/llvm/SetValueCodeGenBase.h b/source/llvm/SetValueCodeGenBase.h +++ b/source/llvm/SetValueCodeGenBase.h +#ifndef RRLLVMSETVALUECODEGENBASE_H_ +#define RRLLVMSETVALUECODEGENBASE_H_ +#include "LLVMException.h" +namespace rrllvm +typedef bool (*SetValueCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t, double); + llvm::Value *codeGen(); +llvm::Value* SetValueCodeGenBase::codeGen() + llvm::Type *argTypes[] = { + llvm::PointerType::get(ModelDataIRBuilder::getStructType(this->module), 0), + llvm::Type::getInt32Ty(this->context), + llvm::Type::getDoubleTy(this->context) + llvm::Value *args[] = {0, 0, 0}; + llvm::BasicBlock *entry = this->codeGenHeader(Derived::FunctionName, llvm::Type::getInt8Ty(this->context), + llvm::BasicBlock *def = llvm::BasicBlock::Create(this->context, "default", this->function); + this->builder.CreateRet(llvm::ConstantInt::get(llvm::Type::getInt8Ty(this->context), 0)); + llvm::SwitchInst *s = this->builder.CreateSwitch(args[1], def, ids.size()); + llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, ids[i] + "_block", this->function); + llvm::Value *value = args[2]; + llvm::Value *comp = loadResolver.loadSymbolValue(species->getCompartment()); + llvm::Value *comp = loadResolver.loadSymbolValue(species->getCompartment()); + this->builder.CreateRet(llvm::ConstantInt::get(llvm::Type::getInt8Ty(this->context), 1)); + s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), i), block); +} /* namespace rrllvm */ +#endif /* RRLLVMSETVALUECODEGENBASE_H_ */ diff --git a/source/llvm/SetValuesCodeGen.cpp b/source/llvm/SetValuesCodeGen.cpp +++ b/source/llvm/SetValuesCodeGen.cpp +#include "LLVMException.h" +using namespace llvm; +namespace rrllvm diff --git a/source/llvm/SetValuesCodeGen.h b/source/llvm/SetValuesCodeGen.h +++ b/source/llvm/SetValuesCodeGen.h +#ifndef RRLLVMSETVALUESCODEGEN_H_ +#define RRLLVMSETVALUESCODEGEN_H_ +namespace rrllvm +} /* namespace rrllvm */ diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm_testing/src/TestBase.cpp b/source/llvm_testing/src/TestBase.cpp --- a/source/llvm_testing/src/TestBase.cpp +++ b/source/llvm_testing/src/TestBase.cpp diff --git a/source/llvm_testing/src/TestGetSetValues.cpp b/source/llvm_testing/src/TestGetSetValues.cpp +++ b/source/llvm_testing/src/TestGetSetValues.cpp diff --git a/source/llvm_testing/src/TestGetSetValues.h b/source/llvm_testing/src/TestGetSetValues.h +++ b/source/llvm_testing/src/TestGetSetValues.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp + @param compiler: if LLVM build is enabled, the compiler defaults to LLVM. diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp - add llvm lib directory to link dir -- this really neads to be changed so the we get the absolute path of the llvm libs. +if (${BUILD_LLVM}) + ${LLVM_LIBRARY_DIRS} +endif (${BUILD_LLVM}) diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp #include "LLVMException.h" diff --git a/source/llvm/CodeGenBase.cpp b/source/llvm/CodeGenBase.cpp --- a/source/llvm/CodeGenBase.cpp +++ b/source/llvm/CodeGenBase.cpp - LLVMCodeGenTest::test(vars, out); + //LLVMCodeGenTest::test(vars, out); diff --git a/source/llvm/LLVMCompiler.cpp b/source/llvm/LLVMCompiler.cpp --- a/source/llvm/LLVMCompiler.cpp +++ b/source/llvm/LLVMCompiler.cpp #include "LLVMCompiler.h" namespace rrllvm diff --git a/source/llvm/LLVMIncludes.h b/source/llvm/LLVMIncludes.h --- a/source/llvm/LLVMIncludes.h +++ b/source/llvm/LLVMIncludes.h #if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 3) #include #include #include #include #include +#include namespace rrllvm { diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp #include "LLVMModelDataSymbols.h" #include "LLVMException.h" -#include -using namespace llvm; diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp #include "LLVMException.h" @@ -474,9 +476,9 @@ ASTNode* LLVMModelSymbols::createStoichiometryNode(int row, int col) const diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp @@ -35,6 +35,26 @@ static void createLibraryFunction(llvm::LibFunc::Func funcId, llvm::FunctionType *funcType, Module *module); diff --git a/source/llvm/SBMLSupportFunctions.cpp b/source/llvm/SBMLSupportFunctions.cpp --- a/source/llvm/SBMLSupportFunctions.cpp +++ b/source/llvm/SBMLSupportFunctions.cpp -set(LLVM_INSTALL_PREFIX "/Users/andy/llvm" CACHE PATH "If LLVM was built using CMake, this is the location where it was installed") +set(LLVM_INSTALL_PREFIX CACHE PATH "If LLVM was built using CMake, this is the location where it was installed") # determine if LLVM was installed using CMake if(EXISTS ${LLVM_INSTALL_PREFIX}/share/llvm/cmake) allow build system to use LLVM from either a CMake install or a Unix packange manager install -set(LLVM_MIN_VERSION "3000000") -set(LLVM_MIN_VERSION_TEXT "3.0") -find_package(LLVM) +set(LLVM_INSTALL_PREFIX "/Users/andy/llvm" CACHE PATH "If LLVM was built using CMake, this is the location where it was installed") +# determine if LLVM was installed using CMake +if(EXISTS ${LLVM_INSTALL_PREFIX}/share/llvm/cmake) + message(STATUS "Found CMake built LLVM") + option (BUILD_LLVM "Build the LLVM back end" ON) + set(BUILD_LLVM ON) + set(LLVM_FOUND TRUE) + # Use the propper LLVM supplied CMake files. + # prepend the cmake module path with the LLVM modules + set(CMAKE_MODULE_PATH "${LLVM_INSTALL_PREFIX}/share/llvm/cmake" ${CMAKE_MODULE_PATH}) + include(LLVMConfig) + # this sets the LLVM_LIBRARIES var to be the list of required LLVM libs + llvm_map_components_to_libraries(LLVM_LIBRARIES jit native) + message(STATUS "Looking for LLVM installed without CMake") + set(LLVM_MIN_VERSION "3000000") + set(LLVM_MIN_VERSION_TEXT "3.0") + # look for LLVM using the llvm-config program + find_package(LLVM) # should we use LLVM ? -option (BUILD_LLVM "Build the optional LLVM back end (Should build, but not fully implemented yet)" OFF) +option (BUILD_LLVM "Build the LLVM back end" OFF) if(BUILD_LLVM) message(STATUS "using LLVM, version ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}") + message(STATUS "LLVM_LIBRARIES: ${LLVM_LIBRARIES}") + message(STATUS "LLVM_DEFINITIONS: ${LLVM_DEFINITIONS}") + message(STATUS "LLVM_INCLUDE_DIRS: ${LLVM_INCLUDE_DIRS}") + message(STATUS "LLVM_LIBRARY_DIRS: ${LLVM_LIBRARY_DIRS}") add_definitions(-DBUILD_LLVM) - add_definitions(${LLVM_CXXFLAGS}) - include_directories(${LLVM_INCLUDE_DIR}) + add_definitions(${LLVM_DEFINITIONS}) + include_directories(${LLVM_INCLUDE_DIRS}) message(STATUS "NOT using LLVM") endif(BUILD_LLVM) diff --git a/cmake/FindLLVM.cmake b/cmake/FindLLVM.cmake --- a/cmake/FindLLVM.cmake +++ b/cmake/FindLLVM.cmake # LLVM_FOUND - True if llvm found. -# LLVM_INCLUDE_DIR - where to find llvm include files -# LLVM_LIBRARY_DIR - where to find llvm libs -# LLVM_LDFLAGS - llvm linker flags -# LLVM_LIBRARIES - list of llvm libs for working with modules. +# LLVM_INCLUDE_DIRS - where to find llvm include files +# LLVM_LIBRARY_DIRS - where to find llvm libs +# LLVM_LDFLAGS - llvm linker flags +# LLVM_LIBRARIES - list of llvm libs for working with modules. -# LLVM_CFLAGS - flags to add to the C compiler for llvm support -# LLVM_CXXFLAGS - flags to add to the CXX compiler for llvm support +# LLVM_DEFINITIONS - flags to add to the CXX compiler for llvm support # LLVM_VERSION_MAJOR # LLVM_VERSION_MINOR # LLVM_VERSION_PATCH @@ -63,13 +62,13 @@ find_program(LLVM_CONFIG_EXECUTABLE if (LLVM_CONFIG_EXECUTABLE) message(STATUS "LLVM llvm-config found at: ${LLVM_CONFIG_EXECUTABLE}") COMMAND ${LLVM_CONFIG_EXECUTABLE} --version OUTPUT_VARIABLE LLVM_VERSION execute_process(COMMAND ${LLVM_CONFIG_EXECUTABLE} --version OUTPUT_VARIABLE LLVM_STRING_VERSION ) string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)([^\n\r\t ]*)" "\\1" LLVM_VERSION_MAJOR @@ -81,75 +80,50 @@ if (LLVM_CONFIG_EXECUTABLE) message(STATUS "LLVM_VERSION_MAJOR: ${LLVM_VERSION_MAJOR}") message(STATUS "LLVM_VERSION_MINOR: ${LLVM_VERSION_MINOR}") message(STATUS "LLVM_VERSION_PATCH: ${LLVM_VERSION_PATCH}") execute_process(COMMAND ${LLVM_CONFIG_EXECUTABLE} --bindir OUTPUT_VARIABLE LLVM_BIN_DIR ) execute_process(COMMAND ${LLVM_CONFIG_EXECUTABLE} --libdir OUTPUT_VARIABLE LLVM_LIB_DIR ) MESSAGE(STATUS "LLVM_BIN_DIR: " ${LLVM_BIN_DIR}) MESSAGE(STATUS "LLVM_LIB_DIR: " ${LLVM_LIB_DIR}) COMMAND ${LLVM_CONFIG_EXECUTABLE} --includedir - OUTPUT_VARIABLE LLVM_INCLUDE_DIR + OUTPUT_VARIABLE LLVM_INCLUDE_DIRS - message(STATUS "LLVM_INCLUDE_DIR: ${LLVM_INCLUDE_DIR}") + message(STATUS "LLVM_INCLUDE_DIRS: ${LLVM_INCLUDE_DIRS}") COMMAND ${LLVM_CONFIG_EXECUTABLE} --libdir - OUTPUT_VARIABLE LLVM_LIBRARY_DIR + OUTPUT_VARIABLE LLVM_LIBRARY_DIRS - message(STATUS "LLVM_LIBRARY_DIR: ${LLVM_LIBRARY_DIR}") + message(STATUS "LLVM_LIBRARY_DIRS: ${LLVM_LIBRARY_DIRS}") COMMAND ${LLVM_CONFIG_EXECUTABLE} --cxxflags - OUTPUT_VARIABLE LLVM_CXXFLAGS + OUTPUT_VARIABLE LLVM_DEFINITIONS # strip this from llvm's version, we should add this ourselves in - STRING(REPLACE "-DNDEBUG" "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) - STRING(REPLACE "-D_DEBUG" "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) + STRING(REPLACE "-DNDEBUG" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS}) + STRING(REPLACE "-D_DEBUG" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS}) - STRING(REGEX REPLACE "-O[0-9]" "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) - STRING(REPLACE "-fno-rtti" "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) - STRING(REPLACE "-fno-exceptions" "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) + STRING(REGEX REPLACE "-O[0-9]" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS}) + STRING(REPLACE "-fno-rtti" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS}) + STRING(REPLACE "-fno-exceptions" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS}) # should be OK linking to LLVM as this just results in a slightly larger lib (I think, I hope...) - string(REPLACE "-fvisibility-inlines-hidden" "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) - MESSAGE(STATUS "LLVM_CXXFLAGS: " ${LLVM_CXXFLAGS}) - COMMAND ${LLVM_CONFIG_EXECUTABLE} --cflags - OUTPUT_VARIABLE LLVM_CFLAGS - # strip this from llvm's version, we should add this ourselves in - STRING(REPLACE "-DNDEBUG" "" LLVM_CFLAGS ${LLVM_CFLAGS}) - STRING(REPLACE "-D_DEBUG" "" LLVM_CFLAGS ${LLVM_CFLAGS}) - STRING(REGEX REPLACE "-O[0-9]" "" LLVM_CFLAGS ${LLVM_CFLAGS}) - MESSAGE(STATUS "LLVM_CFLAGS: " ${LLVM_CFLAGS}) - COMMAND ${LLVM_CONFIG_EXECUTABLE} --ldflags - OUTPUT_VARIABLE LLVM_LDFLAGS - STRING(REPLACE "-ldl" "" LLVM_LDFLAGS ${LLVM_LDFLAGS}) - MESSAGE(STATUS "LLVM_LDFLAGS: " ${LLVM_LDFLAGS}) + string(REPLACE "-fvisibility-inlines-hidden" "" LLVM_DEFINITIONS ${LLVM_DEFINITIONS}) + MESSAGE(STATUS "LLVM_DEFINITIONS: " ${LLVM_DEFINITIONS}) # TODO: in future, replace this with something like LLVM_CORE_LIBS, LLVM_JIT_LIBS... COMMAND ${LLVM_CONFIG_EXECUTABLE} --libfiles core jit native @@ -159,13 +133,13 @@ if (LLVM_CONFIG_EXECUTABLE) # we get a space sep list from llvm-config, make it a cmake ; separated list. STRING(REGEX REPLACE "[\n\t\r ]+" ";" LLVM_LIBRARIES ${LLVM_LIBRARIES}) message(STATUS "LLVM_LIBRARIES: ${LLVM_LIBRARIES}") - if(LLVM_INCLUDE_DIR) + if(LLVM_INCLUDE_DIRS) set(LLVM_FOUND TRUE) - message(STATUS "Found LLVM: ${LLVM_INCLUDE_DIR}") - endif(LLVM_INCLUDE_DIR) + message(STATUS "Found LLVM: ${LLVM_INCLUDE_DIRS}") + endif(LLVM_INCLUDE_DIRS) else (LLVM_CONFIG_EXECUTABLE) message(STATUS "Could NOT find LLVM executable") + * The LLVM ModelGenerator maintins a hash table of currently running diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp #include "LLVMException.h" diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -841,7 +841,17 @@ bool LLVMModelDataSymbols::isValidSpeciesReference( diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp @@ -176,9 +176,10 @@ bool LLVMModelSymbols::visit(const libsbml::Reaction& r) catch (LLVMException&) @@ -207,6 +208,8 @@ bool LLVMModelSymbols::visit(const libsbml::Reaction& r) catch (LLVMException&) diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -235,26 +235,42 @@ void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp @@ -54,24 +54,6 @@ void LLVMModelData::init(LLVMModelData &data) memset(&data, 0, sizeof(LLVMModelData)); -void LLVMModelData::allocBuffers(LLVMModelData &data, const string& modelName) std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) os << "LLVMModelData:" << endl; @@ -91,28 +73,9 @@ std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) @@ -134,8 +97,6 @@ std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) void LLVMModelData::freeBuffers(LLVMModelData &data) diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h @@ -176,8 +176,6 @@ struct LLVMModelData static void init(LLVMModelData&); - static void allocBuffers(LLVMModelData &data, const std::string& modelName); static void freeBuffers(LLVMModelData&); diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -253,9 +253,9 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const Make LLVM the default compiler if built with LLVM Fix ModelResource deletion bug in LLVMModelGenerator diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -227,8 +227,8 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -237,6 +237,10 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp --- a/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/tests/base.cpp b/source/llvm_testing/tests/base.cpp --- a/source/llvm_testing/tests/base.cpp +++ b/source/llvm_testing/tests/base.cpp diff --git a/source/llvm_testing/tests/sbml_test_suite.cpp b/source/llvm_testing/tests/sbml_test_suite.cpp --- a/source/llvm_testing/tests/sbml_test_suite.cpp +++ b/source/llvm_testing/tests/sbml_test_suite.cpp diff --git a/source/llvm_testing/tests/steady_state.cpp b/source/llvm_testing/tests/steady_state.cpp --- a/source/llvm_testing/tests/steady_state.cpp +++ b/source/llvm_testing/tests/steady_state.cpp diff --git a/source/llvm_testing/tests/stoichiometric.cpp b/source/llvm_testing/tests/stoichiometric.cpp --- a/source/llvm_testing/tests/stoichiometric.cpp +++ b/source/llvm_testing/tests/stoichiometric.cpp diff --git a/source/llvm_testing/tests/three_species.cpp b/source/llvm_testing/tests/three_species.cpp --- a/source/llvm_testing/tests/three_species.cpp +++ b/source/llvm_testing/tests/three_species.cpp +#if defined(BUILD_LLVM) + string compiler = _compiler.empty() ? "LLVM" : _compiler; + * @param compiler: If LLVM build is enabled, the compiler defaults to LLVM. -bool gUseLLVM = false; - if (args.compiler == "llvm") - gUseLLVM = true; - cout << "Enabling LLVM" << endl; - Log(Logger::PRIO_NOTICE) << "Enabling LLVM"; -extern bool gUseLLVM; - gRR = createRRInstanceEx(gTempFolder.c_str(), gUseLLVM ? "llvm" : 0); diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -119,7 +119,7 @@ LLVMExecutableModel::~LLVMExecutableModel() LLVMModelData::freeBuffers(modelData); string LLVMExecutableModel::getModelName() diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp LLVMModelGenerator::LLVMModelGenerator() LLVMModelGenerator::~LLVMModelGenerator() diff --git a/source/llvm/ModelResources.cpp b/source/llvm/ModelResources.cpp --- a/source/llvm/ModelResources.cpp +++ b/source/llvm/ModelResources.cpp namespace rrllvm @@ -95,6 +95,7 @@ if(BUILD_LLVM) llvm/AssignmentRuleEvaluator llvm/ASTNodeCodeGen llvm/ASTNodeFactory + llvm/ModelResources llvm/CodeGenBase llvm/LLVMCompiler llvm/EvalConversionFactorCodeGen diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp #include "LLVMExecutableModel.h" #include "LLVMIncludes.h" @@ -56,9 +57,6 @@ static int getValues(LLVMModelData* modelData, double (*funcPtr)(LLVMModelData*, LLVMExecutableModel::LLVMExecutableModel() : @@ -67,7 +65,6 @@ LLVMExecutableModel::LLVMExecutableModel() : @@ -85,21 +82,44 @@ LLVMExecutableModel::LLVMExecutableModel() : -LLVMExecutableModel::~LLVMExecutableModel() +LLVMExecutableModel::LLVMExecutableModel( + LLVMModelData::init(modelData); - Log(Logger::PRIO_WARNING) << "Non-empty LLVM ExecutionEngine error string: " << *errStr; +LLVMExecutableModel::~LLVMExecutableModel() LLVMModelData::freeBuffers(modelData); string LLVMExecutableModel::getModelName() @@ -461,7 +481,6 @@ int LLVMExecutableModel::setStateVector(const double* stateVector) void LLVMExecutableModel::print(std::ostream &stream) stream << "LLVMExecutableModel" << endl; diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h namespace rrllvm class RR_DECLSPEC LLVMExecutableModel: public rr::ExecutableModel LLVMExecutableModel(); + LLVMExecutableModel(const std::tr1::shared_ptr &resources); virtual ~LLVMExecutableModel(); - LLVMModelData modelData; - LLVMModelDataSymbols *symbols; - llvm::LLVMContext *context; - llvm::ExecutionEngine *executionEngine; + LLVMModelData modelData; + const LLVMModelDataSymbols *symbols; static LLVMExecutableModel* dummy(); friend class LLVMModelGenerator; diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp #include "LLVMExecutableModel.h" #include "LLVMIncludes.h" namespace rrllvm LLVMModelGenerator::LLVMModelGenerator() LLVMModelGenerator::~LLVMModelGenerator() bool LLVMModelGenerator::setTemporaryDirectory(const string& path) @@ -35,6 +88,26 @@ string LLVMModelGenerator::getTemporaryDirectory() return LLVMCompiler::gurgle(); ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -42,54 +115,93 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, + return new LLVMExecutableModel(sp); @@ -99,34 +211,47 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, - LLVMExecutableModel *exe = new LLVMExecutableModel(); + return new LLVMExecutableModel(rc); Compiler* LLVMModelGenerator::getCompiler() diff --git a/source/llvm/LLVMModelGenerator.h b/source/llvm/LLVMModelGenerator.h --- a/source/llvm/LLVMModelGenerator.h +++ b/source/llvm/LLVMModelGenerator.h #include "LLVMCompiler.h" namespace rrllvm LLVMCompiler compiler; diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp @@ -178,8 +178,9 @@ llvm::IRBuilder<> &ModelGeneratorContext::getBuilder() const -void ModelGeneratorContext::stealThePeach(LLVMModelDataSymbols **sym, - llvm::LLVMContext** ctx, llvm::ExecutionEngine** eng, string** err) +void ModelGeneratorContext::stealThePeach(const LLVMModelDataSymbols **sym, + const llvm::LLVMContext** ctx, const llvm::ExecutionEngine** eng, diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h - void stealThePeach(LLVMModelDataSymbols **sym, llvm::LLVMContext **ctx, - llvm::ExecutionEngine **eng, std::string **errStr); + void stealThePeach(const LLVMModelDataSymbols **sym, + const llvm::LLVMContext **ctx, const llvm::ExecutionEngine **eng, diff --git a/source/llvm/ModelResources.cpp b/source/llvm/ModelResources.cpp +++ b/source/llvm/ModelResources.cpp +namespace rrllvm + Log(Logger::PRIO_WARNING) << "Non-empty LLVM ExecutionEngine error string: " << *errStr; +} /* namespace rrllvm */ diff --git a/source/llvm/ModelResources.h b/source/llvm/ModelResources.h +++ b/source/llvm/ModelResources.h +#include "LLVMExecutableModel.h" +namespace rrllvm + const LLVMModelDataSymbols *symbols; + const llvm::LLVMContext *context; + const llvm::ExecutionEngine *executionEngine; +} /* namespace rrllvm */ moved all llvm classes to thier own namespace diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp using namespace llvm; +namespace rrllvm diff --git a/source/llvm/ASTNodeCodeGen.h b/source/llvm/ASTNodeCodeGen.h --- a/source/llvm/ASTNodeCodeGen.h +++ b/source/llvm/ASTNodeCodeGen.h +namespace rrllvm * All of the LLVM IR generation is handled here. diff --git a/source/llvm/ASTNodeFactory.cpp b/source/llvm/ASTNodeFactory.cpp --- a/source/llvm/ASTNodeFactory.cpp +++ b/source/llvm/ASTNodeFactory.cpp +namespace rrllvm diff --git a/source/llvm/ASTNodeFactory.h b/source/llvm/ASTNodeFactory.h --- a/source/llvm/ASTNodeFactory.h +++ b/source/llvm/ASTNodeFactory.h +namespace rrllvm diff --git a/source/llvm/AssignmentRuleEvaluator.cpp b/source/llvm/AssignmentRuleEvaluator.cpp --- a/source/llvm/AssignmentRuleEvaluator.cpp +++ b/source/llvm/AssignmentRuleEvaluator.cpp +namespace rrllvm diff --git a/source/llvm/AssignmentRuleEvaluator.h b/source/llvm/AssignmentRuleEvaluator.h --- a/source/llvm/AssignmentRuleEvaluator.h +++ b/source/llvm/AssignmentRuleEvaluator.h +namespace rrllvm diff --git a/source/llvm/CodeGen.h b/source/llvm/CodeGen.h --- a/source/llvm/CodeGen.h +++ b/source/llvm/CodeGen.h #include "LLVMIncludes.h" +namespace rrllvm diff --git a/source/llvm/CodeGenBase.cpp b/source/llvm/CodeGenBase.cpp --- a/source/llvm/CodeGenBase.cpp +++ b/source/llvm/CodeGenBase.cpp +namespace rrllvm using namespace llvm; diff --git a/source/llvm/CodeGenBase.h b/source/llvm/CodeGenBase.h --- a/source/llvm/CodeGenBase.h +++ b/source/llvm/CodeGenBase.h +namespace rrllvm diff --git a/source/llvm/EvalConversionFactorCodeGen.h b/source/llvm/EvalConversionFactorCodeGen.h --- a/source/llvm/EvalConversionFactorCodeGen.h +++ b/source/llvm/EvalConversionFactorCodeGen.h namespace rrllvm -typedef void (*EvalConversionFactorCodeGen_FunctionPtr)(rr::LLVMModelData*); +typedef void (*EvalConversionFactorCodeGen_FunctionPtr)(LLVMModelData*); llvm::Value *codeGen(); diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp using namespace llvm; +namespace rrllvm LLVMModelDataSymbols::SpeciesReferenceInfo nz = *i; diff --git a/source/llvm/EvalInitialConditionsCodeGen.h b/source/llvm/EvalInitialConditionsCodeGen.h --- a/source/llvm/EvalInitialConditionsCodeGen.h +++ b/source/llvm/EvalInitialConditionsCodeGen.h +namespace rrllvm typedef void (*EvalInitialConditions_FunctionPtr)(LLVMModelData*); diff --git a/source/llvm/EvalRateRuleRatesCodeGen.cpp b/source/llvm/EvalRateRuleRatesCodeGen.cpp --- a/source/llvm/EvalRateRuleRatesCodeGen.cpp +++ b/source/llvm/EvalRateRuleRatesCodeGen.cpp @@ -21,7 +21,7 @@ using namespace llvm; +namespace rrllvm diff --git a/source/llvm/EvalRateRuleRatesCodeGen.h b/source/llvm/EvalRateRuleRatesCodeGen.h --- a/source/llvm/EvalRateRuleRatesCodeGen.h +++ b/source/llvm/EvalRateRuleRatesCodeGen.h +namespace rrllvm typedef void (*EvalRateRuleRates_FunctionPtr)(LLVMModelData*); diff --git a/source/llvm/EvalReactionRatesCodeGen.cpp b/source/llvm/EvalReactionRatesCodeGen.cpp --- a/source/llvm/EvalReactionRatesCodeGen.cpp +++ b/source/llvm/EvalReactionRatesCodeGen.cpp @@ -22,7 +22,7 @@ using namespace llvm; +namespace rrllvm diff --git a/source/llvm/EvalReactionRatesCodeGen.h b/source/llvm/EvalReactionRatesCodeGen.h --- a/source/llvm/EvalReactionRatesCodeGen.h +++ b/source/llvm/EvalReactionRatesCodeGen.h +namespace rrllvm typedef double (*EvalReactionRates_FunctionPtr)(LLVMModelData*); diff --git a/source/llvm/EvalVolatileStoichCodeGen.h b/source/llvm/EvalVolatileStoichCodeGen.h --- a/source/llvm/EvalVolatileStoichCodeGen.h +++ b/source/llvm/EvalVolatileStoichCodeGen.h namespace rrllvm -typedef void (*EvalVolatileStoichCodeGen_FunctionPtr)(rr::LLVMModelData*); +typedef void (*EvalVolatileStoichCodeGen_FunctionPtr)(LLVMModelData*); llvm::Value *codeGen(); diff --git a/source/llvm/EventAssignCodeGen.cpp b/source/llvm/EventAssignCodeGen.cpp --- a/source/llvm/EventAssignCodeGen.cpp +++ b/source/llvm/EventAssignCodeGen.cpp +namespace rrllvm using namespace llvm; diff --git a/source/llvm/EventAssignCodeGen.h b/source/llvm/EventAssignCodeGen.h --- a/source/llvm/EventAssignCodeGen.h +++ b/source/llvm/EventAssignCodeGen.h +namespace rrllvm diff --git a/source/llvm/EventCodeGenBase.h b/source/llvm/EventCodeGenBase.h --- a/source/llvm/EventCodeGenBase.h +++ b/source/llvm/EventCodeGenBase.h +namespace rrllvm typedef void (*EventCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t, double*); diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp namespace rrllvm -Event::Event(rr::LLVMExecutableModel& model, uint id) : +Event::Event(LLVMExecutableModel& model, uint id) : diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h --- a/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h -class LLVMExecutableModel; namespace rrllvm { +class LLVMExecutableModel; - Event(rr::LLVMExecutableModel&, uint id); + Event(LLVMExecutableModel&, uint id); - rr::LLVMExecutableModel& model; + LLVMExecutableModel& model; diff --git a/source/llvm/EventTriggerCodeGen.cpp b/source/llvm/EventTriggerCodeGen.cpp --- a/source/llvm/EventTriggerCodeGen.cpp +++ b/source/llvm/EventTriggerCodeGen.cpp +namespace rrllvm using namespace llvm; diff --git a/source/llvm/EventTriggerCodeGen.h b/source/llvm/EventTriggerCodeGen.h --- a/source/llvm/EventTriggerCodeGen.h +++ b/source/llvm/EventTriggerCodeGen.h +namespace rrllvm typedef void (*EventTriggerCodeGen_FunctionPtr)(LLVMModelData*, int32_t); diff --git a/source/llvm/FunctionResolver.cpp b/source/llvm/FunctionResolver.cpp --- a/source/llvm/FunctionResolver.cpp +++ b/source/llvm/FunctionResolver.cpp #include "LLVMException.h" +namespace rrllvm using namespace llvm; const libsbml::Model* model, llvm::IRBuilder<>& builder) : -llvm::Value* rr::FunctionResolver::loadSymbolValue(const std::string& symbol, +llvm::Value* FunctionResolver::loadSymbolValue(const std::string& symbol, const llvm::ArrayRef& args) diff --git a/source/llvm/FunctionResolver.h b/source/llvm/FunctionResolver.h --- a/source/llvm/FunctionResolver.h +++ b/source/llvm/FunctionResolver.h +namespace rrllvm diff --git a/source/llvm/GetEventValuesCodeGen.cpp b/source/llvm/GetEventValuesCodeGen.cpp --- a/source/llvm/GetEventValuesCodeGen.cpp +++ b/source/llvm/GetEventValuesCodeGen.cpp @@ -17,7 +17,7 @@ using namespace llvm; +namespace rrllvm diff --git a/source/llvm/GetEventValuesCodeGen.h b/source/llvm/GetEventValuesCodeGen.h --- a/source/llvm/GetEventValuesCodeGen.h +++ b/source/llvm/GetEventValuesCodeGen.h +namespace rrllvm typedef double (*GetEventValueCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); diff --git a/source/llvm/GetRateRuleValuesCodeGen.cpp b/source/llvm/GetRateRuleValuesCodeGen.cpp --- a/source/llvm/GetRateRuleValuesCodeGen.cpp +++ b/source/llvm/GetRateRuleValuesCodeGen.cpp +namespace rrllvm diff --git a/source/llvm/GetRateRuleValuesCodeGen.h b/source/llvm/GetRateRuleValuesCodeGen.h --- a/source/llvm/GetRateRuleValuesCodeGen.h +++ b/source/llvm/GetRateRuleValuesCodeGen.h +namespace rrllvm diff --git a/source/llvm/GetValueCodeGenBase.h b/source/llvm/GetValueCodeGenBase.h --- a/source/llvm/GetValueCodeGenBase.h +++ b/source/llvm/GetValueCodeGenBase.h +namespace rrllvm typedef double (*GetValueCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); diff --git a/source/llvm/GetValuesCodeGen.cpp b/source/llvm/GetValuesCodeGen.cpp --- a/source/llvm/GetValuesCodeGen.cpp +++ b/source/llvm/GetValuesCodeGen.cpp using namespace llvm; +namespace rrllvm diff --git a/source/llvm/GetValuesCodeGen.h b/source/llvm/GetValuesCodeGen.h --- a/source/llvm/GetValuesCodeGen.h +++ b/source/llvm/GetValuesCodeGen.h +namespace rrllvm diff --git a/source/llvm/InitialValueSymbolResolver.cpp b/source/llvm/InitialValueSymbolResolver.cpp --- a/source/llvm/InitialValueSymbolResolver.cpp +++ b/source/llvm/InitialValueSymbolResolver.cpp using namespace llvm; +namespace rrllvm diff --git a/source/llvm/InitialValueSymbolResolver.h b/source/llvm/InitialValueSymbolResolver.h --- a/source/llvm/InitialValueSymbolResolver.h +++ b/source/llvm/InitialValueSymbolResolver.h +namespace rrllvm diff --git a/source/llvm/KineticLawParameterResolver.cpp b/source/llvm/KineticLawParameterResolver.cpp --- a/source/llvm/KineticLawParameterResolver.cpp +++ b/source/llvm/KineticLawParameterResolver.cpp using namespace llvm; +namespace rrllvm diff --git a/source/llvm/KineticLawParameterResolver.h b/source/llvm/KineticLawParameterResolver.h --- a/source/llvm/KineticLawParameterResolver.h +++ b/source/llvm/KineticLawParameterResolver.h +namespace rrllvm diff --git a/source/llvm/LLVMCompiler.cpp b/source/llvm/LLVMCompiler.cpp --- a/source/llvm/LLVMCompiler.cpp +++ b/source/llvm/LLVMCompiler.cpp #include "LLVMCompiler.h" +namespace rrllvm LLVMCompiler::LLVMCompiler() diff --git a/source/llvm/LLVMCompiler.h b/source/llvm/LLVMCompiler.h --- a/source/llvm/LLVMCompiler.h +++ b/source/llvm/LLVMCompiler.h +namespace rrllvm class RR_DECLSPEC LLVMCompiler: public rr::Compiler diff --git a/source/llvm/LLVMException.h b/source/llvm/LLVMException.h --- a/source/llvm/LLVMException.h +++ b/source/llvm/LLVMException.h +namespace rrllvm class LLVMException: public std::runtime_error #define throw_llvm_exception(what) \ throw LLVMException(_err_msg); } diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp +namespace rrllvm static int getValues(LLVMModelData* modelData, double (*funcPtr)(LLVMModelData*, int), @@ -268,7 +272,7 @@ string LLVMExecutableModel::getInfo() int LLVMExecutableModel::getFloatingSpeciesIndex(const string& allocator) + throw LLVMException(string("Not Implemented: ") + __FUNCTION__); @@ -292,14 +296,14 @@ string LLVMExecutableModel::getBoundarySpeciesId(int indx) int LLVMExecutableModel::getBoundarySpeciesCompartmentIndex(int int1) + throw LLVMException(string("Not Implemented: ") + __FUNCTION__); int LLVMExecutableModel::getGlobalParameterIndex(const string& allocator) + throw LLVMException(string("Not Implemented: ") + __FUNCTION__); @@ -320,7 +324,7 @@ string LLVMExecutableModel::getGlobalParameterId(int id) int LLVMExecutableModel::getCompartmentIndex(const string& allocator) + throw LLVMException(string("Not Implemented: ") + __FUNCTION__); @@ -341,7 +345,7 @@ string LLVMExecutableModel::getCompartmentId(int id) int LLVMExecutableModel::getReactionIndex(const string& allocator) + throw LLVMException(string("Not Implemented: ") + __FUNCTION__); @@ -486,7 +490,7 @@ int LLVMExecutableModel::setFloatingSpeciesConcentrations(int len, + throw LLVMException(string("Not Implemented: ") + __FUNCTION__); @@ -506,7 +510,7 @@ int LLVMExecutableModel::setBoundarySpeciesConcentrations(int len, + throw LLVMException(string("Not Implemented: ") + __FUNCTION__); @@ -520,7 +524,7 @@ int LLVMExecutableModel::setGlobalParameterValues(int len, const int* indx, + throw LLVMException(string("Not Implemented: ") + __FUNCTION__); @@ -545,7 +549,7 @@ int LLVMExecutableModel::getReactionRates(int len, const int* indx, + throw LLVMException("index out of range"); @@ -656,7 +660,7 @@ int LLVMExecutableModel::getEventTriggers(int len, const int *indx, unsigned cha + throw LLVMException("index out of range"); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h +namespace rrllvm -class RR_DECLSPEC LLVMExecutableModel: public ExecutableModel +class RR_DECLSPEC LLVMExecutableModel: public rr::ExecutableModel - rrllvm::EvalVolatileStoichCodeGen::FunctionPtr evalVolatileStoichPtr; - rrllvm::EvalConversionFactorCodeGen::FunctionPtr evalConversionFactorPtr; diff --git a/source/llvm/LLVMIncludes.h b/source/llvm/LLVMIncludes.h --- a/source/llvm/LLVMIncludes.h +++ b/source/llvm/LLVMIncludes.h #include #include +namespace rrllvm { * C++ 11 style to_string for LLVM types diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp +namespace rrllvm void LLVMModelData::init(LLVMModelData &data) - memset(&data, 0, sizeof(rr::LLVMModelData)); + memset(&data, 0, sizeof(LLVMModelData)); diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h +namespace rrllvm struct LLVMModelData; @@ -149,7 +150,7 @@ struct LLVMModelData diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp using namespace llvm; -static std::vector getIds(const rr::LLVMModelDataSymbols::StringUIntMap & m) +static std::vector getIds(const rrllvm::LLVMModelDataSymbols::StringUIntMap & m) - for(rr::LLVMModelDataSymbols::StringUIntMap::const_iterator i = m.begin(); + for(rrllvm::LLVMModelDataSymbols::StringUIntMap::const_iterator i = m.begin(); @@ -74,7 +79,7 @@ static std::vector getIds(const rr::LLVMModelDataSymbols::StringUIn +namespace rrllvm LLVMModelDataSymbols::LLVMModelDataSymbols() : @@ -261,7 +266,7 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h +namespace rrllvm diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp #include "LLVMIncludes.h" -using namespace rrllvm; +namespace rrllvm LLVMModelGenerator::LLVMModelGenerator() diff --git a/source/llvm/LLVMModelGenerator.h b/source/llvm/LLVMModelGenerator.h --- a/source/llvm/LLVMModelGenerator.h +++ b/source/llvm/LLVMModelGenerator.h #include "LLVMCompiler.h" +namespace rrllvm * No effect on LLVM generator. diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp using namespace llvm; +namespace rrllvm LLVMModelSymbols::LLVMModelSymbols(const libsbml::Model *m, LLVMModelDataSymbols const &sym) : @@ -175,7 +178,7 @@ bool LLVMModelSymbols::visit(const libsbml::Reaction& r) @@ -206,7 +209,7 @@ bool LLVMModelSymbols::visit(const libsbml::Reaction& r) diff --git a/source/llvm/LLVMModelSymbols.h b/source/llvm/LLVMModelSymbols.h --- a/source/llvm/LLVMModelSymbols.h +++ b/source/llvm/LLVMModelSymbols.h +namespace rrllvm diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp using namespace llvm; +namespace rrllvm const char* ModelDataIRBuilder::LLVMModelDataName = "rr::LLVMModelData"; diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h +namespace rrllvm diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp using namespace llvm; +namespace rrllvm ModelDataLoadSymbolResolver::ModelDataLoadSymbolResolver(llvm::Value *modelData, diff --git a/source/llvm/ModelDataSymbolResolver.h b/source/llvm/ModelDataSymbolResolver.h --- a/source/llvm/ModelDataSymbolResolver.h +++ b/source/llvm/ModelDataSymbolResolver.h +namespace rrllvm diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp @@ -24,7 +24,7 @@ using namespace llvm; +namespace rrllvm executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispIntDecl(module), (void*)dispInt); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispDoubleDecl(module), (void*)dispDouble); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispCharDecl(module), (void*)dispChar); diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h +namespace rrllvm diff --git a/source/llvm/SetRateRuleValuesCodeGen.cpp b/source/llvm/SetRateRuleValuesCodeGen.cpp --- a/source/llvm/SetRateRuleValuesCodeGen.cpp +++ b/source/llvm/SetRateRuleValuesCodeGen.cpp +namespace rrllvm diff --git a/source/llvm/SetRateRuleValuesCodeGen.h b/source/llvm/SetRateRuleValuesCodeGen.h --- a/source/llvm/SetRateRuleValuesCodeGen.h +++ b/source/llvm/SetRateRuleValuesCodeGen.h +namespace rrllvm diff --git a/source/llvm/SymbolForest.h b/source/llvm/SymbolForest.h --- a/source/llvm/SymbolForest.h +++ b/source/llvm/SymbolForest.h +namespace rrllvm diff --git a/source/llvm_testing/src/LLVMCSRMatrixTest.h b/source/llvm_testing/src/LLVMCSRMatrixTest.h --- a/source/llvm_testing/src/LLVMCSRMatrixTest.h +++ b/source/llvm_testing/src/LLVMCSRMatrixTest.h #include "llvm/LLVMIncludes.h" #include "llvm/ModelGeneratorContext.h" +using namespace rrllvm; diff --git a/source/llvm_testing/src/tests.cpp b/source/llvm_testing/src/tests.cpp --- a/source/llvm_testing/src/tests.cpp +++ b/source/llvm_testing/src/tests.cpp using namespace llvm; +using namespace rrllvm; if (ucomp == "LLVM") Log(Logger::PRIO_NOTICE) << "Creating LLVM based model generator."; - return new LLVMModelGenerator(); + return new rrllvm::LLVMModelGenerator(); -set(LLVM_MIN_VERSION "3000000") -set(LLVM_MIN_VERSION_TEXT "3.0") -find_package(LLVM) -# should we use LLVM ? -option (BUILD_LLVM "Build the optional LLVM back end (Should build, but not fully implemented yet)" OFF) -if(BUILD_LLVM AND NOT LLVM_FOUND) - message(FATAL_ERROR "BUILD_LLVM is enabled, but no LLVM installation was found") -if(BUILD_LLVM) - message(STATUS "using LLVM, version ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}") - add_definitions(${LLVM_CXXFLAGS}) - include_directories(${LLVM_INCLUDE_DIR}) - message(STATUS "NOT using LLVM") -endif(BUILD_LLVM) +set(LLVM_MIN_VERSION "3000000") +set(LLVM_MIN_VERSION_TEXT "3.0") +find_package(LLVM) +# should we use LLVM ? +option (BUILD_LLVM "Build the optional LLVM back end (Should build, but not fully implemented yet)" OFF) +if(BUILD_LLVM AND NOT LLVM_FOUND) + message(FATAL_ERROR "BUILD_LLVM is enabled, but no LLVM installation was found") +if(BUILD_LLVM) + message(STATUS "using LLVM, version ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}") + add_definitions(-DBUILD_LLVM) + add_definitions(${LLVM_CXXFLAGS}) + include_directories(${LLVM_INCLUDE_DIR}) + message(STATUS "NOT using LLVM") +endif(BUILD_LLVM) diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.2_Debug_gfeature-llvm_2013-07-11_21-25.xml b/reports/macosx_amd64/c_tests_GNU_4.7.2_Debug_gfeature-llvm_2013-07-11_21-25.xml +++ b/reports/macosx_amd64/c_tests_GNU_4.7.2_Debug_gfeature-llvm_2013-07-11_21-25.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-09_18-30.xml b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-09_18-30.xml +++ b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-09_18-30.xml diff --git a/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-11_00-05.xml b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-11_00-05.xml +++ b/reports/macosx_amd64/c_tests_GNU_4.7.3_Debug_gfeature-llvm_2013-07-11_00-05.xml -# Add the LLVM sources to compilation -if(BUILD_LLVM) - rrLLVMAssignmentRuleEvaluator - rrLLVMASTNodeCodeGen - rrLLVMCodeGenerator - rrLLVMCompiler - rrLLVMExecutableModel - rrLLVMInitialValueCodeGen - rrLLVMModelDataIRBuilder - rrLLVMModelDataSymbols - rrLLVMModelGenerator - rrLLVMModelGeneratorContext -endif(BUILD_LLVM) - if(BUILD_LLVM) - ${LLVM_LIBRARIES} - endif(BUILD_LLVM) -if(BUILD_LLVM) - ${LLVM_LIBRARIES} -endif(BUILD_LLVM) -if(BUILD_LLVM) - add_subdirectory(llvm_testing) -endif(BUILD_LLVM) +# Add the LLVM sources to compilation +if(BUILD_LLVM) + llvm/AssignmentRuleEvaluator + llvm/ASTNodeCodeGen + llvm/ASTNodeFactory + llvm/CodeGenBase + llvm/LLVMCompiler + llvm/EvalConversionFactorCodeGen + llvm/EvalInitialConditionsCodeGen + llvm/EvalRateRuleRatesCodeGen + llvm/EvalReactionRatesCodeGen + llvm/EventAssignCodeGen + llvm/EventTriggerCodeGen + llvm/EventQueue + llvm/FunctionResolver + llvm/LLVMExecutableModel + llvm/GetRateRuleValuesCodeGen + llvm/GetValuesCodeGen + llvm/GetEventValuesCodeGen + llvm/InitialValueSymbolResolver + llvm/KineticLawParameterResolver + llvm/LLVMModelData + llvm/ModelDataIRBuilder + llvm/ModelDataSymbolResolver + llvm/LLVMModelDataSymbols + llvm/LLVMModelGenerator + llvm/ModelGeneratorContext + llvm/LLVMModelSymbols + llvm/SetRateRuleValuesCodeGen + llvm/SBMLSupportFunctions + llvm/EvalVolatileStoichCodeGen +endif(BUILD_LLVM) + if(BUILD_LLVM) + ${LLVM_LIBRARIES} + endif(BUILD_LLVM) +if(BUILD_LLVM) + ${LLVM_LIBRARIES} +endif(BUILD_LLVM) +if(BUILD_LLVM) + add_subdirectory(llvm_testing) +endif(BUILD_LLVM) - * size in LLVM land. + * Only used in the LLVM version. + * In the LLVM version, this is just a pointer to a data block * LLVM specific diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp + * rrLLVMCodeGenerator.cpp +#include "LLVMException.h" +#include "LLVMIncludes.h" +using namespace llvm; +ASTNodeCodeGen::ASTNodeCodeGen(llvm::IRBuilder<> &builder, +llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) + throw_llvm_exception("ASTNode is NULL"); + throw_llvm_exception(msg.str()); +llvm::Value* ASTNodeCodeGen::notImplemented(const libsbml::ASTNode* ast) + throw_llvm_exception("AST type Not Implemented Yet: " + str); +llvm::Value* ASTNodeCodeGen::nameExprCodeGen(const libsbml::ASTNode* ast) + throw_llvm_exception(string(ast->getName()) + +llvm::Value* ASTNodeCodeGen::realExprCodeGen(const libsbml::ASTNode* ast) +llvm::Value* ASTNodeCodeGen::integerCodeGen(const libsbml::ASTNode* ast) +llvm::Value* ASTNodeCodeGen::applyArithmeticCodeGen( + throw_llvm_exception(err.str()); +llvm::Value* ASTNodeCodeGen::applyRelationalCodeGen(const libsbml::ASTNode* ast) +llvm::Value* ASTNodeCodeGen::applyLogicalCodeGen(const libsbml::ASTNode* ast) + throw_llvm_exception(msg); + throw_llvm_exception(msg); +llvm::Value* ASTNodeCodeGen::functionCallCodeGen(const libsbml::ASTNode* ast) +llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode *ast) + throw_llvm_exception(msg); + throw_llvm_exception(msg); + throw_llvm_exception(err.str()); +llvm::Value* ASTNodeCodeGen::toBoolean(llvm::Value* value) +llvm::Module* ASTNodeCodeGen::getModule() + throw_llvm_exception("could not get module, a BasicBlock is not currently being populated."); +llvm::Value* ASTNodeCodeGen::piecewiseCodeGen(const libsbml::ASTNode* ast) + LLVMContext &context = builder.getContext(); diff --git a/source/llvm/ASTNodeCodeGen.h b/source/llvm/ASTNodeCodeGen.h +++ b/source/llvm/ASTNodeCodeGen.h +#include "LLVMIncludes.h" + * All of the LLVM IR generation is handled here. + ASTNodeCodeGen(llvm::IRBuilder<> &builder, + llvm::Value *codeGen(const libsbml::ASTNode *ast); + llvm::Value *binaryExprCodeGen(const libsbml::ASTNode *ast); + llvm::Value *notImplemented(const libsbml::ASTNode *ast); + llvm::Value *nameExprCodeGen(const libsbml::ASTNode *ast); + llvm::Value *realExprCodeGen(const libsbml::ASTNode *ast); + llvm::Value *integerCodeGen(const libsbml::ASTNode *ast); + llvm::Value *applyArithmeticCodeGen(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); + llvm::IRBuilder<> &builder; + llvm::Module *getModule(); diff --git a/source/llvm/ASTNodeFactory.cpp b/source/llvm/ASTNodeFactory.cpp +++ b/source/llvm/ASTNodeFactory.cpp diff --git a/source/llvm/ASTNodeFactory.h b/source/llvm/ASTNodeFactory.h +++ b/source/llvm/ASTNodeFactory.h + * rrLLVMASTNodeFactory.h +#ifndef LLVMASTNodeFactoryH +#define LLVMASTNodeFactoryH +#endif /* LLVMASTNodeFactoryH */ diff --git a/source/rrLLVMAssignmentRuleEvaluator.cpp b/source/llvm/AssignmentRuleEvaluator.cpp rename from source/rrLLVMAssignmentRuleEvaluator.cpp rename to source/llvm/AssignmentRuleEvaluator.cpp --- a/source/rrLLVMAssignmentRuleEvaluator.cpp +++ b/source/llvm/AssignmentRuleEvaluator.cpp - * rrLLVMAssignmentRuleEvaluator.cpp -#include "rrLLVMAssignmentRuleEvaluator.h" -LLVMAssignmentRuleEvaluator::LLVMAssignmentRuleEvaluator( - LLVMSymbolForest& symbols) : -void LLVMAssignmentRuleEvaluator::evaluate(const Model& model) -bool LLVMAssignmentRuleEvaluator::visit(const AssignmentRule& x) diff --git a/source/rrLLVMAssignmentRuleEvaluator.h b/source/llvm/AssignmentRuleEvaluator.h rename from source/rrLLVMAssignmentRuleEvaluator.h rename to source/llvm/AssignmentRuleEvaluator.h --- a/source/rrLLVMAssignmentRuleEvaluator.h +++ b/source/llvm/AssignmentRuleEvaluator.h - * rrLLVMAssignmentRuleEvaluator.h #ifndef LLVMAssignmentRuleEvaluatorH #define LLVMAssignmentRuleEvaluatorH -#include "rrLLVMSymbolForest.h" -class LLVMAssignmentRuleEvaluator : public libsbml::SBMLVisitor - LLVMAssignmentRuleEvaluator(LLVMSymbolForest &symbols); - LLVMSymbolForest &symbols; diff --git a/source/llvm/CodeGen.h b/source/llvm/CodeGen.h +++ b/source/llvm/CodeGen.h +#include "LLVMIncludes.h" + virtual llvm::Value *codeGen() = 0; + virtual llvm::Value *loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args = + llvm::ArrayRef()) = 0; + virtual llvm::Value *storeSymbolValue(const std::string& symbol, + llvm::Value *value) = 0; +#endif /* LLVMCodeGenH */ diff --git a/source/llvm/CodeGenBase.cpp b/source/llvm/CodeGenBase.cpp +++ b/source/llvm/CodeGenBase.cpp + * rrLLVMCodeGenBase.cpp +#include "LLVMException.h" +using namespace llvm; +class LLVMCodeGenTest + LLVMCodeGenTest(const ModelGeneratorContext &mgc) : + const LLVMModelDataSymbols &dataSymbols; + const LLVMModelSymbols &modelSymbols; + llvm::LLVMContext &context; + llvm::Module *module; + llvm::IRBuilder<> &builder; + llvm::ExecutionEngine &engine; + void codeGenHeader(const char* functionName, llvm::Type *retType, + llvm::Type (*argTypes)[N], + llvm::Value (*args)[N]) + for (llvm::Function::arg_iterator ai = func->arg_begin(); + llvm::Value *arg = ai; + virtual ~LLVMCodeGenTest() {}; + LLVMCodeGenTest::test(vars, out); diff --git a/source/llvm/CodeGenBase.h b/source/llvm/CodeGenBase.h +++ b/source/llvm/CodeGenBase.h +#ifndef LLVMCodeGenBaseH +#define LLVMCodeGenBaseH +#include "LLVMException.h" + llvm::Function *func = (llvm::Function*)codeGen(); + const LLVMModelDataSymbols &dataSymbols; + const LLVMModelSymbols &modelSymbols; + llvm::LLVMContext &context; + llvm::Module *module; + llvm::IRBuilder<> &builder; + llvm::ExecutionEngine &engine; + llvm::Function *function; + virtual llvm::Value *codeGen() = 0; + llvm::BasicBlock *codeGenHeader(const char* functionName, + llvm::Type *retType, + llvm::Type* (&argTypes)[N], + llvm::Value* (&args)[N]) + llvm::FunctionType *funcType = llvm::FunctionType::get(retType, + function = llvm::Function::Create(funcType, + llvm::Function::InternalLinkage, + llvm::BasicBlock *basicBlock = llvm::BasicBlock::Create(context, + for (llvm::Function::arg_iterator ai = function->arg_begin(); + llvm::Value *arg = ai; + llvm::BasicBlock *codeGenVoidModelDataHeader(const char* functionName, + llvm::Value* &modelData) + llvm::Type *argTypes[] = { + llvm::PointerType::get( + llvm::Value *args[] = { 0 }; + llvm::BasicBlock *basicBlock = codeGenHeader(functionName, + llvm::Type::getVoidTy(context), + llvm::Function *verifyFunction() + if (llvm::verifyFunction(*function, llvm::AbortProcessAction)) + throw LLVMException("Generated function is corrupt, see stderr", +#endif /* LLVMCodeGenBaseH */ diff --git a/source/llvm/EvalConversionFactorCodeGen.cpp b/source/llvm/EvalConversionFactorCodeGen.cpp +++ b/source/llvm/EvalConversionFactorCodeGen.cpp +#include "LLVMException.h" +namespace rrllvm +using namespace llvm; +} /* namespace rrllvm */ diff --git a/source/llvm/EvalConversionFactorCodeGen.h b/source/llvm/EvalConversionFactorCodeGen.h +++ b/source/llvm/EvalConversionFactorCodeGen.h +namespace rrllvm +typedef void (*EvalConversionFactorCodeGen_FunctionPtr)(rr::LLVMModelData*); + llvm::Value *codeGen(); +} /* namespace rrllvm */ diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp +#include "LLVMException.h" +using namespace llvm; + llvm::Value *modelData, ModelDataStoreSymbolResolver& modelDataResolver) + list stoichEntries = + for (list::iterator i = + LLVMModelDataSymbols::SpeciesReferenceInfo nz = *i; + // createCSRMatrixSetNZ(llvm::Value *csrPtr, llvm::Value *row, + // llvm::Value *col, llvm::Value *value, const char* name = 0); diff --git a/source/llvm/EvalInitialConditionsCodeGen.h b/source/llvm/EvalInitialConditionsCodeGen.h +++ b/source/llvm/EvalInitialConditionsCodeGen.h +typedef void (*EvalInitialConditions_FunctionPtr)(LLVMModelData*); + * fields in the LLVMModelData structure. + llvm::Value *codeGen(); + void codeGenStoichiometry(llvm::Value *modelData, diff --git a/source/llvm/EvalRateRuleRatesCodeGen.cpp b/source/llvm/EvalRateRuleRatesCodeGen.cpp +++ b/source/llvm/EvalRateRuleRatesCodeGen.cpp + * rrLLVMEvalRateRuleRatesCodeGen.cpp +#include "LLVMException.h" +using namespace llvm; diff --git a/source/llvm/EvalRateRuleRatesCodeGen.h b/source/llvm/EvalRateRuleRatesCodeGen.h +++ b/source/llvm/EvalRateRuleRatesCodeGen.h +#ifndef RRLLVMEVALRATERULERATESCODEGEN_H_ +#define RRLLVMEVALRATERULERATESCODEGEN_H_ +typedef void (*EvalRateRuleRates_FunctionPtr)(LLVMModelData*); + llvm::Value *codeGen(); +#endif /* RRLLVMEVALRATERULERATESCODEGEN_H_ */ diff --git a/source/llvm/EvalReactionRatesCodeGen.cpp b/source/llvm/EvalReactionRatesCodeGen.cpp +++ b/source/llvm/EvalReactionRatesCodeGen.cpp +#include "LLVMException.h" +using namespace llvm; + // single arg type of LLVMModelData* + llvm::Type *argTypes[] = { + llvm::PointerType::get( + llvm::Value *args[] = { 0 }; + codeGenHeader(FunctionName, llvm::Type::getDoubleTy(context), diff --git a/source/llvm/EvalReactionRatesCodeGen.h b/source/llvm/EvalReactionRatesCodeGen.h +++ b/source/llvm/EvalReactionRatesCodeGen.h +typedef double (*EvalReactionRates_FunctionPtr)(LLVMModelData*); + llvm::Value *codeGen(); +#endif /* rrLLVMEvalReactionRatesCodeGen */ diff --git a/source/llvm/EvalVolatileStoichCodeGen.cpp b/source/llvm/EvalVolatileStoichCodeGen.cpp +++ b/source/llvm/EvalVolatileStoichCodeGen.cpp +#include "LLVMException.h" +namespace rrllvm +using namespace llvm; + const LLVMModelDataSymbols::SpeciesReferenceInfo &info = + const LLVMModelDataSymbols::SpeciesReferenceInfo &info = +} /* namespace rrllvm */ diff --git a/source/llvm/EvalVolatileStoichCodeGen.h b/source/llvm/EvalVolatileStoichCodeGen.h +++ b/source/llvm/EvalVolatileStoichCodeGen.h +namespace rrllvm +typedef void (*EvalVolatileStoichCodeGen_FunctionPtr)(rr::LLVMModelData*); + llvm::Value *codeGen(); +} /* namespace rrllvm */ diff --git a/source/llvm/EventAssignCodeGen.cpp b/source/llvm/EventAssignCodeGen.cpp +++ b/source/llvm/EventAssignCodeGen.cpp +using namespace llvm; +bool EventAssignCodeGen::eventCodeGen(llvm::Value *modelData, + llvm::Value *data, const libsbml::Event *event) diff --git a/source/llvm/EventAssignCodeGen.h b/source/llvm/EventAssignCodeGen.h +++ b/source/llvm/EventAssignCodeGen.h + bool eventCodeGen(llvm::Value *modelData, llvm::Value *data, diff --git a/source/llvm/EventCodeGenBase.h b/source/llvm/EventCodeGenBase.h +++ b/source/llvm/EventCodeGenBase.h +#include "LLVMException.h" +typedef void (*EventCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t, double*); + llvm::Value *codeGen(); + bool eventCodeGen (llvm::Value *modelData, llvm::Value *data, +llvm::Value *EventCodeGenBase::codeGen() + llvm::Type *argTypes[] = { + llvm::PointerType::get(ModelDataIRBuilder::getStructType(this->module), 0), + llvm::Type::getInt32Ty(this->context), + llvm::Type::getDoublePtrTy(this->context) + llvm::Value *args[] = {0, 0, 0}; + llvm::Type *retType = llvm::Type::getVoidTy(context); + llvm::BasicBlock *entry = this->codeGenHeader(Derived::FunctionName, retType, + llvm::BasicBlock *def = llvm::BasicBlock::Create(this->context, "default", this->function); + llvm::SwitchInst *s = this->builder.CreateSwitch(args[1], def, events->size()); + llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, block_name, this->function); + s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), i), block); diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp +#include "LLVMExecutableModel.h" +namespace rrllvm +Event::Event(rr::LLVMExecutableModel& model, uint id) : + bool operator()(const rrllvm::Event& event) const diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h +class LLVMExecutableModel; +namespace rrllvm { + Event(rr::LLVMExecutableModel&, uint id); + rr::LLVMExecutableModel& model; + typedef std::list _Sequence; +} /* namespace rrllvm */ diff --git a/source/llvm/EventTriggerCodeGen.cpp b/source/llvm/EventTriggerCodeGen.cpp +++ b/source/llvm/EventTriggerCodeGen.cpp +using namespace llvm; +bool EventTriggerCodeGen::eventCodeGen(llvm::Value *modelData, + llvm::Value *data, const libsbml::Event* event) diff --git a/source/llvm/EventTriggerCodeGen.h b/source/llvm/EventTriggerCodeGen.h +++ b/source/llvm/EventTriggerCodeGen.h +typedef void (*EventTriggerCodeGen_FunctionPtr)(LLVMModelData*, int32_t); + bool eventCodeGen(llvm::Value *modelData, llvm::Value *data, diff --git a/source/llvm/FunctionResolver.cpp b/source/llvm/FunctionResolver.cpp +++ b/source/llvm/FunctionResolver.cpp +#include "LLVMException.h" +using namespace llvm; + const libsbml::Model* model, llvm::IRBuilder<>& builder) : +llvm::Value* rr::FunctionResolver::loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args) + throw_llvm_exception("math elemetn of function definition must be a lambda"); + throw_llvm_exception("argument count does not match"); diff --git a/source/llvm/FunctionResolver.h b/source/llvm/FunctionResolver.h +++ b/source/llvm/FunctionResolver.h + const libsbml::Model *model, llvm::IRBuilder<> &builder); + virtual llvm::Value *loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args = + llvm::ArrayRef()); + llvm::IRBuilder<> &builder; + std::map *symbols; diff --git a/source/llvm/GetEventValuesCodeGen.cpp b/source/llvm/GetEventValuesCodeGen.cpp +++ b/source/llvm/GetEventValuesCodeGen.cpp +#include "LLVMException.h" +using namespace llvm; +llvm::Type *GetEventTriggerCodeGen::getRetType() + return llvm::Type::getInt8Ty(context); +llvm::Value *GetEventTriggerCodeGen::createRet(llvm::Value *value) + return llvm::ConstantInt::get(getRetType(), 0xff, false); diff --git a/source/llvm/GetEventValuesCodeGen.h b/source/llvm/GetEventValuesCodeGen.h +++ b/source/llvm/GetEventValuesCodeGen.h +#ifndef RRLLVMGETEVENTVALUECODEGENBASE_H_ +#define RRLLVMGETEVENTVALUECODEGENBASE_H_ +#include "LLVMException.h" +typedef double (*GetEventValueCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); + llvm::Value *codeGen(); + llvm::Type *getRetType() + return llvm::Type::getDoubleTy(this->context); + llvm::Value *createRet(llvm::Value* value) + llvm::ConstantFP::get(this->context, llvm::APFloat(123.456)); +llvm::Value *GetEventValueCodeGenBase::codeGen() + llvm::Type *argTypes[] = { + llvm::PointerType::get(ModelDataIRBuilder::getStructType(this->module), 0), + llvm::Type::getInt32Ty(this->context) + llvm::Value *args[] = {0, 0}; + llvm::Type *retType = static_cast(this)->getRetType(); + llvm::BasicBlock *entry = this->codeGenHeader(Derived::FunctionName, retType, + llvm::BasicBlock *def = llvm::BasicBlock::Create(this->context, "default", this->function); + llvm::Value *defRet = static_cast(this)->createRet(0); + llvm::SwitchInst *s = this->builder.CreateSwitch(args[1], def, events->size()); + llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, block_name, this->function); + llvm::Value *value = astCodeGen.codeGen(math); + s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), i), block); +typedef unsigned char (*GetEventTriggerCodeGen_FunctionPtr)(LLVMModelData*, int32_t); + llvm::Type *getRetType(); + llvm::Value *createRet(llvm::Value*); +#endif /* RRLLVMGETVALUECODEGENBASE_H_ */ diff --git a/source/llvm/GetRateRuleValuesCodeGen.cpp b/source/llvm/GetRateRuleValuesCodeGen.cpp +++ b/source/llvm/GetRateRuleValuesCodeGen.cpp diff --git a/source/llvm/GetRateRuleValuesCodeGen.h b/source/llvm/GetRateRuleValuesCodeGen.h +++ b/source/llvm/GetRateRuleValuesCodeGen.h + typedef void (*FunctionPtr)(LLVMModelData*); diff --git a/source/llvm/GetValueCodeGenBase.h b/source/llvm/GetValueCodeGenBase.h +++ b/source/llvm/GetValueCodeGenBase.h +#ifndef RRLLVMGETVALUECODEGENBASE_H_ +#define RRLLVMGETVALUECODEGENBASE_H_ +#include "LLVMException.h" +typedef double (*GetValueCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); + llvm::Value *codeGen(); +llvm::Value* GetValueCodeGenBase::codeGen() + llvm::Type *argTypes[] = { + llvm::PointerType::get(ModelDataIRBuilder::getStructType(this->module), 0), + llvm::Type::getInt32Ty(this->context) + llvm::Value *args[] = {0, 0}; + llvm::BasicBlock *entry = this->codeGenHeader(Derived::FunctionName, llvm::Type::getDoubleTy(this->context), + llvm::BasicBlock *def = llvm::BasicBlock::Create(this->context, "default", this->function); + this->builder.CreateRet(llvm::ConstantFP::get(this->context, llvm::APFloat(123.456))); + llvm::SwitchInst *s = this->builder.CreateSwitch(args[1], def, ids.size()); + llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, ids[i] + "_block", this->function); + llvm::Value *value = resolver.loadSymbolValue(ids[i]); + llvm::Value *comp = resolver.loadSymbolValue(species->getCompartment()); + llvm::Value *comp = resolver.loadSymbolValue(species->getCompartment()); + s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), i), block); +#endif /* RRLLVMGETVALUECODEGENBASE_H_ */ diff --git a/source/llvm/GetValuesCodeGen.cpp b/source/llvm/GetValuesCodeGen.cpp +++ b/source/llvm/GetValuesCodeGen.cpp +#include "LLVMException.h" +using namespace llvm; diff --git a/source/llvm/GetValuesCodeGen.h b/source/llvm/GetValuesCodeGen.h +++ b/source/llvm/GetValuesCodeGen.h +#ifndef RRLLVMGETBOUNDARYSPECIESAMOUNTSCODEGEN_H_ +#define RRLLVMGETBOUNDARYSPECIESAMOUNTSCODEGEN_H_ +#endif /* RRLLVMGETBOUNDARYSPECIESAMOUNTSCODEGEN_H_ */ diff --git a/source/llvm/InitialValueSymbolResolver.cpp b/source/llvm/InitialValueSymbolResolver.cpp +++ b/source/llvm/InitialValueSymbolResolver.cpp +#include "LLVMException.h" +using namespace llvm; + const LLVMModelDataSymbols& modelDataSymbols, + const LLVMModelSymbols& modelSymbols, + llvm::IRBuilder<>& builder) : +llvm::Value* InitialValueSymbolResolver::loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args) + throw_llvm_exception(msg); diff --git a/source/llvm/InitialValueSymbolResolver.h b/source/llvm/InitialValueSymbolResolver.h +++ b/source/llvm/InitialValueSymbolResolver.h +#include "LLVMIncludes.h" +#include "LLVMModelDataSymbols.h" +#include "LLVMModelSymbols.h" + const LLVMModelDataSymbols &modelDataSymbols, + const LLVMModelSymbols &modelSymbols, llvm::IRBuilder<> &builder); + virtual llvm::Value *loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args = + llvm::ArrayRef()); + const LLVMModelDataSymbols &modelDataSymbols; + const LLVMModelSymbols &modelSymbols; + llvm::IRBuilder<> &builder; diff --git a/source/llvm/KineticLawParameterResolver.cpp b/source/llvm/KineticLawParameterResolver.cpp +++ b/source/llvm/KineticLawParameterResolver.cpp +#include "LLVMIncludes.h" +using namespace llvm; + const libsbml::KineticLaw& kineticLaw, llvm::IRBuilder<>& builder) : +llvm::Value* KineticLawParameterResolver::loadSymbolValue( + const std::string& symbol, const llvm::ArrayRef& args) diff --git a/source/llvm/KineticLawParameterResolver.h b/source/llvm/KineticLawParameterResolver.h +++ b/source/llvm/KineticLawParameterResolver.h + const libsbml::KineticLaw &kineticLaw, llvm::IRBuilder<> &builder); + virtual llvm::Value *loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args = + llvm::ArrayRef()); + llvm::IRBuilder<> &builder; diff --git a/source/llvm/LLVMCompiler.cpp b/source/llvm/LLVMCompiler.cpp +++ b/source/llvm/LLVMCompiler.cpp + * LLVMCompiler.cpp +#include "LLVMCompiler.h" +LLVMCompiler::LLVMCompiler() +LLVMCompiler::~LLVMCompiler() +std::string LLVMCompiler::getCompiler() const + return "LLVM"; +bool LLVMCompiler::setCompiler(const std::string& compiler) +std::string LLVMCompiler::getCompilerLocation() const +bool LLVMCompiler::setCompilerLocation(const std::string& path) +std::string LLVMCompiler::getSupportCodeFolder() const +bool LLVMCompiler::setSupportCodeFolder(const std::string& path) +std::string LLVMCompiler::gurgle() diff --git a/source/llvm/LLVMCompiler.h b/source/llvm/LLVMCompiler.h +++ b/source/llvm/LLVMCompiler.h + * LLVMCompiler.h +#ifndef LLVMCompilerH +#define LLVMCompilerH +class RR_DECLSPEC LLVMCompiler: public rr::Compiler + LLVMCompiler(); + virtual ~LLVMCompiler(); + * All these file paths are useless to LLVM, so make some use out +#endif /* LLVMCompilerH */ diff --git a/source/rrLLVMException.h b/source/llvm/LLVMException.h rename from source/rrLLVMException.h rename to source/llvm/LLVMException.h --- a/source/rrLLVMException.h +++ b/source/llvm/LLVMException.h - * rrLLVMException.h + * LLVMException.h #define RRLLVMEXCEPTION_H_ +#define throw_llvm_exception(what) \ + throw LLVMException(_err_msg); } #endif /* RRLLVMEXCEPTION_H_ */ diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp + * LLVMExecutableModel.cpp +#include "LLVMExecutableModel.h" +#include "LLVMIncludes.h" +#include "LLVMException.h" +static int getValues(LLVMModelData* modelData, double (*funcPtr)(LLVMModelData*, int), +LLVMExecutableModel::LLVMExecutableModel() : + LLVMModelData::init(modelData); +LLVMExecutableModel::~LLVMExecutableModel() + Log(Logger::PRIO_WARNING) << "Non-empty LLVM ExecutionEngine error string: " << *errStr; + LLVMModelData::freeBuffers(modelData); +string LLVMExecutableModel::getModelName() +void LLVMExecutableModel::setTime(double time) +double LLVMExecutableModel::getTime() +int LLVMExecutableModel::getNumIndependentSpecies() +int LLVMExecutableModel::getNumDependentSpecies() +int LLVMExecutableModel::getNumFloatingSpecies() +int LLVMExecutableModel::getNumBoundarySpecies() +int LLVMExecutableModel::getNumGlobalParameters() +int LLVMExecutableModel::getNumCompartments() +int LLVMExecutableModel::getNumReactions() +int LLVMExecutableModel::getNumLocalParameters(int reactionId) +void LLVMExecutableModel::convertToAmounts() +void LLVMExecutableModel::computeConservedTotals() +double LLVMExecutableModel::getFloatingSpeciesConcentration(int index) +int LLVMExecutableModel::getFloatingSpeciesConcentrations(int len, int const *indx, +void LLVMExecutableModel::getRateRuleValues(double *rateRuleValues) +void LLVMExecutableModel::setRateRuleValues(const double *rateRuleValues) +void LLVMExecutableModel::convertToConcentrations() +void LLVMExecutableModel::updateDependentSpeciesValues() +void LLVMExecutableModel::computeAllRatesOfChange() +void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) +void LLVMExecutableModel::testConstraints() +string LLVMExecutableModel::getInfo() +int LLVMExecutableModel::getFloatingSpeciesIndex(const string& allocator) +string LLVMExecutableModel::getFloatingSpeciesId(int index) +int LLVMExecutableModel::getBoundarySpeciesIndex(const string& id) +string LLVMExecutableModel::getBoundarySpeciesId(int indx) +int LLVMExecutableModel::getBoundarySpeciesCompartmentIndex(int int1) +int LLVMExecutableModel::getGlobalParameterIndex(const string& allocator) +string LLVMExecutableModel::getGlobalParameterId(int id) + throw_llvm_exception("index out of range"); +int LLVMExecutableModel::getCompartmentIndex(const string& allocator) +string LLVMExecutableModel::getCompartmentId(int id) + throw_llvm_exception("index out of range"); +int LLVMExecutableModel::getReactionIndex(const string& allocator) +string LLVMExecutableModel::getReactionId(int id) + throw_llvm_exception("index out of range"); +void LLVMExecutableModel::evalInitialConditions() +void LLVMExecutableModel::reset() +bool LLVMExecutableModel::getConservedSumChanged() +void LLVMExecutableModel::setConservedSumChanged(bool val) +int LLVMExecutableModel::getStateVector(double* stateVector) +int LLVMExecutableModel::setStateVector(const double* stateVector) +void LLVMExecutableModel::print(std::ostream &stream) + stream << "LLVMExecutableModel" << endl; +LLVMExecutableModel* LLVMExecutableModel::dummy() + return new LLVMExecutableModel(); +void LLVMExecutableModel::evalReactionRates() +int LLVMExecutableModel::getNumRules() +int LLVMExecutableModel::getFloatingSpeciesAmounts(int len, const int* indx, +int LLVMExecutableModel::setFloatingSpeciesConcentrations(int len, +int LLVMExecutableModel::getBoundarySpeciesAmounts(int len, const int* indx, +int LLVMExecutableModel::getBoundarySpeciesConcentrations(int len, +int LLVMExecutableModel::setBoundarySpeciesConcentrations(int len, +int LLVMExecutableModel::getGlobalParameterValues(int len, const int* indx, +int LLVMExecutableModel::setGlobalParameterValues(int len, const int* indx, +int LLVMExecutableModel::getCompartmentVolumes(int len, const int* indx, +int LLVMExecutableModel::getReactionRates(int len, const int* indx, +int LLVMExecutableModel::getNumConservedSums() +int LLVMExecutableModel::getConservedSumIndex(const string& name) +string LLVMExecutableModel::getConservedSumId(int index) +int LLVMExecutableModel::getConservedSums(int len, const int* indx, +int LLVMExecutableModel::setConservedSums(int len, const int* indx, +int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, + throw LLVMException("index out of range"); +int LLVMExecutableModel::setFloatingSpeciesAmounts(int len, int const *indx, +int LLVMExecutableModel::setCompartmentVolumes(int len, const int* indx, +int LLVMExecutableModel::setFloatingSpeciesInitConcentrations(int len, +int LLVMExecutableModel::getFloatingSpeciesInitConcentrations(int len, +double LLVMExecutableModel::getStoichiometry(int index) +int LLVMExecutableModel::getNumEvents() +int LLVMExecutableModel::getEventTriggers(int len, const int *indx, unsigned char *values) +void LLVMExecutableModel::evalEvents(double timeEnd, +int LLVMExecutableModel::applyPendingEvents(const double *stateVector, +void LLVMExecutableModel::evalEventRoots(double time, const double* y, double* gdot) +double LLVMExecutableModel::getNextPendingEventTime(bool pop) +int LLVMExecutableModel::getPendingEventSize() +void LLVMExecutableModel::resetEvents() +bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, + pendingEvents.push(rrllvm::Event(*this, i)); +bool LLVMExecutableModel::getEventTieBreak(uint eventA, uint eventB) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h + * LLVMExecutableModel.h +#ifndef LLVMExecutableModelH +#define LLVMExecutableModelH +#include "LLVMModelDataSymbols.h" +#include "LLVMIncludes.h" +class RR_DECLSPEC LLVMExecutableModel: public ExecutableModel + LLVMExecutableModel(); + virtual ~LLVMExecutableModel(); + rrllvm::EventQueue pendingEvents; + LLVMModelData modelData; + LLVMModelDataSymbols *symbols; + llvm::LLVMContext *context; + llvm::ExecutionEngine *executionEngine; + rrllvm::EvalVolatileStoichCodeGen::FunctionPtr evalVolatileStoichPtr; + rrllvm::EvalConversionFactorCodeGen::FunctionPtr evalConversionFactorPtr; + static LLVMExecutableModel* dummy(); + friend class LLVMModelGenerator; +#endif /* LLVMExecutableModelH */ diff --git a/source/rrLLVMIncludes.h b/source/llvm/LLVMIncludes.h rename from source/rrLLVMIncludes.h rename to source/llvm/LLVMIncludes.h --- a/source/rrLLVMIncludes.h +++ b/source/llvm/LLVMIncludes.h - * rrLLVMIncludes.h + * LLVMIncludes.h -#if (LLVM_VERSION_MINOR >= 3) +#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 3) #include #include #include #include #include #include +#elif (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 2) #include #include #include #include #include #include +//#elif (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 1) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include #include +#include +#include + * C++ 11 style to_string for LLVM types +std::string to_string(const llvm::Value *); diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp + * rrLLVMModelData.cpp +#include "LLVMModelData.h" +void LLVMModelData::init(LLVMModelData &data) + memset(&data, 0, sizeof(rr::LLVMModelData)); +void LLVMModelData::allocBuffers(LLVMModelData &data, const string& modelName) +std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) + os << "LLVMModelData:" << endl; +void LLVMModelData::freeBuffers(LLVMModelData &data) diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h + * LLVMModelData.h +#ifndef RRLLVMMODELDATA_H_ +#define RRLLVMMODELDATA_H_ +struct LLVMModelData; +struct LLVMModelData + * size in LLVM land. + * Only used in the LLVM version. + * In the LLVM version, this is just a pointer to a data block + static void init(LLVMModelData&); + static void allocBuffers(LLVMModelData &data, const std::string& modelName); + static void freeBuffers(LLVMModelData&); +std::ostream& operator <<(std::ostream& os, const LLVMModelData& data); +#endif /* RRLLVMMODELDATA_H_ */ diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp + * LLVMModelDataSymbols.cpp +#include "LLVMModelDataSymbols.h" +#include "LLVMException.h" +#include +using namespace llvm; +static std::vector getIds(const rr::LLVMModelDataSymbols::StringUIntMap & m) + for(rr::LLVMModelDataSymbols::StringUIntMap::const_iterator i = m.begin(); +LLVMModelDataSymbols::LLVMModelDataSymbols() : +LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model *model, +LLVMModelDataSymbols::~LLVMModelDataSymbols() +const std::string& LLVMModelDataSymbols::getModelName() const +uint LLVMModelDataSymbols::getCompartmentIndex( + throw LLVMException("could not find compartment with id " + id, __FUNC__); +uint LLVMModelDataSymbols::getFloatingSpeciesIndex( + throw LLVMException("could not find floating species with id " + id, __FUNC__); +uint LLVMModelDataSymbols::getBoundarySpeciesIndex( + throw LLVMException("could not find boundary species with id " + id, __FUNC__); +uint LLVMModelDataSymbols::getBoundarySpeciesSize() const +uint LLVMModelDataSymbols::getGlobalParameterIndex( + throw LLVMException("could not find global parameter species with id " + id, __FUNC__); +void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const + LLVMModelData::init(m); +std::vector LLVMModelDataSymbols::getCompartmentIds() const +std::vector LLVMModelDataSymbols::getBoundarySpeciesIds() const +uint LLVMModelDataSymbols::getReactionIndex(const std::string& id) const + throw LLVMException("could not find reactions with id " + id, __FUNC__); +std::vector LLVMModelDataSymbols::getReactionIds() const +uint LLVMModelDataSymbols::getReactionSize() const +uint LLVMModelDataSymbols::getFloatingSpeciesSize() const +std::list + LLVMModelDataSymbols::getStoichiometryIndx() const +void LLVMModelDataSymbols::print() const +std::vector LLVMModelDataSymbols::getGlobalParameterIds() const +std::vector LLVMModelDataSymbols::getFloatingSpeciesIds() const +uint LLVMModelDataSymbols::getLinearlyIndependentFloatingSpeciesSize() const +uint LLVMModelDataSymbols::getIndependentFloatingSpeciesSize() const +bool LLVMModelDataSymbols::isIndependentFloatingSpecies( +bool LLVMModelDataSymbols::isIndependentBoundarySpecies( +bool LLVMModelDataSymbols::isIndependentGlobalParameter( +bool LLVMModelDataSymbols::isIndependentCompartment(const std::string& id) const +const char* LLVMModelDataSymbols::getFieldName(ModelDataFields field) +uint LLVMModelDataSymbols::getIndependentGlobalParameterSize() const +uint LLVMModelDataSymbols::getIndependentCompartmentSize() const +uint LLVMModelDataSymbols::getIndependentBoundarySpeciesSize() const +uint LLVMModelDataSymbols::getRateRuleIndex(std::string const& id) const + throw LLVMException("could not find rate rule with id " + id, __FUNC__); +uint LLVMModelDataSymbols::getRateRuleSize() const +bool LLVMModelDataSymbols::isIndependentElement(const std::string& id) const +bool LLVMModelDataSymbols::hasAssignmentRule(const std::string& id) const +bool LLVMModelDataSymbols::hasRateRule(const std::string& id) const +uint LLVMModelDataSymbols::getCompartmentsSize() const +uint LLVMModelDataSymbols::getGlobalParametersSize() const +void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model* model) +void LLVMModelDataSymbols::initBoundarySpecies(const libsbml::Model* model) +void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, + throw_llvm_exception(msg); +void LLVMModelDataSymbols::initCompartments(const libsbml::Model *model) +void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) + throw_llvm_exception(msg); + throw_llvm_exception(msg); +bool LLVMModelDataSymbols::isValidSpeciesReference( +void LLVMModelDataSymbols::displayCompartmentInfo() +void LLVMModelDataSymbols::initEvents(const libsbml::Model* model) +const std::vector& LLVMModelDataSymbols::getEventAttributes() const +uint LLVMModelDataSymbols::getEventBufferSize(uint eventId) const +bool LLVMModelDataSymbols::isNamedSpeciesReference(const std::string& id) const +const LLVMModelDataSymbols::SpeciesReferenceInfo& + LLVMModelDataSymbols::getNamedSpeciesReferenceInfo(const std::string& id) const + throw_llvm_exception(id + " is not a named SpeciesReference"); diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h + * LLVMModelDataSymbols.h +#ifndef LLVMModelDataSymbolsH +#define LLVMModelDataSymbolsH +#include "LLVMModelData.h" + * The logic behind splitting up LLVMModelDataSymbols and LLVMModelSymbols + * is that LLVMModelSymbols contains all the ASTs from the model, and this +class LLVMModelDataSymbols + LLVMModelDataSymbols(); + LLVMModelDataSymbols(libsbml::Model const* model, + virtual ~LLVMModelDataSymbols(); + void initAllocModelDataBuffers(LLVMModelData& m) const; +#endif /* RRLLVMMODELDATASYMBOLS_H_ */ diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp + * LLVMModelGenerator.cpp +#include "LLVMModelGenerator.h" +#include "LLVMExecutableModel.h" +#include "LLVMIncludes.h" +using namespace rrllvm; +LLVMModelGenerator::LLVMModelGenerator() +LLVMModelGenerator::~LLVMModelGenerator() +bool LLVMModelGenerator::setTemporaryDirectory(const string& path) +string LLVMModelGenerator::getTemporaryDirectory() + return LLVMCompiler::gurgle(); +ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, + LLVMExecutableModel *exe = new LLVMExecutableModel(); +Compiler* LLVMModelGenerator::getCompiler() +bool LLVMModelGenerator::setCompiler(const string& compiler) +/************ LLVM Utility Functions, TODO: Move To Separate File ************/ + * C++ 11 style to_string for LLVM types +std::string to_string(const llvm::Value *value) + llvm::raw_string_ostream stream(str); diff --git a/source/llvm/LLVMModelGenerator.h b/source/llvm/LLVMModelGenerator.h +++ b/source/llvm/LLVMModelGenerator.h + * LLVMModelGenerator.h +#ifndef rrLLVMModelGeneratorH +#define rrLLVMModelGeneratorH +#include "LLVMCompiler.h" +class RR_DECLSPEC LLVMModelGenerator: public rr::ModelGenerator + LLVMModelGenerator(); + virtual ~LLVMModelGenerator(); + * No effect on LLVM generator. + LLVMCompiler compiler; +#endif /* rrLLVMModelGeneratorH */ diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp + * LLVMModelSymbols.cpp +#include "LLVMModelSymbols.h" +#include "LLVMException.h" +using namespace llvm; +LLVMModelSymbols::LLVMModelSymbols(const libsbml::Model *m, LLVMModelDataSymbols const &sym) : +LLVMModelSymbols::~LLVMModelSymbols() +bool LLVMModelSymbols::visit(const libsbml::Compartment& x) +bool LLVMModelSymbols::visit(const libsbml::Species& x) +bool LLVMModelSymbols::visit(const libsbml::AssignmentRule& x) +bool LLVMModelSymbols::visit(const libsbml::InitialAssignment& x) +bool LLVMModelSymbols::visit(const libsbml::RateRule& rule) +bool LLVMModelSymbols::visit (const libsbml::Event &event) +void LLVMModelSymbols::processElement(SymbolForest& currentSymbols, +bool LLVMModelSymbols::visit(const libsbml::Rule& x) +bool LLVMModelSymbols::visit(const libsbml::Reaction& r) + catch (LLVMException&) + catch (LLVMException&) +void LLVMModelSymbols::processSpecies(SymbolForest ¤tSymbols, +const ASTNode* LLVMModelSymbols::getSpeciesReferenceStoichMath( +void LLVMModelSymbols::processSpeciesReference( + catch (LLVMException &) +ASTNode* LLVMModelSymbols::createStoichiometryNode(int row, int col) const + throw LLVMException(err, __FUNC__); +const SymbolForest& LLVMModelSymbols::getAssigmentRules() const +const SymbolForest& LLVMModelSymbols::getInitialValues() const +const SymbolForest& LLVMModelSymbols::getRateRules() const diff --git a/source/llvm/LLVMModelSymbols.h b/source/llvm/LLVMModelSymbols.h +++ b/source/llvm/LLVMModelSymbols.h + * LLVMModelSymbols.h +#ifndef LLVMLLVMModelSymbolsH +#define LLVMLLVMModelSymbolsH +class LLVMModelSymbols: private libsbml::SBMLVisitor + LLVMModelSymbols(libsbml::Model const *m, LLVMModelDataSymbols const &sym); + ~LLVMModelSymbols(); + const LLVMModelDataSymbols &symbols; +#endif /* LLVMLLVMModelSymbolsH */ diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp +#include "LLVMException.h" +#include "llvm/ADT/APInt.h" +using namespace llvm; +const char* ModelDataIRBuilder::LLVMModelDataName = "rr::LLVMModelData"; + const LLVMModelDataSymbols &symbols, +llvm::Value* ModelDataIRBuilder::createGlobalParamGEP(const std::string& id) +llvm::Value* ModelDataIRBuilder::createGEP(ModelDataFields field, + const char* fieldName = LLVMModelDataSymbols::getFieldName(field); +llvm::Value* ModelDataIRBuilder::createGEP(ModelDataFields field, + Twine fieldName = LLVMModelDataSymbols::getFieldName(field); +llvm::StructType* ModelDataIRBuilder::getCSRSparseStructType( + llvm::Module* module, llvm::ExecutionEngine* engine) + LLVMContext &context = module->getContext(); +#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 2) + size_t llvm_size = dl->getTypeStoreSize(structType); + size_t llvm_size = td->getTypeStoreSize(structType); + if (sizeof(csr_matrix) != llvm_size) + err << "llvm " << csr_matrixName << " size " << llvm_size << + throw LLVMException(err.str(), __FUNC__); +llvm::Function* ModelDataIRBuilder::getCSRMatrixSetNZDecl(Module *module) +llvm::Function* ModelDataIRBuilder::getCSRMatrixGetNZDecl(Module *module) +llvm::CallInst* ModelDataIRBuilder::createCSRMatrixSetNZ(IRBuilder<> &builder, + llvm::Value* csrPtr, llvm::Value* row, llvm::Value* col, + llvm::Value* value, const Twine& name) +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtGEP( +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtLoad( + const std::string& id, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtStore( + const std::string& id, llvm::Value* value) +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtRateGEP( +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtRateLoad( + const std::string& id, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtRateStore( + const std::string& id, llvm::Value* value) +llvm::Module* ModelDataIRBuilder::getModule(IRBuilder<> &builder, const char* func) + throw LLVMException("could not get module, a BasicBlock is not currently being populated.", func); +llvm::CallInst* ModelDataIRBuilder::createCSRMatrixGetNZ(IRBuilder<> &builder, + llvm::Value* csrPtr, llvm::Value* row, llvm::Value* col, +llvm::Value* ModelDataIRBuilder::createLoad(ModelDataFields field, unsigned index, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createRateRuleValueGEP(const std::string& id, + const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createRateRuleValueLoad(const std::string& id, + const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createRateRuleValueStore(const std::string& id, + llvm::Value* value) +llvm::Value* ModelDataIRBuilder::createRateRuleRateGEP(const std::string& id, + const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createRateRuleRateLoad(const std::string& id, + const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createRateRuleRateStore(const std::string& id, + llvm::Value* value) +llvm::Value* ModelDataIRBuilder::createStore(ModelDataFields field, + unsigned index, llvm::Value* value, const Twine& name) +llvm::Value* ModelDataIRBuilder::createCompLoad(const std::string& id, + const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createCompStore(const std::string& id, + llvm::Value* value) +llvm::Value* ModelDataIRBuilder::createCompGEP(const std::string& id, + const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtLoad( + const std::string& id, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtStore( + const std::string& id, llvm::Value* value) +llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtGEP( + const std::string& id, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createGlobalParamLoad( + const std::string& id, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createGlobalParamStore( + const std::string& id, llvm::Value* value) +llvm::Value* ModelDataIRBuilder::createReactionRateLoad(const std::string& id, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createReactionRateStore(const std::string& id, llvm::Value* value) +llvm::Value* ModelDataIRBuilder::createStoichiometryStore(uint row, uint col, + llvm::Value* value, const llvm::Twine& name) + LLVMContext &context = builder.getContext(); +llvm::Value* ModelDataIRBuilder::createStoichiometryLoad(uint row, uint col, + const llvm::Twine& name) + LLVMContext &context = builder.getContext(); +void ModelDataIRBuilder::validateStruct(llvm::Value* s, + if (structType->getName().compare(LLVMModelDataName) == 0) + << LLVMModelDataName << ", but received "; + throw LLVMException(err.str()); +llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module, llvm::ExecutionEngine *engine) + StructType *structType = module->getTypeByName(LLVMModelDataName); + LLVMContext &context = module->getContext(); + structType = StructType::create(context, elements, LLVMModelDataName); +#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 2) + size_t llvm_size = dl->getTypeStoreSize(structType); + size_t llvm_size = td->getTypeStoreSize(structType); + if (sizeof(LLVMModelData) != llvm_size) + err << "llvm rr::ModelData size " << llvm_size << + sizeof(LLVMModelData); + throw LLVMException(err.str(), __FUNC__); + printf("TestStruct size: %i, , LLVM Size: %i\n", sizeof(ModelData), llvm_size); + printf("C++ bool size: %i, LLVM bool size: %i\n", sizeof(bool), dl->getTypeStoreSize(boolType)); + printf("C++ bool* size: %i, LLVM bool* size: %i\n", sizeof(bool*), dl->getTypeStoreSize(boolPtrType)); + printf("C++ char** size: %i, LLVM char** size: %i\n", sizeof(char**), dl->getTypeStoreSize(charStarStarType)); + printf("C++ void* size: %i, LLVM void* size: %i\n", sizeof(void*), dl->getTypeStoreSize(voidPtrType)); +LLVMModelDataIRBuilderTesting::LLVMModelDataIRBuilderTesting(LLVMModelDataSymbols const& symbols, + llvm::IRBuilder<> &b) : +void LLVMModelDataIRBuilderTesting::createAccessors(Module *module) + LLVMContext &context = module->getContext(); +llvm::CallInst* LLVMModelDataIRBuilderTesting::createDispChar(llvm::Value* intVal) +llvm::CallInst* LLVMModelDataIRBuilderTesting::createDispDouble(llvm::Value* doubleVal) +llvm::CallInst* LLVMModelDataIRBuilderTesting::createDispInt(llvm::Value* intVal) +pair LLVMModelDataIRBuilderTesting::createFloatingSpeciesAccessors( + llvm::Module* module, const std::string id) + LLVMContext &context = module->getContext(); +llvm::Function* LLVMModelDataIRBuilderTesting::getDispCharDecl(llvm::Module* module) +llvm::Function* LLVMModelDataIRBuilderTesting::getDispDoubleDecl(llvm::Module* module) +llvm::Function* LLVMModelDataIRBuilderTesting::getDispIntDecl(llvm::Module* module) +llvm::Value* LLVMModelDataIRBuilderTesting::createFloatSpeciesConcGEP(const std::string& id) +llvm::Value* LLVMModelDataIRBuilderTesting::createFloatSpeciesConcStore(const string& id, Value *conc) +void LLVMModelDataIRBuilderTesting::test(Module *module, IRBuilder<> *build, +//static LLVMContext *context; +//static LLVMContext &getContext() { +// size_t llvm_size = dl.getTypeStoreSize(s); +// printf("TestStruct size: %i, , LLVM Size: %i\n", sizeof(TestStruct), llvm_size); +// PointerType *structTypePtr = llvm::PointerType::get(structType, 0); +// LLVMContext &context = getContext(); +// PointerType *structTypePtr = llvm::PointerType::get(structType, 0); diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h +#include "LLVMIncludes.h" +#include "LLVMModelDataSymbols.h" + ModelDataIRBuilder(llvm::Value *modelData, LLVMModelDataSymbols const&, + llvm::IRBuilder<> &); + llvm::Value *createFloatSpeciesAmtGEP(const std::string &id, + const llvm::Twine &name = ""); + llvm::Value *createBoundSpeciesAmtGEP(const std::string &id, + const llvm::Twine &name = ""); + llvm::Value *createGlobalParamGEP(const std::string &id); + llvm::Value *createGEP(ModelDataFields field, const llvm::Twine& name = ""); + llvm::Value *createGEP(ModelDataFields field, unsigned index, + const llvm::Twine& name = ""); + llvm::Value *createLoad(ModelDataFields field, unsigned index, + const llvm::Twine& name = ""); + llvm::Value *createStore(ModelDataFields field, unsigned index, + llvm::Value *value, const llvm::Twine& name = ""); + llvm::Value* createCompGEP(const std::string& id, + const llvm::Twine &name = ""); + llvm::Value *createCompLoad(const std::string& id, + const llvm::Twine& name =""); + llvm::Value *createCompStore(const std::string &id, + llvm::Value *value); + llvm::Value *createGlobalParamLoad(const std::string& id, + const llvm::Twine& name = ""); + llvm::Value *createGlobalParamStore(const std::string &id, + llvm::Value *value); + llvm::Value *createFloatSpeciesAmtLoad(const std::string& id, + const llvm::Twine& name = ""); + llvm::Value *createFloatSpeciesAmtStore(const std::string &id, + llvm::Value *value); + llvm::Value *createFloatSpeciesAmtRateGEP(const std::string &id, + const llvm::Twine &name = ""); + llvm::Value *createFloatSpeciesAmtRateLoad(const std::string& id, + const llvm::Twine& name = ""); + llvm::Value *createFloatSpeciesAmtRateStore(const std::string &id, + llvm::Value *value); + llvm::Value *createBoundSpeciesAmtLoad(const std::string& id, + const llvm::Twine& name = ""); + llvm::Value *createBoundSpeciesAmtStore(const std::string &id, + llvm::Value *value); + llvm::Value *createReactionRateLoad(const std::string& id, + const llvm::Twine& name = ""); + llvm::Value *createReactionRateStore(const std::string &id, + llvm::Value *value); + llvm::Value *createRateRuleValueGEP(const std::string &id, + const llvm::Twine &name = ""); + llvm::Value *createRateRuleValueLoad(const std::string& id, + const llvm::Twine& name = ""); + llvm::Value *createRateRuleValueStore(const std::string &id, + llvm::Value *value); + llvm::Value *createRateRuleRateGEP(const std::string &id, + const llvm::Twine &name = ""); + llvm::Value *createRateRuleRateLoad(const std::string& id, + const llvm::Twine& name = ""); + llvm::Value *createRateRuleRateStore(const std::string &id, + llvm::Value *value); + llvm::Value *createStoichiometryStore(uint row, uint col, + llvm::Value *value, const llvm::Twine& name = ""); + llvm::Value *createStoichiometryLoad(uint row, uint col, + const llvm::Twine& name = ""); + static llvm::CallInst *createCSRMatrixSetNZ(llvm::IRBuilder<> &, + llvm::Value *csrPtr, llvm::Value *row, llvm::Value *col, + llvm::Value *value, const llvm::Twine& name = ""); + static llvm::CallInst *createCSRMatrixGetNZ(llvm::IRBuilder<> &, + llvm::Value *csrPtr, llvm::Value *row, llvm::Value *col, + const llvm::Twine& name = ""); + static llvm::Function *getCSRMatrixSetNZDecl(llvm::Module *module); + static llvm::Function *getCSRMatrixGetNZDecl(llvm::Module *module); + static llvm::StructType *getCSRSparseStructType(llvm::Module *module, + llvm::ExecutionEngine *engine = 0); + static llvm::StructType *getStructType(llvm::Module *module, + llvm::ExecutionEngine *engine = 0); + static const char* LLVMModelDataName; + llvm::Value *modelData; + llvm::IRBuilder<> &builder; + LLVMModelDataSymbols const& symbols; + static llvm::Module *getModule(llvm::IRBuilder<> &, const char* func); + void validateStruct(llvm::Value *s, const char* funcName); + friend class LLVMModelDataIRBuilderTesting; +class LLVMModelDataIRBuilderTesting + LLVMModelDataIRBuilderTesting(LLVMModelDataSymbols const&, + llvm::IRBuilder<> &); + void createAccessors(llvm::Module *module); + std::pair createFloatingSpeciesAccessors( + llvm::Module *module, const std::string id); + void test(llvm::Module *module, llvm::IRBuilder<> *build, + llvm::ExecutionEngine * engine); + llvm::Value *createFloatSpeciesConcGEP(const std::string &id); + llvm::Value *createFloatSpeciesConcStore(const std::string &id, + llvm::Value *value); + static llvm::Function *getDispIntDecl(llvm::Module *module); + llvm::CallInst *createDispInt(llvm::Value *intVal); + static llvm::Function *getDispDoubleDecl(llvm::Module *module); + llvm::CallInst *createDispDouble(llvm::Value *doubleVal); + static llvm::Function *getDispCharDecl(llvm::Module *module); + llvm::CallInst *createDispChar(llvm::Value *doubleVal); + llvm::IRBuilder<> &builder; + LLVMModelDataSymbols const& symbols; diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp + * rrLLVMModelDataTermSymbolResolver.cpp +#include "LLVMException.h" +using namespace llvm; +ModelDataLoadSymbolResolver::ModelDataLoadSymbolResolver(llvm::Value *modelData, + const LLVMModelSymbols &modelSymbols, + const LLVMModelDataSymbols &modelDataSymbols, + llvm::IRBuilder<> &builder) : +ModelDataStoreSymbolResolver::ModelDataStoreSymbolResolver(llvm::Value *modelData, + const LLVMModelSymbols &modelSymbols, + const LLVMModelDataSymbols &modelDataSymbols, + llvm::IRBuilder<> &builder, +llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args) + throw_llvm_exception(msg); + const LLVMModelDataSymbols::SpeciesReferenceInfo &info = + if (info.type == LLVMModelDataSymbols::Reactant) + throw_llvm_exception(msg); +llvm::Value* ModelDataStoreSymbolResolver::storeSymbolValue( + const std::string& symbol, llvm::Value *value) + throw_llvm_exception(msg); + const LLVMModelDataSymbols::SpeciesReferenceInfo &info = + if (info.type == LLVMModelDataSymbols::Reactant) + throw_llvm_exception(msg); diff --git a/source/llvm/ModelDataSymbolResolver.h b/source/llvm/ModelDataSymbolResolver.h +++ b/source/llvm/ModelDataSymbolResolver.h +#include "LLVMIncludes.h" +#include "LLVMModelDataSymbols.h" +#include "LLVMModelSymbols.h" + ModelDataLoadSymbolResolver(llvm::Value *modelData, + const libsbml::Model *model, const LLVMModelSymbols &modelSymbols, + const LLVMModelDataSymbols &modelDataSymbols, + llvm::IRBuilder<> &builder); + virtual llvm::Value *loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args = + llvm::ArrayRef()); + llvm::Value *modelData; + const LLVMModelSymbols &modelSymbols; + const LLVMModelDataSymbols &modelDataSymbols; + llvm::IRBuilder<> &builder; + ModelDataStoreSymbolResolver(llvm::Value *modelData, + const libsbml::Model *model, const LLVMModelSymbols &modelSymbols, + const LLVMModelDataSymbols &modelDataSymbols, + llvm::IRBuilder<> &builder, + virtual llvm::Value *storeSymbolValue(const std::string& symbol, + llvm::Value *value); + llvm::Value *modelData; + const LLVMModelSymbols &modelSymbols; + const LLVMModelDataSymbols &modelDataSymbols; + llvm::IRBuilder<> &builder; +#endif /* rrLLVMModelDataSymbolResolver_H_ */ diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp +#include "LLVMIncludes.h" +#include "LLVMException.h" +using namespace llvm; +static void createLibraryFunction(llvm::LibFunc::Func funcId, + llvm::FunctionType *funcType, Module* module); + llvm::FunctionType *funcType, Module *module); + symbols(new LLVMModelDataSymbols(doc->getModel(), + modelSymbols(new LLVMModelSymbols(getModel(), *symbols)), + // initialize LLVM + context = new LLVMContext(); + module = new Module("LLVM Module", *context); + symbols(new LLVMModelDataSymbols(doc->getModel(), + modelSymbols(new LLVMModelSymbols(getModel(), *symbols)), + // initialize LLVM + context = new LLVMContext(); + module = new Module("LLVM Module", *context); + symbols(new LLVMModelDataSymbols(doc->getModel(), false)), + modelSymbols(new LLVMModelSymbols(getModel(), *symbols)), + // initialize LLVM + context = new LLVMContext(); + module = new Module("LLVM Module", *context); +llvm::LLVMContext &ModelGeneratorContext::getContext() const +llvm::ExecutionEngine &ModelGeneratorContext::getExecutionEngine() const +const LLVMModelDataSymbols& ModelGeneratorContext::getModelDataSymbols() const +llvm::Module *ModelGeneratorContext::getModule() const +llvm::IRBuilder<> &ModelGeneratorContext::getBuilder() const +void ModelGeneratorContext::stealThePeach(LLVMModelDataSymbols **sym, + llvm::LLVMContext** ctx, llvm::ExecutionEngine** eng, string** err) +const LLVMModelSymbols& ModelGeneratorContext::getModelSymbols() const + LLVMContext& context = module->getContext(); + executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispIntDecl(module), (void*)dispInt); + executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispDoubleDecl(module), (void*)dispDouble); + executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispCharDecl(module), (void*)dispChar); + LLVMContext& context = module->getContext(); +static void createLibraryFunction(llvm::LibFunc::Func funcId, + llvm::FunctionType *funcType, Module* module) + throw_llvm_exception(msg); + llvm::FunctionType *funcType, Module *module) diff --git a/source/rrLLVMModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h rename from source/rrLLVMModelGeneratorContext.h rename to source/llvm/ModelGeneratorContext.h --- a/source/rrLLVMModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h - * rrLLVMModelGeneratorContext.h -#ifndef rrLLVMModelGeneratorContextH -#define rrLLVMModelGeneratorContextH +#include "LLVMIncludes.h" +#include "LLVMModelDataSymbols.h" +#include "LLVMModelSymbols.h" -#include "rrLLVMModelDataSymbols.h" -#include "rrLLVMIncludes.h" -class LLVMModelGeneratorContext - LLVMModelGeneratorContext(std::string const &sbml, - LLVMModelGeneratorContext(libsbml::SBMLDocument const *doc, - ~LLVMModelGeneratorContext(); + * useful for testing out LLVM functionality. const LLVMModelDataSymbols &getModelDataSymbols() const; + const LLVMModelSymbols &getModelSymbols() const; llvm::LLVMContext &getContext() const; - llvm::ExecutionEngine *getExecutionEngine() const; + llvm::ExecutionEngine &getExecutionEngine() const; + * nearly all llvm functions expect a pointer to module, so we define this llvm::Module *getModule() const; - llvm::IRBuilder<> *getBuilder() const; + llvm::IRBuilder<> &getBuilder() const; + void stealThePeach(LLVMModelDataSymbols **sym, llvm::LLVMContext **ctx, + llvm::ExecutionEngine **eng, std::string **errStr); - llvm::LLVMContext *context; - llvm::ExecutionEngine *executionEngine; - llvm::Module *module; + * that are accessible from the LLVM generated code. - LLVMModelDataSymbols symbols; + LLVMModelDataSymbols *symbols; + LLVMModelSymbols *modelSymbols; + llvm::LLVMContext *context; + llvm::ExecutionEngine *executionEngine; + llvm::Module *module; llvm::IRBuilder<> *builder; -#endif /* rrLLVMModelGeneratorContextH */ diff --git a/source/llvm/SBMLSupportFunctions.cpp b/source/llvm/SBMLSupportFunctions.cpp +++ b/source/llvm/SBMLSupportFunctions.cpp diff --git a/source/llvm/SBMLSupportFunctions.h b/source/llvm/SBMLSupportFunctions.h +++ b/source/llvm/SBMLSupportFunctions.h diff --git a/source/llvm/SetRateRuleValuesCodeGen.cpp b/source/llvm/SetRateRuleValuesCodeGen.cpp +++ b/source/llvm/SetRateRuleValuesCodeGen.cpp diff --git a/source/llvm/SetRateRuleValuesCodeGen.h b/source/llvm/SetRateRuleValuesCodeGen.h +++ b/source/llvm/SetRateRuleValuesCodeGen.h +#ifndef LLVMSETRATERULEVALUESCODEGEN_H_ +#define LLVMSETRATERULEVALUESCODEGEN_H_ + typedef void (*FunctionPtr)(LLVMModelData*); +#endif /* LLVMSETRATERULEVALUESCODEGEN_H_ */ diff --git a/source/llvm/SymbolForest.h b/source/llvm/SymbolForest.h +++ b/source/llvm/SymbolForest.h +#endif /* LLVMSymbolForestH */ diff --git a/source/llvm_testing/CMakeLists.txt b/source/llvm_testing/CMakeLists.txt --- a/source/llvm_testing/CMakeLists.txt +++ b/source/llvm_testing/CMakeLists.txt + src/LLVMCSRMatrixTest diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp -#include "rrLLVMModelGeneratorContext.h" -#include "rrLLVMModelDataIRBuilder.h" -using namespace llvm; - LLVMModelGeneratorContext c(doc, true); - //StructType *s = LLVMModelDataValue::getStructType(c.getModule(), c.getExecutionEngine()); - LLVMModelDataSymbols symbols(doc->getModel(), true); +//#include "rrLLVMModelDataIRBuilder.h" +//#include "LLVMCSRMatrixTest.h" + cout << "RoadRunner LLVM SBML Test Suite" << endl; + const char* compiler = "llvm"; + //runLLVMCSRMatrixTest(33, 323, 50); + printf("LLVM Model Used %0.2f seconds of CPU time. \n", (double)(stopc - startc)/CLOCKS_PER_SEC); + printf("LLVM Model Finished in about %.0f seconds. \n", difftime(stop, start)); + LLVMModelGeneratorContext c(doc, true); + //StructType *s = LLVMModelDataValue::getStructType(c.getModule(), c.getExecutionEngine()); + LLVMModelDataSymbols symbols(doc->getModel(), true); diff --git a/source/llvm_testing/src/CSRMatrixTest.cpp b/source/llvm_testing/src/CSRMatrixTest.cpp +++ b/source/llvm_testing/src/CSRMatrixTest.cpp +#include "llvm/ModelGeneratorContext.h" +#include "llvm/LLVMModelDataSymbols.h" +#include "llvm/ModelDataIRBuilder.h" +#include "llvm/LLVMIncludes.h" +#include "llvm/AssignmentRuleEvaluator.h" +#include "llvm/EvalInitialConditionsCodeGen.h" +#include "llvm/LLVMModelData.h" +using namespace llvm; diff --git a/source/llvm_testing/src/CSRMatrixTest.h b/source/llvm_testing/src/CSRMatrixTest.h +++ b/source/llvm_testing/src/CSRMatrixTest.h diff --git a/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp b/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp +++ b/source/llvm_testing/src/GetBoundarySpeciesAmountTest.cpp +#include "llvm/GetValuesCodeGen.h" +#include "llvm/ModelGeneratorContext.h" + LLVMModelGeneratorContext ctx; + LLVMGetBoundarySpeciesAmountCodeGen bsa(ctx); + LLVMGetBoundarySpeciesAmountCodeGen::FunctionPtr functionPtr = diff --git a/source/llvm_testing/src/GetBoundarySpeciesAmountTest.h b/source/llvm_testing/src/GetBoundarySpeciesAmountTest.h +++ b/source/llvm_testing/src/GetBoundarySpeciesAmountTest.h diff --git a/source/llvm_testing/src/LLVMCSRMatrixTest.cpp b/source/llvm_testing/src/LLVMCSRMatrixTest.cpp +++ b/source/llvm_testing/src/LLVMCSRMatrixTest.cpp + * LLVMCSRMatrixTest.cpp +#include "LLVMCSRMatrixTest.h" +#include "llvm/ModelDataIRBuilder.h" +using namespace llvm; +LLVMCSRMatrixTest::LLVMCSRMatrixTest() : +LLVMCSRMatrixTest::~LLVMCSRMatrixTest() +bool LLVMCSRMatrixTest::callCSRMatrixSetNZ(csr_matrix* mat, int row, int col, +double LLVMCSRMatrixTest::callCSRMatrixGetNZ(csr_matrix* mat, int row, int col) +llvm::Function* LLVMCSRMatrixTest::getCSRMatrixSetNZTestFunc() + LLVMContext &ctx = context.getContext(); + LLVMModelDataIRBuilderTesting mdirbuilder(LLVMModelDataSymbols(), builder); +bool runLLVMCSRMatrixTest(const std::string& version, int caseNumber) + LLVMCSRMatrixTest tester; +bool runLLVMCSRMatrixTest(const int m, const int n, const int nnz) + LLVMCSRMatrixTest tester; +llvm::Function* LLVMCSRMatrixTest::getCSRMatrixGetNZTestFunc() + LLVMContext &ctx = context.getContext(); + LLVMModelDataIRBuilderTesting mdirbuilder(LLVMModelDataSymbols(), builder); diff --git a/source/llvm_testing/src/LLVMCSRMatrixTest.h b/source/llvm_testing/src/LLVMCSRMatrixTest.h +++ b/source/llvm_testing/src/LLVMCSRMatrixTest.h + * LLVMCSRMatrixTest.h +#ifndef LLVMCSRMATRIXTEST_H_ +#define LLVMCSRMATRIXTEST_H_ +#include "llvm/LLVMIncludes.h" +#include "llvm/ModelGeneratorContext.h" +class LLVMCSRMatrixTest + LLVMCSRMatrixTest(); + virtual ~LLVMCSRMatrixTest(); + llvm::Function *getCSRMatrixSetNZTestFunc(); + llvm::Function *getCSRMatrixGetNZTestFunc(); + llvm::Function *setFunc; + llvm::Function *getFunc; +bool runLLVMCSRMatrixTest(const int m, const int n, const int nnz); +#endif /* LLVMCSRMATRIXTEST_H_ */ diff --git a/source/llvm_testing/src/TestBase.cpp b/source/llvm_testing/src/TestBase.cpp +++ b/source/llvm_testing/src/TestBase.cpp diff --git a/source/llvm_testing/src/TestBase.h b/source/llvm_testing/src/TestBase.h +++ b/source/llvm_testing/src/TestBase.h +#include "llvm/LLVMModelGenerator.h" +#include "llvm/LLVMExecutableModel.h" diff --git a/source/llvm_testing/src/TestEvalInitialConditions.cpp b/source/llvm_testing/src/TestEvalInitialConditions.cpp +++ b/source/llvm_testing/src/TestEvalInitialConditions.cpp diff --git a/source/llvm_testing/src/TestEvalInitialConditions.h b/source/llvm_testing/src/TestEvalInitialConditions.h +++ b/source/llvm_testing/src/TestEvalInitialConditions.h diff --git a/source/llvm_testing/src/TestEvalModel.cpp b/source/llvm_testing/src/TestEvalModel.cpp +++ b/source/llvm_testing/src/TestEvalModel.cpp diff --git a/source/llvm_testing/src/TestEvalModel.h b/source/llvm_testing/src/TestEvalModel.h +++ b/source/llvm_testing/src/TestEvalModel.h diff --git a/source/llvm_testing/src/TestEvalReactionRates.cpp b/source/llvm_testing/src/TestEvalReactionRates.cpp +++ b/source/llvm_testing/src/TestEvalReactionRates.cpp diff --git a/source/llvm_testing/src/TestEvalReactionRates.h b/source/llvm_testing/src/TestEvalReactionRates.h +++ b/source/llvm_testing/src/TestEvalReactionRates.h diff --git a/source/llvm_testing/src/TestRoadRunner.cpp b/source/llvm_testing/src/TestRoadRunner.cpp +++ b/source/llvm_testing/src/TestRoadRunner.cpp diff --git a/source/llvm_testing/src/TestRoadRunner.h b/source/llvm_testing/src/TestRoadRunner.h +++ b/source/llvm_testing/src/TestRoadRunner.h diff --git a/source/llvm_testing/src/cpplapack.cpp b/source/llvm_testing/src/cpplapack.cpp +++ b/source/llvm_testing/src/cpplapack.cpp diff --git a/source/llvm_testing/src/cpplapack.h b/source/llvm_testing/src/cpplapack.h +++ b/source/llvm_testing/src/cpplapack.h diff --git a/source/llvm_testing/src/test_compiler.cpp b/source/llvm_testing/src/test_compiler.cpp +++ b/source/llvm_testing/src/test_compiler.cpp + ModelGenerator *mg = ModelGeneratorFactory::createModelGenerator("LLVM"); diff --git a/source/llvm_testing/src/test_compiler.h b/source/llvm_testing/src/test_compiler.h +++ b/source/llvm_testing/src/test_compiler.h diff --git a/source/llvm_testing/src/tests.cpp b/source/llvm_testing/src/tests.cpp --- a/source/llvm_testing/src/tests.cpp +++ b/source/llvm_testing/src/tests.cpp -#include "rrLLVMModelGeneratorContext.h" -#include "rrLLVMModelDataSymbols.h" -#include "rrLLVMModelDataIRBuilder.h" +#include "llvm/ModelGeneratorContext.h" +#include "llvm/LLVMModelDataSymbols.h" +#include "llvm/ModelDataIRBuilder.h" -#include "rrLLVMIncludes.h" -#include "rrLLVMAssignmentRuleEvaluator.h" +#include "llvm/LLVMIncludes.h" +#include "llvm/AssignmentRuleEvaluator.h" +#include "llvm/EvalInitialConditionsCodeGen.h" +#include "llvm/LLVMModelData.h" using namespace llvm; + LLVMModelData md = {0}; - LLVMModelGeneratorContext c(doc, true); - LLVMSymbolForest s; - LLVMAssignmentRuleEvaluator evaluator(s); + LLVMModelData md; - LLVMModelGeneratorContext c(doc, true); + md.size = sizeof(LLVMModelData); - LLVMModelDataIRBuilder builder(c.getModelDataSymbols(), c.getBuilder()); + LLVMModelDataIRBuilderTesting builder(c.getModelDataSymbols(), c.getBuilder()); + int (*pfunc)(LLVMModelData*) = (int (*)(LLVMModelData*))engine.getPointerToFunction(getFunc); + double (*pfunc)(LLVMModelData*) = (double (*)(LLVMModelData*))engine.getPointerToFunction(getFunc); + void (*psetfunc)(LLVMModelData*,double) = (void (*)(LLVMModelData*,double))engine.getPointerToFunction(setFunc); + LLVMModelData::freeBuffers(md); diff --git a/source/llvm_testing/src/tests.h b/source/llvm_testing/src/tests.h --- a/source/llvm_testing/src/tests.h +++ b/source/llvm_testing/src/tests.h + * generated C code. However, in the LLVM system, there is no code generation diff --git a/source/rrLLVMASTNodeCodeGen.cpp b/source/rrLLVMASTNodeCodeGen.cpp --- a/source/rrLLVMASTNodeCodeGen.cpp - * rrLLVMCodeGenerator.cpp -#include "rrLLVMASTNodeCodeGen.h" -#include "rrLLVMIncludes.h" -using namespace llvm; -LLVMASTNodeCodeGen::LLVMASTNodeCodeGen() : -LLVMASTNodeCodeGen::~LLVMASTNodeCodeGen() -Value *LLVMASTNodeCodeGen::BinaryExprCodegen(const ASTNode *ast) -llvm::Value* LLVMASTNodeCodeGen::Codegen(const libsbml::ASTNode* ast) -llvm::Value* LLVMASTNodeCodeGen::IntrinsicCallCodegen( diff --git a/source/rrLLVMASTNodeCodeGen.h b/source/rrLLVMASTNodeCodeGen.h --- a/source/rrLLVMASTNodeCodeGen.h - * rrLLVMASTNodeCodeGen.h -#ifndef rrLLVMASTNodeCodeGenH -#define rrLLVMASTNodeCodeGenH -#include "rrLLVMIncludes.h" - * All of the LLVM IR generation is handled here. -class LLVMASTNodeCodeGen - LLVMASTNodeCodeGen(); - ~LLVMASTNodeCodeGen(); - llvm::Value *Codegen(const libsbml::ASTNode *ast); - llvm::Value *BinaryExprCodegen(const libsbml::ASTNode *ast); - * most of the AST types correspond to llvm intrinsic, i.e. - llvm::Value *IntrinsicCallCodegen(const libsbml::ASTNode *ast); - llvm::IRBuilder<> builder; -#endif /* rrLLVMASTNodeCodeGenH */ diff --git a/source/rrLLVMCodeGen.h b/source/rrLLVMCodeGen.h --- a/source/rrLLVMCodeGen.h - * rrLLVMCodeGen.h -#ifndef RRLLVMCODEGEN_H_ -#define RRLLVMCODEGEN_H_ -#include "rrLLVMIncludes.h" -class LLVMCodeGen - virtual llvm::Value *CodeGen() = 0; - ~LLVMCodeGen() {}; -#endif /* RRLLVMCODEGEN_H_ */ diff --git a/source/rrLLVMCodeGenerator.cpp b/source/rrLLVMCodeGenerator.cpp --- a/source/rrLLVMCodeGenerator.cpp - * rrLLVMCodeGenerator.cpp -#include "rrLLVMCodeGenerator.h" -LLVMCodeGenerator::LLVMCodeGenerator() -LLVMCodeGenerator::~LLVMCodeGenerator() diff --git a/source/rrLLVMCodeGenerator.h b/source/rrLLVMCodeGenerator.h --- a/source/rrLLVMCodeGenerator.h - * rrLLVMCodeGenerator.h -#ifndef RRLLVMCODEGENERATOR_H_ -#define RRLLVMCODEGENERATOR_H_ -class LLVMCodeGenerator - LLVMCodeGenerator(); - virtual ~LLVMCodeGenerator(); -#endif /* RRLLVMCODEGENERATOR_H_ */ diff --git a/source/rrLLVMCompiler.cpp b/source/rrLLVMCompiler.cpp --- a/source/rrLLVMCompiler.cpp - * rrLLVMCompiler.cpp -#include "rrLLVMCompiler.h" -LLVMCompiler::LLVMCompiler() : -LLVMCompiler::~LLVMCompiler() diff --git a/source/rrLLVMCompiler.h b/source/rrLLVMCompiler.h --- a/source/rrLLVMCompiler.h - * rrLLVMCompiler.h -#ifndef rrLLVMCompilerH -#define rrLLVMCompilerH -class LLVMCompiler: public rr::Compiler - LLVMCompiler(); - virtual ~LLVMCompiler(); -#endif /* rrLLVMCompilerH */ diff --git a/source/rrLLVMExecutableModel.cpp b/source/rrLLVMExecutableModel.cpp --- a/source/rrLLVMExecutableModel.cpp - * rrLLVMExecutableModel.cpp -#include "rrLLVMExecutableModel.h" -#include "rrLLVMIncludes.h" -LLVMExecutableModel::LLVMExecutableModel() -LLVMExecutableModel::~LLVMExecutableModel() -string LLVMExecutableModel::getModelName() -void LLVMExecutableModel::setTime(double _time) -double LLVMExecutableModel::getTime() -ModelData& LLVMExecutableModel::getModelData() -int LLVMExecutableModel::getNumIndependentSpecies() -int LLVMExecutableModel::getNumDependentSpecies() -int LLVMExecutableModel::getNumFloatingSpecies() -int LLVMExecutableModel::getNumBoundarySpecies() -int LLVMExecutableModel::getNumGlobalParameters() -int LLVMExecutableModel::getNumCompartments() -int LLVMExecutableModel::getNumReactions() -int LLVMExecutableModel::getNumEvents() -void LLVMExecutableModel::computeEventPriorites() -void LLVMExecutableModel::setConcentration(int index, double value) -void LLVMExecutableModel::computeReactionRates(double time, double* y) -void LLVMExecutableModel::setCompartmentVolumes() -int LLVMExecutableModel::getNumLocalParameters(int reactionId) -void LLVMExecutableModel::computeRules(vector& _y) -void LLVMExecutableModel::computeRules(double* ay, int size) -void LLVMExecutableModel::initializeInitialConditions() -void LLVMExecutableModel::setParameterValues() -void LLVMExecutableModel::setBoundaryConditions() -void LLVMExecutableModel::setInitialConditions() -void LLVMExecutableModel::evalInitialAssignments() -void LLVMExecutableModel::convertToAmounts() -void LLVMExecutableModel::computeConservedTotals() -double LLVMExecutableModel::getConcentration(int index) -vector LLVMExecutableModel::getCurrentValues() -double LLVMExecutableModel::getAmounts(const int& i) -void LLVMExecutableModel::initializeRates() -void LLVMExecutableModel::assignRates() -void LLVMExecutableModel::assignRates(vector& rates) -void LLVMExecutableModel::convertToConcentrations() -void LLVMExecutableModel::updateDependentSpeciesValues(double* _y) -void LLVMExecutableModel::computeAllRatesOfChange() -void LLVMExecutableModel::evalModel(const double& time, const vector& y) -void LLVMExecutableModel::evalEvents(const double& time, -void LLVMExecutableModel::resetEvents() -void LLVMExecutableModel::testConstraints() -void LLVMExecutableModel::initializeRateRuleSymbols() -string LLVMExecutableModel::getInfo() -const SymbolList& LLVMExecutableModel::getConservations() -const StringList LLVMExecutableModel::getConservationNames() -int LLVMExecutableModel::getFloatingSpeciesIndex(const string& allocator) -string LLVMExecutableModel::getFloatingSpeciesName(int int1) -int LLVMExecutableModel::getBoundarySpeciesIndex(const string& allocator) -string LLVMExecutableModel::getBoundarySpeciesName(int int1) -int LLVMExecutableModel::getBoundarySpeciesCompartmentIndex(int int1) -int LLVMExecutableModel::getGlobalParameterIndex(const string& allocator) -string LLVMExecutableModel::getGlobalParameterName(int int1) -int LLVMExecutableModel::getCompartmentIndex(const string& allocator) -string LLVMExecutableModel::getCompartmentName(int int1) -int LLVMExecutableModel::getReactionIndex(const string& allocator) -string LLVMExecutableModel::getReactionName(int int1) -double LLVMExecutableModel::getGlobalParameterValue(int index) -void LLVMExecutableModel::setGlobalParameterValue(int index, double value) -LLVMExecutableModel* LLVMExecutableModel::dummy() - return new LLVMExecutableModel(); diff --git a/source/rrLLVMExecutableModel.h b/source/rrLLVMExecutableModel.h --- a/source/rrLLVMExecutableModel.h - * rrLLVMExecutableModel.h -#ifndef rrLLVMExecutableModelH -#define rrLLVMExecutableModelH -class LLVMExecutableModel: public rr::ExecutableModel - LLVMExecutableModel(); - virtual ~LLVMExecutableModel(); - static LLVMExecutableModel* dummy(); -#endif /* rrLLVMExecutableModelH */ diff --git a/source/rrLLVMInitialValueCodeGen.cpp b/source/rrLLVMInitialValueCodeGen.cpp --- a/source/rrLLVMInitialValueCodeGen.cpp - * rrLLVMInitialValueCodeGen.cpp -#include "rrLLVMInitialValueCodeGen.h" -LLVMInitialValueCodeGen::LLVMInitialValueCodeGen(const LLVMModelGeneratorContext &mgc) -LLVMInitialValueCodeGen::~LLVMInitialValueCodeGen() diff --git a/source/rrLLVMInitialValueCodeGen.h b/source/rrLLVMInitialValueCodeGen.h --- a/source/rrLLVMInitialValueCodeGen.h - * rrLLVMInitialValueCodeGen.h -#ifndef RRLLVMINITIALVALUECODEGEN_H_ -#define RRLLVMINITIALVALUECODEGEN_H_ -#include "rrLLVMModelGeneratorContext.h" -using llvm::Function; -class LLVMInitialValueCodeGen : public libsbml::SBMLVisitor - LLVMInitialValueCodeGen(const LLVMModelGeneratorContext &mgc); - ~LLVMInitialValueCodeGen(); -#endif /* RRLLVMINITIALVALUECODEGEN_H_ */ diff --git a/source/rrLLVMModelDataIRBuilder.cpp b/source/rrLLVMModelDataIRBuilder.cpp --- a/source/rrLLVMModelDataIRBuilder.cpp - * rrLLVMModelDataIRBuilder.cpp -#include "rrLLVMModelDataIRBuilder.h" -#include "rrLLVMException.h" -#include -#include "llvm/ADT/APInt.h" -using namespace llvm; -const char* LLVMModelDataIRBuilder::ModelDataName = "rr::ModelData"; -//static LLVMContext *context; -//static LLVMContext &getContext() { -// size_t llvm_size = dl.getTypeStoreSize(s); -// printf("TestStruct size: %i, , LLVM Size: %i\n", sizeof(TestStruct), llvm_size); -// PointerType *structTypePtr = llvm::PointerType::get(structType, 0); -// LLVMContext &context = getContext(); -// PointerType *structTypePtr = llvm::PointerType::get(structType, 0); -LLVMModelDataIRBuilder::LLVMModelDataIRBuilder(const LLVMModelDataSymbols &symbols, -LLVMModelDataIRBuilder::~LLVMModelDataIRBuilder() -llvm::Value* LLVMModelDataIRBuilder::createFloatSpeciesConcEP(llvm::Value* s, -llvm::Value* LLVMModelDataIRBuilder::createFloatSpeciedAmtEP(llvm::Value* s, - throw LLVMException("not implemented", __FUNC__); -llvm::Value* LLVMModelDataIRBuilder::createFloatSpeciesConcFromAmtLoad( - llvm::Value* s, const std::string& id) - throw LLVMException("not implemented", __FUNC__); -llvm::Value* LLVMModelDataIRBuilder::createFloatSpeciesAmtFromConcLoad( - llvm::Value* s, const std::string& id) - throw LLVMException("not implemented", __FUNC__); -llvm::Value* LLVMModelDataIRBuilder::createGlobalParamEP(llvm::Value* s, -llvm::Value* LLVMModelDataIRBuilder::createGEP(llvm::Value* s, -void LLVMModelDataIRBuilder::createAccessors(Module *module) - LLVMContext &context = module->getContext(); -pair LLVMModelDataIRBuilder::createFloatingSpeciesAccessors( - llvm::Module* module, const std::string id) - LLVMContext &context = module->getContext(); -llvm::Value* LLVMModelDataIRBuilder::createFloatSpeciesConcStore(Value* s, -llvm::Value* LLVMModelDataIRBuilder::createFloatSpeciesCompEP(llvm::Value* s, -llvm::Value* LLVMModelDataIRBuilder::createGEP(llvm::Value* s, -void LLVMModelDataIRBuilder::validateStruct(llvm::Value* s, const char* funcName) - throw LLVMException(err); - throw LLVMException(err.str()); -void LLVMModelDataIRBuilder::test(Module *module, IRBuilder<> *build, -llvm::StructType *LLVMModelDataIRBuilder::getStructType(llvm::Module *module, llvm::ExecutionEngine *engine) - LLVMContext &context = module->getContext(); - size_t llvm_size = dl->getTypeStoreSize(structType); - if (sizeof(ModelData) != llvm_size) - err << "llvm rr::ModelData size " << llvm_size << - throw LLVMException(err.str(), __FUNC__); - printf("TestStruct size: %i, , LLVM Size: %i\n", sizeof(ModelData), llvm_size); - printf("C++ bool size: %i, LLVM bool size: %i\n", sizeof(bool), dl->getTypeStoreSize(boolType)); - printf("C++ bool* size: %i, LLVM bool* size: %i\n", sizeof(bool*), dl->getTypeStoreSize(boolPtrType)); - printf("C++ char** size: %i, LLVM char** size: %i\n", sizeof(char**), dl->getTypeStoreSize(charStarStarType)); - printf("C++ void* size: %i, LLVM void* size: %i\n", sizeof(void*), dl->getTypeStoreSize(voidPtrType)); diff --git a/source/rrLLVMModelDataIRBuilder.h b/source/rrLLVMModelDataIRBuilder.h --- a/source/rrLLVMModelDataIRBuilder.h - * rrLLVMModelDataSymbols.h -#ifndef rrLLVMModelDataIRBuilderH -#define rrLLVMModelDataIRBuilderH -#include "rrLLVMIncludes.h" -#include "rrLLVMModelDataSymbols.h" -class LLVMModelDataIRBuilder - LLVMModelDataIRBuilder(LLVMModelDataSymbols const&, - llvm::IRBuilder<> * = 0); - virtual ~LLVMModelDataIRBuilder(); - llvm::Value *createFloatSpeciesConcEP(llvm::Value *s, const std::string &id); - llvm::Value *createFloatSpeciesConcStore(llvm::Value *s, const std::string &id, - llvm::Value *value); - llvm::Value *createFloatSpeciedAmtEP(llvm::Value *s, const std::string &id); - llvm::Value *createFloatSpeciesConcFromAmtLoad(llvm::Value *s, const std::string &id); - llvm::Value *createFloatSpeciesAmtFromConcLoad(llvm::Value *s, const std::string &id); - llvm::Value *createFloatSpeciesCompEP(llvm::Value *s, const std::string &id); - llvm::Value *createGlobalParamEP(llvm::Value *s, const std::string &id); - llvm::Value *createGEP(llvm::Value *, ModelDataFields field); - llvm::Value *createGEP(llvm::Value *, ModelDataFields field, unsigned index); -// * LLVM specific - void createAccessors(llvm::Module *module); - std::pair createFloatingSpeciesAccessors(llvm::Module *module, - void test(llvm::Module *module, - llvm::IRBuilder<> *build, llvm::ExecutionEngine * engine); - static llvm::StructType *getStructType(llvm::Module *module, llvm::ExecutionEngine *engine = 0); - llvm::IRBuilder<> *builder; - LLVMModelDataSymbols const& symbols; - void validateStruct(llvm::Value *s, const char* funcName); - llvm::Value *cachedStructValue; -#endif /* rrLLVMModelDataIRBuilderH */ diff --git a/source/rrLLVMModelDataSymbols.cpp b/source/rrLLVMModelDataSymbols.cpp --- a/source/rrLLVMModelDataSymbols.cpp - * rrLLVMModelDataSymbols.cpp -#include "rrLLVMModelDataSymbols.h" -#include "rrLLVMException.h" -#include -using namespace llvm; -static std::vector getIds(const rr::LLVMModelDataSymbols::StringIntMap & m) - for(rr::LLVMModelDataSymbols::StringIntMap::const_iterator i = m.begin(); -LLVMModelDataSymbols::LLVMModelDataSymbols() -LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model *model, -LLVMModelDataSymbols::~LLVMModelDataSymbols() -int LLVMModelDataSymbols::getCompartmentIndex( - throw LLVMException("could not find compartment with id " + id, __FUNC__); -int LLVMModelDataSymbols::getFloatingSpeciesIndex( - throw LLVMException("could not find floating species with id " + id, __FUNC__); -int LLVMModelDataSymbols::getBoundarySpeciesIndex( - throw LLVMException("could not find boundary species with id " + id, __FUNC__); -int LLVMModelDataSymbols::getGlobalParameterIndex( - throw LLVMException("could not find global parameter species with id " + id, __FUNC__); -void LLVMModelDataSymbols::initAllocModelDataBuffers(ModelData& m) const -std::vector LLVMModelDataSymbols::getCompartmentIds() const -std::vector LLVMModelDataSymbols::getBoundarySpeciesIds() const -int LLVMModelDataSymbols::getFloatingSpeciesCompartmentIndex( -int LLVMModelDataSymbols::getBoundarySpeciesCompartmentIndex( -void LLVMModelDataSymbols::print() const -std::vector LLVMModelDataSymbols::getGlobalParameterIds() const -std::vector LLVMModelDataSymbols::getFloatingSpeciesIds() const diff --git a/source/rrLLVMModelDataSymbols.h b/source/rrLLVMModelDataSymbols.h --- a/source/rrLLVMModelDataSymbols.h - * rrLLVMModelDataSymbols.h -#ifndef LLVMModelDataSymbolsH -#define LLVMModelDataSymbolsH -class LLVMModelDataSymbols - LLVMModelDataSymbols(); - LLVMModelDataSymbols(libsbml::Model const* model, - virtual ~LLVMModelDataSymbols(); -// * LLVM specific -#endif /* RRLLVMMODELDATASYMBOLS_H_ */ diff --git a/source/rrLLVMModelGenerator.cpp b/source/rrLLVMModelGenerator.cpp --- a/source/rrLLVMModelGenerator.cpp - * rrLLVMModelGenerator.cpp -#include "rrLLVMModelGenerator.h" -LLVMModelGenerator::LLVMModelGenerator() -LLVMModelGenerator::~LLVMModelGenerator() -bool LLVMModelGenerator::setTemporaryDirectory(const string& path) -string LLVMModelGenerator::getTemporaryDirectory() -ExecutableModel* LLVMModelGenerator::createModel(const string& sbml, -Compiler* LLVMModelGenerator::getCompiler() -bool LLVMModelGenerator::setCompiler(const string& compiler) diff --git a/source/rrLLVMModelGenerator.h b/source/rrLLVMModelGenerator.h --- a/source/rrLLVMModelGenerator.h - * rrLLVMModelGenerator.h -#ifndef rrLLVMModelGeneratorH -#define rrLLVMModelGeneratorH -class LLVMModelGenerator: public rr::ModelGenerator - LLVMModelGenerator(); - virtual ~LLVMModelGenerator(); -#endif /* rrLLVMModelGeneratorH */ diff --git a/source/rrLLVMModelGeneratorContext.cpp b/source/rrLLVMModelGeneratorContext.cpp --- a/source/rrLLVMModelGeneratorContext.cpp - * rrLLVMModelGeneratorContext.cpp -#include "rrLLVMModelGeneratorContext.h" -#include "rrLLVMIncludes.h" -using namespace llvm; -LLVMModelGeneratorContext::LLVMModelGeneratorContext(std::string const &sbml, - // initialize LLVM - context = new LLVMContext(); - module = new Module("LLVM Module", *context); -LLVMModelGeneratorContext::LLVMModelGeneratorContext(libsbml::SBMLDocument const *doc, - // initialize LLVM - context = new LLVMContext(); - module = new Module("LLVM Module", *context); -LLVMModelGeneratorContext::~LLVMModelGeneratorContext() -llvm::LLVMContext& LLVMModelGeneratorContext::getContext() const -llvm::ExecutionEngine* LLVMModelGeneratorContext::getExecutionEngine() const -const LLVMModelDataSymbols& LLVMModelGeneratorContext::getModelDataSymbols() const -const libsbml::SBMLDocument* LLVMModelGeneratorContext::getDocument() const -const libsbml::Model* LLVMModelGeneratorContext::getModel() const -llvm::Module* LLVMModelGeneratorContext::getModule() const -llvm::IRBuilder<>* LLVMModelGeneratorContext::getBuilder() const diff --git a/source/rrLLVMSymbolForest.h b/source/rrLLVMSymbolForest.h --- a/source/rrLLVMSymbolForest.h - * rrLLVMSymbolForest.h -#ifndef LLVMSymbolForestH -#define LLVMSymbolForestH -class LLVMSymbolForest -#endif /* LLVMSymbolForestH +#include "llvm/LLVMModelGenerator.h" +#if defined(BUILD_LLVM) + if (ucomp == "LLVM") + Log(Logger::PRIO_NOTICE) << "Creating LLVM based model generator."; + return new LLVMModelGenerator(); + * @param compiler: the textual name of the compiler. If this is "llvm", then then + * the LLVM ModelGenerator is created, otherwise, A C based model generator is + * C files and objects here, not used for LLVM. + * not used in LLVM. + * These funcs are used by the generated LLVM model. - * size in LLVM land. + * Only used in the LLVM version. + * In the LLVM version, this is just a pointer to a data block * LLVM specific + usage<= 3) && (LLVM_VERSION_MINOR >= 3) #include #include #include #include #include -#elif (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 1) +//#elif (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 1) #include #include #include diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -93,12 +93,12 @@ llvm::StructType* ModelDataIRBuilder::getCSRSparseStructType( -#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 1) - size_t llvm_size = td->getTypeStoreSize(structType); +#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 2) size_t llvm_size = dl->getTypeStoreSize(structType); + size_t llvm_size = td->getTypeStoreSize(structType); if (sizeof(csr_matrix) != llvm_size) @@ -461,12 +461,12 @@ llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module, llvm:: -#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 1) - size_t llvm_size = td->getTypeStoreSize(structType); +#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 2) size_t llvm_size = dl->getTypeStoreSize(structType); + size_t llvm_size = td->getTypeStoreSize(structType); if (sizeof(LLVMModelData) != llvm_size) add inverse hyperbolic functions back, use the external C ones instead of intrinsics to be compatible with older llvm diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -435,8 +435,7 @@ llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode *ast) @@ -469,16 +468,14 @@ llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode *ast) diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -94,8 +94,8 @@ llvm::StructType* ModelDataIRBuilder::getCSRSparseStructType( #if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 1) - size_t llvm_size = td->getTypeStoreSize(structType); + size_t llvm_size = td->getTypeStoreSize(structType); size_t llvm_size = dl->getTypeStoreSize(structType); @@ -456,14 +456,14 @@ llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module, llvm:: structType = StructType::create(context, elements, LLVMModelDataName); #if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 1) - size_t llvm_size = td->getTypeStoreSize(structType); + size_t llvm_size = td->getTypeStoreSize(structType); size_t llvm_size = dl->getTypeStoreSize(structType); diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp using namespace llvm; changes to compile with older LLVM 3.1 diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -435,8 +435,8 @@ llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode *ast) @@ -469,16 +469,16 @@ llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode *ast) diff --git a/source/llvm/LLVMIncludes.h b/source/llvm/LLVMIncludes.h --- a/source/llvm/LLVMIncludes.h +++ b/source/llvm/LLVMIncludes.h -#if (LLVM_VERSION_MINOR >= 3) +#ifndef LLVM_VERSION_MAJOR +#error "At least LLVM version 3.1 required" +#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 3) #include #include #include #include #include #include +#elif (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 2) #include #include #include #include #include #include +#elif (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 1) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -93,9 +93,13 @@ llvm::StructType* ModelDataIRBuilder::getCSRSparseStructType( +#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 1) + size_t llvm_size = td->getTypeStoreSize(structType); size_t llvm_size = dl->getTypeStoreSize(structType); if (sizeof(csr_matrix) != llvm_size) @@ -457,9 +461,13 @@ llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module, llvm:: +#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR == 1) + size_t llvm_size = td->getTypeStoreSize(structType); size_t llvm_size = dl->getTypeStoreSize(structType); if (sizeof(LLVMModelData) != llvm_size) diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp removed obsolete fields from llvmmodeldata struct diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -83,7 +83,7 @@ LLVMExecutableModel::LLVMExecutableModel() : LLVMExecutableModel::~LLVMExecutableModel() @@ -100,7 +100,7 @@ LLVMExecutableModel::~LLVMExecutableModel() string LLVMExecutableModel::getModelName() void LLVMExecutableModel::setTime(double time) diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp @@ -57,13 +57,10 @@ void LLVMModelData::init(LLVMModelData &data) void LLVMModelData::allocBuffers(LLVMModelData &data, const string& modelName) @@ -72,9 +69,6 @@ void LLVMModelData::allocBuffers(LLVMModelData &data, const string& modelName) @@ -139,8 +133,6 @@ std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) void LLVMModelData::freeBuffers(LLVMModelData &data) @@ -154,82 +146,6 @@ void LLVMModelData::freeBuffers(LLVMModelData &data) -void LLVMModelData::clone(LLVMModelData *dst, LLVMModelData *src) - memcpy(dst, src, sizeof(LLVMModelData)); -void LLVMModelData::copyBuffers(LLVMModelData *dst, LLVMModelData *src) diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h @@ -172,35 +172,11 @@ struct LLVMModelData static void init(LLVMModelData&); - static void clone(LLVMModelData *dst, LLVMModelData *src); static void allocBuffers(LLVMModelData &data, const std::string& modelName); - static void copyBuffers(LLVMModelData *dst, LLVMModelData *src); static void freeBuffers(LLVMModelData&); diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -147,6 +147,10 @@ LLVMModelDataSymbols::~LLVMModelDataSymbols() +const std::string& LLVMModelDataSymbols::getModelName() const uint LLVMModelDataSymbols::getCompartmentIndex( @@ -249,13 +253,13 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h virtual ~LLVMModelDataSymbols(); removed unused fields from llvm modeldata diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp @@ -132,38 +132,6 @@ std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) @@ -176,15 +144,12 @@ void LLVMModelData::freeBuffers(LLVMModelData &data) diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -179,7 +174,7 @@ uint LLVMModelDataSymbols::getFloatingSpeciesIndex( @@ -244,35 +239,26 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const std::vector LLVMModelDataSymbols::getCompartmentIds() const @@ -422,7 +408,7 @@ bool LLVMModelDataSymbols::isIndependentCompartment(const std::string& id) const const char* LLVMModelDataSymbols::getFieldName(ModelDataFields field) diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -452,12 +452,7 @@ llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module, llvm:: structType = StructType::create(context, elements, LLVMModelDataName); @@ -97,6 +97,7 @@ if(BUILD_LLVM) llvm/ASTNodeFactory llvm/CodeGenBase llvm/LLVMCompiler + llvm/EvalConversionFactorCodeGen llvm/EvalInitialConditionsCodeGen llvm/EvalRateRuleRatesCodeGen llvm/EvalReactionRatesCodeGen diff --git a/source/llvm/EvalConversionFactorCodeGen.cpp b/source/llvm/EvalConversionFactorCodeGen.cpp +++ b/source/llvm/EvalConversionFactorCodeGen.cpp +#include "LLVMException.h" +namespace rrllvm +using namespace llvm; +} /* namespace rrllvm */ diff --git a/source/llvm/EvalConversionFactorCodeGen.h b/source/llvm/EvalConversionFactorCodeGen.h +++ b/source/llvm/EvalConversionFactorCodeGen.h +namespace rrllvm +typedef void (*EvalConversionFactorCodeGen_FunctionPtr)(rr::LLVMModelData*); + llvm::Value *codeGen(); +} /* namespace rrllvm */ diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp + list stoichEntries = + for (list::iterator i = + LLVMModelDataSymbols::SpeciesReferenceInfo nz = *i; diff --git a/source/llvm/EvalReactionRatesCodeGen.cpp b/source/llvm/EvalReactionRatesCodeGen.cpp --- a/source/llvm/EvalReactionRatesCodeGen.cpp +++ b/source/llvm/EvalReactionRatesCodeGen.cpp + // single arg type of LLVMModelData* + llvm::Type *argTypes[] = { + llvm::PointerType::get( + llvm::Value *args[] = { 0 }; + llvm::BasicBlock *basicBlock = codeGenHeader(FunctionName, + llvm::Type::getDoubleTy(context), diff --git a/source/llvm/EvalReactionRatesCodeGen.h b/source/llvm/EvalReactionRatesCodeGen.h --- a/source/llvm/EvalReactionRatesCodeGen.h +++ b/source/llvm/EvalReactionRatesCodeGen.h -typedef void (*EvalReactionRates_FunctionPtr)(LLVMModelData*); +typedef double (*EvalReactionRates_FunctionPtr)(LLVMModelData*); diff --git a/source/llvm/EvalVolatileStoichCodeGen.cpp b/source/llvm/EvalVolatileStoichCodeGen.cpp --- a/source/llvm/EvalVolatileStoichCodeGen.cpp +++ b/source/llvm/EvalVolatileStoichCodeGen.cpp const LLVMModelDataSymbols::SpeciesReferenceInfo &info = diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -70,7 +70,8 @@ LLVMExecutableModel::LLVMExecutableModel() : LLVMModelData::init(modelData); @@ -215,10 +216,12 @@ void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h rrllvm::EvalVolatileStoichCodeGen::FunctionPtr evalVolatileStoichPtr; + rrllvm::EvalConversionFactorCodeGen::FunctionPtr evalConversionFactorPtr; diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -313,13 +313,15 @@ uint LLVMModelDataSymbols::getFloatingSpeciesSize() const -std::list > LLVMModelDataSymbols::getStoichiometryIndx() const +std::list + LLVMModelDataSymbols::getStoichiometryIndx() const @@ -747,13 +749,16 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) @@ -778,13 +783,16 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h LLVMModelDataSymbols(); diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -89,6 +89,9 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -121,6 +124,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -186,6 +186,29 @@ llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtStore( +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtRateGEP( +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtRateLoad( + const std::string& id, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtRateStore( + const std::string& id, llvm::Value* value) llvm::Module* ModelDataIRBuilder::getModule(IRBuilder<> &builder, const char* func) diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h llvm::Value *value); + llvm::Value *createFloatSpeciesAmtRateGEP(const std::string &id, + const llvm::Twine &name = ""); + llvm::Value *createFloatSpeciesAmtRateLoad(const std::string& id, + const llvm::Twine& name = ""); + llvm::Value *createFloatSpeciesAmtRateStore(const std::string &id, + llvm::Value *value); llvm::Value *createBoundSpeciesAmtLoad(const std::string& id, @@ -119,6 +119,7 @@ if(BUILD_LLVM) llvm/LLVMModelSymbols llvm/SetRateRuleValuesCodeGen llvm/SBMLSupportFunctions + llvm/EvalVolatileStoichCodeGen endif(BUILD_LLVM) diff --git a/source/llvm/EvalVolatileStoichCodeGen.cpp b/source/llvm/EvalVolatileStoichCodeGen.cpp --- a/source/llvm/EvalVolatileStoichCodeGen.cpp +++ b/source/llvm/EvalVolatileStoichCodeGen.cpp @@ -19,6 +21,8 @@ namespace rrllvm using namespace llvm; + const LLVMModelDataSymbols::SpeciesReferenceInfo &info = + const LLVMModelDataSymbols::SpeciesReferenceInfo &info = } /* namespace rrllvm */ diff --git a/source/llvm/EvalVolatileStoichCodeGen.h b/source/llvm/EvalVolatileStoichCodeGen.h --- a/source/llvm/EvalVolatileStoichCodeGen.h +++ b/source/llvm/EvalVolatileStoichCodeGen.h namespace rrllvm -typedef void (*EvalVolatileStoichCodeGen_FunctionPtr)(rr::LLVMModelData*, int32_t); +typedef void (*EvalVolatileStoichCodeGen_FunctionPtr)(rr::LLVMModelData*); llvm::Value *codeGen(); } /* namespace rrllvm */ diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -430,6 +430,8 @@ int LLVMExecutableModel::setStateVector(const double* stateVector) diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -934,68 +934,6 @@ const LLVMModelDataSymbols::SpeciesReferenceInfo& -bool LLVMModelDataSymbols::isConstantSpeciesReference( -bool LLVMModelDataSymbols::isConstantASTNode(const ASTNode *ast) const diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/EvalVolatileStoichCodeGen.cpp b/source/llvm/EvalVolatileStoichCodeGen.cpp +++ b/source/llvm/EvalVolatileStoichCodeGen.cpp +#include "LLVMException.h" +namespace rrllvm +using namespace llvm; +} /* namespace rrllvm */ diff --git a/source/llvm/EvalVolatileStoichCodeGen.h b/source/llvm/EvalVolatileStoichCodeGen.h +++ b/source/llvm/EvalVolatileStoichCodeGen.h +namespace rrllvm +typedef void (*EvalVolatileStoichCodeGen_FunctionPtr)(rr::LLVMModelData*, int32_t); + llvm::Value *codeGen(); +} /* namespace rrllvm */ diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -69,7 +69,8 @@ LLVMExecutableModel::LLVMExecutableModel() : LLVMModelData::init(modelData); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h + rrllvm::EvalVolatileStoichCodeGen::FunctionPtr evalVolatileStoichPtr; diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -730,13 +730,13 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) @@ -747,10 +747,27 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) + throw_llvm_exception(msg); @@ -761,11 +778,29 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) + throw_llvm_exception(msg); bool LLVMModelDataSymbols::isValidSpeciesReference( @@ -879,6 +914,89 @@ uint LLVMModelDataSymbols::getEventBufferSize(uint eventId) const +bool LLVMModelDataSymbols::isNamedSpeciesReference(const std::string& id) const +const LLVMModelDataSymbols::SpeciesReferenceInfo& + LLVMModelDataSymbols::getNamedSpeciesReferenceInfo(const std::string& id) const + throw_llvm_exception(id + " is not a named SpeciesReference"); +bool LLVMModelDataSymbols::isConstantSpeciesReference( +bool LLVMModelDataSymbols::isConstantASTNode(const ASTNode *ast) const diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h LLVMModelDataSymbols(); LLVMModelDataSymbols(libsbml::Model const* model, diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp #include "LLVMIncludes.h" +using namespace rrllvm; @@ -85,6 +86,9 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -116,6 +120,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -344,6 +344,28 @@ llvm::Value* ModelDataIRBuilder::createReactionRateStore(const std::string& id, +llvm::Value* ModelDataIRBuilder::createStoichiometryStore(uint row, uint col, + llvm::Value* value, const llvm::Twine& name) + LLVMContext &context = builder.getContext(); +llvm::Value* ModelDataIRBuilder::createStoichiometryLoad(uint row, uint col, + const llvm::Twine& name) + LLVMContext &context = builder.getContext(); void ModelDataIRBuilder::validateStruct(llvm::Value* s, diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h llvm::Value *createRateRuleRateStore(const std::string &id, llvm::Value *value); + llvm::Value *createStoichiometryStore(uint row, uint col, + llvm::Value *value, const llvm::Twine& name = ""); + llvm::Value *createStoichiometryLoad(uint row, uint col, + const llvm::Twine& name = ""); diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp @@ -146,6 +146,25 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue(const std::string& sym + const LLVMModelDataSymbols::SpeciesReferenceInfo &info = + if (info.type == LLVMModelDataSymbols::Reactant) @@ -233,6 +252,23 @@ llvm::Value* ModelDataStoreSymbolResolver::storeSymbolValue( + const LLVMModelDataSymbols::SpeciesReferenceInfo &info = + if (info.type == LLVMModelDataSymbols::Reactant) diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -348,7 +354,7 @@ llvm::Value* ASTNodeCodeGen::applyLogicalCodeGen(const libsbml::ASTNode* ast) throw_llvm_exception(msg); @@ -433,7 +439,15 @@ llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode *ast) @@ -771,6 +785,19 @@ llvm::Value* ASTNodeCodeGen::piecewiseCodeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp diff --git a/source/llvm/SBMLSupportFunctions.cpp b/source/llvm/SBMLSupportFunctions.cpp --- a/source/llvm/SBMLSupportFunctions.cpp +++ b/source/llvm/SBMLSupportFunctions.cpp diff --git a/source/llvm/SBMLSupportFunctions.h b/source/llvm/SBMLSupportFunctions.h --- a/source/llvm/SBMLSupportFunctions.h +++ b/source/llvm/SBMLSupportFunctions.h diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -407,6 +407,9 @@ llvm::Value* ASTNodeCodeGen::functionCallCodeGen(const libsbml::ASTNode* ast) llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode *ast) @@ -415,117 +418,136 @@ llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode *ast) - throw_llvm_exception("do not handle acot yet") - throw_llvm_exception("do not handle acoth yet"); - throw_llvm_exception("do not handle acsc yet"); - throw_llvm_exception("do not handle acsch yet"); - throw_llvm_exception("do not handle asec yet"); - throw_llvm_exception("do not handle asech yet"); - throw_llvm_exception("do not handle cot yet"); - throw_llvm_exception("do not handle coth yet"); - throw_llvm_exception("do not handle csc yet"); - throw_llvm_exception("do not handle csch yet"); - throw_llvm_exception("do not handle factorial yet"); - throw_llvm_exception("do not handle log yet"); - throw_llvm_exception("do not handle root yet"); - throw_llvm_exception("do not handle sec yet"); - throw_llvm_exception("do not handle sech yet"); - throw_llvm_exception("unknown case") + throw_llvm_exception(msg); throw_llvm_exception(msg); diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp #include "LLVMIncludes.h" #include "LLVMException.h" static void createLibraryFunction(llvm::LibFunc::Func funcId, llvm::FunctionType *funcType, Module* module); + llvm::FunctionType *funcType, Module *module); + LLVMContext& context = module->getContext(); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispIntDecl(module), (void*)dispInt); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispDoubleDecl(module), (void*)dispDouble); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispCharDecl(module), (void*)dispChar); @@ -320,10 +427,10 @@ static void createLibraryFunction(llvm::LibFunc::Func funcId, llvm::FunctionType *funcType, Module *module) diff --git a/source/llvm/SBMLSupportFunctions.cpp b/source/llvm/SBMLSupportFunctions.cpp --- a/source/llvm/SBMLSupportFunctions.cpp +++ b/source/llvm/SBMLSupportFunctions.cpp diff --git a/source/llvm/SBMLSupportFunctions.h b/source/llvm/SBMLSupportFunctions.h --- a/source/llvm/SBMLSupportFunctions.h +++ b/source/llvm/SBMLSupportFunctions.h diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -252,20 +252,32 @@ llvm::Value* ASTNodeCodeGen::applyArithmeticCodeGen( throw_llvm_exception(err.str()); diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -705,7 +705,11 @@ llvm::Value* ASTNodeCodeGen::piecewiseCodeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/GetValueCodeGenBase.h b/source/llvm/GetValueCodeGenBase.h --- a/source/llvm/GetValueCodeGenBase.h +++ b/source/llvm/GetValueCodeGenBase.h diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp @@ -320,4 +320,10 @@ static void createLibraryFunction(llvm::LibFunc::Func funcId, + llvm::FunctionType *funcType, Module *module) @@ -118,6 +118,7 @@ if(BUILD_LLVM) llvm/ModelGeneratorContext llvm/LLVMModelSymbols llvm/SetRateRuleValuesCodeGen + llvm/SBMLSupportFunctions endif(BUILD_LLVM) diff --git a/source/llvm/SBMLSupportFunctions.cpp b/source/llvm/SBMLSupportFunctions.cpp +++ b/source/llvm/SBMLSupportFunctions.cpp diff --git a/source/llvm/SBMLSupportFunctions.h b/source/llvm/SBMLSupportFunctions.h +++ b/source/llvm/SBMLSupportFunctions.h diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h --- a/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h --- a/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h rr::LLVMExecutableModel& model; - typedef std::deque _Sequence; + typedef std::list _Sequence; diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -739,11 +739,7 @@ void LLVMExecutableModel::evalEventRoots(double time, const double* y, double* double LLVMExecutableModel::getNextPendingEventTime(bool pop) int LLVMExecutableModel::getPendingEventSize() diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h --- a/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h - private std::priority_queue > - typedef std::priority_queue > _base; + typedef std::deque _Sequence; diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h --- a/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h } /* namespace rrllvm */ diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp #include "LLVMException.h" @@ -74,6 +75,8 @@ LLVMExecutableModel::LLVMExecutableModel() : LLVMModelData::init(modelData); LLVMExecutableModel::~LLVMExecutableModel() @@ -777,6 +780,7 @@ bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, bool LLVMExecutableModel::getEventTieBreak(uint eventA, uint eventB) @@ -794,10 +798,15 @@ bool LLVMExecutableModel::getEventTieBreak(uint eventA, uint eventB) diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h --- a/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h - public std::priority_queue > + private std::priority_queue > typedef std::priority_queue > _base; diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp #include "LLVMException.h" @@ -668,34 +674,44 @@ void LLVMExecutableModel::evalEvents(double timeEnd, -int LLVMExecutableModel::applyPendingEvents(const double *stateVector, double timeEnd, +int LLVMExecutableModel::applyPendingEvents(const double *stateVector, @@ -759,6 +775,32 @@ bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, +bool LLVMExecutableModel::getEventTieBreak(uint eventA, uint eventB) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp #include "LLVMExecutableModel.h" @@ -27,6 +51,13 @@ Event::Event(rr::LLVMExecutableModel& model, uint id) : diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h --- a/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h rr::LLVMExecutableModel& model; public std::priority_queue > diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -66,7 +66,8 @@ LLVMExecutableModel::LLVMExecutableModel() : LLVMModelData::init(modelData); - LLVMModelData::init(modelDataCopy); LLVMExecutableModel::~LLVMExecutableModel() @@ -352,10 +353,15 @@ void LLVMExecutableModel::evalInitialConditions() void LLVMExecutableModel::reset() @@ -633,14 +639,7 @@ int LLVMExecutableModel::getEventTriggers(int len, const int *indx, unsigned cha @@ -745,33 +744,19 @@ bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, - pendingEvents.push(rrllvm::Event(*this, i)); + pendingEvents.push(rrllvm::Event(*this, i)); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h LLVMModelData modelData; - LLVMModelData modelDataCopy; LLVMModelDataSymbols *symbols; llvm::LLVMContext *context; llvm::ExecutionEngine *executionEngine; diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -102,8 +102,6 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, - LLVMModelData::clone(&exe->modelDataCopy, &exe->modelData); Changed LLVM event system to allow multiple concurrent events of the same type. Events are odd, assign time appears to be calcuated at trigger time, but priority appears to change after the event is triggered but before its applied. diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp @@ -18,8 +18,8 @@ namespace rrllvm Event::Event(rr::LLVMExecutableModel& model, uint id) : @@ -32,7 +32,7 @@ Event::Event(rr::LLVMExecutableModel& model, uint id) : diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h --- a/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h rr::LLVMExecutableModel& model; diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -87,8 +87,7 @@ LLVMModelDataSymbols::LLVMModelDataSymbols() : @@ -98,8 +97,7 @@ LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model *model, @@ -245,7 +243,6 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const @@ -421,16 +418,6 @@ bool LLVMModelDataSymbols::isIndependentCompartment(const std::string& id) const -uint LLVMModelDataSymbols::getEventAssignmentOffset(uint eventIndx) const -uint LLVMModelDataSymbols::getEventAssignmentSize() const const char* LLVMModelDataSymbols::getFieldName(ModelDataFields field) @@ -847,8 +834,8 @@ void LLVMModelDataSymbols::initEvents(const libsbml::Model* model) @@ -876,20 +863,8 @@ void LLVMModelDataSymbols::initEvents(const libsbml::Model* model) @@ -900,8 +875,8 @@ const std::vector& LLVMModelDataSymbols::getEventAttributes() con uint LLVMModelDataSymbols::getEventBufferSize(uint eventId) const diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -317,30 +317,6 @@ llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtGEP( -llvm::Value* ModelDataIRBuilder::createEventAssignmentGEP(uint eventId, - uint assignmentId, const llvm::Twine& name) -llvm::Value* ModelDataIRBuilder::createEventAssignmentLoad(uint eventId, - uint assignmentId, const llvm::Twine& name) -llvm::Value* ModelDataIRBuilder::createEventAssignmentStore(uint eventId, - uint assignmentId, llvm::Value* value) llvm::Value* ModelDataIRBuilder::createGlobalParamLoad( const std::string& id, const llvm::Twine& name) diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h llvm::Value *value); - llvm::Value *createEventAssignmentGEP(uint eventId, uint assignmentId, - const llvm::Twine &name = ""); - llvm::Value *createEventAssignmentLoad(uint eventId, uint assignmentId, - const llvm::Twine& name = ""); - llvm::Value *createEventAssignmentStore(uint eventId, uint assignmentId, - llvm::Value *value); llvm::Value *createRateRuleRateGEP(const std::string &id, diff --git a/source/llvm/EventAssignCodeGen.cpp b/source/llvm/EventAssignCodeGen.cpp --- a/source/llvm/EventAssignCodeGen.cpp +++ b/source/llvm/EventAssignCodeGen.cpp bool EventAssignCodeGen::eventCodeGen(llvm::Value *modelData, - llvm::Value *data, uint eventIndx, const libsbml::Event *event) + llvm::Value *data, const libsbml::Event *event) @@ -41,7 +41,8 @@ bool EventAssignCodeGen::eventCodeGen(llvm::Value *modelData, diff --git a/source/llvm/EventAssignCodeGen.h b/source/llvm/EventAssignCodeGen.h --- a/source/llvm/EventAssignCodeGen.h +++ b/source/llvm/EventAssignCodeGen.h - bool eventCodeGen(llvm::Value *modelData, llvm::Value *data, uint eventIndx, + bool eventCodeGen(llvm::Value *modelData, llvm::Value *data, diff --git a/source/llvm/EventCodeGenBase.h b/source/llvm/EventCodeGenBase.h --- a/source/llvm/EventCodeGenBase.h +++ b/source/llvm/EventCodeGenBase.h - bool eventCodeGen (llvm::Value *modelData, llvm::Value *data, uint eventId, + bool eventCodeGen (llvm::Value *modelData, llvm::Value *data, @@ -103,7 +103,7 @@ llvm::Value *EventCodeGenBase::codeGen() s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), i), block); diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp namespace rrllvm @@ -17,84 +19,82 @@ Event::Event(rr::LLVMExecutableModel& model, uint id) : -using namespace rrllvm; -void foo(LLVMExecutableModel& model) -EventComparator::EventComparator(LLVMExecutableModel& model) : -EventQueue::EventQueue(LLVMExecutableModel& model) : model(model) + bool operator()(const rrllvm::Event& event) const - rrllvm::Event *e = *i; diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h --- a/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h Event(rr::LLVMExecutableModel&, uint id); rr::LLVMExecutableModel& model; -class LLVMExecutableModel; - EventComparator(LLVMExecutableModel&); - LLVMExecutableModel &model; -template<> struct std::less - bool operator()(const rrllvm::Event *a, const rrllvm::Event *b) const - private std::priority_queue > + public std::priority_queue > - typedef std::priority_queue > _base; + typedef std::priority_queue > _base; - EventQueue(LLVMExecutableModel&); - _base::push(new rrllvm::Event(model, eventId)); - rrllvm::Event *p = c.end(); - LLVMExecutableModel& model; +} /* namespace rrllvm */ diff --git a/source/llvm/EventTriggerCodeGen.cpp b/source/llvm/EventTriggerCodeGen.cpp --- a/source/llvm/EventTriggerCodeGen.cpp +++ b/source/llvm/EventTriggerCodeGen.cpp -bool EventTriggerCodeGen::eventCodeGen(llvm::Value *modelData, llvm::Value *data, +bool EventTriggerCodeGen::eventCodeGen(llvm::Value *modelData, + llvm::Value *data, const libsbml::Event* event) @@ -46,7 +46,8 @@ bool EventTriggerCodeGen::eventCodeGen(llvm::Value *modelData, llvm::Value *data diff --git a/source/llvm/EventTriggerCodeGen.h b/source/llvm/EventTriggerCodeGen.h --- a/source/llvm/EventTriggerCodeGen.h +++ b/source/llvm/EventTriggerCodeGen.h - bool eventCodeGen(llvm::Value *modelData, llvm::Value *data, uint eventIndx, + bool eventCodeGen(llvm::Value *modelData, llvm::Value *data, diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -62,8 +62,7 @@ LLVMExecutableModel::LLVMExecutableModel() : LLVMModelData::init(modelData); @@ -692,20 +691,10 @@ int LLVMExecutableModel::applyPendingEvents(const double *stateVector, double ti @@ -734,28 +723,7 @@ double LLVMExecutableModel::getNextPendingEventTime(bool pop) @@ -779,14 +747,7 @@ bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, @@ -794,43 +755,26 @@ bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, + pendingEvents.push(rrllvm::Event(*this, i)); diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h + rrllvm::EventQueue pendingEvents; diff --git a/source/llvm/EventAssignCodeGen.cpp b/source/llvm/EventAssignCodeGen.cpp --- a/source/llvm/EventAssignCodeGen.cpp +++ b/source/llvm/EventAssignCodeGen.cpp bool EventAssignCodeGen::eventCodeGen(llvm::Value *modelData, + llvm::Value *data, uint eventIndx, const libsbml::Event *event) diff --git a/source/llvm/EventAssignCodeGen.h b/source/llvm/EventAssignCodeGen.h --- a/source/llvm/EventAssignCodeGen.h +++ b/source/llvm/EventAssignCodeGen.h - bool eventCodeGen(llvm::Value *modelData, uint eventIndx, + bool eventCodeGen(llvm::Value *modelData, llvm::Value *data, uint eventIndx, diff --git a/source/llvm/EventCodeGenBase.h b/source/llvm/EventCodeGenBase.h --- a/source/llvm/EventCodeGenBase.h +++ b/source/llvm/EventCodeGenBase.h -typedef void (*EventCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); +typedef void (*EventCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t, double*); - bool eventCodeGen (llvm::Value *modelData, uint eventId, const libsbml::Event *event) + bool eventCodeGen (llvm::Value *modelData, llvm::Value *data, uint eventId, @@ -64,14 +65,15 @@ llvm::Value *EventCodeGenBase::codeGen() llvm::Type *argTypes[] = { llvm::PointerType::get(ModelDataIRBuilder::getStructType(this->module), 0), - llvm::Type::getInt32Ty(this->context) + llvm::Type::getInt32Ty(this->context), + llvm::Type::getDoublePtrTy(this->context) - llvm::Value *args[] = {0, 0}; + llvm::Value *args[] = {0, 0, 0}; llvm::Type *retType = llvm::Type::getVoidTy(context); @@ -101,7 +103,7 @@ llvm::Value *EventCodeGenBase::codeGen() s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), i), block); diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp +namespace rrllvm +Event::Event(rr::LLVMExecutableModel& model, uint id) : +using namespace rrllvm; -EventQueue::EventQueue(LLVMExecutableModel& model) : +EventQueue::EventQueue(LLVMExecutableModel& model) : model(model) + rrllvm::Event *e = *i; diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h --- a/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h class LLVMExecutableModel; +namespace rrllvm { + Event(rr::LLVMExecutableModel&, uint id); + rr::LLVMExecutableModel& model; +class LLVMExecutableModel; LLVMExecutableModel &model; +template<> struct std::less + bool operator()(const rrllvm::Event *a, const rrllvm::Event *b) const + private std::priority_queue > + typedef std::priority_queue > _base; EventQueue(LLVMExecutableModel&); + _base::push(new rrllvm::Event(model, eventId)); + rrllvm::Event *p = c.end(); + LLVMExecutableModel& model; diff --git a/source/llvm/EventTriggerCodeGen.cpp b/source/llvm/EventTriggerCodeGen.cpp --- a/source/llvm/EventTriggerCodeGen.cpp +++ b/source/llvm/EventTriggerCodeGen.cpp -bool EventTriggerCodeGen::eventCodeGen(llvm::Value *modelData, uint eventIndx, +bool EventTriggerCodeGen::eventCodeGen(llvm::Value *modelData, llvm::Value *data, @@ -45,6 +45,7 @@ bool EventTriggerCodeGen::eventCodeGen(llvm::Value *modelData, uint eventIndx, @@ -53,3 +54,4 @@ bool EventTriggerCodeGen::eventCodeGen(llvm::Value *modelData, uint eventIndx, diff --git a/source/llvm/EventTriggerCodeGen.h b/source/llvm/EventTriggerCodeGen.h --- a/source/llvm/EventTriggerCodeGen.h +++ b/source/llvm/EventTriggerCodeGen.h - bool eventCodeGen(llvm::Value *modelData, uint eventIndx, + bool eventCodeGen(llvm::Value *modelData, llvm::Value *data, uint eventIndx, diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -734,7 +734,7 @@ double LLVMExecutableModel::getNextPendingEventTime(bool pop) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -898,6 +898,12 @@ const std::vector& LLVMModelDataSymbols::getEventAttributes() con +uint LLVMModelDataSymbols::getEventBufferSize(uint eventId) const diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp using namespace llvm; @@ -176,12 +177,21 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp ASTNodeCodeGen::ASTNodeCodeGen(llvm::IRBuilder<> &builder, @@ -304,35 +312,59 @@ llvm::Value* ASTNodeCodeGen::applyRelationalCodeGen(const libsbml::ASTNode* ast) llvm::Value* ASTNodeCodeGen::applyLogicalCodeGen(const libsbml::ASTNode* ast) + throw_llvm_exception(msg); + throw_llvm_exception(msg); llvm::Value* ASTNodeCodeGen::functionCallCodeGen(const libsbml::ASTNode* ast) @@ -551,6 +583,30 @@ llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode *ast) +llvm::Value* ASTNodeCodeGen::toBoolean(llvm::Value* value) llvm::Module* ASTNodeCodeGen::getModule() @@ -636,12 +692,10 @@ llvm::Value* ASTNodeCodeGen::piecewiseCodeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/ASTNodeCodeGen.h b/source/llvm/ASTNodeCodeGen.h --- a/source/llvm/ASTNodeCodeGen.h +++ b/source/llvm/ASTNodeCodeGen.h llvm::Value *codeGen(const libsbml::ASTNode *ast); llvm::Value *piecewiseCodeGen(const libsbml::ASTNode *ast); + llvm::Value *toBoolean(llvm::Value *value); llvm::IRBuilder<> &builder; llvm::Module *getModule(); diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -754,7 +754,7 @@ double LLVMExecutableModel::getNextPendingEventTime(bool pop) @@ -794,7 +794,8 @@ bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -100,7 +100,7 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, LLVMModelData::clone(&exe->modelDataCopy, &exe->modelData); diff --git a/source/llvm/SymbolForest.h b/source/llvm/SymbolForest.h --- a/source/llvm/SymbolForest.h +++ b/source/llvm/SymbolForest.h diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp #include "LLVMIncludes.h" @@ -165,6 +166,8 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -565,6 +568,107 @@ llvm::Module* ASTNodeCodeGen::getModule() +llvm::Value* ASTNodeCodeGen::piecewiseCodeGen(const libsbml::ASTNode* ast) + LLVMContext &context = builder.getContext(); diff --git a/source/llvm/ASTNodeCodeGen.h b/source/llvm/ASTNodeCodeGen.h --- a/source/llvm/ASTNodeCodeGen.h +++ b/source/llvm/ASTNodeCodeGen.h llvm::Value *intrinsicCallCodeGen(const libsbml::ASTNode *ast); + llvm::Value *piecewiseCodeGen(const libsbml::ASTNode *ast); llvm::IRBuilder<> &builder; diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -199,7 +199,21 @@ llvm::Value* ASTNodeCodeGen::notImplemented(const libsbml::ASTNode* ast) llvm::Value* ASTNodeCodeGen::nameExprCodeGen(const libsbml::ASTNode* ast) + throw_llvm_exception(string(ast->getName()) + llvm::Value* ASTNodeCodeGen::realExprCodeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/InitialValueSymbolResolver.cpp b/source/llvm/InitialValueSymbolResolver.cpp --- a/source/llvm/InitialValueSymbolResolver.cpp +++ b/source/llvm/InitialValueSymbolResolver.cpp @@ -38,6 +38,14 @@ llvm::Value* InitialValueSymbolResolver::loadSymbolValue(const std::string& symb const llvm::ArrayRef& args) diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp @@ -54,6 +54,16 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue(const std::string& sym diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -91,11 +91,6 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -130,15 +125,9 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -159,7 +148,6 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -173,10 +161,16 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -191,11 +185,6 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) -llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen( llvm::Value* ASTNodeCodeGen::notImplemented(const libsbml::ASTNode* ast) @@ -344,6 +333,224 @@ llvm::Value* ASTNodeCodeGen::functionCallCodeGen(const libsbml::ASTNode* ast) +llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen(const libsbml::ASTNode *ast) + throw_llvm_exception("do not handle acot yet") + throw_llvm_exception("do not handle acoth yet"); + throw_llvm_exception("do not handle acsc yet"); + throw_llvm_exception("do not handle acsch yet"); + throw_llvm_exception("do not handle asec yet"); + throw_llvm_exception("do not handle asech yet"); + throw_llvm_exception("do not handle cot yet"); + throw_llvm_exception("do not handle coth yet"); + throw_llvm_exception("do not handle csc yet"); + throw_llvm_exception("do not handle csch yet"); + throw_llvm_exception("do not handle factorial yet"); + throw_llvm_exception("do not handle log yet"); + throw_llvm_exception("do not handle root yet"); + throw_llvm_exception("do not handle sec yet"); + throw_llvm_exception("do not handle sech yet"); + throw_llvm_exception("unknown case") + throw_llvm_exception(msg); + throw_llvm_exception(err.str()); +llvm::Module* ASTNodeCodeGen::getModule() + throw_llvm_exception("could not get module, a BasicBlock is not currently being populated."); diff --git a/source/llvm/ASTNodeCodeGen.h b/source/llvm/ASTNodeCodeGen.h --- a/source/llvm/ASTNodeCodeGen.h +++ b/source/llvm/ASTNodeCodeGen.h llvm::Value *binaryExprCodeGen(const libsbml::ASTNode *ast); - * most of the AST types correspond to llvm intrinsic, i.e. - llvm::Value *intrinsicCallCodeGen(const libsbml::ASTNode *ast); llvm::Value *notImplemented(const libsbml::ASTNode *ast); llvm::Value *nameExprCodeGen(const libsbml::ASTNode *ast); llvm::Value *functionCallCodeGen(const libsbml::ASTNode *ast); + llvm::Value *intrinsicCallCodeGen(const libsbml::ASTNode *ast); llvm::IRBuilder<> &builder; + llvm::Module *getModule(); diff --git a/source/llvm/CodeGenBase.h b/source/llvm/CodeGenBase.h --- a/source/llvm/CodeGenBase.h +++ b/source/llvm/CodeGenBase.h - if (llvm::verifyFunction(*function, llvm::PrintMessageAction)) + if (llvm::verifyFunction(*function, llvm::AbortProcessAction)) diff --git a/source/llvm/LLVMIncludes.h b/source/llvm/LLVMIncludes.h --- a/source/llvm/LLVMIncludes.h +++ b/source/llvm/LLVMIncludes.h #include #include #include +#include diff --git a/source/llvm/ModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/ModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp #include "LLVMIncludes.h" +#include "LLVMException.h" +static void createLibraryFunction(llvm::LibFunc::Func funcId, + llvm::FunctionType *funcType, Module* module); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispCharDecl(module), (void*)dispChar); + LLVMContext& context = module->getContext(); +static void createLibraryFunction(llvm::LibFunc::Func funcId, + llvm::FunctionType *funcType, Module* module) + throw_llvm_exception(msg); diff --git a/source/llvm/ModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h --- a/source/llvm/ModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h diff --git a/source/llvm/EvalRateRuleRatesCodeGen.cpp b/source/llvm/EvalRateRuleRatesCodeGen.cpp --- a/source/llvm/EvalRateRuleRatesCodeGen.cpp +++ b/source/llvm/EvalRateRuleRatesCodeGen.cpp diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp --- a/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp @@ -30,12 +30,12 @@ EventComparator::EventComparator(LLVMExecutableModel& model) : diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -561,6 +561,7 @@ int LLVMExecutableModel::setConservedSums(int len, const int* indx, int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, @@ -574,6 +575,8 @@ int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, @@ -731,6 +734,25 @@ double LLVMExecutableModel::getNextPendingEventTime(bool pop) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -867,7 +867,10 @@ void LLVMModelDataSymbols::initEvents(const libsbml::Model* model) LLVM delayed events working @@ -102,6 +102,7 @@ if(BUILD_LLVM) llvm/EvalReactionRatesCodeGen llvm/EventAssignCodeGen llvm/EventTriggerCodeGen + llvm/EventQueue llvm/FunctionResolver llvm/LLVMExecutableModel llvm/GetRateRuleValuesCodeGen diff --git a/source/llvm/EventQueue.cpp b/source/llvm/EventQueue.cpp +++ b/source/llvm/EventQueue.cpp +#include "LLVMExecutableModel.h" +void foo(LLVMExecutableModel& model) +EventComparator::EventComparator(LLVMExecutableModel& model) : +EventQueue::EventQueue(LLVMExecutableModel& model) : diff --git a/source/llvm/EventQueue.h b/source/llvm/EventQueue.h +++ b/source/llvm/EventQueue.h +class LLVMExecutableModel; + EventComparator(LLVMExecutableModel&); + LLVMExecutableModel &model; + EventQueue(LLVMExecutableModel&); diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -63,7 +63,7 @@ LLVMExecutableModel::LLVMExecutableModel() : LLVMModelData::init(modelData); @@ -384,6 +384,7 @@ int LLVMExecutableModel::getStateVector(double* stateVector) @@ -595,22 +596,16 @@ int LLVMExecutableModel::setFloatingSpeciesInitConcentrations(int len, int LLVMExecutableModel::getFloatingSpeciesInitConcentrations(int len, double LLVMExecutableModel::getStoichiometry(int index) @@ -654,20 +649,31 @@ int LLVMExecutableModel::getEventTriggers(int len, const int *indx, unsigned cha -void LLVMExecutableModel::evalEvents(double timeEnd, const unsigned char* previousEventStatus, +void LLVMExecutableModel::evalEvents(double timeEnd, @@ -675,7 +681,31 @@ void LLVMExecutableModel::evalEvents(double timeEnd, const unsigned char* previo int LLVMExecutableModel::applyPendingEvents(const double *stateVector, double timeEnd, void LLVMExecutableModel::evalEventRoots(double time, const double* y, double* gdot) @@ -699,46 +729,39 @@ void LLVMExecutableModel::evalEventRoots(double time, const double* y, double* double LLVMExecutableModel::getNextPendingEventTime(bool pop) int LLVMExecutableModel::getPendingEventSize() void LLVMExecutableModel::resetEvents() -int LLVMExecutableModel::applyEvents(unsigned char* prevEventState, +bool LLVMExecutableModel::applyEvents(unsigned char* prevEventState, @@ -746,77 +769,44 @@ int LLVMExecutableModel::applyEvents(unsigned char* prevEventState, -LLVMExecutableModel::EventCompare::EventCompare(LLVMExecutableModel& model) : -bool LLVMExecutableModel::EventCompare::operator ()(uint a, uint b) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h - EventCompare(LLVMExecutableModel&); - LLVMExecutableModel &model; diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -99,6 +99,9 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, LLVMModelData::clone(&exe->modelDataCopy, &exe->modelData); llvm events implementation diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -62,7 +62,8 @@ LLVMExecutableModel::LLVMExecutableModel() : LLVMModelData::init(modelData); @@ -710,6 +711,113 @@ void LLVMExecutableModel::resetEvents() +int LLVMExecutableModel::applyEvents(unsigned char* prevEventState, +LLVMExecutableModel::EventCompare::EventCompare(LLVMExecutableModel& model) : +bool LLVMExecutableModel::EventCompare::operator ()(uint a, uint b) @@ -717,3 +825,4 @@ void LLVMExecutableModel::resetEvents() diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h - static LLVMExecutableModel* dummy(); + EventCompare(LLVMExecutableModel&); + LLVMExecutableModel &model; LLVMModelData modelData; + static LLVMExecutableModel* dummy(); friend class LLVMModelGenerator; diff --git a/source/llvm/SymbolForest.h b/source/llvm/SymbolForest.h --- a/source/llvm/SymbolForest.h +++ b/source/llvm/SymbolForest.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -620,7 +620,7 @@ int LLVMExecutableModel::getNumEvents() -int LLVMExecutableModel::getEventStatus(int len, const int *indx, unsigned char *values) +int LLVMExecutableModel::getEventTriggers(int len, const int *indx, unsigned char *values) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMModelGenerator.h b/source/llvm/LLVMModelGenerator.h --- a/source/llvm/LLVMModelGenerator.h +++ b/source/llvm/LLVMModelGenerator.h diff --git a/source/llvm_testing/src/TestBase.cpp b/source/llvm_testing/src/TestBase.cpp --- a/source/llvm_testing/src/TestBase.cpp +++ b/source/llvm_testing/src/TestBase.cpp diff --git a/source/llvm_testing/src/test_compiler.cpp b/source/llvm_testing/src/test_compiler.cpp --- a/source/llvm_testing/src/test_compiler.cpp +++ b/source/llvm_testing/src/test_compiler.cpp - ModelGenerator *mg = ModelGeneratorFactory::createModelGenerator("", "", "", "LLVM"); + ModelGenerator *mg = ModelGeneratorFactory::createModelGenerator("LLVM"); #include "llvm/LLVMModelGenerator.h" #if defined(BUILD_LLVM) + * @param compiler: the textual name of the compiler. If this is "llvm", then then + * the LLVM ModelGenerator is created, otherwise, A C based model generator is + * C files and objects here, not used for LLVM. + * not used in LLVM. diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -34,16 +34,13 @@ string LLVMModelGenerator::getTemporaryDirectory() return LLVMCompiler::gurgle(); -ExecutableModel* LLVMModelGenerator::createModel(const string& sbml, ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/LLVMModelGenerator.h b/source/llvm/LLVMModelGenerator.h --- a/source/llvm/LLVMModelGenerator.h +++ b/source/llvm/LLVMModelGenerator.h added LLVM option in the test suite +bool gUseLLVM = false; + if (args.compiler == "llvm") + gUseLLVM = true; + cout << "Enabling LLVM" << endl; + Log(Logger::PRIO_NOTICE) << "Enabling LLVM"; + usage<& builder) : +llvm::Value* KineticLawParameterResolver::loadSymbolValue( + const std::string& symbol, const llvm::ArrayRef& args) diff --git a/source/llvm/KineticLawParameterResolver.h b/source/llvm/KineticLawParameterResolver.h +++ b/source/llvm/KineticLawParameterResolver.h + const libsbml::KineticLaw &kineticLaw, llvm::IRBuilder<> &builder); + virtual llvm::Value *loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args = + llvm::ArrayRef()); + llvm::IRBuilder<> &builder; diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -221,6 +221,7 @@ void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) @@ -240,6 +241,7 @@ void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) void LLVMExecutableModel::testConstraints() @@ -545,7 +547,19 @@ int LLVMExecutableModel::setConservedSums(int len, const int* indx, int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, + throw LLVMException("index out of range"); removed methods definitions with NO implementation from RoadRunner, removed the non-working local parameter access methods from the ExecutableModel interface. In LLVM, local parameters simply override any global defs of the same name as one would expect diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h @@ -108,33 +108,6 @@ struct LLVMModelData - * LLVM specific @@ -144,17 +117,17 @@ struct LLVMModelData @@ -163,44 +136,44 @@ struct LLVMModelData @@ -210,15 +183,15 @@ struct LLVMModelData static void init(LLVMModelData&); diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -419,26 +419,23 @@ llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module, llvm:: structType = StructType::create(context, elements, LLVMModelDataName); removed species / comp maps from LLVMModelDataSymbols, duplicated info present in libsbml::Model diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp @@ -122,7 +122,6 @@ std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -277,15 +277,6 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const @@ -300,20 +291,6 @@ std::vector LLVMModelDataSymbols::getBoundarySpeciesIds() const -uint LLVMModelDataSymbols::getFloatingSpeciesCompartmentIndex( -uint LLVMModelDataSymbols::getBoundarySpeciesCompartmentIndex( uint LLVMModelDataSymbols::getReactionIndex(const std::string& id) const @@ -619,16 +596,6 @@ void LLVMModelDataSymbols::initBoundarySpecies(const libsbml::Model* model) @@ -713,16 +680,6 @@ void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -58,11 +58,6 @@ llvm::Value* ModelDataIRBuilder::createGEP(ModelDataFields field, -llvm::Value* ModelDataIRBuilder::createFloatSpeciesCompGEP(const std::string& id) llvm::Value* ModelDataIRBuilder::createGEP(ModelDataFields field, @@ -346,12 +341,6 @@ llvm::Value* ModelDataIRBuilder::createEventAssignmentStore(uint eventId, -llvm::Value* ModelDataIRBuilder::createBoundSpeciesCompGEP(const std::string& id) llvm::Value* ModelDataIRBuilder::createGlobalParamLoad( const std::string& id, const llvm::Twine& name) diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h llvm::Value *createBoundSpeciesAmtGEP(const std::string &id, const llvm::Twine &name = ""); - llvm::Value *createFloatSpeciesCompGEP(const std::string &id); - llvm::Value *createBoundSpeciesCompGEP(const std::string &id); llvm::Value *createGlobalParamGEP(const std::string &id); diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -126,6 +126,10 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -134,7 +138,7 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -183,7 +187,6 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) throw_llvm_exception(msg.str()); @@ -326,4 +329,21 @@ llvm::Value* ASTNodeCodeGen::applyLogicalCodeGen(const libsbml::ASTNode* ast) +llvm::Value* ASTNodeCodeGen::functionCallCodeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/ASTNodeCodeGen.h b/source/llvm/ASTNodeCodeGen.h --- a/source/llvm/ASTNodeCodeGen.h +++ b/source/llvm/ASTNodeCodeGen.h llvm::Value *applyLogicalCodeGen(const libsbml::ASTNode *ast); + llvm::Value *functionCallCodeGen(const libsbml::ASTNode *ast); llvm::IRBuilder<> &builder; diff --git a/source/llvm/FunctionResolver.cpp b/source/llvm/FunctionResolver.cpp --- a/source/llvm/FunctionResolver.cpp +++ b/source/llvm/FunctionResolver.cpp -#include "llvm/FunctionResolver.h" +#include "LLVMException.h" +using namespace llvm; const libsbml::Model* model, llvm::IRBuilder<>& builder) : llvm::Value* rr::FunctionResolver::loadSymbolValue(const std::string& symbol, const llvm::ArrayRef& args) + throw_llvm_exception("math elemetn of function definition must be a lambda"); + throw_llvm_exception("argument count does not match"); diff --git a/source/llvm/FunctionResolver.h b/source/llvm/FunctionResolver.h --- a/source/llvm/FunctionResolver.h +++ b/source/llvm/FunctionResolver.h const libsbml::Model *model, llvm::IRBuilder<> &builder); llvm::ArrayRef()); llvm::IRBuilder<> &builder; check for valid species references, make sure getFloatingSpeciesIndex only returns index for valid independent species, correct size of stoichimetry matrix when dependent species are present, remove unused stuff from LLVMModelData diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -153,6 +153,7 @@ void LLVMExecutableModel::computeConservedTotals() double LLVMExecutableModel::getFloatingSpeciesConcentration(int index) @@ -164,6 +165,8 @@ double LLVMExecutableModel::getFloatingSpeciesConcentration(int index) int LLVMExecutableModel::getFloatingSpeciesConcentrations(int len, int const *indx, diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp @@ -72,8 +72,6 @@ void LLVMModelData::allocBuffers(LLVMModelData &data, const string& modelName) @@ -179,12 +177,10 @@ void LLVMModelData::freeBuffers(LLVMModelData &data) @@ -260,19 +256,6 @@ void LLVMModelData::copyBuffers(LLVMModelData *dst, LLVMModelData *src) diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h @@ -157,64 +157,50 @@ struct LLVMModelData @@ -224,15 +210,15 @@ struct LLVMModelData static void init(LLVMModelData&); diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -178,12 +176,24 @@ uint LLVMModelDataSymbols::getFloatingSpeciesIndex( throw LLVMException("could not find floating species with id " + id, __FUNC__); @@ -228,9 +238,6 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const LLVMModelData::init(m); @@ -246,7 +253,7 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const @@ -263,22 +270,22 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const @@ -793,25 +800,13 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) @@ -820,29 +815,58 @@ void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) +bool LLVMModelDataSymbols::isValidSpeciesReference( void LLVMModelDataSymbols::displayCompartmentInfo() diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -436,22 +436,20 @@ llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module, llvm:: structType = StructType::create(context, elements, LLVMModelDataName); diff --git a/source/llvm/FunctionResolver.cpp b/source/llvm/FunctionResolver.cpp +++ b/source/llvm/FunctionResolver.cpp +#include "llvm/FunctionResolver.h" + const libsbml::Model* model, llvm::IRBuilder<>& builder) : +llvm::Value* rr::FunctionResolver::loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args) diff --git a/source/llvm/FunctionResolver.h b/source/llvm/FunctionResolver.h +++ b/source/llvm/FunctionResolver.h + const libsbml::Model *model, llvm::IRBuilder<> &builder); + virtual llvm::Value *loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args = + llvm::ArrayRef()); + llvm::IRBuilder<> &builder; + std::map *symbols; @@ -103,7 +103,7 @@ if(BUILD_LLVM) llvm/EvalReactionRatesCodeGen llvm/EventAssignCodeGen llvm/EventTriggerCodeGen - llvm/EventSymbolResolver + llvm/FunctionResolver llvm/LLVMExecutableModel llvm/GetRateRuleValuesCodeGen llvm/GetValuesCodeGen diff --git a/source/llvm/CodeGen.h b/source/llvm/CodeGen.h --- a/source/llvm/CodeGen.h +++ b/source/llvm/CodeGen.h - virtual llvm::Value *loadSymbolValue(const std::string& symbol) = 0; + virtual llvm::Value *loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args = + llvm::ArrayRef()) = 0; diff --git a/source/llvm/EventSymbolResolver.cpp b/source/llvm/EventSymbolResolver.cpp --- a/source/llvm/EventSymbolResolver.cpp -#include "llvm/EventSymbolResolver.h" -rr::EventSymbolResolver::EventSymbolResolver(llvm::Value* modelData, - const libsbml::Model* model, const LLVMModelSymbols& modelSymbols, - const LLVMModelDataSymbols& modelDataSymbols, - llvm::IRBuilder<>& builder, LoadSymbolResolver& resolver) -llvm::Value* rr::EventSymbolResolver::loadSymbolValue(const std::string& symbol) -llvm::Value* rr::EventSymbolResolver::storeSymbolValue( - const std::string& symbol, llvm::Value* value) diff --git a/source/llvm/EventSymbolResolver.h b/source/llvm/EventSymbolResolver.h --- a/source/llvm/EventSymbolResolver.h - EventSymbolResolver(llvm::Value *modelData, const libsbml::Model *model, - const LLVMModelSymbols &modelSymbols, - const LLVMModelDataSymbols &modelDataSymbols, - llvm::IRBuilder<> &builder, LoadSymbolResolver &resolver); - virtual llvm::Value *loadSymbolValue(const std::string& symbol); - virtual llvm::Value *storeSymbolValue(const std::string& symbol, - llvm::Value *value); diff --git a/source/llvm/InitialValueSymbolResolver.cpp b/source/llvm/InitialValueSymbolResolver.cpp --- a/source/llvm/InitialValueSymbolResolver.cpp +++ b/source/llvm/InitialValueSymbolResolver.cpp #include "LLVMException.h" llvm::IRBuilder<>& builder) : -llvm::Value* InitialValueSymbolResolver::loadSymbolValue( +llvm::Value* InitialValueSymbolResolver::loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args) diff --git a/source/llvm/InitialValueSymbolResolver.h b/source/llvm/InitialValueSymbolResolver.h --- a/source/llvm/InitialValueSymbolResolver.h +++ b/source/llvm/InitialValueSymbolResolver.h - virtual llvm::Value* loadSymbolValue(const std::string& symbol); + virtual llvm::Value *loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args = + llvm::ArrayRef()); const LLVMModelDataSymbols &modelDataSymbols; const LLVMModelSymbols &modelSymbols; llvm::IRBuilder<> &builder; diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp #include "LLVMException.h" @@ -46,13 +47,25 @@ ModelDataStoreSymbolResolver::ModelDataStoreSymbolResolver(llvm::Value *modelDat -llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue( +llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args) diff --git a/source/llvm/ModelDataSymbolResolver.h b/source/llvm/ModelDataSymbolResolver.h --- a/source/llvm/ModelDataSymbolResolver.h +++ b/source/llvm/ModelDataSymbolResolver.h - virtual llvm::Value *loadSymbolValue(const std::string& symbol); + virtual llvm::Value *loadSymbolValue(const std::string& symbol, + const llvm::ArrayRef& args = + llvm::ArrayRef()); llvm::Value *modelData; const LLVMModelSymbols &modelSymbols; const LLVMModelDataSymbols &modelDataSymbols; llvm::IRBuilder<> &builder; diff --git a/source/llvm/SymbolForest.h b/source/llvm/SymbolForest.h --- a/source/llvm/SymbolForest.h +++ b/source/llvm/SymbolForest.h diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -677,10 +677,6 @@ int LLVMExecutableModel::getPendingEventSize() -void LLVMExecutableModel::evalEvents(const double time, const double *y) void LLVMExecutableModel::resetEvents() diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h basic events working in LLVM diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -196,6 +196,8 @@ void LLVMExecutableModel::computeAllRatesOfChange() void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) @@ -604,8 +606,14 @@ int LLVMExecutableModel::getEventStatus(int len, const int *indx, unsigned char @@ -619,7 +627,19 @@ int LLVMExecutableModel::getEventStatus(int len, const int *indx, unsigned char void LLVMExecutableModel::evalEvents(double timeEnd, const unsigned char* previousEventStatus, int LLVMExecutableModel::applyPendingEvents(const double *stateVector, double timeEnd, @@ -630,6 +650,20 @@ int LLVMExecutableModel::applyPendingEvents(const double *stateVector, double ti void LLVMExecutableModel::evalEventRoots(double time, const double* y, double* gdot) diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -884,12 +884,12 @@ void LLVMModelDataSymbols::initEvents(const libsbml::Model* model) diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -57,7 +57,12 @@ LLVMExecutableModel::LLVMExecutableModel() : LLVMModelData::init(modelData); @@ -96,7 +101,6 @@ double LLVMExecutableModel::getTime() int LLVMExecutableModel::getNumIndependentSpecies() @@ -132,14 +136,6 @@ int LLVMExecutableModel::getNumReactions() -int LLVMExecutableModel::getNumEvents() -void LLVMExecutableModel::computeEventPriorites() int LLVMExecutableModel::getNumLocalParameters(int reactionId) @@ -147,10 +143,6 @@ int LLVMExecutableModel::getNumLocalParameters(int reactionId) -void LLVMExecutableModel::evalInitialAssignments() void LLVMExecutableModel::convertToAmounts() @@ -245,15 +237,6 @@ void LLVMExecutableModel::evalModel(double time, const double *y, double *dydt) -void LLVMExecutableModel::evalEvents(const double time, -void LLVMExecutableModel::resetEvents() void LLVMExecutableModel::testConstraints() @@ -357,18 +340,6 @@ string LLVMExecutableModel::getReactionId(int id) -int LLVMExecutableModel::pushState(unsigned) - LLVMModelData::copyBuffers(&modelDataCopy, &modelData); -int LLVMExecutableModel::popState(unsigned) - LLVMModelData::copyBuffers(&modelData, &modelDataCopy); void LLVMExecutableModel::evalInitialConditions() @@ -531,135 +502,159 @@ int LLVMExecutableModel::getCompartmentVolumes(int len, const int* indx, -int LLVMExecutableModel::getEventDelays(int len, const int* indx, -int LLVMExecutableModel::getEventPriorities(int len, const int* indx, +int LLVMExecutableModel::getReactionRates(int len, const int* indx, -void LLVMExecutableModel::eventAssignment(int eventId) +int LLVMExecutableModel::getNumConservedSums() -double* LLVMExecutableModel::evalEventAssignment(int eventId) +int LLVMExecutableModel::getConservedSumIndex(const string& name) -void LLVMExecutableModel::applyEventAssignment(int eventId, double* values) +string LLVMExecutableModel::getConservedSumId(int index) -int LLVMExecutableModel::getEventStatus(int len, const int *indx, unsigned char *values) +int LLVMExecutableModel::getConservedSums(int len, const int* indx, -void LLVMExecutableModel::evalEvents(double timeEnd, const unsigned char* previousEventStatus, +int LLVMExecutableModel::setConservedSums(int len, const int* indx, -int LLVMExecutableModel::applyPendingEvents(const double *stateVector, double timeEnd, +int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, -void LLVMExecutableModel::evalEventRoots(double time, const double* y, double* gdot) -double LLVMExecutableModel::getNextPendingEventTime(bool pop) +int LLVMExecutableModel::setFloatingSpeciesAmounts(int len, int const *indx, -int LLVMExecutableModel::getPendingEventSize() +int LLVMExecutableModel::setCompartmentVolumes(int len, const int* indx, -int LLVMExecutableModel::getReactionRates(int len, const int* indx, +int LLVMExecutableModel::setFloatingSpeciesInitConcentrations(int len, -int LLVMExecutableModel::getNumConservedSums() +int LLVMExecutableModel::getFloatingSpeciesInitConcentrations(int len, -int LLVMExecutableModel::getConservedSumIndex(const string& name) +double LLVMExecutableModel::getStoichiometry(int index) -string LLVMExecutableModel::getConservedSumId(int index) +int LLVMExecutableModel::getNumEvents() -int LLVMExecutableModel::getConservedSums(int len, const int* indx, +int LLVMExecutableModel::getEventStatus(int len, const int *indx, unsigned char *values) -int LLVMExecutableModel::setConservedSums(int len, const int* indx, +void LLVMExecutableModel::evalEvents(double timeEnd, const unsigned char* previousEventStatus, -int LLVMExecutableModel::getFloatingSpeciesAmountRates(int len, +int LLVMExecutableModel::applyPendingEvents(const double *stateVector, double timeEnd, -int LLVMExecutableModel::setFloatingSpeciesAmounts(int len, int const *indx, +void LLVMExecutableModel::evalEventRoots(double time, const double* y, double* gdot) -int LLVMExecutableModel::setCompartmentVolumes(int len, const int* indx, +double LLVMExecutableModel::getNextPendingEventTime(bool pop) -int LLVMExecutableModel::setFloatingSpeciesInitConcentrations(int len, +int LLVMExecutableModel::getPendingEventSize() -int LLVMExecutableModel::getFloatingSpeciesInitConcentrations(int len, +void LLVMExecutableModel::evalEvents(const double time, const double *y) -double LLVMExecutableModel::getStoichiometry(int index) +void LLVMExecutableModel::resetEvents() diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -233,13 +233,10 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const @@ -873,9 +870,35 @@ void LLVMModelDataSymbols::initEvents(const libsbml::Model* model) @@ -889,6 +912,11 @@ void LLVMModelDataSymbols::initEvents(const libsbml::Model* model) +const std::vector& LLVMModelDataSymbols::getEventAttributes() const diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/EventAssignCodeGen.cpp b/source/llvm/EventAssignCodeGen.cpp --- a/source/llvm/EventAssignCodeGen.cpp +++ b/source/llvm/EventAssignCodeGen.cpp -#include "llvm/EventAssignCodeGen.h" +bool EventAssignCodeGen::eventCodeGen(llvm::Value *modelData, diff --git a/source/llvm/EventAssignCodeGen.h b/source/llvm/EventAssignCodeGen.h --- a/source/llvm/EventAssignCodeGen.h +++ b/source/llvm/EventAssignCodeGen.h + bool eventCodeGen(llvm::Value *modelData, uint eventIndx, diff --git a/source/llvm/EventCodeGenBase.h b/source/llvm/EventCodeGenBase.h --- a/source/llvm/EventCodeGenBase.h +++ b/source/llvm/EventCodeGenBase.h typedef void (*EventCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); llvm::Value *codeGen(); + bool eventCodeGen (llvm::Value *modelData, uint eventId, const libsbml::Event *event) @@ -66,11 +80,6 @@ llvm::Value *EventCodeGenBase::codeGen() llvm::BasicBlock *def = llvm::BasicBlock::Create(this->context, "default", this->function); @@ -92,9 +101,12 @@ llvm::Value *EventCodeGenBase::codeGen() s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), i), block); @@ -102,8 +114,4 @@ llvm::Value *EventCodeGenBase::codeGen() diff --git a/source/llvm/EventTriggerCodeGen.cpp b/source/llvm/EventTriggerCodeGen.cpp --- a/source/llvm/EventTriggerCodeGen.cpp +++ b/source/llvm/EventTriggerCodeGen.cpp -#include "llvm/EventTriggerCodeGen.h" +bool EventTriggerCodeGen::eventCodeGen(llvm::Value *modelData, uint eventIndx, diff --git a/source/llvm/EventTriggerCodeGen.h b/source/llvm/EventTriggerCodeGen.h --- a/source/llvm/EventTriggerCodeGen.h +++ b/source/llvm/EventTriggerCodeGen.h typedef void (*EventTriggerCodeGen_FunctionPtr)(LLVMModelData*, int32_t); + bool eventCodeGen(llvm::Value *modelData, uint eventIndx, diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -300,7 +300,8 @@ llvm::Value* ModelDataIRBuilder::createCompGEP(const std::string& id, -llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtLoad(const std::string& id, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtLoad( + const std::string& id, const llvm::Twine& name) @@ -321,6 +322,30 @@ llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtGEP( +llvm::Value* ModelDataIRBuilder::createEventAssignmentGEP(uint eventId, + uint assignmentId, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createEventAssignmentLoad(uint eventId, + uint assignmentId, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createEventAssignmentStore(uint eventId, + uint assignmentId, llvm::Value* value) llvm::Value* ModelDataIRBuilder::createBoundSpeciesCompGEP(const std::string& id) @@ -1051,18 +1076,3 @@ void LLVMModelDataIRBuilderTesting::test(Module *module, IRBuilder<> *build, -llvm::Value* ModelDataIRBuilder::createEventAssignmentGEP(uint eventId, - uint assignmentId, const llvm::Twine& name) -llvm::Value* ModelDataIRBuilder::createEventAssignmentLoad(uint eventId, - uint assignmentId, const llvm::Twine& name) -llvm::Value* ModelDataIRBuilder::createEventAssignmentStore(uint eventId, - uint assignmentId, llvm::Value* value) diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp @@ -137,6 +137,10 @@ std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -93,7 +93,8 @@ LLVMModelDataSymbols::LLVMModelDataSymbols() : @@ -103,7 +104,8 @@ LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model *model, @@ -133,344 +135,25 @@ LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model *model, - throw_llvm_exception(msg); LLVMModelDataSymbols::~LLVMModelDataSymbols() @@ -555,20 +238,14 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const @@ -581,7 +258,7 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const @@ -589,13 +266,7 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const @@ -612,6 +283,8 @@ void LLVMModelDataSymbols::initAllocModelDataBuffers(LLVMModelData& m) const std::vector LLVMModelDataSymbols::getCompartmentIds() const @@ -771,6 +444,16 @@ bool LLVMModelDataSymbols::isIndependentCompartment(const std::string& id) const +uint LLVMModelDataSymbols::getEventAssignmentOffset(uint eventIndx) const +uint LLVMModelDataSymbols::getEventAssignmentSize() const const char* LLVMModelDataSymbols::getFieldName(ModelDataFields field) @@ -842,6 +525,370 @@ uint LLVMModelDataSymbols::getGlobalParametersSize() const +void LLVMModelDataSymbols::initGlobalParameters(const libsbml::Model* model) +void LLVMModelDataSymbols::initBoundarySpecies(const libsbml::Model* model) +void LLVMModelDataSymbols::initFloatingSpecies(const libsbml::Model* model, + throw_llvm_exception(msg); +void LLVMModelDataSymbols::initCompartments(const libsbml::Model *model) +void LLVMModelDataSymbols::initReactions(const libsbml::Model* model) +void LLVMModelDataSymbols::displayCompartmentInfo() +void LLVMModelDataSymbols::initEvents(const libsbml::Model* model) diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp llvm::Value* ModelDataIRBuilder::createGlobalParamGEP(const std::string& id) @@ -389,12 +387,6 @@ llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module, llvm:: LLVMContext &context = module->getContext(); @@ -473,12 +465,6 @@ llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module, llvm:: @@ -1066,4 +1052,17 @@ void LLVMModelDataIRBuilderTesting::test(Module *module, IRBuilder<> *build, +llvm::Value* ModelDataIRBuilder::createEventAssignmentGEP(uint eventId, + uint assignmentId, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createEventAssignmentLoad(uint eventId, + uint assignmentId, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createEventAssignmentStore(uint eventId, + uint assignmentId, llvm::Value* value) diff --git a/source/llvm/ModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h --- a/source/llvm/ModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h llvm::Value *value); + llvm::Value *createEventAssignmentGEP(uint eventId, uint assignmentId, + const llvm::Twine &name = ""); + llvm::Value *createEventAssignmentLoad(uint eventId, uint assignmentId, + const llvm::Twine& name = ""); + llvm::Value *createEventAssignmentStore(uint eventId, uint assignmentId, + llvm::Value *value); llvm::Value *createRateRuleRateGEP(const std::string &id, removed unused stuff from LLVMModelData, event trigger / assignments stubbed out @@ -101,6 +101,9 @@ if(BUILD_LLVM) llvm/EvalInitialConditionsCodeGen llvm/EvalRateRuleRatesCodeGen llvm/EvalReactionRatesCodeGen + llvm/EventAssignCodeGen + llvm/EventTriggerCodeGen + llvm/EventSymbolResolver llvm/LLVMExecutableModel llvm/GetRateRuleValuesCodeGen llvm/GetValuesCodeGen diff --git a/source/llvm/AssignmentRuleEvaluator.cpp b/source/llvm/AssignmentRuleEvaluator.cpp --- a/source/llvm/AssignmentRuleEvaluator.cpp +++ b/source/llvm/AssignmentRuleEvaluator.cpp - LLVMSymbolForest& symbols) : diff --git a/source/llvm/AssignmentRuleEvaluator.h b/source/llvm/AssignmentRuleEvaluator.h --- a/source/llvm/AssignmentRuleEvaluator.h +++ b/source/llvm/AssignmentRuleEvaluator.h - AssignmentRuleEvaluator(LLVMSymbolForest &symbols); - LLVMSymbolForest &symbols; diff --git a/source/llvm/CodeGen.h b/source/llvm/CodeGen.h --- a/source/llvm/CodeGen.h +++ b/source/llvm/CodeGen.h -class LLVMStoreSymbolResolver virtual llvm::Value *storeSymbolValue(const std::string& symbol, llvm::Value *value) = 0; - ~LLVMStoreSymbolResolver() {}; diff --git a/source/llvm/CodeGenBase.h b/source/llvm/CodeGenBase.h --- a/source/llvm/CodeGenBase.h +++ b/source/llvm/CodeGenBase.h diff --git a/source/llvm/EvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/EvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp - for (LLVMSymbolForest::ConstIterator i = modelSymbols.getInitialValues().boundarySpecies.begin(); - LLVMModelDataStoreSymbolResolver modelDataResolver(modelData, model, - LLVMModelDataStoreSymbolResolver& modelDataResolver) - llvm::Value *modelData, LLVMModelDataStoreSymbolResolver& modelDataResolver) + llvm::Value *modelData, ModelDataStoreSymbolResolver& modelDataResolver) - LLVMModelDataStoreSymbolResolver& modelDataResolver) - LLVMModelDataStoreSymbolResolver& modelDataResolver) diff --git a/source/llvm/EvalInitialConditionsCodeGen.h b/source/llvm/EvalInitialConditionsCodeGen.h --- a/source/llvm/EvalInitialConditionsCodeGen.h +++ b/source/llvm/EvalInitialConditionsCodeGen.h - void codeGenSpecies(LLVMModelDataStoreSymbolResolver& modelDataResolver); void codeGenStoichiometry(llvm::Value *modelData, - LLVMModelDataStoreSymbolResolver& modelDataResolver); - void codeGenCompartments(LLVMModelDataStoreSymbolResolver& modelDataResolver); - void codeGenParameters(LLVMModelDataStoreSymbolResolver& modelDataResolver); diff --git a/source/llvm/EventAssignCodeGen.cpp b/source/llvm/EventAssignCodeGen.cpp +++ b/source/llvm/EventAssignCodeGen.cpp +#include "llvm/EventAssignCodeGen.h" +using namespace llvm; diff --git a/source/llvm/EventAssignCodeGen.h b/source/llvm/EventAssignCodeGen.h +++ b/source/llvm/EventAssignCodeGen.h diff --git a/source/llvm/EventCodeGenBase.h b/source/llvm/EventCodeGenBase.h +++ b/source/llvm/EventCodeGenBase.h +#include "LLVMException.h" +typedef void (*EventCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); + llvm::Value *codeGen(); +llvm::Value *EventCodeGenBase::codeGen() + llvm::Type *argTypes[] = { + llvm::PointerType::get(ModelDataIRBuilder::getStructType(this->module), 0), + llvm::Type::getInt32Ty(this->context) + llvm::Value *args[] = {0, 0}; + llvm::Type *retType = llvm::Type::getVoidTy(context); + llvm::BasicBlock *entry = this->codeGenHeader(Derived::FunctionName, retType, + llvm::BasicBlock *def = llvm::BasicBlock::Create(this->context, "default", this->function); + llvm::SwitchInst *s = this->builder.CreateSwitch(args[1], def, events->size()); + llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, block_name, this->function); + s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), i), block); diff --git a/source/llvm/EventSymbolResolver.cpp b/source/llvm/EventSymbolResolver.cpp +++ b/source/llvm/EventSymbolResolver.cpp +#include "llvm/EventSymbolResolver.h" +rr::EventSymbolResolver::EventSymbolResolver(llvm::Value* modelData, + const libsbml::Model* model, const LLVMModelSymbols& modelSymbols, + const LLVMModelDataSymbols& modelDataSymbols, + llvm::IRBuilder<>& builder, LoadSymbolResolver& resolver) +llvm::Value* rr::EventSymbolResolver::loadSymbolValue(const std::string& symbol) +llvm::Value* rr::EventSymbolResolver::storeSymbolValue( + const std::string& symbol, llvm::Value* value) diff --git a/source/llvm/EventSymbolResolver.h b/source/llvm/EventSymbolResolver.h +++ b/source/llvm/EventSymbolResolver.h + EventSymbolResolver(llvm::Value *modelData, const libsbml::Model *model, + const LLVMModelSymbols &modelSymbols, + const LLVMModelDataSymbols &modelDataSymbols, + llvm::IRBuilder<> &builder, LoadSymbolResolver &resolver); + virtual llvm::Value *loadSymbolValue(const std::string& symbol); + virtual llvm::Value *storeSymbolValue(const std::string& symbol, + llvm::Value *value); diff --git a/source/llvm/EventTriggerCodeGen.cpp b/source/llvm/EventTriggerCodeGen.cpp +++ b/source/llvm/EventTriggerCodeGen.cpp +#include "llvm/EventTriggerCodeGen.h" +using namespace llvm; diff --git a/source/llvm/EventTriggerCodeGen.h b/source/llvm/EventTriggerCodeGen.h +++ b/source/llvm/EventTriggerCodeGen.h +typedef void (*EventTriggerCodeGen_FunctionPtr)(LLVMModelData*, int32_t); diff --git a/source/llvm/InitialValueSymbolResolver.cpp b/source/llvm/InitialValueSymbolResolver.cpp --- a/source/llvm/InitialValueSymbolResolver.cpp +++ b/source/llvm/InitialValueSymbolResolver.cpp @@ -39,7 +39,7 @@ llvm::Value* InitialValueSymbolResolver::loadSymbolValue( - LLVMSymbolForest::ConstIterator i = @@ -51,7 +51,7 @@ llvm::Value* InitialValueSymbolResolver::loadSymbolValue( - LLVMSymbolForest::ConstIterator i = diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMModelData.cpp b/source/llvm/LLVMModelData.cpp --- a/source/llvm/LLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp @@ -68,33 +68,16 @@ void LLVMModelData::allocBuffers(LLVMModelData &data, const string& modelName) - (LLVMEventAssignmentHandler*)calloc(data.numEvents, sizeof(LLVMEventAssignmentHandler*)); - (LLVMComputeEventAssignmentHandler*)calloc(data.numEvents, sizeof(LLVMComputeEventAssignmentHandler*)); - (LLVMPerformEventAssignmentHandler*)calloc(data.numEvents, sizeof(LLVMPerformEventAssignmentHandler*)); - (LLVMEventDelayHandler*)calloc(data.numEvents, sizeof(LLVMEventDelayHandler*)); @@ -130,8 +113,6 @@ std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) @@ -146,8 +127,7 @@ std::ostream& operator <<(std::ostream& os, const LLVMModelData& data) @@ -196,29 +176,17 @@ void LLVMModelData::freeBuffers(LLVMModelData &data) @@ -251,13 +219,7 @@ void LLVMModelData::copyBuffers(LLVMModelData *dst, LLVMModelData *src) @@ -273,13 +235,7 @@ void LLVMModelData::copyBuffers(LLVMModelData *dst, LLVMModelData *src) @@ -293,13 +249,7 @@ void LLVMModelData::copyBuffers(LLVMModelData *dst, LLVMModelData *src) @@ -307,42 +257,6 @@ void LLVMModelData::copyBuffers(LLVMModelData *dst, LLVMModelData *src) @@ -362,31 +276,6 @@ void LLVMModelData::copyBuffers(LLVMModelData *dst, LLVMModelData *src) - src->numEvents * sizeof(LLVMEventAssignmentHandler*)); - src->numEvents * sizeof(LLVMComputeEventAssignmentHandler*)); - src->numEvents * sizeof(LLVMPerformEventAssignmentHandler*)); - src->numEvents * sizeof(LLVMEventDelayHandler*)); diff --git a/source/llvm/LLVMModelData.h b/source/llvm/LLVMModelData.h --- a/source/llvm/LLVMModelData.h +++ b/source/llvm/LLVMModelData.h struct LLVMModelData; -typedef double (*LLVMEventDelayHandler)(LLVMModelData*); -typedef double* (*LLVMComputeEventAssignmentHandler)(LLVMModelData*); -typedef void (*LLVMPerformEventAssignmentHandler)(LLVMModelData*, double*); -typedef void (*LLVMEventAssignmentHandler)(); @@ -124,7 +119,7 @@ struct LLVMModelData @@ -152,31 +147,21 @@ struct LLVMModelData @@ -185,66 +170,52 @@ struct LLVMModelData @@ -253,19 +224,15 @@ struct LLVMModelData - LLVMEventDelayHandler* eventDelays; // 47 - LLVMEventAssignmentHandler* eventAssignments; // 48 - LLVMComputeEventAssignmentHandler* computeEventAssignments; // 49 - LLVMPerformEventAssignmentHandler* performEventAssignments; // 50 static void init(LLVMModelData&); diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp diff --git a/source/llvm/LLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/LLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -82,6 +82,12 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -100,7 +106,6 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -111,6 +116,8 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp @@ -96,7 +96,7 @@ bool LLVMModelSymbols::visit (const libsbml::Event &event) -void LLVMModelSymbols::processElement(LLVMSymbolForest& currentSymbols, +void LLVMModelSymbols::processElement(SymbolForest& currentSymbols, @@ -222,7 +222,7 @@ bool LLVMModelSymbols::visit(const libsbml::Reaction& r) -void LLVMModelSymbols::processSpecies(LLVMSymbolForest ¤tSymbols, +void LLVMModelSymbols::processSpecies(SymbolForest ¤tSymbols, @@ -528,17 +528,17 @@ ASTNode* LLVMModelSymbols::createStoichiometryNode(int row, int col) const -const LLVMSymbolForest& LLVMModelSymbols::getAssigmentRules() const +const SymbolForest& LLVMModelSymbols::getAssigmentRules() const -const LLVMSymbolForest& LLVMModelSymbols::getInitialValues() const +const SymbolForest& LLVMModelSymbols::getInitialValues() const -const LLVMSymbolForest& LLVMModelSymbols::getRateRules() const +const SymbolForest& LLVMModelSymbols::getRateRules() const diff --git a/source/llvm/LLVMModelSymbols.h b/source/llvm/LLVMModelSymbols.h --- a/source/llvm/LLVMModelSymbols.h +++ b/source/llvm/LLVMModelSymbols.h - const LLVMSymbolForest& getAssigmentRules() const; - const LLVMSymbolForest& getInitialValues() const; - const LLVMSymbolForest& getRateRules() const; - void processElement(LLVMSymbolForest ¤tSymbols, - void processSpecies(LLVMSymbolForest ¤tSymbols, - LLVMSymbolForest initialValues; - LLVMSymbolForest assigmentRules; - LLVMSymbolForest rateRules; diff --git a/source/llvm/ModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/ModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp @@ -417,41 +417,24 @@ llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module, llvm:: structType = StructType::create(context, elements, LLVMModelDataName); diff --git a/source/llvm/ModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/ModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp @@ -30,7 +30,7 @@ ModelDataLoadSymbolResolver::ModelDataLoadSymbolResolver(llvm::Value *modelData, -LLVMModelDataStoreSymbolResolver::LLVMModelDataStoreSymbolResolver(llvm::Value *modelData, +ModelDataStoreSymbolResolver::ModelDataStoreSymbolResolver(llvm::Value *modelData, const LLVMModelSymbols &modelSymbols, const LLVMModelDataSymbols &modelDataSymbols, @@ -56,7 +56,7 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue( - LLVMSymbolForest::ConstIterator i = modelSymbols.getAssigmentRules().find( @@ -133,7 +133,7 @@ llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue( -llvm::Value* LLVMModelDataStoreSymbolResolver::storeSymbolValue( +llvm::Value* ModelDataStoreSymbolResolver::storeSymbolValue( const std::string& symbol, llvm::Value *value) diff --git a/source/llvm/ModelDataSymbolResolver.h b/source/llvm/ModelDataSymbolResolver.h --- a/source/llvm/ModelDataSymbolResolver.h +++ b/source/llvm/ModelDataSymbolResolver.h -class LLVMModelDataStoreSymbolResolver: public LLVMStoreSymbolResolver - LLVMModelDataStoreSymbolResolver(llvm::Value *modelData, + ModelDataStoreSymbolResolver(llvm::Value *modelData, const libsbml::Model *model, const LLVMModelSymbols &modelSymbols, const LLVMModelDataSymbols &modelDataSymbols, llvm::IRBuilder<> &builder, - virtual ~LLVMModelDataStoreSymbolResolver() {}; virtual llvm::Value *storeSymbolValue(const std::string& symbol, llvm::Value *value); diff --git a/source/llvm/SymbolForest.h b/source/llvm/SymbolForest.h --- a/source/llvm/SymbolForest.h +++ b/source/llvm/SymbolForest.h -class LLVMSymbolForest diff --git a/source/llvm_testing/src/tests.cpp b/source/llvm_testing/src/tests.cpp --- a/source/llvm_testing/src/tests.cpp +++ b/source/llvm_testing/src/tests.cpp diff --git a/source/llvm/GetEventValuesCodeGen.h b/source/llvm/GetEventValuesCodeGen.h --- a/source/llvm/GetEventValuesCodeGen.h +++ b/source/llvm/GetEventValuesCodeGen.h typedef double (*GetEventValueCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); clean up ExecutableModel interface, more more useless junk out of main interface into the CompiledExecutableModel implementation, basic handling of logical in LLVM AST diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -119,6 +119,13 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -163,10 +170,7 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -283,6 +287,9 @@ llvm::Value* ASTNodeCodeGen::applyRelationalCodeGen(const libsbml::ASTNode* ast) @@ -291,4 +298,32 @@ llvm::Value* ASTNodeCodeGen::applyRelationalCodeGen(const libsbml::ASTNode* ast) +llvm::Value* ASTNodeCodeGen::applyLogicalCodeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/ASTNodeCodeGen.h b/source/llvm/ASTNodeCodeGen.h --- a/source/llvm/ASTNodeCodeGen.h +++ b/source/llvm/ASTNodeCodeGen.h llvm::Value *applyRelationalCodeGen(const libsbml::ASTNode *ast); + llvm::Value *applyLogicalCodeGen(const libsbml::ASTNode *ast); llvm::IRBuilder<> &builder; diff --git a/source/llvm/LLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/LLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp @@ -574,8 +574,7 @@ int LLVMExecutableModel::applyPendingEvents(const double *stateVector, double ti -void LLVMExecutableModel::evalEventRoots(double time, +void LLVMExecutableModel::evalEventRoots(double time, const double* y, double* gdot) diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm_testing/main.cpp b/source/llvm_testing/main.cpp --- a/source/llvm_testing/main.cpp +++ b/source/llvm_testing/main.cpp diff --git a/source/llvm/ASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/ASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp @@ -110,6 +110,15 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -153,6 +162,13 @@ llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -242,4 +258,37 @@ llvm::Value* ASTNodeCodeGen::applyArithmeticCodeGen( +llvm::Value* ASTNodeCodeGen::applyRelationalCodeGen(const libsbml::ASTNode* ast) diff --git a/source/llvm/ASTNodeCodeGen.h b/source/llvm/ASTNodeCodeGen.h --- a/source/llvm/ASTNodeCodeGen.h +++ b/source/llvm/ASTNodeCodeGen.h llvm::Value *applyArithmeticCodeGen(const libsbml::ASTNode *ast); + llvm::Value *applyRelationalCodeGen(const libsbml::ASTNode *ast); llvm::IRBuilder<> &builder; diff --git a/source/llvm/GetEventValuesCodeGen.cpp b/source/llvm/GetEventValuesCodeGen.cpp --- a/source/llvm/GetEventValuesCodeGen.cpp +++ b/source/llvm/GetEventValuesCodeGen.cpp +llvm::Type *GetEventTriggerCodeGen::getRetType() + return llvm::Type::getInt8Ty(context); +llvm::Value *GetEventTriggerCodeGen::createRet(llvm::Value *value) + return llvm::ConstantInt::get(getRetType(), 0xff, false); diff --git a/source/llvm/GetEventValuesCodeGen.h b/source/llvm/GetEventValuesCodeGen.h --- a/source/llvm/GetEventValuesCodeGen.h +++ b/source/llvm/GetEventValuesCodeGen.h typedef double (*GetEventValueCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); - llvm::Value *codeGen(); + llvm::Value *codeGen(); + llvm::Type *getRetType() + return llvm::Type::getDoubleTy(this->context); + llvm::Value *createRet(llvm::Value* value) + llvm::ConstantFP::get(this->context, llvm::APFloat(123.456)); -llvm::Value* GetEventValueCodeGenBase::codeGen() +llvm::Value *GetEventValueCodeGenBase::codeGen() llvm::Type *argTypes[] = { @@ -68,7 +79,9 @@ llvm::Value* GetEventValueCodeGenBase::codeGen() llvm::Value *args[] = {0, 0}; - llvm::BasicBlock *entry = this->codeGenHeader(Derived::FunctionName, llvm::Type::getDoubleTy(this->context), + llvm::Type *retType = static_cast(this)->getRetType(); + llvm::BasicBlock *entry = this->codeGenHeader(Derived::FunctionName, retType, @@ -81,7 +94,9 @@ llvm::Value* GetEventValueCodeGenBase::codeGen() llvm::BasicBlock *def = llvm::BasicBlock::Create(this->context, "default", this->function); - this->builder.CreateRet(llvm::ConstantFP::get(this->context, llvm::APFloat(123.456))); + llvm::Value *defRet = static_cast(this)->createRet(0); @@ -103,6 +118,9 @@ llvm::Value* GetEventValueCodeGenBase::codeGen() llvm::Value *value = astCodeGen.codeGen(math); s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), i), block); @@ -110,9 +128,11 @@ llvm::Value* GetEventValueCodeGenBase::codeGen() +typedef unsigned char (*GetEventTriggerCodeGen_FunctionPtr)(LLVMModelData*, int32_t); + llvm::Type *getRetType(); + llvm::Value *createRet(llvm::Value*); LLVM JITed event trigger, delay, priority functions @@ -104,6 +104,7 @@ if(BUILD_LLVM) llvm/LLVMExecutableModel llvm/GetRateRuleValuesCodeGen llvm/GetValuesCodeGen + llvm/GetEventValuesCodeGen llvm/InitialValueSymbolResolver llvm/LLVMModelData llvm/ModelDataIRBuilder diff --git a/source/llvm/GetEventValuesCodeGen.cpp b/source/llvm/GetEventValuesCodeGen.cpp +++ b/source/llvm/GetEventValuesCodeGen.cpp +#include "LLVMException.h" +using namespace llvm; diff --git a/source/llvm/GetEventValuesCodeGen.h b/source/llvm/GetEventValuesCodeGen.h +++ b/source/llvm/GetEventValuesCodeGen.h +#ifndef RRLLVMGETEVENTVALUECODEGENBASE_H_ +#define RRLLVMGETEVENTVALUECODEGENBASE_H_ +#include "LLVMException.h" +typedef double (*GetEventValueCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); + llvm::Value *codeGen(); +llvm::Value* GetEventValueCodeGenBase::codeGen() + llvm::Type *argTypes[] = { + llvm::PointerType::get(ModelDataIRBuilder::getStructType(this->module), 0), + llvm::Type::getInt32Ty(this->context) + llvm::Value *args[] = {0, 0}; + llvm::BasicBlock *entry = this->codeGenHeader(Derived::FunctionName, llvm::Type::getDoubleTy(this->context), + llvm::BasicBlock *def = llvm::BasicBlock::Create(this->context, "default", this->function); + this->builder.CreateRet(llvm::ConstantFP::get(this->context, llvm::APFloat(123.456))); + llvm::SwitchInst *s = this->builder.CreateSwitch(args[1], def, events->size()); + llvm::BasicBlock *block = llvm::BasicBlock::Create(this->context, block_name, this->function); + llvm::Value *value = astCodeGen.codeGen(math); + s->addCase(llvm::ConstantInt::get(llvm::Type::getInt32Ty(this->context), i), block); +#endif /* RRLLVMGETVALUECODEGENBASE_H_ */ diff --git a/source/llvm/LLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h --- a/source/llvm/LLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h diff --git a/source/llvm/LLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/LLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp @@ -73,6 +73,15 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, @@ -99,7 +108,9 @@ ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, diff --git a/source/llvm/LLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/LLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp @@ -93,11 +93,7 @@ bool LLVMModelSymbols::visit(const libsbml::RateRule& rule) bool LLVMModelSymbols::visit (const libsbml::Event &event) - throw_llvm_exception(msg); void LLVMModelSymbols::processElement(LLVMSymbolForest& currentSymbols, renamed llvm classes / files to use sane, standard naming scheme # Add the LLVM sources to compilation if(BUILD_LLVM) - llvm/rrLLVMAssignmentRuleEvaluator - llvm/rrLLVMASTNodeCodeGen - llvm/rrLLVMASTNodeFactory - llvm/rrLLVMCodeGenBase - llvm/rrLLVMCompiler - llvm/rrLLVMEvalInitialConditionsCodeGen - llvm/rrLLVMEvalRateRuleRatesCodeGen - llvm/rrLLVMEvalReactionRatesCodeGen - llvm/rrLLVMExecutableModel - llvm/rrLLVMGetRateRuleValuesCodeGen - llvm/rrLLVMGetValuesCodeGen - llvm/rrLLVMInitialValueSymbolResolver - llvm/rrLLVMModelData - llvm/rrLLVMModelDataIRBuilder - llvm/rrLLVMModelDataSymbolResolver - llvm/rrLLVMModelDataSymbols - llvm/rrLLVMModelGenerator - llvm/rrLLVMModelGeneratorContext - llvm/rrLLVMModelSymbols - llvm/rrLLVMSetRateRuleValuesCodeGen + llvm/AssignmentRuleEvaluator + llvm/ASTNodeCodeGen + llvm/ASTNodeFactory + llvm/CodeGenBase + llvm/LLVMCompiler + llvm/EvalInitialConditionsCodeGen + llvm/EvalRateRuleRatesCodeGen + llvm/EvalReactionRatesCodeGen + llvm/LLVMExecutableModel + llvm/GetRateRuleValuesCodeGen + llvm/GetValuesCodeGen + llvm/InitialValueSymbolResolver + llvm/LLVMModelData + llvm/ModelDataIRBuilder + llvm/ModelDataSymbolResolver + llvm/LLVMModelDataSymbols + llvm/LLVMModelGenerator + llvm/ModelGeneratorContext + llvm/LLVMModelSymbols + llvm/SetRateRuleValuesCodeGen endif(BUILD_LLVM) diff --git a/source/llvm/rrLLVMASTNodeCodeGen.cpp b/source/llvm/ASTNodeCodeGen.cpp rename from source/llvm/rrLLVMASTNodeCodeGen.cpp rename to source/llvm/ASTNodeCodeGen.cpp --- a/source/llvm/rrLLVMASTNodeCodeGen.cpp +++ b/source/llvm/ASTNodeCodeGen.cpp -#include "rrLLVMASTNodeCodeGen.h" -#include "rrLLVMException.h" +#include "LLVMException.h" -#include "rrLLVMIncludes.h" +#include "LLVMIncludes.h" -LLVMASTNodeCodeGen::LLVMASTNodeCodeGen(llvm::IRBuilder<> &builder, - LLVMLoadSymbolResolver &resolver) : +ASTNodeCodeGen::ASTNodeCodeGen(llvm::IRBuilder<> &builder, -LLVMASTNodeCodeGen::~LLVMASTNodeCodeGen() -Value *LLVMASTNodeCodeGen::binaryExprCodeGen(const ASTNode *ast) @@ -74,7 +74,7 @@ Value *LLVMASTNodeCodeGen::binaryExprCodeGen(const ASTNode *ast) -llvm::Value* LLVMASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) +llvm::Value* ASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) @@ -168,13 +168,13 @@ llvm::Value* LLVMASTNodeCodeGen::codeGen(const libsbml::ASTNode* ast) -llvm::Value* LLVMASTNodeCodeGen::intrinsicCallCodeGen( +llvm::Value* ASTNodeCodeGen::intrinsicCallCodeGen( -llvm::Value* LLVMASTNodeCodeGen::notImplemented(const libsbml::ASTNode* ast) +llvm::Value* ASTNodeCodeGen::notImplemented(const libsbml::ASTNode* ast) @@ -185,22 +185,22 @@ llvm::Value* LLVMASTNodeCodeGen::notImplemented(const libsbml::ASTNode* ast) -llvm::Value* LLVMASTNodeCodeGen::nameExprCodeGen(const libsbml::ASTNode* ast) +llvm::Value* ASTNodeCodeGen::nameExprCodeGen(const libsbml::ASTNode* ast) -llvm::Value* LLVMASTNodeCodeGen::realExprCodeGen(const libsbml::ASTNode* ast) +llvm::Value* ASTNodeCodeGen::realExprCodeGen(const libsbml::ASTNode* ast) -llvm::Value* LLVMASTNodeCodeGen::integerCodeGen(const libsbml::ASTNode* ast) +llvm::Value* ASTNodeCodeGen::integerCodeGen(const libsbml::ASTNode* ast) -llvm::Value* LLVMASTNodeCodeGen::applyArithmeticCodeGen( +llvm::Value* ASTNodeCodeGen::applyArithmeticCodeGen( diff --git a/source/llvm/rrLLVMASTNodeCodeGen.h b/source/llvm/ASTNodeCodeGen.h rename from source/llvm/rrLLVMASTNodeCodeGen.h rename to source/llvm/ASTNodeCodeGen.h --- a/source/llvm/rrLLVMASTNodeCodeGen.h +++ b/source/llvm/ASTNodeCodeGen.h - * rrLLVMASTNodeCodeGen.h -#ifndef rrLLVMASTNodeCodeGenH -#define rrLLVMASTNodeCodeGenH -#include "rrLLVMIncludes.h" -#include "rrLLVMCodeGen.h" +#include "LLVMIncludes.h" * All of the LLVM IR generation is handled here. -class LLVMASTNodeCodeGen - LLVMASTNodeCodeGen(llvm::IRBuilder<> &builder, - LLVMLoadSymbolResolver &resolver); - ~LLVMASTNodeCodeGen(); + ASTNodeCodeGen(llvm::IRBuilder<> &builder, llvm::Value *codeGen(const libsbml::ASTNode *ast); llvm::IRBuilder<> &builder; - LLVMLoadSymbolResolver &resolver; -#endif /* rrLLVMASTNodeCodeGenH */ diff --git a/source/llvm/rrLLVMASTNodeFactory.cpp b/source/llvm/ASTNodeFactory.cpp rename from source/llvm/rrLLVMASTNodeFactory.cpp rename to source/llvm/ASTNodeFactory.cpp --- a/source/llvm/rrLLVMASTNodeFactory.cpp +++ b/source/llvm/ASTNodeFactory.cpp - * rrLLVMASTNodeFactory.cpp -#include "rrLLVMASTNodeFactory.h" -LLVMASTNodeFactory::LLVMASTNodeFactory() -LLVMASTNodeFactory::~LLVMASTNodeFactory() @@ -26,21 +26,21 @@ LLVMASTNodeFactory::~LLVMASTNodeFactory() -libsbml::ASTNode* LLVMASTNodeFactory::create(libsbml::ASTNodeType_t type) -libsbml::ASTNode* LLVMASTNodeFactory::create(libsbml::Token_t* token) -libsbml::ASTNode* LLVMASTNodeFactory::create(const libsbml::ASTNode& orig) diff --git a/source/llvm/rrLLVMASTNodeFactory.h b/source/llvm/ASTNodeFactory.h rename from source/llvm/rrLLVMASTNodeFactory.h rename to source/llvm/ASTNodeFactory.h --- a/source/llvm/rrLLVMASTNodeFactory.h +++ b/source/llvm/ASTNodeFactory.h -class LLVMASTNodeFactory - LLVMASTNodeFactory(); - ~LLVMASTNodeFactory(); - LLVMASTNodeFactory(const LLVMASTNodeFactory&) {}; - LLVMASTNodeFactory& operator=( const LLVMASTNodeFactory& rhs ) {return *this;}; diff --git a/source/llvm/rrLLVMAssignmentRuleEvaluator.cpp b/source/llvm/AssignmentRuleEvaluator.cpp rename from source/llvm/rrLLVMAssignmentRuleEvaluator.cpp rename to source/llvm/AssignmentRuleEvaluator.cpp --- a/source/llvm/rrLLVMAssignmentRuleEvaluator.cpp +++ b/source/llvm/AssignmentRuleEvaluator.cpp - * rrLLVMAssignmentRuleEvaluator.cpp -#include "rrLLVMAssignmentRuleEvaluator.h" -LLVMAssignmentRuleEvaluator::LLVMAssignmentRuleEvaluator( LLVMSymbolForest& symbols) : -void LLVMAssignmentRuleEvaluator::evaluate(const Model& model) -bool LLVMAssignmentRuleEvaluator::visit(const AssignmentRule& x) diff --git a/source/llvm/rrLLVMAssignmentRuleEvaluator.h b/source/llvm/AssignmentRuleEvaluator.h rename from source/llvm/rrLLVMAssignmentRuleEvaluator.h rename to source/llvm/AssignmentRuleEvaluator.h --- a/source/llvm/rrLLVMAssignmentRuleEvaluator.h +++ b/source/llvm/AssignmentRuleEvaluator.h - * rrLLVMAssignmentRuleEvaluator.h #ifndef LLVMAssignmentRuleEvaluatorH #define LLVMAssignmentRuleEvaluatorH -#include "rrLLVMSymbolForest.h" -class LLVMAssignmentRuleEvaluator : public libsbml::SBMLVisitor - LLVMAssignmentRuleEvaluator(LLVMSymbolForest &symbols); + AssignmentRuleEvaluator(LLVMSymbolForest &symbols); diff --git a/source/llvm/rrLLVMCodeGen.h b/source/llvm/CodeGen.h rename from source/llvm/rrLLVMCodeGen.h rename to source/llvm/CodeGen.h --- a/source/llvm/rrLLVMCodeGen.h +++ b/source/llvm/CodeGen.h - * rrLLVMCodeGen.h -#ifndef LLVMCodeGenH -#define LLVMCodeGenH -#include "rrLLVMIncludes.h" +#include "LLVMIncludes.h" -class LLVMCodeGen virtual llvm::Value *codeGen() = 0; - ~LLVMCodeGen() {}; -class LLVMLoadSymbolResolver virtual llvm::Value *loadSymbolValue(const std::string& symbol) = 0; - ~LLVMLoadSymbolResolver() {}; class LLVMStoreSymbolResolver diff --git a/source/llvm/rrLLVMCodeGenBase.cpp b/source/llvm/CodeGenBase.cpp rename from source/llvm/rrLLVMCodeGenBase.cpp rename to source/llvm/CodeGenBase.cpp --- a/source/llvm/rrLLVMCodeGenBase.cpp +++ b/source/llvm/CodeGenBase.cpp -#include "rrLLVMCodeGenBase.h" -#include "rrLLVMASTNodeCodeGen.h" -#include "rrLLVMException.h" -#include "rrLLVMCodeGenBase.h" -#include "rrLLVMModelGeneratorContext.h" -#include "rrLLVMCodeGen.h" -#include "rrLLVMCodeGenBase.h" -#include "rrLLVMSymbolForest.h" -#include "rrLLVMASTNodeFactory.h" -#include "rrLLVMModelDataIRBuilder.h" -#include "rrLLVMGetValueCodeGenBase.h" +#include "LLVMException.h" @@ -31,7 +27,7 @@ class LLVMCodeGenTest - LLVMCodeGenTest(const LLVMModelGeneratorContext &mgc) : + LLVMCodeGenTest(const ModelGeneratorContext &mgc) : diff --git a/source/llvm/rrLLVMCodeGenBase.h b/source/llvm/CodeGenBase.h rename from source/llvm/rrLLVMCodeGenBase.h rename to source/llvm/CodeGenBase.h --- a/source/llvm/rrLLVMCodeGenBase.h +++ b/source/llvm/CodeGenBase.h - * rrLLVMCodeGenBase.h #ifndef LLVMCodeGenBaseH #define LLVMCodeGenBaseH -#include "rrLLVMModelGeneratorContext.h" -#include "rrLLVMCodeGen.h" -#include "rrLLVMException.h" +#include "LLVMException.h" -class LLVMCodeGenBase - LLVMCodeGenBase(const LLVMModelGeneratorContext &mgc) : llvm::Type *argTypes[] = { llvm::PointerType::get( - LLVMModelDataIRBuilder::getStructType(module), 0) - virtual ~LLVMCodeGenBase() {}; diff --git a/source/llvm/rrLLVMEvalInitialConditionsCodeGen.cpp b/source/llvm/EvalInitialConditionsCodeGen.cpp rename from source/llvm/rrLLVMEvalInitialConditionsCodeGen.cpp rename to source/llvm/EvalInitialConditionsCodeGen.cpp --- a/source/llvm/rrLLVMEvalInitialConditionsCodeGen.cpp +++ b/source/llvm/EvalInitialConditionsCodeGen.cpp - * rrLLVMInitialValueCodeGen.cpp -#include "rrLLVMEvalInitialConditionsCodeGen.h" -#include "rrLLVMException.h" -#include "rrLLVMASTNodeCodeGen.h" -#include "rrLLVMInitialValueSymbolResolver.h" +#include "LLVMException.h" -const char* LLVMEvalInitialConditionsCodeGen::FunctionName = "evalInitialConditions"; -LLVMEvalInitialConditionsCodeGen::LLVMEvalInitialConditionsCodeGen( - const LLVMModelGeneratorContext &mgc) : - LLVMCodeGenBase(mgc), -LLVMEvalInitialConditionsCodeGen::~LLVMEvalInitialConditionsCodeGen() -Value* LLVMEvalInitialConditionsCodeGen::codeGen() @@ -67,7 +67,7 @@ Value* LLVMEvalInitialConditionsCodeGen::codeGen() -void LLVMEvalInitialConditionsCodeGen::codeGenSpecies( LLVMModelDataStoreSymbolResolver& modelDataResolver) @@ -104,12 +104,12 @@ void LLVMEvalInitialConditionsCodeGen::codeGenSpecies( -void LLVMEvalInitialConditionsCodeGen::codeGenStoichiometry( llvm::Value *modelData, LLVMModelDataStoreSymbolResolver& modelDataResolver) - LLVMModelDataIRBuilder modelDataBuilder(modelData, dataSymbols, - LLVMASTNodeCodeGen astCodeGen(builder, initialValueResolver); @@ -142,12 +142,12 @@ void LLVMEvalInitialConditionsCodeGen::codeGenStoichiometry( - LLVMModelDataIRBuilder::createCSRMatrixSetNZ(builder, stoich, row, col, stoichValue); -void LLVMEvalInitialConditionsCodeGen::codeGenCompartments( LLVMModelDataStoreSymbolResolver& modelDataResolver) @@ -165,7 +165,7 @@ void LLVMEvalInitialConditionsCodeGen::codeGenCompartments( -void LLVMEvalInitialConditionsCodeGen::codeGenParameters( LLVMModelDataStoreSymbolResolver& modelDataResolver) diff --git a/source/llvm/rrLLVMEvalInitialConditionsCodeGen.h b/source/llvm/EvalInitialConditionsCodeGen.h rename from source/llvm/rrLLVMEvalInitialConditionsCodeGen.h rename to source/llvm/EvalInitialConditionsCodeGen.h --- a/source/llvm/rrLLVMEvalInitialConditionsCodeGen.h +++ b/source/llvm/EvalInitialConditionsCodeGen.h - * rrLLVMInitialValueCodeGen.h -#ifndef LLVMInitialValueCodeGenH -#define LLVMInitialValueCodeGenH -#include "rrLLVMModelGeneratorContext.h" -#include "rrLLVMCodeGen.h" -#include "rrLLVMCodeGenBase.h" -#include "rrLLVMSymbolForest.h" -#include "rrLLVMASTNodeFactory.h" -#include "rrLLVMModelDataIRBuilder.h" -#include "rrLLVMInitialValueSymbolResolver.h" -#include "rrLLVMModelDataSymbolResolver.h" -typedef void (*LLVMEvalInitialConditions_FunctionPtr)(LLVMModelData*); +typedef void (*EvalInitialConditions_FunctionPtr)(LLVMModelData*); @@ -33,17 +32,17 @@ typedef void (*LLVMEvalInitialConditions_FunctionPtr)(LLVMModelData*); -class LLVMEvalInitialConditionsCodeGen: - public LLVMCodeGenBase - LLVMEvalInitialConditionsCodeGen(const LLVMModelGeneratorContext &mgc); - virtual ~LLVMEvalInitialConditionsCodeGen(); llvm::Value *codeGen(); - typedef LLVMEvalInitialConditions_FunctionPtr FunctionPtr; void codeGenParameters(LLVMModelDataStoreSymbolResolver& modelDataResolver); - LLVMInitialValueSymbolResolver initialValueResolver; -#endif /* LLVMInitialValueCodeGenH */ diff --git a/source/llvm/rrLLVMEvalRateRuleRatesCodeGen.cpp b/source/llvm/EvalRateRuleRatesCodeGen.cpp rename from source/llvm/rrLLVMEvalRateRuleRatesCodeGen.cpp rename to source/llvm/EvalRateRuleRatesCodeGen.cpp --- a/source/llvm/rrLLVMEvalRateRuleRatesCodeGen.cpp +++ b/source/llvm/EvalRateRuleRatesCodeGen.cpp -#include "rrLLVMEvalRateRuleRatesCodeGen.h" -#include "rrLLVMException.h" -#include "rrLLVMASTNodeCodeGen.h" -#include "rrLLVMASTNodeFactory.h" -#include "rrLLVMModelDataSymbolResolver.h" +#include "LLVMException.h" -const char* LLVMEvalRateRuleRatesCodeGen::FunctionName = "evalRateRuleRates"; -LLVMEvalRateRuleRatesCodeGen::LLVMEvalRateRuleRatesCodeGen( - const LLVMModelGeneratorContext &mgc) : - LLVMCodeGenBase(mgc) -LLVMEvalRateRuleRatesCodeGen::~LLVMEvalRateRuleRatesCodeGen() -Value* LLVMEvalRateRuleRatesCodeGen::codeGen() - LLVMModelDataLoadSymbolResolver resolver(modelData,model,modelSymbols, - LLVMModelDataIRBuilder mdbuilder(modelData, dataSymbols, builder); - LLVMASTNodeCodeGen astCodeGen(builder, resolver); - LLVMASTNodeFactory nodes; diff --git a/source/llvm/EvalRateRuleRatesCodeGen.h b/source/llvm/EvalRateRuleRatesCodeGen.h +++ b/source/llvm/EvalRateRuleRatesCodeGen.h +#ifndef RRLLVMEVALRATERULERATESCODEGEN_H_ +#define RRLLVMEVALRATERULERATESCODEGEN_H_ +typedef void (*EvalRateRuleRates_FunctionPtr)(LLVMModelData*); + llvm::Value *codeGen(); +#endif /* RRLLVMEVALRATERULERATESCODEGEN_H_ */ diff --git a/source/llvm/rrLLVMEvalReactionRatesCodeGen.cpp b/source/llvm/EvalReactionRatesCodeGen.cpp rename from source/llvm/rrLLVMEvalReactionRatesCodeGen.cpp rename to source/llvm/EvalReactionRatesCodeGen.cpp --- a/source/llvm/rrLLVMEvalReactionRatesCodeGen.cpp +++ b/source/llvm/EvalReactionRatesCodeGen.cpp - * rrLLVMEvalReactionRatesCodeGen.cpp -#include "rrLLVMEvalReactionRatesCodeGen.h" -#include "rrLLVMException.h" -#include "rrLLVMASTNodeCodeGen.h" -#include "rrLLVMASTNodeFactory.h" -#include "rrLLVMModelDataSymbolResolver.h" +#include "LLVMException.h" -const char* LLVMEvalReactionRatesCodeGen::FunctionName = "evalReactionRates"; -LLVMEvalReactionRatesCodeGen::LLVMEvalReactionRatesCodeGen( - const LLVMModelGeneratorContext &mgc) : - LLVMCodeGenBase(mgc) -LLVMEvalReactionRatesCodeGen::~LLVMEvalReactionRatesCodeGen() -Value* LLVMEvalReactionRatesCodeGen::codeGen() - LLVMModelDataLoadSymbolResolver resolver(modelData,model,modelSymbols, - LLVMModelDataIRBuilder mdbuilder(modelData, dataSymbols, builder); - LLVMASTNodeCodeGen astCodeGen(builder, resolver); - LLVMASTNodeFactory nodes; diff --git a/source/llvm/EvalReactionRatesCodeGen.h b/source/llvm/EvalReactionRatesCodeGen.h +++ b/source/llvm/EvalReactionRatesCodeGen.h +typedef void (*EvalReactionRates_FunctionPtr)(LLVMModelData*); + llvm::Value *codeGen(); +#endif /* rrLLVMEvalReactionRatesCodeGen */ diff --git a/source/llvm/GetRateRuleValuesCodeGen.cpp b/source/llvm/GetRateRuleValuesCodeGen.cpp +++ b/source/llvm/GetRateRuleValuesCodeGen.cpp diff --git a/source/llvm/GetRateRuleValuesCodeGen.h b/source/llvm/GetRateRuleValuesCodeGen.h +++ b/source/llvm/GetRateRuleValuesCodeGen.h + typedef void (*FunctionPtr)(LLVMModelData*); diff --git a/source/llvm/rrLLVMGetValueCodeGenBase.h b/source/llvm/GetValueCodeGenBase.h rename from source/llvm/rrLLVMGetValueCodeGenBase.h rename to source/llvm/GetValueCodeGenBase.h --- a/source/llvm/rrLLVMGetValueCodeGenBase.h +++ b/source/llvm/GetValueCodeGenBase.h - * rrLLVMGetValueCodeGenBase.h #ifndef RRLLVMGETVALUECODEGENBASE_H_ #define RRLLVMGETVALUECODEGENBASE_H_ -#include "rrLLVMCodeGenBase.h" -#include "rrLLVMModelGeneratorContext.h" -#include "rrLLVMCodeGen.h" -#include "rrLLVMCodeGenBase.h" -#include "rrLLVMSymbolForest.h" -#include "rrLLVMASTNodeFactory.h" -#include "rrLLVMModelDataIRBuilder.h" -#include "rrLLVMModelDataSymbolResolver.h" -#include "rrLLVMException.h" +#include "LLVMException.h" -typedef double (*LLVMGetValueCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); +typedef double (*GetValueCodeGenBase_FunctionPtr)(LLVMModelData*, int32_t); -class LLVMGetValueCodeGenBase : - public LLVMCodeGenBase - LLVMGetValueCodeGenBase(const LLVMModelGeneratorContext &mgc); - virtual ~LLVMGetValueCodeGenBase(); llvm::Value *codeGen(); - typedef LLVMGetValueCodeGenBase_FunctionPtr FunctionPtr; -LLVMGetValueCodeGenBase::LLVMGetValueCodeGenBase( - const LLVMModelGeneratorContext &mgc) : - LLVMCodeGenBase(mgc) -LLVMGetValueCodeGenBase::~LLVMGetValueCodeGenBase() -llvm::Value* LLVMGetValueCodeGenBase::codeGen() +llvm::Value* GetValueCodeGenBase::codeGen() llvm::Type *argTypes[] = { - llvm::PointerType::get(LLVMModelDataIRBuilder::getStructType(this->module), 0), + llvm::PointerType::get(ModelDataIRBuilder::getStructType(this->module), 0), llvm::Type::getInt32Ty(this->context) @@ -73,7 +71,7 @@ llvm::Value* LLVMGetValueCodeGenBase::codeGen() - LLVMModelDataLoadSymbolResolver resolver(args[0], this->model, this->modelSymbols, diff --git a/source/llvm/GetValuesCodeGen.cpp b/source/llvm/GetValuesCodeGen.cpp +++ b/source/llvm/GetValuesCodeGen.cpp +#include "LLVMException.h" +using namespace llvm; diff --git a/source/llvm/GetValuesCodeGen.h b/source/llvm/GetValuesCodeGen.h +++ b/source/llvm/GetValuesCodeGen.h +#ifndef RRLLVMGETBOUNDARYSPECIESAMOUNTSCODEGEN_H_ +#define RRLLVMGETBOUNDARYSPECIESAMOUNTSCODEGEN_H_ +#endif /* RRLLVMGETBOUNDARYSPECIESAMOUNTSCODEGEN_H_ */ diff --git a/source/llvm/rrLLVMInitialValueSymbolResolver.cpp b/source/llvm/InitialValueSymbolResolver.cpp rename from source/llvm/rrLLVMInitialValueSymbolResolver.cpp rename to source/llvm/InitialValueSymbolResolver.cpp --- a/source/llvm/rrLLVMInitialValueSymbolResolver.cpp +++ b/source/llvm/InitialValueSymbolResolver.cpp - * rrLLVMModelDataSymbolResolver.cpp -#include "rrLLVMInitialValueSymbolResolver.h" -#include "rrLLVMASTNodeCodeGen.h" -#include "rrLLVMException.h" +#include "LLVMException.h" @@ -17,7 +17,7 @@ using namespace llvm; -LLVMInitialValueSymbolResolver::LLVMInitialValueSymbolResolver( const LLVMModelDataSymbols& modelDataSymbols, const LLVMModelSymbols& modelSymbols, @@ -28,11 +28,11 @@ LLVMInitialValueSymbolResolver::LLVMInitialValueSymbolResolver( -LLVMInitialValueSymbolResolver::~LLVMInitialValueSymbolResolver() -llvm::Value* LLVMInitialValueSymbolResolver::loadSymbolValue( +llvm::Value* InitialValueSymbolResolver::loadSymbolValue( @@ -43,7 +43,7 @@ llvm::Value* LLVMInitialValueSymbolResolver::loadSymbolValue( - return LLVMASTNodeCodeGen(builder, *this).codeGen(i->second); @@ -56,7 +56,7 @@ llvm::Value* LLVMInitialValueSymbolResolver::loadSymbolValue( - return LLVMASTNodeCodeGen(builder, *this).codeGen(i->second); diff --git a/source/llvm/rrLLVMInitialValueSymbolResolver.h b/source/llvm/InitialValueSymbolResolver.h rename from source/llvm/rrLLVMInitialValueSymbolResolver.h rename to source/llvm/InitialValueSymbolResolver.h --- a/source/llvm/rrLLVMInitialValueSymbolResolver.h +++ b/source/llvm/InitialValueSymbolResolver.h - * rrLLVMInitialValueSymbolResolver.h -#ifndef rrLLVMInitialValueSymbolResolver_H_ -#define rrLLVMInitialValueSymbolResolver_H_ -#include "rrLLVMCodeGen.h" -#include "rrLLVMIncludes.h" -#include "rrLLVMModelDataSymbols.h" -#include "rrLLVMModelSymbols.h" +#include "LLVMIncludes.h" +#include "LLVMModelDataSymbols.h" +#include "LLVMModelSymbols.h" -class LLVMInitialValueSymbolResolver: public LLVMLoadSymbolResolver - LLVMInitialValueSymbolResolver(const libsbml::Model *model, const LLVMModelDataSymbols &modelDataSymbols, const LLVMModelSymbols &modelSymbols, llvm::IRBuilder<> &builder); - virtual ~LLVMInitialValueSymbolResolver(); virtual llvm::Value* loadSymbolValue(const std::string& symbol); -#endif /* rrLLVMInitialValueSymbolResolver_H_ */ diff --git a/source/llvm/rrLLVMCompiler.cpp b/source/llvm/LLVMCompiler.cpp rename from source/llvm/rrLLVMCompiler.cpp rename to source/llvm/LLVMCompiler.cpp --- a/source/llvm/rrLLVMCompiler.cpp +++ b/source/llvm/LLVMCompiler.cpp - * rrLLVMCompiler.cpp + * LLVMCompiler.cpp -#include "rrLLVMCompiler.h" +#include "LLVMCompiler.h" diff --git a/source/llvm/rrLLVMCompiler.h b/source/llvm/LLVMCompiler.h rename from source/llvm/rrLLVMCompiler.h rename to source/llvm/LLVMCompiler.h --- a/source/llvm/rrLLVMCompiler.h +++ b/source/llvm/LLVMCompiler.h - * rrLLVMCompiler.h + * LLVMCompiler.h -#ifndef rrLLVMCompilerH -#define rrLLVMCompilerH +#ifndef LLVMCompilerH +#define LLVMCompilerH -#endif /* rrLLVMCompilerH */ +#endif /* LLVMCompilerH */ diff --git a/source/llvm/rrLLVMException.h b/source/llvm/LLVMException.h rename from source/llvm/rrLLVMException.h rename to source/llvm/LLVMException.h --- a/source/llvm/rrLLVMException.h +++ b/source/llvm/LLVMException.h - * rrLLVMException.h + * LLVMException.h diff --git a/source/llvm/rrLLVMExecutableModel.cpp b/source/llvm/LLVMExecutableModel.cpp rename from source/llvm/rrLLVMExecutableModel.cpp rename to source/llvm/LLVMExecutableModel.cpp --- a/source/llvm/rrLLVMExecutableModel.cpp +++ b/source/llvm/LLVMExecutableModel.cpp - * rrLLVMExecutableModel.cpp + * LLVMExecutableModel.cpp -#include "rrLLVMExecutableModel.h" -#include "rrLLVMIncludes.h" +#include "LLVMExecutableModel.h" +#include "LLVMIncludes.h" -#include "rrLLVMException.h" +#include "LLVMException.h" diff --git a/source/llvm/rrLLVMExecutableModel.h b/source/llvm/LLVMExecutableModel.h rename from source/llvm/rrLLVMExecutableModel.h rename to source/llvm/LLVMExecutableModel.h --- a/source/llvm/rrLLVMExecutableModel.h +++ b/source/llvm/LLVMExecutableModel.h - * rrLLVMExecutableModel.h + * LLVMExecutableModel.h -#ifndef rrLLVMExecutableModelH -#define rrLLVMExecutableModelH +#ifndef LLVMExecutableModelH +#define LLVMExecutableModelH -#include "rrLLVMModelDataSymbols.h" -#include "rrLLVMIncludes.h" +#include "LLVMModelDataSymbols.h" +#include "LLVMIncludes.h" -#include "rrLLVMEvalInitialConditionsCodeGen.h" -#include "rrLLVMEvalReactionRatesCodeGen.h" -#include "rrLLVMEvalRateRuleRatesCodeGen.h" -#include "rrLLVMGetValuesCodeGen.h" - LLVMEvalInitialConditionsCodeGen::FunctionPtr evalInitialConditionsPtr; - LLVMEvalReactionRatesCodeGen::FunctionPtr evalReactionRatesPtr; - LLVMGetBoundarySpeciesAmountCodeGen::FunctionPtr getBoundarySpeciesAmountPtr; - LLVMGetFloatingSpeciesAmountCodeGen::FunctionPtr getFloatingSpeciesAmountPtr; - LLVMGetBoundarySpeciesConcentrationCodeGen::FunctionPtr getBoundarySpeciesConcentrationPtr; - LLVMGetFloatingSpeciesConcentrationCodeGen::FunctionPtr getFloatingSpeciesConcentrationPtr; - LLVMGetCompartmentVolumeCodeGen::FunctionPtr getCompartmentVolumePtr; - LLVMGetGlobalParameterCodeGen::FunctionPtr getGlobalParameterPtr; - LLVMEvalRateRuleRatesCodeGen::FunctionPtr evalRateRuleRatesPtr; -#endif /* rrLLVMExecutableModelH */ +#endif /* LLVMExecutableModelH */ diff --git a/source/llvm/rrLLVMIncludes.h b/source/llvm/LLVMIncludes.h rename from source/llvm/rrLLVMIncludes.h rename to source/llvm/LLVMIncludes.h --- a/source/llvm/rrLLVMIncludes.h +++ b/source/llvm/LLVMIncludes.h - * rrLLVMIncludes.h + * LLVMIncludes.h diff --git a/source/llvm/rrLLVMModelData.cpp b/source/llvm/LLVMModelData.cpp rename from source/llvm/rrLLVMModelData.cpp rename to source/llvm/LLVMModelData.cpp --- a/source/llvm/rrLLVMModelData.cpp +++ b/source/llvm/LLVMModelData.cpp -#include "rrLLVMModelData.h" +#include "LLVMModelData.h" diff --git a/source/llvm/rrLLVMModelData.h b/source/llvm/LLVMModelData.h rename from source/llvm/rrLLVMModelData.h rename to source/llvm/LLVMModelData.h --- a/source/llvm/rrLLVMModelData.h +++ b/source/llvm/LLVMModelData.h - * rrLLVMModelData.h + * LLVMModelData.h diff --git a/source/llvm/rrLLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp rename from source/llvm/rrLLVMModelDataSymbols.cpp rename to source/llvm/LLVMModelDataSymbols.cpp --- a/source/llvm/rrLLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp - * rrLLVMModelDataSymbols.cpp + * LLVMModelDataSymbols.cpp -#include "rrLLVMModelDataSymbols.h" +#include "LLVMModelDataSymbols.h" -#include "rrLLVMException.h" +#include "LLVMException.h" diff --git a/source/llvm/rrLLVMModelDataSymbols.h b/source/llvm/LLVMModelDataSymbols.h rename from source/llvm/rrLLVMModelDataSymbols.h rename to source/llvm/LLVMModelDataSymbols.h --- a/source/llvm/rrLLVMModelDataSymbols.h +++ b/source/llvm/LLVMModelDataSymbols.h - * rrLLVMModelDataSymbols.h + * LLVMModelDataSymbols.h #ifndef LLVMModelDataSymbolsH #define LLVMModelDataSymbolsH -#include "rrLLVMModelData.h" +#include "LLVMModelData.h" diff --git a/source/llvm/rrLLVMModelGenerator.cpp b/source/llvm/LLVMModelGenerator.cpp rename from source/llvm/rrLLVMModelGenerator.cpp rename to source/llvm/LLVMModelGenerator.cpp --- a/source/llvm/rrLLVMModelGenerator.cpp +++ b/source/llvm/LLVMModelGenerator.cpp - * rrLLVMModelGenerator.cpp + * LLVMModelGenerator.cpp -#include "rrLLVMModelGenerator.h" -#include "rrLLVMExecutableModel.h" -#include "rrLLVMModelGeneratorContext.h" -#include "rrLLVMIncludes.h" +#include "LLVMModelGenerator.h" +#include "LLVMExecutableModel.h" +#include "LLVMIncludes.h" @@ -44,34 +44,34 @@ ExecutableModel* LLVMModelGenerator::createModel(const string& sbml, ExecutableModel* LLVMModelGenerator::createModel(const std::string& sbml, - LLVMModelGeneratorContext context(sbml, computeAndAssignConsevationLaws); - LLVMEvalInitialConditionsCodeGen::FunctionPtr evalInitialConditionsPtr = - LLVMEvalInitialConditionsCodeGen(context).createFunction(); - LLVMEvalReactionRatesCodeGen::FunctionPtr evalReactionRatesPtr = - LLVMEvalReactionRatesCodeGen(context).createFunction(); - LLVMGetBoundarySpeciesAmountCodeGen::FunctionPtr getBoundarySpeciesAmountPtr = - LLVMGetBoundarySpeciesAmountCodeGen(context).createFunction(); - LLVMGetFloatingSpeciesAmountCodeGen::FunctionPtr getFloatingSpeciesAmountPtr = - LLVMGetFloatingSpeciesAmountCodeGen(context).createFunction(); - LLVMGetBoundarySpeciesConcentrationCodeGen::FunctionPtr getBoundarySpeciesConcentrationPtr = - LLVMGetBoundarySpeciesConcentrationCodeGen(context).createFunction(); - LLVMGetFloatingSpeciesConcentrationCodeGen::FunctionPtr getFloatingSpeciesConcentrationPtr = - LLVMGetFloatingSpeciesConcentrationCodeGen(context).createFunction(); - LLVMGetCompartmentVolumeCodeGen::FunctionPtr getCompartmentVolumePtr = - LLVMGetCompartmentVolumeCodeGen(context).createFunction(); - LLVMGetGlobalParameterCodeGen::FunctionPtr getGlobalParameterPtr = - LLVMGetGlobalParameterCodeGen(context).createFunction(); - LLVMEvalRateRuleRatesCodeGen::FunctionPtr evalRateRuleRatesPtr = - LLVMEvalRateRuleRatesCodeGen(context).createFunction(); diff --git a/source/llvm/rrLLVMModelGenerator.h b/source/llvm/LLVMModelGenerator.h rename from source/llvm/rrLLVMModelGenerator.h rename to source/llvm/LLVMModelGenerator.h --- a/source/llvm/rrLLVMModelGenerator.h +++ b/source/llvm/LLVMModelGenerator.h - * rrLLVMModelGenerator.h + * LLVMModelGenerator.h #define rrLLVMModelGeneratorH -#include "rrLLVMCompiler.h" +#include "LLVMCompiler.h" diff --git a/source/llvm/rrLLVMModelSymbols.cpp b/source/llvm/LLVMModelSymbols.cpp rename from source/llvm/rrLLVMModelSymbols.cpp rename to source/llvm/LLVMModelSymbols.cpp --- a/source/llvm/rrLLVMModelSymbols.cpp +++ b/source/llvm/LLVMModelSymbols.cpp - * rrLLVMInitialValueCodeGen.cpp + * LLVMModelSymbols.cpp -#include "rrLLVMModelSymbols.h" -#include "rrLLVMException.h" -#include "rrLLVMASTNodeCodeGen.h" +#include "LLVMModelSymbols.h" +#include "LLVMException.h" diff --git a/source/llvm/rrLLVMModelSymbols.h b/source/llvm/LLVMModelSymbols.h rename from source/llvm/rrLLVMModelSymbols.h rename to source/llvm/LLVMModelSymbols.h --- a/source/llvm/rrLLVMModelSymbols.h +++ b/source/llvm/LLVMModelSymbols.h - * rrLLVMModelSymbols.h + * LLVMModelSymbols.h #ifndef LLVMLLVMModelSymbolsH #define LLVMLLVMModelSymbolsH -#include "rrLLVMSymbolForest.h" -#include "rrLLVMASTNodeFactory.h" -#include "rrLLVMModelDataIRBuilder.h" - LLVMASTNodeFactory nodes; diff --git a/source/llvm/rrLLVMModelDataIRBuilder.cpp b/source/llvm/ModelDataIRBuilder.cpp rename from source/llvm/rrLLVMModelDataIRBuilder.cpp rename to source/llvm/ModelDataIRBuilder.cpp --- a/source/llvm/rrLLVMModelDataIRBuilder.cpp +++ b/source/llvm/ModelDataIRBuilder.cpp - * rrLLVMModelDataIRBuilder.cpp -#include "rrLLVMModelDataIRBuilder.h" -#include "rrLLVMException.h" +#include "LLVMException.h" -const char* LLVMModelDataIRBuilder::LLVMModelDataName = "rr::LLVMModelData"; -const char* LLVMModelDataIRBuilder::csr_matrixName = "rr::csr_matrix"; -const char* LLVMModelDataIRBuilder::csr_matrix_set_nzName = "rr::csr_matrix_set_nz"; -const char* LLVMModelDataIRBuilder::csr_matrix_get_nzName = "rr::csr_matrix_get_nz"; +const char* ModelDataIRBuilder::LLVMModelDataName = "rr::LLVMModelData"; -LLVMModelDataIRBuilder::LLVMModelDataIRBuilder(Value *modelData, const LLVMModelDataSymbols &symbols, @@ -45,7 +45,7 @@ LLVMModelDataIRBuilder::LLVMModelDataIRBuilder(Value *modelData, -llvm::Value* LLVMModelDataIRBuilder::createGlobalParamGEP(const std::string& id) +llvm::Value* ModelDataIRBuilder::createGlobalParamGEP(const std::string& id) @@ -53,20 +53,20 @@ llvm::Value* LLVMModelDataIRBuilder::createGlobalParamGEP(const std::string& id) -llvm::Value* LLVMModelDataIRBuilder::createGEP(ModelDataFields field, +llvm::Value* ModelDataIRBuilder::createGEP(ModelDataFields field, const char* fieldName = LLVMModelDataSymbols::getFieldName(field); -llvm::Value* LLVMModelDataIRBuilder::createFloatSpeciesCompGEP(const std::string& id) +llvm::Value* ModelDataIRBuilder::createFloatSpeciesCompGEP(const std::string& id) -llvm::Value* LLVMModelDataIRBuilder::createGEP(ModelDataFields field, +llvm::Value* ModelDataIRBuilder::createGEP(ModelDataFields field, Twine fieldName = LLVMModelDataSymbols::getFieldName(field); @@ -78,7 +78,7 @@ llvm::Value* LLVMModelDataIRBuilder::createGEP(ModelDataFields field, -llvm::StructType* LLVMModelDataIRBuilder::getCSRSparseStructType( +llvm::StructType* ModelDataIRBuilder::getCSRSparseStructType( llvm::Module* module, llvm::ExecutionEngine* engine) @@ -117,10 +117,10 @@ llvm::StructType* LLVMModelDataIRBuilder::getCSRSparseStructType( -llvm::Function* LLVMModelDataIRBuilder::getCSRMatrixSetNZDecl(Module *module) +llvm::Function* ModelDataIRBuilder::getCSRMatrixSetNZDecl(Module *module) - LLVMModelDataIRBuilder::csr_matrix_set_nzName); @@ -135,15 +135,15 @@ llvm::Function* LLVMModelDataIRBuilder::getCSRMatrixSetNZDecl(Module *module) - LLVMModelDataIRBuilder::csr_matrix_set_nzName, module); -llvm::Function* LLVMModelDataIRBuilder::getCSRMatrixGetNZDecl(Module *module) +llvm::Function* ModelDataIRBuilder::getCSRMatrixGetNZDecl(Module *module) - LLVMModelDataIRBuilder::csr_matrix_get_nzName); @@ -156,21 +156,21 @@ llvm::Function* LLVMModelDataIRBuilder::getCSRMatrixGetNZDecl(Module *module) - LLVMModelDataIRBuilder::csr_matrix_get_nzName, module); -llvm::CallInst* LLVMModelDataIRBuilder::createCSRMatrixSetNZ(IRBuilder<> &builder, +llvm::CallInst* ModelDataIRBuilder::createCSRMatrixSetNZ(IRBuilder<> &builder, llvm::Value* csrPtr, llvm::Value* row, llvm::Value* col, llvm::Value* value, const Twine& name) - Function *func = LLVMModelDataIRBuilder::getCSRMatrixSetNZDecl(getModule(builder, __FUNC__)); -llvm::Value* LLVMModelDataIRBuilder::createFloatSpeciesAmtGEP( +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtGEP( @@ -179,21 +179,21 @@ llvm::Value* LLVMModelDataIRBuilder::createFloatSpeciesAmtGEP( -llvm::Value* LLVMModelDataIRBuilder::createFloatSpeciesAmtLoad( +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtLoad( const std::string& id, const llvm::Twine& name) -llvm::Value* LLVMModelDataIRBuilder::createFloatSpeciesAmtStore( +llvm::Value* ModelDataIRBuilder::createFloatSpeciesAmtStore( const std::string& id, llvm::Value* value) -llvm::Module* LLVMModelDataIRBuilder::getModule(IRBuilder<> &builder, const char* func) +llvm::Module* ModelDataIRBuilder::getModule(IRBuilder<> &builder, const char* func) @@ -208,23 +208,23 @@ llvm::Module* LLVMModelDataIRBuilder::getModule(IRBuilder<> &builder, const char -llvm::CallInst* LLVMModelDataIRBuilder::createCSRMatrixGetNZ(IRBuilder<> &builder, +llvm::CallInst* ModelDataIRBuilder::createCSRMatrixGetNZ(IRBuilder<> &builder, llvm::Value* csrPtr, llvm::Value* row, llvm::Value* col, - Function *func = LLVMModelDataIRBuilder::getCSRMatrixGetNZDecl(getModule(builder, __FUNC__)); -llvm::Value* LLVMModelDataIRBuilder::createLoad(ModelDataFields field, unsigned index, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createLoad(ModelDataFields field, unsigned index, const llvm::Twine& name) -llvm::Value* LLVMModelDataIRBuilder::createRateRuleValueGEP(const std::string& id, +llvm::Value* ModelDataIRBuilder::createRateRuleValueGEP(const std::string& id, const llvm::Twine& name) @@ -233,7 +233,7 @@ llvm::Value* LLVMModelDataIRBuilder::createRateRuleValueGEP(const std::string& i -llvm::Value* LLVMModelDataIRBuilder::createRateRuleValueLoad(const std::string& id, +llvm::Value* ModelDataIRBuilder::createRateRuleValueLoad(const std::string& id, const llvm::Twine& name) @@ -241,14 +241,14 @@ llvm::Value* LLVMModelDataIRBuilder::createRateRuleValueLoad(const std::string& -llvm::Value* LLVMModelDataIRBuilder::createRateRuleValueStore(const std::string& id, +llvm::Value* ModelDataIRBuilder::createRateRuleValueStore(const std::string& id, llvm::Value* value) -llvm::Value* LLVMModelDataIRBuilder::createRateRuleRateGEP(const std::string& id, +llvm::Value* ModelDataIRBuilder::createRateRuleRateGEP(const std::string& id, const llvm::Twine& name) @@ -257,7 +257,7 @@ llvm::Value* LLVMModelDataIRBuilder::createRateRuleRateGEP(const std::string& id -llvm::Value* LLVMModelDataIRBuilder::createRateRuleRateLoad(const std::string& id, +llvm::Value* ModelDataIRBuilder::createRateRuleRateLoad(const std::string& id, const llvm::Twine& name) @@ -265,35 +265,35 @@ llvm::Value* LLVMModelDataIRBuilder::createRateRuleRateLoad(const std::string& i -llvm::Value* LLVMModelDataIRBuilder::createRateRuleRateStore(const std::string& id, +llvm::Value* ModelDataIRBuilder::createRateRuleRateStore(const std::string& id, llvm::Value* value) -llvm::Value* LLVMModelDataIRBuilder::createStore(ModelDataFields field, +llvm::Value* ModelDataIRBuilder::createStore(ModelDataFields field, unsigned index, llvm::Value* value, const Twine& name) -llvm::Value* LLVMModelDataIRBuilder::createCompLoad(const std::string& id, +llvm::Value* ModelDataIRBuilder::createCompLoad(const std::string& id, const llvm::Twine& name) -llvm::Value* LLVMModelDataIRBuilder::createCompStore(const std::string& id, +llvm::Value* ModelDataIRBuilder::createCompStore(const std::string& id, llvm::Value* value) -llvm::Value* LLVMModelDataIRBuilder::createCompGEP(const std::string& id, +llvm::Value* ModelDataIRBuilder::createCompGEP(const std::string& id, const llvm::Twine& name) @@ -302,20 +302,20 @@ llvm::Value* LLVMModelDataIRBuilder::createCompGEP(const std::string& id, -llvm::Value* LLVMModelDataIRBuilder::createBoundSpeciesAmtLoad(const std::string& id, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtLoad(const std::string& id, const llvm::Twine& name) -llvm::Value* LLVMModelDataIRBuilder::createBoundSpeciesAmtStore( +llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtStore( const std::string& id, llvm::Value* value) -llvm::Value* LLVMModelDataIRBuilder::createBoundSpeciesAmtGEP( +llvm::Value* ModelDataIRBuilder::createBoundSpeciesAmtGEP( const std::string& id, const llvm::Twine& name) @@ -323,13 +323,13 @@ llvm::Value* LLVMModelDataIRBuilder::createBoundSpeciesAmtGEP( -llvm::Value* LLVMModelDataIRBuilder::createBoundSpeciesCompGEP(const std::string& id) +llvm::Value* ModelDataIRBuilder::createBoundSpeciesCompGEP(const std::string& id) -llvm::Value* LLVMModelDataIRBuilder::createGlobalParamLoad( +llvm::Value* ModelDataIRBuilder::createGlobalParamLoad( const std::string& id, const llvm::Twine& name) @@ -337,26 +337,26 @@ llvm::Value* LLVMModelDataIRBuilder::createGlobalParamLoad( -llvm::Value* LLVMModelDataIRBuilder::createGlobalParamStore( +llvm::Value* ModelDataIRBuilder::createGlobalParamStore( const std::string& id, llvm::Value* value) -llvm::Value* LLVMModelDataIRBuilder::createReactionRateLoad(const std::string& id, const llvm::Twine& name) +llvm::Value* ModelDataIRBuilder::createReactionRateLoad(const std::string& id, const llvm::Twine& name) -llvm::Value* LLVMModelDataIRBuilder::createReactionRateStore(const std::string& id, llvm::Value* value) +llvm::Value* ModelDataIRBuilder::createReactionRateStore(const std::string& id, llvm::Value* value) -void LLVMModelDataIRBuilder::validateStruct(llvm::Value* s, +void ModelDataIRBuilder::validateStruct(llvm::Value* s, @@ -381,7 +381,7 @@ void LLVMModelDataIRBuilder::validateStruct(llvm::Value* s, throw LLVMException(err.str()); -llvm::StructType *LLVMModelDataIRBuilder::getStructType(llvm::Module *module, llvm::ExecutionEngine *engine) +llvm::StructType *ModelDataIRBuilder::getStructType(llvm::Module *module, llvm::ExecutionEngine *engine) StructType *structType = module->getTypeByName(LLVMModelDataName); @@ -519,7 +519,7 @@ void LLVMModelDataIRBuilderTesting::createAccessors(Module *module) LLVMContext &context = module->getContext(); - StructType *structType = LLVMModelDataIRBuilder::getStructType(module); @@ -537,7 +537,7 @@ void LLVMModelDataIRBuilderTesting::createAccessors(Module *module) - LLVMModelDataIRBuilder mdbuilder (getArgValues[0], symbols, builder); @@ -557,17 +557,17 @@ void LLVMModelDataIRBuilderTesting::createAccessors(Module *module) llvm::CallInst* LLVMModelDataIRBuilderTesting::createDispChar(llvm::Value* intVal) - return builder.CreateCall(getDispCharDecl(LLVMModelDataIRBuilder::getModule(builder, __FUNC__)), intVal); llvm::CallInst* LLVMModelDataIRBuilderTesting::createDispDouble(llvm::Value* doubleVal) - return builder.CreateCall(getDispDoubleDecl(LLVMModelDataIRBuilder::getModule(builder, __FUNC__)), doubleVal); llvm::CallInst* LLVMModelDataIRBuilderTesting::createDispInt(llvm::Value* intVal) - return builder.CreateCall(getDispIntDecl(LLVMModelDataIRBuilder::getModule(builder, __FUNC__)), intVal); @@ -583,7 +583,7 @@ pair LLVMModelDataIRBuilderTesting::createFloatingSpeciesA LLVMContext &context = module->getContext(); - StructType *structType = LLVMModelDataIRBuilder::getStructType(module); @@ -603,7 +603,7 @@ pair LLVMModelDataIRBuilderTesting::createFloatingSpeciesA - LLVMModelDataIRBuilder mdbuilder (getArgValues[0], symbols, builder); diff --git a/source/llvm/rrLLVMModelDataIRBuilder.h b/source/llvm/ModelDataIRBuilder.h rename from source/llvm/rrLLVMModelDataIRBuilder.h rename to source/llvm/ModelDataIRBuilder.h --- a/source/llvm/rrLLVMModelDataIRBuilder.h +++ b/source/llvm/ModelDataIRBuilder.h - * rrLLVMModelDataSymbols.h -#ifndef rrLLVMModelDataIRBuilderH -#define rrLLVMModelDataIRBuilderH -#include "rrLLVMIncludes.h" -#include "rrLLVMModelDataSymbols.h" +#include "LLVMIncludes.h" +#include "LLVMModelDataSymbols.h" -class LLVMModelDataIRBuilder - LLVMModelDataIRBuilder(llvm::Value *modelData, LLVMModelDataSymbols const&, + ModelDataIRBuilder(llvm::Value *modelData, LLVMModelDataSymbols const&, llvm::IRBuilder<> &); llvm::Value *createFloatSpeciesAmtGEP(const std::string &id, -#endif /* rrLLVMModelDataIRBuilderH */ diff --git a/source/llvm/rrLLVMModelDataSymbolResolver.cpp b/source/llvm/ModelDataSymbolResolver.cpp rename from source/llvm/rrLLVMModelDataSymbolResolver.cpp rename to source/llvm/ModelDataSymbolResolver.cpp --- a/source/llvm/rrLLVMModelDataSymbolResolver.cpp +++ b/source/llvm/ModelDataSymbolResolver.cpp -#include "rrLLVMModelDataSymbolResolver.h" -#include "rrLLVMASTNodeCodeGen.h" -#include "rrLLVMException.h" +#include "LLVMException.h" @@ -17,7 +17,7 @@ using namespace llvm; -LLVMModelDataLoadSymbolResolver::LLVMModelDataLoadSymbolResolver(llvm::Value *modelData, +ModelDataLoadSymbolResolver::ModelDataLoadSymbolResolver(llvm::Value *modelData, const LLVMModelSymbols &modelSymbols, const LLVMModelDataSymbols &modelDataSymbols, @@ -35,7 +35,7 @@ LLVMModelDataStoreSymbolResolver::LLVMModelDataStoreSymbolResolver(llvm::Value * const LLVMModelSymbols &modelSymbols, const LLVMModelDataSymbols &modelDataSymbols, llvm::IRBuilder<> &builder, - LLVMLoadSymbolResolver &resolver) : @@ -46,10 +46,10 @@ LLVMModelDataStoreSymbolResolver::LLVMModelDataStoreSymbolResolver(llvm::Value * -llvm::Value* LLVMModelDataLoadSymbolResolver::loadSymbolValue( +llvm::Value* ModelDataLoadSymbolResolver::loadSymbolValue( - LLVMModelDataIRBuilder mdbuilder(modelData, modelDataSymbols, @@ -60,7 +60,7 @@ llvm::Value* LLVMModelDataLoadSymbolResolver::loadSymbolValue( - return LLVMASTNodeCodeGen(builder, *this).codeGen(i->second); @@ -138,7 +138,7 @@ llvm::Value* LLVMModelDataStoreSymbolResolver::storeSymbolValue( - LLVMModelDataIRBuilder mdbuilder(modelData, modelDataSymbols, diff --git a/source/llvm/rrLLVMModelDataSymbolResolver.h b/source/llvm/ModelDataSymbolResolver.h rename from source/llvm/rrLLVMModelDataSymbolResolver.h rename to source/llvm/ModelDataSymbolResolver.h --- a/source/llvm/rrLLVMModelDataSymbolResolver.h +++ b/source/llvm/ModelDataSymbolResolver.h - * rrLLVMModelDataSymbolResolver.h -#ifndef rrLLVMModelDataSymbolResolver_H_ -#define rrLLVMModelDataSymbolResolver_H_ -#include "rrLLVMCodeGen.h" -#include "rrLLVMIncludes.h" -#include "rrLLVMModelDataSymbols.h" -#include "rrLLVMModelSymbols.h" +#include "LLVMIncludes.h" +#include "LLVMModelDataSymbols.h" +#include "LLVMModelSymbols.h" -class LLVMModelDataLoadSymbolResolver: public LLVMLoadSymbolResolver - LLVMModelDataLoadSymbolResolver(llvm::Value *modelData, + ModelDataLoadSymbolResolver(llvm::Value *modelData, const libsbml::Model *model, const LLVMModelSymbols &modelSymbols, const LLVMModelDataSymbols &modelDataSymbols, llvm::IRBuilder<> &builder); - virtual ~LLVMModelDataLoadSymbolResolver() {}; virtual llvm::Value *loadSymbolValue(const std::string& symbol); const libsbml::Model *model, const LLVMModelSymbols &modelSymbols, const LLVMModelDataSymbols &modelDataSymbols, llvm::IRBuilder<> &builder, - LLVMLoadSymbolResolver &resolver); virtual ~LLVMModelDataStoreSymbolResolver() {}; const LLVMModelSymbols &modelSymbols; const LLVMModelDataSymbols &modelDataSymbols; llvm::IRBuilder<> &builder; - LLVMLoadSymbolResolver &resolver; diff --git a/source/llvm/rrLLVMModelGeneratorContext.cpp b/source/llvm/ModelGeneratorContext.cpp rename from source/llvm/rrLLVMModelGeneratorContext.cpp rename to source/llvm/ModelGeneratorContext.cpp --- a/source/llvm/rrLLVMModelGeneratorContext.cpp +++ b/source/llvm/ModelGeneratorContext.cpp - * rrLLVMModelGeneratorContext.cpp -#include "rrLLVMModelGeneratorContext.h" -#include "rrLLVMIncludes.h" -#include "rrLLVMModelDataIRBuilder.h" +#include "LLVMIncludes.h" -LLVMModelGeneratorContext::LLVMModelGeneratorContext(std::string const &sbml, @@ -52,7 +52,7 @@ LLVMModelGeneratorContext::LLVMModelGeneratorContext(std::string const &sbml, -LLVMModelGeneratorContext::LLVMModelGeneratorContext(libsbml::SBMLDocument const *doc, -LLVMModelGeneratorContext::LLVMModelGeneratorContext() : symbols(new LLVMModelDataSymbols(doc->getModel(), false)), @@ -116,7 +116,7 @@ LLVMModelGeneratorContext::LLVMModelGeneratorContext() : -LLVMModelGeneratorContext::~LLVMModelGeneratorContext() @@ -127,43 +127,43 @@ LLVMModelGeneratorContext::~LLVMModelGeneratorContext() -llvm::LLVMContext &LLVMModelGeneratorContext::getContext() const +llvm::LLVMContext &ModelGeneratorContext::getContext() const -llvm::ExecutionEngine &LLVMModelGeneratorContext::getExecutionEngine() const +llvm::ExecutionEngine &ModelGeneratorContext::getExecutionEngine() const -const LLVMModelDataSymbols& LLVMModelGeneratorContext::getModelDataSymbols() const +const LLVMModelDataSymbols& ModelGeneratorContext::getModelDataSymbols() const -const libsbml::SBMLDocument* LLVMModelGeneratorContext::getDocument() const -const libsbml::Model* LLVMModelGeneratorContext::getModel() const -llvm::Module *LLVMModelGeneratorContext::getModule() const +llvm::Module *ModelGeneratorContext::getModule() const -llvm::IRBuilder<> &LLVMModelGeneratorContext::getBuilder() const +llvm::IRBuilder<> &ModelGeneratorContext::getBuilder() const -void LLVMModelGeneratorContext::stealThePeach(LLVMModelDataSymbols **sym, +void ModelGeneratorContext::stealThePeach(LLVMModelDataSymbols **sym, llvm::LLVMContext** ctx, llvm::ExecutionEngine** eng, string** err) @@ -176,7 +176,7 @@ void LLVMModelGeneratorContext::stealThePeach(LLVMModelDataSymbols **sym, -const LLVMModelSymbols& LLVMModelGeneratorContext::getModelSymbols() const +const LLVMModelSymbols& ModelGeneratorContext::getModelSymbols() const -void LLVMModelGeneratorContext::addGlobalMappings() - executionEngine->addGlobalMapping(LLVMModelDataIRBuilder::getCSRMatrixSetNZDecl(module), (void*)csr_matrix_set_nz); - executionEngine->addGlobalMapping(LLVMModelDataIRBuilder::getCSRMatrixGetNZDecl(module), (void*)csr_matrix_get_nz); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispIntDecl(module), (void*)dispInt); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispDoubleDecl(module), (void*)dispDouble); executionEngine->addGlobalMapping(LLVMModelDataIRBuilderTesting::getDispCharDecl(module), (void*)dispChar); diff --git a/source/llvm/rrLLVMModelGeneratorContext.h b/source/llvm/ModelGeneratorContext.h rename from source/llvm/rrLLVMModelGeneratorContext.h rename to source/llvm/ModelGeneratorContext.h --- a/source/llvm/rrLLVMModelGeneratorContext.h +++ b/source/llvm/ModelGeneratorContext.h - * rrLLVMModelGeneratorContext.h -#ifndef rrLLVMModelGeneratorContextH -#define rrLLVMModelGeneratorContextH -#include "rrLLVMIncludes.h" -#include "rrLLVMModelDataSymbols.h" -#include "rrLLVMModelSymbols.h" +#include "LLVMIncludes.h" +#include "LLVMModelDataSymbols.h" +#include "LLVMModelSymbols.h" -class LLVMModelGeneratorContext - LLVMModelGeneratorContext(std::string const &sbml, - LLVMModelGeneratorContext(libsbml::SBMLDocument const *doc, * useful for testing out LLVM functionality. - LLVMModelGeneratorContext(); - ~LLVMModelGeneratorContext(); const LLVMModelDataSymbols &getModelDataSymbols() const; * that are accessible from the LLVM generated code. LLVMModelSymbols *modelSymbols; llvm::LLVMContext *context; llvm::ExecutionEngine *executionEngine; llvm::Module *module; -#endif /* rrLLVMModelGeneratorContextH */ diff --git a/source/llvm/SetRateRuleValuesCodeGen.cpp b/source/llvm/SetRateRuleValuesCodeGen.cpp +++ b/source/llvm/SetRateRuleValuesCodeGen.cpp diff --git a/source/llvm/rrLLVMSetRateRuleValuesCodeGen.h b/source/llvm/SetRateRuleValuesCodeGen.h rename from source/llvm/rrLLVMSetRateRuleValuesCodeGen.h rename to source/llvm/SetRateRuleValuesCodeGen.h --- a/source/llvm/rrLLVMSetRateRuleValuesCodeGen.h +++ b/source/llvm/SetRateRuleValuesCodeGen.h - * LLVMSetRateRuleValuesCodeGen.h #ifndef LLVMSETRATERULEVALUESCODEGEN_H_ #define LLVMSETRATERULEVALUESCODEGEN_H_ -#include "rrLLVMCodeGenBase.h" -class LLVMSetRateRuleValuesCodeGen: - public LLVMCodeGenBase - LLVMSetRateRuleValuesCodeGen(const LLVMModelGeneratorContext &mgc); - virtual ~LLVMSetRateRuleValuesCodeGen(); typedef void (*FunctionPtr)(LLVMModelData*); diff --git a/source/llvm/rrLLVMSymbolForest.h b/source/llvm/SymbolForest.h rename from source/llvm/rrLLVMSymbolForest.h rename to source/llvm/SymbolForest.h --- a/source/llvm/rrLLVMSymbolForest.h +++ b/source/llvm/SymbolForest.h - * rrLLVMSymbolForest.h -#ifndef LLVMSymbolForestH -#define LLVMSymbolForestH diff --git a/source/llvm/rrLLVMEvalRateRuleRatesCodeGen.h b/source/llvm/rrLLVMEvalRateRuleRatesCodeGen.h --- a/source/llvm/rrLLVMEvalRateRuleRatesCodeGen.h - * rrLLVMEvalRateRuleRatesCodeGen.h -#ifndef RRLLVMEVALRATERULERATESCODEGEN_H_ -#define RRLLVMEVALRATERULERATESCODEGEN_H_ -#include "rrLLVMCodeGenBase.h" -#include "rrLLVMModelGeneratorContext.h" -#include "rrLLVMCodeGen.h" -#include "rrLLVMSymbolForest.h" -#include "rrLLVMASTNodeFactory.h" -#include "rrLLVMModelDataIRBuilder.h" -typedef void (*LLVMEvalRateRuleRates_FunctionPtr)(LLVMModelData*); -class LLVMEvalRateRuleRatesCodeGen: - public LLVMCodeGenBase - LLVMEvalRateRuleRatesCodeGen(const LLVMModelGeneratorContext &mgc); - virtual ~LLVMEvalRateRuleRatesCodeGen(); - llvm::Value *codeGen(); - typedef LLVMEvalRateRuleRates_FunctionPtr FunctionPtr; -#endif /* RRLLVMEVALRATERULERATESCODEGEN_H_ */ diff --git a/source/llvm/rrLLVMEvalReactionRatesCodeGen.h b/source/llvm/rrLLVMEvalReactionRatesCodeGen.h --- a/source/llvm/rrLLVMEvalReactionRatesCodeGen.h - * rrLLVMEvalReactionRatesCodeGen.h -#ifndef rrLLVMEvalReactionRatesCodeGenH -#define rrLLVMEvalReactionRatesCodeGenH -#include "rrLLVMModelGeneratorContext.h" -#include "rrLLVMCodeGen.h" -#include "rrLLVMCodeGenBase.h" -#include "rrLLVMSymbolForest.h" -#include "rrLLVMASTNodeFactory.h" -#include "rrLLVMModelDataIRBuilder.h" -typedef void (*LLVMEvalReactionRates_FunctionPtr)(LLVMModelData*); -class LLVMEvalReactionRatesCodeGen: - public LLVMCodeGenBase