├── .clang-format ├── .clang-tidy ├── .editorconfig ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── config.yml ├── labeler.yml └── workflows │ ├── fast-forward.yml │ ├── pr-clang-format.yml │ └── pr-labeler.yml ├── .gitignore ├── .jenkins ├── debian-12.Dockerfile ├── dev-debian-12.Jenkinsfile ├── dev-fedora-40.Jenkinsfile ├── dev-ubuntu-22.04.Jenkinsfile ├── docker-dev-debug-debian-12.Jenkinsfile ├── docker-dev-release-debian-12.Jenkinsfile ├── docker-prod-debian-12.Jenkinsfile ├── fedora-40.Dockerfile ├── install_llvm.sh ├── install_marco.sh ├── install_marco_runtime.sh ├── install_openmodelica.sh ├── package-debian-12.Jenkinsfile ├── package │ └── debian-12 │ │ ├── build.sh │ │ ├── control │ │ └── marco-wrapper.sh ├── prod-image.Dockerfile ├── setup_venv.sh ├── ubuntu-22.04.Dockerfile ├── version_llvm.txt ├── version_marco_runtime.txt └── version_openmodelica.txt ├── CMakeLists.txt ├── COPYING ├── COPYING.LESSER ├── README.md ├── cmake └── modules │ ├── AddMARCO.cmake │ ├── CMakeLists.txt │ └── MARCOConfig.cmake.in ├── docker ├── marco.py └── run-sim.py ├── docs ├── BuildOnLinuxMacOS.md ├── CMakeLists.txt ├── Dialects.md ├── OMC.md ├── Overview.md ├── TestCases.md └── doxygen.cfg.in ├── include ├── CMakeLists.txt └── marco │ ├── AST │ ├── AST.h │ └── Node │ │ ├── ASTNode.h │ │ ├── Algorithm.h │ │ ├── Annotation.h │ │ ├── ArrayConstant.h │ │ ├── ArrayDimension.h │ │ ├── ArrayForGenerator.h │ │ ├── ArrayGenerator.h │ │ ├── AssignmentStatement.h │ │ ├── BreakStatement.h │ │ ├── Call.h │ │ ├── CallStatement.h │ │ ├── Class.h │ │ ├── ComponentReference.h │ │ ├── ComponentReferenceEntry.h │ │ ├── Constant.h │ │ ├── EqualityEquation.h │ │ ├── Equation.h │ │ ├── EquationSection.h │ │ ├── Expression.h │ │ ├── ExpressionFunctionArgument.h │ │ ├── ForEquation.h │ │ ├── ForIndex.h │ │ ├── ForStatement.h │ │ ├── Function.h │ │ ├── FunctionArgument.h │ │ ├── IfEquation.h │ │ ├── IfStatement.h │ │ ├── Member.h │ │ ├── Model.h │ │ ├── Modification.h │ │ ├── NamedFunctionArgument.h │ │ ├── Operation.h │ │ ├── Package.h │ │ ├── Record.h │ │ ├── Reduction.h │ │ ├── ReductionFunctionArgument.h │ │ ├── ReturnStatement.h │ │ ├── Root.h │ │ ├── Statement.h │ │ ├── StatementsBlock.h │ │ ├── Subscript.h │ │ ├── Tuple.h │ │ ├── Type.h │ │ ├── TypePrefix.h │ │ ├── WhenEquation.h │ │ ├── WhenStatement.h │ │ └── WhileStatement.h │ ├── CMakeLists.txt │ ├── Codegen │ ├── CMakeLists.txt │ ├── Conversion │ │ ├── AllToLLVM │ │ │ └── AllToLLVM.h │ │ ├── BaseModelicaCommon │ │ │ ├── LLVMTypeConverter.h │ │ │ └── TypeConverter.h │ │ ├── BaseModelicaToArith │ │ │ └── BaseModelicaToArith.h │ │ ├── BaseModelicaToCF │ │ │ └── BaseModelicaToCF.h │ │ ├── BaseModelicaToFunc │ │ │ └── BaseModelicaToFunc.h │ │ ├── BaseModelicaToLLVM │ │ │ └── BaseModelicaToLLVM.h │ │ ├── BaseModelicaToLinalg │ │ │ └── BaseModelicaToLinalg.h │ │ ├── BaseModelicaToMLIRCore │ │ │ └── BaseModelicaToMLIRCore.h │ │ ├── BaseModelicaToMemRef │ │ │ └── BaseModelicaToMemRef.h │ │ ├── BaseModelicaToRuntime │ │ │ └── BaseModelicaToRuntime.h │ │ ├── BaseModelicaToRuntimeCall │ │ │ └── BaseModelicaToRuntimeCall.h │ │ ├── BaseModelicaToTensor │ │ │ └── BaseModelicaToTensor.h │ │ ├── CMakeLists.txt │ │ ├── IDACommon │ │ │ └── LLVMTypeConverter.h │ │ ├── IDAToFunc │ │ │ └── IDAToFunc.h │ │ ├── IDAToLLVM │ │ │ └── IDAToLLVM.h │ │ ├── KINSOLCommon │ │ │ └── LLVMTypeConverter.h │ │ ├── KINSOLToFunc │ │ │ └── KINSOLToFunc.h │ │ ├── KINSOLToLLVM │ │ │ └── KINSOLToLLVM.h │ │ ├── Passes.h │ │ ├── Passes.td │ │ ├── RuntimeModelMetadataConversion │ │ │ └── RuntimeModelMetadataConversion.h │ │ ├── RuntimeToFunc │ │ │ └── RuntimeToFunc.h │ │ ├── RuntimeToLLVM │ │ │ ├── LLVMTypeConverter.h │ │ │ └── RuntimeToLLVM.h │ │ ├── SUNDIALSToFunc │ │ │ └── SUNDIALSToFunc.h │ │ └── SimulationToLLVM │ │ │ └── SimulationToLLVM.h │ ├── Lowering │ │ ├── AlgorithmLowerer.h │ │ ├── ArrayGeneratorLowerer.h │ │ ├── AssignmentStatementLowerer.h │ │ ├── BreakStatementLowerer.h │ │ ├── Bridge.h │ │ ├── BridgeInterface.h │ │ ├── CallLowerer.h │ │ ├── CallStatementLowerer.h │ │ ├── ClassDependencyGraph.h │ │ ├── ClassLowerer.h │ │ ├── ClassPath.h │ │ ├── ComponentReferenceLowerer.h │ │ ├── ConstantLowerer.h │ │ ├── Distance │ │ │ ├── DatabaseReader.h │ │ │ ├── EditDistance.h │ │ │ ├── EditDistanceParameters.h │ │ │ ├── SentenceDistanceCalculator.h │ │ │ ├── WordDistanceCalculator.h │ │ │ └── distance_mainpage.dox │ │ ├── EqualityEquationLowerer.h │ │ ├── EquationLowerer.h │ │ ├── EquationSectionLowerer.h │ │ ├── ExpressionLowerer.h │ │ ├── ForEquationLowerer.h │ │ ├── ForStatementLowerer.h │ │ ├── IdentifierError.h │ │ ├── IfEquationLowerer.h │ │ ├── IfStatementLowerer.h │ │ ├── Lowerer.h │ │ ├── LoweringContext.h │ │ ├── ModelLowerer.h │ │ ├── OperationLowerer.h │ │ ├── PackageLowerer.h │ │ ├── PartialDerFunctionLowerer.h │ │ ├── RecordLowerer.h │ │ ├── Reference.h │ │ ├── Results.h │ │ ├── ReturnStatementLowerer.h │ │ ├── StandardFunctionLowerer.h │ │ ├── StatementLowerer.h │ │ ├── SubscriptLowerer.h │ │ ├── TupleLowerer.h │ │ ├── VariablesSymbolTable.h │ │ ├── WhenEquationLowerer.h │ │ ├── WhenStatementLowerer.h │ │ └── WhileStatementLowerer.h │ ├── Runtime.h │ ├── Transforms │ │ ├── CMakeLists.txt │ │ ├── Passes.h │ │ └── Passes.td │ └── Verifier.h │ ├── Dialect │ ├── BaseModelica │ │ ├── Analysis │ │ │ └── VariableAccessAnalysis.h │ │ ├── CMakeLists.txt │ │ ├── IR │ │ │ ├── AttrInterfaces.h │ │ │ ├── Attributes.h │ │ │ ├── BaseModelica.h │ │ │ ├── BaseModelica.td │ │ │ ├── BaseModelicaAttrInterfaces.td │ │ │ ├── BaseModelicaAttributes.td │ │ │ ├── BaseModelicaEnums.td │ │ │ ├── BaseModelicaOpInterfaces.td │ │ │ ├── BaseModelicaOps.td │ │ │ ├── BaseModelicaTypeInterfaces.td │ │ │ ├── BaseModelicaTypes.td │ │ │ ├── CMakeLists.txt │ │ │ ├── Common.h │ │ │ ├── DefaultValuesDependencyGraph.h │ │ │ ├── DerivativesMap.h │ │ │ ├── Enums.h │ │ │ ├── EquationPath.h │ │ │ ├── ExpressionPath.h │ │ │ ├── OpInterfaces.h │ │ │ ├── Ops.h │ │ │ ├── Properties.h │ │ │ ├── TypeInterfaces.h │ │ │ ├── Types.h │ │ │ ├── VariableAccess.h │ │ │ ├── VariablesDependencyGraph.h │ │ │ └── VariablesDimensionsDependencyGraph.h │ │ └── Transforms │ │ │ ├── AccessReplacementTest.h │ │ │ ├── AllInterfaces.h │ │ │ ├── AllocationOpInterfaceImpl.h │ │ │ ├── AutomaticDifferentiation.h │ │ │ ├── AutomaticDifferentiation │ │ │ └── ForwardAD.h │ │ │ ├── BindingEquationConversion.h │ │ │ ├── BufferizableOpInterfaceImpl.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CallCSE.h │ │ │ ├── ConstantMaterializableTypeInterfaceImpl.h │ │ │ ├── DerivableOpInterfaceImpl.h │ │ │ ├── DerivableTypeInterfaceImpl.h │ │ │ ├── DerivativeChainRule.h │ │ │ ├── DerivativesInitialization.h │ │ │ ├── DerivativesMaterialization.h │ │ │ ├── EquationAccessSplit.h │ │ │ ├── EquationExplicitation.h │ │ │ ├── EquationExplicitationTest.h │ │ │ ├── EquationExpressionOpInterfaceImpl.h │ │ │ ├── EquationFunctionLoopHoisting.h │ │ │ ├── EquationInductionsExplicitation.h │ │ │ ├── EquationSidesSplit.h │ │ │ ├── EquationTemplatesCreation.h │ │ │ ├── EulerForward.h │ │ │ ├── ExplicitCastInsertion.h │ │ │ ├── ExplicitInitialEquationsInsertion.h │ │ │ ├── ExplicitStartValueInsertion.h │ │ │ ├── FunctionDefaultValuesConversion.h │ │ │ ├── FunctionScalarization.h │ │ │ ├── FunctionUnwrap.h │ │ │ ├── IDA.h │ │ │ ├── InitialConditionsSolving.h │ │ │ ├── InliningAttributeInsertion.h │ │ │ ├── InvertibleOpInterfaceImpl.h │ │ │ ├── Matching.h │ │ │ ├── ModelAlgorithmConversion.h │ │ │ ├── ModelDebugCanonicalization.h │ │ │ ├── Modeling │ │ │ ├── Bridge.h │ │ │ ├── EquationBridge.h │ │ │ ├── SCCBridge.h │ │ │ └── VariableBridge.h │ │ │ ├── OpDistribution.h │ │ │ ├── Passes.h │ │ │ ├── Passes.td │ │ │ ├── PrintModelInfo.h │ │ │ ├── PureFunctionInlining.h │ │ │ ├── RangeBoundariesInference.h │ │ │ ├── ReadOnlyVariablesPropagation.h │ │ │ ├── RecordInlining.h │ │ │ ├── RungeKutta.h │ │ │ ├── RuntimeVerifiableOpInterfaceImpl.h │ │ │ ├── SCCAbsenceVerification.h │ │ │ ├── SCCDetection.h │ │ │ ├── SCCSolvingBySubstitution.h │ │ │ ├── SCCSolvingWithKINSOL.h │ │ │ ├── ScalarRangesEquationSplit.h │ │ │ ├── ScheduleParallelization.h │ │ │ ├── SchedulersInstantiation.h │ │ │ ├── Scheduling.h │ │ │ ├── SingleValuedInductionElimination.h │ │ │ ├── Solvers │ │ │ └── SUNDIALS.h │ │ │ ├── VariablesPromotion.h │ │ │ ├── VariablesPruning.h │ │ │ ├── VectorizableOpInterfaceImpl.h │ │ │ └── ViewAccessFolding.h │ ├── CMakeLists.txt │ ├── IDA │ │ ├── CMakeLists.txt │ │ └── IR │ │ │ ├── Attributes.h │ │ │ ├── CMakeLists.txt │ │ │ ├── IDA.h │ │ │ ├── IDA.td │ │ │ ├── IDAAttributes.td │ │ │ ├── IDAOps.td │ │ │ ├── IDATypes.td │ │ │ ├── Ops.h │ │ │ ├── Properties.h │ │ │ └── Types.h │ ├── KINSOL │ │ ├── CMakeLists.txt │ │ └── IR │ │ │ ├── Attributes.h │ │ │ ├── CMakeLists.txt │ │ │ ├── KINSOL.h │ │ │ ├── KINSOL.td │ │ │ ├── KINSOLAttributes.td │ │ │ ├── KINSOLOps.td │ │ │ ├── KINSOLTypes.td │ │ │ ├── Ops.h │ │ │ ├── Properties.h │ │ │ └── Types.h │ ├── Modeling │ │ ├── CMakeLists.txt │ │ └── IR │ │ │ ├── Attributes.h │ │ │ ├── CMakeLists.txt │ │ │ ├── IndexSet.h │ │ │ ├── Modeling.h │ │ │ ├── Modeling.td │ │ │ ├── ModelingAttributes.td │ │ │ ├── ModelingOps.td │ │ │ ├── ModelingProperties.td │ │ │ ├── MultidimensionalRange.h │ │ │ ├── Ops.h │ │ │ ├── Point.h │ │ │ ├── Properties.h │ │ │ └── Range.h │ ├── Runtime │ │ ├── CMakeLists.txt │ │ ├── IR │ │ │ ├── Attributes.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Ops.h │ │ │ ├── Properties.h │ │ │ ├── Runtime.h │ │ │ ├── Runtime.td │ │ │ ├── RuntimeAttributes.td │ │ │ ├── RuntimeOps.td │ │ │ ├── RuntimeTypes.td │ │ │ └── Types.h │ │ └── Transforms │ │ │ ├── AllInterfaces.h │ │ │ ├── BufferizableOpInterfaceImpl.h │ │ │ ├── CMakeLists.txt │ │ │ ├── HeapFunctionsReplacement.h │ │ │ ├── Passes.h │ │ │ └── Passes.td │ └── SUNDIALS │ │ ├── CMakeLists.txt │ │ └── IR │ │ ├── Attributes.h │ │ ├── CMakeLists.txt │ │ ├── Ops.h │ │ ├── Properties.h │ │ ├── SUNDIALS.h │ │ ├── SUNDIALS.td │ │ ├── SUNDIALSAttributes.td │ │ ├── SUNDIALSOps.td │ │ ├── SUNDIALSTypes.td │ │ └── Types.h │ ├── Frontend │ ├── CodegenOptions.h │ ├── CompilerInstance.h │ ├── CompilerInvocation.h │ ├── DiagnosticHandler.h │ ├── FrontendAction.h │ ├── FrontendActions.h │ ├── FrontendOptions.h │ ├── Instrumentation │ │ └── VerificationModelEmitter.h │ ├── LanguageOptions.h │ └── SimulationOptions.h │ ├── IO │ ├── Command.h │ └── InputFile.h │ ├── JIT │ └── EngineBuilder.h │ ├── Modeling │ ├── AccessFunction.h │ ├── AccessFunctionAffineConstant.h │ ├── AccessFunctionAffineMap.h │ ├── AccessFunctionConstant.h │ ├── AccessFunctionEmpty.h │ ├── AccessFunctionGeneric.h │ ├── AccessFunctionRotoTranslation.h │ ├── ArrayEquationsDependencyGraph.h │ ├── ArrayVariablesDependencyGraph.h │ ├── Dependency.h │ ├── DependencyGraph.h │ ├── DimensionAccess.h │ ├── DimensionAccessAdd.h │ ├── DimensionAccessConstant.h │ ├── DimensionAccessDimension.h │ ├── DimensionAccessDiv.h │ ├── DimensionAccessIndices.h │ ├── DimensionAccessMul.h │ ├── DimensionAccessRange.h │ ├── DimensionAccessSub.h │ ├── Dumpable.h │ ├── Graph.h │ ├── GraphDumper.h │ ├── IndexSet.h │ ├── LocalMatchingSolutions.h │ ├── LocalMatchingSolutionsImpl.h │ ├── LocalMatchingSolutionsMCIM.h │ ├── LocalMatchingSolutionsVAF.h │ ├── MCIM.h │ ├── MCIMGroup.h │ ├── MCIMGroupAffineConstant.h │ ├── MCIMGroupEmpty.h │ ├── MCIMGroupGeneric.h │ ├── Matching.h │ ├── MultidimensionalRange.h │ ├── Point.h │ ├── RTree.h │ ├── Range.h │ ├── SCC.h │ ├── SCCsDependencyGraph.h │ ├── ScalarEquationsDependencyGraph.h │ ├── Scheduling.h │ ├── SingleEntryDigraph.h │ ├── SingleEntryWeaklyConnectedDigraph.h │ └── TreeOStream.h │ ├── Parser │ ├── FloatLexer.h │ ├── IntegerLexer.h │ ├── Lexer.h │ ├── Location.h │ ├── ModelicaStateMachine.h │ ├── Parser.h │ └── Token.h │ └── VariableFilter │ ├── AST.h │ ├── Filter.h │ ├── LexerStateMachine.h │ ├── Parser.h │ ├── Range.h │ ├── Token.h │ ├── Tracker.h │ └── VariableFilter.h ├── lib ├── AST │ ├── CMakeLists.txt │ └── Node │ │ ├── ASTNode.cpp │ │ ├── Algorithm.cpp │ │ ├── Annotation.cpp │ │ ├── ArrayConstant.cpp │ │ ├── ArrayDimension.cpp │ │ ├── ArrayForGenerator.cpp │ │ ├── ArrayGenerator.cpp │ │ ├── AssignmentStatement.cpp │ │ ├── BreakStatement.cpp │ │ ├── Call.cpp │ │ ├── CallStatement.cpp │ │ ├── Class.cpp │ │ ├── ComponentReference.cpp │ │ ├── ComponentReferenceEntry.cpp │ │ ├── Constant.cpp │ │ ├── EqualityEquation.cpp │ │ ├── Equation.cpp │ │ ├── EquationSection.cpp │ │ ├── Expression.cpp │ │ ├── ExpressionFunctionArgument.cpp │ │ ├── ForEquation.cpp │ │ ├── ForIndex.cpp │ │ ├── ForStatement.cpp │ │ ├── Function.cpp │ │ ├── FunctionArgument.cpp │ │ ├── IfEquation.cpp │ │ ├── IfStatement.cpp │ │ ├── Member.cpp │ │ ├── Model.cpp │ │ ├── Modification.cpp │ │ ├── NamedFunctionArgument.cpp │ │ ├── Operation.cpp │ │ ├── Package.cpp │ │ ├── Record.cpp │ │ ├── Reduction.cpp │ │ ├── ReductionFunctionArgument.cpp │ │ ├── ReturnStatement.cpp │ │ ├── Root.cpp │ │ ├── Statement.cpp │ │ ├── StatementsBlock.cpp │ │ ├── Subscript.cpp │ │ ├── Tuple.cpp │ │ ├── Type.cpp │ │ ├── TypePrefix.cpp │ │ ├── WhenEquation.cpp │ │ ├── WhenStatement.cpp │ │ └── WhileStatement.cpp ├── CMakeLists.txt ├── Codegen │ ├── CMakeLists.txt │ ├── Conversion │ │ ├── AllToLLVM │ │ │ ├── AllToLLVM.cpp │ │ │ └── CMakeLists.txt │ │ ├── BaseModelicaCommon │ │ │ ├── CMakeLists.txt │ │ │ ├── LLVMTypeConverter.cpp │ │ │ └── TypeConverter.cpp │ │ ├── BaseModelicaToArith │ │ │ ├── BaseModelicaToArith.cpp │ │ │ └── CMakeLists.txt │ │ ├── BaseModelicaToCF │ │ │ ├── BaseModelicaToCF.cpp │ │ │ └── CMakeLists.txt │ │ ├── BaseModelicaToFunc │ │ │ ├── BaseModelicaToFunc.cpp │ │ │ └── CMakeLists.txt │ │ ├── BaseModelicaToLLVM │ │ │ ├── BaseModelicaToLLVM.cpp │ │ │ └── CMakeLists.txt │ │ ├── BaseModelicaToLinalg │ │ │ ├── BaseModelicaToLinalg.cpp │ │ │ └── CMakeLists.txt │ │ ├── BaseModelicaToMLIRCore │ │ │ ├── BaseModelicaToMLIRCore.cpp │ │ │ └── CMakeLists.txt │ │ ├── BaseModelicaToMemRef │ │ │ ├── BaseModelicaToMemRef.cpp │ │ │ └── CMakeLists.txt │ │ ├── BaseModelicaToRuntime │ │ │ ├── BaseModelicaToRuntime.cpp │ │ │ └── CMakeLists.txt │ │ ├── BaseModelicaToRuntimeCall │ │ │ ├── BaseModelicaToRuntimeCall.cpp │ │ │ └── CMakeLists.txt │ │ ├── BaseModelicaToTensor │ │ │ ├── BaseModelicaToTensor.cpp │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── IDACommon │ │ │ ├── CMakeLists.txt │ │ │ └── LLVMTypeConverter.cpp │ │ ├── IDAToFunc │ │ │ ├── CMakeLists.txt │ │ │ └── IDAToFunc.cpp │ │ ├── IDAToLLVM │ │ │ ├── CMakeLists.txt │ │ │ └── IDAToLLVM.cpp │ │ ├── KINSOLCommon │ │ │ ├── CMakeLists.txt │ │ │ └── LLVMTypeConverter.cpp │ │ ├── KINSOLToFunc │ │ │ ├── CMakeLists.txt │ │ │ └── KINSOLToFunc.cpp │ │ ├── KINSOLToLLVM │ │ │ ├── CMakeLists.txt │ │ │ └── KINSOLToLLVM.cpp │ │ ├── RuntimeModelMetadataConversion │ │ │ ├── CMakeLists.txt │ │ │ └── RuntimeModelMetadataConversion.cpp │ │ ├── RuntimeToFunc │ │ │ ├── CMakeLists.txt │ │ │ └── RuntimeToFunc.cpp │ │ ├── RuntimeToLLVM │ │ │ ├── CMakeLists.txt │ │ │ ├── LLVMTypeConverter.cpp │ │ │ └── RuntimeToLLVM.cpp │ │ └── SUNDIALSToFunc │ │ │ ├── CMakeLists.txt │ │ │ └── SUNDIALSToFunc.cpp │ ├── Lowering │ │ ├── AlgorithmLowerer.cpp │ │ ├── ArrayGeneratorLowerer.cpp │ │ ├── AssignmentStatementLowerer.cpp │ │ ├── BreakStatementLowerer.cpp │ │ ├── Bridge.cpp │ │ ├── CMakeLists.txt │ │ ├── CallLowerer.cpp │ │ ├── CallStatementLowerer.cpp │ │ ├── ClassDependencyGraph.cpp │ │ ├── ClassLowerer.cpp │ │ ├── ClassPath.cpp │ │ ├── ComponentReferenceLowerer.cpp │ │ ├── ConstantLowerer.cpp │ │ ├── Distance │ │ │ ├── CMakeLists.txt │ │ │ ├── DatabaseReader.cpp │ │ │ ├── EditDistance.cpp │ │ │ ├── SentenceDistanceCalculator.cpp │ │ │ ├── WordDistanceCalculator.cpp │ │ │ └── install-db.py │ │ ├── EqualityEquationLowerer.cpp │ │ ├── EquationLowerer.cpp │ │ ├── EquationSectionLowerer.cpp │ │ ├── ExpressionLowerer.cpp │ │ ├── ForEquationLowerer.cpp │ │ ├── ForStatementLowerer.cpp │ │ ├── IdentifierError.cpp │ │ ├── IfEquationLowerer.cpp │ │ ├── IfStatementLowerer.cpp │ │ ├── Lowerer.cpp │ │ ├── LoweringContext.cpp │ │ ├── ModelLowerer.cpp │ │ ├── OperationLowerer.cpp │ │ ├── PackageLowerer.cpp │ │ ├── PartialDerFunctionLowerer.cpp │ │ ├── RecordLowerer.cpp │ │ ├── Reference.cpp │ │ ├── Results.cpp │ │ ├── ReturnStatementLowerer.cpp │ │ ├── StandardFunctionLowerer.cpp │ │ ├── StatementLowerer.cpp │ │ ├── SubscriptLowerer.cpp │ │ ├── TupleLowerer.cpp │ │ ├── VariablesSymbolTable.cpp │ │ ├── WhenEquationLowerer.cpp │ │ ├── WhenStatementLowerer.cpp │ │ └── WhileStatementLowerer.cpp │ ├── Runtime.cpp │ └── Verifier.cpp ├── Dialect │ ├── BaseModelica │ │ ├── Analysis │ │ │ ├── CMakeLists.txt │ │ │ └── VariableAccessAnalysis.cpp │ │ ├── CMakeLists.txt │ │ ├── IR │ │ │ ├── AttrInterfaces.cpp │ │ │ ├── Attributes.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── DefaultValuesDependencyGraph.cpp │ │ │ ├── DerivativesMap.cpp │ │ │ ├── Dialect.cpp │ │ │ ├── Enums.cpp │ │ │ ├── EquationPath.cpp │ │ │ ├── ExpressionPath.cpp │ │ │ ├── OpInterfaces.cpp │ │ │ ├── Ops.cpp │ │ │ ├── Properties.cpp │ │ │ ├── TypeInterfaces.cpp │ │ │ ├── Types.cpp │ │ │ ├── VariableAccess.cpp │ │ │ ├── VariablesDependencyGraph.cpp │ │ │ └── VariablesDimensionsDependencyGraph.cpp │ │ └── Transforms │ │ │ ├── AccessReplacementTest.cpp │ │ │ ├── AllInterfaces.cpp │ │ │ ├── AllocationOpInterfaceImpl.cpp │ │ │ ├── AutomaticDifferentiation │ │ │ ├── AutomaticDifferentiation.cpp │ │ │ └── ForwardAD.cpp │ │ │ ├── BindingEquationConversion.cpp │ │ │ ├── BufferizableOpInterfaceImpl.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── CallCSE.cpp │ │ │ ├── ConstantMaterializableTypeInterfaceImpl.cpp │ │ │ ├── DerivableOpInterfaceImpl.cpp │ │ │ ├── DerivableTypeInterfaceImpl.cpp │ │ │ ├── DerivativeChainRule.cpp │ │ │ ├── DerivativesAllocation.cpp │ │ │ ├── DerivativesInitialization.cpp │ │ │ ├── EquationAccessSplit.cpp │ │ │ ├── EquationExplicitation.cpp │ │ │ ├── EquationExplicitationTest.cpp │ │ │ ├── EquationExpressionOpInterfaceImpl.cpp │ │ │ ├── EquationFunctionLoopHoisting.cpp │ │ │ ├── EquationInductionsExplicitation.cpp │ │ │ ├── EquationSidesSplit.cpp │ │ │ ├── EquationTemplatesCreation.cpp │ │ │ ├── EulerForward.cpp │ │ │ ├── ExplicitCastInsertion.cpp │ │ │ ├── ExplicitInitialEquationsInsertion.cpp │ │ │ ├── ExplicitStartValueInsertion.cpp │ │ │ ├── FunctionDefaultValuesConversion.cpp │ │ │ ├── FunctionScalarization.cpp │ │ │ ├── FunctionUnwrap.cpp │ │ │ ├── IDA.cpp │ │ │ ├── InitialConditionsSolving.cpp │ │ │ ├── InliningAttributeInsertion.cpp │ │ │ ├── InvertibleOpInterfaceImpl.cpp │ │ │ ├── Matching.cpp │ │ │ ├── ModelAlgorithmConversion.cpp │ │ │ ├── ModelDebugCanonicalization.cpp │ │ │ ├── Modeling │ │ │ ├── Bridge.cpp │ │ │ ├── EquationBridge.cpp │ │ │ ├── SCCBridge.cpp │ │ │ └── VariableBridge.cpp │ │ │ ├── OpDistribution.cpp │ │ │ ├── Passes.cpp │ │ │ ├── PrintModelInfo.cpp │ │ │ ├── PureFunctionInlining.cpp │ │ │ ├── RangeBoundariesInference.cpp │ │ │ ├── ReadOnlyVariablesPropagation.cpp │ │ │ ├── RecordInlining.cpp │ │ │ ├── RungeKutta.cpp │ │ │ ├── RuntimeVerifiableOpInterfaceImpl.cpp │ │ │ ├── SCCAbsenceVerification.cpp │ │ │ ├── SCCDetection.cpp │ │ │ ├── SCCSolvingBySubstitution.cpp │ │ │ ├── SCCSolvingWithKINSOL.cpp │ │ │ ├── ScalarRangesEquationSplit.cpp │ │ │ ├── ScheduleParallelization.cpp │ │ │ ├── SchedulersInstantiation.cpp │ │ │ ├── Scheduling.cpp │ │ │ ├── SingleValuedInductionElimination.cpp │ │ │ ├── Solvers │ │ │ └── SUNDIALS.cpp │ │ │ ├── VariablesPromotion.cpp │ │ │ ├── VariablesPruning.cpp │ │ │ ├── VectorizableOpInterfaceImpl.cpp │ │ │ └── ViewAccessFolding.cpp │ ├── CMakeLists.txt │ ├── IDA │ │ ├── CMakeLists.txt │ │ └── IR │ │ │ ├── Attributes.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── IDA.cpp │ │ │ ├── Ops.cpp │ │ │ └── Types.cpp │ ├── KINSOL │ │ ├── CMakeLists.txt │ │ └── IR │ │ │ ├── Attributes.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── KINSOL.cpp │ │ │ ├── Ops.cpp │ │ │ └── Types.cpp │ ├── Modeling │ │ ├── CMakeLists.txt │ │ └── IR │ │ │ ├── Attributes.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── Modeling.cpp │ │ │ ├── Ops.cpp │ │ │ └── Properties.cpp │ ├── Runtime │ │ ├── CMakeLists.txt │ │ ├── IR │ │ │ ├── Attributes.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── Ops.cpp │ │ │ ├── Properties.cpp │ │ │ ├── Runtime.cpp │ │ │ └── Types.cpp │ │ └── Transforms │ │ │ ├── AllInterfaces.cpp │ │ │ ├── BufferizableOpInterfaceImpl.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── HeapFunctionsReplacement.cpp │ │ │ └── Passes.cpp │ └── SUNDIALS │ │ ├── CMakeLists.txt │ │ └── IR │ │ ├── Attributes.cpp │ │ ├── CMakeLists.txt │ │ ├── Ops.cpp │ │ ├── SUNDIALS.cpp │ │ └── Types.cpp ├── Frontend │ ├── CMakeLists.txt │ ├── CompilerInstance.cpp │ ├── CompilerInvocation.cpp │ ├── DiagnosticHandler.cpp │ ├── ExecuteCompilerInvocation.cpp │ ├── FrontendAction.cpp │ ├── FrontendActions.cpp │ ├── FrontendOptions.cpp │ ├── Instrumentation │ │ └── VerificationModelEmitter.cpp │ ├── LanguageOptions.cpp │ └── SimulationOptions.cpp ├── IO │ ├── CMakeLists.txt │ ├── Command.cpp │ └── InputFile.cpp ├── JIT │ ├── CMakeLists.txt │ └── EngineBuilder.cpp ├── Modeling │ ├── AccessFunction.cpp │ ├── AccessFunctionAffineConstant.cpp │ ├── AccessFunctionAffineMap.cpp │ ├── AccessFunctionConstant.cpp │ ├── AccessFunctionEmpty.cpp │ ├── AccessFunctionGeneric.cpp │ ├── AccessFunctionRotoTranslation.cpp │ ├── ArrayEquationsDependencyGraph.cpp │ ├── ArrayVariablesDependencyGraph.cpp │ ├── CMakeLists.txt │ ├── Dependency.cpp │ ├── DimensionAccess.cpp │ ├── DimensionAccessAdd.cpp │ ├── DimensionAccessConstant.cpp │ ├── DimensionAccessDimension.cpp │ ├── DimensionAccessDiv.cpp │ ├── DimensionAccessIndices.cpp │ ├── DimensionAccessMul.cpp │ ├── DimensionAccessRange.cpp │ ├── DimensionAccessSub.cpp │ ├── Dumpable.cpp │ ├── Graph.cpp │ ├── IndexSet.cpp │ ├── LocalMatchingSolutions.cpp │ ├── LocalMatchingSolutionsMCIM.cpp │ ├── LocalMatchingSolutionsVAF.cpp │ ├── MCIM.cpp │ ├── MCIMGroup.cpp │ ├── MCIMGroupAffineConstant.cpp │ ├── MCIMGroupEmpty.cpp │ ├── MCIMGroupGeneric.cpp │ ├── Matching.cpp │ ├── MultidimensionalRange.cpp │ ├── Point.cpp │ ├── RTree.cpp │ ├── Range.cpp │ ├── SCC.cpp │ ├── SCCsDependencyGraph.cpp │ ├── ScalarEquationsDependencyGraph.cpp │ ├── Scheduling.cpp │ ├── SingleEntryDigraph.cpp │ └── SingleEntryWeaklyConnectedDigraph.cpp ├── Parser │ ├── CMakeLists.txt │ ├── Location.cpp │ ├── ModelicaStateMachine.cpp │ ├── Parser.cpp │ └── Token.cpp └── VariableFilter │ ├── AST.cpp │ ├── CMakeLists.txt │ ├── Filter.cpp │ ├── LexerStateMachine.cpp │ ├── Parser.cpp │ ├── Range.cpp │ ├── Token.cpp │ ├── Tracker.cpp │ └── VariableFilter.cpp ├── test ├── CMakeLists.txt ├── Codegen │ ├── Conversion │ │ ├── BaseModelicaToArith │ │ │ ├── add.mlir │ │ │ ├── and.mlir │ │ │ ├── cast.mlir │ │ │ ├── constant.mlir │ │ │ ├── div.mlir │ │ │ ├── eq.mlir │ │ │ ├── gt.mlir │ │ │ ├── gte.mlir │ │ │ ├── lt.mlir │ │ │ ├── lte.mlir │ │ │ ├── mul.mlir │ │ │ ├── neg.mlir │ │ │ ├── neq.mlir │ │ │ ├── not.mlir │ │ │ ├── or.mlir │ │ │ ├── range_size.mlir │ │ │ ├── reduction.mlir │ │ │ ├── select.mlir │ │ │ └── sub.mlir │ │ ├── BaseModelicaToCF │ │ │ ├── break.mlir │ │ │ ├── for.mlir │ │ │ ├── function-input-variable.mlir │ │ │ ├── function-output-variable.mlir │ │ │ ├── function-protected-variable.mlir │ │ │ ├── if.mlir │ │ │ ├── return.mlir │ │ │ └── while.mlir │ │ ├── BaseModelicaToFunc │ │ │ ├── call.mlir │ │ │ ├── raw_function.mlir │ │ │ └── raw_variable.mlir │ │ ├── BaseModelicaToLLVM │ │ │ ├── range.mlir │ │ │ ├── range_begin.mlir │ │ │ ├── range_end.mlir │ │ │ └── range_step.mlir │ │ ├── BaseModelicaToLinalg │ │ │ ├── abs.mlir │ │ │ ├── acos.mlir │ │ │ ├── add.mlir │ │ │ ├── add_ew.mlir │ │ │ ├── and.mlir │ │ │ ├── asin.mlir │ │ │ ├── atan.mlir │ │ │ ├── atan2.mlir │ │ │ ├── ceil.mlir │ │ │ ├── cos.mlir │ │ │ ├── cosh.mlir │ │ │ ├── div_ew.mlir │ │ │ ├── exp.mlir │ │ │ ├── floor.mlir │ │ │ ├── integer.mlir │ │ │ ├── log.mlir │ │ │ ├── log10.mlir │ │ │ ├── mul.mlir │ │ │ ├── mul_ew.mlir │ │ │ ├── not.mlir │ │ │ ├── or.mlir │ │ │ ├── pow.mlir │ │ │ ├── sign.mlir │ │ │ ├── sin.mlir │ │ │ ├── sinh.mlir │ │ │ ├── sqrt.mlir │ │ │ ├── sub.mlir │ │ │ ├── sub_ew.mlir │ │ │ ├── tan.mlir │ │ │ ├── tanh.mlir │ │ │ └── transpose.mlir │ │ ├── BaseModelicaToMemRef │ │ │ ├── alloc.mlir │ │ │ ├── alloca.mlir │ │ │ ├── array_broadcast.mlir │ │ │ ├── array_copy.mlir │ │ │ ├── array_fill.mlir │ │ │ ├── array_from_elements.mlir │ │ │ ├── constant.mlir │ │ │ ├── dim.mlir │ │ │ ├── free.mlir │ │ │ └── subscription.mlir │ │ ├── BaseModelicaToRuntime │ │ │ ├── deinit-function.mlir │ │ │ ├── global-variables.mlir │ │ │ ├── init-function.mlir │ │ │ ├── model-name.mlir │ │ │ ├── number-of-variables.mlir │ │ │ ├── time-getter.mlir │ │ │ ├── time-setter.mlir │ │ │ ├── variable-getters.mlir │ │ │ ├── variable-names.mlir │ │ │ └── variable-printable-indices.mlir │ │ ├── BaseModelicaToRuntimeCall │ │ │ ├── acos.mlir │ │ │ ├── asin.mlir │ │ │ ├── assert.mlir │ │ │ ├── atan.mlir │ │ │ ├── atan2.mlir │ │ │ ├── ceil.mlir │ │ │ ├── cos.mlir │ │ │ ├── cosh.mlir │ │ │ ├── diagonal.mlir │ │ │ ├── div_trunc.mlir │ │ │ ├── exp.mlir │ │ │ ├── floor.mlir │ │ │ ├── identity.mlir │ │ │ ├── integer.mlir │ │ │ ├── linspace.mlir │ │ │ ├── log.mlir │ │ │ ├── log10.mlir │ │ │ ├── max.mlir │ │ │ ├── min.mlir │ │ │ ├── mod.mlir │ │ │ ├── ones.mlir │ │ │ ├── pow.mlir │ │ │ ├── print.mlir │ │ │ ├── product.mlir │ │ │ ├── rem.mlir │ │ │ ├── sign.mlir │ │ │ ├── sin.mlir │ │ │ ├── sinh.mlir │ │ │ ├── sqrt.mlir │ │ │ ├── sum.mlir │ │ │ ├── symmetric.mlir │ │ │ ├── tan.mlir │ │ │ ├── tanh.mlir │ │ │ ├── transpose.mlir │ │ │ └── zeros.mlir │ │ ├── BaseModelicaToTensor │ │ │ ├── ndims.mlir │ │ │ ├── size.mlir │ │ │ ├── tensor_broadcast.mlir │ │ │ ├── tensor_extract.mlir │ │ │ ├── tensor_from_elements.mlir │ │ │ ├── tensor_insert_slice.mlir │ │ │ └── tensor_view.mlir │ │ ├── RuntimeModelMetadataConversion │ │ │ ├── derivatives_map.mlir │ │ │ ├── model_name.mlir │ │ │ ├── number_of_variables.mlir │ │ │ ├── printable_indices.mlir │ │ │ ├── variable_getters.mlir │ │ │ ├── variable_names.mlir │ │ │ └── variable_ranks.mlir │ │ ├── RuntimeToFunc │ │ │ ├── deinit_function.mlir │ │ │ ├── dynamic-model-begin.mlir │ │ │ ├── dynamic-model-end.mlir │ │ │ ├── function.mlir │ │ │ ├── ic-model-begin.mlir │ │ │ ├── ic-model-end.mlir │ │ │ ├── init_function.mlir │ │ │ └── variable_getter.mlir │ │ └── RuntimeToLLVM │ │ │ ├── call.mlir │ │ │ └── function.mlir │ └── Lowering │ │ ├── built-in-function │ │ ├── abs.mo │ │ ├── acos.mo │ │ ├── asin.mo │ │ ├── assert.mo │ │ ├── atan.mo │ │ ├── atan2.mo │ │ ├── ceil.mo │ │ ├── cos.mo │ │ ├── cosh.mo │ │ ├── diagonal.mo │ │ ├── div.mo │ │ ├── exp.mo │ │ ├── floor.mo │ │ ├── identity.mo │ │ ├── integer.mo │ │ ├── linspace.mo │ │ ├── log.mo │ │ ├── log10.mo │ │ ├── max-array.mo │ │ ├── max-reduction.mo │ │ ├── max-scalars.mo │ │ ├── min-array.mo │ │ ├── min-reduction.mo │ │ ├── min-scalars.mo │ │ ├── mod.mo │ │ ├── ndims.mo │ │ ├── ones.mo │ │ ├── product-array.mo │ │ ├── product-reduction.mo │ │ ├── rem.mo │ │ ├── sign.mo │ │ ├── sin.mo │ │ ├── sinh.mo │ │ ├── size.mo │ │ ├── sqrt.mo │ │ ├── sum-array.mo │ │ ├── sum-reduction.mo │ │ ├── symmetric.mo │ │ ├── tan.mo │ │ ├── tanh.mo │ │ ├── transpose.mo │ │ └── zeros.mo │ │ ├── component-reference │ │ ├── array-variable.mo │ │ ├── scalar-variable.mo │ │ └── subview.mo │ │ ├── equation │ │ └── inline-if.mo │ │ ├── model │ │ ├── array-variable-record.mo │ │ ├── array-variable-with-binding-equation-arrayconst.mo │ │ ├── array-variable-with-binding-equation-arrayfor.mo │ │ ├── array-variable-with-binding-equation-arraygen.mo │ │ ├── array-variable-with-scalar-start.mo │ │ ├── constant.mo │ │ ├── empty-model.mo │ │ ├── parameter.mo │ │ ├── scalar-variable-record.mo │ │ ├── scalar-variable-with-binding-equation.mo │ │ ├── scalar-variable-with-fixed-start.mo │ │ └── scalar-variable-with-non-fixed-start.mo │ │ ├── operation │ │ ├── add-arrays.mo │ │ ├── add-ew-array-scalar.mo │ │ ├── add-ew-arrays.mo │ │ ├── add-ew-scalar-array.mo │ │ ├── add-ew-scalars.mo │ │ ├── add-scalars.mo │ │ ├── div-array-scalar.mo │ │ ├── div-ew-array-scalar.mo │ │ ├── div-ew-scalar-array.mo │ │ ├── div-ew-scalars.mo │ │ ├── div-scalars.mo │ │ ├── mul-1d-array-2d-array.mo │ │ ├── mul-1d-arrays.mo │ │ ├── mul-2d-array-1d-array.mo │ │ ├── mul-2d-arrays.mo │ │ ├── mul-ew-array-scalar.mo │ │ ├── mul-ew-arrays.mo │ │ ├── mul-ew-scalar-array.mo │ │ ├── mul-ew-scalars.mo │ │ ├── mul-scalar-array.mo │ │ ├── mul-scalars.mo │ │ ├── neg-array.mo │ │ ├── neg-scalar.mo │ │ ├── pow-2d-array-scalar.mo │ │ ├── pow-ew-array-scalar.mo │ │ ├── pow-ew-scalar-array.mo │ │ ├── pow-ew-scalars.mo │ │ ├── pow-scalars.mo │ │ ├── sub-arrays.mo │ │ ├── sub-ew-array-scalar.mo │ │ ├── sub-ew-arrays.mo │ │ ├── sub-ew-scalar-array.mo │ │ ├── sub-ew-scalars.mo │ │ └── sub-scalars.mo │ │ ├── record │ │ ├── array-components.mo │ │ ├── array-variable-get-array-component.mo │ │ ├── array-variable-get-scalar-component.mo │ │ ├── array-variable-get-subscripted-array-component.mo │ │ ├── array-variable-set-array-component.mo │ │ ├── array-variable-set-scalar-component.mo │ │ ├── array-variable-set-subscripted-array-component.mo │ │ ├── array-variable-with-component-start-attribute.mo │ │ ├── empty-record.mo │ │ ├── scalar-components.mo │ │ ├── scalar-variable-get-array-component.mo │ │ ├── scalar-variable-get-scalar-component.mo │ │ ├── scalar-variable-set-array-component.mo │ │ ├── scalar-variable-set-scalar-component.mo │ │ ├── scalar-variable-with-component-start-attribute.mo │ │ ├── subscripted-array-variable-get-array-component.mo │ │ ├── subscripted-array-variable-get-scalar-component.mo │ │ ├── subscripted-array-variable-set-array-component.mo │ │ └── subscripted-array-variable-set-scalar-component.mo │ │ ├── standard-function │ │ ├── assignment.mo │ │ ├── input-member.mo │ │ ├── output-member.mo │ │ └── protected-member.mo │ │ └── statement │ │ ├── if-else-statement.mo │ │ ├── if-elseif-else-statement.mo │ │ ├── if-elseif-statement.mo │ │ └── if-statement.mo ├── Dialect │ ├── BaseModelica │ │ └── Transforms │ │ │ ├── AccessReplacement │ │ │ ├── constant-indices.mlir │ │ │ ├── identity-access.mlir │ │ │ ├── identity-with-offsets-access.mlir │ │ │ ├── rotation-access.mlir │ │ │ ├── rototranslation-access.mlir │ │ │ └── scalar-equation.mlir │ │ │ ├── AutomaticDifferentiation │ │ │ ├── PartialDerivative │ │ │ │ ├── first-order.mlir │ │ │ │ └── second-order.mlir │ │ │ └── TimeDerivative │ │ │ │ ├── first-order.mlir │ │ │ │ └── second-order.mlir │ │ │ ├── BindingEquationConversion │ │ │ ├── parameter.mlir │ │ │ └── variable.mlir │ │ │ ├── CallCSE │ │ │ ├── array-cse-1d.mlir │ │ │ ├── array-cse-2d.mlir │ │ │ ├── array-cse-edge-cases.mlir │ │ │ ├── basic-cse.mlir │ │ │ ├── complex-expression.mlir │ │ │ ├── idempotent-configurations.mlir │ │ │ ├── multiple-calls.mlir │ │ │ ├── multiple-return-values.mlir │ │ │ └── op-with-region.mlir │ │ │ ├── Canonicalization │ │ │ ├── Folding │ │ │ │ ├── built-in-function │ │ │ │ │ ├── abs.mlir │ │ │ │ │ ├── acos.mlir │ │ │ │ │ ├── asin.mlir │ │ │ │ │ ├── atan.mlir │ │ │ │ │ ├── ceil.mlir │ │ │ │ │ ├── cos.mlir │ │ │ │ │ ├── cosh.mlir │ │ │ │ │ ├── div.mlir │ │ │ │ │ ├── exp.mlir │ │ │ │ │ ├── floor.mlir │ │ │ │ │ ├── integer.mlir │ │ │ │ │ ├── log.mlir │ │ │ │ │ ├── log10.mlir │ │ │ │ │ ├── max.mlir │ │ │ │ │ ├── min.mlir │ │ │ │ │ ├── mod.mlir │ │ │ │ │ ├── rem.mlir │ │ │ │ │ ├── sign.mlir │ │ │ │ │ ├── sin.mlir │ │ │ │ │ ├── sinh.mlir │ │ │ │ │ ├── sqrt.mlir │ │ │ │ │ ├── tan.mlir │ │ │ │ │ └── tanh.mlir │ │ │ │ ├── cast.mlir │ │ │ │ ├── comparison │ │ │ │ │ ├── equal.mlir │ │ │ │ │ ├── greater-or-equal.mlir │ │ │ │ │ ├── greater.mlir │ │ │ │ │ ├── less-or-equal.mlir │ │ │ │ │ ├── less.mlir │ │ │ │ │ └── not-equal.mlir │ │ │ │ ├── logic │ │ │ │ │ ├── and.mlir │ │ │ │ │ ├── not.mlir │ │ │ │ │ └── or.mlir │ │ │ │ ├── math │ │ │ │ │ ├── addition.mlir │ │ │ │ │ ├── division.mlir │ │ │ │ │ ├── exponentiation.mlir │ │ │ │ │ ├── multiplication.mlir │ │ │ │ │ ├── negation.mlir │ │ │ │ │ └── subtraction.mlir │ │ │ │ ├── model │ │ │ │ │ └── materialization-scope.mlir │ │ │ │ └── range │ │ │ │ │ ├── range.mlir │ │ │ │ │ ├── range_begin.mlir │ │ │ │ │ ├── range_end.mlir │ │ │ │ │ ├── range_size.mlir │ │ │ │ │ └── range_step.mlir │ │ │ ├── add.mlir │ │ │ ├── dim.mlir │ │ │ ├── load.mlir │ │ │ └── subscription.mlir │ │ │ ├── DerivativeChainRule │ │ │ ├── cos.mlir │ │ │ └── sin.mlir │ │ │ ├── DerivativesInitialization │ │ │ ├── filler-equations.mlir │ │ │ └── start.mlir │ │ │ ├── DerivativesMaterialization │ │ │ ├── algorithm.mlir │ │ │ ├── array-equation.mlir │ │ │ ├── existing-derivatives.mlir │ │ │ ├── initial-algorithm.mlir │ │ │ ├── scalar-equation.mlir │ │ │ └── variable-declaration.mlir │ │ │ ├── EquationAccessSplit │ │ │ ├── array-self-dependency.mlir │ │ │ ├── overlap-with-constant-access.mlir │ │ │ └── overlap-with-different-directions.mlir │ │ │ ├── EquationExplicitation │ │ │ ├── add.mlir │ │ │ ├── forward-scheduling.mlir │ │ │ └── scalar-equations.mlir │ │ │ ├── EquationInductionsExplicitation │ │ │ ├── dynamic-dimensions.mlir │ │ │ └── static-arrays.mlir │ │ │ ├── EquationTemplatesCreation │ │ │ ├── equation.mlir │ │ │ └── for-equation.mlir │ │ │ ├── EulerForward │ │ │ ├── update-non-state-variables.mlir │ │ │ └── update-state-variables.mlir │ │ │ ├── ExplicitInitialEquationsInsertion │ │ │ ├── clone-equation-as-initial-equation.mlir │ │ │ ├── existing-initial-equation.mlir │ │ │ └── fixed-start-ops.mlir │ │ │ ├── ExplicitStartValueInsertion │ │ │ ├── array-variable.mlir │ │ │ └── scalar-variable.mlir │ │ │ ├── FunctionDefaultValuesConversion │ │ │ ├── input-variable.mlir │ │ │ ├── output-variable.mlir │ │ │ └── protected-variable.mlir │ │ │ ├── FunctionScalarization │ │ │ └── function-call.mlir │ │ │ ├── FunctionUnwrap │ │ │ ├── function-in-model.mlir │ │ │ ├── function-in-module.mlir │ │ │ ├── nested-functions.mlir │ │ │ └── recursion.mlir │ │ │ ├── IDA │ │ │ ├── calc-ic.mlir │ │ │ ├── dynamic-model-begin-function.mlir │ │ │ ├── dynamic-model-end-function.mlir │ │ │ ├── get-ida-time.mlir │ │ │ ├── residual-function.mlir │ │ │ ├── update-ida-variables.mlir │ │ │ ├── update-non-ida-variables.mlir │ │ │ ├── variable-getter.mlir │ │ │ └── variable-setter.mlir │ │ │ ├── InliningAttributeInsertion │ │ │ ├── function.mlir │ │ │ └── raw_function.mlir │ │ │ ├── Matching │ │ │ ├── chained-simplifications.mlir │ │ │ ├── indices-split.mlir │ │ │ ├── induction-and-constant-overlap.mlir │ │ │ ├── scalar-equations.mlir │ │ │ ├── test-case-1.mlir │ │ │ ├── test-case-10.mlir │ │ │ ├── test-case-2.mlir │ │ │ ├── test-case-3.mlir │ │ │ ├── test-case-4.mlir │ │ │ ├── test-case-5.mlir │ │ │ ├── test-case-6.mlir │ │ │ ├── test-case-7.mlir │ │ │ ├── test-case-8.mlir │ │ │ └── test-case-9.mlir │ │ │ ├── ModelAlgorithmConversion │ │ │ └── scalar-variables.mlir │ │ │ ├── OneShotBufferize │ │ │ ├── raw_variable.mlir │ │ │ ├── runtime-call.mlir │ │ │ └── runtime-function.mlir │ │ │ ├── OpDistribution │ │ │ ├── division.mlir │ │ │ ├── multiplication.mlir │ │ │ └── negation.mlir │ │ │ ├── PureFunctionInlining │ │ │ ├── array-variables.mlir │ │ │ ├── default-input-value.mlir │ │ │ └── scalar-variables.mlir │ │ │ ├── RangeBoundariesInference │ │ │ └── unbounded_range.mlir │ │ │ ├── ReadOnlyVariablesPropagation │ │ │ ├── array-variable.mlir │ │ │ ├── ignored-variables.mlir │ │ │ └── scalar-variable.mlir │ │ │ ├── RecordInlining │ │ │ ├── call.mlir │ │ │ ├── component-get.mlir │ │ │ ├── default.mlir │ │ │ ├── equation.mlir │ │ │ ├── slicing.mlir │ │ │ ├── start.mlir │ │ │ ├── tensor-broadcast.mlir │ │ │ ├── variable-component-set.mlir │ │ │ ├── variable-set.mlir │ │ │ └── variable.mlir │ │ │ ├── RuntimeVerification │ │ │ ├── acos.mlir │ │ │ ├── asin.mlir │ │ │ ├── dim.mlir │ │ │ ├── div.mlir │ │ │ ├── div_ew.mlir │ │ │ ├── div_trunc.mlir │ │ │ ├── load.mlir │ │ │ ├── log.mlir │ │ │ ├── log10.mlir │ │ │ ├── mod.mlir │ │ │ ├── rem.mlir │ │ │ ├── size.mlir │ │ │ ├── sqrt.mlir │ │ │ ├── store.mlir │ │ │ ├── subscription.mlir │ │ │ ├── tensor_extract.mlir │ │ │ ├── tensor_insert.mlir │ │ │ ├── tensor_insert_slice.mlir │ │ │ └── tensor_view.mlir │ │ │ ├── SCCDetection │ │ │ ├── array-equations.mlir │ │ │ └── scalar-equations.mlir │ │ │ ├── SCCSolvingBySubstitution │ │ │ └── scc-too-big.mlir │ │ │ ├── ScalarRangesEquationSplit │ │ │ ├── matched-equation.mlir │ │ │ ├── mixed.mlir │ │ │ ├── non-scalar-ranges.mlir │ │ │ └── scalar-ranges.mlir │ │ │ ├── ScheduleParallelization │ │ │ ├── dependant-array-equations.mlir │ │ │ └── dependant-scalar-equations.mlir │ │ │ ├── SchedulersInstantiation │ │ │ ├── multiple-schedulers.mlir │ │ │ └── parallel-blocks.mlir │ │ │ ├── Scheduling │ │ │ ├── backward-scheduling.mlir │ │ │ ├── forward-scheduling.mlir │ │ │ ├── scalar-equations.mlir │ │ │ └── start-attributes-with-dependencies.mlir │ │ │ ├── SingleValuedInductionElimination │ │ │ ├── array-equation.mlir │ │ │ └── scalar-equation.mlir │ │ │ ├── VariablesPromotion │ │ │ ├── array-variable.mlir │ │ │ └── scalar-variable.mlir │ │ │ ├── VariablesPruning │ │ │ ├── array-variable.mlir │ │ │ ├── derivative.mlir │ │ │ ├── initial-and-dynamic-equations.mlir │ │ │ ├── initial-equations.mlir │ │ │ ├── multiple-writing-equations.mlir │ │ │ ├── no-output-variables.mlir │ │ │ └── unused-variable.mlir │ │ │ └── inlining.mlir │ └── Simulation │ │ └── Transforms │ │ └── HeapFunctionsReplacement │ │ ├── free.mlir │ │ ├── malloc.mlir │ │ └── realloc.mlir ├── Driver │ ├── emit-assembly.mlir │ ├── emit-assembly.mo │ ├── emit-ast.mo │ ├── emit-llvm.mlir │ ├── emit-llvm.mo │ ├── emit-mlir-llvm.mlir │ ├── emit-mlir-llvm.mo │ ├── emit-mlir-modelica.mlir │ └── emit-mlir-modelica.mo ├── Frontend │ ├── Actions │ │ ├── emit-assembly.mlir │ │ ├── emit-assembly.mo │ │ ├── emit-ast.mo │ │ ├── emit-llvm.mlir │ │ ├── emit-llvm.mo │ │ ├── emit-mlir-llvm.mlir │ │ ├── emit-mlir-llvm.mo │ │ ├── emit-mlir-modelica.mlir │ │ └── emit-mlir-modelica.mo │ ├── codegen-options │ │ ├── assertions.test │ │ ├── cse.test │ │ ├── debug.test │ │ ├── inlining.test │ │ ├── omp.test │ │ ├── optimization.test │ │ ├── output-arrays-promotion.test │ │ └── read-only-variables-propagation.test │ └── simulation-options │ │ └── solver.test ├── Integration │ └── OMC │ │ ├── lit.local.cfg │ │ ├── no-extra-args.mo │ │ └── no-scalarize.mo ├── ParserError │ ├── calls │ │ ├── function_builtin.mo │ │ ├── function_custom.mo │ │ └── function_custom_scope.mo │ ├── fields │ │ ├── field_assignment.mo │ │ └── field_scope.mo │ ├── fixed_property.mo │ ├── num_arguments │ │ ├── abs.mo │ │ ├── acos.mo │ │ ├── asin.mo │ │ ├── atan.mo │ │ ├── atan2.mo │ │ ├── ceil.mo │ │ ├── cos.mo │ │ ├── cosh.mo │ │ ├── custom_function.mo │ │ ├── diagonal.mo │ │ ├── div.mo │ │ ├── exp.mo │ │ ├── floor.mo │ │ ├── identity.mo │ │ ├── integer.mo │ │ ├── linspace.mo │ │ ├── log.mo │ │ ├── log10.mo │ │ ├── max.mo │ │ ├── min.mo │ │ ├── mod.mo │ │ ├── ndims.mo │ │ ├── ones.mo │ │ ├── product.mo │ │ ├── rem.mo │ │ ├── sign.mo │ │ ├── sin.mo │ │ ├── sinh.mo │ │ ├── size.mo │ │ ├── size_2.mo │ │ ├── sqrt.mo │ │ ├── sum.mo │ │ ├── symmetric.mo │ │ ├── tan.mo │ │ ├── tanh.mo │ │ ├── transpose.mo │ │ └── zeros.mo │ ├── types_classes │ │ ├── class_custom.mo │ │ ├── class_custom_scope.mo │ │ └── type_builtin.mo │ └── variables │ │ ├── function_argument.mo │ │ ├── if_statement.mo │ │ ├── loop.mo │ │ ├── loop_index.mo │ │ ├── model_attribute.mo │ │ ├── record_attribute.mo │ │ ├── variable_scope.mo │ │ └── variable_simple.mo ├── Simulation │ ├── euler-forward │ │ ├── accesses-depending-on-indices.mo │ │ ├── algorithm-inside-model.mo │ │ ├── cycle-with-array-and-scalar-equations.mo │ │ ├── cycle-with-bifurcation.mo │ │ ├── cycle-with-derivative.mo │ │ ├── cycle-with-multiple-dependencies.mo │ │ ├── cycle-with-scalar-explicit-equations.mo │ │ ├── cycle-with-vectorized-explicit-equations.mo │ │ ├── equation-with-induction-variable-in-expression.mo │ │ ├── function-multiple-results.mo │ │ ├── function-output-should-not-affect-input.mo │ │ ├── inline-if.mo │ │ ├── record-construction.mo │ │ ├── record-inline-function.mo │ │ ├── record-subscripts.mo │ │ ├── simple-first-order.mo │ │ └── time-usage.mo │ ├── ida │ │ ├── array-variables-substitution.mo │ │ ├── cycle-with-all-implicit-equations.mo │ │ ├── cycle-with-implicit-equation.mo │ │ ├── der-function-call.mo │ │ ├── derivative-and-state-same-equation.mo │ │ ├── equation-with-induction-in-expression.mo │ │ ├── function-call.mo │ │ ├── implicit-equation.mo │ │ ├── implicit-kepler.mo │ │ ├── lit.local.cfg │ │ ├── multidimensional-array.mo │ │ ├── no-equations-handled.mo │ │ ├── robertson.mo │ │ ├── scalar-variables-substitution.mo │ │ └── time-usage.mo │ ├── lit.local.cfg │ └── runge-kutta │ │ ├── euler-backward.mo │ │ ├── euler-forward.mo │ │ ├── heun-euler.mo │ │ └── rk4.mo ├── Unit │ ├── lit.cfg.py.backup │ └── lit.site.cfg.py.in.backup ├── lit.cfg.py ├── lit.site.cfg.py.in └── llvm-lit.in ├── tool ├── CMakeLists.txt ├── marco-driver │ ├── CMakeLists.txt │ ├── marco-cc1.cpp │ ├── marco-mc1.cpp │ └── marco.cpp ├── modelica-opt │ ├── CMakeLists.txt │ └── modelica-opt.cpp └── modelica-verifier │ ├── CMakeLists.txt │ └── Verifier.cpp └── unittest ├── AST ├── ArrayTest.cpp ├── CMakeLists.txt ├── ExpressionTest.cpp ├── StatementTest.cpp └── TupleTest.cpp ├── CMakeLists.txt ├── Codegen ├── CMakeLists.txt └── Conversion │ ├── CMakeLists.txt │ └── ModelicaCommon │ ├── CMakeLists.txt │ └── TypeConverterTest.cpp ├── Dialect ├── CMakeLists.txt └── Modelica │ ├── ArrayTypeTest.cpp │ └── CMakeLists.txt ├── Modeling ├── AccessFunctionRotoTranslationTest.cpp ├── AccessFunctionTest.cpp ├── CMakeLists.txt ├── Common.cpp ├── Common.h ├── CyclesTest.cpp ├── DirectedGraphTest.cpp ├── GraphDumperMermaidBackendTest.cpp ├── GraphDumperTest.cpp ├── IndexSetTest.cpp ├── MCIMTest.cpp ├── MultidimensionalRangeTest.cpp ├── PointTest.cpp ├── RTreeTest.cpp ├── RangeTest.cpp ├── SolveLocalMatchingProblemTest.cpp └── UndirectedGraphTest.cpp ├── Parser ├── CMakeLists.txt ├── FloatLexerTest.cpp ├── IntegerLexerTest.cpp ├── LexerTest.cpp └── ParserTest.cpp ├── ParserError ├── CMakeLists.txt └── EditDistanceTest.cpp └── VariableFilter ├── CMakeLists.txt └── VariableFilterTest.cpp /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: LLVM 2 | AlwaysBreakTemplateDeclarations: Yes 3 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.py] 4 | indent_size = 4 5 | 6 | [{CMakeLists.txt,*.cmake}] 7 | indent_size = 4 8 | 9 | [Makefile] 10 | indent_style = tab 11 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @marco-compiler/reviewers 2 | -------------------------------------------------------------------------------- /.github/workflows/pr-labeler.yml: -------------------------------------------------------------------------------- 1 | name: "Pull Request Labeler" 2 | on: 3 | - pull_request_target 4 | 5 | jobs: 6 | labeler: 7 | permissions: 8 | contents: read 9 | pull-requests: write 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/labeler@v5 13 | -------------------------------------------------------------------------------- /.jenkins/install_marco.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -rf marco 4 | git clone https://github.com/marco-compiler/marco.git 5 | cd marco || exit 1 6 | git checkout ${MARCO_COMMIT} 7 | 8 | mkdir build 9 | 10 | cmake \ 11 | -S . \ 12 | -B build \ 13 | -G Ninja \ 14 | -DCMAKE_LINKER_TYPE=MOLD \ 15 | -DCMAKE_BUILD_TYPE=${MARCO_BUILD_TYPE} \ 16 | -DPython3_EXECUTABLE=${PYTHON3_EXECUTABLE} \ 17 | || exit 1 18 | 19 | cmake --build build --target install || exit 1 20 | rm -rf build 21 | -------------------------------------------------------------------------------- /.jenkins/install_marco_runtime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -rf marco-runtime 4 | git clone https://github.com/marco-compiler/marco-runtime.git 5 | cd marco-runtime || exit 1 6 | git checkout ${MARCO_RUNTIME_COMMIT} 7 | 8 | rm -rf build 9 | mkdir build 10 | 11 | cmake \ 12 | -S . -B build -G Ninja \ 13 | -DCMAKE_LINKER_TYPE=MOLD \ 14 | -DCMAKE_BUILD_TYPE=${MARCO_RUNTIME_BUILD_TYPE} \ 15 | -DMARCO_USE_BUILTIN_SUNDIALS=OFF \ 16 | || exit 1 17 | 18 | cmake --build build --target install || exit 1 19 | rm -rf build 20 | -------------------------------------------------------------------------------- /.jenkins/install_openmodelica.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -rf OpenModelica 4 | git clone https://github.com/OpenModelica/OpenModelica.git 5 | cd OpenModelica || exit 1 6 | git checkout ${OPENMODELICA_COMMIT} 7 | git submodule update --force --init --recursive 8 | 9 | rm -rf build 10 | mkdir build 11 | 12 | cmake \ 13 | -S . \ 14 | -B build \ 15 | -G Ninja \ 16 | -DCMAKE_LINKER_TYPE=MOLD \ 17 | -DCMAKE_BUILD_TYPE=Release \ 18 | -DCMAKE_INSTALL_PREFIX=/usr/local \ 19 | -DOM_USE_CCACHE=OFF \ 20 | -DOM_ENABLE_GUI_CLIENTS=OFF \ 21 | || exit 1 22 | 23 | cmake --build build --target install || exit 1 24 | rm -rf build 25 | -------------------------------------------------------------------------------- /.jenkins/package/debian-12/control: -------------------------------------------------------------------------------- 1 | Package: marco 2 | Version: $VERSION 3 | Architecture: amd64 4 | Maintainer: Michele Scuttari 5 | Depends: build-essential 6 | Section: devel 7 | Priority: optional 8 | Homepage: https://marco-compiler.com/ 9 | Description: MARCO Compiler 10 | -------------------------------------------------------------------------------- /.jenkins/package/debian-12/marco-wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Run the driver with the modified arguments. 4 | /usr/lib/marco/marco "$@" -L /usr/lib/marco-runtime -Wl,-rpath /usr/lib/marco-runtime 5 | -------------------------------------------------------------------------------- /.jenkins/prod-image.Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE=marco-compiler/marco-dev-release-debian-12:latest 2 | FROM $BASE_IMAGE 3 | 4 | ARG MARCO_COMMIT=master 5 | ARG PYTHON3_EXECUTABLE=/virtualenv/bin/python 6 | 7 | LABEL org.opencontainers.image.source="https://github.com/marco-compiler/marco" 8 | 9 | # Install MARCO. 10 | COPY ./install_marco.sh /tmp/ 11 | 12 | RUN chmod +x /tmp/install_marco.sh && \ 13 | cd /root && \ 14 | MARCO_BUILD_TYPE=Release \ 15 | /tmp/install_marco.sh 16 | -------------------------------------------------------------------------------- /.jenkins/setup_venv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python3 -m venv /virtualenv 4 | 5 | source /virtualenv/bin/activate 6 | pip install --upgrade pip 7 | pip install lit 8 | -------------------------------------------------------------------------------- /.jenkins/version_llvm.txt: -------------------------------------------------------------------------------- 1 | fd6d4db44467978994de115533dfa4e594265cc3 -------------------------------------------------------------------------------- /.jenkins/version_marco_runtime.txt: -------------------------------------------------------------------------------- 1 | b142d4e374b547313c7c153c628c7887913ec154 -------------------------------------------------------------------------------- /.jenkins/version_openmodelica.txt: -------------------------------------------------------------------------------- 1 | e499b206639233a2e3fb5138bacd9513c500de6c -------------------------------------------------------------------------------- /cmake/modules/CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marco-compiler/marco/213862a3965502bbdae92b7038284cfda3912d8b/cmake/modules/CMakeLists.txt -------------------------------------------------------------------------------- /cmake/modules/MARCOConfig.cmake.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marco-compiler/marco/213862a3965502bbdae92b7038284cfda3912d8b/cmake/modules/MARCOConfig.cmake.in -------------------------------------------------------------------------------- /include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(marco) 2 | -------------------------------------------------------------------------------- /include/marco/AST/Node/Equation.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_AST_NODE_EQUATION_H 2 | #define MARCO_AST_NODE_EQUATION_H 3 | 4 | #include "marco/AST/Node/ASTNode.h" 5 | 6 | namespace marco::ast { 7 | class Equation : public ASTNode { 8 | public: 9 | using ASTNode::ASTNode; 10 | 11 | ~Equation() override; 12 | 13 | static bool classof(const ASTNode *node) { 14 | return node->getKind() >= ASTNode::Kind::Equation && 15 | node->getKind() <= ASTNode::Kind::Equation_LastEquation; 16 | } 17 | }; 18 | } // namespace marco::ast 19 | 20 | #endif // MARCO_AST_NODE_EQUATION_H 21 | -------------------------------------------------------------------------------- /include/marco/AST/Node/Model.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_AST_NODE_MODEL_H 2 | #define MARCO_AST_NODE_MODEL_H 3 | 4 | #include "marco/AST/Node/Class.h" 5 | 6 | namespace marco::ast { 7 | class Model : public Class { 8 | public: 9 | explicit Model(SourceRange location); 10 | 11 | static bool classof(const ASTNode *node) { 12 | return node->getKind() == ASTNode::Kind::Class_Model; 13 | } 14 | 15 | std::unique_ptr clone() const override; 16 | 17 | llvm::json::Value toJSON() const override; 18 | }; 19 | } // namespace marco::ast 20 | 21 | #endif // MARCO_AST_NODE_MODEL_H 22 | -------------------------------------------------------------------------------- /include/marco/AST/Node/Package.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_AST_NODE_PACKAGE_H 2 | #define MARCO_AST_NODE_PACKAGE_H 3 | 4 | #include "marco/AST/Node/Class.h" 5 | 6 | namespace marco::ast { 7 | class Package : public Class { 8 | public: 9 | explicit Package(SourceRange location); 10 | 11 | static bool classof(const ASTNode *node) { 12 | return node->getKind() == ASTNode::Kind::Class_Package; 13 | } 14 | 15 | std::unique_ptr clone() const override; 16 | 17 | llvm::json::Value toJSON() const override; 18 | }; 19 | } // namespace marco::ast 20 | 21 | #endif // MARCO_AST_NODE_PACKAGE_H 22 | -------------------------------------------------------------------------------- /include/marco/AST/Node/Statement.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_AST_NODE_STATEMENT_H 2 | #define MARCO_AST_NODE_STATEMENT_H 3 | 4 | #include "marco/AST/Node/ASTNode.h" 5 | 6 | namespace marco::ast { 7 | class Statement : public ASTNode { 8 | public: 9 | using ASTNode::ASTNode; 10 | 11 | Statement(const Statement &other); 12 | 13 | ~Statement() override; 14 | 15 | static bool classof(const ASTNode *node) { 16 | return node->getKind() >= ASTNode::Kind::Statement && 17 | node->getKind() <= ASTNode::Kind::Statement_LastStatement; 18 | } 19 | }; 20 | } // namespace marco::ast 21 | 22 | #endif // MARCO_AST_NODE_STATEMENT_H 23 | -------------------------------------------------------------------------------- /include/marco/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Dialect) 2 | add_subdirectory(Codegen) 3 | -------------------------------------------------------------------------------- /include/marco/Codegen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Conversion) 2 | add_subdirectory(Transforms) 3 | -------------------------------------------------------------------------------- /include/marco/Codegen/Conversion/AllToLLVM/AllToLLVM.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_CODEGEN_CONVERSION_ALLTOLLVM_ALLTOLLVM_H 2 | #define MARCO_CODEGEN_CONVERSION_ALLTOLLVM_ALLTOLLVM_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir { 7 | #define GEN_PASS_DECL_ALLTOLLVMCONVERSIONPASS 8 | #include "marco/Codegen/Conversion/Passes.h.inc" 9 | 10 | std::unique_ptr createAllToLLVMConversionPass(); 11 | } // namespace mlir 12 | 13 | #endif // MARCO_CODEGEN_CONVERSION_ALLTOLLVM_ALLTOLLVM_H 14 | -------------------------------------------------------------------------------- /include/marco/Codegen/Conversion/BaseModelicaToCF/BaseModelicaToCF.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_CODEGEN_CONVERSION_BASEMODELICATOCF_BASEMODELICATOCF_H 2 | #define MARCO_CODEGEN_CONVERSION_BASEMODELICATOCF_BASEMODELICATOCF_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | #include "llvm/IR/DataLayout.h" 6 | 7 | namespace mlir { 8 | #define GEN_PASS_DECL_BASEMODELICATOCFCONVERSIONPASS 9 | #include "marco/Codegen/Conversion/Passes.h.inc" 10 | 11 | std::unique_ptr createBaseModelicaToCFConversionPass(); 12 | } // namespace mlir 13 | 14 | #endif // MARCO_CODEGEN_CONVERSION_BASEMODELICATOCF_BASEMODELICATOCF_H 15 | -------------------------------------------------------------------------------- /include/marco/Codegen/Conversion/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(LLVM_TARGET_DEFINITIONS Passes.td) 2 | mlir_tablegen(Passes.h.inc -gen-pass-decls -name Conversion) 3 | mlir_tablegen(Passes.capi.h.inc -gen-pass-capi-header --prefix Conversion) 4 | mlir_tablegen(Passes.capi.cpp.inc -gen-pass-capi-impl --prefix Conversion) 5 | add_public_tablegen_target(MARCOConversionPassIncGen) 6 | 7 | add_mlir_doc(Passes ConversionPasses ./ -gen-pass-doc) 8 | -------------------------------------------------------------------------------- /include/marco/Codegen/Transforms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(LLVM_TARGET_DEFINITIONS Passes.td) 2 | mlir_tablegen(Passes.h.inc -gen-pass-decls -name Transforms) 3 | mlir_tablegen(Transforms.capi.h.inc -gen-pass-capi-header --prefix Transforms) 4 | mlir_tablegen(Transforms.capi.cpp.inc -gen-pass-capi-impl --prefix Transforms) 5 | add_public_tablegen_target(MARCOTransformsPassIncGen) 6 | 7 | add_mlir_doc(Passes GeneralPasses ./ -gen-pass-doc) 8 | -------------------------------------------------------------------------------- /include/marco/Codegen/Transforms/Passes.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_CODEGEN_TRANSFORMS_PASSES_H 2 | #define MARCO_CODEGEN_TRANSFORMS_PASSES_H 3 | 4 | namespace marco::codegen { 5 | /// Generate the code for registering passes. 6 | #define GEN_PASS_REGISTRATION 7 | #include "marco/Codegen/Transforms/Passes.h.inc" 8 | } // namespace marco::codegen 9 | 10 | #endif // MARCO_CODEGEN_TRANSFORMS_PASSES_H 11 | -------------------------------------------------------------------------------- /include/marco/Codegen/Transforms/Passes.td: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_CODEGEN_TRANSFORMS_PASSES_TD 2 | #define MARCO_CODEGEN_TRANSFORMS_PASSES_TD 3 | 4 | include "mlir/Pass/PassBase.td" 5 | include "mlir/Rewrite/PassUtil.td" 6 | 7 | #endif // MARCO_CODEGEN_TRANSFORMS_PASSES_TD 8 | -------------------------------------------------------------------------------- /include/marco/Codegen/Verifier.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_CODEGEN_VERIFIER_H 2 | #define MARCO_CODEGEN_VERIFIER_H 3 | 4 | #include "mlir/IR/Verifier.h" 5 | #include "mlir/Pass/Pass.h" 6 | 7 | namespace marco::codegen::lowering { 8 | /// A verification pass to verify the output from the bridge. This provides a 9 | /// little bit of glue to run a verifier pass directly. 10 | class VerifierPass 11 | : public mlir::PassWrapper> { 12 | void runOnOperation() override; 13 | }; 14 | 15 | } // namespace marco::codegen::lowering 16 | 17 | #endif // MARCO_CODEGEN_VERIFIER_H 18 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IR) 2 | add_subdirectory(Transforms) 3 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/IR/AttrInterfaces.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_IR_ATTRINTERFACES_H 2 | #define MARCO_DIALECT_BASEMODELICA_IR_ATTRINTERFACES_H 3 | 4 | #include "mlir/IR/Dialect.h" 5 | 6 | #include "marco/Dialect/BaseModelica/IR/BaseModelicaAttrInterfaces.h.inc" 7 | 8 | #endif // MARCO_DIALECT_BASEMODELICA_IR_ATTRINTERFACES_H 9 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/IR/BaseModelicaEnums.td: -------------------------------------------------------------------------------- 1 | include "mlir/IR/EnumAttr.td" 2 | 3 | def AssertionLevel : I32EnumAttr< 4 | "AssertionLevel", "Assertion level", 5 | [ 6 | I32EnumAttrCase<"Warning", 0, "Warning">, 7 | I32EnumAttrCase<"Error", 1, "Error"> 8 | ]> { 9 | let cppNamespace = "::mlir::bmodelica"; 10 | } 11 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/IR/Common.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_IR_COMMON_H 2 | #define MARCO_DIALECT_BASEMODELICA_IR_COMMON_H 3 | 4 | #include "marco/Dialect/Modeling/IR/Modeling.h" 5 | 6 | namespace mlir::bmodelica { 7 | using Point = ::mlir::modeling::Point; 8 | using Range = ::mlir::modeling::Range; 9 | using MultidimensionalRange = ::mlir::modeling::MultidimensionalRange; 10 | using IndexSet = ::mlir::modeling::IndexSet; 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_IR_COMMON_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/IR/Enums.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_IR_ENUMS_H 2 | #define MARCO_DIALECT_BASEMODELICA_IR_ENUMS_H 3 | 4 | #include "mlir/IR/BuiltinAttributes.h" 5 | 6 | #include "marco/Dialect/BaseModelica/IR/BaseModelicaEnums.h.inc" 7 | 8 | #endif // MARCO_DIALECT_BASEMODELICA_IR_ENUMS_H 9 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/IR/TypeInterfaces.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_IR_TYPEINTERFACES_H 2 | #define MARCO_DIALECT_BASEMODELICA_IR_TYPEINTERFACES_H 3 | 4 | #include "mlir/IR/Dialect.h" 5 | 6 | #include "marco/Dialect/BaseModelica/IR/BaseModelicaTypeInterfaces.h.inc" 7 | 8 | #endif // MARCO_DIALECT_BASEMODELICA_IR_TYPEINTERFACES_H 9 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/AccessReplacementTest.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_ACCESSREPLACEMENTTEST_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_ACCESSREPLACEMENTTEST_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_ACCESSREPLACEMENTTESTPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createAccessReplacementTestPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_ACCESSREPLACEMENTTEST_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/AllInterfaces.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_ALLINTERFACES_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_ALLINTERFACES_H 3 | 4 | namespace mlir { 5 | class DialectRegistry; 6 | 7 | namespace bmodelica { 8 | void registerAllDialectInterfaceImplementations( 9 | mlir::DialectRegistry ®istry); 10 | } 11 | } // namespace mlir 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_ALLINTERFACES_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/AllocationOpInterfaceImpl.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_ALLOCATIONOPINTERFACEIMPL_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_ALLOCATIONOPINTERFACEIMPL_H 3 | 4 | namespace mlir { 5 | class DialectRegistry; 6 | 7 | namespace bmodelica { 8 | void registerAllocationOpInterfaceExternalModels( 9 | mlir::DialectRegistry ®istry); 10 | } 11 | } // namespace mlir 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_ALLOCATIONOPINTERFACEIMPL_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/AutomaticDifferentiation.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_AUTOMATICDIFFERENTIATION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_AUTOMATICDIFFERENTIATION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_AUTOMATICDIFFERENTIATIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createAutomaticDifferentiationPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_AUTOMATICDIFFERENTIATION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/BindingEquationConversion.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_BINDINGEQUATIONCONVERSION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_BINDINGEQUATIONCONVERSION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_BINDINGEQUATIONCONVERSIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createBindingEquationConversionPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_BINDINGEQUATIONCONVERSION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/BufferizableOpInterfaceImpl.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_BUFFERIZABLEOPINTERFACEIMPL_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_BUFFERIZABLEOPINTERFACEIMPL_H 3 | 4 | namespace mlir { 5 | class DialectRegistry; 6 | 7 | namespace bmodelica { 8 | void registerBufferizableOpInterfaceExternalModels( 9 | mlir::DialectRegistry ®istry); 10 | } 11 | } // namespace mlir 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_BUFFERIZABLEOPINTERFACEIMPL_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(LLVM_TARGET_DEFINITIONS Passes.td) 2 | mlir_tablegen(Passes.h.inc -gen-pass-decls -name Modelica) 3 | add_public_tablegen_target(MLIRBaseModelicaTransformsIncGen) 4 | 5 | add_mlir_doc(Passes BaseModelicaPasses Dialects/ -gen-pass-doc) 6 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/CallCSE.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_CALLCSE_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_CALLCSE_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_CALLCSEPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createCallCSEPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_CALLCSE_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/ConstantMaterializableTypeInterfaceImpl.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_CONSTANTMATERIALIZABLETYPEINTERFACEIMPL_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_CONSTANTMATERIALIZABLETYPEINTERFACEIMPL_H 3 | 4 | namespace mlir { 5 | class DialectRegistry; 6 | 7 | namespace bmodelica { 8 | void registerConstantMaterializableTypeInterfaceExternalModels( 9 | mlir::DialectRegistry ®istry); 10 | } 11 | } // namespace mlir 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_CONSTANTMATERIALIZABLETYPEINTERFACEIMPL_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/DerivableOpInterfaceImpl.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVABLEOPINTERFACEIMPL_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVABLEOPINTERFACEIMPL_H 3 | 4 | namespace mlir { 5 | class DialectRegistry; 6 | 7 | namespace bmodelica { 8 | void registerDerivableOpInterfaceExternalModels( 9 | mlir::DialectRegistry ®istry); 10 | } 11 | } // namespace mlir 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVABLEOPINTERFACEIMPL_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/DerivableTypeInterfaceImpl.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVABLETYPEINTERFACEIMPL_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVABLETYPEINTERFACEIMPL_H 3 | 4 | namespace mlir { 5 | class DialectRegistry; 6 | 7 | namespace bmodelica { 8 | void registerDerivableTypeInterfaceExternalModels( 9 | mlir::DialectRegistry ®istry); 10 | } 11 | } // namespace mlir 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVABLETYPEINTERFACEIMPL_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/DerivativeChainRule.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVATIVECHAINRULE_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVATIVECHAINRULE_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_DERIVATIVECHAINRULEPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createDerivativeChainRulePass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVATIVECHAINRULE_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/DerivativesInitialization.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVATIVESINITIALIZATION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVATIVESINITIALIZATION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_DERIVATIVESINITIALIZATIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createDerivativesInitializationPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVATIVESINITIALIZATION_H -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/DerivativesMaterialization.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVATIVESMATERIALIZATION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVATIVESMATERIALIZATION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_DERIVATIVESMATERIALIZATIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createDerivativesMaterializationPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_DERIVATIVESMATERIALIZATION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/EquationAccessSplit.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONACCESSSPLIT_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONACCESSSPLIT_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_EQUATIONACCESSSPLITPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createEquationAccessSplitPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONACCESSSPLIT_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/EquationExplicitation.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONEXPLICITATION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONEXPLICITATION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_EQUATIONEXPLICITATIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createEquationExplicitationPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONEXPLICITATION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/EquationExpressionOpInterfaceImpl.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONEXPRESSIONOPINTERFACEIMPL_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONEXPRESSIONOPINTERFACEIMPL_H 3 | 4 | namespace mlir { 5 | class DialectRegistry; 6 | 7 | namespace bmodelica { 8 | void registerEquationExpressionOpInterfaceExternalModels( 9 | mlir::DialectRegistry ®istry); 10 | } 11 | } // namespace mlir 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONEXPRESSIONOPINTERFACEIMPL_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/EquationFunctionLoopHoisting.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONFUNCTIONLOOPHOISTING_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONFUNCTIONLOOPHOISTING_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_EQUATIONFUNCTIONLOOPHOISTINGPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createEquationFunctionLoopHoistingPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONFUNCTIONLOOPHOISTING_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/EquationSidesSplit.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONSIDESSPLIT_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONSIDESSPLIT_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_EQUATIONSIDESSPLITPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createEquationSidesSplitPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONSIDESSPLIT_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/EquationTemplatesCreation.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONTEMPLATESCREATION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONTEMPLATESCREATION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_EQUATIONTEMPLATESCREATIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createEquationTemplatesCreationPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EQUATIONTEMPLATESCREATION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/ExplicitCastInsertion.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_MDOELICA_TRANSFORMS_EXPLICITCASTINSERTION_H 2 | #define MARCO_DIALECT_MDOELICA_TRANSFORMS_EXPLICITCASTINSERTION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_EXPLICITCASTINSERTIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createExplicitCastInsertionPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_MDOELICA_TRANSFORMS_EXPLICITCASTINSERTION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/ExplicitStartValueInsertion.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EXPLICSTARTVALUEINSERTION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EXPLICSTARTVALUEINSERTION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_EXPLICITSTARTVALUEINSERTIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createExplicitStartValueInsertionPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_EXPLICSTARTVALUEINSERTION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/FunctionUnwrap.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_FUNCTIONUNWRAP_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_FUNCTIONUNWRAP_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_FUNCTIONUNWRAPPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createFunctionUnwrapPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_FUNCTIONUNWRAP_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/IDA.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_IDA_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_IDA_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_IDAPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createIDAPass(); 11 | 12 | std::unique_ptr createIDAPass(const IDAPassOptions &options); 13 | } // namespace mlir::bmodelica 14 | 15 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_IDA_H 16 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/InitialConditionsSolving.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_INITIALCONDITIONSSOLVING_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_INITIALCONDITIONSSOLVING_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_INITIALCONDITIONSSOLVINGPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createInitialConditionsSolvingPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_INITIALCONDITIONSSOLVING_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/InliningAttributeInsertion.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_INLININGATTRIBUTEINSERTION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_INLININGATTRIBUTEINSERTION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_INLININGATTRIBUTEINSERTIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createInliningAttributeInsertionPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_INLININGATTRIBUTEINSERTION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/InvertibleOpInterfaceImpl.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_INVERTIBLEOPINTERFACEIMPL_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_INVERTIBLEOPINTERFACEIMPL_H 3 | 4 | namespace mlir { 5 | class DialectRegistry; 6 | 7 | namespace bmodelica { 8 | void registerInvertibleOpInterfaceExternalModels( 9 | mlir::DialectRegistry ®istry); 10 | } 11 | } // namespace mlir 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_INVERTIBLEOPINTERFACEIMPL_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/ModelAlgorithmConversion.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_MODELALGORITHMCONVERSION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_MODELALGORITHMCONVERSION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_MODELALGORITHMCONVERSIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createModelAlgorithmConversionPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_MODELALGORITHMCONVERSION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/ModelDebugCanonicalization.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_MODELDEBUGCANONICALIZATIONPASS_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_MODELDEBUGCANONICALIZATIONPASS_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_MODELDEBUGCANONICALIZATIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createModelDebugCanonicalizationPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_MODELDEBUGCANONICALIZATIONPASS_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/PrintModelInfo.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_PRINTMODELINFO_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_PRINTMODELINFO_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_PRINTMODELINFOPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createPrintModelInfoPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_PRINTMODELINFO_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/PureFunctionInlining.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_PUREFUNCTIONINLINING_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_PUREFUNCTIONINLINING_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_PUREFUNCTIONINLININGPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createPureFunctionInliningPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_PUREFUNCTIONINLINING_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/RangeBoundariesInference.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_RANGEBOUNDARIESINFERENCE_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_RANGEBOUNDARIESINFERENCE_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_RANGEBOUNDARIESINFERENCEPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createRangeBoundariesInferencePass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_RANGEBOUNDARIESINFERENCE_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/RecordInlining.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_RECORDINLINING_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_RECORDINLINING_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_RECORDINLININGPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createRecordInliningPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_RECORDINLINING_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/RungeKutta.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_RUNGEKUTTA_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_RUNGEKUTTA_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_RUNGEKUTTAPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createRungeKuttaPass(); 11 | 12 | std::unique_ptr 13 | createRungeKuttaPass(const RungeKuttaPassOptions &options); 14 | } // namespace mlir::bmodelica 15 | 16 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_RUNGEKUTTA_H 17 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/RuntimeVerifiableOpInterfaceImpl.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_RUNTIMEVERIFIABLEOPINTERFACEIMPL_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_RUNTIMEVERIFIABLEOPINTERFACEIMPL_H 3 | 4 | namespace mlir { 5 | class DialectRegistry; 6 | 7 | namespace bmodelica { 8 | void registerRuntimeVerifiableOpInterfaceExternalModels( 9 | mlir::DialectRegistry ®istry); 10 | } 11 | } // namespace mlir 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_RUNTIMEVERIFIABLEOPINTERFACEIMPL_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/SCCAbsenceVerification.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCCABSENCEVERIFICATION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCCABSENCEVERIFICATION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_SCCABSENCEVERIFICATIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createSCCAbsenceVerificationPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCCABSENCEVERIFICATION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/SCCDetection.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCCDETECTION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCCDETECTION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_SCCDETECTIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createSCCDetectionPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCCDETECTION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/ScalarRangesEquationSplit.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCALARRANGESEQUATIONSPLIT_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCALARRANGESEQUATIONSPLIT_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_SCALARRANGESEQUATIONSPLITPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createScalarRangesEquationSplitPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCALARRANGESEQUATIONSPLIT_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/SchedulersInstantiation.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCHEDULERSINSTANTIATION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCHEDULERSINSTANTIATION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_SCHEDULERSINSTANTIATIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createSchedulersInstantiationPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCHEDULERSINSTANTIATION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/Scheduling.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCHEDULING_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCHEDULING_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_SCHEDULINGPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | /// Create a pass performing the scheduling process on a matched model. 11 | std::unique_ptr createSchedulingPass(); 12 | } // namespace mlir::bmodelica 13 | 14 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_SCHEDULING_H 15 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/VariablesPromotion.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_VARIABLESPROMOTION_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_VARIABLESPROMOTION_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_VARIABLESPROMOTIONPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createVariablesPromotionPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_VARIABLESPROMOTION_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/VariablesPruning.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_VARIABLESPRUNING_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_VARIABLESPRUNING_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_VARIABLESPRUNINGPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createVariablesPruningPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_VARIABLESPRUNING_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/VectorizableOpInterfaceImpl.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_VECTORIZABLEOPINTERFACEIMPL_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_VECTORIZABLEOPINTERFACEIMPL_H 3 | 4 | namespace mlir { 5 | class DialectRegistry; 6 | 7 | namespace bmodelica { 8 | void registerVectorizableOpInterfaceExternalModels( 9 | mlir::DialectRegistry ®istry); 10 | } 11 | } // namespace mlir 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_VECTORIZABLEOPINTERFACEIMPL_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/BaseModelica/Transforms/ViewAccessFolding.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_BASEMODELICA_TRANSFORMS_VIEWACCESSFOLDING_H 2 | #define MARCO_DIALECT_BASEMODELICA_TRANSFORMS_VIEWACCESSFOLDING_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::bmodelica { 7 | #define GEN_PASS_DECL_VIEWACCESSFOLDINGPASS 8 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createViewAccessFoldingPass(); 11 | } // namespace mlir::bmodelica 12 | 13 | #endif // MARCO_DIALECT_BASEMODELICA_TRANSFORMS_VIEWACCESSFOLDING_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Modeling) 2 | add_subdirectory(SUNDIALS) 3 | add_subdirectory(IDA) 4 | add_subdirectory(KINSOL) 5 | add_subdirectory(BaseModelica) 6 | add_subdirectory(Runtime) 7 | -------------------------------------------------------------------------------- /include/marco/Dialect/IDA/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IR) 2 | -------------------------------------------------------------------------------- /include/marco/Dialect/IDA/IR/IDA.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_IDA_IR_IDA_H 2 | #define MARCO_DIALECT_IDA_IR_IDA_H 3 | 4 | #include "marco/Dialect/IDA/IR/Attributes.h" 5 | #include "marco/Dialect/IDA/IR/Ops.h" 6 | #include "marco/Dialect/IDA/IR/Properties.h" 7 | #include "marco/Dialect/IDA/IR/Types.h" 8 | #include "marco/Dialect/SUNDIALS/IR/SUNDIALS.h" 9 | #include "mlir/IR/Dialect.h" 10 | #include "mlir/Interfaces/SideEffectInterfaces.h" 11 | 12 | #include "marco/Dialect/IDA/IR/IDA.h.inc" 13 | 14 | #endif // MARCO_DIALECT_IDA_IR_IDA_H 15 | -------------------------------------------------------------------------------- /include/marco/Dialect/IDA/IR/Properties.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_IDA_IR_PROPERTIES_H 2 | #define MARCO_DIALECT_IDA_IR_PROPERTIES_H 3 | 4 | #include "marco/Dialect/Modeling/IR/Properties.h" 5 | 6 | namespace mlir::ida { 7 | using Point = ::mlir::modeling::Point; 8 | using Range = ::mlir::modeling::Range; 9 | using MultidimensionalRange = ::mlir::modeling::MultidimensionalRange; 10 | using IndexSet = ::mlir::modeling::IndexSet; 11 | } // namespace mlir::ida 12 | 13 | #endif // MARCO_DIALECT_IDA_IR_PROPERTIES_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/IDA/IR/Types.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_IDA_IR_TYPES_H 2 | #define MARCO_DIALECT_IDA_IR_TYPES_H 3 | 4 | #include "mlir/IR/Types.h" 5 | 6 | #define GET_TYPEDEF_CLASSES 7 | #include "marco/Dialect/IDA/IR/IDATypes.h.inc" 8 | 9 | #endif // MARCO_DIALECT_IDA_IR_TYPES_H 10 | -------------------------------------------------------------------------------- /include/marco/Dialect/KINSOL/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IR) 2 | -------------------------------------------------------------------------------- /include/marco/Dialect/KINSOL/IR/KINSOL.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_KINSOL_IR_KINSOL_H 2 | #define MARCO_DIALECT_KINSOL_IR_KINSOL_H 3 | 4 | #include "marco/Dialect/KINSOL/IR/Ops.h" 5 | #include "marco/Dialect/KINSOL/IR/Properties.h" 6 | #include "marco/Dialect/KINSOL/IR/Types.h" 7 | #include "marco/Dialect/SUNDIALS/IR/SUNDIALS.h" 8 | #include "mlir/IR/Dialect.h" 9 | #include "mlir/Interfaces/SideEffectInterfaces.h" 10 | 11 | #include "marco/Dialect/KINSOL/IR/KINSOL.h.inc" 12 | 13 | #endif // MARCO_DIALECT_KINSOL_IR_KINSOL_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/KINSOL/IR/Properties.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_KINSOL_IR_PROPERTIES_H 2 | #define MARCO_DIALECT_KINSOL_IR_PROPERTIES_H 3 | 4 | #include "marco/Dialect/Modeling/IR/Properties.h" 5 | 6 | namespace mlir::kinsol { 7 | using Point = ::mlir::modeling::Point; 8 | using Range = ::mlir::modeling::Range; 9 | using MultidimensionalRange = ::mlir::modeling::MultidimensionalRange; 10 | using IndexSet = ::mlir::modeling::IndexSet; 11 | } // namespace mlir::kinsol 12 | 13 | #endif // MARCO_DIALECT_KINSOL_IR_PROPERTIES_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/KINSOL/IR/Types.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_KINSOL_IR_TYPES_H 2 | #define MARCO_DIALECT_KINSOL_IR_TYPES_H 3 | 4 | #include "mlir/IR/Types.h" 5 | 6 | #define GET_TYPEDEF_CLASSES 7 | #include "marco/Dialect/KINSOL/IR/KINSOLTypes.h.inc" 8 | 9 | #endif // MARCO_DIALECT_KINSOL_IR_TYPES_H 10 | -------------------------------------------------------------------------------- /include/marco/Dialect/Modeling/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IR) 2 | -------------------------------------------------------------------------------- /include/marco/Dialect/Modeling/IR/IndexSet.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_MODELING_IR_INDEXSET_H 2 | #define MARCO_DIALECT_MODELING_IR_INDEXSET_H 3 | 4 | #include "marco/Modeling/IndexSet.h" 5 | 6 | namespace mlir::modeling { 7 | using IndexSet = ::marco::modeling::IndexSet; 8 | } 9 | 10 | #endif // MARCO_DIALECT_MODELING_IR_INDEXSET_H 11 | -------------------------------------------------------------------------------- /include/marco/Dialect/Modeling/IR/Modeling.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_MODELING_IR_MODELING_H 2 | #define MARCO_DIALECT_MODELING_IR_MODELING_H 3 | 4 | #include "marco/Dialect/Modeling/IR/Attributes.h" 5 | #include "marco/Dialect/Modeling/IR/Ops.h" 6 | #include "marco/Dialect/Modeling/IR/Properties.h" 7 | #include "mlir/IR/Dialect.h" 8 | 9 | #include "marco/Dialect/Modeling/IR/Modeling.h.inc" 10 | 11 | namespace mlir::bmodelica {} 12 | 13 | #endif // MARCO_DIALECT_MODELING_IR_MODELING_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/Modeling/IR/MultidimensionalRange.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_MODELING_IR_MULTIDIMENSIONALRANGE_H 2 | #define MARCO_DIALECT_MODELING_IR_MULTIDIMENSIONALRANGE_H 3 | 4 | #include "marco/Modeling/IndexSet.h" 5 | 6 | namespace mlir::modeling { 7 | using MultidimensionalRange = ::marco::modeling::MultidimensionalRange; 8 | } 9 | 10 | #endif // MARCO_DIALECT_MODELING_IR_MULTIDIMENSIONALRANGE_H 11 | -------------------------------------------------------------------------------- /include/marco/Dialect/Modeling/IR/Point.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_MODELING_IR_POINT_H 2 | #define MARCO_DIALECT_MODELING_IR_POINT_H 3 | 4 | #include "marco/Modeling/IndexSet.h" 5 | 6 | namespace mlir::modeling { 7 | using Point = ::marco::modeling::Point; 8 | } 9 | 10 | #endif // MARCO_DIALECT_MODELING_IR_POINT_H 11 | -------------------------------------------------------------------------------- /include/marco/Dialect/Modeling/IR/Range.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_MODELING_IR_RANGE_H 2 | #define MARCO_DIALECT_MODELING_IR_RANGE_H 3 | 4 | #include "marco/Modeling/IndexSet.h" 5 | 6 | namespace mlir::modeling { 7 | using Range = ::marco::modeling::Range; 8 | } 9 | 10 | #endif // MARCO_DIALECT_MODELING_IR_RANGE_H 11 | -------------------------------------------------------------------------------- /include/marco/Dialect/Runtime/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IR) 2 | add_subdirectory(Transforms) 3 | -------------------------------------------------------------------------------- /include/marco/Dialect/Runtime/IR/Runtime.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_RUNTIME_IR_RUNTIME_H 2 | #define MARCO_DIALECT_RUNTIME_IR_RUNTIME_H 3 | 4 | #include "marco/Dialect/Modeling/IR/Modeling.h" 5 | #include "marco/Dialect/Runtime/IR/Attributes.h" 6 | #include "marco/Dialect/Runtime/IR/Ops.h" 7 | #include "marco/Dialect/Runtime/IR/Properties.h" 8 | #include "marco/Dialect/Runtime/IR/Types.h" 9 | #include "mlir/IR/Dialect.h" 10 | 11 | #include "marco/Dialect/Runtime/IR/Runtime.h.inc" 12 | 13 | #endif // MARCO_DIALECT_RUNTIME_IR_RUNTIME_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/Runtime/IR/Types.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_RUNTIME_IR_TYPES 2 | #define MARCO_DIALECT_RUNTIME_IR_TYPES 3 | 4 | #include "mlir/IR/Types.h" 5 | 6 | #define GET_TYPEDEF_CLASSES 7 | #include "marco/Dialect/Runtime/IR/RuntimeTypes.h.inc" 8 | 9 | #endif // MARCO_DIALECT_RUNTIME_IR_TYPES 10 | -------------------------------------------------------------------------------- /include/marco/Dialect/Runtime/Transforms/AllInterfaces.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_RUNTIME_TRANSFORMS_ALLINTERFACES_H 2 | #define MARCO_DIALECT_RUNTIME_TRANSFORMS_ALLINTERFACES_H 3 | 4 | namespace mlir { 5 | class DialectRegistry; 6 | 7 | namespace runtime { 8 | void registerAllDialectInterfaceImplementations( 9 | mlir::DialectRegistry ®istry); 10 | } 11 | } // namespace mlir 12 | 13 | #endif // MARCO_DIALECT_RUNTIME_TRANSFORMS_ALLINTERFACES_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/Runtime/Transforms/BufferizableOpInterfaceImpl.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_RUNTIME_TRANSFORMS_BUFFERIZABLEOPINTERFACEIMPL_H 2 | #define MARCO_DIALECT_RUNTIME_TRANSFORMS_BUFFERIZABLEOPINTERFACEIMPL_H 3 | 4 | namespace mlir { 5 | class DialectRegistry; 6 | 7 | namespace runtime { 8 | void registerBufferizableOpInterfaceExternalModels( 9 | mlir::DialectRegistry ®istry); 10 | } 11 | } // namespace mlir 12 | 13 | #endif // MARCO_DIALECT_RUNTIME_TRANSFORMS_BUFFERIZABLEOPINTERFACEIMPL_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/Runtime/Transforms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(LLVM_TARGET_DEFINITIONS Passes.td) 2 | mlir_tablegen(Passes.h.inc -gen-pass-decls -name Runtime) 3 | add_public_tablegen_target(MLIRRuntimeTransformsIncGen) 4 | 5 | add_mlir_doc(Passes RuntimePasses Dialects/ -gen-pass-doc) 6 | -------------------------------------------------------------------------------- /include/marco/Dialect/Runtime/Transforms/HeapFunctionsReplacement.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_RUNTIME_TRANSFORMS_HEAPFUNCTIONSREPLACEMENT_H 2 | #define MARCO_DIALECT_RUNTIME_TRANSFORMS_HEAPFUNCTIONSREPLACEMENT_H 3 | 4 | #include "mlir/Pass/Pass.h" 5 | 6 | namespace mlir::runtime { 7 | #define GEN_PASS_DECL_HEAPFUNCTIONSREPLACEMENTPASS 8 | #include "marco/Dialect/Runtime/Transforms/Passes.h.inc" 9 | 10 | std::unique_ptr createHeapFunctionsReplacementPass(); 11 | } // namespace mlir::runtime 12 | 13 | #endif // MARCO_DIALECT_RUNTIME_TRANSFORMS_HEAPFUNCTIONSREPLACEMENT_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/Runtime/Transforms/Passes.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_RUNTIME_TRANSFORMS_PASSES_H 2 | #define MARCO_DIALECT_RUNTIME_TRANSFORMS_PASSES_H 3 | 4 | #include "marco/Dialect/Runtime/Transforms/HeapFunctionsReplacement.h" 5 | 6 | namespace mlir::runtime { 7 | /// Generate the code for registering passes. 8 | #define GEN_PASS_REGISTRATION 9 | #include "marco/Dialect/Runtime/Transforms/Passes.h.inc" 10 | } // namespace mlir::runtime 11 | 12 | #endif // MARCO_DIALECT_RUNTIME_TRANSFORMS_PASSES_H 13 | -------------------------------------------------------------------------------- /include/marco/Dialect/SUNDIALS/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IR) 2 | -------------------------------------------------------------------------------- /include/marco/Dialect/SUNDIALS/IR/Properties.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_SUNDIALS_IR_PROPERTIES_H 2 | #define MARCO_DIALECT_SUNDIALS_IR_PROPERTIES_H 3 | 4 | #include "marco/Dialect/Modeling/IR/Properties.h" 5 | 6 | namespace mlir::sundials { 7 | using Point = ::mlir::modeling::Point; 8 | using Range = ::mlir::modeling::Range; 9 | using MultidimensionalRange = ::mlir::modeling::MultidimensionalRange; 10 | using IndexSet = ::mlir::modeling::IndexSet; 11 | } // namespace mlir::sundials 12 | 13 | #endif // MARCO_DIALECT_SUNDIALS_IR_PROPERTIES_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/SUNDIALS/IR/SUNDIALS.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_SUNDIALS_IR_SUNDIALS_H 2 | #define MARCO_DIALECT_SUNDIALS_IR_SUNDIALS_H 3 | 4 | #include "marco/Dialect/SUNDIALS/IR/Attributes.h" 5 | #include "marco/Dialect/SUNDIALS/IR/Ops.h" 6 | #include "marco/Dialect/SUNDIALS/IR/Properties.h" 7 | #include "marco/Dialect/SUNDIALS/IR/Types.h" 8 | #include "mlir/IR/Dialect.h" 9 | #include "mlir/Interfaces/SideEffectInterfaces.h" 10 | 11 | #include "marco/Dialect/SUNDIALS/IR/SUNDIALS.h.inc" 12 | 13 | #endif // MARCO_DIALECT_SUNDIALS_IR_SUNDIALS_H 14 | -------------------------------------------------------------------------------- /include/marco/Dialect/SUNDIALS/IR/Types.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_DIALECT_SUNDIALS_IR_TYPES_H 2 | #define MARCO_DIALECT_SUNDIALS_IR_TYPES_H 3 | 4 | #include "mlir/IR/Types.h" 5 | 6 | #define GET_TYPEDEF_CLASSES 7 | #include "marco/Dialect/SUNDIALS/IR/SUNDIALSTypes.h.inc" 8 | 9 | #endif // MARCO_DIALECT_SUNDIALS_IR_TYPES_H 10 | -------------------------------------------------------------------------------- /include/marco/Frontend/SimulationOptions.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_FRONTEND_SIMULATIONOPTIONS_H 2 | #define MARCO_FRONTEND_SIMULATIONOPTIONS_H 3 | 4 | #include 5 | 6 | namespace marco::frontend { 7 | struct SimulationOptions { 8 | std::string modelName = ""; 9 | std::string solver = "forwardEuler"; 10 | bool IDAReducedSystem = true; 11 | bool IDAReducedDerivatives = true; 12 | bool IDAJacobianOneSweep = true; 13 | }; 14 | } // namespace marco::frontend 15 | 16 | #endif // MARCO_FRONTEND_SIMULATIONOPTIONS_H 17 | -------------------------------------------------------------------------------- /include/marco/VariableFilter/Range.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_VARIABLEFILTER_RANGE_H 2 | #define MARCO_VARIABLEFILTER_RANGE_H 3 | 4 | namespace marco::vf { 5 | /// Represents an array range. 6 | class Range { 7 | public: 8 | static constexpr long kUnbounded = -1; 9 | 10 | Range(long lowerBound, long upperBound); 11 | 12 | bool hasLowerBound() const; 13 | long getLowerBound() const; 14 | 15 | bool hasUpperBound() const; 16 | long getUpperBound() const; 17 | 18 | private: 19 | long lowerBound, upperBound; 20 | }; 21 | } // namespace marco::vf 22 | 23 | #endif // MARCO_VARIABLEFILTER_RANGE_H 24 | -------------------------------------------------------------------------------- /lib/AST/Node/ArrayGenerator.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/AST/Node/ArrayGenerator.h" 2 | 3 | using namespace ::marco; 4 | using namespace ::marco::ast; 5 | 6 | namespace marco::ast { 7 | ArrayGenerator::~ArrayGenerator() = default; 8 | } // namespace marco::ast 9 | -------------------------------------------------------------------------------- /lib/AST/Node/Equation.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/AST/Node/Equation.h" 2 | 3 | using namespace ::marco; 4 | using namespace ::marco::ast; 5 | 6 | namespace marco::ast { 7 | Equation::~Equation() = default; 8 | } // namespace marco::ast 9 | -------------------------------------------------------------------------------- /lib/AST/Node/Expression.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/AST/Node/Expression.h" 2 | 3 | using namespace ::marco; 4 | using namespace ::marco::ast; 5 | 6 | namespace marco::ast { 7 | Expression::~Expression() = default; 8 | } // namespace marco::ast 9 | -------------------------------------------------------------------------------- /lib/AST/Node/FunctionArgument.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/AST/Node/FunctionArgument.h" 2 | 3 | using namespace ::marco; 4 | using namespace ::marco::ast; 5 | 6 | namespace marco::ast { 7 | FunctionArgument::FunctionArgument(const FunctionArgument &other) = default; 8 | 9 | FunctionArgument::~FunctionArgument() = default; 10 | 11 | void FunctionArgument::addJSONProperties(llvm::json::Object &obj) const { 12 | ASTNode::addJSONProperties(obj); 13 | } 14 | } // namespace marco::ast 15 | -------------------------------------------------------------------------------- /lib/AST/Node/Model.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/AST/Node/Model.h" 2 | 3 | using namespace marco::ast; 4 | 5 | namespace marco::ast { 6 | Model::Model(SourceRange location) 7 | : Class(ASTNode::Kind::Class_Model, std::move(location)) {} 8 | 9 | std::unique_ptr Model::clone() const { 10 | return std::make_unique(*this); 11 | } 12 | 13 | llvm::json::Value Model::toJSON() const { 14 | llvm::json::Object result; 15 | addJSONProperties(result); 16 | return result; 17 | } 18 | } // namespace marco::ast 19 | -------------------------------------------------------------------------------- /lib/AST/Node/Package.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/AST/Node/Package.h" 2 | 3 | using namespace ::marco; 4 | using namespace ::marco::ast; 5 | 6 | namespace marco::ast { 7 | Package::Package(SourceRange location) 8 | : Class(ASTNode::Kind::Class_Package, std::move(location)) {} 9 | 10 | std::unique_ptr Package::clone() const { 11 | return std::make_unique(*this); 12 | } 13 | 14 | llvm::json::Value Package::toJSON() const { 15 | llvm::json::Object result; 16 | addJSONProperties(result); 17 | return result; 18 | } 19 | } // namespace marco::ast 20 | -------------------------------------------------------------------------------- /lib/AST/Node/Statement.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/AST/Node/Statement.h" 2 | 3 | using namespace ::marco; 4 | using namespace ::marco::ast; 5 | 6 | namespace marco::ast { 7 | Statement::Statement(const Statement &other) = default; 8 | 9 | Statement::~Statement() = default; 10 | } // namespace marco::ast 11 | -------------------------------------------------------------------------------- /lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Order matters. 2 | # For example, the dialects library populate the global property 3 | # containing the dialects list. Such property is then used by 4 | # the Codegen and Frontend libraries. 5 | 6 | # The modeling library is designed to be independent. 7 | add_subdirectory(Modeling) 8 | 9 | add_subdirectory(VariableFilter) 10 | add_subdirectory(AST) 11 | add_subdirectory(Parser) 12 | add_subdirectory(Dialect) 13 | add_subdirectory(Codegen) 14 | add_subdirectory(JIT) 15 | add_subdirectory(IO) 16 | add_subdirectory(Frontend) 17 | -------------------------------------------------------------------------------- /lib/Codegen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | Runtime.cpp 3 | Verifier.cpp) 4 | 5 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs}) 9 | 10 | marco_add_library(codegen 11 | ${SOURCES} 12 | 13 | LINK_LIBS PUBLIC 14 | ${MLIR_LIBS}) 15 | 16 | add_subdirectory(Conversion) 17 | add_subdirectory(Lowering) 18 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/AllToLLVM/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | AllToLLVM.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRAllToLLVM 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | marco::codegen 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/BaseModelicaCommon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | LLVMTypeConverter.cpp 3 | TypeConverter.cpp) 4 | 5 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 6 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 7 | 8 | set(MLIR_LIBS 9 | ${dialect_libs} 10 | ${conversion_libs}) 11 | 12 | add_mlir_conversion_library(MLIRBaseModelicaCommonConversion 13 | ${SOURCES} 14 | 15 | DEPENDS 16 | MARCOConversionPassIncGen 17 | 18 | LINK_LIBS PUBLIC 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/BaseModelicaToArith/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | BaseModelicaToArith.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRBaseModelicaToArith 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | MLIRBaseModelicaCommonConversion 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/BaseModelicaToCF/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | BaseModelicaToCF.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRBaseModelicaToCF 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | marco::codegen 19 | MLIRBaseModelicaCommonConversion 20 | ${MLIR_LIBS}) 21 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/BaseModelicaToFunc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | BaseModelicaToFunc.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRBaseModelicaToFunc 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | marco::codegen 19 | MLIRBaseModelicaCommonConversion 20 | MLIRIDAToFunc 21 | ${MLIR_LIBS}) 22 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/BaseModelicaToLLVM/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | BaseModelicaToLLVM.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRBaseModelicaToLLVM 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | MLIRBaseModelicaCommonConversion 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/BaseModelicaToLinalg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | BaseModelicaToLinalg.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRBaseModelicaToLinalg 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | MLIRBaseModelicaCommonConversion 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/BaseModelicaToMLIRCore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | BaseModelicaToMLIRCore.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRTensorLowering 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | MLIRBaseModelicaCommonConversion 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/BaseModelicaToMemRef/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | BaseModelicaToMemRef.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRBaseModelicaToMemRef 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | MLIRBaseModelicaCommonConversion 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/BaseModelicaToRuntime/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | BaseModelicaToRuntime.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRBaseModelicaToRuntime 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | ${MLIR_LIBS} 19 | marco::variableFilter) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/BaseModelicaToRuntimeCall/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | BaseModelicaToRuntimeCall.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRBaseModelicaToRuntimeCall 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | MLIRBaseModelicaCommonConversion 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/BaseModelicaToTensor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | BaseModelicaToTensor.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRBaseModelicaToTensor 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | MLIRBaseModelicaCommonConversion 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/IDACommon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | LLVMTypeConverter.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRIDACommonConversion 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | ${MLIR_LIBS}) 19 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/IDAToFunc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | IDAToFunc.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRIDAToFunc 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | marco::codegen 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/IDAToLLVM/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | IDAToLLVM.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRIDAToLLVM 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | marco::codegen 19 | MLIRIDACommonConversion 20 | MLIRRuntimeToFunc 21 | ${MLIR_LIBS}) 22 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/KINSOLCommon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | LLVMTypeConverter.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRKINSOLCommonConversion 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | ${MLIR_LIBS}) 19 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/KINSOLToFunc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | KINSOLToFunc.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRKINSOLToFunc 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | marco::codegen 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/KINSOLToLLVM/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | KINSOLToLLVM.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRKINSOLToLLVM 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | marco::codegen 19 | MLIRKINSOLCommonConversion 20 | MLIRRuntimeToFunc 21 | ${MLIR_LIBS}) 22 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/RuntimeModelMetadataConversion/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | RuntimeModelMetadataConversion.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRRuntimeModelMetadataConversion 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | marco::codegen 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/RuntimeToFunc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | RuntimeToFunc.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRRuntimeToFunc 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | marco::codegen 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/RuntimeToLLVM/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | LLVMTypeConverter.cpp 3 | RuntimeToLLVM.cpp) 4 | 5 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 6 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 7 | 8 | set(MLIR_LIBS 9 | ${dialect_libs} 10 | ${conversion_libs}) 11 | 12 | add_mlir_conversion_library(MLIRRuntimeToLLVM 13 | ${SOURCES} 14 | 15 | DEPENDS 16 | MARCOConversionPassIncGen 17 | 18 | LINK_LIBS PUBLIC 19 | marco::codegen 20 | ${MLIR_LIBS}) 21 | -------------------------------------------------------------------------------- /lib/Codegen/Conversion/SUNDIALSToFunc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | SUNDIALSToFunc.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 6 | 7 | set(MLIR_LIBS 8 | ${dialect_libs} 9 | ${conversion_libs}) 10 | 11 | add_mlir_conversion_library(MLIRSUNDIALSToFunc 12 | ${SOURCES} 13 | 14 | DEPENDS 15 | MARCOConversionPassIncGen 16 | 17 | LINK_LIBS PUBLIC 18 | marco::codegen 19 | ${MLIR_LIBS}) 20 | -------------------------------------------------------------------------------- /lib/Codegen/Lowering/BreakStatementLowerer.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Codegen/Lowering/BreakStatementLowerer.h" 2 | 3 | using namespace ::marco; 4 | using namespace ::marco::codegen; 5 | using namespace ::mlir::bmodelica; 6 | 7 | namespace marco::codegen::lowering { 8 | BreakStatementLowerer::BreakStatementLowerer(BridgeInterface *bridge) 9 | : Lowerer(bridge) {} 10 | 11 | bool BreakStatementLowerer::lower(const ast::BreakStatement &statement) { 12 | mlir::Location location = loc(statement.getLocation()); 13 | builder().create(location); 14 | return true; 15 | } 16 | } // namespace marco::codegen::lowering 17 | -------------------------------------------------------------------------------- /lib/Codegen/Lowering/CallStatementLowerer.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Codegen/Lowering/CallStatementLowerer.h" 2 | 3 | using namespace ::marco; 4 | using namespace ::marco::codegen; 5 | using namespace ::mlir::bmodelica; 6 | 7 | namespace marco::codegen::lowering { 8 | CallStatementLowerer::CallStatementLowerer(BridgeInterface *bridge) 9 | : Lowerer(bridge) {} 10 | 11 | bool CallStatementLowerer::lower(const ast::CallStatement &statement) { 12 | return static_cast(lower(*statement.getCall())); 13 | } 14 | } // namespace marco::codegen::lowering 15 | -------------------------------------------------------------------------------- /lib/Codegen/Lowering/IfEquationLowerer.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Codegen/Lowering/IfEquationLowerer.h" 2 | 3 | using namespace ::marco; 4 | using namespace ::marco::codegen; 5 | using namespace ::mlir::bmodelica; 6 | 7 | namespace marco::codegen::lowering { 8 | IfEquationLowerer::IfEquationLowerer(BridgeInterface *bridge) 9 | : Lowerer(bridge) {} 10 | 11 | bool IfEquationLowerer::lower(const ast::IfEquation &equation) { 12 | llvm_unreachable("If equation is not implemented yet"); 13 | return false; 14 | } 15 | } // namespace marco::codegen::lowering 16 | -------------------------------------------------------------------------------- /lib/Codegen/Lowering/ReturnStatementLowerer.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Codegen/Lowering/ReturnStatementLowerer.h" 2 | 3 | using namespace ::marco; 4 | using namespace ::marco::codegen; 5 | using namespace ::mlir::bmodelica; 6 | 7 | namespace marco::codegen::lowering { 8 | ReturnStatementLowerer::ReturnStatementLowerer(BridgeInterface *bridge) 9 | : Lowerer(bridge) {} 10 | 11 | bool ReturnStatementLowerer::lower(const ast::ReturnStatement &statement) { 12 | mlir::Location location = loc(statement.getLocation()); 13 | builder().create(location); 14 | return true; 15 | } 16 | } // namespace marco::codegen::lowering 17 | -------------------------------------------------------------------------------- /lib/Codegen/Lowering/WhenEquationLowerer.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Codegen/Lowering/WhenEquationLowerer.h" 2 | 3 | using namespace ::marco; 4 | using namespace ::marco::codegen; 5 | using namespace ::mlir::bmodelica; 6 | 7 | namespace marco::codegen::lowering { 8 | WhenEquationLowerer::WhenEquationLowerer(BridgeInterface *bridge) 9 | : Lowerer(bridge) {} 10 | 11 | bool WhenEquationLowerer::lower(const ast::WhenEquation &equation) { 12 | llvm_unreachable("When equation is not implemented yet"); 13 | return false; 14 | } 15 | } // namespace marco::codegen::lowering 16 | -------------------------------------------------------------------------------- /lib/Codegen/Lowering/WhenStatementLowerer.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Codegen/Lowering/WhenStatementLowerer.h" 2 | 3 | using namespace ::marco; 4 | using namespace ::marco::codegen; 5 | using namespace ::mlir::bmodelica; 6 | 7 | namespace marco::codegen::lowering { 8 | WhenStatementLowerer::WhenStatementLowerer(BridgeInterface *bridge) 9 | : Lowerer(bridge) {} 10 | 11 | bool WhenStatementLowerer::lower(const ast::WhenStatement &statement) { 12 | llvm_unreachable("When statement is not implemented yet"); 13 | return false; 14 | } 15 | } // namespace marco::codegen::lowering 16 | -------------------------------------------------------------------------------- /lib/Codegen/Verifier.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Codegen/Verifier.h" 2 | 3 | namespace marco::codegen::lowering { 4 | void VerifierPass::runOnOperation() { 5 | if (mlir::failed(mlir::verify(getOperation()))) { 6 | signalPassFailure(); 7 | } 8 | 9 | markAllAnalysesPreserved(); 10 | } 11 | } // namespace marco::codegen::lowering 12 | -------------------------------------------------------------------------------- /lib/Dialect/BaseModelica/Analysis/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | VariableAccessAnalysis.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | 6 | set(MLIR_LIBS 7 | ${dialect_libs}) 8 | 9 | add_mlir_dialect_library(MLIRBaseModelicaAnalysis 10 | ${SOURCES} 11 | 12 | LINK_LIBS PUBLIC 13 | marco::modeling 14 | ${MLIR_LIBS}) 15 | -------------------------------------------------------------------------------- /lib/Dialect/BaseModelica/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IR) 2 | add_subdirectory(Analysis) 3 | add_subdirectory(Transforms) 4 | -------------------------------------------------------------------------------- /lib/Dialect/BaseModelica/IR/AttrInterfaces.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/BaseModelica/IR/AttrInterfaces.h" 2 | 3 | #include "marco/Dialect/BaseModelica/IR/BaseModelicaAttrInterfaces.cpp.inc" 4 | -------------------------------------------------------------------------------- /lib/Dialect/BaseModelica/IR/Enums.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/BaseModelica/IR/Enums.h" 2 | #include "marco/Dialect/BaseModelica/IR/BaseModelica.h" 3 | #include "llvm/ADT/StringExtras.h" 4 | 5 | using namespace ::mlir::bmodelica; 6 | using namespace ::mlir::bmodelica::detail; 7 | 8 | //===---------------------------------------------------------------------===// 9 | // Tablegen enums definitions 10 | //===---------------------------------------------------------------------===// 11 | 12 | #include "marco/Dialect/BaseModelica/IR/BaseModelicaEnums.cpp.inc" 13 | -------------------------------------------------------------------------------- /lib/Dialect/BaseModelica/IR/TypeInterfaces.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/BaseModelica/IR/TypeInterfaces.h" 2 | 3 | #include "marco/Dialect/BaseModelica/IR/BaseModelicaTypeInterfaces.cpp.inc" 4 | -------------------------------------------------------------------------------- /lib/Dialect/BaseModelica/Transforms/Modeling/Bridge.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/BaseModelica/Transforms/Modeling/Bridge.h" 2 | 3 | using namespace ::mlir::bmodelica::bridge; 4 | 5 | namespace mlir::bmodelica::bridge { 6 | struct StorageImpl : Storage {}; 7 | 8 | std::unique_ptr Storage::create() { 9 | return std::make_unique(); 10 | } 11 | } // namespace mlir::bmodelica::bridge 12 | -------------------------------------------------------------------------------- /lib/Dialect/BaseModelica/Transforms/Passes.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/BaseModelica/Transforms/Passes.h" 2 | -------------------------------------------------------------------------------- /lib/Dialect/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Modeling) 2 | add_subdirectory(SUNDIALS) 3 | add_subdirectory(IDA) 4 | add_subdirectory(KINSOL) 5 | add_subdirectory(Runtime) 6 | add_subdirectory(BaseModelica) 7 | -------------------------------------------------------------------------------- /lib/Dialect/IDA/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IR) 2 | -------------------------------------------------------------------------------- /lib/Dialect/IDA/IR/Attributes.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/IDA/IR/Attributes.h" 2 | #include "marco/Dialect/IDA/IR/IDA.h" 3 | #include "llvm/ADT/TypeSwitch.h" 4 | 5 | using namespace ::mlir::ida; 6 | 7 | //===---------------------------------------------------------------------===// 8 | // Tablegen attribute definitions 9 | //===---------------------------------------------------------------------===// 10 | 11 | #define GET_ATTRDEF_CLASSES 12 | #include "marco/Dialect/IDA/IR/IDAAttributes.cpp.inc" 13 | -------------------------------------------------------------------------------- /lib/Dialect/IDA/IR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_mlir_dialect_library(MLIRIDA 2 | Attributes.cpp 3 | IDA.cpp 4 | Ops.cpp 5 | Types.cpp 6 | 7 | DEPENDS 8 | MLIRIDAIncGen 9 | 10 | LINK_COMPONENTS 11 | Core 12 | 13 | LINK_LIBS PUBLIC 14 | MLIRIR 15 | MLIRModeling 16 | MLIRSupport 17 | MLIRCallInterfaces 18 | MLIRControlFlowInterfaces 19 | MLIRFunctionInterfaces 20 | MLIRSideEffectInterfaces 21 | MLIRSUNDIALS) 22 | -------------------------------------------------------------------------------- /lib/Dialect/IDA/IR/Types.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/IDA/IR/Types.h" 2 | #include "marco/Dialect/IDA/IR/IDA.h" 3 | #include "llvm/ADT/TypeSwitch.h" 4 | 5 | using namespace ::mlir::ida; 6 | 7 | //===---------------------------------------------------------------------===// 8 | // Tablegen type definitions 9 | //===---------------------------------------------------------------------===// 10 | 11 | #define GET_TYPEDEF_CLASSES 12 | #include "marco/Dialect/IDA/IR/IDATypes.cpp.inc" 13 | -------------------------------------------------------------------------------- /lib/Dialect/KINSOL/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IR) 2 | -------------------------------------------------------------------------------- /lib/Dialect/KINSOL/IR/Attributes.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/KINSOL/IR/Attributes.h" 2 | #include "marco/Dialect/KINSOL/IR/KINSOL.h" 3 | #include "llvm/ADT/TypeSwitch.h" 4 | 5 | using namespace ::mlir::kinsol; 6 | 7 | //===---------------------------------------------------------------------===// 8 | // Tablegen attribute definitions 9 | //===---------------------------------------------------------------------===// 10 | 11 | #define GET_ATTRDEF_CLASSES 12 | #include "marco/Dialect/KINSOL/IR/KINSOLAttributes.cpp.inc" 13 | -------------------------------------------------------------------------------- /lib/Dialect/KINSOL/IR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_mlir_dialect_library(MLIRKINSOL 2 | Attributes.cpp 3 | KINSOL.cpp 4 | Ops.cpp 5 | Types.cpp 6 | 7 | DEPENDS 8 | MLIRKINSOLIncGen 9 | 10 | LINK_COMPONENTS 11 | Core 12 | 13 | LINK_LIBS PUBLIC 14 | MLIRIR 15 | MLIRModeling 16 | MLIRSupport 17 | MLIRCallInterfaces 18 | MLIRControlFlowInterfaces 19 | MLIRFunctionInterfaces 20 | MLIRSideEffectInterfaces 21 | MLIRSUNDIALS) 22 | -------------------------------------------------------------------------------- /lib/Dialect/KINSOL/IR/Types.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/KINSOL/IR/Types.h" 2 | #include "marco/Dialect/KINSOL/IR/KINSOL.h" 3 | #include "llvm/ADT/TypeSwitch.h" 4 | 5 | using namespace ::mlir::kinsol; 6 | 7 | //===---------------------------------------------------------------------===// 8 | // Tablegen type definitions 9 | //===---------------------------------------------------------------------===// 10 | 11 | #define GET_TYPEDEF_CLASSES 12 | #include "marco/Dialect/KINSOL/IR/KINSOLTypes.cpp.inc" 13 | -------------------------------------------------------------------------------- /lib/Dialect/Modeling/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IR) 2 | -------------------------------------------------------------------------------- /lib/Dialect/Modeling/IR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_mlir_dialect_library(MLIRModeling 2 | Attributes.cpp 3 | Modeling.cpp 4 | Ops.cpp 5 | Properties.cpp 6 | 7 | DEPENDS 8 | MLIRModelingIncGen 9 | 10 | LINK_COMPONENTS 11 | Core 12 | 13 | LINK_LIBS PUBLIC 14 | MLIRIR 15 | MLIRSupport 16 | marco::modeling) 17 | -------------------------------------------------------------------------------- /lib/Dialect/Runtime/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IR) 2 | add_subdirectory(Transforms) 3 | -------------------------------------------------------------------------------- /lib/Dialect/Runtime/IR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_mlir_dialect_library(MLIRRuntime 2 | Attributes.cpp 3 | Ops.cpp 4 | Properties.cpp 5 | Runtime.cpp 6 | Types.cpp 7 | 8 | DEPENDS 9 | MLIRRuntimeIncGen 10 | 11 | LINK_COMPONENTS 12 | Core 13 | 14 | LINK_LIBS PUBLIC 15 | MLIRIR 16 | MLIRFunctionInterfaces 17 | MLIRSupport 18 | MLIRModeling) 19 | -------------------------------------------------------------------------------- /lib/Dialect/Runtime/Transforms/AllInterfaces.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/Runtime/Transforms/AllInterfaces.h" 2 | #include "marco/Dialect/Runtime/Transforms/BufferizableOpInterfaceImpl.h" 3 | 4 | namespace mlir::runtime { 5 | void registerAllDialectInterfaceImplementations( 6 | mlir::DialectRegistry ®istry) { 7 | registerBufferizableOpInterfaceExternalModels(registry); 8 | } 9 | } // namespace mlir::runtime 10 | -------------------------------------------------------------------------------- /lib/Dialect/Runtime/Transforms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_mlir_dialect_library(MLIRRuntimeTransforms 2 | AllInterfaces.cpp 3 | BufferizableOpInterfaceImpl.cpp 4 | HeapFunctionsReplacement.cpp 5 | Passes.cpp 6 | 7 | # ADDITIONAL_HEADER_DIRS 8 | # ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg 9 | 10 | DEPENDS 11 | MLIRRuntimeTransformsIncGen 12 | 13 | LINK_LIBS PUBLIC 14 | MLIRRuntime) 15 | -------------------------------------------------------------------------------- /lib/Dialect/Runtime/Transforms/Passes.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/Runtime/Transforms/Passes.h" 2 | -------------------------------------------------------------------------------- /lib/Dialect/SUNDIALS/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IR) 2 | -------------------------------------------------------------------------------- /lib/Dialect/SUNDIALS/IR/Attributes.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/SUNDIALS/IR/Attributes.h" 2 | #include "marco/Dialect/SUNDIALS/IR/SUNDIALS.h" 3 | #include "llvm/ADT/TypeSwitch.h" 4 | 5 | using namespace ::mlir::sundials; 6 | 7 | //===---------------------------------------------------------------------===// 8 | // Tablegen attribute definitions 9 | //===---------------------------------------------------------------------===// 10 | 11 | #define GET_ATTRDEF_CLASSES 12 | #include "marco/Dialect/SUNDIALS/IR/SUNDIALSAttributes.cpp.inc" 13 | -------------------------------------------------------------------------------- /lib/Dialect/SUNDIALS/IR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_mlir_dialect_library(MLIRSUNDIALS 2 | Attributes.cpp 3 | Ops.cpp 4 | SUNDIALS.cpp 5 | Types.cpp 6 | 7 | DEPENDS 8 | MLIRSUNDIALSIncGen 9 | 10 | LINK_COMPONENTS 11 | Core 12 | 13 | LINK_LIBS PUBLIC 14 | MLIRIR 15 | MLIRModeling 16 | MLIRSupport 17 | MLIRCallInterfaces 18 | MLIRControlFlowInterfaces 19 | MLIRFunctionInterfaces 20 | MLIRSideEffectInterfaces) 21 | -------------------------------------------------------------------------------- /lib/Dialect/SUNDIALS/IR/Types.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Dialect/SUNDIALS/IR/Types.h" 2 | #include "marco/Dialect/SUNDIALS/IR/SUNDIALS.h" 3 | #include "llvm/ADT/TypeSwitch.h" 4 | 5 | using namespace ::mlir::sundials; 6 | 7 | //===---------------------------------------------------------------------===// 8 | // Tablegen type definitions 9 | //===---------------------------------------------------------------------===// 10 | 11 | #define GET_TYPEDEF_CLASSES 12 | #include "marco/Dialect/SUNDIALS/IR/SUNDIALSTypes.cpp.inc" 13 | -------------------------------------------------------------------------------- /lib/Frontend/FrontendOptions.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Frontend/FrontendOptions.h" 2 | 3 | using namespace ::marco::frontend; 4 | 5 | namespace marco::frontend { 6 | bool FrontendOptions::shouldPrintIR() const { 7 | return !printIRBeforePass.empty() || !printIRAfterPass.empty(); 8 | } 9 | } // namespace marco::frontend 10 | -------------------------------------------------------------------------------- /lib/Frontend/LanguageOptions.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Frontend/LanguageOptions.h" 2 | 3 | using namespace ::marco::frontend; 4 | -------------------------------------------------------------------------------- /lib/Frontend/SimulationOptions.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Frontend/SimulationOptions.h" 2 | -------------------------------------------------------------------------------- /lib/IO/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | Command.cpp 3 | InputFile.cpp) 4 | 5 | marco_add_library(IO 6 | ${SOURCES} 7 | 8 | LINK_COMPONENTS 9 | Support) 10 | -------------------------------------------------------------------------------- /lib/JIT/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | EngineBuilder.cpp) 3 | 4 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 5 | get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS) 6 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 7 | 8 | marco_add_library(JIT 9 | ${SOURCES} 10 | 11 | LINK_COMPONENTS 12 | Core 13 | Support 14 | 15 | LINK_LIBS PUBLIC 16 | MLIRIR 17 | MLIRExecutionEngine 18 | ${dialect_libs} 19 | ${extension_libs} 20 | ${conversion_libs}) 21 | -------------------------------------------------------------------------------- /lib/Modeling/ArrayEquationsDependencyGraph.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Modeling/ArrayEquationsDependencyGraph.h" 2 | -------------------------------------------------------------------------------- /lib/Modeling/ArrayVariablesDependencyGraph.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Modeling/ArrayVariablesDependencyGraph.h" 2 | -------------------------------------------------------------------------------- /lib/Modeling/Dependency.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Modeling/Dependency.h" 2 | -------------------------------------------------------------------------------- /lib/Modeling/Dumpable.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Modeling/Dumpable.h" 2 | #include "llvm/Support/raw_ostream.h" 3 | 4 | namespace marco::modeling::internal { 5 | Dumpable::~Dumpable() = default; 6 | 7 | void Dumpable::dump() const { dump(llvm::errs()); } 8 | } // namespace marco::modeling::internal 9 | -------------------------------------------------------------------------------- /lib/Modeling/Graph.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Modeling/Graph.h" 2 | -------------------------------------------------------------------------------- /lib/Modeling/SCC.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Modeling/SCC.h" 2 | -------------------------------------------------------------------------------- /lib/Modeling/SCCsDependencyGraph.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Modeling/SCCsDependencyGraph.h" 2 | -------------------------------------------------------------------------------- /lib/Modeling/ScalarEquationsDependencyGraph.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Modeling/ScalarEquationsDependencyGraph.h" 2 | -------------------------------------------------------------------------------- /lib/Modeling/Scheduling.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Modeling/Scheduling.h" 2 | -------------------------------------------------------------------------------- /lib/Modeling/SingleEntryDigraph.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Modeling/SingleEntryDigraph.h" 2 | -------------------------------------------------------------------------------- /lib/Modeling/SingleEntryWeaklyConnectedDigraph.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Modeling/SingleEntryWeaklyConnectedDigraph.h" 2 | -------------------------------------------------------------------------------- /lib/Parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | ModelicaStateMachine.cpp 3 | Parser.cpp 4 | Token.cpp 5 | Location.cpp) 6 | 7 | marco_add_library(parser 8 | ${SOURCES} 9 | 10 | LINK_LIBS 11 | PUBLIC marco::ast 12 | 13 | LINK_COMPONENTS 14 | Core 15 | Support 16 | 17 | LINK_LIBS PUBLIC 18 | MLIRIR 19 | 20 | clangBasic 21 | clangCodeGen) 22 | # TODO check if really need the link libs 23 | -------------------------------------------------------------------------------- /lib/VariableFilter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | AST.cpp 3 | Filter.cpp 4 | LexerStateMachine.cpp 5 | Parser.cpp 6 | Range.cpp 7 | Token.cpp 8 | Tracker.cpp 9 | VariableFilter.cpp) 10 | 11 | marco_add_library(variableFilter 12 | ${SOURCES} 13 | 14 | LINK_LIBS 15 | marco::parser 16 | 17 | LINK_COMPONENTS 18 | Core 19 | Support) 20 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToLinalg/abs.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-linalg | FileCheck %s 2 | 3 | // CHECK: @foo(%[[arg0:.*]]: tensor<3x4x5xf64>) 4 | // CHECK: %[[destination:.*]] = tensor.empty() : tensor<3x4x5xf64> 5 | // CHECK: %[[map:.*]] = linalg.map { bmodelica.abs } ins(%[[arg0]] : tensor<3x4x5xf64>) outs(%[[destination]] : tensor<3x4x5xf64>) 6 | // CHECK: return %[[map]] 7 | 8 | func.func @foo(%arg0: tensor<3x4x5xf64>) -> (tensor<3x4x5xf64>) { 9 | %result = bmodelica.abs %arg0 : tensor<3x4x5xf64> -> tensor<3x4x5xf64> 10 | return %result : tensor<3x4x5xf64> 11 | } 12 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToLinalg/cos.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-linalg | FileCheck %s 2 | 3 | // CHECK: @foo(%[[arg0:.*]]: tensor<3x4x5xf64>) 4 | // CHECK: %[[destination:.*]] = tensor.empty() : tensor<3x4x5xf64> 5 | // CHECK: %[[map:.*]] = linalg.map { bmodelica.cos } ins(%[[arg0]] : tensor<3x4x5xf64>) outs(%[[destination]] : tensor<3x4x5xf64>) 6 | // CHECK: return %[[map]] 7 | 8 | func.func @foo(%arg0: tensor<3x4x5xf64>) -> (tensor<3x4x5xf64>) { 9 | %result = bmodelica.cos %arg0 : tensor<3x4x5xf64> -> tensor<3x4x5xf64> 10 | return %result : tensor<3x4x5xf64> 11 | } 12 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToLinalg/exp.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-linalg | FileCheck %s 2 | 3 | // CHECK: @foo(%[[arg0:.*]]: tensor<3x4x5xf64>) 4 | // CHECK: %[[destination:.*]] = tensor.empty() : tensor<3x4x5xf64> 5 | // CHECK: %[[map:.*]] = linalg.map { bmodelica.exp } ins(%[[arg0]] : tensor<3x4x5xf64>) outs(%[[destination]] : tensor<3x4x5xf64>) 6 | // CHECK: return %[[map]] 7 | 8 | func.func @foo(%arg0: tensor<3x4x5xf64>) -> (tensor<3x4x5xf64>) { 9 | %result = bmodelica.exp %arg0 : tensor<3x4x5xf64> -> tensor<3x4x5xf64> 10 | return %result : tensor<3x4x5xf64> 11 | } 12 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToLinalg/log.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-linalg | FileCheck %s 2 | 3 | // CHECK: @foo(%[[arg0:.*]]: tensor<3x4x5xf64>) 4 | // CHECK: %[[destination:.*]] = tensor.empty() : tensor<3x4x5xf64> 5 | // CHECK: %[[map:.*]] = linalg.map { bmodelica.log } ins(%[[arg0]] : tensor<3x4x5xf64>) outs(%[[destination]] : tensor<3x4x5xf64>) 6 | // CHECK: return %[[map]] 7 | 8 | func.func @foo(%arg0: tensor<3x4x5xf64>) -> (tensor<3x4x5xf64>) { 9 | %result = bmodelica.log %arg0 : tensor<3x4x5xf64> -> tensor<3x4x5xf64> 10 | return %result : tensor<3x4x5xf64> 11 | } 12 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToLinalg/sin.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-linalg | FileCheck %s 2 | 3 | // CHECK: @foo(%[[arg0:.*]]: tensor<3x4x5xf64>) 4 | // CHECK: %[[destination:.*]] = tensor.empty() : tensor<3x4x5xf64> 5 | // CHECK: %[[map:.*]] = linalg.map { bmodelica.sin } ins(%[[arg0]] : tensor<3x4x5xf64>) outs(%[[destination]] : tensor<3x4x5xf64>) 6 | // CHECK: return %[[map]] 7 | 8 | func.func @foo(%arg0: tensor<3x4x5xf64>) -> (tensor<3x4x5xf64>) { 9 | %result = bmodelica.sin %arg0 : tensor<3x4x5xf64> -> tensor<3x4x5xf64> 10 | return %result : tensor<3x4x5xf64> 11 | } 12 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToLinalg/tan.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-linalg | FileCheck %s 2 | 3 | // CHECK: @foo(%[[arg0:.*]]: tensor<3x4x5xf64>) 4 | // CHECK: %[[destination:.*]] = tensor.empty() : tensor<3x4x5xf64> 5 | // CHECK: %[[map:.*]] = linalg.map { bmodelica.tan } ins(%[[arg0]] : tensor<3x4x5xf64>) outs(%[[destination]] : tensor<3x4x5xf64>) 6 | // CHECK: return %[[map]] 7 | 8 | func.func @foo(%arg0: tensor<3x4x5xf64>) -> (tensor<3x4x5xf64>) { 9 | %result = bmodelica.tan %arg0 : tensor<3x4x5xf64> -> tensor<3x4x5xf64> 10 | return %result : tensor<3x4x5xf64> 11 | } 12 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToMemRef/free.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-memref | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK-SAME: (%[[arg0:.*]]: !bmodelica.array<5x3x!bmodelica.int>) 5 | // CHECK: %[[memref:.*]] = builtin.unrealized_conversion_cast %[[arg0]] : !bmodelica.array<5x3x!bmodelica.int> to memref<5x3xi64> 6 | // CHECK: memref.dealloc %[[memref]] : memref<5x3xi64> 7 | // CHECK: return 8 | 9 | func.func @foo(%arg0: !bmodelica.array<5x3x!bmodelica.int>) { 10 | bmodelica.free %arg0 : !bmodelica.array<5x3x!bmodelica.int> 11 | func.return 12 | } 13 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntime/deinit-function.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime | FileCheck %s 2 | 3 | // CHECK: runtime.deinit_function { 4 | // CHECK: runtime.yield 5 | // CHECK: } 6 | 7 | module { 8 | bmodelica.model @Test { 9 | bmodelica.variable @x : !bmodelica.variable 10 | bmodelica.variable @y : !bmodelica.variable<3x!bmodelica.real> 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntime/global-variables.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime | FileCheck %s 2 | 3 | // CHECK-DAG: bmodelica.global_variable @[[x:.*]] : !bmodelica.array 4 | // CHECK-DAG: bmodelica.global_variable @[[y:.*]] : !bmodelica.array<3x!bmodelica.int> 5 | 6 | module { 7 | bmodelica.model @Test { 8 | bmodelica.variable @x : !bmodelica.variable 9 | bmodelica.variable @y : !bmodelica.variable<3x!bmodelica.int> 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntime/model-name.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime | FileCheck %s 2 | 3 | // CHECK: runtime.model_name "Test" 4 | 5 | bmodelica.model @Test { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntime/number-of-variables.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime | FileCheck %s 2 | 3 | // CHECK: runtime.number_of_variables 2 4 | 5 | module { 6 | bmodelica.model @Test { 7 | bmodelica.variable @x : !bmodelica.variable 8 | bmodelica.variable @y : !bmodelica.variable<3x!bmodelica.real> 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntime/time-getter.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime | FileCheck %s 2 | 3 | // CHECK: runtime.function @getTime() -> f64 { 4 | // CHECK: %[[time_get:.*]] = bmodelica.global_variable_get @time : !bmodelica.array 5 | // CHECK: %[[time_load:.*]] = bmodelica.load %[[time_get]][] 6 | // CHECK: %[[result:.*]] = bmodelica.cast %[[time_load]] : !bmodelica.real -> f64 7 | // CHECK: runtime.return %[[result]] : f64 8 | // CHECK-NEXT: } 9 | 10 | bmodelica.model @Test { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntime/time-setter.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime | FileCheck %s 2 | 3 | // CHECK: runtime.function @setTime(%[[newTime:.*]]: f64) { 4 | // CHECK: %[[time_get:.*]] = bmodelica.global_variable_get @time : !bmodelica.array 5 | // CHECK: %[[newTime_cast:.*]] = bmodelica.cast %[[newTime]] : f64 -> !bmodelica.real 6 | // CHECK: bmodelica.store %[[time_get]][], %[[newTime_cast]] 7 | // CHECK: runtime.return 8 | // CHECK-NEXT: } 9 | 10 | bmodelica.model @Test { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntime/variable-names.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime | FileCheck %s 2 | 3 | // CHECK: runtime.variable_names ["x", "y"] 4 | 5 | module { 6 | bmodelica.model @Test { 7 | bmodelica.variable @x : !bmodelica.variable 8 | bmodelica.variable @y : !bmodelica.variable<3x!bmodelica.real> 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/acos.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Macos_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Macos_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.acos %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/asin.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Masin_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Masin_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.asin %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/atan.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Matan_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Matan_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.atan %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/atan2.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Matan2_f64_f64_f64(f64, f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64, %[[arg1:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Matan2_f64_f64_f64(%[[arg0]], %[[arg1]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64, %arg1: f64) -> f64 { 11 | %0 = bmodelica.atan2 %arg0, %arg1 : (f64, f64) -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/ceil.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mceil_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mceil_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.ceil %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/cos.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mcos_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mcos_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.cos %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/cosh.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mcosh_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mcosh_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.cosh %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/div_trunc.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mdiv_f64_f64_f64(f64, f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64, %[[arg1:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mdiv_f64_f64_f64(%[[arg0]], %[[arg1]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64, %arg1: f64) -> f64 { 11 | %0 = bmodelica.div_trunc %arg0, %arg1 : (f64, f64) -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/exp.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mexp_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mexp_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.exp %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/floor.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mfloor_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mfloor_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.floor %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/integer.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Minteger_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Minteger_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.integer %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/log.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mlog_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mlog_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.log %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/log10.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mlog10_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mlog10_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.log10 %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/mod.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mmod_f64_f64_f64(f64, f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64, %[[arg1:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mmod_f64_f64_f64(%[[arg0]], %[[arg1]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64, %arg1: f64) -> f64 { 11 | %0 = bmodelica.mod %arg0, %arg1 : (f64, f64) -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/pow.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mpow_f64_f64_f64(f64, f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64, %[[arg1:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mpow_f64_f64_f64(%[[arg0]], %[[arg1]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64, %arg1: f64) -> f64 { 11 | %0 = bmodelica.pow %arg0, %arg1 : (f64, f64) -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/print.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mprint_void_ai64(tensor<*xi64>) 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: tensor<2x3xi64>) 7 | // CHECK: %[[cast:.*]] = tensor.cast %[[arg0]] : tensor<2x3xi64> to tensor<*xi64> 8 | // CHECK: runtime.call @_Mprint_void_ai64(%[[cast]]) 9 | // CHECK: return 10 | 11 | func.func @foo(%arg0: tensor<2x3xi64>) { 12 | bmodelica.print %arg0 : tensor<2x3xi64> 13 | func.return 14 | } 15 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/rem.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mrem_f64_f64_f64(f64, f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64, %[[arg1:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mrem_f64_f64_f64(%[[arg0]], %[[arg1]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64, %arg1: f64) -> f64 { 11 | %0 = bmodelica.rem %arg0, %arg1 : (f64, f64) -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/sign.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Msign_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Msign_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.sign %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/sin.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Msin_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Msin_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.sin %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/sinh.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Msinh_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Msinh_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.sinh %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/sqrt.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Msqrt_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Msqrt_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.sqrt %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/tan.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mtan_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mtan_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.tan %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToRuntimeCall/tanh.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-runtime-call | FileCheck %s 2 | 3 | // CHECK: runtime.function private @_Mtanh_f64_f64(f64) -> f64 4 | 5 | // CHECK-LABEL: @foo 6 | // CHECK-SAME: (%[[arg0:.*]]: f64) -> f64 7 | // CHECK: %[[result:.*]] = runtime.call @_Mtanh_f64_f64(%[[arg0]]) 8 | // CHECK: return %[[result]] 9 | 10 | func.func @foo(%arg0: f64) -> f64 { 11 | %0 = bmodelica.tanh %arg0 : f64 -> f64 12 | func.return %0 : f64 13 | } 14 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToTensor/tensor_broadcast.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-tensor | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK-SAME: (%[[arg0:.*]]: i64) -> tensor<2x3xi64> 5 | // CHECK: %[[tensor:.*]] = tensor.splat %[[arg0]] : tensor<2x3xi64> 6 | // CHECK: return %[[tensor]] 7 | 8 | func.func @foo(%arg0: i64) -> tensor<2x3xi64> { 9 | %0 = bmodelica.tensor_broadcast %arg0 : i64 -> tensor<2x3xi64> 10 | func.return %0 : tensor<2x3xi64> 11 | } 12 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/BaseModelicaToTensor/tensor_extract.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-bmodelica-to-tensor | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK-SAME: (%[[arg0:.*]]: tensor<2x3xi64>, %[[arg1:.*]]: index, %[[arg2:.*]]: index) -> i64 5 | // CHECK: %[[value:.*]] = tensor.extract %[[arg0]][%[[arg1]], %[[arg2]]] 6 | // CHECK: return %[[value]] 7 | 8 | func.func @foo(%arg0: tensor<2x3xi64>, %arg1: index, %arg2: index) -> i64 { 9 | %0 = bmodelica.tensor_extract %arg0[%arg1, %arg2] : tensor<2x3xi64> 10 | func.return %0 : i64 11 | } 12 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/RuntimeModelMetadataConversion/model_name.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-runtime-model-metadata | FileCheck %s 2 | 3 | // CHECK: llvm.mlir.global internal constant @modelName("Test\00") 4 | 5 | // CHECK: func.func @getModelName() -> !llvm.ptr { 6 | // CHECK-DAG: %[[addr:.*]] = llvm.mlir.addressof @modelName : !llvm.ptr 7 | // CHECK: %[[ptr:.*]] = llvm.getelementptr %[[addr]][0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.array<5 x i8> 8 | // CHECK: return %[[ptr]] : !llvm.ptr 9 | // CHECK-NEXT: } 10 | 11 | runtime.model_name "Test" 12 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/RuntimeModelMetadataConversion/number_of_variables.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-runtime-model-metadata | FileCheck %s 2 | 3 | // CHECK: func.func @getNumOfVariables() -> i64 { 4 | // CHECK-NEXT: %[[result:.*]] = arith.constant 2 : i64 5 | // CHECK-NEXT: return %[[result]] 6 | // CHECK-NEXT: } 7 | 8 | runtime.number_of_variables 2 9 | -------------------------------------------------------------------------------- /test/Codegen/Conversion/RuntimeToFunc/function.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --convert-runtime-to-func | FileCheck %s 2 | 3 | // CHECK: func.func @foo() { 4 | // CHECK: return 5 | // CHECK-NEXT: } 6 | 7 | runtime.function @foo() { 8 | runtime.return 9 | } 10 | 11 | // ----- 12 | 13 | // CHECK: func.func @foo(%[[arg:.*]]: f64) -> f64 { 14 | // CHECK: return %[[arg]] 15 | // CHECK-NEXT: } 16 | 17 | runtime.function @foo(%arg0: f64) -> f64 { 18 | runtime.return %arg0 : f64 19 | } 20 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/abs.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.abs 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := abs(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/acos.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.acos 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := acos(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/asin.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.asin 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := asin(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/atan.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.atan 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := atan(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/atan2.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.atan2 5 | // CHECK-SAME: (!bmodelica.real, !bmodelica.real) -> !bmodelica.real 6 | 7 | function foo 8 | input Real y; 9 | input Real x; 10 | output Real z; 11 | algorithm 12 | z := atan2(y, x); 13 | end foo; 14 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/ceil.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.ceil 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := ceil(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/cos.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.cos 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := cos(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/cosh.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.cosh 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := cosh(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/diagonal.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.diagonal 5 | // CHECK-SAME: tensor -> tensor 6 | 7 | function foo 8 | input Integer[:] x; 9 | output Integer[:,:] y; 10 | algorithm 11 | y := diagonal(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/div.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.div_trunc 5 | // CHECK-SAME: (!bmodelica.int, !bmodelica.int) -> !bmodelica.int 6 | 7 | function foo 8 | input Integer x; 9 | input Integer y; 10 | output Integer z; 11 | algorithm 12 | z := div(x, y); 13 | end foo; 14 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/exp.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.exp 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := exp(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/floor.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.floor 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := floor(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/identity.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.identity 5 | // CHECK-SAME: !bmodelica.int -> tensor 6 | 7 | function foo 8 | input Integer x; 9 | output Integer[:,:] y; 10 | algorithm 11 | y := identity(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/integer.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.integer 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.int 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := integer(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/linspace.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.linspace 5 | // CHECK-SAME: (!bmodelica.int, !bmodelica.int, !bmodelica.int) -> tensor 6 | 7 | function foo 8 | input Integer start; 9 | input Integer stop; 10 | input Integer n; 11 | output Real[:] y; 12 | algorithm 13 | y := linspace(start, stop, n); 14 | end foo; 15 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/log.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.log 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := log(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/log10.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.log10 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := log10(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/max-array.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.max 5 | // CHECK-SAME: tensor -> !bmodelica.real 6 | 7 | function foo 8 | input Real[:,:] x; 9 | output Real y; 10 | algorithm 11 | y := max(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/max-scalars.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.max 5 | // CHECK-SAME: (!bmodelica.real, !bmodelica.real) -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | input Real y; 10 | output Real z; 11 | algorithm 12 | z := max(x, y); 13 | end foo; 14 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/min-array.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.min 5 | // CHECK-SAME: tensor -> !bmodelica.real 6 | 7 | function foo 8 | input Real[:,:] x; 9 | output Real y; 10 | algorithm 11 | y := min(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/min-scalars.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.min 5 | // CHECK-SAME: (!bmodelica.real, !bmodelica.real) -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | input Real y; 10 | output Real z; 11 | algorithm 12 | z := min(x, y); 13 | end foo; 14 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/mod.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.mod 5 | // CHECK-SAME: (!bmodelica.int, !bmodelica.int) -> !bmodelica.int 6 | 7 | function foo 8 | input Integer x; 9 | input Integer y; 10 | output Integer z; 11 | algorithm 12 | z := mod(x, y); 13 | end foo; 14 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/ndims.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.ndims 5 | // CHECK-SAME: tensor -> !bmodelica.int 6 | 7 | function foo 8 | input Integer[:,:] x; 9 | output Integer y; 10 | algorithm 11 | y := ndims(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/ones.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.ones 5 | // CHECK-SAME: (!bmodelica.int, !bmodelica.int) -> tensor 6 | 7 | function foo 8 | input Integer n1; 9 | input Integer n2; 10 | output Real[:] y; 11 | algorithm 12 | y := ones(n1, n2); 13 | end foo; 14 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/product-array.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.product 5 | // CHECK-SAME: tensor -> !bmodelica.int 6 | 7 | function foo 8 | input Integer[:] x; 9 | output Integer y; 10 | algorithm 11 | y := product(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/rem.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.rem 5 | // CHECK-SAME: (!bmodelica.int, !bmodelica.int) -> !bmodelica.int 6 | 7 | function foo 8 | input Integer x; 9 | input Integer y; 10 | output Integer z; 11 | algorithm 12 | z := rem(x, y); 13 | end foo; 14 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/sign.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.sign 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.int 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := sign(x); 12 | end foo; -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/sin.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.sin 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := sin(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/sinh.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.sinh 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := sinh(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/sqrt.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.sqrt 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := sqrt(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/sum-array.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.sum 5 | // CHECK-SAME: tensor -> !bmodelica.int 6 | 7 | function foo 8 | input Integer[:] x; 9 | output Integer y; 10 | algorithm 11 | y := sum(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/symmetric.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.symmetric 5 | // CHECK-SAME: tensor -> tensor 6 | 7 | function foo 8 | input Integer[:,:] x; 9 | output Integer[:,:] y; 10 | algorithm 11 | y := symmetric(x); 12 | end foo; -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/tan.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.tan 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := tan(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/tanh.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.tanh 5 | // CHECK-SAME: !bmodelica.real -> !bmodelica.real 6 | 7 | function foo 8 | input Real x; 9 | output Real y; 10 | algorithm 11 | y := tanh(x); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/transpose.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.transpose 5 | // CHECK-SAME: tensor -> tensor 6 | 7 | function foo 8 | input Integer[:,:] x; 9 | output Integer[:,:] y; 10 | algorithm 11 | y := transpose(x); 12 | end foo; -------------------------------------------------------------------------------- /test/Codegen/Lowering/built-in-function/zeros.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | // CHECK: bmodelica.zeros 5 | // CHECK-SAME: (!bmodelica.int, !bmodelica.int) -> tensor 6 | 7 | function foo 8 | input Integer n1; 9 | input Integer n2; 10 | output Real[:] y; 11 | algorithm 12 | y := zeros(n1, n2); 13 | end foo; 14 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/component-reference/array-variable.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @Foo 4 | // CHECK: bmodelica.algorithm { 5 | // CHECK-NEXT: %[[x:.*]] = bmodelica.variable_get @x : tensor<2x!bmodelica.real> 6 | // CHECK-NEXT: bmodelica.variable_set @y, %[[x]] 7 | // CHECK-NEXT: } 8 | 9 | function Foo 10 | input Real[2] x; 11 | output Real[2] y; 12 | algorithm 13 | y := x; 14 | end Foo; 15 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/component-reference/scalar-variable.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @Foo 4 | // CHECK: bmodelica.algorithm { 5 | // CHECK-NEXT: %[[x:.*]] = bmodelica.variable_get @x : !bmodelica.real 6 | // CHECK-NEXT: bmodelica.variable_set @y, %[[x]] 7 | // CHECK-NEXT: } 8 | 9 | function Foo 10 | input Real x; 11 | output Real y; 12 | algorithm 13 | y := x; 14 | end Foo; 15 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/model/array-variable-record.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK: bmodelica.model @M { 4 | // CHECK-NEXT: bmodelica.variable @r : !bmodelica.variable<3x!bmodelica> 5 | // CHECK-NEXT: } 6 | 7 | package Test 8 | record R 9 | end R; 10 | 11 | model M 12 | R[3] r; 13 | end M; 14 | end Test; 15 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/model/array-variable-with-binding-equation-arrayfor.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK: bmodelica.binding_equation @x { 5 | // CHECK-DAG: %[[cst0:.*]] = bmodelica.constant #bmodelica 6 | // CHECK-NEXT: %[[tensor:.*]] = bmodelica.tensor_broadcast %[[cst0]] : !bmodelica.int -> tensor<3x!bmodelica.int> 7 | // CHECK-NEXT: bmodelica.yield %[[tensor]] 8 | // CHECK-NEXT: } 9 | 10 | model Test 11 | Real[3] x = {1234 for i in 1:3}; 12 | equation 13 | end Test; 14 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/model/array-variable-with-scalar-start.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK: bmodelica.start @x { 5 | // CHECK-NEXT: %[[value:.*]] = bmodelica.constant #bmodelica 6 | // CHECK-NEXT: bmodelica.yield %[[value]] : !bmodelica.int 7 | // CHECK-NEXT: } {each = true, fixed = false} 8 | 9 | model Test 10 | Real[3] x(each start = 5); 11 | end Test; 12 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/model/constant.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK: bmodelica.variable @n : !bmodelica.variable 5 | 6 | model Test 7 | constant Integer n; 8 | end Test; 9 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/model/empty-model.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK: bmodelica.model @Test { 4 | // CHECK-NEXT: } 5 | 6 | model Test 7 | end Test; 8 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/model/parameter.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK: bmodelica.variable @n : !bmodelica.variable 5 | 6 | model Test 7 | parameter Integer n; 8 | end Test; 9 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/model/scalar-variable-record.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK: bmodelica.model @M { 4 | // CHECK-NEXT: bmodelica.variable @r : !bmodelica.variable> 5 | // CHECK-NEXT: } 6 | 7 | package Test 8 | record R 9 | end R; 10 | 11 | model M 12 | R r; 13 | end M; 14 | end Test; 15 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/model/scalar-variable-with-binding-equation.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK: bmodelica.binding_equation @x { 5 | // CHECK-NEXT: %[[value:.*]] = bmodelica.constant #bmodelica 6 | // CHECK-NEXT: bmodelica.yield %[[value]] 7 | // CHECK-NEXT: } 8 | 9 | model Test 10 | Integer x = 5; 11 | end Test; 12 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/model/scalar-variable-with-fixed-start.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK: bmodelica.start @x { 5 | // CHECK-NEXT: %[[value:.*]] = bmodelica.constant #bmodelica 6 | // CHECK-NEXT: bmodelica.yield %[[value]] : !bmodelica.int 7 | // CHECK-NEXT: } {each = false, fixed = true} 8 | 9 | model Test 10 | Real x(start = 5, fixed = true); 11 | end Test; 12 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/model/scalar-variable-with-non-fixed-start.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK: bmodelica.start @x { 5 | // CHECK-NEXT: %[[value:.*]] = bmodelica.constant #bmodelica 6 | // CHECK-NEXT: bmodelica.yield %[[value]] : !bmodelica.int 7 | // CHECK-NEXT: } {each = false, fixed = false} 8 | 9 | model Test 10 | Real x(start = 5, fixed = false); 11 | end Test; 12 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/operation/neg-scalar.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @Integer 4 | // CHECK: bmodelica.neg %{{.*}} : !bmodelica.int -> !bmodelica.int 5 | 6 | function Integers 7 | input Integer x; 8 | output Integer y; 9 | algorithm 10 | y := -x; 11 | end Integers; 12 | 13 | // CHECK-LABEL: @Real 14 | // CHECK: bmodelica.neg %{{.*}} : !bmodelica.real -> !bmodelica.real 15 | 16 | function Reals 17 | input Real x; 18 | output Real y; 19 | algorithm 20 | y := -x; 21 | end Reals; 22 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/record/array-components.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK: bmodelica.record @Test { 4 | // CHECK-NEXT: bmodelica.variable @x : !bmodelica.variable<3x!bmodelica.bool> 5 | // CHECK-NEXT: bmodelica.variable @y : !bmodelica.variable<4x!bmodelica.int> 6 | // CHECK-NEXT: bmodelica.variable @z : !bmodelica.variable<5x!bmodelica.real> 7 | // CHECK-NEXT: } 8 | 9 | record Test 10 | Boolean[3] x; 11 | Integer[4] y; 12 | Real[5] z; 13 | end Test; 14 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/record/array-variable-set-array-component.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK: bmodelica.function @Foo { 4 | // CHECK: bmodelica.algorithm { 5 | // CHECK: %[[x:.*]] = bmodelica.variable_get @x : tensor<2x3x!bmodelica.real> 6 | // CHECK-NEXT: bmodelica.variable_component_set @r::@x, %[[x]] 7 | // CHECK-NEXT: } 8 | // CHECK-NEXT: } 9 | 10 | record R 11 | Real[3] x; 12 | end R; 13 | 14 | function Foo 15 | input Real[2,3] x; 16 | output R[2] r; 17 | algorithm 18 | r.x := x; 19 | end Foo; 20 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/record/array-variable-set-scalar-component.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK: bmodelica.function @Foo { 4 | // CHECK: bmodelica.algorithm { 5 | // CHECK: %[[x:.*]] = bmodelica.variable_get @x : tensor<3x!bmodelica.real> 6 | // CHECK-NEXT: bmodelica.variable_component_set @r::@x, %[[x]] 7 | // CHECK-NEXT: } 8 | // CHECK-NEXT: } 9 | 10 | record R 11 | Real x; 12 | end R; 13 | 14 | function Foo 15 | input Real[3] x; 16 | output R[3] r; 17 | algorithm 18 | r.x := x; 19 | end Foo; 20 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/record/empty-record.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK: bmodelica.record @Test { 4 | // CHECK-NEXT: } 5 | 6 | record Test 7 | end Test; 8 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/record/scalar-components.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK: bmodelica.record @Test { 4 | // CHECK-NEXT: bmodelica.variable @x : !bmodelica.variable 5 | // CHECK-NEXT: bmodelica.variable @y : !bmodelica.variable 6 | // CHECK-NEXT: bmodelica.variable @z : !bmodelica.variable 7 | // CHECK-NEXT: } 8 | 9 | record Test 10 | Boolean x; 11 | Integer y; 12 | Real z; 13 | end Test; 14 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/record/scalar-variable-set-array-component.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK: bmodelica.function @Foo { 4 | // CHECK: bmodelica.algorithm { 5 | // CHECK: %[[x:.*]] = bmodelica.variable_get @x : tensor<3x!bmodelica.real> 6 | // CHECK-NEXT: bmodelica.variable_component_set @r::@x, %[[x]] 7 | // CHECK-NEXT: } 8 | // CHECK-NEXT: } 9 | 10 | record R 11 | Real[3] x; 12 | end R; 13 | 14 | function Foo 15 | input Real[3] x; 16 | output R r; 17 | algorithm 18 | r.x := x; 19 | end Foo; 20 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/record/scalar-variable-set-scalar-component.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK: bmodelica.function @Foo { 4 | // CHECK: bmodelica.algorithm { 5 | // CHECK: %[[x:.*]] = bmodelica.variable_get @x : !bmodelica.real 6 | // CHECK-NEXT: bmodelica.variable_component_set @r::@x, %[[x]] 7 | // CHECK-NEXT: } 8 | // CHECK-NEXT: } 9 | 10 | record R 11 | Real x; 12 | end R; 13 | 14 | function Foo 15 | input Real x; 16 | output R r; 17 | algorithm 18 | r.x := x; 19 | end Foo; 20 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/standard-function/protected-member.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK-LABEL: @foo 4 | 5 | // CHECK: bmodelica.variable @x : !bmodelica.variable 6 | // CHECK: bmodelica.variable @y : !bmodelica.variable 7 | // CHECK: bmodelica.variable @z : !bmodelica.variable<2x!bmodelica.int> 8 | 9 | function foo 10 | input Integer[:] x; 11 | output Integer y; 12 | protected 13 | Integer[2] z; 14 | algorithm 15 | end foo; 16 | -------------------------------------------------------------------------------- /test/Codegen/Lowering/statement/if-statement.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 %s --omc-bypass -emit-mlir -o - | FileCheck %s 2 | 3 | // CHECK: %[[condition:.*]] = bmodelica.eq 4 | // CHECK: bmodelica.if (%[[condition]] : !bmodelica.bool) { 5 | // CHECK-NEXT: %[[value:.*]] = bmodelica.constant #bmodelica 6 | // CHECK-NEXT: bmodelica.variable_set @y, %[[value]] 7 | // CHECK-NEXT: } 8 | 9 | function Test 10 | input Real x; 11 | output Real y; 12 | algorithm 13 | if x == 0 then 14 | y := 1; 15 | end if; 16 | end Test; 17 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/EulerForward/update-non-state-variables.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --euler-forward | FileCheck %s 2 | 3 | // CHECK: runtime.function @updateNonStateVariables() { 4 | // CHECK: runtime.return 5 | // CHECK-NEXT: } 6 | 7 | bmodelica.model @emptyModel { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/EulerForward/update-state-variables.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --euler-forward | FileCheck %s 2 | 3 | // CHECK: runtime.function @updateStateVariables(%[[timeStep:.*]]: f64) { 4 | // CHECK: runtime.return 5 | // CHECK-NEXT: } 6 | 7 | bmodelica.model @emptyModel { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/FunctionUnwrap/recursion.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --function-unwrap | FileCheck %s 2 | 3 | // CHECK: bmodelica.function @M1_M2_foo { 4 | // CHECK-NEXT: bmodelica.algorithm { 5 | // CHECK-NEXT: bmodelica.call @M1_M2_foo() 6 | // CHECK-NEXT: } 7 | // CHECK-NEXT: } 8 | 9 | bmodelica.model @M1 { 10 | bmodelica.model @M2 { 11 | bmodelica.function @foo { 12 | bmodelica.algorithm { 13 | bmodelica.call @M1::@M2::@foo() : () -> () 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/IDA/calc-ic.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --ida | FileCheck %s 2 | 3 | // CHECK: ida.instance @ida_main 4 | // CHECK: runtime.function @calcIC() { 5 | // CHECK: ida.calc_ic @ida_main 6 | // CHECK: runtime.return 7 | // CHECK-NEXT: } 8 | 9 | bmodelica.model @emptyModel { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/IDA/dynamic-model-end-function.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --ida | FileCheck %s 2 | 3 | // CHECK: ida.instance @ida_main 4 | // CHECK: runtime.dynamic_model_end { 5 | // CHECK-NEXT: ida.free @ida_main 6 | // CHECK-NEXT: } 7 | 8 | bmodelica.model @emptyModel { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/IDA/get-ida-time.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --ida | FileCheck %s 2 | 3 | // CHECK: ida.instance @ida_main 4 | // CHECK: runtime.function @getIDATime() -> f64 { 5 | // CHECK-NEXT: %[[result:.*]] = ida.get_current_time @ida_main : f64 6 | // CHECK-NEXT: runtime.return %[[result]] 7 | // CHECK-NEXT: } 8 | 9 | bmodelica.model @emptyModel { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/IDA/update-ida-variables.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --ida | FileCheck %s 2 | 3 | // CHECK: ida.instance @ida_main 4 | // CHECK: runtime.function @updateIDAVariables() { 5 | // CHECK: ida.step @ida_main 6 | // CHECK: runtime.return 7 | // CHECK-NEXT: } 8 | 9 | bmodelica.model @emptyModel { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/IDA/update-non-ida-variables.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --ida | FileCheck %s 2 | 3 | // CHECK: runtime.function @updateNonIDAVariables() { 4 | // CHECK-NEXT: runtime.return 5 | // CHECK-NEXT: } 6 | 7 | bmodelica.model @emptyModel { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/RuntimeVerification/div.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --generate-runtime-verification | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK-SAME: (%{{.*}}: f64, %[[rhs:.*]]: f64) 5 | 6 | func.func @Test(%arg0: f64, %arg1: f64) -> f64 { 7 | // CHECK: bmodelica.assert 8 | // CHECK: %[[zero:.*]] = bmodelica.constant #bmodelica 9 | // CHECK: %[[condition:.*]] = bmodelica.neq %[[rhs]], %[[zero]] 10 | // CHECK: bmodelica.yield %[[condition]] 11 | 12 | %0 = bmodelica.div %arg0, %arg1 : (f64, f64) -> f64 13 | func.return %0 : f64 14 | } 15 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/RuntimeVerification/log.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --generate-runtime-verification | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK-SAME: (%[[arg0:.*]]: f64) 5 | 6 | func.func @Test(%arg0: f64) -> f64 { 7 | // CHECK: bmodelica.assert 8 | // CHECK: %[[zero:.*]] = bmodelica.constant #bmodelica 9 | // CHECK: %[[condition:.*]] = bmodelica.gt %[[arg0]], %[[zero]] 10 | // CHECK: bmodelica.yield %[[condition]] 11 | 12 | %0 = bmodelica.log %arg0 : f64 -> f64 13 | func.return %0 : f64 14 | } 15 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/RuntimeVerification/log10.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --generate-runtime-verification | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK-SAME: (%[[arg0:.*]]: f64) 5 | 6 | func.func @Test(%arg0: f64) -> f64 { 7 | // CHECK: bmodelica.assert 8 | // CHECK: %[[zero:.*]] = bmodelica.constant #bmodelica 9 | // CHECK: %[[condition:.*]] = bmodelica.gt %[[arg0]], %[[zero]] 10 | // CHECK: bmodelica.yield %[[condition]] 11 | 12 | %0 = bmodelica.log10 %arg0 : f64 -> f64 13 | func.return %0 : f64 14 | } 15 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/RuntimeVerification/mod.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --generate-runtime-verification | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK-SAME: (%{{.*}}: f64, %[[rhs:.*]]: f64) 5 | 6 | func.func @Test(%arg0: f64, %arg1: f64) -> f64 { 7 | // CHECK: bmodelica.assert 8 | // CHECK: %[[zero:.*]] = bmodelica.constant #bmodelica 9 | // CHECK: %[[condition:.*]] = bmodelica.neq %[[rhs]], %[[zero]] 10 | // CHECK: bmodelica.yield %[[condition]] 11 | 12 | %0 = bmodelica.mod %arg0, %arg1 : (f64, f64) -> f64 13 | func.return %0 : f64 14 | } 15 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/RuntimeVerification/rem.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --generate-runtime-verification | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK-SAME: (%{{.*}}: f64, %[[rhs:.*]]: f64) 5 | 6 | func.func @Test(%arg0: f64, %arg1: f64) -> f64 { 7 | // CHECK: bmodelica.assert 8 | // CHECK: %[[zero:.*]] = bmodelica.constant #bmodelica 9 | // CHECK: %[[condition:.*]] = bmodelica.neq %[[rhs]], %[[zero]] 10 | // CHECK: bmodelica.yield %[[condition]] 11 | 12 | %0 = bmodelica.rem %arg0, %arg1 : (f64, f64) -> f64 13 | func.return %0 : f64 14 | } 15 | -------------------------------------------------------------------------------- /test/Dialect/BaseModelica/Transforms/RuntimeVerification/sqrt.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --generate-runtime-verification | FileCheck %s 2 | 3 | // CHECK-LABEL: @Test 4 | // CHECK-SAME: (%[[arg0:.*]]: f64) 5 | 6 | func.func @Test(%arg0: f64) -> f64 { 7 | // CHECK: bmodelica.assert 8 | // CHECK: %[[zero:.*]] = bmodelica.constant #bmodelica 9 | // CHECK: %[[condition:.*]] = bmodelica.gte %[[arg0]], %[[zero]] 10 | // CHECK: bmodelica.yield %[[condition]] 11 | 12 | %0 = bmodelica.sqrt %arg0 : f64 -> f64 13 | func.return %0 : f64 14 | } 15 | -------------------------------------------------------------------------------- /test/Dialect/Simulation/Transforms/HeapFunctionsReplacement/free.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --heap-functions-replacement | FileCheck %s 2 | 3 | // CHECK-DAG: llvm.func @marco_free(!llvm.ptr) 4 | // CHECK-DAG: llvm.call @marco_free 5 | 6 | module { 7 | llvm.func @free(!llvm.ptr) 8 | 9 | func.func @foo(%arg0: !llvm.ptr) { 10 | llvm.call @free(%arg0) : (!llvm.ptr) -> () 11 | func.return 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/Dialect/Simulation/Transforms/HeapFunctionsReplacement/malloc.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --heap-functions-replacement | FileCheck %s 2 | 3 | // CHECK-DAG: llvm.func @marco_malloc(i64) -> !llvm.ptr 4 | // CHECK-DAG: llvm.call @marco_malloc 5 | 6 | module { 7 | llvm.func @malloc(i64) -> !llvm.ptr 8 | 9 | func.func @foo(%arg0: i64) -> !llvm.ptr { 10 | %0 = llvm.call @malloc(%arg0) : (i64) -> !llvm.ptr 11 | func.return %0 : !llvm.ptr 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/Dialect/Simulation/Transforms/HeapFunctionsReplacement/realloc.mlir: -------------------------------------------------------------------------------- 1 | // RUN: modelica-opt %s --split-input-file --heap-functions-replacement | FileCheck %s 2 | 3 | // CHECK-DAG: llvm.func @marco_realloc(!llvm.ptr, i64) -> !llvm.ptr 4 | // CHECK-DAG: llvm.call @marco_realloc 5 | 6 | module { 7 | llvm.func @realloc(!llvm.ptr, i64) -> !llvm.ptr 8 | 9 | func.func @foo(%arg0: !llvm.ptr, %arg1: i64) -> !llvm.ptr { 10 | %0 = llvm.call @realloc(%arg0, %arg1) : (!llvm.ptr, i64) -> !llvm.ptr 11 | func.return %0 : !llvm.ptr 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/Driver/emit-assembly.mlir: -------------------------------------------------------------------------------- 1 | // RUN: marco -S --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: text 4 | 5 | bmodelica.model @M { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/Driver/emit-assembly.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -S --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: text 4 | 5 | model M 6 | end M; 7 | -------------------------------------------------------------------------------- /test/Driver/emit-ast.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -emit-ast --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: "node_type": "root" 4 | 5 | model M 6 | end M; 7 | -------------------------------------------------------------------------------- /test/Driver/emit-llvm.mlir: -------------------------------------------------------------------------------- 1 | // RUN: marco -emit-llvm -S --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: @modelName = internal constant [2 x i8] c"M\00 4 | 5 | bmodelica.model @M { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/Driver/emit-llvm.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -emit-llvm -S --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: @modelName = internal constant [2 x i8] c"M\00 4 | 5 | model M 6 | end M; 7 | -------------------------------------------------------------------------------- /test/Driver/emit-mlir-llvm.mlir: -------------------------------------------------------------------------------- 1 | // RUN: marco -emit-mlir-llvm --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: llvm.mlir.global internal constant @modelName 4 | 5 | bmodelica.model @M { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/Driver/emit-mlir-llvm.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -emit-mlir-llvm --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: llvm.mlir.global internal constant @modelName 4 | 5 | model M 6 | end M; 7 | -------------------------------------------------------------------------------- /test/Driver/emit-mlir-modelica.mlir: -------------------------------------------------------------------------------- 1 | // RUN: marco -emit-mlir-modelica --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: bmodelica.model 4 | 5 | bmodelica.model @M { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/Driver/emit-mlir-modelica.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -emit-mlir-modelica --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: bmodelica.model 4 | 5 | model M 6 | end M; 7 | -------------------------------------------------------------------------------- /test/Frontend/Actions/emit-assembly.mlir: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 -S --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: text 4 | 5 | bmodelica.model @M { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/Frontend/Actions/emit-assembly.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 -S --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: text 4 | 5 | model M 6 | end M; 7 | -------------------------------------------------------------------------------- /test/Frontend/Actions/emit-ast.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 -emit-ast --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: "node_type": "root" 4 | 5 | model M 6 | end M; 7 | -------------------------------------------------------------------------------- /test/Frontend/Actions/emit-llvm.mlir: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 -emit-llvm --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: @modelName = internal constant [2 x i8] c"M\00 4 | 5 | bmodelica.model @M { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/Frontend/Actions/emit-llvm.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 -emit-llvm --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: @modelName = internal constant [2 x i8] c"M\00 4 | 5 | model M 6 | end M; 7 | -------------------------------------------------------------------------------- /test/Frontend/Actions/emit-mlir-llvm.mlir: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 -emit-mlir-llvm --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: llvm.mlir.global internal constant @modelName 4 | 5 | bmodelica.model @M { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/Frontend/Actions/emit-mlir-llvm.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 -emit-mlir-llvm --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: llvm.mlir.global internal constant @modelName 4 | 5 | model M 6 | end M; 7 | -------------------------------------------------------------------------------- /test/Frontend/Actions/emit-mlir-modelica.mlir: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 -emit-mlir-modelica --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: bmodelica.model 4 | 5 | bmodelica.model @M { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/Frontend/Actions/emit-mlir-modelica.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 -emit-mlir-modelica --omc-bypass -o - %s | FileCheck %s 2 | 3 | // CHECK: bmodelica.model 4 | 5 | model M 6 | end M; 7 | -------------------------------------------------------------------------------- /test/Frontend/codegen-options/omp.test: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 -init-only | FileCheck %s --check-prefix="CHECK-DEFAULT" 2 | 3 | // CHECK-DEFAULT-LABEL: [Code generation] 4 | // CHECK-DEFAULT: OpenMP: false 5 | 6 | // RUN: marco -mc1 -init-only -omp | FileCheck %s --check-prefix="CHECK-ENABLED" 7 | 8 | // CHECK-ENABLED-LABEL: [Code generation] 9 | // CHECK-ENABLED: OpenMP: true 10 | 11 | // RUN: marco -mc1 -init-only -no-omp | FileCheck %s --check-prefix="CHECK-DISABLED" 12 | 13 | // CHECK-DISABLED-LABEL: [Code generation] 14 | // CHECK-DISABLED: OpenMP: false 15 | -------------------------------------------------------------------------------- /test/Frontend/simulation-options/solver.test: -------------------------------------------------------------------------------- 1 | // RUN: marco -mc1 -init-only | FileCheck %s --check-prefix="CHECK-DEFAULT" 2 | 3 | // CHECK-DEFAULT-LABEL: [Simulation] 4 | // CHECK-DEFAULT: Solver: forwardEuler 5 | 6 | // RUN: marco -mc1 -init-only --solver=euler-forward | FileCheck %s --check-prefix="CHECK-EULER-FORWARD" 7 | 8 | // CHECK-EULER-FORWARD-LABEL: [Simulation] 9 | // CHECK-EULER-FORWARD: Solver: euler-forward 10 | 11 | // RUN: marco -mc1 -init-only --solver=ida | FileCheck %s --check-prefix="CHECK-IDA" 12 | 13 | // CHECK-IDA-LABEL: [Simulation] 14 | // CHECK-IDA: Solver: ida 15 | -------------------------------------------------------------------------------- /test/Integration/OMC/lit.local.cfg: -------------------------------------------------------------------------------- 1 | import sys 2 | import lit.util 3 | 4 | from lit.llvm import llvm_config 5 | 6 | if "omc" not in config.available_features: 7 | config.unsupported = True 8 | -------------------------------------------------------------------------------- /test/Integration/OMC/no-extra-args.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s -o - --model=Test -emit-base-modelica | FileCheck %s 2 | 3 | // CHECK: model 'Test' 4 | // CHECK-NEXT: Real 'x'(fixed = true, start = 0.0); 5 | // CHECK-NEXT: equation 6 | // CHECK-NEXT: 'x' = 1.0 - der('x'); 7 | // CHECK-NEXT: end 'Test'; 8 | 9 | model Test 10 | Real x(fixed = true, start = 0); 11 | equation 12 | x = 1 - der(x); 13 | end Test; 14 | -------------------------------------------------------------------------------- /test/Integration/OMC/no-scalarize.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s -o - --model=Test -Xomc=-d=nonfScalarize -emit-base-modelica | FileCheck %s 2 | 3 | // CHECK: model 'Test' 4 | // CHECK-NEXT: Real[10] 'x'(each fixed = true, each start = 0.0); 5 | // CHECK-NEXT: equation 6 | // CHECK-NEXT: for 'i' in 1:10 loop 7 | // CHECK-NEXT: 'x'['i'] = 1.0 - der('x'['i']); 8 | // CHECK-NEXT: end for; 9 | // CHECK-NEXT: end 'Test'; 10 | 11 | model Test 12 | Real[10] x(each fixed = true, each start = 0); 13 | equation 14 | for i in 1:10 loop 15 | x[i] = 1 - der(x[i]); 16 | end for; 17 | end Test; 18 | -------------------------------------------------------------------------------- /test/ParserError/calls/function_builtin.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown function identifier sze. Did you mean size? 4 | 5 | function sizeDimension 6 | input Real[:,:] x; 7 | input Integer n; 8 | output Integer[2] y; 9 | algorithm 10 | y := sze(x, n); 11 | end sizeDimension; 12 | -------------------------------------------------------------------------------- /test/ParserError/calls/function_custom.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown function identifier foO. Did you mean foo? 4 | 5 | function foo 6 | input Integer[:] x; 7 | output Integer[:,:] y; 8 | algorithm 9 | y := diagonal(x); 10 | end foo; 11 | 12 | function bar 13 | input Integer[:] x; 14 | output Integer[:,:] y; 15 | algorithm 16 | y := foO(x); 17 | end bar; 18 | 19 | -------------------------------------------------------------------------------- /test/ParserError/fields/field_assignment.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown field identifier fild. Did you mean field? 4 | 5 | record RECORD 6 | Real field; 7 | end RECORD; 8 | 9 | function Foo 10 | input RECORD x; 11 | output Real y; 12 | algorithm 13 | y := x.fild; 14 | end Foo; -------------------------------------------------------------------------------- /test/ParserError/fields/field_scope.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown field identifier fild. Did you mean field? 4 | 5 | record RECORD1 6 | Real field; 7 | end RECORD1; 8 | 9 | record RECORD2 10 | Real fild; 11 | end RECORD2; 12 | 13 | function Foo 14 | input RECORD1 x; 15 | output Real y; 16 | algorithm 17 | y := x.fild; 18 | end Foo; -------------------------------------------------------------------------------- /test/ParserError/fixed_property.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Invalid fixed property for variable x. 4 | 5 | model Test 6 | Boolean e; 7 | Real x(start = 5, fixed = e); 8 | end Test; 9 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/abs.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: abs: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := abs(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/acos.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: acos: expected 1 argument(s) but got 0. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := acos(); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/asin.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: asin: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := asin(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/atan.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: atan: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := atan(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/atan2.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: atan2: expected 2 argument(s) but got 1. 4 | 5 | function foo 6 | input Real y; 7 | input Real x; 8 | output Real z; 9 | algorithm 10 | z := atan2(y); 11 | end foo; 12 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/ceil.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: ceil: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := ceil(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/cos.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: cos: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := cos(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/cosh.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: cosh: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := cosh(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/custom_function.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: foo: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := x; 10 | end foo; 11 | 12 | function bar 13 | input Real x; 14 | output Real y; 15 | algorithm 16 | y := foo(x, x); 17 | end bar; 18 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/diagonal.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: diagonal: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Integer[:] x; 7 | output Integer[:,:] y; 8 | algorithm 9 | y := diagonal(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/div.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: div: expected 2 argument(s) but got 3. 4 | function foo 5 | input Integer x; 6 | input Integer y; 7 | output Integer z; 8 | algorithm 9 | z := div(x, y, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/exp.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: exp: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := exp(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/floor.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: floor: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := floor(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/identity.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: identity: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Integer x; 7 | output Integer[:,:] y; 8 | algorithm 9 | y := identity(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/integer.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: integer: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := integer(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/linspace.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: linspace: expected 3 argument(s) but got 1. 4 | 5 | function foo 6 | input Integer start; 7 | input Integer stop; 8 | input Integer n; 9 | output Real[:] y; 10 | algorithm 11 | y := linspace(start); 12 | end foo; 13 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/log.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: log: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := log(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/log10.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: log10: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := log10(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/max.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: max: expected between 1 and 2 argument(s) but got 3. 4 | 5 | function foo 6 | input Real x; 7 | input Real y; 8 | output Real z; 9 | algorithm 10 | z := max(x, y, x); 11 | end foo; 12 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/min.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: min: expected between 1 and 2 argument(s) but got 0. 4 | 5 | function foo 6 | input Real x; 7 | input Real y; 8 | output Real z; 9 | algorithm 10 | z := min(); 11 | end foo; 12 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/mod.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: mod: expected 2 argument(s) but got 1. 4 | 5 | function foo 6 | input Integer x; 7 | input Integer y; 8 | output Integer z; 9 | algorithm 10 | z := mod(x); 11 | end foo; 12 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/ndims.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: ndims: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Integer[:,:] x; 7 | output Integer y; 8 | algorithm 9 | y := ndims(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/ones.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: ones: expected at least 1 argument(s) but got 0. 4 | 5 | function foo 6 | input Integer n1; 7 | input Integer n2; 8 | output Real[:] y; 9 | algorithm 10 | y := ones(); 11 | end foo; 12 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/product.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: product: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Integer[:] x; 7 | output Integer y; 8 | algorithm 9 | y := product(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/rem.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: rem: expected 2 argument(s) but got 1. 4 | 5 | function foo 6 | input Integer x; 7 | input Integer y; 8 | output Integer z; 9 | algorithm 10 | z := rem(x); 11 | end foo; 12 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/sign.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: sign: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := sign(x, x); 10 | end foo; -------------------------------------------------------------------------------- /test/ParserError/num_arguments/sin.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: sin: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := sin(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/sinh.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: sinh: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := sinh(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/size.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: size: expected between 1 and 2 argument(s) but got 0. 4 | 5 | function sizeArray 6 | input Real[:,:] x; 7 | output Integer[2] y; 8 | algorithm 9 | y := size(); 10 | end sizeArray; -------------------------------------------------------------------------------- /test/ParserError/num_arguments/size_2.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: size: expected between 1 and 2 argument(s) but got 3. 4 | 5 | function sizeDimension 6 | input Real[:,:] x; 7 | input Integer n; 8 | output Integer[2] y; 9 | algorithm 10 | y := size(x, n, x); 11 | end sizeDimension; 12 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/sqrt.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: sqrt: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := sqrt(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/sum.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: sum: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Integer[:] x; 7 | output Integer y; 8 | algorithm 9 | y := sum(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/symmetric.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: symmetric: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Integer[:,:] x; 7 | output Integer[:,:] y; 8 | algorithm 9 | y := symmetric(x, x); 10 | end foo; -------------------------------------------------------------------------------- /test/ParserError/num_arguments/tan.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: tan: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := tan(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/tanh.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: tanh: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Real x; 7 | output Real y; 8 | algorithm 9 | y := tanh(x, x); 10 | end foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/num_arguments/transpose.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: transpose: expected 1 argument(s) but got 2. 4 | 5 | function foo 6 | input Integer[:,:] x; 7 | output Integer[:,:] y; 8 | algorithm 9 | y := transpose(x, x); 10 | end foo; -------------------------------------------------------------------------------- /test/ParserError/num_arguments/zeros.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: zeros: expected at least 1 argument(s) but got 0. 4 | 5 | function foo 6 | input Integer n1; 7 | input Integer n2; 8 | output Real[:] y; 9 | algorithm 10 | y := zeros(); 11 | end foo; 12 | -------------------------------------------------------------------------------- /test/ParserError/types_classes/class_custom.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown type or class identifier RECRD. Did you mean RECORD? 4 | 5 | record RECORD 6 | Real x; 7 | end RECORD; 8 | 9 | function Foo 10 | input RECRD r; 11 | output Real x; 12 | algorithm 13 | x := r.x; 14 | end Foo; 15 | -------------------------------------------------------------------------------- /test/ParserError/types_classes/class_custom_scope.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown type or class identifier Model1. Did you mean Model2? 4 | 5 | package A 6 | model Model1 7 | parameter Integer par; 8 | end Model1; 9 | end A; 10 | 11 | package B 12 | record Model2 13 | Real x; 14 | end Model2; 15 | 16 | function foo 17 | input Model1 m; 18 | output Integer y; 19 | algorithm 20 | y := m.par; 21 | end foo; 22 | end B; -------------------------------------------------------------------------------- /test/ParserError/types_classes/type_builtin.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown type or class identifier Rel. Did you mean Real? 4 | 5 | function Foo 6 | input Rel x; 7 | output Real y; 8 | algorithm 9 | y := x; 10 | end Foo; 11 | -------------------------------------------------------------------------------- /test/ParserError/variables/function_argument.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown variable identifier argument. Did you mean argument1? 4 | 5 | function foo 6 | input Integer[:] x; 7 | output Integer[:,:] y; 8 | algorithm 9 | y := diagonal(x); 10 | end foo; 11 | 12 | function bar 13 | input Integer[:] argument1; 14 | output Integer[:,:] y; 15 | algorithm 16 | y := foo(argument); 17 | end bar; 18 | 19 | -------------------------------------------------------------------------------- /test/ParserError/variables/if_statement.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown variable identifier inpt_var. Did you mean input_var? 4 | 5 | function Test 6 | input Real input_var; 7 | output Real output_var; 8 | algorithm 9 | if inpt_var == 0 then 10 | output_var := 1; 11 | end if; 12 | end Test; 13 | -------------------------------------------------------------------------------- /test/ParserError/variables/loop.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown variable identifier variale. Did you mean variable? 4 | 5 | model AccessesDependingOnIndices 6 | Real[3, 4] x; 7 | Real variable; 8 | equation 9 | for i in 1:3 loop 10 | for j in 1:4 loop 11 | der(x[i, j]) = 2 * der(x[2, 2]) - variale; 12 | end for; 13 | end for; 14 | end AccessesDependingOnIndices; 15 | -------------------------------------------------------------------------------- /test/ParserError/variables/loop_index.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown variable identifier id1. Did you mean idx1? 4 | 5 | model AccessesDependingOnIndices 6 | Real[3, 4] x; 7 | Real variable; 8 | equation 9 | for idx1 in 1:3 loop 10 | for idx2 in 1:4 loop 11 | der(x[id1, idx2]) = 2 * der(x[2, 2]) - 4; 12 | end for; 13 | end for; 14 | end AccessesDependingOnIndices; 15 | -------------------------------------------------------------------------------- /test/ParserError/variables/model_attribute.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown variable identifier att. Did you mean attr? 4 | 5 | model Test 6 | Real attr; 7 | Real x(start = att); 8 | end Test; 9 | -------------------------------------------------------------------------------- /test/ParserError/variables/record_attribute.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown variable identifier fooo. Did you mean foo? 4 | 5 | model M 6 | record R 7 | Real x; 8 | Real y; 9 | end R; 10 | 11 | Real foo; 12 | 13 | R[3] r(x(start = {fooo, 2.0, 3.0}), y(start = {4.0, 5.0, 6.0})); 14 | end M; 15 | -------------------------------------------------------------------------------- /test/ParserError/variables/variable_scope.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown variable identifier input_var. Did you mean input_var2? 4 | 5 | function Test1 6 | input Real input_var; 7 | output Real output_var; 8 | algorithm 9 | output_var := input_var; 10 | end Test1; 11 | 12 | function Test2 13 | input Real input_var2; 14 | output Real output_var2; 15 | algorithm 16 | output_var2 := input_var; 17 | end Test2; 18 | -------------------------------------------------------------------------------- /test/ParserError/variables/variable_simple.mo: -------------------------------------------------------------------------------- 1 | // RUN: not marco -mc1 %s --omc-bypass -emit-mlir -o - 2>&1 | FileCheck %s 2 | 3 | // CHECK: Unknown variable identifier inpt_var. Did you mean input_var? 4 | 5 | function Test2 6 | input Real input_var; 7 | output Real output_var; 8 | algorithm 9 | output_var := inpt_var; 10 | end Test2; 11 | -------------------------------------------------------------------------------- /test/Simulation/euler-forward/cycle-with-derivative.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=CycleWithDerivative --solver=euler-forward -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=0.2 --time-step=0.1 --precision=6 | FileCheck %s 3 | 4 | // CHECK: "time","x","y" 5 | // CHECK: 0.000000,0.000000,1.000000 6 | // CHECK: 0.200000,0.600000,1.000000 7 | 8 | model CycleWithDerivative 9 | Real x(start = 0, fixed = true); 10 | Real y; 11 | equation 12 | der(x) + y = 4; 13 | der(x) - y = 2; 14 | end CycleWithDerivative; 15 | -------------------------------------------------------------------------------- /test/Simulation/euler-forward/cycle-with-multiple-dependencies.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=M1 --solver=euler-forward -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=0.2 --time-step=0.1 --precision=6 | FileCheck %s 3 | 4 | // CHECK: "time","x","y","z" 5 | // CHECK: 0.000000,-3.000000,-17.000000,2.000000 6 | // CHECK: 0.200000,-3.000000,-17.000000,2.000000 7 | 8 | model M1 9 | Real x; 10 | Real y; 11 | Real z; 12 | equation 13 | x = y + z + 12; 14 | y = 5 * x - 2; 15 | z = -2 * x - 4; 16 | end M1; 17 | -------------------------------------------------------------------------------- /test/Simulation/euler-forward/cycle-with-scalar-explicit-equations.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=M1 --solver=euler-forward -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=0.2 --time-step=0.1 --precision=6 | FileCheck %s 3 | 4 | // CHECK: "time","x","y","z" 5 | // CHECK: 0.000000,-0.500000,3.500000,-1.500000 6 | // CHECK: 0.200000,-0.500000,3.500000,-1.500000 7 | 8 | model M1 9 | Real x; 10 | Real y; 11 | Real z; 12 | equation 13 | x = y - 4; 14 | y = 2 - z; 15 | z = 3 * x; 16 | end M1; 17 | -------------------------------------------------------------------------------- /test/Simulation/euler-forward/equation-with-induction-variable-in-expression.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=InductionInExpression --solver=euler-forward -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=1 --time-step=0.1 --precision=6 | FileCheck %s 3 | 4 | // CHECK: "time","x[1]","x[2]","x[3]" 5 | // CHECK: 0.000000,1.000000,2.000000,3.000000 6 | // CHECK: 1.000000,2.000000,3.000000,4.000000 7 | 8 | model InductionInExpression 9 | Real[3] x; 10 | equation 11 | for i in 1:3 loop 12 | x[i] = i + time; 13 | end for; 14 | end InductionInExpression; 15 | -------------------------------------------------------------------------------- /test/Simulation/euler-forward/simple-first-order.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=SimpleFirstOrder --solver=euler-forward -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=1 --time-step=0.1 --precision=6 | FileCheck %s 3 | 4 | // CHECK: "time","x" 5 | // CHECK: 0.000000,0.000000 6 | // CHECK: 1.000000,0.651322 7 | 8 | model SimpleFirstOrder 9 | Real x(start = 0, fixed = true); 10 | equation 11 | der(x) = 1 - x; 12 | end SimpleFirstOrder; 13 | -------------------------------------------------------------------------------- /test/Simulation/euler-forward/time-usage.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=TimeUsage --solver=euler-forward -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=1 --time-step=0.1 --precision=6 | FileCheck %s 3 | 4 | // CHECK: "time","x","y" 5 | // CHECK: 0.000000,0.000000,0.000000 6 | // CHECK: 1.000000,-0.506366,0.023282 7 | 8 | model TimeUsage 9 | Real x; 10 | Real y(start = 0, fixed = true); 11 | equation 12 | x = sin(time * 100); 13 | der(y) = x; 14 | end TimeUsage; 15 | -------------------------------------------------------------------------------- /test/Simulation/ida/cycle-with-all-implicit-equations.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=CycleWithAllImplicitEquations --solver=ida -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=0.2 --time-step=0.1 --precision=4 | FileCheck %s 3 | 4 | // CHECK: "time","x","y" 5 | // CHECK: 0.0000,0.7854,0.7854 6 | // CHECK: 0.2000,0.7854,0.7854 7 | 8 | model CycleWithAllImplicitEquations 9 | Real x(start = 0, fixed = false); 10 | Real y(start = 0, fixed = false); 11 | equation 12 | x + cos(x) = y + sin(y); 13 | x + x*x = y + y*y; 14 | end CycleWithAllImplicitEquations; 15 | -------------------------------------------------------------------------------- /test/Simulation/ida/cycle-with-implicit-equation.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=CycleWithImplicitEquation --solver=ida -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=1 --time-step=0.1 --precision=4 | FileCheck %s 3 | 4 | // CHECK: "time","x","y" 5 | // CHECK: 0.0000,-0.6640,-1.1878 6 | // CHECK: 1.0000,-0.6640,-1.1878 7 | 8 | model CycleWithImplicitEquation 9 | Real x(start = -0.7, fixed = false); 10 | Real y(start = -0.7, fixed = false); 11 | equation 12 | x * x + y * y + x + y = 0; 13 | x * x * y + x = y; 14 | end CycleWithImplicitEquation; 15 | -------------------------------------------------------------------------------- /test/Simulation/ida/implicit-equation.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=ImplicitEquation --solver=ida -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=1 --time-step=0.1 --precision=4 | FileCheck %s 3 | 4 | // CHECK: "time","x" 5 | // CHECK: 0.0000,1.7392 6 | // CHECK: 1.0000,1.7392 7 | 8 | model ImplicitEquation 9 | Real x(start = 0, fixed = false); 10 | equation 11 | x + x * x * x = 7.0; 12 | end ImplicitEquation; 13 | -------------------------------------------------------------------------------- /test/Simulation/ida/implicit-kepler.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=ImplicitKepler --solver=ida -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=1 --time-step=0.1 --precision=4 | FileCheck %s 3 | 4 | // CHECK: "time","x[1]","x[2]" 5 | // CHECK: 0.0000,3.6577,3.6577 6 | // CHECK: 1.0000,3.6577,3.6577 7 | 8 | model ImplicitKepler 9 | Real[2] x(each start = 3.6, fixed = false); 10 | equation 11 | for i in 1:2 loop 12 | 5.0 = x[i] - 2.72 * sin(x[i]); 13 | end for; 14 | end ImplicitKepler; 15 | -------------------------------------------------------------------------------- /test/Simulation/ida/lit.local.cfg: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | if "runtime-ida" not in config.available_features: 4 | config.unsupported = True 5 | -------------------------------------------------------------------------------- /test/Simulation/ida/scalar-variables-substitution.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=ScalarVariablesSubstitution --solver=ida -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=1 --time-step=0.1 --precision=4 | FileCheck %s 3 | 4 | // CHECK: "time","x","y" 5 | // CHECK: 0.0000,0.0000,2.0000 6 | // CHECK: 1.0000,2.0000,2.0000 7 | 8 | model ScalarVariablesSubstitution 9 | Real x(start = 0, fixed = true); 10 | Real y; 11 | equation 12 | der(x) = y; 13 | y = 2.0; 14 | end ScalarVariablesSubstitution; 15 | -------------------------------------------------------------------------------- /test/Simulation/ida/time-usage.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=TimeUsage --solver=ida -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=1 --time-step=0.1 --precision=4 | FileCheck %s 3 | 4 | // CHECK: "time","x" 5 | // CHECK: 0.0000,0.0000 6 | // CHECK: 1.0000,0.5000 7 | 8 | model TimeUsage 9 | Real x(start = 0, fixed = true); 10 | equation 11 | der(x) = time; 12 | end TimeUsage; 13 | -------------------------------------------------------------------------------- /test/Simulation/lit.local.cfg: -------------------------------------------------------------------------------- 1 | import sys 2 | import lit.util 3 | 4 | from lit.llvm import llvm_config 5 | 6 | if "runtime-library" not in config.available_features: 7 | config.unsupported = True 8 | -------------------------------------------------------------------------------- /test/Simulation/runge-kutta/euler-backward.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=Test --solver=rk-euler-backward -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=1 --time-step=0.1 --precision=6 | FileCheck %s 3 | 4 | // CHECK: "time","x" 5 | // CHECK: 0.000000,0.000000 6 | // CHECK: 1.000000,0.614457 7 | 8 | model Test 9 | Real x(start = 0, fixed = true); 10 | equation 11 | der(x) = 1 - x; 12 | end Test; 13 | -------------------------------------------------------------------------------- /test/Simulation/runge-kutta/euler-forward.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=Test --solver=rk-euler-forward -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=1 --time-step=0.1 --precision=6 | FileCheck %s 3 | 4 | // CHECK: "time","x" 5 | // CHECK: 0.000000,0.000000 6 | // CHECK: 1.000000,0.651322 7 | 8 | model Test 9 | Real x(start = 0, fixed = true); 10 | equation 11 | der(x) = 1 - x; 12 | end Test; 13 | -------------------------------------------------------------------------------- /test/Simulation/runge-kutta/heun-euler.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=Test --solver=rk-heun-euler -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=1 --time-step=0.1 --precision=6 | FileCheck %s 3 | 4 | // CHECK: "time","x" 5 | // CHECK: 0.000000,0.000000 6 | // CHECK: 1.000000,0.631459 7 | 8 | model Test 9 | Real x(start = 0, fixed = true); 10 | equation 11 | der(x) = 1 - x; 12 | end Test; 13 | -------------------------------------------------------------------------------- /test/Simulation/runge-kutta/rk4.mo: -------------------------------------------------------------------------------- 1 | // RUN: marco %s --omc-bypass --model=Test --solver=rk4 -o %basename_t -L %runtime_lib_dir -Wl,-rpath %runtime_lib_dir 2 | // RUN: ./%basename_t --end-time=1 --time-step=0.1 --precision=6 | FileCheck %s 3 | 4 | // CHECK: "time","x" 5 | // CHECK: 0.000000,0.000000 6 | // CHECK: 1.000000,0.632120 7 | 8 | model Test 9 | Real x(start = 0, fixed = true); 10 | equation 11 | der(x) = 1 - x; 12 | end Test; 13 | -------------------------------------------------------------------------------- /tool/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(marco-driver) 2 | add_subdirectory(modelica-opt) 3 | add_subdirectory(modelica-verifier) 4 | -------------------------------------------------------------------------------- /tool/marco-driver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | marco.cpp 3 | marco-cc1.cpp 4 | marco-mc1.cpp) 5 | 6 | set(LLVM_LINK_COMPONENTS 7 | ${LLVM_TARGETS_TO_BUILD} 8 | Core 9 | MC 10 | MCParser 11 | Support) 12 | 13 | marco_add_tool(marco ${SOURCES}) 14 | 15 | target_link_libraries(marco 16 | PRIVATE 17 | marco::frontend 18 | ) 19 | 20 | clang_target_link_libraries(marco 21 | PRIVATE 22 | clangDriver 23 | clangBasic 24 | clangFrontend 25 | clangFrontendTool 26 | ) 27 | -------------------------------------------------------------------------------- /tool/modelica-verifier/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | Verifier.cpp) 3 | 4 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) 5 | 6 | marco_add_tool(modelica-verifier ${SOURCES}) 7 | 8 | get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) 9 | get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS) 10 | get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) 11 | 12 | target_link_libraries(modelica-verifier 13 | PRIVATE ${dialect_libs} 14 | PRIVATE ${extension_libs} 15 | PRIVATE ${conversion_libs} 16 | PRIVATE marco::JIT) 17 | -------------------------------------------------------------------------------- /unittest/AST/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | ArrayTest.cpp 3 | ExpressionTest.cpp 4 | StatementTest.cpp 5 | TupleTest.cpp) 6 | 7 | marco_add_unittest(ASTTest ${SOURCES}) 8 | 9 | marco_link_llvm_libs(ASTTest Core Support) 10 | 11 | target_link_libraries(ASTTest 12 | PRIVATE marco::ast) 13 | -------------------------------------------------------------------------------- /unittest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_custom_target(MARCOUnitTests) 2 | set_target_properties(MARCOUnitTests PROPERTIES FOLDER "MARCO unit tests") 3 | 4 | include(GoogleTest) 5 | 6 | add_subdirectory(AST) 7 | add_subdirectory(Codegen) 8 | add_subdirectory(Dialect) 9 | add_subdirectory(Modeling) 10 | add_subdirectory(Parser) 11 | add_subdirectory(ParserError) 12 | add_subdirectory(VariableFilter) 13 | -------------------------------------------------------------------------------- /unittest/Codegen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Conversion) 2 | -------------------------------------------------------------------------------- /unittest/Codegen/Conversion/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(ModelicaCommon) 2 | -------------------------------------------------------------------------------- /unittest/Codegen/Conversion/ModelicaCommon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | TypeConverterTest.cpp) 3 | 4 | marco_add_unittest(ModelicaCommonConversionTest ${SOURCES}) 5 | 6 | marco_link_llvm_libs(ModelicaCommonConversionTest Core Support) 7 | 8 | target_link_libraries(ModelicaCommonConversionTest 9 | PRIVATE MLIRBaseModelicaCommonConversion 10 | PRIVATE marco::codegen) 11 | -------------------------------------------------------------------------------- /unittest/Dialect/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Modelica) 2 | -------------------------------------------------------------------------------- /unittest/Dialect/Modelica/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | ArrayTypeTest.cpp) 3 | 4 | marco_add_unittest(ModelicaDialectTest ${SOURCES}) 5 | 6 | marco_link_llvm_libs(ModelicaDialectTest Core Support) 7 | 8 | target_link_libraries(ModelicaDialectTest 9 | PRIVATE MLIRBaseModelica) 10 | -------------------------------------------------------------------------------- /unittest/Modeling/Common.cpp: -------------------------------------------------------------------------------- 1 | #include "Common.h" 2 | 3 | namespace marco::test { 4 | mlir::AffineExpr getDimWithOffset(unsigned int dimension, int64_t offset, 5 | mlir::MLIRContext *context) { 6 | mlir::AffineExpr dimExpr = mlir::getAffineDimExpr(dimension, context); 7 | mlir::AffineExpr offsetExpr = mlir::getAffineConstantExpr(offset, context); 8 | return dimExpr + offsetExpr; 9 | } 10 | } // namespace marco::test 11 | -------------------------------------------------------------------------------- /unittest/Modeling/Common.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCO_TEST_MODELING_COMMON_H 2 | #define MARCO_TEST_MODELING_COMMON_H 3 | 4 | #include "mlir/IR/AffineMap.h" 5 | 6 | namespace marco::test { 7 | mlir::AffineExpr getDimWithOffset(unsigned int dimension, int64_t offset, 8 | mlir::MLIRContext *context); 9 | } 10 | 11 | #endif // MARCO_TEST_MODELING_COMMON_H 12 | -------------------------------------------------------------------------------- /unittest/Parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | FloatLexerTest.cpp 3 | IntegerLexerTest.cpp 4 | LexerTest.cpp 5 | ParserTest.cpp) 6 | 7 | marco_add_unittest(ParserTest ${SOURCES}) 8 | 9 | marco_link_llvm_libs(ParserTest Core Support) 10 | 11 | target_link_libraries(ParserTest 12 | PRIVATE marco::parser) 13 | -------------------------------------------------------------------------------- /unittest/Parser/IntegerLexerTest.cpp: -------------------------------------------------------------------------------- 1 | #include "marco/Parser/IntegerLexer.h" 2 | #include "gtest/gtest.h" 3 | 4 | using namespace ::marco; 5 | 6 | TEST(IntegerLexer, defaultShouldBeZero) { 7 | IntegerLexer<10> lex; 8 | EXPECT_EQ(lex.get(), 0); 9 | } 10 | 11 | TEST(IntegerLexer, insertionShouldWork) { 12 | IntegerLexer<10> lex; 13 | 14 | lex += 9; 15 | EXPECT_EQ(lex.get(), 9); 16 | 17 | lex += 7; 18 | EXPECT_EQ(lex.get(), 97); 19 | } 20 | -------------------------------------------------------------------------------- /unittest/ParserError/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | EditDistanceTest.cpp) 3 | 4 | marco_add_unittest(ParserErrorTest ${SOURCES}) 5 | 6 | target_link_libraries(ParserErrorTest 7 | PRIVATE marco::Distance) 8 | -------------------------------------------------------------------------------- /unittest/VariableFilter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | VariableFilterTest.cpp) 3 | 4 | marco_add_unittest(VariableFilterTest ${SOURCES}) 5 | 6 | marco_link_llvm_libs(VariableFilterTest Core Support) 7 | 8 | target_link_libraries(VariableFilterTest 9 | PRIVATE marco::variableFilter) 10 | --------------------------------------------------------------------------------