├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── analysis.patch ├── deps.7z ├── docs ├── CMakeLists.txt ├── Doxyfile.all ├── Doxyfile.all.in ├── Reprise │ └── Reprise.chm └── buildhelp.bat ├── include ├── Analysis │ ├── AbstractDepGraph.h │ ├── AliasAnalysis │ │ ├── AliasAnalyzer.h │ │ ├── CallGraphEx.h │ │ ├── DistributionValues.h │ │ ├── ExprAnalyzer.h │ │ ├── MemoryManager.h │ │ ├── PointersTable.h │ │ ├── ProcAnalyzer.h │ │ ├── SetAbstractMemoryCell.h │ │ └── VariablesClassifier.h │ ├── CalculationGraph │ │ ├── CalculationGraph.h │ │ ├── CalculationGraphBase.h │ │ ├── CalculationGraphBuilder.h │ │ └── ExpressionGraph.h │ ├── CallGraph.h │ ├── ComplexOccurrenceAnalysis │ │ └── GrouppedOccurrences.h │ ├── ConsistCheck │ │ ├── Conditions.h │ │ └── IConsistCheckService.h │ ├── ControlFlowGraph.h │ ├── ControlFlowGraphEx.h │ ├── DeadDeclarations.h │ ├── DepGraph │ │ ├── DepGraph.h │ │ ├── DepGraphEx │ │ │ ├── DepGraphEx.h │ │ │ ├── LoopHelpers.h │ │ │ ├── Predicates.h │ │ │ └── Simplifier.h │ │ ├── LoopStruct.h │ │ ├── Status.h │ │ ├── SubProcAnalysis.h │ │ └── id.h │ ├── DominanceFrontierGraph.h │ ├── ExpressionOrder.h │ ├── Frames │ │ ├── BlockNestAnalizer.h │ │ ├── Frame.h │ │ ├── FrameDataSpecification.h │ │ ├── FramesGraph.h │ │ ├── FramesPartitioner.h │ │ ├── IFramesPartitioner.h │ │ ├── IProfiler.h │ │ └── ProfilerBridge.h │ ├── InductionVariables │ │ └── InductionVariables.h │ ├── LatticeGraph │ │ ├── ComplexCondition.h │ │ ├── Correspondence.h │ │ ├── ElemLatticeGraph.h │ │ ├── ExtendedQuast.h │ │ ├── GaussianElimination.h │ │ ├── LatticeGraph.h │ │ ├── LinDataForLatticeGraph.h │ │ ├── LinearLib.h │ │ ├── LoopIndex.h │ │ ├── PIP.h │ │ ├── ParamPoint.h │ │ ├── RationalNumber.h │ │ └── voevodin.h │ ├── LoopsInterchange │ │ └── LoopsInterchangeAnalysis.h │ ├── MinControlEdgeSet.h │ ├── Montego │ │ ├── AliasAnalysis │ │ │ ├── AliasImplementation.h │ │ │ ├── AliasInterface.h │ │ │ ├── AliasTypes.h │ │ │ ├── CanonicalForm.h │ │ │ ├── MemoryCell.h │ │ │ └── SetAbstractMemoryCell2.h │ │ ├── DependenceGraph │ │ │ ├── DependenceGraph.h │ │ │ ├── DependenceGraphArc.h │ │ │ ├── DependenceGraphVertex.h │ │ │ ├── DependenceLevel.h │ │ │ ├── IndexAnalysis.h │ │ │ └── SymbolicAnalysis.h │ │ ├── Loops.h │ │ ├── Occurrence.h │ │ ├── OccurrenceCoeffs.h │ │ ├── OccurrenceContainer.h │ │ └── SafeStatus.h │ ├── ParallelLoops.h │ ├── Profiler │ │ ├── ProfTextBuilder.h │ │ └── Profiler.h │ ├── Renewal │ │ ├── AliasAnalysis │ │ │ └── IAliasAnalysisService.h │ │ ├── Occurrence │ │ │ ├── OccurrenceHelpers.h │ │ │ └── Occurrences.h │ │ └── OccurrenceAnalysis │ │ │ └── IOccurrenceAnalysisService.h │ ├── SSAForm │ │ ├── SSAForm.h │ │ └── VirtualRegistry.h │ ├── Statistics.h │ └── SymbolPredicateFinder.h ├── Backends │ ├── BackendsHub.h │ ├── OutToC │ │ └── OutToC.h │ ├── RepriseToClang │ │ ├── ClangGenerator.h │ │ └── ClangGeneratorTypes.h │ └── RepriseXml │ │ ├── RepriseXml.h │ │ └── RepriseXmlPass.h ├── ClangParser │ ├── ClangGenerator.h │ ├── PragmaHandler.h │ ├── clangParser.h │ └── clangParserSettings.h ├── FrontTransforms │ ├── BaseOperator.h │ ├── C2RPass.h │ ├── CantoToReprise.h │ ├── ExpressionSimplifier.h │ ├── Resolver.h │ └── ResolverPass.h ├── Frontend │ └── Frontend.h ├── GTestIncludeWrapper.h ├── OPS_Core │ ├── Compiler.h │ ├── Console.h │ ├── Core.h │ ├── EntryPoint.h │ ├── Environment.h │ ├── Events.h │ ├── Exceptions.h │ ├── ExternalCompiler.h │ ├── File.h │ ├── Helpers.h │ ├── IO.h │ ├── IniFile.h │ ├── Interfaces │ │ └── ICoreSettingsService.h │ ├── Kernel.h │ ├── Listener.h │ ├── Localization.h │ ├── MemoryHelper.h │ ├── Mixins.h │ ├── OPS_Core.h │ ├── Platform.h │ ├── Plugins │ │ ├── IPlugin.h │ │ ├── PluginManager.h │ │ └── PluginRegistration.h │ ├── Reporting.h │ ├── Serialization.h │ ├── ServiceLocator.h │ ├── StlHelpers.h │ ├── Strings.h │ ├── Template.h │ ├── Threading.h │ ├── Types.h │ ├── Visitor.h │ ├── XmlBuilder.h │ ├── disable_llvm_warnings_begin.h │ ├── disable_llvm_warnings_end.h │ ├── msc_leakcheck.h │ └── xmlsp.h ├── OPS_Stage │ ├── ClangGenerator.h │ ├── Config.h │ ├── GenericWriter.h │ ├── OPS_Stage.h │ ├── Passes.h │ ├── StdStreamWriter.h │ ├── Utils.h │ └── WorkContext.h ├── Reprise │ ├── Canto.h │ ├── Canto │ │ ├── HirCExpressions.h │ │ ├── HirCStatements.h │ │ ├── HirCTypes.h │ │ ├── HirCUtils.h │ │ ├── HirFExpressions.h │ │ └── HirFTypes.h │ ├── Collections.h │ ├── Common.h │ ├── Declarations.h │ ├── Exceptions.h │ ├── Expressions.h │ ├── Layouts.h │ ├── Lifetime.h │ ├── ParserResult.h │ ├── ProgramFragment.h │ ├── Reprise.h │ ├── Service │ │ ├── DeepWalker.h │ │ ├── Marker.h │ │ ├── Service.h │ │ ├── Traversal.h │ │ └── WalkerBase.h │ ├── ServiceFunctions.h │ ├── Statements.h │ ├── Types.h │ ├── Units.h │ └── Utils.h ├── Shared │ ├── Checks.h │ ├── Checks │ │ └── CompositionCheck │ │ │ ├── CompositionCheckObjects.h │ │ │ └── CompositionCheckWalker.h │ ├── ContextNotifier │ │ ├── ContextNotifier.h │ │ ├── ContextObserverBase.h │ │ ├── ContextObserverState.h │ │ ├── ContextObserverStateManager.h │ │ └── IContextObserver.h │ ├── DataShared.h │ ├── ExpressionHelpers.h │ ├── ExpressionOperators.h │ ├── ExpressionPolynomial.h │ ├── LabelsShared.h │ ├── LinearExpressions.h │ ├── LinearExpressionsUtils.h │ ├── LoopShared.h │ ├── NodesCollector.h │ ├── Nullable.h │ ├── ParametricLinearExpressions.h │ ├── PlatformSettings.h │ ├── ProgramContext.h │ ├── ProgramTextBuilder.h │ ├── ReferenceMapper.h │ ├── RepriseClone.h │ ├── ReprisePath.h │ ├── StatementsShared.h │ └── SubroutinesShared.h └── Transforms │ ├── Data │ └── CommonBlockToGlobalVars.h │ ├── DataDistribution │ ├── BlockAffineDataDistribution.h │ ├── BlockAffineDataDistributionParameters.h │ ├── DataDistributionAnalizer.h │ ├── MPI │ │ ├── Block │ │ │ ├── BlockGather.h │ │ │ ├── BlockIndexesProducer.h │ │ │ ├── BlockIteration.h │ │ │ ├── BlockLoopNesting.h │ │ │ ├── BlockScatter.h │ │ │ ├── BlockingDescription.h │ │ │ ├── BlocksHelper.h │ │ │ ├── BufferCopyingBuilder.h │ │ │ └── DistributedIndexBuilder.h │ │ ├── IMPIDataDistributionGather.h │ │ ├── IMPIDataDistributionIteration.h │ │ ├── IMPIDataDistributionScatter.h │ │ ├── IMPISingleAccessAreaProducer.h │ │ ├── MPIDataDistributionGather.h │ │ ├── MPIDataDistributionIteration.h │ │ ├── MPIDataDistributionScatter.h │ │ ├── MPILoopNesting.h │ │ └── MPISingleAccessAreaProducer.h │ └── Shared │ │ ├── BDExceptions.h │ │ ├── BDParameters.h │ │ └── DataDistributionForSharedMemory.h │ ├── Declarations │ ├── CopyDeclarations.h │ ├── GenerateExtern.h │ └── RemoveDeadDeclarations.h │ ├── Helpers │ ├── IsolateFrame │ │ └── IsolateFrame.h │ └── PrepareCadreDeclarations │ │ └── PrepareCadreDeclarations.h │ ├── ITransformation.h │ ├── If │ ├── CanonizeIfGoto │ │ └── CanonizeIfGoto.h │ ├── CollapseIf │ │ └── CollapseIf.h │ ├── IfDistribution │ │ └── IfDistribution.h │ ├── IfExtraction │ │ └── IfExtraction.h │ └── IfSplitting │ │ └── IfSplitting.h │ ├── Loops │ ├── Canonizing │ │ ├── CanonizeFor.h │ │ ├── ConvertLessEqualToLess.h │ │ └── ConvertStructCounter.h │ ├── DependencyElimination │ │ └── DependencyElimination.h │ ├── ExtractInvariant │ │ └── ExtractInvariant.h │ ├── IntToVector │ │ └── IntToVector.h │ ├── LoopCycleOffset │ │ └── LoopCycleOffset.h │ ├── LoopDistribution │ │ └── LoopDistribution.h │ ├── LoopFragmentation │ │ └── LoopFragmentation.h │ ├── LoopFullUnrolling │ │ └── LoopFullUnrolling.h │ ├── LoopFusion │ │ └── LoopFusion.h │ ├── LoopHeaderRemoval │ │ └── LoopHeaderRemoval.h │ ├── LoopInterchange │ │ └── LoopInterchange.h │ ├── LoopNestBlocking │ │ └── LoopNestBlocking.h │ ├── LoopNestUnification │ │ └── LoopNestUnification.h │ ├── LoopNesting │ │ └── LoopNesting.h │ ├── LoopSplitting │ │ └── LoopSplitting.h │ ├── LoopUnrolling │ │ └── LoopUnrolling.h │ ├── RecurrentLoops │ │ ├── RecurrentLoops.h │ │ └── RootScan.h │ ├── StripMining │ │ └── StripMining.h │ ├── TempArrays │ │ └── TempArrays.h │ └── Var2Array │ │ └── Var2Array.h │ ├── MPI │ ├── MPIGlobalsProducer │ │ ├── IMPIGlobalsProducer.h │ │ ├── IMPIRankProducer.h │ │ ├── IMPISizeProducer.h │ │ ├── MPIGlobalsProducer.h │ │ ├── MPIRankProducer.h │ │ └── MPISizeProducer.h │ └── Utils │ │ ├── MPIHelper.h │ │ └── MPIProducerFactory.h │ ├── Scalar │ ├── ArithmeticOperatorExpansion.h │ ├── CommonSubexpressionElimination │ │ └── CommonSubexpressionElimination.h │ ├── ConstantPropagation │ │ └── ConstantPropagation.h │ ├── InductionSubstitution │ │ └── InductionSubstitution.h │ ├── LocalizationScalar │ │ └── LocalizationScalar.h │ ├── SSASubstitutionForward │ │ └── SSASubstitutionForward.h │ ├── Silly │ │ └── SillyTranslationUnit.h │ ├── SubstitutionForward │ │ └── SubstitutionForward.h │ └── SwitchToIf │ │ └── SwitchToIf.h │ ├── Statements │ ├── DeleteUnusedLabels.h │ └── SwapStatements.h │ ├── Subroutines │ ├── DeadSubroutineElimination.h │ ├── FragmentToSubroutine.h │ ├── Inlining.h │ ├── InliningWithSubstitution.h │ └── SubroutineSplitting.h │ ├── TransformArgs.h │ ├── TransformsHub.h │ └── TransformsPasses.h ├── install └── CMakeLists.txt ├── ops.cmake ├── samples └── CMakeLists.txt ├── source ├── 3rd │ ├── README │ └── gtest │ │ ├── gtest-all.cc │ │ ├── gtest.h │ │ └── gtest_main.cc ├── Analysis │ ├── .gitignore │ ├── AbstractDepGraph.cpp │ ├── AliasAnalysis │ │ ├── AliasAnalyzer.cpp │ │ ├── CallGraphEx.cpp │ │ ├── DistributionValues.cpp │ │ ├── ExprAnalyzer.cpp │ │ ├── MemoryManager.cpp │ │ ├── PointersTable.cpp │ │ ├── ProcAnalyzer.cpp │ │ ├── SetAbstractMemoryCell.cpp │ │ ├── VariablesClassifier.cpp │ │ └── testmod │ │ │ ├── main.cpp │ │ │ └── tests │ │ │ └── test.c │ ├── AnalysisPlugin.cpp │ ├── AnalysisPlugin.h │ ├── CMakeLists.txt │ ├── CalculationGraph │ │ ├── CalculationGraph.cpp │ │ ├── CalculationGraphBase.cpp │ │ ├── CalculationGraphBuilder.cpp │ │ ├── restrictions.txt │ │ └── testmods │ │ │ └── testmod1 │ │ │ ├── input │ │ │ └── Program.c │ │ │ └── testmod1.cpp │ ├── CallGraph │ │ └── CallGraph.cpp │ ├── ComplexOccurrenceAnalysis │ │ └── GrouppedOccurrences.cpp │ ├── ConsistCheck │ │ ├── Conditions.cpp │ │ ├── ConsistCheckService.cpp │ │ ├── ConsistCheckService.h │ │ ├── ConsistCheckWalker.cpp │ │ └── ConsistCheckWalker.h │ ├── ControlFlowGraph │ │ └── ControlFlowGraph.cpp │ ├── ControlFlowGraphEx │ │ └── ControlFlowGraphEx.cpp │ ├── DeadDeclarations.cpp │ ├── DepGraph │ │ ├── id.cpp │ │ ├── src │ │ │ ├── DepGraph.cpp │ │ │ ├── DepGraphEx │ │ │ │ ├── DepGraphEx.cpp │ │ │ │ ├── LoopHelpers.cpp │ │ │ │ ├── Predicates.cpp │ │ │ │ └── Simplifier.cpp │ │ │ ├── LoopStruct.cpp │ │ │ └── SubProcAnalysis.cpp │ │ └── testmod │ │ │ ├── test │ │ │ └── test1.c │ │ │ └── testmod.cpp │ ├── DominanceFrontierGraph │ │ ├── DominanceFrontierGraph.cpp │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ ├── Samples │ │ │ ├── LoopNest.cpp │ │ │ └── Straight.cpp │ │ │ └── main.cpp │ ├── ExpressionOrder.cpp │ ├── Frames │ │ ├── BlockNestAnalizer.cpp │ │ ├── FrameDataSpecification.cpp │ │ ├── FramesGraph.cpp │ │ ├── FramesPartitioner.cpp │ │ ├── ProfilerBridge.cpp │ │ └── ProfilerFramesPartitioningWalker.h │ ├── InductionVariables │ │ ├── InductionVariables.cpp │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ ├── Samples │ │ │ ├── Induction.cpp │ │ │ ├── Induction2.cpp │ │ │ └── test.c │ │ │ └── main.cpp │ ├── LatticeGraph │ │ ├── CMakeLists.txt │ │ ├── ComplexCondition.cpp │ │ ├── Correspondence.cpp │ │ ├── CountIntPoints │ │ │ ├── FunctionsVerge.cpp │ │ │ ├── FunctionsVerge.h │ │ │ ├── IOfunctions.cpp │ │ │ ├── IOfunctions.h │ │ │ ├── LLL.cpp │ │ │ ├── LLL.h │ │ │ ├── RationalMatrix.cpp │ │ │ ├── RationalMatrix.h │ │ │ ├── StructuresVerge.h │ │ │ └── testmodCountIntPoints │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── infile.dat │ │ │ │ └── main.cpp │ │ ├── ElemLatticeGraph.cpp │ │ ├── ExtendedQuast.cpp │ │ ├── GaussianElimination.cpp │ │ ├── LatticeGraph.cpp │ │ ├── LinearLib.cpp │ │ ├── LoopIndex.cpp │ │ ├── PIP.cpp │ │ ├── ParamPoint.cpp │ │ ├── RationalNumber.cpp │ │ ├── testmod3 │ │ │ ├── CMakeLists.txt │ │ │ ├── main.cpp │ │ │ └── test │ │ │ │ ├── test1.c │ │ │ │ ├── test2.c │ │ │ │ └── test3.c │ │ ├── testmod4 │ │ │ ├── CMakeLists.txt │ │ │ ├── generated │ │ │ │ ├── Simple.g │ │ │ │ ├── Simple.tokens │ │ │ │ ├── SimpleLexer.cpp │ │ │ │ ├── SimpleLexer.g │ │ │ │ ├── SimpleLexer.h │ │ │ │ ├── SimpleLexer.tokens │ │ │ │ ├── SimpleParser.cpp │ │ │ │ └── SimpleParser.h │ │ │ ├── input │ │ │ └── main.cpp │ │ └── voevodin.cpp │ ├── LoopsInterchange │ │ └── LoopsInterchangeAnalysis.cpp │ ├── MinControlEdgeSet │ │ └── MinControlEdgeSet.cpp │ ├── Montego │ │ ├── AliasAnalysis │ │ │ ├── AliasAnalysisContext.cpp │ │ │ ├── AliasAnalysisContext.h │ │ │ ├── AliasInterface.cpp │ │ │ ├── AliasProcedureAnalyzer.cpp │ │ │ ├── AliasProcedureAnalyzer.h │ │ │ ├── AliasTypes.cpp │ │ │ ├── CanonicalForm.cpp │ │ │ ├── DynamicMemoryAllotmentSearchVisitor.cpp │ │ │ ├── DynamicMemoryAllotmentSearchVisitor.h │ │ │ ├── ExpressionAnalyser.cpp │ │ │ ├── ExpressionAnalyser.h │ │ │ ├── FunctionContext.cpp │ │ │ ├── FunctionContext.h │ │ │ ├── MemoryCell.cpp │ │ │ ├── MemoryCellContainer.cpp │ │ │ ├── MemoryCellContainer.h │ │ │ ├── Navigation.cpp │ │ │ ├── Navigation.h │ │ │ ├── ProgramState.cpp │ │ │ ├── ProgramState.h │ │ │ ├── SetAbstractMemoryCell2.cpp │ │ │ ├── perftest │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── main.cpp │ │ │ │ └── tests │ │ │ │ │ ├── Gazaryan_mainBlock.c │ │ │ │ │ ├── Hirschberg.c │ │ │ │ │ ├── Hirschberg2.c │ │ │ │ │ ├── RevRinaBlock.c │ │ │ │ │ ├── cfg.c │ │ │ │ │ ├── dc │ │ │ │ │ ├── adc.h │ │ │ │ │ ├── adcc.h │ │ │ │ │ ├── dc_inline.c │ │ │ │ │ ├── macrodef.h │ │ │ │ │ ├── npbparams.h │ │ │ │ │ ├── protots.h │ │ │ │ │ └── rbt.h │ │ │ │ │ ├── dc1 │ │ │ │ │ └── dc_inline.c │ │ │ │ │ ├── lbm │ │ │ │ │ ├── config.h │ │ │ │ │ ├── lbm.c │ │ │ │ │ ├── lbm.h │ │ │ │ │ ├── lbm_1d_array.h │ │ │ │ │ ├── main.c │ │ │ │ │ └── main.h │ │ │ │ │ ├── linpackc.new.c │ │ │ │ │ ├── md.c │ │ │ │ │ ├── parallel_block.c │ │ │ │ │ ├── quagga │ │ │ │ │ ├── isis_adjacency.h │ │ │ │ │ ├── isis_spf.c │ │ │ │ │ └── linklist.h │ │ │ │ │ ├── smith.c │ │ │ │ │ └── whetstone.c │ │ │ └── testmod │ │ │ │ ├── AliasAnalysisTester.cpp │ │ │ │ ├── AliasAnalysisTester.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── main.cpp │ │ │ │ └── test │ │ │ │ ├── 100_100_130_cf_a.of │ │ │ │ ├── 470.lbm.c │ │ │ │ ├── compile.bat │ │ │ │ ├── include │ │ │ │ ├── crtdefs.h │ │ │ │ ├── sal.h │ │ │ │ ├── stdio.h │ │ │ │ ├── swprintf.inl │ │ │ │ └── vadefs.h │ │ │ │ ├── setsystemvars.bat │ │ │ │ ├── test1.c │ │ │ │ └── test2.c │ │ ├── DependenceGraph │ │ │ ├── DependenceGraph.cpp │ │ │ ├── DependenceGraphArc.cpp │ │ │ ├── DependenceGraphVertex.cpp │ │ │ ├── DependenceLevel.cpp │ │ │ ├── IndexAnalysis.cpp │ │ │ └── SymbolicAnalysis.cpp │ │ ├── Loops.cpp │ │ ├── OccurSearchVisitor.cpp │ │ ├── OccurSearchVisitor.h │ │ ├── Occurrence.cpp │ │ ├── OccurrenceCoeffs.cpp │ │ ├── OccurrenceContainer.cpp │ │ ├── OccurrenceContainerBuilder.cpp │ │ ├── OccurrenceContainerBuilder.h │ │ └── SafeStatus.cpp │ ├── ParallelLoops │ │ ├── Analysers.cpp │ │ ├── Analysers.h │ │ ├── ParallelLoops.cpp │ │ ├── Privatization.cpp │ │ └── Privatization.h │ ├── Profiler │ │ ├── CMakeLists.txt │ │ ├── ProfTextBuilder.cpp │ │ ├── Profiler.cpp │ │ ├── ProfilingInterprocedural.cpp │ │ ├── ProfilingInterprocedural.h │ │ ├── ProfilingWithinSubroutine.cpp │ │ ├── ProfilingWithinSubroutine.h │ │ ├── UsingPlatformSettings.cpp │ │ ├── UsingPlatformSettings.h │ │ └── testmod │ │ │ ├── Profiler_test.cpp │ │ │ └── samples │ │ │ ├── PlatformSettings.xml │ │ │ └── test.c │ ├── Renewal │ │ ├── AliasAnalysis │ │ │ ├── AliasAnalysisService.cpp │ │ │ ├── AliasAnalysisService.h │ │ │ ├── AliasAnalysisServiceState.h │ │ │ └── IOccurrenceAnalyzerHolder.h │ │ ├── Occurrence │ │ │ ├── OccurrenceHelpers.cpp │ │ │ └── Occurrences.cpp │ │ └── OccurrenceAnalysis │ │ │ ├── OccurrenceAnalysisService.cpp │ │ │ ├── OccurrenceAnalysisService.h │ │ │ └── OccurrenceAnalysisServiceState.h │ ├── SSAForm │ │ ├── SSAForm.cpp │ │ ├── VirtualRegistry.cpp │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ ├── Samples │ │ │ ├── Loop.cpp │ │ │ ├── LoopNest.cpp │ │ │ ├── Straight.cpp │ │ │ └── goto continue break.cpp │ │ │ └── main.cpp │ ├── Statistics.cpp │ └── SymbolPredicateFinder │ │ └── SymbolPredicateFinder.cpp ├── Backends │ ├── BackendsHub.cpp │ ├── BackendsPlugin.cpp │ ├── BackendsPlugin.h │ ├── CMakeLists.txt │ ├── OutToC │ │ └── OutToC.cpp │ ├── RepriseToClang │ │ ├── ClangExpressions.cpp │ │ ├── ClangExpressions.h │ │ ├── ClangGenerator.cpp │ │ ├── ClangGeneratorTypes.cpp │ │ ├── ClangStatements.cpp │ │ ├── ClangStatements.h │ │ ├── ClangTypes.cpp │ │ ├── ClangTypes.h │ │ ├── ClangWalker.cpp │ │ ├── ClangWalker.h │ │ ├── R2CDeclNodes.h │ │ ├── RepriseClangifier.cpp │ │ ├── RepriseClangifier.h │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ └── R2Clang_main.cpp │ └── RepriseXml │ │ ├── RepriseXml.cpp │ │ └── RepriseXmlPass.cpp ├── CMakeLists.txt ├── ClangParser │ ├── .gitignore │ ├── AST2RepriseConsumers.cpp │ ├── AST2RepriseConsumers.h │ ├── CMakeLists.txt │ ├── ClangGenerator.cpp │ ├── ClangParserPlugin.cpp │ ├── ClangParserPlugin.h │ ├── PragmaHandler.cpp │ ├── README │ ├── RepriseDiagnosticClient.cpp │ ├── RepriseDiagnosticClient.h │ ├── clangParser.cpp │ ├── clangParserRepriseFacade.cpp │ ├── clangParserSettings.cpp │ └── lib │ │ └── clang │ │ └── 1.1 │ │ └── include │ │ ├── assert.h │ │ ├── crtdefs.h │ │ ├── ctype.h │ │ ├── emmintrin.h │ │ ├── float.h │ │ ├── io.h │ │ ├── iso646.h │ │ ├── limits.h │ │ ├── mbctype.h │ │ ├── mm_malloc.h │ │ ├── mmintrin.h │ │ ├── pmmintrin.h │ │ ├── sal.h │ │ ├── stdarg.h │ │ ├── stdbool.h │ │ ├── stddef.h │ │ ├── stdint.h │ │ ├── stdio.h │ │ ├── stdlib.h │ │ ├── string.h │ │ ├── swprintf.inl │ │ ├── tgmath.h │ │ ├── tmmintrin.h │ │ ├── vadefs.h │ │ └── xmmintrin.h ├── FrontTransforms │ ├── C2RPass.cpp │ ├── CMakeLists.txt │ ├── CantoToReprise │ │ └── CantoToReprise.cpp │ ├── ExprOptimization │ │ ├── Accessors.h │ │ ├── BasicTypesHelper.cpp │ │ ├── BasicTypesHelper.h │ │ ├── BinaryOperators.cpp │ │ ├── BinaryOperators.h │ │ ├── Exceptions.h │ │ ├── ExpressionSimplifier.cpp │ │ ├── LiteralTypesLists.h │ │ ├── NullType.h │ │ ├── Operators.h │ │ ├── TypeManip.h │ │ ├── Typelist.h │ │ ├── TypelistMacros.h │ │ ├── UnaryOperations.h │ │ ├── UnaryOperators.cpp │ │ └── UnaryOperators.h │ ├── FrontTransformationsPlugin.cpp │ ├── FrontTransformationsPlugin.h │ ├── Resolver.cpp │ └── ResolverPass.cpp ├── Frontend │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Frontend.cpp │ ├── FrontendPlugin.cpp │ └── FrontendPlugin.h ├── OPS_Core │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Console.cpp │ ├── Core.cpp │ ├── CoreSettingsService.cpp │ ├── CoreSettingsService.h │ ├── EntryPoint.cpp │ ├── Exceptions.cpp │ ├── ExternalCompiler.cpp │ ├── File.cpp │ ├── IO.cpp │ ├── IniFile.cpp │ ├── Kernel.cpp │ ├── Listener.cpp │ ├── Mixins.cpp │ ├── Plugins │ │ ├── PluginManager.cpp │ │ ├── PluginRegistry.cpp │ │ └── PluginRegistry.h │ ├── Reporting.cpp │ ├── Serialization.cpp │ ├── ServiceLocator.cpp │ ├── Strings.cpp │ ├── Template.cpp │ ├── Threading.cpp │ ├── Threading_Platform_Unix.cpp │ ├── Threading_Platform_Win.cpp │ ├── XmlBuilder.cpp │ └── xmlsp.cpp ├── OPS_Stage │ ├── CMakeLists.txt │ ├── ClangGenerator.cpp │ ├── Config.cpp │ ├── Passes.cpp │ ├── StdStreamWriter.cpp │ ├── Utils.cpp │ ├── WorkContext.cpp │ └── testmod │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ └── main.cpp ├── Reprise │ ├── .gitignore │ ├── C2R_test │ │ ├── C2R_test.cpp │ │ └── CMakeLists.txt │ ├── CMakeLists.txt │ ├── Canto │ │ ├── HirCExpressions.cpp │ │ ├── HirCStatements.cpp │ │ ├── HirCTypes.cpp │ │ ├── HirCUtils.cpp │ │ ├── HirFExpressions.cpp │ │ └── HirFTypes.cpp │ ├── Common.cpp │ ├── Declarations.cpp │ ├── Doxyfile.in │ ├── Expressions.cpp │ ├── Layouts.cpp │ ├── Lifetime.cpp │ ├── ProgramFragment.cpp │ ├── Service │ │ ├── DeepWalker.cpp │ │ ├── Marker.cpp │ │ ├── Traversal.cpp │ │ └── WalkerBase.cpp │ ├── ServiceFunctions.cpp │ ├── Statements.cpp │ ├── Types.cpp │ ├── Units.cpp │ ├── Utils.cpp │ └── testmod │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── FullUnrollFor.cpp │ │ ├── NodeCollector.h │ │ ├── StatementsList.cpp │ │ ├── TestCollections.cpp │ │ ├── Tests.h │ │ ├── TrackPtrTest.cpp │ │ ├── c2r.cpp │ │ ├── c2r.h │ │ ├── main.cpp │ │ ├── out │ │ ├── test_eval.c │ │ └── test_for_unroll.c │ │ └── tests │ │ ├── C2R │ │ └── MI2SB │ │ │ └── DefaultParamValue.c │ │ ├── Lamport2.c │ │ ├── Lamport2.f │ │ ├── expr_conversion.c │ │ └── fullhouse.c ├── Shared │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Checks │ │ └── CompositionCheck │ │ │ ├── CompositionCheckObjects.cpp │ │ │ └── CompositionCheckWalker.cpp │ ├── ContextNotifier │ │ ├── ContextNotifier.cpp │ │ ├── ContextObserverBase.cpp │ │ ├── ContextObserverState.cpp │ │ └── ContextObserverStateManager.cpp │ ├── DataShared │ │ ├── DataShared.cpp │ │ └── DataSharedDeepWalkers.h │ ├── ExpressionHelpers │ │ ├── ExpressionHelpers.cpp │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ ├── main.cpp │ │ │ └── tests │ │ │ └── test1.c │ ├── ExpressionsReduction │ │ └── ExpressionPolynomial.cpp │ ├── LabelsShared │ │ ├── LabelsShared.cpp │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ ├── main.cpp │ │ │ └── tests │ │ │ └── test1.c │ ├── LinearExpressions │ │ ├── LinearExpressions.cpp │ │ ├── LinearExpressionsUtils.cpp │ │ └── ParametricLinearExpressions.cpp │ ├── LoopShared │ │ ├── LoopShared.cpp │ │ └── LoopSharedDeepWalkers.h │ ├── PlatformSettings │ │ └── PlatformSettings.cpp │ ├── ProgramContext.cpp │ ├── ProgramTextBuilder.cpp │ ├── ReadMe.txt │ ├── ReferenceMapper.cpp │ ├── RepriseClone.cpp │ ├── ReprisePath.cpp │ ├── StatementsShared │ │ ├── StatementsShared.cpp │ │ └── StatementsSharedDeepWalkers.h │ ├── SubroutinesShared │ │ ├── SubroutinesShared.cpp │ │ └── SubroutinesSharedDeepWalkers.h │ └── testmod │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ └── tests │ │ └── testLinearExpressions.c └── Transforms │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Data │ └── CommonBlockToGlobalVars.cpp │ ├── DataDistribution │ ├── BlockAffineDataDistribution.cpp │ ├── BlockAffineDataDistributionParameters.cpp │ ├── DataDistributionAnalizer.cpp │ ├── DataDistributionDeepWalkers.h │ ├── MPI │ │ ├── Block │ │ │ ├── BlockGather.cpp │ │ │ ├── BlockIndexesProducer.cpp │ │ │ ├── BlockIteration.cpp │ │ │ ├── BlockLoopNesting.cpp │ │ │ ├── BlockScatter.cpp │ │ │ ├── BlockingDescription.cpp │ │ │ ├── BlocksHelper.cpp │ │ │ ├── BufferCopyingBuilder.cpp │ │ │ └── DistributedIndexBuilder.cpp │ │ ├── MPIDataDistributionGather.cpp │ │ ├── MPIDataDistributionIteration.cpp │ │ ├── MPIDataDistributionScatter.cpp │ │ ├── MPILoopNesting.cpp │ │ └── MPISingleAccessAreaProducer.cpp │ ├── ReferencesFinder.h │ └── Shared │ │ ├── ArrayDistributionInfo.cpp │ │ ├── BDParameters.cpp │ │ ├── ChangeIndexesVisitor.cpp │ │ ├── ChangeIndexesVisitor.h │ │ ├── DataDistributionForSharedMemory.cpp │ │ ├── DistributedArrayReferenceInfo.cpp │ │ ├── ForStmtTree.cpp │ │ ├── ForStmtTree.h │ │ ├── PragmaInfo.cpp │ │ ├── ReferenceTable.cpp │ │ ├── RenameDistributionArrayVisitor.cpp │ │ ├── RenameDistributionArrayVisitor.h │ │ ├── change_references_algorithms.cpp │ │ ├── include │ │ ├── ArrayDistributionInfo.h │ │ ├── ChangeIndexesVisitor.h │ │ ├── DistributedArrayReferenceInfo.h │ │ ├── ForStmtTree.h │ │ ├── PragmaInfo.h │ │ ├── ReferenceTable.h │ │ ├── RenameDistributionArrayVisitor.h │ │ ├── change_references_algorithms.h │ │ └── shared_helpers.h │ │ ├── shared_helpers.cpp │ │ ├── shared_helpers.h │ │ └── testmod │ │ ├── CMakeLists.txt │ │ └── main.cpp │ ├── Declarations │ ├── CopyDeclarations.cpp │ ├── GenerateExtern.cpp │ └── RemoveDeadDeclarations.cpp │ ├── Helpers │ ├── IsolateFrame │ │ ├── IsolateFrame.cpp │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ ├── Samples │ │ │ ├── sample01.c │ │ │ └── sample02.c │ │ │ └── test.cpp │ └── PrepareCadreDeclarations │ │ └── PrepareCadreDeclarations.cpp │ ├── If │ ├── CMakeLists.txt │ ├── CanonizeIfGoto │ │ └── CanonizeIfGoto.cpp │ ├── CollapseIf │ │ ├── CollapseIf.cpp │ │ └── CollapseIf.h │ ├── IfDistribution │ │ ├── IfDistribution.cpp │ │ ├── IfDistributionDeepWalker.h │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ ├── Samples │ │ │ ├── sample01.c │ │ │ ├── sample02.c │ │ │ ├── sample03.c │ │ │ ├── sample04.c │ │ │ ├── sample05.c │ │ │ ├── sample06.c │ │ │ ├── sample07.c │ │ │ ├── sample08.c │ │ │ ├── sample09.c │ │ │ ├── sample10.c │ │ │ ├── sample11.c │ │ │ ├── sample12.c │ │ │ ├── sample13.c │ │ │ ├── sample14.c │ │ │ └── sample15.c │ │ │ └── main.cpp │ ├── IfExraction │ │ ├── IfExtraction.cpp │ │ ├── IfExtractionDeepWalkers.h │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ ├── Samples │ │ │ └── Sample01.c │ │ │ └── main.cpp │ └── IfSplitting │ │ ├── IfSplitting.cpp │ │ └── testmod │ │ ├── CMakeLists.txt │ │ ├── Samples │ │ ├── sample01.c │ │ ├── sample02.c │ │ ├── sample03.c │ │ ├── sample04.c │ │ ├── sample05.c │ │ ├── sample06.c │ │ └── sample07.c │ │ └── main.cpp │ ├── Loops │ ├── CMakeLists.txt │ ├── Canonizing │ │ ├── CanonizeFor.cpp │ │ ├── ConvertLessEqualToLess.cpp │ │ └── ConvertStructCounter.cpp │ ├── DependencyElimination │ │ └── DependencyElimination.cpp │ ├── ExtractInvariant │ │ └── ExtractInvariant.cpp │ ├── IntToVector │ │ └── IntToVector.cpp │ ├── LoopCycleOffset │ │ ├── LoopCycleOffset.cpp │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ ├── Samples │ │ │ └── sample01.c │ │ │ └── main.cpp │ ├── LoopDistribution │ │ └── LoopDistribution.cpp │ ├── LoopFragmentation │ │ └── LoopFragmentation.cpp │ ├── LoopFullUnrolling │ │ └── LoopFullUnrolling.cpp │ ├── LoopFusion │ │ └── LoopFusion.cpp │ ├── LoopHeaderRemoval │ │ └── LoopHeaderRemoval.cpp │ ├── LoopInterchange │ │ └── LoopInterchange.cpp │ ├── LoopNestBlocking │ │ └── LoopNestBlocking.cpp │ ├── LoopNestUnification │ │ └── LoopNestUnification.cpp │ ├── LoopNesting │ │ └── LoopNesting.cpp │ ├── LoopSplitting │ │ └── LoopSplitting.cpp │ ├── LoopUnrolling │ │ └── LoopUnrolling.cpp │ ├── RecurrentLoops │ │ ├── RecurrentLoops.cpp │ │ └── RootScan.cpp │ ├── StripMining │ │ └── StripMining.cpp │ ├── TempArrays │ │ └── TempArrays.cpp │ └── Var2Array │ │ └── Var2Array.cpp │ ├── MPI │ ├── MPIGlobalsProducer │ │ ├── MPIGlobalsProducer.cpp │ │ ├── MPIGlobalsProducerDeepWalkers.h │ │ ├── MPIRankProducer.cpp │ │ └── MPISizeProducer.cpp │ └── Utils │ │ ├── MPIHelper.cpp │ │ ├── MPIHelperDeepWalkers.h │ │ └── MPIProducerFactory.cpp │ ├── ReadMe.txt │ ├── Scalar │ ├── ArithmeticOperatorExpansion.cpp │ ├── ArithmeticOperatorExpansion │ │ ├── ArithmeticOperatorExpansion.cpp │ │ ├── README │ │ ├── aoe-sr.c │ │ └── aoe-sr.h │ ├── CMakeLists.txt │ ├── CommonSubexpressionElimination │ │ └── CommonSubexpressionElimination.cpp │ ├── ConstantPropagation │ │ ├── ConstantPropagation.cpp │ │ ├── ConstantPropagationWalker.cpp │ │ └── ConstantPropagationWalker.h │ ├── InductionSubstitution │ │ ├── InductionSubstitution.cpp │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ ├── Samples │ │ │ ├── Induction.cpp │ │ │ └── Induction2.cpp │ │ │ └── main.cpp │ ├── LocalizationScalar │ │ └── LocalizationScalar.cpp │ ├── SSASubstitutionForward │ │ ├── SSASubstitutionForward.cpp │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ ├── Silly │ │ └── SillyTranslationUnit.cpp │ ├── SubstitutionForward │ │ ├── SubstitutionForward.cpp │ │ ├── SubstitutionForwardWalker.cpp │ │ ├── SubstitutionForwardWalker.h │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ ├── main.cpp │ │ │ └── tests │ │ │ └── test1.c │ └── SwitchToIf │ │ └── SwitchToIf.cpp │ ├── Statements │ ├── DeleteUnusedLabels.cpp │ └── SwapStatements.cpp │ ├── Subroutines │ ├── DeadSubroutineElimination.cpp │ ├── FragmentToSubroutine │ │ ├── FragmentToSubroutine.cpp │ │ └── testmod │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ ├── Inlining │ │ └── Inlining.cpp │ ├── InliningWithSubstitution.cpp │ └── SubroutineSplitting │ │ └── SubroutineSplitting.cpp │ ├── TransformArgs.cpp │ ├── TransformationsPlugin.cpp │ ├── TransformationsPlugin.h │ ├── TransformsHub.cpp │ └── TransformsPasses.cpp ├── tests └── Reprise │ └── UnitTests │ ├── arithmetic_result_type.c │ ├── array_equal.c │ ├── conditional_result_type.c │ ├── dump_labels.c │ ├── func_ptr_result_type.c │ ├── get_associated_variable.c │ ├── get_result_type.c │ ├── goto_test.c │ ├── negative_test.c │ ├── program_fragment.c │ ├── recursive_structs.c │ ├── struct_access.c │ └── vec_get_result_type.c └── unittests ├── CMakeLists.txt ├── FrontendHelper.h ├── Reprise ├── CollectionsTest.cpp ├── ProgramFragmentTest.cpp └── Reprise.cpp ├── TestArguments.h ├── googletest.proj └── main.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeLists.txt.user* 2 | *~ 3 | .idea/ 4 | *.sublime-project 5 | *.sublime-workspace 6 | 7 | docs/Reprise/Reprise.chw 8 | deps/include/antlr-3.2 9 | deps/include/expat 10 | deps/include/gtest 11 | deps/win32 12 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CMakeLists.txt for OPS5 project 2 | 3 | cmake_minimum_required(VERSION 2.8.7) 4 | 5 | # Add path for custom modules 6 | set( 7 | CMAKE_MODULE_PATH 8 | ${CMAKE_MODULE_PATH} 9 | "${CMAKE_CURRENT_SOURCE_DIR}") 10 | 11 | project(ops) 12 | 13 | include(ops) 14 | 15 | enable_testing() 16 | 17 | add_subdirectory(source) 18 | #add_subdirectory(unittests) 19 | add_subdirectory(docs) 20 | add_subdirectory(samples) 21 | add_subdirectory(install) 22 | 23 | # End of File 24 | -------------------------------------------------------------------------------- /analysis.patch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpsGroup/open-ops/b1ab8da354c4aecc0fe76a562395f5861bffc207/analysis.patch -------------------------------------------------------------------------------- /deps.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpsGroup/open-ops/b1ab8da354c4aecc0fe76a562395f5861bffc207/deps.7z -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(UNIX) 2 | find_package(Doxygen) 3 | elseif(WIN32) 4 | set(DOXYGEN_FOUND 1) 5 | set(DOXYGEN_EXECUTABLE ${CMAKE_BINARY_DIR}/depends/deps/win32/bin/doxygen.exe) 6 | endif() 7 | 8 | if(DOXYGEN_FOUND) 9 | 10 | # Add alldoc target for building dumb documentation for all project 11 | 12 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.all.in" 13 | "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.all" @ONLY) 14 | 15 | add_custom_target(alldoc 16 | COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.all") 17 | 18 | # Add doc target for building smart documentation 19 | 20 | configure_file("${ops_source_root_dir}/source/Reprise/Doxyfile.in" 21 | "${binary_root_dir}/source/Reprise/Doxyfile" @ONLY) 22 | 23 | add_custom_target(doc 24 | COMMAND ${DOXYGEN_EXECUTABLE} "${binary_root_dir}/source/Reprise/Doxyfile" 25 | COMMENT "Generating documentation with with Doxygen" VERBATIM) 26 | 27 | else(DOXYGEN_FOUND) 28 | 29 | message(STATUS "WARNING: Doxygen not found - Documentation will not be created") 30 | 31 | endif(DOXYGEN_FOUND) 32 | -------------------------------------------------------------------------------- /docs/Reprise/Reprise.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpsGroup/open-ops/b1ab8da354c4aecc0fe76a562395f5861bffc207/docs/Reprise/Reprise.chm -------------------------------------------------------------------------------- /docs/buildhelp.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | :: Generation of Reprise Help 3 | ..\deps\win32\bin\doxygen ..\source\Reprise\Doxyfile 4 | cd Reprise\html 5 | ..\..\..\deps\win32\bin\hhc index.hhp 6 | cd ..\.. 7 | 8 | :: Generation of OPS_Core Help 9 | ..\deps\win32\bin\doxygen ..\source\OPS_Core\Doxyfile 10 | cd OPS_Core\html 11 | ..\..\..\deps\win32\bin\hhc index.hhp 12 | cd ..\.. -------------------------------------------------------------------------------- /include/Analysis/ComplexOccurrenceAnalysis/GrouppedOccurrences.h: -------------------------------------------------------------------------------- 1 | #ifndef _GROUPPED_OCCURRENCES_H_INCLUDED_ 2 | #define _GROUPPED_OCCURRENCES_H_INCLUDED_ 3 | 4 | #include 5 | #include 6 | 7 | namespace OPS 8 | { 9 | 10 | namespace Reprise 11 | { 12 | 13 | class ExpressionBase; 14 | class StatementBase; 15 | class VariableDeclaration; 16 | 17 | } 18 | 19 | namespace Analysis 20 | { 21 | 22 | enum GrouppedByType 23 | { 24 | GBT_READ = 0, 25 | GBT_WRITE 26 | }; 27 | 28 | typedef std::list TopLevelOccurrenceList; 29 | typedef std::map 30 | OccurrencesByDeclarations; 31 | 32 | OccurrencesByDeclarations findAllTopLevelOccurrences(const Reprise::StatementBase& statement, 33 | GrouppedByType grouppedBy); 34 | 35 | } 36 | 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/Analysis/DeadDeclarations.h: -------------------------------------------------------------------------------- 1 | #ifndef ANALYSIS_DEADDECLARATIONS_H 2 | #define ANALYSIS_DEADDECLARATIONS_H 3 | 4 | #include 5 | #include "Reprise/Declarations.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Analysis 10 | { 11 | 12 | void obtainUsedDeclarations(const std::list& rootDeclarations, 13 | std::set& usedDeclarations); 14 | 15 | void obtainUsedDeclarations(OPS::Reprise::DeclarationBase* rootDeclaration, 16 | std::set& usedDeclarations); 17 | 18 | } 19 | } 20 | 21 | #endif // ANALYSIS_DEADDECLARATIONS_H 22 | -------------------------------------------------------------------------------- /include/Analysis/DepGraph/Status.h: -------------------------------------------------------------------------------- 1 | #ifndef _STATUS_ 2 | #define _STATUS_ 3 | 4 | namespace DepGraph 5 | { 6 | class Status 7 | { 8 | public: 9 | typedef unsigned int status_t; 10 | 11 | explicit Status(status_t s = 0):status(s){} 12 | // Status(int s):status(s){} 13 | Status(const Status& s):status(s.GetStatusData()){} 14 | Status& operator=(const Status& s){status=s.GetStatusData();return *this;} 15 | void SetStatus(status_t s) { status |= s; } 16 | void SaveStatus(status_t s){ status = s; } 17 | bool isStatus(status_t s) const { return (status & s) != 0; } 18 | void ClearStatus(status_t s) { status &= ~s; } 19 | status_t GetStatusData() const { return status; } 20 | void UnsetStatus(status_t s) { status &= ~s; }//the same as "ClearStatus" 21 | private: 22 | status_t status; 23 | }; 24 | } 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /include/Analysis/ExpressionOrder.h: -------------------------------------------------------------------------------- 1 | #ifndef EXPRESSIONORDER_H 2 | #define EXPRESSIONORDER_H 3 | 4 | #include "Reprise/Expressions.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Analysis 9 | { 10 | 11 | // Возвращает > 0 если выражение first выполняется раньше second 12 | // = 0 если не определено 13 | // < 0 если выражение first выполняется позже second 14 | // Выражения должны принадлежать одному оператору, иначе будет выброшено исключение 15 | int getExpressionOrder(Reprise::ExpressionBase& first, Reprise::ExpressionBase& second); 16 | 17 | } 18 | } 19 | 20 | #endif // EXPRESSIONORDER_H 21 | -------------------------------------------------------------------------------- /include/Analysis/Frames/BlockNestAnalizer.h: -------------------------------------------------------------------------------- 1 | #ifndef BLOCK_NEST_ANALIZER_H_INCLUDED 2 | #define BLOCK_NEST_ANALIZER_H_INCLUDED 3 | 4 | #include "Reprise/Reprise.h" 5 | #include "Transforms/ITransformation.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Analysis 10 | { 11 | namespace Frames 12 | { 13 | using OPS::Reprise::BlockStatement; 14 | using OPS::Reprise::ExpressionBase; 15 | using OPS::Reprise::ForStatement; 16 | using OPS::Reprise::VariableDeclaration; 17 | using OPS::Reprise::ReprisePtr; 18 | 19 | class BlockNestAnalizer: public OPS::NonCopyableMix, public OPS::NonAssignableMix 20 | { 21 | public: 22 | BlockNestAnalizer(ForStatement& outerLoop, int loopNestDepth); 23 | 24 | bool analyse(); 25 | virtual std::string getErrorMessage(); 26 | 27 | private: 28 | void validateAndLookupLoopNestInfo(); 29 | void checkConsistency(); 30 | void checkEquivalency(); 31 | 32 | private: 33 | ForStatement& m_outerLoop; 34 | int m_loopNestDepth; 35 | 36 | std::vector m_nestLoops; 37 | 38 | std::list m_errors; 39 | }; 40 | } 41 | } 42 | } 43 | 44 | #endif // BLOCK_NEST_ANALIZER_H_INCLUDED 45 | -------------------------------------------------------------------------------- /include/Analysis/Frames/Frame.h: -------------------------------------------------------------------------------- 1 | #ifndef FRAME_H_INCLUDED 2 | #define FRAME_H_INCLUDED 3 | 4 | #include 5 | 6 | #include "Reprise/Reprise.h" 7 | 8 | namespace OPS 9 | { 10 | namespace Analysis 11 | { 12 | namespace Frames 13 | { 14 | using OPS::Reprise::ForStatement; 15 | using OPS::Reprise::StatementBase; 16 | 17 | struct Frame 18 | { 19 | typedef std::deque TNodes; 20 | 21 | // Содержимое кадра 22 | TNodes m_Nodes; 23 | 24 | // Число от 0.0 до 1.0, характеризующее объем используемых ресурсов 25 | // 0.0 - ресурсы полностью свободны 26 | // 1.0 - ресурсы полностью заняты 27 | double m_resourceUsage; 28 | 29 | virtual ~Frame() {} 30 | }; 31 | 32 | struct HeaderFrame: public Frame 33 | { 34 | }; 35 | 36 | struct PartitionedByIterationsFrame: public Frame 37 | { 38 | std::map m_partitionedNestIterationsCount; 39 | }; 40 | } 41 | } 42 | } 43 | #endif // FRAME_H_INCLUDED 44 | -------------------------------------------------------------------------------- /include/Analysis/Frames/FramesGraph.h: -------------------------------------------------------------------------------- 1 | #ifndef FRAMES_GRAPH_H_INCLUDED 2 | #define FRAMES_GRAPH_H_INCLUDED 3 | 4 | #include 5 | #include 6 | 7 | #include "Analysis/Frames/Frame.h" 8 | 9 | namespace OPS 10 | { 11 | namespace Analysis 12 | { 13 | namespace Frames 14 | { 15 | using std::map; 16 | using std::set; 17 | 18 | class FramesGraph 19 | { 20 | public: 21 | typedef set FramesCollection; 22 | typedef map AccesssibilityMap; 23 | 24 | public: 25 | FramesGraph(); 26 | 27 | void addNode(Frame* pFrame); 28 | void addEdge(Frame* pBegin, Frame* pEnd); 29 | 30 | void setFirstExecutableNode(Frame* pFirstExecutableNode); 31 | void setLastExecutableNodes(FramesCollection& lastExecutableNodes); 32 | 33 | Frame* getFirstExecutableNode(); 34 | FramesCollection getLastExecutableNodes(); 35 | 36 | FramesCollection getNodes(); 37 | AccesssibilityMap getAccesssibilityMap(); 38 | 39 | private: 40 | AccesssibilityMap m_accesssibilityMap; 41 | 42 | Frame* m_pFirstExecutableNode; 43 | FramesCollection m_lastExecutableNodes; 44 | }; 45 | } 46 | } 47 | } 48 | 49 | #endif // FRAMES_GRAPH_H_INCLUDED 50 | -------------------------------------------------------------------------------- /include/Analysis/Frames/FramesPartitioner.h: -------------------------------------------------------------------------------- 1 | #ifndef FRAMES_PARTITIONER_H_INCLUDED 2 | #define FRAMES_PARTITIONER_H_INCLUDED 3 | 4 | #include "Analysis/Frames/IFramesPartitioner.h" 5 | #include "Analysis/Frames/IProfiler.h" 6 | #include "OPS_Core/MemoryHelper.h" 7 | 8 | namespace OPS 9 | { 10 | namespace Analysis 11 | { 12 | namespace Frames 13 | { 14 | using OPS::Reprise::ProgramFragment; 15 | using std::tr1::shared_ptr; 16 | 17 | class FramesPartitioner: public IFramesPartitioner 18 | { 19 | public: 20 | FramesPartitioner(shared_ptr spProfiler, long_long_t maxCommandSize, long_long_t maxDataSize); 21 | ~FramesPartitioner(); 22 | 23 | virtual FramesGraph MakePartition(ProgramFragment& fragment); 24 | 25 | private: 26 | bool checkConsistency(ProgramFragment& statement); 27 | 28 | private: 29 | shared_ptr m_spProfiler; 30 | long_long_t m_maxCommandSize; 31 | long_long_t m_maxDataSize; 32 | }; 33 | } 34 | } 35 | } 36 | #endif // FRAMES_PARTITIONER_H_INCLUDED 37 | -------------------------------------------------------------------------------- /include/Analysis/Frames/IFramesPartitioner.h: -------------------------------------------------------------------------------- 1 | #ifndef I_FRAMES_PARTITIONER_H_INCLUDED 2 | #define I_FRAMES_PARTITIONER_H_INCLUDED 3 | 4 | #include "Analysis/Frames/FramesGraph.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Analysis 9 | { 10 | namespace Frames 11 | { 12 | using OPS::Reprise::StatementBase; 13 | 14 | class IFramesPartitioner 15 | { 16 | public: 17 | virtual ~IFramesPartitioner() {} 18 | virtual FramesGraph MakePartition(OPS::Reprise::ProgramFragment& fragment) = 0; 19 | 20 | inline FramesGraph MakePartition(Reprise::StatementBase& statement) 21 | { 22 | Reprise::ProgramFragment fragment(statement); 23 | return MakePartition(fragment); 24 | } 25 | }; 26 | } 27 | } 28 | } 29 | #endif // I_FRAMES_PARTITIONER_H_INCLUDED 30 | -------------------------------------------------------------------------------- /include/Analysis/Frames/IProfiler.h: -------------------------------------------------------------------------------- 1 | #ifndef FRAMES_I_PROFILER_H_INCLUDED_ 2 | #define FRAMES_I_PROFILER_H_INCLUDED_ 3 | 4 | #include "Reprise/Reprise.h" 5 | #include "OPS_Core/MemoryHelper.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Analysis 10 | { 11 | namespace Frames 12 | { 13 | using OPS::Reprise::ForStatement; 14 | using OPS::Reprise::RepriseBase; 15 | using OPS::Reprise::StatementBase; 16 | 17 | class IProfiler 18 | { 19 | public: 20 | virtual ~IProfiler() {} 21 | 22 | virtual long_long_t GetSizeCommand(StatementBase&, bool isOnlyForHeaders = false) = 0; 23 | virtual long_long_t GetSizeData(StatementBase&, bool isOnlyForHeaders = false) = 0; 24 | 25 | virtual long_long_t GetSizeData(ForStatement&, const std::map&) = 0; 26 | }; 27 | } 28 | } 29 | } 30 | 31 | #endif // FRAMES_I_PROFILER_H_INCLUDED_ 32 | -------------------------------------------------------------------------------- /include/Analysis/Frames/ProfilerBridge.h: -------------------------------------------------------------------------------- 1 | #ifndef FRAMES_I_PROFILER_BRIDGE_H_INCLUDED_ 2 | #define FRAMES_I_PROFILER_BRIDGE_H_INCLUDED_ 3 | 4 | #include "Analysis/Frames/IProfiler.h" 5 | #include "Analysis/Profiler/Profiler.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Analysis 10 | { 11 | namespace Frames 12 | { 13 | using OPS::Profiling::Profiler; 14 | using OPS::Reprise::RepriseBase; 15 | using std::tr1::shared_ptr; 16 | using OPS::Reprise::ForStatement; 17 | 18 | class ProfilerBridge : public IProfiler 19 | { 20 | public: 21 | ProfilerBridge(); 22 | ProfilerBridge(shared_ptr spProfiler); 23 | 24 | virtual long_long_t GetSizeCommand(StatementBase&, bool isOnlyForHeaders = false); 25 | virtual long_long_t GetSizeData(StatementBase&, bool isOnlyForHeaders = false); 26 | 27 | virtual long_long_t GetSizeData(ForStatement&, const std::map&); 28 | 29 | private: 30 | shared_ptr m_spProfiler; 31 | bool m_analizeOnlyDataSize; 32 | }; 33 | } 34 | } 35 | } 36 | 37 | #endif // FRAMES_I_PROFILER_BRIDGE_H_INCLUDED_ 38 | -------------------------------------------------------------------------------- /include/Analysis/LatticeGraph/GaussianElimination.h: -------------------------------------------------------------------------------- 1 | #ifndef GAUSSIANELIMINATION_H 2 | #define GAUSSIANELIMINATION_H 3 | 4 | #include 5 | #include "Analysis/LatticeGraph/RationalNumber.h" 6 | 7 | namespace OPS 8 | { 9 | 10 | namespace LatticeGraph 11 | { 12 | 13 | typedef std::vector RationalMatrixRow; 14 | typedef std::vector RationalMatrix; 15 | 16 | class GaussianEliminator 17 | { 18 | public: 19 | enum Status 20 | { 21 | None = 0, 22 | ExactSolution, 23 | FundamentalSystemSolution, 24 | Incompatible 25 | }; 26 | 27 | explicit GaussianEliminator(const RationalMatrix& matrix); 28 | explicit GaussianEliminator(const std::vector >& integerMatrix); 29 | 30 | Status eliminate(); 31 | 32 | const RationalMatrix& getSolution() const; 33 | Status getStatus() const; 34 | 35 | bool getIntegerSolution(std::vector >& solution) const; 36 | 37 | private: 38 | void makeForwardElimination(); 39 | bool makeBackSubstitution(); 40 | 41 | void printMatrix(); 42 | 43 | RationalMatrix m_matrix; 44 | Status m_status; 45 | }; 46 | 47 | } 48 | } 49 | #endif // GAUSSIANELIMINATION_H 50 | -------------------------------------------------------------------------------- /include/Analysis/LatticeGraph/ParamPoint.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "Analysis/LatticeGraph/LinearLib.h" 4 | 5 | namespace OPS 6 | { 7 | namespace LatticeGraph 8 | { 9 | 10 | /// Целая точка n-мерного пространства, аффинно зависящая от каких-то параметров 11 | struct ParamPoint : public std::vector 12 | { 13 | public: 14 | 15 | ParamPoint(int n); 16 | 17 | 18 | }; 19 | }//end of namespace 20 | }//end of namespace 21 | 22 | -------------------------------------------------------------------------------- /include/Analysis/LoopsInterchange/LoopsInterchangeAnalysis.h: -------------------------------------------------------------------------------- 1 | #ifndef LOOPS_INTERCHANGE_ANALYSIS_H_INCLUDED 2 | #define LOOPS_INTERCHANGE_ANALYSIS_H_INCLUDED 3 | 4 | #include "Reprise/Reprise.h" 5 | #include "Analysis/Montego/DependenceGraph/DependenceGraph.h" 6 | 7 | using OPS::Reprise::ForStatement; 8 | 9 | namespace OPS 10 | { 11 | namespace Analysis 12 | { 13 | namespace LoopsInterchange 14 | { 15 | 16 | //на вход подается внешний цикл тесного гнезда 17 | //функция строит депграф 18 | bool isInterchangable(ForStatement& forStatement); 19 | 20 | } // LoopsInterchange 21 | } // Analysis 22 | } // OPS 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /include/Analysis/Montego/DependenceGraph/DependenceGraphVertex.h: -------------------------------------------------------------------------------- 1 | #ifndef _DEPENDENCE_GRAPH_VERTEX_H_INCLUDED_ 2 | #define _DEPENDENCE_GRAPH_VERTEX_H_INCLUDED_ 3 | 4 | #include "Analysis/Montego/Occurrence.h" 5 | 6 | #include 7 | #include 8 | 9 | namespace OPS 10 | { 11 | namespace Montego 12 | { 13 | 14 | class DependenceGraphVertex 15 | { 16 | public: 17 | DependenceGraphVertex(); 18 | explicit DependenceGraphVertex(Reprise::StatementBase* parentStatement); 19 | explicit DependenceGraphVertex(const OccurrencePtr& sourceOccurrence); 20 | 21 | public: 22 | bool operator ==(const DependenceGraphVertex& otherVertex) const; 23 | 24 | public: 25 | Reprise::StatementBase* getParentStatement() const; 26 | OccurrencePtr getSourceOccurrence() const; 27 | 28 | private: 29 | Reprise::StatementBase* m_parentStatement; 30 | OccurrencePtr m_sourceOccurrence; 31 | }; 32 | 33 | } 34 | } 35 | 36 | #endif // _DEPENDENCE_GRAPH_VERTEX_H_INCLUDED_ 37 | -------------------------------------------------------------------------------- /include/Analysis/Montego/DependenceGraph/DependenceLevel.h: -------------------------------------------------------------------------------- 1 | #ifndef _DEPENDENCE_LEVEL_H_INCLUDED_ 2 | #define _DEPENDENCE_LEVEL_H_INCLUDED_ 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace OPS 9 | { 10 | namespace Montego 11 | { 12 | 13 | class DependenceLevel 14 | { 15 | public: 16 | explicit DependenceLevel(const Reprise::ForStatement& forStatement); 17 | explicit DependenceLevel(const Reprise::WhileStatement& whileStatement); 18 | 19 | public: 20 | bool operator ==(const DependenceLevel& otherVertex) const; 21 | 22 | private: 23 | DependenceLevel(); 24 | 25 | private: 26 | const Reprise::ForStatement* m_forStatement; 27 | const Reprise::WhileStatement* m_whileStatement; 28 | }; 29 | 30 | 31 | 32 | // childStatement must be a child of sourceStatement!!! 33 | std::list getAllDependenceLevelsBetween( 34 | const Reprise::StatementBase& sourceStatement, 35 | const Reprise::StatementBase& childStatement); 36 | 37 | } 38 | } 39 | 40 | #endif // _DEPENDENCE_LEVEL_H_INCLUDED_ 41 | -------------------------------------------------------------------------------- /include/Analysis/Montego/SafeStatus.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace OPS 4 | { 5 | namespace Montego 6 | { 7 | 8 | class SafeStatus 9 | { 10 | public: 11 | 12 | typedef unsigned int status_t; 13 | 14 | explicit SafeStatus(status_t s = 0); 15 | 16 | SafeStatus(const SafeStatus& s); 17 | 18 | SafeStatus& operator=(const SafeStatus& s); 19 | 20 | bool isStatus(status_t s) const; 21 | 22 | status_t getStatusData() const; 23 | 24 | //добавляет к имеющемуся еще флаги в s 25 | void addStatus(status_t s); 26 | 27 | //заменяет имеющийся на статус s 28 | void replaceAllStatusBy(status_t s); 29 | 30 | //отчищает все статусы 31 | void clearAllStatus(status_t s); 32 | 33 | //удаляет из имеющегося указанные статусы 34 | void unsetStatus(status_t s); 35 | 36 | private: 37 | 38 | status_t m_status; 39 | }; 40 | 41 | }//end of namespace 42 | }//end of namespace 43 | -------------------------------------------------------------------------------- /include/Analysis/Renewal/AliasAnalysis/IAliasAnalysisService.h: -------------------------------------------------------------------------------- 1 | #ifndef _I_ALIAS_ANALYSIS_SERVICE_H_INLUDED_ 2 | #define _I_ALIAS_ANALYSIS_SERVICE_H_INLUDED_ 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace OPS 9 | { 10 | 11 | namespace Renewal 12 | { 13 | 14 | /// Stuff for work with aliases 15 | class IAliasAnalysisService 16 | : public virtual Shared::IContextObserver 17 | { 18 | protected: 19 | inline ~IAliasAnalysisService() {} 20 | }; 21 | 22 | inline IAliasAnalysisService& getAliasAnalysisService() 23 | { 24 | return Core::ServiceLocator::instance().getService(); 25 | } 26 | 27 | } 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /include/Analysis/Renewal/Occurrence/OccurrenceHelpers.h: -------------------------------------------------------------------------------- 1 | #ifndef _OCCURRENCE_HELPERS_H_INCLUDED_ 2 | #define _OCCURRENCE_HELPERS_H_INCLUDED_ 3 | 4 | #include "Analysis/Renewal/Occurrence/Occurrences.h" 5 | 6 | namespace OPS 7 | { 8 | 9 | namespace Montego 10 | { 11 | 12 | class Occurrence; 13 | 14 | } 15 | 16 | namespace Renewal 17 | { 18 | 19 | OccurrencePtr convertMontegoToRenewal(const Montego::Occurrence& montegoOccurrence); 20 | 21 | } 22 | 23 | } 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /include/Analysis/Renewal/OccurrenceAnalysis/IOccurrenceAnalysisService.h: -------------------------------------------------------------------------------- 1 | #ifndef _I_OCCURRENCE_ANALYSIS_SERVICE_H_INCLUDED_ 2 | #define _I_OCCURRENCE_ANALYSIS_SERVICE_H_INCLUDED_ 3 | 4 | #include "Analysis/Renewal/Occurrence/Occurrences.h" 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace OPS 13 | { 14 | 15 | namespace Reprise 16 | { 17 | 18 | class RepriseBase; 19 | 20 | } 21 | 22 | namespace Renewal 23 | { 24 | 25 | typedef std::vector Occurrences; 26 | 27 | /// Stuff for work with occurrences 28 | class IOccurrenceAnalysisService 29 | : public virtual Shared::IContextObserver 30 | { 31 | public: 32 | virtual Occurrences findAllOccurrences(const Reprise::RepriseBase& rootNode) = 0; 33 | 34 | protected: 35 | inline ~IOccurrenceAnalysisService() {} 36 | }; 37 | 38 | inline IOccurrenceAnalysisService& getOccurrenceAnalysisService() 39 | { 40 | return Core::ServiceLocator::instance().getService(); 41 | } 42 | 43 | } 44 | 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /include/Analysis/Statistics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace OPS 8 | { 9 | namespace Analysis 10 | { 11 | namespace Statistics 12 | { 13 | 14 | class StatisticsAnalyserBase : public BaseVisitor 15 | { 16 | public: 17 | virtual void printStatistics(std::ostream& os) const = 0; 18 | }; 19 | 20 | StatisticsAnalyserBase* createNodeCountAnalyser(); 21 | StatisticsAnalyserBase* createVariableTypesAnalyser(); 22 | StatisticsAnalyserBase* createForLoopHeaderAnalyser(); 23 | StatisticsAnalyserBase* createForStructureAnalyser(); 24 | StatisticsAnalyserBase* createSubscriptAnalyser(); 25 | StatisticsAnalyserBase* createMemorySizeAnalyser(); 26 | StatisticsAnalyserBase* createStructAnalyser(); 27 | 28 | void makeStatistics(OPS::Reprise::RepriseBase& node, 29 | const std::list& analysers, 30 | std::ostream& os); 31 | 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /include/Backends/BackendsHub.h: -------------------------------------------------------------------------------- 1 | #ifndef BACKENDSHUB_H 2 | #define BACKENDSHUB_H 3 | 4 | #include "Transforms/TransformsHub.h" 5 | 6 | namespace OPS 7 | { 8 | namespace TransformationsHub 9 | { 10 | 11 | class CodeGeneratorBase : public TransformBase 12 | { 13 | public: 14 | typedef std::map ProgramCode; 15 | 16 | /// Возвращает отображение вида: <имя файла, сгенерированный код> 17 | virtual const ProgramCode& getGeneratedCode() const; 18 | 19 | protected: 20 | void setGeneratedCode(OPS::Reprise::ProgramUnit& program); 21 | 22 | ProgramCode m_generatedCode; 23 | }; 24 | 25 | void registerBackends(); 26 | 27 | } 28 | } 29 | 30 | #endif // BACKENDSHUB_H 31 | -------------------------------------------------------------------------------- /include/Backends/RepriseToClang/ClangGenerator.h: -------------------------------------------------------------------------------- 1 | /// ClangGenerator.h 2 | /// Создано: 19.02.2013 3 | 4 | #ifndef CLANG_GENERATOR_H__ 5 | #define CLANG_GENERATOR_H__ 6 | 7 | #include "Backends/BackendsHub.h" 8 | 9 | #include "ClangGeneratorTypes.h" 10 | 11 | #include 12 | 13 | namespace OPS 14 | { 15 | namespace Backends 16 | { 17 | namespace Clang 18 | { 19 | class Generator : public OPS::TransformationsHub::CodeGeneratorBase 20 | { 21 | public: 22 | // 23 | explicit Generator( 24 | clang::TargetOptions& rTargetOptions); 25 | explicit Generator( 26 | clang::CompilerInstance& rCompilerInstance); 27 | // 28 | public: 29 | // 30 | const ASTContexts& getResult() const; 31 | // 32 | public: 33 | // 34 | virtual void makeTransformImpl( 35 | OPS::Reprise::ProgramUnit* pProgramUnit, 36 | const OPS::TransformationsHub::ArgumentValues& rcParams); 37 | // 38 | private: 39 | // 40 | clang::CompilerInstance* m_pCompilerInstance; 41 | Internal::ASTContextParams m_ASTContextParams; 42 | ASTContexts m_Contexts; 43 | }; 44 | } // namespace Clang 45 | } // namespace Backends 46 | } // namespace OPS 47 | 48 | #endif // CLANG_GENERATOR_H__ 49 | 50 | // Конец файла 51 | -------------------------------------------------------------------------------- /include/Backends/RepriseXml/RepriseXmlPass.h: -------------------------------------------------------------------------------- 1 | #ifndef REPRISEXMLPASS_H 2 | #define REPRISEXMLPASS_H 3 | 4 | // Standard includes 5 | 6 | // OPS includes 7 | 8 | // Local includes 9 | #include "OPS_Stage/Passes.h" 10 | 11 | // Global defines and macros 12 | 13 | // Enter namespace 14 | namespace OPS 15 | { 16 | namespace Stage 17 | { 18 | 19 | // Constants and enums 20 | 21 | // Global classes 22 | class RepriseXmlSerializer : public SimpleSerializerBase 23 | { 24 | public: 25 | explicit RepriseXmlSerializer(const std::string& fileName = std::string()); 26 | std::string getName() const; 27 | 28 | protected: 29 | void serialize(Reprise::TranslationUnit &unit, std::ostream &os); 30 | std::string generateFileName(Reprise::TranslationUnit &unit); 31 | }; 32 | 33 | // Global functions 34 | 35 | // Exit namespace 36 | } 37 | } 38 | 39 | #endif // REPRISEXMLPASS_H 40 | -------------------------------------------------------------------------------- /include/ClangParser/ClangGenerator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "OPS_Stage/Passes.h" 4 | #include "clangParserSettings.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Stage 9 | { 10 | 11 | class ClangGenerator : public GeneratorBase 12 | { 13 | public: 14 | ClangGenerator(); 15 | virtual ~ClangGenerator(); 16 | 17 | virtual bool run(); 18 | 19 | clang::ClangParserSettings& settings() { return m_settings; } 20 | 21 | void addFile(const std::string& fileName); 22 | 23 | private: 24 | typedef std::list FileList; 25 | 26 | clang::ClangParserSettings m_settings; 27 | FileList m_fileNames; 28 | }; 29 | 30 | static RegisterPass clangGenerator("Clang Generator"); 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /include/ClangParser/PragmaHandler.h: -------------------------------------------------------------------------------- 1 | #ifndef PRAGMAHANDLERS_H 2 | #define PRAGMAHANDLERS_H 3 | 4 | #include 5 | #include "clang/Lex/Pragma.h" 6 | #include "clang/Basic/SourceLocation.h" 7 | 8 | namespace OPS 9 | { 10 | namespace ClangParser 11 | { 12 | 13 | typedef std::vector< std::pair< clang::SourceLocation, std::pair > > Pragmas; 14 | 15 | class PragmaHandlerBase : public clang::PragmaHandler 16 | { 17 | Pragmas& pragmas; 18 | protected: 19 | 20 | void registerPragma(const clang::SourceLocation& location, 21 | const std::string& name, 22 | const std::string& value); 23 | 24 | public: 25 | PragmaHandlerBase(llvm::StringRef name, Pragmas& p); 26 | }; 27 | 28 | clang::PragmaHandler* createOpsPragmaHandlers(Pragmas& p); 29 | 30 | void registerPragmaHandler(clang::PragmaHandler*(*factory)(Pragmas& p)); 31 | 32 | } 33 | } 34 | 35 | #endif // PRAGMAHANDLERS_H 36 | -------------------------------------------------------------------------------- /include/FrontTransforms/BaseOperator.h: -------------------------------------------------------------------------------- 1 | #ifndef EXPRESSION_OPTIMIZATION_BASE_OPERATOR_H 2 | #define EXPRESSION_OPTIMIZATION_BASE_OPERATOR_H 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace ExpressionSimplifier 9 | { 10 | namespace Calculation 11 | { 12 | using OPS::Reprise::BasicCallExpression; 13 | using OPS::Reprise::ExpressionBase; 14 | 15 | class BaseOperator{ 16 | public: 17 | // любая реализация метода calculate может делать следующее: 18 | // 1) измененение expression 19 | // 2) возвращать НОВОЕ дерево либо 0. 20 | virtual ExpressionBase* calculate(BasicCallExpression*& expression) = 0; 21 | virtual ~BaseOperator() {} 22 | }; 23 | 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /include/FrontTransforms/C2RPass.h: -------------------------------------------------------------------------------- 1 | #ifndef C2RPASS_H 2 | #define C2RPASS_H 3 | 4 | // Standard includes 5 | 6 | // OPS includes 7 | #include "OPS_Stage/Passes.h" 8 | 9 | // Local includes 10 | 11 | // Global defines and macros 12 | 13 | // Enter namespace 14 | namespace OPS 15 | { 16 | namespace Stage 17 | { 18 | 19 | // Constants and enums 20 | 21 | // Global classes 22 | 23 | class NoCanto {}; 24 | 25 | /// Pass converting Canto nodes to Reprise nodes 26 | class C2RPass : public PassBase 27 | { 28 | public: 29 | C2RPass(); 30 | bool run(); 31 | }; 32 | 33 | class RepriseCanonical {}; 34 | 35 | /// Pass converts variable initializations and multiple assignments 36 | class RepriseCanonizationPass : public PassBase 37 | { 38 | public: 39 | RepriseCanonizationPass(); 40 | bool run(); 41 | }; 42 | 43 | // Global functions 44 | 45 | // Exit namespace 46 | 47 | } 48 | } 49 | 50 | #endif // C2RPASS_H 51 | -------------------------------------------------------------------------------- /include/FrontTransforms/ResolverPass.h: -------------------------------------------------------------------------------- 1 | #ifndef RESOLVERPASS_H 2 | #define RESOLVERPASS_H 3 | 4 | // Standard includes 5 | 6 | // OPS includes 7 | #include "OPS_Stage/Passes.h" 8 | 9 | // Local includes 10 | 11 | // Global defines and macros 12 | 13 | // Enter namespace 14 | namespace OPS 15 | { 16 | namespace Stage 17 | { 18 | 19 | // Constants and enums 20 | 21 | // Global classes 22 | class NamesResolved {}; 23 | 24 | class ResolverPass : public PassBase 25 | { 26 | public: 27 | ResolverPass(); 28 | bool run(); 29 | }; 30 | 31 | // Global functions 32 | 33 | // Exit namespace 34 | } 35 | } 36 | #endif // RESOLVERPASS_H 37 | -------------------------------------------------------------------------------- /include/GTestIncludeWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "OPS_Core/IO.h" 3 | #include "OPS_Core/Kernel.h" 4 | 5 | #if OPS_COMPILER_MSC_VER > 0 6 | #pragma warning(push) 7 | #pragma warning(disable: 4512 4224 4127 4389) 8 | #endif 9 | #include 10 | #if OPS_COMPILER_MSC_VER > 0 11 | #pragma warning(pop) 12 | #endif 13 | -------------------------------------------------------------------------------- /include/OPS_Core/Core.h: -------------------------------------------------------------------------------- 1 | #ifndef _CORE_H_INCLUDED_ 2 | #define _CORE_H_INCLUDED_ 3 | 4 | namespace OPS 5 | { 6 | namespace Core 7 | { 8 | class Core 9 | { 10 | public: 11 | 12 | Core(); 13 | 14 | ~Core(); 15 | 16 | private: 17 | 18 | Core(const Core& ); 19 | Core& operator =(const Core& ); 20 | 21 | void initialize(); 22 | void terminate(); 23 | }; 24 | } 25 | } 26 | 27 | #endif // _CORE_H_INCLUDED_ 28 | -------------------------------------------------------------------------------- /include/OPS_Core/File.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_COMMON_CORE_FILE_H_ 2 | #define OPS_COMMON_CORE_FILE_H_ 3 | 4 | #include 5 | #include 6 | 7 | namespace OPS 8 | { 9 | 10 | class FilesCollector 11 | { 12 | public: 13 | typedef std::vector List; 14 | 15 | explicit FilesCollector(const std::string& mask = "*.*"); 16 | 17 | void getFilesRecursive(const std::string& path, FilesCollector::List& files) const; 18 | 19 | void setMask(const std::string& mask); 20 | 21 | std::string getMask() const; 22 | 23 | private: 24 | 25 | std::string m_mask; 26 | }; 27 | 28 | 29 | 30 | 31 | } 32 | 33 | 34 | #endif // OPS_COMMON_CORE_FILE_H_ 35 | 36 | -------------------------------------------------------------------------------- /include/OPS_Core/Interfaces/ICoreSettingsService.h: -------------------------------------------------------------------------------- 1 | #ifndef _I_CORE_SETTINGS_SERVICE_H_INCLUDED_ 2 | #define _I_CORE_SETTINGS_SERVICE_H_INCLUDED_ 3 | 4 | #include "OPS_Core/ServiceLocator.h" 5 | 6 | #include 7 | 8 | namespace OPS 9 | { 10 | 11 | namespace Core 12 | { 13 | 14 | class ICoreSettingsService 15 | { 16 | public: 17 | virtual int getAsInt(const std::string& propertyName) const = 0; 18 | virtual std::string getAsString(const std::string& propertyName) const = 0; 19 | 20 | virtual void setInt(const std::string& propertyName, int value) = 0; 21 | virtual void setString(const std::string& propertyName, const std::string& value) = 0; 22 | 23 | protected: 24 | virtual inline ~ICoreSettingsService() {} 25 | }; 26 | 27 | inline ICoreSettingsService& coreSettings() 28 | { 29 | return ServiceLocator::instance().getService(); 30 | } 31 | 32 | } 33 | 34 | } 35 | 36 | #endif // _I_CORE_SETTINGS_SERVICE_H_INCLUDED_ 37 | -------------------------------------------------------------------------------- /include/OPS_Core/Kernel.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_COMMON_CORE_KERNEL_H_ 2 | #define OPS_COMMON_CORE_KERNEL_H_ 3 | 4 | #include 5 | #include 6 | #include "OPS_Core/Compiler.h" 7 | #include "OPS_Core/Types.h" 8 | 9 | namespace OPS 10 | { 11 | 12 | /** 13 | Application startup path getter 14 | 15 | \return Application startup path 16 | */ 17 | const std::wstring& getStartupPath(void); 18 | 19 | void log(const std::wstring& message); 20 | 21 | void log(const std::string& message); 22 | 23 | void log_console(const std::wstring& message); 24 | 25 | void log_console(const std::string& message); 26 | 27 | dword getTickCount(void); 28 | 29 | int getLastOsError(void) throw(); 30 | 31 | } 32 | 33 | #endif // OPS_COMMON_CORE_KERNEL_H_ 34 | -------------------------------------------------------------------------------- /include/OPS_Core/Localization.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_COMMON_CORE_LOCALIZATION_H_ 2 | #define OPS_COMMON_CORE_LOCALIZATION_H_ 3 | 4 | #if defined (_TL) 5 | #error _TL already defined 6 | #endif 7 | 8 | #if !defined (OPS_LOCALE) 9 | #define OPS_LOCALE 0 10 | #endif 11 | 12 | #if OPS_LOCALE == 0 13 | #define OPS_LOCALE_ENGLISH 1 14 | #define OPS_LOCALE_RUSSIAN 0 15 | #elif OPS_LOCALE == 1 16 | #define OPS_LOCALE_ENGLISH 0 17 | #define OPS_LOCALE_RUSSIAN 1 18 | #else 19 | #error Unexpected OPS_LOCALE or not defined. 20 | #endif 21 | 22 | #if OPS_LOCALE_ENGLISH 23 | #define _TL(english, russian) english 24 | #elif OPS_LOCALE_RUSSIAN 25 | #define _TL(english, russian) russian 26 | #else 27 | #error Unexpected OPS_LOCALE, could not define _TL. 28 | #endif 29 | 30 | 31 | #endif // OPS_COMMON_CORE_LOCALIZATION_H_ 32 | -------------------------------------------------------------------------------- /include/OPS_Core/MemoryHelper.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_COMMON_CORE_MEMORY_HELPER_H 2 | #define OPS_COMMON_CORE_MEMORY_HELPER_H 3 | 4 | #ifdef _MSC_VER 5 | #include 6 | #endif 7 | 8 | #ifdef __GNUC__ 9 | #include 10 | #endif 11 | 12 | #endif // OPS_COMMON_CORE_MEMORY_HELPER_H 13 | -------------------------------------------------------------------------------- /include/OPS_Core/OPS_Core.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_COMMON_CORE_OPSCORE_H_ 2 | #define OPS_COMMON_CORE_OPSCORE_H_ 3 | 4 | #include "OPS_Core/Compiler.h" 5 | #include "OPS_Core/Console.h" 6 | #include "OPS_Core/Exceptions.h" 7 | #include "OPS_Core/Events.h" 8 | #include "OPS_Core/File.h" 9 | #include "OPS_Core/Helpers.h" 10 | #include "OPS_Core/IniFile.h" 11 | #include "OPS_Core/IO.h" 12 | #include "OPS_Core/Kernel.h" 13 | #include "OPS_Core/Listener.h" 14 | #include "OPS_Core/Localization.h" 15 | #include "OPS_Core/Mixins.h" 16 | #include "OPS_Core/Platform.h" 17 | #include "OPS_Core/Reporting.h" 18 | #include "OPS_Core/StlHelpers.h" 19 | #include "OPS_Core/Strings.h" 20 | #include "OPS_Core/Types.h" 21 | #include "OPS_Core/Visitor.h" 22 | #include "OPS_Core/XmlBuilder.h" 23 | 24 | 25 | #endif // OPS_COMMON_CORE_OPSCORE_H_ 26 | -------------------------------------------------------------------------------- /include/OPS_Core/Plugins/IPlugin.h: -------------------------------------------------------------------------------- 1 | #ifndef _I_PLUGIN_H_INCLUDED_ 2 | #define _I_PLUGIN_H_INCLUDED_ 3 | 4 | namespace OPS 5 | { 6 | namespace Core 7 | { 8 | class IPlugin 9 | { 10 | public: 11 | 12 | virtual void initialize() = 0; 13 | virtual void terminate() = 0; 14 | 15 | protected: 16 | 17 | inline ~IPlugin() {} 18 | }; 19 | } 20 | } 21 | 22 | #endif // _I_PLUGIN_H_INCLUDED_ 23 | -------------------------------------------------------------------------------- /include/OPS_Core/Plugins/PluginManager.h: -------------------------------------------------------------------------------- 1 | #ifndef _PLUGIN_MANAGER_H_INCLUDED_ 2 | #define _PLUGIN_MANAGER_H_INCLUDED_ 3 | 4 | #include 5 | #include 6 | 7 | namespace OPS 8 | { 9 | namespace Core 10 | { 11 | class PluginManager 12 | { 13 | public: 14 | 15 | inline PluginManager() {} 16 | 17 | void setPluginLoadOrder(const std::list& loadOrderedPluginNames); 18 | 19 | void initializePlugins() const; 20 | void terminatePlugins() const; 21 | 22 | private: 23 | 24 | PluginManager(const PluginManager& ); 25 | PluginManager& operator =(const PluginManager& ); 26 | 27 | private: 28 | 29 | std::list m_loadOrderedPluginNames; 30 | }; 31 | } 32 | } 33 | 34 | #endif // _PLUGIN_MANAGER_H_INCLUDED_ 35 | -------------------------------------------------------------------------------- /include/OPS_Core/Plugins/PluginRegistration.h: -------------------------------------------------------------------------------- 1 | #ifndef _PLUGIN_REGISTRATION_H_INCLUDED_ 2 | #define _PLUGIN_REGISTRATION_H_INCLUDED_ 3 | 4 | #include "OPS_Core/Plugins/IPlugin.h" 5 | 6 | #include 7 | 8 | typedef OPS::Core::IPlugin& (*PluginInstanceFunction)(); 9 | 10 | void registerStaticPluginInstanceFunction(const std::string& pluginName, 11 | PluginInstanceFunction pluginInstanceFunction); 12 | 13 | #define EXPORT_STATIC_PLUGIN2(pluginName, PluginClass) \ 14 | OPS::Core::IPlugin& pluginInstanceFunction##pluginName() \ 15 | { \ 16 | static PluginClass s_instance; \ 17 | return s_instance; \ 18 | } 19 | 20 | #define IMPORT_STATIC_PLUGIN(pluginName) \ 21 | OPS::Core::IPlugin& pluginInstanceFunction##pluginName(); \ 22 | \ 23 | class Static##pluginName##PluginInitializer \ 24 | { \ 25 | public: \ 26 | \ 27 | Static##pluginName##PluginInitializer() \ 28 | { \ 29 | registerStaticPluginInstanceFunction(#pluginName, \ 30 | pluginInstanceFunction##pluginName); \ 31 | } \ 32 | }; \ 33 | \ 34 | static Static##pluginName##PluginInitializer s_static##pluginName##PluginInitializer; 35 | 36 | #endif // _PLUGIN_REGISTRATION_H_INCLUDED_ 37 | -------------------------------------------------------------------------------- /include/OPS_Core/Template.h: -------------------------------------------------------------------------------- 1 | /* 2 | OPS_Core/Template.h - OPS_Core module, template header 3 | 4 | */ 5 | 6 | // Multiple include guard start 7 | #ifndef OPS_CORE_TEMPLATE_H__ 8 | #define OPS_CORE_TEMPLATE_H__ 9 | 10 | // Standard includes 11 | 12 | // OPS includes 13 | 14 | // Local includes 15 | 16 | // Global defines and macros 17 | 18 | // Enter namespace 19 | 20 | // Constants and enums 21 | 22 | // Global classes 23 | 24 | // Global functions 25 | 26 | // Exit namespace 27 | 28 | // Multiple include guard end 29 | #endif // OPS_CORE_TEMPLATE_H__ 30 | -------------------------------------------------------------------------------- /include/OPS_Core/disable_llvm_warnings_begin.h: -------------------------------------------------------------------------------- 1 | #ifdef _MSC_VER 2 | # pragma warning(push) 3 | # pragma warning(disable: 4146 4244 4291 4345 4624 4800 4996) 4 | #endif 5 | #ifdef __GNUC__ 6 | # pragma GCC diagnostic push 7 | # pragma GCC diagnostic ignored "-Wunused-parameter" 8 | #endif -------------------------------------------------------------------------------- /include/OPS_Core/disable_llvm_warnings_end.h: -------------------------------------------------------------------------------- 1 | #ifdef __GNUC__ 2 | # pragma GCC diagnostic pop 3 | #endif 4 | #ifdef _MSC_VER 5 | # pragma warning(pop) 6 | #endif -------------------------------------------------------------------------------- /include/OPS_Core/msc_leakcheck.h: -------------------------------------------------------------------------------- 1 | //блок проверки утечек памяти 2 | //этот блок надо вставлять в конце всех include 3 | //и вызывать при завершении программы функцию _CrtDumpMemoryLeaks(); 4 | //тогда в окне output в Visual Studio будет указаны все 5 | //неосвобожденные блоки памяти и имена файлов, в которых эта память выделялась 6 | //(если в эти файлы был включен этот текст) 7 | #if 0 // This is deprecated now 8 | #ifdef _MSC_VER 9 | #define _CRTDBG_MAP_ALLOC 10 | #include 11 | #include 12 | #ifdef _DEBUG 13 | #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 14 | #define new DEBUG_NEW 15 | #endif 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /include/OPS_Stage/ClangGenerator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "OPS_Stage/Passes.h" 4 | 5 | namespace OPS 6 | { 7 | namespace Stage 8 | { 9 | 10 | class ClangGenerator : public GeneratorBase 11 | { 12 | public: 13 | ClangGenerator(); 14 | virtual ~ClangGenerator(); 15 | 16 | virtual std::string name(); 17 | virtual void run(); 18 | 19 | private: 20 | }; 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /include/OPS_Stage/Config.h: -------------------------------------------------------------------------------- 1 | /* 2 | OPS_Stage/Config.h - OPS_Stage module, config header 3 | 4 | */ 5 | 6 | // Multiple include guard start 7 | #ifndef OPS_STAGE_CONFIG_H__ 8 | #define OPS_STAGE_CONFIG_H__ 9 | 10 | // Standard includes 11 | #include 12 | #include 13 | #include 14 | 15 | // OPS includes 16 | 17 | // Local includes 18 | 19 | // Global defines and macros 20 | 21 | // Enter namespace 22 | namespace OPS 23 | { 24 | namespace Stage 25 | { 26 | // Constants and enums 27 | 28 | // Global classes 29 | /// EnvironmentConfig class 30 | struct EnvironmentConfig 31 | { 32 | typedef std::list StringListType; 33 | 34 | StringListType ClangIncludePathList; 35 | StringListType F2003IncludePathList; 36 | 37 | std::wstring ConfigFilePath; 38 | 39 | EnvironmentConfig(void); 40 | explicit EnvironmentConfig(const wchar_t* filePath); 41 | 42 | void load(const wchar_t* filePath); 43 | 44 | }; 45 | 46 | 47 | // Global functions 48 | 49 | // Exit namespace 50 | 51 | } 52 | } 53 | 54 | // Multiple include guard end 55 | #endif // OPS_STAGE_CONFIG_H__ 56 | -------------------------------------------------------------------------------- /include/OPS_Stage/GenericWriter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "OPS_Core/Exceptions.h" 4 | 5 | namespace OPS 6 | { 7 | namespace Stage 8 | { 9 | 10 | template 11 | class GenericWriter 12 | { 13 | public: 14 | GenericWriter() : m_indent(0), m_useTabs(true) 15 | { 16 | } 17 | 18 | void indent() 19 | { 20 | m_indent += 1; 21 | } 22 | void outdent() 23 | { 24 | if (m_indent < 0) 25 | throw RuntimeError("Improper indenting used"); 26 | m_indent -= 1; 27 | } 28 | 29 | void write(const char* string) 30 | { 31 | static_cast(this)->write(string); 32 | } 33 | 34 | void write(const wchar_t* string) 35 | { 36 | static_cast(this)->write(string); 37 | } 38 | 39 | void writeLine(const char* string) 40 | { 41 | static_cast(this)->writeLine(string); 42 | } 43 | 44 | void writeLine(const wchar_t* string) 45 | { 46 | static_cast(this)->writeLine(string); 47 | } 48 | 49 | protected: 50 | int m_indent; 51 | bool m_useTabs; 52 | }; 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /include/OPS_Stage/OPS_Stage.h: -------------------------------------------------------------------------------- 1 | /* 2 | OPS_Stage/OPS_Stage.h - OPS_Stage module, all exported stage interfaces header 3 | 4 | */ 5 | 6 | // Multiple include guard start 7 | #ifndef OPS_STAGE_OPSSTAGE_H__ 8 | #define OPS_STAGE_OPSSTAGE_H__ 9 | 10 | // Standard includes 11 | 12 | // OPS includes 13 | 14 | // Local includes 15 | #include "OPS_Stage/Config.h" 16 | #include "OPS_Stage/Passes.h" 17 | #include "OPS_Stage/Utils.h" 18 | #include "OPS_Stage/WorkContext.h" 19 | 20 | // Global defines and macros 21 | 22 | // Enter namespace 23 | 24 | // Constants and enums 25 | 26 | // Global classes 27 | 28 | // Global functions 29 | 30 | // Exit namespace 31 | 32 | // Multiple include guard end 33 | #endif // OPS_STAGE_OPSSTAGE_H__ 34 | -------------------------------------------------------------------------------- /include/OPS_Stage/StdStreamWriter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "OPS_Core/Mixins.h" 6 | 7 | #include "OPS_Stage/GenericWriter.h" 8 | 9 | 10 | 11 | namespace OPS 12 | { 13 | namespace Stage 14 | { 15 | 16 | 17 | class StdStreamWriter : public GenericWriter, virtual public OPS::NonCopyableMix 18 | { 19 | public: 20 | StdStreamWriter(std::ostream& stream); 21 | 22 | void write(const char* string); 23 | 24 | void write(const wchar_t* string); 25 | 26 | void writeLine(const char* string); 27 | 28 | void writeLine(const wchar_t* string); 29 | 30 | private: 31 | std::ostream& m_stream; 32 | }; 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /include/OPS_Stage/Utils.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_STAGE_UTILS_H__ 2 | #define OPS_STAGE_UTILS_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace OPS 9 | { 10 | namespace Stage 11 | { 12 | 13 | std::wstring getStageRoot(void); 14 | 15 | void setStageRoot(const wchar_t* rootPath); 16 | 17 | 18 | std::wstring getStageConfigsRoot(void); 19 | 20 | std::wstring getStageSamplesRoot(void); 21 | 22 | } 23 | } 24 | 25 | #endif // OPS_STAGE_UTILS_H__ 26 | -------------------------------------------------------------------------------- /include/OPS_Stage/WorkContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // Standard includes 3 | 4 | // OPS includes 5 | #include "Reprise/Units.h" 6 | #include "OPS_Core/ServiceLocator.h" 7 | 8 | // Local includes 9 | 10 | // Global defines and macros 11 | 12 | // Enter namespace 13 | namespace OPS 14 | { 15 | namespace Stage 16 | { 17 | 18 | // Constants and enums 19 | 20 | // Global classes 21 | 22 | class WorkContext : public OPS::Core::ServiceLocatorBase 23 | { 24 | public: 25 | WorkContext(); 26 | ~WorkContext(); 27 | 28 | Reprise::ProgramUnit& program() { return *m_program; } 29 | const Reprise::ProgramUnit& program() const { return *m_program; } 30 | 31 | void reset(); 32 | 33 | // Satellite programs: opencl, ... 34 | Reprise::RepriseList m_satellitePrograms; 35 | 36 | private: 37 | // Main program 38 | Reprise::ReprisePtr m_program; 39 | }; 40 | 41 | // Global functions 42 | 43 | // Exit namespace 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /include/Reprise/Canto.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_IR_REPRISE_CANTO_H__ 2 | #define OPS_IR_REPRISE_CANTO_H__ 3 | 4 | // Canto includes 5 | #include "Reprise/Canto/HirCExpressions.h" 6 | #include "Reprise/Canto/HirCStatements.h" 7 | #include "Reprise/Canto/HirCTypes.h" 8 | #include "Reprise/Canto/HirCUtils.h" 9 | #include "Reprise/Canto/HirFExpressions.h" 10 | #include "Reprise/Canto/HirFTypes.h" 11 | 12 | #endif // OPS_IR_REPRISE_CANTO_H__ 13 | -------------------------------------------------------------------------------- /include/Reprise/Canto/HirCUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_IR_REPRISE_CANTO_HIRCUTILS_H_INCLUDED__ 2 | #define OPS_IR_REPRISE_CANTO_HIRCUTILS_H_INCLUDED__ 3 | 4 | #include "Reprise/Expressions.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Reprise 9 | { 10 | namespace Canto 11 | { 12 | 13 | // Global functions 14 | ReprisePtr HirCdecodeLiteral(const std::string& literal); 15 | 16 | } 17 | } 18 | } 19 | 20 | #endif // OPS_IR_REPRISE_CANTO_HIRCUTILS_H_INCLUDED__ 21 | -------------------------------------------------------------------------------- /include/Reprise/Exceptions.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_IR_REPRISE_EXCEPTIONS_H_INCLUDED__ 2 | #define OPS_IR_REPRISE_EXCEPTIONS_H_INCLUDED__ 3 | 4 | #include "OPS_Core/Exceptions.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Reprise 9 | { 10 | /// RepriseError exception 11 | OPS_DEFINE_EXCEPTION_CLASS(RepriseError, RuntimeError) 12 | 13 | /// UnexpectedChildError exception 14 | OPS_DEFINE_EXCEPTION_CLASS(UnexpectedChildError, RepriseError) 15 | 16 | /// NotEmplementedError exception 17 | OPS_DEFINE_EXCEPTION_CLASS(NotEmplementedError, RepriseError) 18 | } 19 | } 20 | 21 | #endif // OPS_IR_REPRISE_EXCEPTIONS_H_INCLUDED__ 22 | -------------------------------------------------------------------------------- /include/Reprise/Lifetime.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_REPRISE_LIFETIME_H_INCLUDED__ 2 | #define OPS_REPRISE_LIFETIME_H_INCLUDED__ 3 | 4 | #include "OPS_Core/Mixins.h" 5 | #include 6 | #include 7 | #include 8 | 9 | // Enter namespaces 10 | namespace OPS 11 | { 12 | namespace Reprise 13 | { 14 | 15 | class RepriseBase; 16 | 17 | class Coordinator : OPS::NonCopyableMix 18 | { 19 | public: 20 | static void init(void); 21 | static Coordinator& instance(void); 22 | static void shutdown(void); 23 | 24 | void addNode(RepriseBase* node); 25 | void removeNode(RepriseBase* node); 26 | 27 | std::string getStatistics(unsigned indent = 0) const; 28 | 29 | private: 30 | typedef std::set NodesList; 31 | 32 | Coordinator(void); 33 | ~Coordinator(void); 34 | 35 | void cleanup(void); 36 | 37 | NodesList m_nodes; 38 | }; 39 | 40 | // Exit namespaces 41 | } 42 | } 43 | 44 | 45 | #endif // OPS_REPRISE_LIFETIME_H_INCLUDED__ 46 | -------------------------------------------------------------------------------- /include/Reprise/Service/Service.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_IR_REPRISE_SERVICE_SERVICE_H_INCLUDED__ 2 | #define OPS_IR_REPRISE_SERVICE_SERVICE_H_INCLUDED__ 3 | 4 | #include "Reprise/Service/DeepWalker.h" 5 | #include "Reprise/Service/Marker.h" 6 | #include "Reprise/Service/Traversal.h" 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /include/Reprise/Service/Traversal.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_IR_REPRISE_SERVICE_TRAVERSAL_H_INCLUDED__ 2 | #define OPS_IR_REPRISE_SERVICE_TRAVERSAL_H_INCLUDED__ 3 | 4 | #include "Reprise/Common.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Reprise 9 | { 10 | namespace Service 11 | { 12 | 13 | // Visit root first 14 | template 15 | void makePreOrderTraversal(RepriseBase& root, Action& action) 16 | { 17 | action(root); 18 | 19 | const int childCount = root.getChildCount(); 20 | for(int i = 0; i < childCount; ++i) 21 | { 22 | makePreOrderTraversal(root.getChild(i), action); 23 | } 24 | } 25 | 26 | // Visit subtrees first 27 | template 28 | void makePostOrderTraversal(RepriseBase& root, Action& action) 29 | { 30 | const int childCount = root.getChildCount(); 31 | for(int i = 0; i < childCount; ++i) 32 | { 33 | makePostOrderTraversal(root.getChild(i), action); 34 | } 35 | 36 | action(root); 37 | } 38 | 39 | void makePreOrderVisitorTraversal(RepriseBase& root, OPS::BaseVisitor& visitor); 40 | 41 | void makePostOrderVisitorTraversal(RepriseBase& root, OPS::BaseVisitor& visitor); 42 | 43 | } 44 | } 45 | } 46 | 47 | 48 | #endif // OPS_IR_REPRISE_SERVICE_TRAVERSAL_H_INCLUDED__ 49 | -------------------------------------------------------------------------------- /include/Shared/Checks/CompositionCheck/CompositionCheckObjects.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPOSITION_CHECK_OBJECTS_H_ 2 | #define _COMPOSITION_CHECK_OBJECTS_H_ 3 | 4 | #include 5 | 6 | namespace OPS 7 | { 8 | namespace Shared 9 | { 10 | namespace Checks 11 | { 12 | 13 | class CompositionCheckObjects 14 | { 15 | public: 16 | enum CompositionCheckObjectTypes 17 | { 18 | // Statements 19 | CCOT_BlockStatement = 0, 20 | CCOT_BreakStatement, 21 | CCOT_ContinueStatement, 22 | CCOT_EmptyStatement, 23 | CCOT_ExpressionStatement, 24 | CCOT_ForStatement, 25 | CCOT_GotoStatement, 26 | CCOT_IfStatement, 27 | CCOT_ReturnStatement, 28 | CCOT_SwitchStatement, 29 | CCOT_WhileStatement, 30 | 31 | // Other 32 | CCOT_Label, 33 | 34 | CCOT_ObjectsCount 35 | }; 36 | 37 | CompositionCheckObjects(); 38 | 39 | CompositionCheckObjects& operator << (CompositionCheckObjectTypes object); 40 | 41 | bool contains(CompositionCheckObjectTypes object) const; 42 | 43 | private: 44 | std::set m_objects; 45 | }; 46 | 47 | } // Checks 48 | } // Shared 49 | } // OPS 50 | 51 | #endif // _COMPOSITION_CHECK_OBJECTS_H_ 52 | -------------------------------------------------------------------------------- /include/Shared/ContextNotifier/ContextNotifier.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONTEXT_NOTIFIER_H_INCLUDED_ 2 | #define _CONTEXT_NOTIFIER_H_INCLUDED_ 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace OPS 9 | { 10 | 11 | namespace Reprise 12 | { 13 | 14 | class RepriseBase; 15 | 16 | } 17 | 18 | namespace Shared 19 | { 20 | 21 | class IContextObserver; 22 | 23 | /// Context notifier 24 | class ContextNotifier 25 | : public NonCopyableMix 26 | { 27 | public: 28 | ContextNotifier(); 29 | 30 | ~ContextNotifier(); 31 | 32 | public: 33 | /// Subscribe context observer for notifications 34 | void subscribe(IContextObserver& observer); 35 | /// Unsubscribe context observer 36 | void unsubscribe(IContextObserver& observer); 37 | 38 | /// Notify all subscribed context observers about context change 39 | void notifyContextChanged(const Reprise::RepriseBase& context) const; 40 | 41 | private: 42 | const std::list& observers() const; 43 | 44 | private: 45 | std::list m_observers; 46 | }; 47 | 48 | } 49 | 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/Shared/ContextNotifier/ContextObserverState.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONTEXT_OBSERVER_STATE_H_INCLUDED_ 2 | #define _CONTEXT_OBSERVER_STATE_H_INCLUDED_ 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace OPS 9 | { 10 | 11 | namespace Shared 12 | { 13 | 14 | /// Base class for context observer state 15 | class ContextObserverState 16 | : public Reprise::RepriseBase 17 | { 18 | public: 19 | virtual ~ContextObserverState(); 20 | 21 | public: 22 | bool isSyncronized() const; 23 | void setSyncronized(bool isSyncronized); 24 | 25 | // RepriseBase stuff 26 | 27 | virtual int getChildCount() const; 28 | virtual RepriseBase& getChild(int index); 29 | 30 | OPS_REPRISE_DEFINE_GET_OBJECT_SIZE() 31 | OPS_DEFINE_CLONABLE_INTERFACE(ContextObserverState) 32 | 33 | protected: 34 | ContextObserverState(); 35 | 36 | private: 37 | bool m_isSyncronized; 38 | }; 39 | 40 | } 41 | 42 | } 43 | 44 | #endif // _CONTEXT_OBSERVER_STATE_H_INCLUDED_ 45 | -------------------------------------------------------------------------------- /include/Shared/ContextNotifier/IContextObserver.h: -------------------------------------------------------------------------------- 1 | #ifndef _I_CONTEXT_OBSERVER_H_INCLUDED_ 2 | #define _I_CONTEXT_OBSERVER_H_INCLUDED_ 3 | 4 | namespace OPS 5 | { 6 | 7 | namespace Reprise 8 | { 9 | 10 | class RepriseBase; 11 | 12 | } 13 | 14 | namespace Shared 15 | { 16 | 17 | /// Context observer interface 18 | class IContextObserver 19 | { 20 | public: 21 | /// Notify context observer about context change 22 | virtual void notifyContextChanged(const Reprise::RepriseBase& context) = 0; 23 | 24 | protected: 25 | inline ~IContextObserver() {} 26 | }; 27 | 28 | } 29 | 30 | } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /include/Shared/LabelsShared.h: -------------------------------------------------------------------------------- 1 | #ifndef _LABELS_SHARED_H_INCLUDED_ 2 | #define _LABELS_SHARED_H_INCLUDED_ 3 | 4 | #include "Reprise/Statements.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Shared 9 | { 10 | 11 | using OPS::Reprise::ReprisePtr; 12 | 13 | using OPS::Reprise::StatementBase; 14 | 15 | 16 | // You can use this function after replaceStatement function 17 | // if you need to translate label from sourceStmt to destinationStmt. 18 | // EXAMPLE: updateLabel(replaceStatement(stmt1, ReprisePtr(stmt2)), &stmt2); 19 | ReprisePtr updateLabel(ReprisePtr sourceStmt, StatementBase& destinationStmt); 20 | 21 | 22 | // This function checks whether you can apply a generateNewLabels function 23 | // to a statement statementBase. 24 | bool isPossibleToGenerateNewLabels(StatementBase& statementBase); 25 | 26 | // If you clone some statement from the program and want to use it in this program, 27 | // then you have to generate new labels in cloned statement by this function. 28 | // WARNING: If some goto outside statementBase points label inside statementBase, 29 | // then the function will not work!!! 30 | void generateNewLabels(StatementBase& statementBase); 31 | 32 | } // Shared 33 | } // OPS 34 | 35 | #endif // _LABELS_SHARED_H_INCLUDED_ 36 | -------------------------------------------------------------------------------- /include/Shared/ReferenceMapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Reprise/Common.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Shared 9 | { 10 | typedef std::map RepriseReferenceMap; 11 | 12 | /** Функция позволяет для двух одинаковых деревьев найти 13 | соответствующие друг другу объекты в них. 14 | \param left, right - одинаковые деревья 15 | \param refMap - map: ключи - для которых нужно найти соответсвие, 16 | значения - соответсвия 17 | **/ 18 | void mapReferences(const Reprise::RepriseBase& left, 19 | Reprise::RepriseBase& right, 20 | RepriseReferenceMap& refMap); 21 | 22 | /** Функция делает то же самое, что и mapReferences(), но для 23 | одного объекта. Эта просто обертка над mapReferences() - не используйте 24 | её если у вас несколько объектов. 25 | **/ 26 | Reprise::RepriseBase* mapReference(const Reprise::RepriseBase& left, 27 | Reprise::RepriseBase& right, 28 | const Reprise::RepriseBase& sourceObject); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /include/Shared/RepriseClone.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Reprise/Units.h" 4 | #include "Reprise/Statements.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Shared 9 | { 10 | 11 | OPS::Reprise::ReprisePtr deepCloneProgramUnit(OPS::Reprise::ProgramUnit& unit); 12 | 13 | OPS::Reprise::ReprisePtr deepCloneTranslationUnit(OPS::Reprise::TranslationUnit& unit); 14 | 15 | void doPostCloneLinkFix(const OPS::Reprise::RepriseBase& original, OPS::Reprise::RepriseBase& clone); 16 | 17 | OPS::Reprise::ReprisePtr cloneStatement( 18 | const OPS::Reprise::StatementBase& stmt, 19 | const OPS::Reprise::Declarations& sourceDeclarations, 20 | OPS::Reprise::Declarations& destDeclarations 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /include/Shared/ReprisePath.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "Reprise/Common.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Shared 10 | { 11 | typedef std::list ReprisePath; 12 | 13 | OPS_DEFINE_EXCEPTION_CLASS(InvalidReprisePath, OPS::RuntimeError) 14 | 15 | ReprisePath makePath(const OPS::Reprise::RepriseBase& obj, const OPS::Reprise::RepriseBase* root = 0); 16 | OPS::Reprise::RepriseBase* findByPath(OPS::Reprise::RepriseBase& root, ReprisePath path); 17 | 18 | template 19 | _Ty* findByPathEx(OPS::Reprise::RepriseBase& root, const ReprisePath& path) 20 | { 21 | OPS::Reprise::RepriseBase* node = findByPath(root, path); 22 | if (node != 0) 23 | return node->cast_ptr<_Ty>(); 24 | else 25 | return 0; 26 | } 27 | 28 | ReprisePath makePathFromString(const std::string& path); 29 | std::string makeStringFromPath(const ReprisePath& path); 30 | 31 | std::ostream& operator<<(std::ostream& os, const ReprisePath& path); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /include/Transforms/Data/CommonBlockToGlobalVars.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMONBLOCKTOGLOBALVARS_H 2 | #define COMMONBLOCKTOGLOBALVARS_H 3 | 4 | #include "Reprise/Units.h" 5 | #include "Reprise/Declarations.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | 12 | /// Convert single common block 13 | bool convertCommonBlockToGlobalVariables(Reprise::VariableDeclaration& commonBlockVariable); 14 | 15 | /// Convert all common blocks declared in fragment 16 | void convertAllCommonBlocksToGlobalVariables(Reprise::RepriseBase& node); 17 | 18 | } 19 | } 20 | 21 | #endif // COMMONBLOCKTOGLOBALVARS_H 22 | -------------------------------------------------------------------------------- /include/Transforms/DataDistribution/MPI/Block/BlocksHelper.h: -------------------------------------------------------------------------------- 1 | #ifndef I_MPI_DATA_DISTRIBUTION_BLOCKS_HELPER_INCLUDED 2 | #define I_MPI_DATA_DISTRIBUTION_BLOCKS_HELPER_INCLUDED 3 | 4 | #include "Reprise/Reprise.h" 5 | #include "Transforms/DataDistribution/MPI/Block/BlockingDescription.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | namespace DataDistribution 12 | { 13 | using OPS::Reprise::VariableDeclaration; 14 | using OPS::Reprise::SubroutineDeclaration; 15 | 16 | class BlocksHelper 17 | { 18 | public: 19 | static const std::string BLOCK_INDEX_NOTE_NAME; 20 | static const std::string OLD_EXPRESSION_NOTE_NAME; 21 | static const std::string PARAMETERS_FAMILY_NOTE_NAME; 22 | 23 | static bool findBlockIndexDeclarations(BlockingDescription& blockingDescription, SubroutineDeclaration& subroutineDeclaration, std::vector& foundDeclarations); 24 | }; 25 | } 26 | } 27 | } 28 | 29 | #endif // I_MPI_DATA_DISTRIBUTION_BLOCKS_HELPER_INCLUDED 30 | -------------------------------------------------------------------------------- /include/Transforms/DataDistribution/MPI/IMPIDataDistributionGather.h: -------------------------------------------------------------------------------- 1 | #ifndef I_MPI_DATA_DISTRIBUTION_GATHER_H_INCLUDED 2 | #define I_MPI_DATA_DISTRIBUTION_GATHER_H_INCLUDED 3 | 4 | #include "Reprise/Reprise.h" 5 | #include "Transforms/ITransformation.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | namespace DataDistribution 12 | { 13 | using OPS::Reprise::VariableDeclaration; 14 | 15 | // Интерфейс для сбора размещенных данных 16 | class IMPIDataDistributionGather: public ITransformation 17 | { 18 | public: 19 | // Задает объявление массива, который будет содержать размещенные данные. 20 | // Должен быть вызван до вызова метода makeTransformation. 21 | virtual void setNewArrayDeclaration(VariableDeclaration& newArrayDeclaration) = 0; 22 | 23 | virtual ~IMPIDataDistributionGather() {}; 24 | }; 25 | } 26 | } 27 | } 28 | 29 | #endif // I_MPI_DATA_DISTRIBUTION_GATHER_H_INCLUDED 30 | -------------------------------------------------------------------------------- /include/Transforms/DataDistribution/MPI/IMPIDataDistributionIteration.h: -------------------------------------------------------------------------------- 1 | #ifndef I_MPI_DATA_DISTRIBUTION_ITERATION_H_INCLUDED 2 | #define I_MPI_DATA_DISTRIBUTION_ITERATION_H_INCLUDED 3 | 4 | #include "Reprise/Reprise.h" 5 | #include "Transforms/ITransformation.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | namespace DataDistribution 12 | { 13 | using OPS::Reprise::VariableDeclaration; 14 | 15 | // Интерфейс для итерационного переразмещения данных 16 | class IMPIDataDistributionIteration: public ITransformation 17 | { 18 | public: 19 | // Задает объявление массива, который будет содержать размещенные данные. 20 | // Должен быть вызван до вызова метода makeTransformation. 21 | virtual void setNewArrayDeclaration(VariableDeclaration& newArrayDeclaration) = 0; 22 | 23 | virtual ~IMPIDataDistributionIteration() {}; 24 | }; 25 | } 26 | } 27 | } 28 | 29 | #endif // I_MPI_DATA_DISTRIBUTION_ITERATION_H_INCLUDED 30 | -------------------------------------------------------------------------------- /include/Transforms/DataDistribution/MPI/IMPIDataDistributionScatter.h: -------------------------------------------------------------------------------- 1 | #ifndef I_MPI_DATA_DISTRIBUTION_SCATTER_H_INCLUDED 2 | #define I_MPI_DATA_DISTRIBUTION_SCATTER_H_INCLUDED 3 | 4 | #include "Reprise/Reprise.h" 5 | #include "Transforms/ITransformation.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | namespace DataDistribution 12 | { 13 | using OPS::Reprise::VariableDeclaration; 14 | 15 | // Интерфейс для рассылки размещенных данных 16 | class IMPIDataDistributionScatter: public ITransformation 17 | { 18 | public: 19 | // Задает объявление массива, который будет содержать размещенные данные. 20 | // Должен быть вызван до вызова метода makeTransformation. 21 | virtual void setNewArrayDeclaration(VariableDeclaration& newArrayDeclaration) = 0; 22 | 23 | virtual ~IMPIDataDistributionScatter() {}; 24 | }; 25 | } 26 | } 27 | } 28 | 29 | #endif // I_MPI_DATA_DISTRIBUTION_SCATTER_H_INCLUDED 30 | -------------------------------------------------------------------------------- /include/Transforms/DataDistribution/MPI/IMPISingleAccessAreaProducer.h: -------------------------------------------------------------------------------- 1 | #ifndef I_MPI_SINGLE_ACCESS_AREA_PRODUCER_H_INCLUDED 2 | #define I_MPI_SINGLE_ACCESS_AREA_PRODUCER_H_INCLUDED 3 | 4 | #include "Reprise/Reprise.h" 5 | #include "Transforms/ITransformation.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | namespace DataDistribution 12 | { 13 | using OPS::Reprise::VariableDeclaration; 14 | 15 | // Интерфейс для создания области единичного доступа 16 | class IMPISingleAccessAreaProducer: public ITransformation 17 | { 18 | public: 19 | typedef std::list VariableDeclarationContainer; 20 | 21 | virtual void setDeclarationsToBcast(VariableDeclarationContainer declarations) = 0; 22 | 23 | virtual ~IMPISingleAccessAreaProducer() {}; 24 | }; 25 | } 26 | } 27 | } 28 | 29 | #endif // I_MPI_SINGLE_ACCESS_AREA_PRODUCER_H_INCLUDED 30 | -------------------------------------------------------------------------------- /include/Transforms/DataDistribution/Shared/BDExceptions.h: -------------------------------------------------------------------------------- 1 | #ifndef BD_EXCEPTIONS_H 2 | #define BD_EXCEPTIONS_H 3 | 4 | #include 5 | #include "OPS_Core/Exceptions.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | namespace DataDistribution 12 | { 13 | 14 | OPS_DEFINE_EXCEPTION_CLASS(BDException, OPS::RuntimeError) 15 | 16 | } 17 | } 18 | } 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/Transforms/Declarations/CopyDeclarations.h: -------------------------------------------------------------------------------- 1 | #ifndef COPYDECLARATIONS_H 2 | #define COPYDECLARATIONS_H 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | #include 7 | #include 8 | 9 | namespace OPS 10 | { 11 | namespace Transforms 12 | { 13 | namespace Declarations 14 | { 15 | 16 | class CopyDeclarations 17 | { 18 | public: 19 | /// конструктор 20 | CopyDeclarations(const std::vector& includePaths); 21 | 22 | /// формирует единицу трансляции содержащую объявления 23 | void initSourceTranslationUnit(std::string pathToFile); 24 | 25 | /// копирует все объявления в целевую (TargetTranslationUnit) единицу трансляции 26 | void copyAllDeclarations(Reprise::TranslationUnit* TargetTranslationUnit); 27 | 28 | /// копирует выбранное объявление функции в целевую (TargetTranslationUnit) единицу трансляции 29 | void copySubroutineDeclarationByName(Reprise::TranslationUnit* TargetTranslationUnit, std::string subroutineName); 30 | 31 | protected: 32 | Reprise::ReprisePtr m_unitWithDeclarations; 33 | std::vector m_includePaths; 34 | }; 35 | 36 | } 37 | } 38 | } 39 | 40 | #endif // COPYDECLARATIONS_H 41 | -------------------------------------------------------------------------------- /include/Transforms/Declarations/GenerateExtern.h: -------------------------------------------------------------------------------- 1 | /// Transforms/Declarations/GenerateExtern.h 2 | /// Generate necessary extern declarations if any declarations reference 3 | /// another translation unit. 4 | /// Author: Denis Dubrov (dubrov@sfedu.ru) 5 | /// Created: 9.03.2013 6 | 7 | #ifndef GENERATEEXTERN_H__ 8 | #define GENERATEEXTERN_H__ 9 | 10 | namespace OPS 11 | { 12 | namespace Reprise 13 | { 14 | class ProgramUnit; 15 | } 16 | // 17 | namespace Transforms 18 | { 19 | namespace Declarations 20 | { 21 | void generateExtern(OPS::Reprise::ProgramUnit& rProgramUnit); 22 | // 23 | } // namespace Declarations 24 | } // namespace Transforms 25 | } // namespace OPS 26 | 27 | #endif // GENERATEEXTERN_H__ 28 | 29 | // End of File 30 | -------------------------------------------------------------------------------- /include/Transforms/Declarations/RemoveDeadDeclarations.h: -------------------------------------------------------------------------------- 1 | #ifndef REMOVEDEADDECLARATIONS_H 2 | #define REMOVEDEADDECLARATIONS_H 3 | 4 | namespace OPS 5 | { 6 | 7 | namespace Reprise 8 | { 9 | class ProgramUnit; 10 | class TranslationUnit; 11 | } 12 | 13 | namespace Transformations 14 | { 15 | namespace Declarations 16 | { 17 | 18 | void removeDeadDeclarations(Reprise::ProgramUnit& program); 19 | 20 | } 21 | } 22 | } 23 | 24 | #endif // REMOVEDEADDECLARATIONS_H 25 | -------------------------------------------------------------------------------- /include/Transforms/Helpers/IsolateFrame/IsolateFrame.h: -------------------------------------------------------------------------------- 1 | #include "Transforms/Helpers/PrepareCadreDeclarations/PrepareCadreDeclarations.h" 2 | 3 | namespace OPS 4 | { 5 | namespace Transforms 6 | { 7 | namespace Helpers 8 | { 9 | using namespace Reprise; 10 | 11 | typedef RepriseList StatementList; 12 | typedef RepriseList VariableList; 13 | 14 | ReprisePtr isolateFrame(StatementBase& frame, 15 | ReplaceParams& to_replace, 16 | VariableList& localVariables); 17 | ReprisePtr isolateFrame(StatementList& frame, 18 | ReplaceParams& to_replace, 19 | VariableList& localVariables); 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /include/Transforms/Helpers/PrepareCadreDeclarations/PrepareCadreDeclarations.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Reprise/Statements.h" 3 | 4 | namespace OPS 5 | { 6 | namespace Transforms 7 | { 8 | namespace Helpers 9 | { 10 | 11 | 12 | 13 | typedef std::map ReplaceParams; 14 | typedef std::map ReplaceMap; 15 | 16 | 17 | ReplaceMap prepareCadreDeclaraions(ReplaceParams& to_replace); 18 | void replaceCadreVariables(Reprise::BlockStatement& block, ReplaceMap& to_replace); 19 | 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /include/Transforms/ITransformation.h: -------------------------------------------------------------------------------- 1 | #ifndef I_TRANSFORMATION_H 2 | #define I_TRANSFORMATION_H 3 | 4 | #include 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | class ITransformation 11 | { 12 | public: 13 | virtual bool analyseApplicability() = 0; 14 | 15 | virtual std::string getErrorMessage() = 0; 16 | 17 | virtual void makeTransformation() = 0; 18 | 19 | virtual ~ITransformation() {}; 20 | }; 21 | } 22 | } 23 | 24 | #endif // I_TRANSFORMATION_H 25 | -------------------------------------------------------------------------------- /include/Transforms/If/CanonizeIfGoto/CanonizeIfGoto.h: -------------------------------------------------------------------------------- 1 | #ifndef CANONIZE_IF_GOTO 2 | #define CANONIZE_IF_GOTO 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | 11 | bool canCanonizeIfGoto(OPS::Reprise::IfStatement& ifStatement); 12 | 13 | void canonizeIfGoto(OPS::Reprise::IfStatement& ifStatement); 14 | 15 | } 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /include/Transforms/If/CollapseIf/CollapseIf.h: -------------------------------------------------------------------------------- 1 | #ifndef COLLAPSE_IF_H 2 | #define COLLAPSE_IF_H 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | /** 11 | * @brief CollapseIf 12 | * convert IfStatement to simple ExpressionStatement 13 | * @param ifstatement 14 | * @return 15 | * new ExpressionStatement - result of transformation; 0 if cannot transform 16 | */ 17 | Reprise::ExpressionStatement* collapseIfToAssign(Reprise::IfStatement* ifstatement); 18 | } 19 | } 20 | 21 | #endif //COLLAPSE_IF_H 22 | -------------------------------------------------------------------------------- /include/Transforms/Loops/Canonizing/CanonizeFor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Reprise/Reprise.h" 3 | #include "Analysis/Montego/AliasAnalysis/AliasImplementation.h" 4 | 5 | namespace OPS 6 | { 7 | namespace Transforms 8 | { 9 | 10 | bool forIsCanonized(OPS::Reprise::ForStatement& fstmt, OPS::Montego::AliasImplementation &ai); 11 | 12 | //возвражает true, если получилось, false - если нет 13 | bool canonizeFor(OPS::Reprise::ForStatement& fstmt); 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /include/Transforms/Loops/Canonizing/ConvertLessEqualToLess.h: -------------------------------------------------------------------------------- 1 | #ifndef CONVERT_LESSEQUAL_TO_LESS__ 2 | #define CONVERT_LESSEQUAL_TO_LESS__ 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | 12 | bool canConvertLessEqualToLess(OPS::Reprise::ForStatement& forStat); 13 | 14 | OPS::Reprise::ForStatement& convertLessEqualToLess(OPS::Reprise::ForStatement& forStat); 15 | 16 | } 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /include/Transforms/Loops/Canonizing/ConvertStructCounter.h: -------------------------------------------------------------------------------- 1 | #ifndef CONVERT_STRUCT_COUNTER__ 2 | #define CONVERT_STRUCT_COUNTER__ 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | 12 | bool canChangeStructLoopCounter(OPS::Reprise::ForStatement& forStmt); 13 | 14 | OPS::Reprise::ForStatement& changeStructLoopCounter(OPS::Reprise::ForStatement& forStmt); 15 | 16 | } 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /include/Transforms/Loops/ExtractInvariant/ExtractInvariant.h: -------------------------------------------------------------------------------- 1 | #ifndef EXTRACTINVARIANT_H 2 | #define EXTRACTINVARIANT_H 3 | 4 | 5 | #include 6 | 7 | 8 | namespace OPS 9 | { 10 | namespace Analysis 11 | { 12 | void extractInvariant(Reprise::BasicCallExpression* expressionForReplace, Reprise::ForStatement* target); 13 | } 14 | } 15 | #endif // EXTRACTINVARIANT_H -------------------------------------------------------------------------------- /include/Transforms/Loops/IntToVector/IntToVector.h: -------------------------------------------------------------------------------- 1 | /**/ 2 | /*Вопросы: Олег 8-903-462-33-24*/ 3 | /*olegsteinb@gmail.com*/ 4 | 5 | #ifndef _INTTOVECTOR 6 | #define _INTTOVECTOR 7 | 8 | //#include "Reprise/Reprise.h" 9 | 10 | namespace OPS 11 | { 12 | namespace Transforms 13 | { 14 | namespace Loops 15 | { 16 | bool IntToVector(OPS::Reprise::ForStatement* pFor); 17 | //void replaceAll(std::list &result_list); 18 | } // Loops 19 | } // Transforms 20 | } // OPS 21 | 22 | #endif //_INTTOVECTOR 23 | -------------------------------------------------------------------------------- /include/Transforms/Loops/LoopFullUnrolling/LoopFullUnrolling.h: -------------------------------------------------------------------------------- 1 | #ifndef _LOOP_FULL_UNROLLING_H_INCLUDED_ 2 | #define _LOOP_FULL_UNROLLING_H_INCLUDED_ 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | namespace Loops 11 | { 12 | 13 | using OPS::Reprise::ForStatement; 14 | 15 | 16 | bool canApplyLoopFullUnrollingTo(ForStatement& forStatement); 17 | 18 | void makeLoopFullUnrolling(ForStatement& forStatement); 19 | 20 | } // Loops 21 | } // Transforms 22 | } // OPS 23 | 24 | #endif // _LOOP_FULL_UNROLLING_H_INCLUDED_ 25 | -------------------------------------------------------------------------------- /include/Transforms/Loops/LoopFusion/LoopFusion.h: -------------------------------------------------------------------------------- 1 | /*слияние циклов*/ 2 | /*Вопросы: Олег 8-903-462-33-24*/ 3 | /*olegsteinb@gmail.com*/ 4 | 5 | #ifndef _FUSION 6 | #define _FUSION 7 | 8 | #ifdef _MSC_VER 9 | #pragma warning(disable : 4008) // Запрещаем сообщение об обрубании имен в debug-версии 10 | #endif 11 | 12 | #include "Reprise/Reprise.h" 13 | 14 | namespace OPS 15 | { 16 | namespace Transforms 17 | { 18 | namespace Loops 19 | { 20 | /*Ф-ия слияния двух следующих друг за другом циклов*/ 21 | /*Пытается слить два цикла 22 | (начальные параметры отвечают за использование вспомогательных 23 | преобразований "растягивание скаляров" и "введение временных массивов")*/ 24 | bool LoopFusion(OPS::Reprise::ForStatement* loop1, OPS::Reprise::ForStatement* loop2, bool VarToArray = false, bool TempArrays = false); 25 | } // Loops 26 | } // Transforms 27 | } // OPS 28 | #endif //_FUSION 29 | -------------------------------------------------------------------------------- /include/Transforms/Loops/LoopHeaderRemoval/LoopHeaderRemoval.h: -------------------------------------------------------------------------------- 1 | #ifndef _LOOP_HEADER_REMOVAL_ 2 | #define _LOOP_HEADER_REMOVAL_ 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | namespace Loops 11 | { 12 | using OPS::Reprise::ForStatement; 13 | 14 | bool canApplyLoopHeaderRemovalTo(ForStatement& forStatement); 15 | void makeLoopHeaderRemoval(ForStatement& forStatement); 16 | 17 | } //Loops 18 | } //Transforms 19 | } //OPS 20 | #endif //_LOOP_HEADER_REMOVAL_ 21 | -------------------------------------------------------------------------------- /include/Transforms/Loops/LoopInterchange/LoopInterchange.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Reprise/Reprise.h" 4 | #include "Analysis/Montego/DependenceGraph/DependenceGraph.h" 5 | 6 | using OPS::Reprise::ForStatement; 7 | 8 | namespace OPS 9 | { 10 | namespace Transforms 11 | { 12 | namespace Loops 13 | { 14 | 15 | //на вход подается внешний цикл тесного гнезда 16 | //функция строит депграф 17 | bool canApplyLoopInterchangeTo(ForStatement& forStatement); 18 | 19 | //на вход подается внешний цикл тесного гнезда 20 | void makeLoopInterchange(ForStatement& forStatement); 21 | 22 | } // Loops 23 | } // Transforms 24 | } // OPS 25 | -------------------------------------------------------------------------------- /include/Transforms/Loops/LoopNestUnification/LoopNestUnification.h: -------------------------------------------------------------------------------- 1 | #ifndef LOOP_NEST_UNIFICATION 2 | #define LOOP_NEST_UNIFICATION 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | namespace Loops 11 | { 12 | 13 | // From 14 | 15 | // for(i = i0; i < n; ++i) 16 | // for(j = j0; j < m; ++j) 17 | // { 18 | // Block; 19 | // } 20 | 21 | // to 22 | 23 | // for(s = 0; s < (n - i0) * (m - j0); ++s) 24 | // { 25 | // i = i0 + s / (m - j0); 26 | // j = j0 + s % (m - j0); 27 | // { 28 | // Block; 29 | // } 30 | // } 31 | 32 | OPS::Reprise::ForStatement& loopNestUnification(OPS::Reprise::ForStatement &oldLoop, int maxDepth = 2); 33 | 34 | } //Loops 35 | } //Transforms 36 | } //OPS 37 | #endif 38 | -------------------------------------------------------------------------------- /include/Transforms/Loops/LoopSplitting/LoopSplitting.h: -------------------------------------------------------------------------------- 1 | #ifndef _LOOP_SPLIT_H_INCLUDED_ 2 | #define _LOOP_SPLIT_H_INCLUDED_ 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | namespace Loops 11 | { 12 | std::pair 13 | makeLoopSplitting(Reprise::ForStatement* forStatement, Reprise::ExpressionBase* minSplittingExpression, 14 | Reprise::ExpressionBase* maxSplittingExpression); 15 | std::pair 16 | makeLoopSplittingSafe(Reprise::ForStatement* forStatement, Reprise::ExpressionBase* splittingExpression); 17 | 18 | } // Loops 19 | } // Transforms 20 | } // OPS 21 | 22 | #endif // _LOOP_SPLIT_H_INCLUDED_ 23 | -------------------------------------------------------------------------------- /include/Transforms/Loops/LoopUnrolling/LoopUnrolling.h: -------------------------------------------------------------------------------- 1 | #ifndef _LOOP_UNROLLING_H_INCLUDED_ 2 | #define _LOOP_UNROLLING_H_INCLUDED_ 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | namespace Loops 11 | { 12 | 13 | using OPS::Reprise::ForStatement; 14 | 15 | 16 | bool canApplyLoopUnrollingTo(ForStatement& forStatement, qword); 17 | 18 | void makeLoopUnrolling(ForStatement& forStatement, qword h); 19 | 20 | } // Loops 21 | } // Transforms 22 | } // OPS 23 | 24 | #endif // _LOOP_UNROLLING_H_INCLUDED_ 25 | -------------------------------------------------------------------------------- /include/Transforms/Loops/RecurrentLoops/RecurrentLoops.h: -------------------------------------------------------------------------------- 1 | /*Разрезание циклов*/ 2 | /*Вопросы: Олег 8-903-462-33-24*/ 3 | /*olegsteinb@gmail.com*/ 4 | 5 | #ifndef _RECURR 6 | #define _RECURR 7 | 8 | #include "Reprise/Reprise.h" 9 | 10 | namespace OPS 11 | { 12 | namespace Transforms 13 | { 14 | namespace Loops 15 | { 16 | bool MakeRLT(OPS::Reprise::ForStatement* pFor, int number_of_proc = 2, const double Tf = 5, const double Ts = 7); 17 | } // Loops 18 | } // Transforms 19 | } // OPS 20 | 21 | #endif // _RECURR 22 | -------------------------------------------------------------------------------- /include/Transforms/Loops/RecurrentLoops/RootScan.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | typedef double number; 4 | 5 | inline int imax(int i, int j); 6 | inline number nabs(number x); 7 | int rootscan(number* coeff, int n); 8 | -------------------------------------------------------------------------------- /include/Transforms/Loops/StripMining/StripMining.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRIP_MINING_H_INCLUDED_ 2 | #define _STRIP_MINING_H_INCLUDED_ 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | namespace Loops 11 | { 12 | 13 | using OPS::Reprise::ReprisePtr; 14 | 15 | using OPS::Reprise::ForStatement; 16 | 17 | using OPS::Reprise::ExpressionBase; 18 | 19 | using OPS::Reprise::BlockStatement; 20 | 21 | 22 | bool canApplyStripMiningTo(ForStatement& forStatement, ReprisePtr); 23 | 24 | BlockStatement& makeStripMining(ForStatement& forStatement, ReprisePtr h); 25 | 26 | } // Loops 27 | } // Transforms 28 | } // OPS 29 | 30 | #endif // _STRIP_MINING_H_INCLUDED_ 31 | -------------------------------------------------------------------------------- /include/Transforms/Loops/TempArrays/TempArrays.h: -------------------------------------------------------------------------------- 1 | #ifndef _TEMPARRAYS 2 | #define _TEMPARRAYS 3 | 4 | #include "Reprise/Expressions.h" 5 | #include "Analysis/Montego/DependenceGraph/DependenceGraph.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | namespace Loops 12 | { 13 | //bool MakeTempArrayTrunsform(DepGraph::LampArrow* Arrow, DepGraph::IndOccurContainer& occurList, OPS::Reprise::ForStatement* pFor); 14 | bool MakeTempArrayTransform(OPS::Montego::DependenceGraph::ArcList::iterator Arrow, OPS::Reprise::ForStatement* pFor); 15 | } // Loops 16 | } // Transforms 17 | } // OPS 18 | 19 | #endif // _TEMPARRAYS 20 | -------------------------------------------------------------------------------- /include/Transforms/Loops/Var2Array/Var2Array.h: -------------------------------------------------------------------------------- 1 | #ifndef _VAR2ARRAY 2 | #define _VAR2ARRAY 3 | 4 | #include "Reprise/Expressions.h" 5 | #include "Analysis/Montego/DependenceGraph/DependenceGraph.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | namespace Loops 12 | { 13 | bool MakeVar2ArrayTransform(OPS::Montego::DependenceGraph::ArcList::iterator Arrow, OPS::Reprise::ForStatement* pFor); 14 | } // Loops 15 | } // Transforms 16 | } // OPS 17 | 18 | #endif // _VAR2ARRAY 19 | -------------------------------------------------------------------------------- /include/Transforms/MPI/MPIGlobalsProducer/IMPIGlobalsProducer.h: -------------------------------------------------------------------------------- 1 | #ifndef I_MPI_GLOBALS_PRODUCER_H_INCLUDED 2 | #define I_MPI_GLOBALS_PRODUCER_H_INCLUDED 3 | 4 | #include "Transforms/MPI/Utils/MPIProducerFactory.h" 5 | #include "Transforms/ITransformation.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | namespace MPIProducer 12 | { 13 | using OPS::Transforms::ITransformation; 14 | 15 | class MPIProducerFactory; 16 | /** 17 | Need to be called before all MPI transformation 18 | Summary 19 | 1) Find the entry point of input program <-- Need to give the entry point in parameters 20 | 2) Add call of MPI_Init as first executable statement of the program 21 | 3) Add call of MPI_finalise as last executable statement of the program 22 | 23 | To particular information see documentation 24 | */ 25 | class IMPIGlobalsProducer: public ITransformation 26 | { 27 | public: 28 | virtual ~IMPIGlobalsProducer() { }; 29 | }; 30 | } 31 | } 32 | } 33 | 34 | #endif // I_MPI_GLOBALS_PRODUCER_H_INCLUDED 35 | -------------------------------------------------------------------------------- /include/Transforms/MPI/MPIGlobalsProducer/IMPIRankProducer.h: -------------------------------------------------------------------------------- 1 | #ifndef I_MPI_RANK_PRODUCER_H_INCLUDED 2 | #define I_MPI_RANK_PRODUCER_H_INCLUDED 3 | 4 | #include "Transforms/MPI/Utils/MPIProducerFactory.h" 5 | #include "Transforms/ITransformation.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | namespace MPIProducer 12 | { 13 | using OPS::Reprise::BasicType; 14 | using OPS::Transforms::ITransformation; 15 | 16 | class IMPIRankProducer: public ITransformation 17 | { 18 | public: 19 | virtual ~IMPIRankProducer() {}; 20 | 21 | virtual const BasicType* getRankType() const = 0; 22 | }; 23 | } 24 | } 25 | } 26 | 27 | #endif // I_MPI_RANK_PRODUCER_H_INCLUDED 28 | -------------------------------------------------------------------------------- /include/Transforms/MPI/MPIGlobalsProducer/IMPISizeProducer.h: -------------------------------------------------------------------------------- 1 | #ifndef I_MPI_SIZE_PRODUCER_H_INCLUDED 2 | #define I_MPI_SIZE_PRODUCER_H_INCLUDED 3 | 4 | #include "Transforms/MPI/Utils/MPIProducerFactory.h" 5 | #include "Transforms/ITransformation.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Transforms 10 | { 11 | namespace MPIProducer 12 | { 13 | using OPS::Reprise::BasicType; 14 | using OPS::Transforms::ITransformation; 15 | 16 | class IMPISizeProducer: public ITransformation 17 | { 18 | public: 19 | virtual ~IMPISizeProducer() {}; 20 | 21 | virtual const BasicType* getSizeType() const = 0; 22 | }; 23 | } 24 | } 25 | } 26 | 27 | #endif // I_MPI_SIZE_PRODUCER_H_INCLUDED 28 | -------------------------------------------------------------------------------- /include/Transforms/Scalar/ConstantPropagation/ConstantPropagation.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONSTANT_PROPAGATION_H_INCLUDED_ 2 | #define _CONSTANT_PROPAGATION_H_INCLUDED_ 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | namespace Scalar 11 | { 12 | 13 | void makeConstantPropagation(OPS::Reprise::BlockStatement& blockStatement); 14 | 15 | // Возвращает true если переменная является константой 16 | bool isConstantVariable(OPS::Reprise::VariableDeclaration& variable); 17 | 18 | // Функция протягивает константные переменные типа: const int X = 10 19 | void propagateConstantVariable(OPS::Reprise::VariableDeclaration& variable); 20 | void propagateConstantVariables(const std::set& variables); 21 | 22 | // Протянуть все константные переменные объявленные во фрагменте 23 | void propagateAllConstantVariables(OPS::Reprise::RepriseBase& fragment); 24 | 25 | } // Scalar 26 | } // OPS 27 | } // Transforms 28 | 29 | #endif // _CONSTANT_PROPAGATION_H_INCLUDED_ 30 | -------------------------------------------------------------------------------- /include/Transforms/Scalar/InductionSubstitution/InductionSubstitution.h: -------------------------------------------------------------------------------- 1 | #ifndef _INDUCTION_SUBSTITION_H_INCLUDED_ 2 | #define _INDUCTION_SUBSTITION_H_INCLUDED_ 3 | 4 | #include "Analysis/InductionVariables/InductionVariables.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | namespace Scalar 11 | { 12 | 13 | using OPS::Analysis::LoopInductionAnalysis; 14 | using OPS::Reprise::ReprisePtr; 15 | using OPS::Reprise::ExpressionBase; 16 | 17 | //данные для восстановления после замены переменных 18 | typedef std::map > ReplaceMap; 19 | 20 | //если есть эталонная переменная, подставить её во все вхождения индуктивных переменных 21 | //возвращает данные для восстановления 22 | ReplaceMap substituteAllInductionVariables(LoopInductionAnalysis& inductions); 23 | 24 | //отменить подстановку эталонной переменной 25 | //если подставленные узлы ВП уже кто-то удалил, возвращает false 26 | void undoInductionSubstitution(ReplaceMap& undoData); 27 | 28 | 29 | 30 | } // Scalar 31 | } // Transforms 32 | } // OPS 33 | 34 | #endif // _INDUCTION_SUBSTITION_H_INCLUDED_ 35 | -------------------------------------------------------------------------------- /include/Transforms/Scalar/LocalizationScalar/LocalizationScalar.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_TRANSFORMATIOINS_LOCALIZATION_SCALAR_H_ 2 | #define OPS_TRANSFORMATIOINS_LOCALIZATION_SCALAR_H_ 3 | 4 | 5 | #include "Reprise/Reprise.h" 6 | 7 | #include "Analysis/ComplexOccurrenceAnalysis/GrouppedOccurrences.h" 8 | 9 | namespace OPS 10 | { 11 | namespace Transforms 12 | { 13 | namespace Scalar 14 | { 15 | class LocalizationScalar 16 | { 17 | public: 18 | LocalizationScalar(Reprise::ProgramFragment& program, Analysis::OccurrencesByDeclarations& in, Analysis::OccurrencesByDeclarations& out); 19 | 20 | void makeTransform(); 21 | Reprise::ProgramFragment& getProgram(); 22 | Analysis::OccurrencesByDeclarations& getIn(); 23 | Analysis::OccurrencesByDeclarations& getOut(); 24 | private: 25 | Analysis::OccurrencesByDeclarations& m_inOccurrencesByDeclarations; 26 | Analysis::OccurrencesByDeclarations& m_outOccurrencesByDeclarations; 27 | Reprise::ProgramFragment& m_fragment; 28 | }; 29 | } 30 | } 31 | } 32 | #endif // OPS_TRANSFORMATIOINS_LOCALIZATION_SCALAR_H_ 33 | -------------------------------------------------------------------------------- /include/Transforms/Scalar/SSASubstitutionForward/SSASubstitutionForward.h: -------------------------------------------------------------------------------- 1 | #ifndef _SSA_SUBSTITUTION_FORWARD_H_INCLUDED_ 2 | #define _SSA_SUBSTITUTION_FORWARD_H_INCLUDED_ 3 | 4 | #include "Reprise/Reprise.h" 5 | #include "Analysis/SSAForm/SSAForm.h" 6 | 7 | 8 | namespace OPS 9 | { 10 | namespace Transforms 11 | { 12 | namespace Scalar 13 | { 14 | 15 | 16 | using OPS::Reprise::ExpressionBase; 17 | using OPS::Reprise::BasicCallExpression; 18 | using OPS::Analysis::SSAForms::SSAForm; 19 | 20 | 21 | 22 | 23 | /***************************************************************** 24 | на вход подаётся SSA-форма, генератор и выражение, в которое следует подставить правую часть этого генератора 25 | Если переменная, имеющая вхождение в правой части гернератора, к моменту подстановки успевает изменить значение, 26 | создается её копия рядом с генератором 27 | ******************************************************************/ 28 | void makeSSASubstitutionForward(SSAForm& ssa, BasicCallExpression& generator, ExpressionBase& expressionTo); 29 | 30 | } // Scalar 31 | } // Transforms 32 | } // OPS 33 | 34 | #endif // _SSA_SUBSTITUTION_FORWARD_H_INCLUDED_ 35 | -------------------------------------------------------------------------------- /include/Transforms/Scalar/Silly/SillyTranslationUnit.h: -------------------------------------------------------------------------------- 1 | /// Transforms/Scalar/Silly/SillyTranslationUnit.h 2 | /// Test transformation applied to the translation unit. 3 | /// Author: Denis Dubrov (dubrov@sfedu.ru) 4 | /// Created: 20.11.2013 5 | 6 | #ifndef SILLYTRANSLATIONUNIT_H__ 7 | #define SILLYTRANSLATIONUNIT_H__ 8 | 9 | namespace OPS 10 | { 11 | namespace Reprise 12 | { 13 | class TranslationUnit; 14 | } 15 | 16 | namespace Transforms 17 | { 18 | namespace Scalar 19 | { 20 | void applySillyToTranslationUnit( 21 | OPS::Reprise::TranslationUnit& rTranslationUnit); 22 | 23 | } // namespace Scalar 24 | } // namespace Transforms 25 | } // namespace OPS 26 | 27 | #endif // SILLYTRANSLATIONUNIT_H__ 28 | 29 | // End of File 30 | -------------------------------------------------------------------------------- /include/Transforms/Scalar/SubstitutionForward/SubstitutionForward.h: -------------------------------------------------------------------------------- 1 | #ifndef _SUBSTITUTION_FORWARD_H_INCLUDED_ 2 | #define _SUBSTITUTION_FORWARD_H_INCLUDED_ 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | namespace Scalar 11 | { 12 | 13 | using OPS::Reprise::ReprisePtr; 14 | 15 | using OPS::Reprise::StatementBase; 16 | using OPS::Reprise::ExpressionBase; 17 | 18 | using OPS::Reprise::BlockStatement; 19 | 20 | 21 | void makeSubstitutionForward(StatementBase& statementTo, ExpressionBase& expressionInstead, ReprisePtr expressionWhat, 22 | bool changeLeftPartOfAssign = false); 23 | 24 | void makeSubstitutionForward(ExpressionBase& expressionTo, ExpressionBase& expressionInstead, ReprisePtr expressionWhat, 25 | bool changeLeftPartOfAssign = false); 26 | 27 | } // Scalar 28 | } // Transforms 29 | } // OPS 30 | 31 | #endif // _SUBSTITUTION_FORWARD_H_INCLUDED_ 32 | -------------------------------------------------------------------------------- /include/Transforms/Statements/DeleteUnusedLabels.h: -------------------------------------------------------------------------------- 1 | #ifndef DELETE_UNUSED_LABELS_H_ 2 | #define DELETE_UNUSED_LABELS_H_ 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | 11 | void deleteUnusedLabels(OPS::Reprise::StatementBase& statement); 12 | 13 | } 14 | } 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /include/Transforms/Statements/SwapStatements.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_TRANSFORMATIOINS_SWAP_STATEMENTS_H_ 2 | #define OPS_TRANSFORMATIOINS_SWAP_STATEMENTS_H_ 3 | 4 | #include "Transforms/TransformArgs.h" 5 | #include "Transforms/TransformsHub.h" 6 | #include "Reprise/Reprise.h" 7 | #include "Reprise/Statements.h" 8 | 9 | namespace OPS 10 | { 11 | namespace Transforms 12 | { 13 | /* 14 | * Возвращает true, если после перемены местами двух стетментов программа останентся эквивалентной исходной, 15 | * и false в противном случае. 16 | */ 17 | bool maySwapStmts (/*const*/ Reprise::StatementBase* /*const*/ stmt1, /*const*/ Reprise::StatementBase* /*const*/ stmt2); 18 | 19 | /* 20 | * Возвращает true, если преобразование сработало (т. е. если maySwap от тех же аргуметов вернёт true), 21 | * и false в противном случае. 22 | */ 23 | bool trySwapStmts (/*const*/ Reprise::StatementBase* /*const*/ stmt1, /*const*/ Reprise::StatementBase* /*const*/ stmt2); 24 | 25 | } // end namespace Transforms 26 | } // end namespace OPS 27 | 28 | #endif // OPS_TRANSFORMATIOINS_SWAP_STATEMENTS_H_ 29 | -------------------------------------------------------------------------------- /include/Transforms/Subroutines/DeadSubroutineElimination.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_DEAD_SUBROUTINE_ELIMINATION_H_INCLUDED__ 2 | #define OPS_DEAD_SUBROUTINE_ELIMINATION_H_INCLUDED__ 3 | 4 | #include 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | namespace Subroutines 11 | { 12 | 13 | /// Удаляет все функции, которые прямо или косвенно не вызываются из главной функции mainSubroutine 14 | /// Возвращает количество удаленных функций 15 | int removeDeadSubroutines(OPS::Reprise::SubroutineDeclaration& mainSubroutine); 16 | 17 | /// Удаляет все неиспользуемые функции. Используемыми считаются только те, которые переданы в списке usedSubroutines 18 | /// Возвращает количество удаленных функций 19 | int removeDeadSubroutines(const std::set& usedSubroutines); 20 | 21 | } 22 | } 23 | } 24 | 25 | #endif // OPS_DEAD_SUBROUTINE_ELIMINATION_H_INCLUDED__ 26 | -------------------------------------------------------------------------------- /include/Transforms/Subroutines/FragmentToSubroutine.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_FRAGMENT_TO_SUBROUTINE_H_INCLUDED_ 2 | #define OPS_FRAGMENT_TO_SUBROUTINE_H_INCLUDED_ 3 | 4 | 5 | #include "Transforms/TransformArgs.h" 6 | #include "Transforms/TransformsHub.h" 7 | 8 | #include "Reprise/Reprise.h" 9 | namespace OPS { 10 | namespace Transforms{ 11 | 12 | namespace Subroutines { 13 | 14 | OPS::Reprise::SubroutineDeclaration* fragmentToSubroutine(Reprise::BlockStatement::Iterator first, Reprise::BlockStatement::Iterator last); 15 | 16 | class FragmentToSubroutine : public OPS::TransformationsHub::TransformBase 17 | { 18 | public: 19 | class FragmentToSubroutineException: public OPS::Exception 20 | { 21 | public: 22 | FragmentToSubroutineException(std::string message): OPS::Exception(message) {}; 23 | }; 24 | 25 | FragmentToSubroutine(); 26 | 27 | virtual bool isApplicable(Reprise::ProgramUnit *program, const OPS::TransformationsHub::ArgumentValues &args, std::string *message); 28 | virtual void makeTransformImpl(OPS::Reprise::ProgramUnit* program, const OPS::TransformationsHub::ArgumentValues& params); 29 | }; 30 | 31 | } 32 | 33 | } 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /include/Transforms/Subroutines/InliningWithSubstitution.h: -------------------------------------------------------------------------------- 1 | #ifndef INLININGWITHSUBSTITUTION_H 2 | #define INLININGWITHSUBSTITUTION_H 3 | 4 | #include "Transforms/Subroutines/Inlining.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | namespace Subroutines 11 | { 12 | 13 | void makeInliningWithSubstitution(OPS::Reprise::SubroutineCallExpression* pCall); 14 | 15 | class InliningWithSubtitution : public OPS::TransformationsHub::TransformBase 16 | { 17 | public: 18 | InliningWithSubtitution(); 19 | virtual void makeTransformImpl(OPS::Reprise::ProgramUnit *program, const OPS::TransformationsHub::ArgumentValues ¶ms); 20 | }; 21 | 22 | } 23 | } 24 | } 25 | 26 | #endif // INLININGWITHSUBSTITUTION_H 27 | -------------------------------------------------------------------------------- /include/Transforms/Subroutines/SubroutineSplitting.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_SUBROUTINE_SPLITTING_H_INCLUDED__ 2 | #define OPS_SUBROUTINE_SPLITTING_H_INCLUDED__ 3 | 4 | #include "Transforms/TransformArgs.h" 5 | #include "Transforms/TransformsHub.h" 6 | 7 | #include "Reprise/Reprise.h" 8 | namespace OPS { 9 | namespace Transforms{ 10 | 11 | namespace Subroutines { 12 | 13 | bool splitSubroutine(OPS::Reprise::SubroutineDeclaration* subroutine, OPS::Reprise::BlockStatement::Iterator place, OPS::Reprise::ProgramUnit* unit); 14 | 15 | class SubroutineSplitting : public OPS::TransformationsHub::TransformBase 16 | { 17 | public: 18 | class SubroutineSplittingException: public OPS::Exception 19 | { 20 | public: 21 | SubroutineSplittingException(std::string message): OPS::Exception(message) {}; 22 | }; 23 | 24 | SubroutineSplitting(); 25 | 26 | virtual bool isApplicable(Reprise::ProgramUnit *program, const OPS::TransformationsHub::ArgumentValues &args, std::string *message); 27 | virtual void makeTransformImpl(OPS::Reprise::ProgramUnit* program, const OPS::TransformationsHub::ArgumentValues& params); 28 | }; 29 | 30 | } 31 | 32 | } 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /include/Transforms/TransformsPasses.h: -------------------------------------------------------------------------------- 1 | #ifndef TRANSFORMS_PASSES_H 2 | #define TRANSFORMS_PASSES_H 3 | 4 | // Standard includes 5 | 6 | // OPS includes 7 | #include "OPS_Stage/Passes.h" 8 | 9 | // Local includes 10 | 11 | // Global defines and macros 12 | 13 | // Enter namespace 14 | namespace OPS 15 | { 16 | namespace Stage 17 | { 18 | 19 | // Constants and enums 20 | 21 | // Global classes 22 | 23 | class LoopDistributionDone {}; // LoopDistribution не выдает никаких результатов наружу 24 | 25 | class LoopDistributionPass : public PassBase 26 | { 27 | public: 28 | LoopDistributionPass(); 29 | bool run(); 30 | }; 31 | 32 | class LoopFragmentationPass : public PassBase 33 | { 34 | public: 35 | LoopFragmentationPass(); 36 | bool run(); 37 | AnalysisUsage getAnalysisUsage() const; 38 | }; 39 | 40 | class DataDistributionForSharedMemoryPass : public PassBase 41 | { 42 | public: 43 | DataDistributionForSharedMemoryPass(); 44 | bool run(); 45 | }; 46 | 47 | 48 | // Global functions 49 | 50 | // Exit namespace 51 | 52 | } 53 | } 54 | 55 | #endif // TRANSFORMS_PASSES_H 56 | -------------------------------------------------------------------------------- /samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(DIRECTORY ./ DESTINATION samples COMPONENT Samples PATTERN "CMakeLists.txt" EXCLUDE) 2 | -------------------------------------------------------------------------------- /source/3rd/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpsGroup/open-ops/b1ab8da354c4aecc0fe76a562395f5861bffc207/source/3rd/README -------------------------------------------------------------------------------- /source/Analysis/.gitignore: -------------------------------------------------------------------------------- 1 | /[Bb]in 2 | /obj 3 | /[Dd]ebug 4 | /[Rr]elease 5 | /*.user 6 | /*.aps 7 | /*.eto 8 | -------------------------------------------------------------------------------- /source/Analysis/AliasAnalysis/PointersTable.cpp: -------------------------------------------------------------------------------- 1 | #include "Analysis/AliasAnalysis/PointersTable.h" 2 | 3 | namespace OPS 4 | { 5 | namespace AliasAnalysis 6 | { 7 | 8 | void EntriesPointersTable::SetSAMC(ReferenceExpression* referenceExpression, SetAbstractMemoryCell samc) 9 | { 10 | m_entriesPointerMap[referenceExpression]=samc; 11 | }; 12 | 13 | SetAbstractMemoryCell EntriesPointersTable::GetSAMC(ReferenceExpression* referenceExpression) 14 | { 15 | return m_entriesPointerMap[referenceExpression]; 16 | }; 17 | 18 | void EntriesPointersTable::UnionSAMC(ReferenceExpression* referenceExpression, SetAbstractMemoryCell samc2) 19 | { 20 | SetAbstractMemoryCell samc_src = m_entriesPointerMap[referenceExpression]; 21 | samc_src.insert(samc_src.end(), samc2.begin(), samc2.end()); 22 | m_entriesPointerMap[referenceExpression] = samc_src; 23 | }; 24 | 25 | void EntriesPointersTable::Clear() 26 | { 27 | m_entriesPointerMap.clear(); 28 | }; 29 | 30 | } // end namespace AliasAnalysis 31 | } // end namespace OPS 32 | -------------------------------------------------------------------------------- /source/Analysis/AliasAnalysis/testmod/tests/test.c: -------------------------------------------------------------------------------- 1 | int a; 2 | int k; 3 | int *p; 4 | 5 | int* fn(int *i) 6 | { 7 | i=&k; 8 | p=&a; 9 | return p; 10 | } 11 | 12 | int main() 13 | { 14 | int b; 15 | int c; 16 | int m[10]; 17 | int *q; 18 | 19 | q=&b; 20 | p=&c; 21 | q=fn(q); 22 | 23 | a=*p; 24 | b=*q; 25 | } 26 | -------------------------------------------------------------------------------- /source/Analysis/AnalysisPlugin.h: -------------------------------------------------------------------------------- 1 | #ifndef _ANALYSIS_PLUGIN_H_INCLUDED_ 2 | #define _ANALYSIS_PLUGIN_H_INCLUDED_ 3 | 4 | #include 5 | 6 | namespace OPS 7 | { 8 | namespace Analysis 9 | { 10 | class AnalysisPlugin 11 | : public Core::IPlugin 12 | { 13 | public: 14 | 15 | AnalysisPlugin(); 16 | 17 | public: // Core::IPlugin 18 | 19 | virtual void initialize(); // override 20 | virtual void terminate(); // override 21 | }; 22 | } 23 | } 24 | 25 | #endif // _ANALYSIS_PLUGIN_H_INCLUDED_ 26 | -------------------------------------------------------------------------------- /source/Analysis/CalculationGraph/restrictions.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpsGroup/open-ops/b1ab8da354c4aecc0fe76a562395f5861bffc207/source/Analysis/CalculationGraph/restrictions.txt -------------------------------------------------------------------------------- /source/Analysis/CalculationGraph/testmods/testmod1/input/Program.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | double A[10],b; 4 | int i; 5 | for (i = 0; i < 10; i++) 6 | { 7 | if (i>5) 8 | A[i] = 10 - A[i-1]; 9 | else 10 | A[i] = 10 + A[i-1]; 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /source/Analysis/ConsistCheck/ConsistCheckService.cpp: -------------------------------------------------------------------------------- 1 | #include "ConsistCheckService.h" 2 | 3 | #include "ConsistCheckWalker.h" 4 | 5 | #include 6 | 7 | using namespace OPS::Reprise; 8 | 9 | namespace OPS 10 | { 11 | 12 | namespace Analysis 13 | { 14 | 15 | ConsistCheckService::ConsistCheckService() 16 | { 17 | } 18 | 19 | ConsistCheckService::~ConsistCheckService() 20 | { 21 | } 22 | 23 | bool ConsistCheckService::matchTo(const RepriseBase &repriseObject, 24 | const ConditionList &conditions) const 25 | { 26 | ConsistCheckWalker consistCheckWalker(conditions); 27 | 28 | const_cast(repriseObject).accept(consistCheckWalker); 29 | 30 | return consistCheckWalker.getResult(); 31 | } 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /source/Analysis/ConsistCheck/ConsistCheckService.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONSIST_CHECK_SERVICE_H_INCLUDED_ 2 | #define _CONSIST_CHECK_SERVICE_H_INCLUDED_ 3 | 4 | #include "Analysis/ConsistCheck/IConsistCheckService.h" 5 | 6 | namespace OPS 7 | { 8 | 9 | namespace Analysis 10 | { 11 | 12 | class ConsistCheckService 13 | : public IConsistCheckService 14 | { 15 | public: 16 | ConsistCheckService(); 17 | ~ConsistCheckService(); 18 | 19 | virtual bool matchTo(const Reprise::RepriseBase& repriseObject, 20 | const ConditionList& conditions) const; 21 | }; 22 | 23 | } 24 | 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /source/Analysis/DepGraph/testmod/test/test1.c: -------------------------------------------------------------------------------- 1 | int b[50][50],a[10][10],x[50],k; 2 | 3 | int main() 4 | { 5 | int i,j; 6 | for(i=1;i<=10;i=i+1) 7 | {for ( j=1 ;j<=i; j=j+1) 8 | { 9 | a[i][j]=a[j][i]+b[i][j]; 10 | } 11 | } 12 | } 13 | 14 | //int i = 0, j = 0, k = 0; 15 | //int a[10], b[10], c[10]; 16 | //int main() 17 | //{ 18 | // 19 | // 20 | //for(i = 0; i < 2; i++) 21 | // 22 | //{ 23 | // 24 | //for(j = 0; j < 5; j++) 25 | // 26 | //{ 27 | // 28 | //a[5*i + j + 1] = b[5*i + 3*j + 2]; 29 | // 30 | //c[5*i + j + 4] = b[5*i + 12*j + 12]; 31 | // 32 | //} 33 | //} 34 | // 35 | // 36 | //} -------------------------------------------------------------------------------- /source/Analysis/DominanceFrontierGraph/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(DominanceFrontierGraph_test) 2 | 3 | ops_project( 4 | DominanceFrontierGraph_test APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Transforms 10 | Frontend 11 | Analysis 12 | Shared 13 | Backends 14 | ) 15 | -------------------------------------------------------------------------------- /source/Analysis/DominanceFrontierGraph/testmod/Samples/LoopNest.cpp: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i, k=0, p = 5, A[100]; 4 | int j = 0; 5 | ; 6 | for(i = 0; i<10; i = i + 1) 7 | { 8 | for( j = 10; j>0; j = j - 1) 9 | { 10 | } 11 | } 12 | return i; 13 | } -------------------------------------------------------------------------------- /source/Analysis/DominanceFrontierGraph/testmod/Samples/Straight.cpp: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i; 4 | int j, k; 5 | i=0; 6 | j=i+1; 7 | i=1; 8 | k=j+1; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /source/Analysis/InductionVariables/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(Induction_testmod) 2 | 3 | ops_project( 4 | Induction_testmod APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Transforms 10 | Frontend 11 | Analysis 12 | Shared 13 | Backends 14 | ) 15 | -------------------------------------------------------------------------------- /source/Analysis/InductionVariables/testmod/Samples/Induction.cpp: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i, k=0, p = 5, A[100]; 4 | int j = 0; 5 | ; 6 | for(i = 0; i<10; i = j + 1) 7 | { 8 | j = i + 1; 9 | A[k] = A [p]; 10 | k = k + 1; 11 | p = k + j; 12 | A[k] = A [p]; 13 | 14 | } 15 | return i; 16 | } -------------------------------------------------------------------------------- /source/Analysis/InductionVariables/testmod/Samples/Induction2.cpp: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i=0; 4 | i=0; 5 | while(i<10 ) 6 | { 7 | i = i + 1; 8 | } 9 | return i; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(CountIntPoints/testmodCountIntPoints) 2 | add_subdirectory(testmod3) 3 | add_subdirectory(testmod4) -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/CountIntPoints/IOfunctions.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "IOfunctions.h" 3 | #include "FunctionsVerge.h" 4 | 5 | namespace OPS 6 | { 7 | namespace LatticeGraph 8 | { 9 | namespace CountIntPoints 10 | { 11 | 12 | void Read_MatrixFromFile(std::ifstream& fin,matrix *mat) 13 | { 14 | int nbrows, nbcolumns, i, j ; 15 | //(void) scanf ("%d %d", &nbrows, &nbcolumns) ; 16 | fin>>nbrows>>nbcolumns; 17 | //fin.get(nbrows);fin.get(nbcolumns); 18 | Alloc_Matrix(mat, nbrows, nbcolumns); 19 | for (i=0;i>mat->p[i][j]; 22 | //(void) scanf ("%d", &(mat->p[i] [j] )); 23 | 24 | } /* Read.Matrix From File*/ 25 | 26 | 27 | void Write_MatrixToFile(std::ofstream& fout, matrix *mat,int dim) 28 | { 29 | int nbrows, i, j; 30 | //(void) printf("%d %d\n", nbrows=mat->nbrows, dim); 31 | nbrows=mat->nbrows; 32 | fout<p[i][j]<<" "; 37 | //(void) printf ("%4d", mat->p[i] [j] ); 38 | fout<<"\n"; 39 | } 40 | } /* Write.Matrix */ 41 | 42 | 43 | }//end of namespace 44 | }//end of namespace 45 | }//end of namespace 46 | 47 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/CountIntPoints/IOfunctions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "StructuresVerge.h" 4 | #include 5 | #include 6 | 7 | 8 | namespace OPS 9 | { 10 | namespace LatticeGraph 11 | { 12 | namespace CountIntPoints 13 | { 14 | 15 | void Read_MatrixFromFile(std::ifstream& fin,matrix *mat); 16 | 17 | void Write_MatrixToFile(std::ofstream& fout, matrix *mat,int dim); 18 | 19 | }//end of namespace 20 | }//end of namespace 21 | }//end of namespace 22 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/CountIntPoints/LLL.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Analysis/LatticeGraph/RationalNumber.h" 4 | 5 | namespace OPS 6 | { 7 | namespace LatticeGraph 8 | { 9 | namespace CountIntPoints 10 | { 11 | 12 | //a[i] - векторы, n - размерность и количество векторов, delta - параметр LLL-алгоритма 13 | void LLL(RationalNumber* a, int n, double delta); 14 | 15 | }//end of namespace 16 | }//end of namespace 17 | }//end of namespace 18 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/CountIntPoints/StructuresVerge.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace OPS 4 | { 5 | namespace LatticeGraph 6 | { 7 | namespace CountIntPoints 8 | { 9 | 10 | const int TOP = 2147483647; 11 | 12 | typedef struct vector 13 | { 14 | int size; 15 | int *p; 16 | } vector; 17 | 18 | typedef struct matrix 19 | { 20 | int nbrows; 21 | int nbcolumns; 22 | int **p; 23 | int *p_init; 24 | } matrix; 25 | 26 | }//end of namespace 27 | }//end of namespace 28 | }//end of namespace 29 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/CountIntPoints/testmodCountIntPoints/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(CountIntPoints_testmod) 2 | 3 | ops_project( 4 | CountIntPoints_testmod APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Shared 11 | Backends 12 | Transforms 13 | ) 14 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/CountIntPoints/testmodCountIntPoints/infile.dat: -------------------------------------------------------------------------------- 1 | 5 5 2 | 1 -2 2 -1 0 3 | 1 4 2 -1 0 4 | 1 2 6 -3 -20 5 | 1 -6 10 -5 -24 6 | 1 0 0 0 1 -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/ParamPoint.cpp: -------------------------------------------------------------------------------- 1 | #include "Analysis/LatticeGraph/ParamPoint.h" 2 | 3 | #include "OPS_Core/msc_leakcheck.h" 4 | 5 | namespace OPS 6 | { 7 | namespace LatticeGraph 8 | { 9 | 10 | ParamPoint::ParamPoint(int n):std::vector(n) 11 | { 12 | } 13 | 14 | }//end of namespace 15 | }//end of namespace 16 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/testmod3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(LatGraph_testmod) 2 | 3 | ops_project( 4 | LatGraph_testmod APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Shared 11 | Backends 12 | Transforms 13 | ) 14 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/testmod3/test/test1.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int x[10],i,k; 4 | for (k=0; k<10; k++) 5 | { 6 | for (i=1; i<10; i++) 7 | { 8 | x[i] = 1; 9 | } 10 | 11 | for (i=1; i<10; i++) 12 | { 13 | x[i] = 2; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/testmod3/test/test2.c: -------------------------------------------------------------------------------- 1 | int i, j, k; 2 | int uf[365][195][8], vf[365][195][8], fsm[365][195]; 3 | 4 | int main() 5 | { 6 | for(k=0; k < 8; ++k) 7 | { 8 | for(j=0; j < 195; ++j) 9 | { 10 | uf[365][j][k] = 1.e-10; 11 | vf[365][j][k] = 1.e-10; 12 | uf[1][j][k] = 1.e-10; 13 | vf[1][j][k] = 1.e-10; 14 | } 15 | for(j=0; j < 195; ++j) 16 | { 17 | for(i=0; i < 365; ++i) 18 | { 19 | uf[i][j][k] = uf[i][j][k]*fsm[i][j]; 20 | vf[i][j][k] = vf[i][j][k]*fsm[i][j]; 21 | } 22 | } 23 | } 24 | 25 | return 0; 26 | } -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/testmod3/test/test3.c: -------------------------------------------------------------------------------- 1 | int main() 2 | {int i,j,x[10][10],n1,n2,n3,n4,n5; 3 | for (i=0;i<10;i++) 4 | { 5 | for (j=0;j<10;j++) 6 | { 7 | x[i][j]=x[i-1][j]; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/testmod4/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(QuastParser_testmod) 2 | 3 | ops_project( 4 | QuastParser_testmod APP 5 | SOURCES 6 | main.cpp 7 | generated/SimpleLexer.cpp 8 | generated/SimpleParser.cpp 9 | generated/SimpleLexer.h 10 | generated/SimpleParser.h 11 | LIBRARIES 12 | Reprise 13 | Frontend 14 | Shared 15 | Backends 16 | Transforms 17 | TEMPLATES 18 | ANTLR 19 | ) 20 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/testmod4/generated/Simple.tokens: -------------------------------------------------------------------------------- 1 | T_NIL=14 2 | T_IF=15 3 | T_VEC_end=9 4 | T_NEWPARAM=12 5 | T_EOF=20 6 | T_OR=18 7 | Digit=6 8 | T_AND=17 9 | T_CLOSE_BR=11 10 | T_OPEN_BR=10 11 | T_DIV=13 12 | T_LIST=19 13 | WS=5 14 | T_DIGIT_STRING=7 15 | T_VEC_beg=8 16 | T_NEWLINE=4 17 | T_NOT=16 18 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/testmod4/generated/SimpleLexer.g: -------------------------------------------------------------------------------- 1 | lexer grammar SimpleLexer; 2 | 3 | options 4 | { 5 | language = C; 6 | } 7 | 8 | T_NEWLINE 9 | : '\r'? '\n' {$channel = HIDDEN;} 10 | ; 11 | 12 | WS : (' ' | '\t') {$channel = HIDDEN;} 13 | ; 14 | 15 | T_DIGIT_STRING 16 | : Digit+ 17 | ; 18 | 19 | T_VEC_beg 20 | :'*[' 21 | ; 22 | T_VEC_end 23 | :']' 24 | ; 25 | 26 | T_OPEN_BR 27 | :'(' 28 | ; 29 | T_CLOSE_BR 30 | :')' 31 | ; 32 | T_NEWPARAM 33 | :'newparm' 34 | ; 35 | 36 | T_DIV 37 | :'div' 38 | ; 39 | T_NIL 40 | :'nil' 41 | ; 42 | T_IF 43 | :'if' 44 | ; 45 | T_NOT 46 | :'not' 47 | ; 48 | T_AND 49 | :'and' 50 | ; 51 | T_OR 52 | :'or' 53 | ; 54 | T_LIST 55 | :'list' 56 | ; 57 | 58 | 59 | 60 | 61 | T_EOF : '__T_EOF__'; 62 | 63 | /* fragments */ 64 | 65 | fragment 66 | Digit : '0'..'9' ; 67 | 68 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/testmod4/generated/SimpleLexer.tokens: -------------------------------------------------------------------------------- 1 | T_NIL=14 2 | T_IF=15 3 | T_VEC_end=9 4 | T_NEWPARAM=12 5 | T_EOF=20 6 | T_OR=18 7 | Digit=6 8 | T_AND=17 9 | T_CLOSE_BR=11 10 | T_OPEN_BR=10 11 | T_DIV=13 12 | T_LIST=19 13 | WS=5 14 | T_DIGIT_STRING=7 15 | T_VEC_beg=8 16 | T_NEWLINE=4 17 | T_NOT=16 18 | -------------------------------------------------------------------------------- /source/Analysis/LatticeGraph/testmod4/input: -------------------------------------------------------------------------------- 1 | (if 2 | *[jhgf -4 0 5] and *[ 2 34 ] 3 | () () 4 | ) -------------------------------------------------------------------------------- /source/Analysis/Montego/AliasAnalysis/DynamicMemoryAllotmentSearchVisitor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | здесь описан клас DinMemAllotmentSearchVisitor - визитор для поиска функций 4 | динамического выделения памяти в программе 5 | */ 6 | 7 | #include 8 | #include "Reprise/Service/DeepWalker.h" 9 | 10 | namespace OPS 11 | { 12 | namespace Montego 13 | { 14 | 15 | class DynamicMemoryAllotmentSearchVisitor : public OPS::Reprise::Service::DeepWalker 16 | { 17 | public: 18 | DynamicMemoryAllotmentSearchVisitor(); 19 | 20 | //выполняет accept 21 | DynamicMemoryAllotmentSearchVisitor(OPS::Reprise::SubroutineDeclaration& e); 22 | 23 | void visit(OPS::Reprise::SubroutineCallExpression& e); 24 | 25 | std::list getDinMemAllotmentList(); 26 | 27 | // есть ли данная строка в массиве m_funcNames 28 | static bool isMemAllocFuncName(std::string s); 29 | 30 | private: 31 | std::list m_dinMemAllotmentList; 32 | }; 33 | 34 | 35 | }//end of namespace 36 | }//end of namespace 37 | -------------------------------------------------------------------------------- /source/Analysis/Montego/AliasAnalysis/perftest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(MontegoAliases_perftest) 2 | 3 | ops_project( 4 | MontegoAliases_perftest APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Analysis 10 | Frontend 11 | Shared 12 | Backends 13 | Transforms 14 | ) 15 | -------------------------------------------------------------------------------- /source/Analysis/Montego/AliasAnalysis/perftest/tests/cfg.c: -------------------------------------------------------------------------------- 1 | void empty() 2 | { 3 | } 4 | 5 | void multiBlocks() 6 | { 7 | { 8 | { 9 | } 10 | { 11 | } 12 | } 13 | } 14 | 15 | void linear() 16 | { 17 | int x, y, z; 18 | x = 0; 19 | y = 10; 20 | z = x+y; 21 | } 22 | 23 | void ifStmt() 24 | { 25 | int x,y; 26 | if (x > 0) 27 | x = 1; 28 | else 29 | x = -1; 30 | y = x; 31 | } 32 | 33 | void switchStmt() 34 | { 35 | int x, y, z; 36 | switch(x) 37 | { 38 | case 1: 39 | case 2: 40 | x = y; 41 | break; 42 | case 3: 43 | x = z; 44 | default: 45 | z = y; 46 | } 47 | } 48 | 49 | void forStmt() 50 | { 51 | int i, x; 52 | for(i=0; i< 10; ++i) 53 | x *=2; 54 | } 55 | 56 | void forStmtGoto() 57 | { 58 | int i, x; 59 | goto l; 60 | for(i=0; i < 10; ++i) 61 | { 62 | l: x++; 63 | } 64 | } 65 | 66 | void whileStmt() 67 | { 68 | while(0) 69 | { 70 | } 71 | 1+1; 72 | } 73 | 74 | void doWhileStmt() 75 | { 76 | do 77 | { 78 | 79 | } 80 | while(0); 81 | 1+1; 82 | } 83 | -------------------------------------------------------------------------------- /source/Analysis/Montego/AliasAnalysis/perftest/tests/dc/macrodef.h: -------------------------------------------------------------------------------- 1 | #define PutErrMsg(msg) {printf(" %s, errno = %d\n", msg, 0);} 2 | 3 | #define WriteToFile(ptr,size,nitems,stream,logf) if( fwrite(ptr,size,nitems,stream) != nitems )\ 4 | {\ 5 | printf("\n Write error from WriteToFile()\n"); return ADC_WRITE_FAILED; \ 6 | } 7 | 8 | #ifdef WINNT 9 | #define FSEEK(stream,offset,whence) fseek(stream, (long)offset,whence); 10 | #else 11 | #define FSEEK(stream,offset,whence) fseek(stream,offset,whence); 12 | #endif 13 | 14 | #define GetRecSize(nd,nm) (DIM_FSZ*nd+MSR_FSZ*nm) 15 | -------------------------------------------------------------------------------- /source/Analysis/Montego/AliasAnalysis/perftest/tests/dc/npbparams.h: -------------------------------------------------------------------------------- 1 | #define CLASS 'S' 2 | /* 3 | This file is generated automatically by the setparams utility. 4 | It sets the number of processors and the class of the NPB 5 | in this directory. Do not modify it by hand. 6 | This file provided for backward compatibility. 7 | It is not used in DC benchmark. */ 8 | 9 | long long int input_tuples=1000, attrnum=5; 10 | #define COMPILETIME "15 Nov 2010" 11 | #define NPBVERSION "3.3" 12 | #define CC "cc" 13 | #define CFLAGS "-O" 14 | #define CLINK "$(CC)" 15 | #define CLINKFLAGS "-O" 16 | #define C_LIB "(none)" 17 | #define C_INC "(none)" 18 | -------------------------------------------------------------------------------- /source/Analysis/Montego/AliasAnalysis/perftest/tests/dc/rbt.h: -------------------------------------------------------------------------------- 1 | #ifndef _ADC_PARVIEW_TREE_DEF_H_ 2 | #define _ADC_PARVIEW_TREE_DEF_H_ 3 | 4 | #define MAX_TREE_HEIGHT 64 5 | enum{BLACK,RED}; 6 | 7 | typedef struct treeNode{ 8 | struct treeNode *left; 9 | struct treeNode *right; 10 | uint32 clr; 11 | int64 nodeMemPool[1]; 12 | } treeNode; 13 | 14 | typedef struct RBTree{ 15 | treeNode root; 16 | treeNode * mp; 17 | uint32 count; 18 | uint32 treeNodeSize; 19 | uint32 nodeDataSize; 20 | uint32 memoryLimit; 21 | uint32 memaddr; 22 | uint32 memoryIsFull; 23 | uint32 freeNodeCounter; 24 | uint32 nNodesLimit; 25 | uint32 nd; 26 | uint32 nm; 27 | uint32 *drcts; 28 | treeNode **nodes; 29 | unsigned char * memPool; 30 | } RBTree; 31 | 32 | #define NEW_TREE_NODE(node_ptr,memPool,memaddr,treeNodeSize, \ 33 | freeNodeCounter,memoryIsFull) \ 34 | node_ptr=(struct treeNode*)(memPool+memaddr); \ 35 | memaddr+=treeNodeSize; \ 36 | (freeNodeCounter)--; \ 37 | if( freeNodeCounter == 0 ) { \ 38 | memoryIsFull = 1; \ 39 | } 40 | 41 | int32 TreeInsert(RBTree *tree, uint32 *attrs); 42 | 43 | #endif /* _ADC_PARVIEW_TREE_DEF_H_ */ 44 | -------------------------------------------------------------------------------- /source/Analysis/Montego/AliasAnalysis/perftest/tests/lbm/config.h: -------------------------------------------------------------------------------- 1 | /* $Id: config.h,v 1.5 2004/04/20 14:42:56 pohlt Exp $ */ 2 | 3 | /*############################################################################*/ 4 | 5 | #ifndef _CONFIG_H_ 6 | #define _CONFIG_H_ 7 | 8 | /*############################################################################*/ 9 | 10 | #define SIZE (100) 11 | #define SIZE_X (1*SIZE) 12 | #define SIZE_Y (1*SIZE) 13 | #define SIZE_Z (130) 14 | 15 | #define OMEGA (1.95) 16 | 17 | #define OUTPUT_PRECISION float 18 | 19 | #define BOOL int 20 | #define TRUE (-1) 21 | #define FALSE (0) 22 | 23 | /*############################################################################*/ 24 | 25 | #endif /* _CONFIG_H_ */ 26 | -------------------------------------------------------------------------------- /source/Analysis/Montego/AliasAnalysis/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(MontegoAliases_testmod) 2 | 3 | ops_project( 4 | MontegoAliases_testmod APP 5 | SOURCES 6 | AliasAnalysisTester.cpp 7 | AliasAnalysisTester.h 8 | main.cpp 9 | LIBRARIES 10 | Reprise 11 | Analysis 12 | Frontend 13 | Shared 14 | Backends 15 | Transforms 16 | ) 17 | -------------------------------------------------------------------------------- /source/Analysis/Montego/AliasAnalysis/testmod/test/compile.bat: -------------------------------------------------------------------------------- 1 | cl test\test1_fprintf.c /Fotest\test1_fprintf.obj /Fetest\test1_fprintf.exe -------------------------------------------------------------------------------- /source/Analysis/Montego/AliasAnalysis/testmod/test/test1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a; 6 | sqrt(a); 7 | } 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /source/Analysis/Montego/AliasAnalysis/testmod/test/test2.c: -------------------------------------------------------------------------------- 1 | //#include 2 | 3 | int main() 4 | { 5 | int x, y, z, i, j, k, grid[10]; 6 | for( i = -2; i < 2; i++ ) 7 | { 8 | for( j = 0; j < 10; j++ ) 9 | { 10 | for( k = 0; k < 11; k++ ) 11 | { 12 | if ( x == 0 || x == 5 || y == 0 || y == 11 ) 13 | { 14 | {grid[2] = 1;} 15 | 16 | if ( (z == 0 || z == 2) && !((int *)grid)[3]) 17 | grid[4] = 5; 18 | } 19 | } 20 | } 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /source/Analysis/Montego/SafeStatus.cpp: -------------------------------------------------------------------------------- 1 | #include "Analysis/Montego/SafeStatus.h" 2 | 3 | namespace OPS 4 | { 5 | namespace Montego 6 | { 7 | 8 | SafeStatus::SafeStatus(status_t s):m_status(s) 9 | { 10 | } 11 | 12 | SafeStatus::SafeStatus(const SafeStatus& s):m_status(s.getStatusData()) 13 | { 14 | } 15 | 16 | SafeStatus& SafeStatus::operator=(const SafeStatus& s) 17 | { 18 | m_status=s.getStatusData(); 19 | return *this; 20 | } 21 | 22 | bool SafeStatus::isStatus(status_t s) const 23 | { 24 | return (m_status & s) == s; 25 | } 26 | 27 | SafeStatus::status_t SafeStatus::getStatusData() const 28 | { 29 | return m_status; 30 | } 31 | 32 | void SafeStatus::addStatus(status_t s) 33 | { 34 | m_status |= s; 35 | } 36 | 37 | void SafeStatus::replaceAllStatusBy(status_t s) 38 | { 39 | m_status = s; 40 | } 41 | 42 | void SafeStatus::clearAllStatus(status_t s) 43 | { 44 | m_status = 0; 45 | } 46 | 47 | void SafeStatus::unsetStatus(status_t s) 48 | { 49 | m_status = m_status & (~s); 50 | } 51 | 52 | }//end of namespace 53 | }//end of namespace 54 | -------------------------------------------------------------------------------- /source/Analysis/Profiler/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(Profiler_test) 2 | 3 | ops_project( 4 | Profiler_test APP 5 | SOURCES 6 | testmod/Profiler_test.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Analysis 11 | Transforms 12 | ) 13 | -------------------------------------------------------------------------------- /source/Analysis/Profiler/testmod/samples/test.c: -------------------------------------------------------------------------------- 1 | 2 | int filter(int A[10][10], int i, int j) 3 | { 4 | return ((A[i+1][j] + A[i][j+1] + A[i-1][j] + A[i][j-1]) / 4); 5 | } 6 | 7 | 8 | int main() { 9 | int A[10][10]; 10 | int B[10][10]; 11 | int S; 12 | int i,j; 13 | 14 | S = 0; 15 | 16 | for(i = 0; i < 10; i++) 17 | { 18 | for(j = 0; j < 10; j++) 19 | { 20 | B[i][j] = filter(A,i,j); 21 | S = S + A[i][j];; 22 | }; 23 | } 24 | 25 | S = S + 10; 26 | return 0;; 27 | } -------------------------------------------------------------------------------- /source/Analysis/Renewal/AliasAnalysis/AliasAnalysisServiceState.h: -------------------------------------------------------------------------------- 1 | #ifndef _ALIAS_ANALYSIS_SERVICE_STATE_H_INCLUDED_ 2 | #define _ALIAS_ANALYSIS_SERVICE_STATE_H_INCLUDED_ 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace OPS 9 | { 10 | 11 | namespace Montego 12 | { 13 | 14 | class AliasInterface; 15 | class OccurrenceContainer; 16 | 17 | } 18 | 19 | namespace Renewal 20 | { 21 | 22 | struct AliasAnalysisState 23 | : public Shared::ContextObserverState 24 | { 25 | std::unique_ptr aliasAnalyzer; 26 | std::unique_ptr occurrenceAnalyzer; 27 | }; 28 | 29 | } 30 | 31 | } 32 | 33 | #endif // _ALIAS_ANALYSIS_SERVICE_STATE_H_INCLUDED_ 34 | -------------------------------------------------------------------------------- /source/Analysis/Renewal/AliasAnalysis/IOccurrenceAnalyzerHolder.h: -------------------------------------------------------------------------------- 1 | #ifndef _I_OCCURRENCE_ANALYZER_HOLDER_H_INCLUDED_ 2 | #define _I_OCCURRENCE_ANALYZER_HOLDER_H_INCLUDED_ 3 | 4 | namespace OPS 5 | { 6 | 7 | namespace Montego 8 | { 9 | 10 | class OccurrenceContainer; 11 | 12 | } 13 | 14 | namespace Reprise 15 | { 16 | 17 | class RepriseBase; 18 | 19 | } 20 | 21 | namespace Renewal 22 | { 23 | 24 | namespace Internals 25 | { 26 | 27 | class IOccurrenceAnalyzerHolder 28 | { 29 | public: 30 | virtual Montego::OccurrenceContainer& reqestOccurrenceAnalyzer( 31 | const Reprise::RepriseBase& context) = 0; 32 | 33 | protected: 34 | inline ~IOccurrenceAnalyzerHolder() {} 35 | }; 36 | 37 | } 38 | 39 | } 40 | 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /source/Analysis/Renewal/OccurrenceAnalysis/OccurrenceAnalysisService.h: -------------------------------------------------------------------------------- 1 | #ifndef _OCCURRENCE_ANALYSIS_SERVICE_H_INCLUDED_ 2 | #define _OCCURRENCE_ANALYSIS_SERVICE_H_INCLUDED_ 3 | 4 | #include "Analysis/Renewal/OccurrenceAnalysis/IOccurrenceAnalysisService.h" 5 | 6 | #include 7 | 8 | #include 9 | 10 | namespace OPS 11 | { 12 | 13 | namespace Montego 14 | { 15 | 16 | class OccurrenceContainer; 17 | 18 | } 19 | 20 | namespace Renewal 21 | { 22 | 23 | class OccurrenceAnalysisService 24 | : public Shared::ContextObserverBase 25 | , public IOccurrenceAnalysisService 26 | { 27 | public: 28 | OccurrenceAnalysisService(); 29 | 30 | ~OccurrenceAnalysisService(); 31 | 32 | public: 33 | virtual Occurrences findAllOccurrences(const Reprise::RepriseBase& rootNode); 34 | 35 | protected: 36 | virtual void syncronizeWithContext(const Reprise::RepriseBase& context); 37 | 38 | private: 39 | Montego::OccurrenceContainer& getOccurrenceAnalyzer( 40 | const Reprise::RepriseBase& context) const; 41 | }; 42 | 43 | } 44 | 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /source/Analysis/Renewal/OccurrenceAnalysis/OccurrenceAnalysisServiceState.h: -------------------------------------------------------------------------------- 1 | #ifndef _OCCURRENCE_ANALYSIS_SERVICE_STATE_H_INCLUDED_ 2 | #define _OCCURRENCE_ANALYSIS_SERVICE_STATE_H_INCLUDED_ 3 | 4 | #include 5 | 6 | namespace OPS 7 | { 8 | 9 | namespace Montego 10 | { 11 | 12 | class OccurrenceContainer; 13 | 14 | } 15 | 16 | namespace Renewal 17 | { 18 | 19 | struct OccurrenceAnalysisServiceState 20 | : public Shared::ContextObserverState 21 | { 22 | OccurrenceAnalysisServiceState() 23 | : occurrenceAnalyzer(NULL) 24 | { 25 | } 26 | 27 | Montego::OccurrenceContainer* occurrenceAnalyzer; 28 | }; 29 | 30 | } 31 | 32 | } 33 | 34 | #endif // _OCCURRENCE_ANALYSIS_SERVICE_STATE_H_INCLUDED_ 35 | -------------------------------------------------------------------------------- /source/Analysis/SSAForm/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(SSAForm_test) 2 | 3 | ops_project( 4 | SSAForm_test APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Analysis 11 | Shared 12 | Backends 13 | ) 14 | -------------------------------------------------------------------------------- /source/Analysis/SSAForm/testmod/Samples/Loop.cpp: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i, k=0, p = 5, A[100]; 4 | int j = 0; 5 | j=0; 6 | for(i = 0; i<10; i = i + 1) 7 | { 8 | j=1; 9 | } 10 | return i; 11 | } -------------------------------------------------------------------------------- /source/Analysis/SSAForm/testmod/Samples/LoopNest.cpp: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i, p = 5, A[100]; 4 | int j = 10; 5 | int k = 0; 6 | ; 7 | for(i = 0; i<10; i = i + 1) 8 | { 9 | int ppc = 16; 10 | for( j = 10; j>0; j = j - 1) 11 | { 12 | } 13 | } 14 | return i; 15 | } -------------------------------------------------------------------------------- /source/Analysis/SSAForm/testmod/Samples/Straight.cpp: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i; 4 | int j, k; 5 | i=0; 6 | j=i+1; 7 | i=1; 8 | k=j+1; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /source/Analysis/SSAForm/testmod/Samples/goto continue break.cpp: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | { 4 | goto jj; 5 | jj: ; 6 | } 7 | return 0; 8 | } -------------------------------------------------------------------------------- /source/Backends/BackendsPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "BackendsPlugin.h" 2 | 3 | #include 4 | 5 | EXPORT_STATIC_PLUGIN2(BackendsPlugin, OPS::Backends::BackendsPlugin) 6 | 7 | namespace OPS 8 | { 9 | namespace Backends 10 | { 11 | BackendsPlugin::BackendsPlugin() 12 | { 13 | } 14 | 15 | void BackendsPlugin::initialize() 16 | { 17 | } 18 | 19 | void BackendsPlugin::terminate() 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/Backends/BackendsPlugin.h: -------------------------------------------------------------------------------- 1 | #ifndef _BACKENDS_PLUGIN_H_INCLUDED_ 2 | #define _BACKENDS_PLUGIN_H_INCLUDED_ 3 | 4 | #include 5 | 6 | namespace OPS 7 | { 8 | namespace Backends 9 | { 10 | class BackendsPlugin 11 | : public Core::IPlugin 12 | { 13 | public: 14 | 15 | BackendsPlugin(); 16 | 17 | public: // Core::IPlugin 18 | 19 | virtual void initialize(); // override 20 | virtual void terminate(); // override 21 | }; 22 | } 23 | } 24 | 25 | #endif // _BACKENDS_PLUGIN_H_INCLUDED_ 26 | -------------------------------------------------------------------------------- /source/Backends/RepriseToClang/ClangExpressions.h: -------------------------------------------------------------------------------- 1 | /// ClangExpressions.h 2 | /// Create clang expressions from Reprise expressions. 3 | /// Author: Denis Dubrov (dubrov@sfedu.ru) 4 | /// Created: 12.04.2013 5 | 6 | #ifndef CLANG_EXPRESSIONS_H__ 7 | #define CLANG_EXPRESSIONS_H__ 8 | 9 | #include "R2CDeclNodes.h" 10 | 11 | namespace clang 12 | { 13 | class ASTContext; 14 | class Expr; 15 | } 16 | 17 | namespace OPS 18 | { 19 | namespace Reprise 20 | { 21 | class ExpressionBase; 22 | } 23 | 24 | namespace Backends 25 | { 26 | namespace Clang 27 | { 28 | namespace Internal 29 | { 30 | clang::Expr* getClangExpr( 31 | clang::ASTContext &rASTContext, 32 | OPS::Reprise::ExpressionBase& rExpressionBase, 33 | R2CDeclNodes& rR2CDeclNodes, 34 | bool needLtoRconversion = false); 35 | 36 | } // namespace Internal 37 | } // namespace Clang 38 | } // namespace Backends 39 | } // namespace OPS 40 | 41 | #endif // CLANG_EXPRESSIONS_H__ 42 | 43 | // End of File 44 | -------------------------------------------------------------------------------- /source/Backends/RepriseToClang/ClangStatements.h: -------------------------------------------------------------------------------- 1 | /// ClangStatements.h 2 | /// Create clang statements from Reprise statements. 3 | /// Author: Denis Dubrov (dubrov@sfedu.ru) 4 | /// Created: 9.08.2013 5 | 6 | #ifndef CLANG_STATEMENTS_H__ 7 | #define CLANG_STATEMENTS_H__ 8 | 9 | #include "R2CDeclNodes.h" 10 | 11 | namespace clang 12 | { 13 | class ASTContext; 14 | class Stmt; 15 | } 16 | 17 | namespace OPS 18 | { 19 | namespace Reprise 20 | { 21 | class StatementBase; 22 | } 23 | 24 | namespace Backends 25 | { 26 | namespace Clang 27 | { 28 | namespace Internal 29 | { 30 | clang::Stmt* getClangStmt( 31 | clang::ASTContext &rASTContext, 32 | OPS::Reprise::StatementBase& rStatementBase, 33 | R2CDeclNodes& rR2CDeclNodes); 34 | 35 | } // namespace Internal 36 | } // namespace Clang 37 | } // namespace Backends 38 | } // namespace OPS 39 | 40 | #endif // CLANG_STATEMENTS_H__ 41 | 42 | // End of File 43 | -------------------------------------------------------------------------------- /source/Backends/RepriseToClang/ClangTypes.h: -------------------------------------------------------------------------------- 1 | /// ClangTypes.h 2 | /// Create clang types from Reprise types. 3 | /// Author: Denis Dubrov (dubrov@sfedu.ru) 4 | /// Created: 12.04.2013 5 | 6 | #ifndef CLANG_TYPES_H__ 7 | #define CLANG_TYPES_H__ 8 | 9 | #include "OPS_Core/disable_llvm_warnings_begin.h" 10 | #include "clang/AST/Type.h" 11 | #include "OPS_Core/disable_llvm_warnings_end.h" 12 | 13 | #include "R2CDeclNodes.h" 14 | 15 | #include 16 | 17 | namespace clang 18 | { 19 | enum StorageClass; 20 | class ASTContext; 21 | } 22 | 23 | namespace OPS 24 | { 25 | namespace Reprise 26 | { 27 | class TypeBase; 28 | class VariableDeclarators; 29 | } 30 | 31 | namespace Backends 32 | { 33 | namespace Clang 34 | { 35 | namespace Internal 36 | { 37 | clang::StorageClass getClangStorageClass( 38 | const OPS::Reprise::VariableDeclarators& rcVariableDeclarators); 39 | 40 | clang::QualType getClangQualType( 41 | clang::ASTContext &rASTContext, 42 | OPS::Reprise::TypeBase& rType, 43 | R2CDeclNodes& rR2CDeclNodes); 44 | 45 | } // namespace Internal 46 | } // namespace Clang 47 | } // namespace Backends 48 | } // namespace OPS 49 | 50 | #endif // CLANG_TYPES_H__ 51 | 52 | // End of File 53 | -------------------------------------------------------------------------------- /source/Backends/RepriseToClang/R2CDeclNodes.h: -------------------------------------------------------------------------------- 1 | /// R2CDeclNodes.h 2 | /// Declaration for a map RepriseBase -> cland Decl. 3 | /// Author: Denis Dubrov (dubrov@sfedu.ru) 4 | /// Created: 9.08.2013 5 | 6 | #ifndef R2CDECLNODES_H__ 7 | #define R2CDECLNODES_H__ 8 | 9 | #include 10 | 11 | namespace clang 12 | { 13 | class Decl; 14 | } 15 | 16 | namespace OPS 17 | { 18 | namespace Reprise 19 | { 20 | class RepriseBase; 21 | } 22 | 23 | namespace Backends 24 | { 25 | namespace Clang 26 | { 27 | namespace Internal 28 | { 29 | typedef 30 | std::map 31 | R2CDeclNodes; 32 | 33 | } // namespace Internal 34 | } // namespace Clang 35 | } // namespace Backends 36 | } // namespace OPS 37 | 38 | #endif // R2CDECLNODES_H__ 39 | 40 | // End of File 41 | -------------------------------------------------------------------------------- /source/Backends/RepriseToClang/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CMakeLists.txt for the R2Clang project 2 | 3 | # 4 | # Create an OPS subproject 5 | # 6 | ops_project( 7 | R2Clang_test APP 8 | SOURCES 9 | R2Clang_main.cpp 10 | LIBRARIES 11 | Analysis 12 | Backends 13 | Frontend 14 | Reprise 15 | Shared 16 | #Transforms 17 | DEPENDS 18 | ClangParser 19 | OPS_Core 20 | ) 21 | 22 | # End of File 23 | -------------------------------------------------------------------------------- /source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Analysis) 2 | add_subdirectory(Backends) 3 | add_subdirectory(ClangParser) 4 | add_subdirectory(FrontTransforms) 5 | add_subdirectory(Frontend) 6 | add_subdirectory(OPS_Core) 7 | add_subdirectory(OPS_Stage) 8 | add_subdirectory(Reprise) 9 | add_subdirectory(Shared) 10 | add_subdirectory(Transforms) 11 | -------------------------------------------------------------------------------- /source/ClangParser/.gitignore: -------------------------------------------------------------------------------- 1 | /[Bb]in 2 | /obj 3 | /[Dd]ebug 4 | /[Rr]elease 5 | /*.user 6 | /*.aps 7 | /*.eto 8 | -------------------------------------------------------------------------------- /source/ClangParser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CMakeLists.txt for ClangParser project 2 | 3 | project(ClangParser) 4 | 5 | ops_filesin( 6 | INTERFACE 7 | "../../include/ClangParser/" 8 | clangParser.h 9 | clangParserSettings.h 10 | ClangGenerator.h 11 | PragmaHandler.h 12 | ) 13 | 14 | ops_project( 15 | # 16 | ClangParser LIB 17 | # 18 | SOURCES 19 | # 20 | ${INTERFACE} 21 | AST2RepriseConsumers.h 22 | RepriseDiagnosticClient.h 23 | ClangParserPlugin.h 24 | ClangParserPlugin.cpp 25 | AST2RepriseConsumers.cpp 26 | clangParser.cpp 27 | clangParserRepriseFacade.cpp 28 | clangParserSettings.cpp 29 | RepriseDiagnosticClient.cpp 30 | ClangGenerator.cpp 31 | PragmaHandler.cpp 32 | # 33 | LIBRARIES 34 | # 35 | OPS_Core 36 | OPS_Stage 37 | Reprise 38 | # 39 | PUBLIC 40 | ) 41 | 42 | 43 | # End of File 44 | -------------------------------------------------------------------------------- /source/ClangParser/ClangParserPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "ClangParserPlugin.h" 2 | 3 | #include 4 | #include "ClangParser/PragmaHandler.h" 5 | 6 | EXPORT_STATIC_PLUGIN2(ClangParserPlugin, OPS::ClangParser::ClangParserPlugin) 7 | 8 | namespace OPS 9 | { 10 | namespace ClangParser 11 | { 12 | ClangParserPlugin::ClangParserPlugin() 13 | { 14 | } 15 | 16 | void ClangParserPlugin::initialize() 17 | { 18 | OPS::ClangParser::registerPragmaHandler(OPS::ClangParser::createOpsPragmaHandlers); 19 | } 20 | 21 | void ClangParserPlugin::terminate() 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /source/ClangParser/ClangParserPlugin.h: -------------------------------------------------------------------------------- 1 | #ifndef _CLANG_PARSER_PLUGIN_H_INCLUDED_ 2 | #define _CLANG_PARSER_PLUGIN_H_INCLUDED_ 3 | 4 | #include 5 | 6 | namespace OPS 7 | { 8 | namespace ClangParser 9 | { 10 | class ClangParserPlugin 11 | : public Core::IPlugin 12 | { 13 | public: 14 | 15 | ClangParserPlugin(); 16 | 17 | public: // Core::IPlugin 18 | 19 | virtual void initialize(); // override 20 | virtual void terminate(); // override 21 | }; 22 | } 23 | } 24 | 25 | #endif // _CLANG_PARSER_PLUGIN_H_INCLUDED_ 26 | -------------------------------------------------------------------------------- /source/ClangParser/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpsGroup/open-ops/b1ab8da354c4aecc0fe76a562395f5861bffc207/source/ClangParser/README -------------------------------------------------------------------------------- /source/ClangParser/RepriseDiagnosticClient.h: -------------------------------------------------------------------------------- 1 | #ifndef REPRISE_DIAGNOSTIC_CLIENT_H 2 | #define REPRISE_DIAGNOSTIC_CLIENT_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "Reprise/Reprise.h" 8 | #include "Reprise/ParserResult.h" 9 | 10 | namespace clang 11 | { 12 | class DiagnosticConsumer; 13 | } 14 | 15 | namespace OPS 16 | { 17 | namespace Reprise 18 | { 19 | std::unique_ptr createRepriseDiagnosticConsumer(std::list &messageList); 20 | } 21 | } 22 | #endif 23 | -------------------------------------------------------------------------------- /source/ClangParser/lib/clang/1.1/include/assert.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *assert.h - define the assert macro 3 | * 4 | * Copyright (c) Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * Defines the assert(exp) macro. 8 | * [ANSI/System V] 9 | * 10 | * [Public] 11 | * 12 | ****/ 13 | 14 | #include 15 | 16 | #undef assert 17 | 18 | #ifdef NDEBUG 19 | 20 | #define assert(_Expression) ((void)0) 21 | 22 | #else 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | _CRTIMP void __cdecl _wassert(_In_z_ const wchar_t * _Message, _In_z_ const wchar_t *_File, _In_ unsigned _Line); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #define assert(_Expression) (void)( (!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression), _CRT_WIDE(__FILE__), __LINE__), 0) ) 35 | 36 | #endif /* NDEBUG */ 37 | -------------------------------------------------------------------------------- /source/FrontTransforms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ops_filesin(INTERFACE "../../include/FrontTransforms/" 2 | BaseOperator.h 3 | CantoToReprise.h 4 | ExpressionSimplifier.h 5 | Resolver.h 6 | C2RPass.h 7 | ResolverPass.h 8 | ) 9 | 10 | ops_project( 11 | FrontTransforms LIB 12 | SOURCES 13 | ${INTERFACE} 14 | FrontTransformationsPlugin.h 15 | FrontTransformationsPlugin.cpp 16 | CantoToReprise/CantoToReprise.cpp 17 | ExprOptimization/BasicTypesHelper.cpp 18 | ExprOptimization/BinaryOperators.cpp 19 | ExprOptimization/ExpressionSimplifier.cpp 20 | ExprOptimization/UnaryOperators.cpp 21 | ExprOptimization/Accessors.h 22 | ExprOptimization/BasicTypesHelper.h 23 | ExprOptimization/BinaryOperators.h 24 | ExprOptimization/Exceptions.h 25 | ExprOptimization/LiteralTypesLists.h 26 | ExprOptimization/NullType.h 27 | ExprOptimization/Operators.h 28 | ExprOptimization/Typelist.h 29 | ExprOptimization/TypelistMacros.h 30 | ExprOptimization/TypeManip.h 31 | ExprOptimization/UnaryOperations.h 32 | ExprOptimization/UnaryOperators.h 33 | Resolver.cpp 34 | C2RPass.cpp 35 | ResolverPass.cpp 36 | LIBRARIES 37 | OPS_Core 38 | Reprise 39 | PUBLIC 40 | ) 41 | -------------------------------------------------------------------------------- /source/FrontTransforms/ExprOptimization/Exceptions.h: -------------------------------------------------------------------------------- 1 | #ifndef EXPRESSION_OPTIMIZATION_EXCEPTIONS_H 2 | #define EXPRESSION_OPTIMIZATION_EXCEPTIONS_H 3 | 4 | #include "OPS_Core/Exceptions.h" 5 | 6 | namespace OPS 7 | { 8 | namespace ExpressionSimplifier 9 | { 10 | 11 | OPS_DEFINE_EXCEPTION_CLASS(ArgumentError, OPS::RuntimeError) 12 | 13 | } 14 | } 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /source/FrontTransforms/ExprOptimization/Operators.h: -------------------------------------------------------------------------------- 1 | #ifndef EXPRESSION_OPTIMIZATION_OPERATORS_H 2 | #define EXPRESSION_OPTIMIZATION_OPERATORS_H 3 | 4 | #include "BinaryOperators.h" 5 | #include "UnaryOperators.h" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /source/FrontTransforms/ExprOptimization/UnaryOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef UNARY_OPERATIONS_H 2 | #define UNARY_OPERATIONS_H 3 | 4 | namespace OPS 5 | { 6 | namespace ExpressionSimplifier 7 | { 8 | namespace UnaryOperations 9 | { 10 | 11 | } 12 | } 13 | } 14 | 15 | #endif //UNARY_OPERATIONS_H -------------------------------------------------------------------------------- /source/FrontTransforms/ExprOptimization/UnaryOperators.h: -------------------------------------------------------------------------------- 1 | #ifndef EXPRESSION_OPTIMIZATION_UNARY_OPERATORS_H 2 | #define EXPRESSION_OPTIMIZATION_UNARY_OPERATORS_H 3 | 4 | #include "Reprise/Reprise.h" 5 | #include "FrontTransforms/BaseOperator.h" 6 | 7 | namespace OPS 8 | { 9 | namespace ExpressionSimplifier 10 | { 11 | namespace Calculation 12 | { 13 | using OPS::Reprise::ExpressionBase; 14 | using OPS::Reprise::BasicCallExpression; 15 | using OPS::Reprise::TypeCastExpression; 16 | 17 | class UnaryPlusOperator : public BaseOperator 18 | { 19 | public: 20 | virtual ExpressionBase* calculate(BasicCallExpression*&); 21 | }; 22 | 23 | class UnaryMinusOperator : public BaseOperator 24 | { 25 | public: 26 | virtual ExpressionBase* calculate(BasicCallExpression*&); 27 | }; 28 | 29 | class LogicalNotOperator : public BaseOperator 30 | { 31 | public: 32 | virtual ExpressionBase* calculate(BasicCallExpression*&); 33 | }; 34 | 35 | class BitwiseNotOperator : public BaseOperator 36 | { 37 | public: 38 | virtual ExpressionBase* calculate(BasicCallExpression*&); 39 | }; 40 | 41 | /* Spefific TypeCast operator */ 42 | class TypeCastOperator 43 | { 44 | public: 45 | ExpressionBase* calculate(TypeCastExpression*&); 46 | }; 47 | } 48 | } 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /source/FrontTransforms/FrontTransformationsPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "FrontTransformationsPlugin.h" 2 | #include "FrontTransforms/ResolverPass.h" 3 | #include "FrontTransforms/C2RPass.h" 4 | 5 | #include 6 | 7 | EXPORT_STATIC_PLUGIN2(FrontTransformationsPlugin, 8 | OPS::FrontTransformations::FrontTransformationsPlugin) 9 | 10 | namespace OPS 11 | { 12 | namespace FrontTransformations 13 | { 14 | FrontTransformationsPlugin::FrontTransformationsPlugin() 15 | { 16 | } 17 | 18 | void FrontTransformationsPlugin::initialize() 19 | { 20 | using namespace OPS::Stage; 21 | 22 | RegisterAnalysisPass 23 | c2rPass("Canto To Reprise"); 24 | 25 | RegisterAnalysisPass 26 | repriseCanonization("Reprise Canonization"); 27 | 28 | RegisterAnalysisPass 29 | resolver("Name Resolver"); 30 | 31 | } 32 | 33 | void FrontTransformationsPlugin::terminate() 34 | { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/FrontTransforms/FrontTransformationsPlugin.h: -------------------------------------------------------------------------------- 1 | #ifndef _FRONT_TRASFORMATIONS_PLUGIN_H_INCLUDED_ 2 | #define _FRONT_TRASFORMATIONS_PLUGIN_H_INCLUDED_ 3 | 4 | #include 5 | 6 | namespace OPS 7 | { 8 | namespace FrontTransformations 9 | { 10 | class FrontTransformationsPlugin 11 | : public Core::IPlugin 12 | { 13 | public: 14 | 15 | FrontTransformationsPlugin(); 16 | 17 | public: // Core::IPlugin 18 | 19 | virtual void initialize(); // override 20 | virtual void terminate(); // override 21 | }; 22 | } 23 | } 24 | 25 | #endif // _FRONT_TRASFORMATIONS_PLUGIN_H_INCLUDED_ 26 | -------------------------------------------------------------------------------- /source/FrontTransforms/ResolverPass.cpp: -------------------------------------------------------------------------------- 1 | // Standard includes 2 | 3 | // OPS includes 4 | #include "FrontTransforms/ResolverPass.h" 5 | #include "FrontTransforms/Resolver.h" 6 | 7 | // Local includes 8 | 9 | // Namespaces using 10 | using namespace OPS::Reprise; 11 | 12 | // Defines and macros 13 | 14 | // Enter namespace 15 | namespace OPS 16 | { 17 | namespace Stage 18 | { 19 | // Constants and enums 20 | 21 | // Classes 22 | 23 | // Functions declaration 24 | 25 | // Variables 26 | 27 | // Classes implementation 28 | 29 | // Global classes implementation 30 | ResolverPass::ResolverPass() 31 | { 32 | } 33 | 34 | bool ResolverPass::run() 35 | { 36 | OPS::Transforms::Resolver resolver; 37 | resolver.setProgram(workContext().program()); 38 | resolver.resolve(); 39 | 40 | for(int i = 0; i < resolver.getErrorCount(); ++i) 41 | { 42 | manager()->addDiagnostics(CompilerResultMessage(CompilerResultMessage::CRK_ERROR, 43 | resolver.getError(i), "")); 44 | } 45 | 46 | if (resolver.getErrorCount() == 0) 47 | workContext().addService(new NamesResolved); 48 | 49 | return true; 50 | } 51 | 52 | // Functions implementation 53 | 54 | // Exit namespace 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /source/Frontend/.gitignore: -------------------------------------------------------------------------------- 1 | /[Bb]in 2 | /obj 3 | /[Dd]ebug 4 | /[Rr]elease 5 | /*.user 6 | /*.aps 7 | /*.eto 8 | -------------------------------------------------------------------------------- /source/Frontend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ops_project( 2 | Frontend LIB 3 | SOURCES 4 | ../../include/Frontend/Frontend.h 5 | FrontendPlugin.h 6 | FrontendPlugin.cpp 7 | Frontend.cpp 8 | LIBRARIES 9 | OPS_Core 10 | Reprise 11 | ClangParser 12 | FrontTransforms 13 | PUBLIC 14 | ) 15 | 16 | #if(OPS_HAVE_ANTLR) 17 | # target_link_libraries(Frontend F2003Parser) 18 | #endif() 19 | -------------------------------------------------------------------------------- /source/Frontend/FrontendPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "FrontendPlugin.h" 2 | 3 | #include 4 | 5 | EXPORT_STATIC_PLUGIN2(FrontendPlugin, OPS::Frontend::FrontendPlugin) 6 | 7 | namespace OPS 8 | { 9 | namespace Frontend 10 | { 11 | FrontendPlugin::FrontendPlugin() 12 | { 13 | } 14 | 15 | void FrontendPlugin::initialize() 16 | { 17 | } 18 | 19 | void FrontendPlugin::terminate() 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/Frontend/FrontendPlugin.h: -------------------------------------------------------------------------------- 1 | #ifndef _FRONTEND_PLUGIN_H_INCLUDED_ 2 | #define _FRONTEND_PLUGIN_H_INCLUDED_ 3 | 4 | #include 5 | 6 | namespace OPS 7 | { 8 | namespace Frontend 9 | { 10 | class FrontendPlugin 11 | : public Core::IPlugin 12 | { 13 | public: 14 | 15 | FrontendPlugin(); 16 | 17 | public: // Core::IPlugin 18 | 19 | virtual void initialize(); // override 20 | virtual void terminate(); // override 21 | }; 22 | } 23 | } 24 | 25 | #endif // _FRONTEND_PLUGIN_H_INCLUDED_ 26 | -------------------------------------------------------------------------------- /source/OPS_Core/.gitignore: -------------------------------------------------------------------------------- 1 | /[Bb]in 2 | /obj 3 | /[Dd]ebug 4 | /[Rr]elease 5 | /*.user 6 | /*.aps 7 | /*.eto 8 | -------------------------------------------------------------------------------- /source/OPS_Core/Core.cpp: -------------------------------------------------------------------------------- 1 | #include "OPS_Core/Core.h" 2 | 3 | #include "OPS_Core/ServiceLocator.h" 4 | 5 | #include "CoreSettingsService.h" 6 | 7 | #include 8 | 9 | namespace OPS 10 | { 11 | namespace Core 12 | { 13 | Core::Core() 14 | { 15 | initialize(); 16 | } 17 | 18 | Core::~Core() 19 | { 20 | terminate(); 21 | } 22 | 23 | void Core::initialize() 24 | { 25 | std::locale::global(std::locale("")); 26 | 27 | ServiceLocator::initialize(); 28 | 29 | // install core services 30 | ServiceLocator::instance().addService( 31 | new CoreSettingsService()); 32 | } 33 | 34 | void Core::terminate() 35 | { 36 | // uninstall core services 37 | ServiceLocator::instance().deleteService(); 38 | 39 | ServiceLocator::terminate(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/OPS_Core/CoreSettingsService.cpp: -------------------------------------------------------------------------------- 1 | #include "CoreSettingsService.h" 2 | 3 | #include "OPS_Core/Helpers.h" 4 | 5 | namespace OPS 6 | { 7 | 8 | namespace Core 9 | { 10 | 11 | CoreSettingsService::CoreSettingsService() 12 | { 13 | } 14 | 15 | CoreSettingsService::~CoreSettingsService() 16 | { 17 | } 18 | 19 | int CoreSettingsService::getAsInt(const std::string& propertyName) const 20 | { 21 | const VariantValue value = m_variantMap[propertyName]; 22 | 23 | OPS_ASSERT(value.type == typeInt); 24 | 25 | return value.intValue; 26 | } 27 | 28 | std::string CoreSettingsService::getAsString(const std::string& propertyName) const 29 | { 30 | const VariantValue value = m_variantMap[propertyName]; 31 | 32 | OPS_ASSERT(value.type == typeString); 33 | 34 | return value.stringValue; 35 | } 36 | 37 | void CoreSettingsService::setInt(const std::string& propertyName, int value) 38 | { 39 | m_variantMap[propertyName] = VariantValue(value); 40 | } 41 | 42 | void CoreSettingsService::setString(const std::string& propertyName, 43 | const std::string& value) 44 | { 45 | m_variantMap[propertyName] = VariantValue(value); 46 | } 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /source/OPS_Core/Listener.cpp: -------------------------------------------------------------------------------- 1 | #include "OPS_Core/Listener.h" 2 | #include "OPS_Core/Helpers.h" 3 | 4 | namespace OPS 5 | { 6 | BaseListener::ListenerSet BaseListener::g_listeners; 7 | 8 | void BaseListener::add(BaseListener& listener) 9 | { 10 | g_listeners.insert(&listener); 11 | } 12 | 13 | void BaseListener::remove(BaseListener& listener) 14 | { 15 | g_listeners.erase(&listener); 16 | } 17 | 18 | 19 | //template 20 | //void BaseListener::propogatePostNotify(T&, ChangeType) 21 | //{ 22 | //} 23 | 24 | } -------------------------------------------------------------------------------- /source/OPS_Core/Mixins.cpp: -------------------------------------------------------------------------------- 1 | #include "OPS_Core/Mixins.h" 2 | #include "OPS_Core/Exceptions.h" 3 | #include "OPS_Core/Strings.h" 4 | 5 | namespace OPS 6 | { 7 | 8 | void TypeConvertibleMix::castToErrorHandler(const char* const typeName) const 9 | { 10 | throw OPS::TypeCastError(Strings::format("Cannot cast from <%s*>@%p to <%s>.", 11 | typeid(*this).name(), this, typeName)); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /source/OPS_Core/Plugins/PluginManager.cpp: -------------------------------------------------------------------------------- 1 | #include "OPS_Core/Plugins/PluginManager.h" 2 | 3 | #include "PluginRegistry.h" 4 | 5 | #include "OPS_Core/Plugins/IPlugin.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Core 10 | { 11 | void PluginManager::setPluginLoadOrder( 12 | const std::list& loadOrderedPluginNames) 13 | { 14 | m_loadOrderedPluginNames = loadOrderedPluginNames; 15 | } 16 | 17 | void PluginManager::initializePlugins() const 18 | { 19 | typedef std::list::const_iterator StringListConstIter; 20 | 21 | for (StringListConstIter it = m_loadOrderedPluginNames.begin(); 22 | it != m_loadOrderedPluginNames.end(); ++it) 23 | { 24 | PluginRegistry::instance().pluginByName(*it).initialize(); 25 | } 26 | } 27 | 28 | void PluginManager::terminatePlugins() const 29 | { 30 | typedef std::list::const_reverse_iterator StringListConstRevIter; 31 | 32 | for (StringListConstRevIter it = m_loadOrderedPluginNames.rbegin(); 33 | it != m_loadOrderedPluginNames.rend(); ++it) 34 | { 35 | PluginRegistry::instance().pluginByName(*it).terminate(); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/OPS_Core/Plugins/PluginRegistry.h: -------------------------------------------------------------------------------- 1 | #ifndef _PLUGIN_REGISTRY_H_INCLUDED_ 2 | #define _PLUGIN_REGISTRY_H_INCLUDED_ 3 | 4 | #include 5 | #include 6 | 7 | namespace OPS 8 | { 9 | namespace Core 10 | { 11 | class IPlugin; 12 | 13 | class PluginRegistry 14 | { 15 | public: 16 | 17 | typedef IPlugin& (*PluginInstanceFunction)(); 18 | 19 | public: 20 | 21 | void registerPluginInstanceFunction(const std::string& pluginName, 22 | PluginInstanceFunction pluginInstanceFunction); 23 | 24 | IPlugin& pluginByName(const std::string& pluginName) const; 25 | 26 | public: 27 | 28 | static PluginRegistry& instance(); 29 | 30 | private: 31 | 32 | inline PluginRegistry() {} 33 | 34 | inline ~PluginRegistry() {} 35 | 36 | PluginRegistry(const PluginRegistry& ); 37 | PluginRegistry& operator =(const PluginRegistry& ); 38 | 39 | bool isPluginRegistered(const std::string& pluginName) const; 40 | 41 | private: 42 | 43 | mutable std::map m_pluginInstanceFunctions; 44 | }; 45 | } 46 | } 47 | 48 | #endif // _PLUGIN_REGISTRY_H_INCLUDED_ 49 | -------------------------------------------------------------------------------- /source/OPS_Core/Reporting.cpp: -------------------------------------------------------------------------------- 1 | #include "OPS_Core/Reporting.h" 2 | 3 | 4 | namespace OPS 5 | { 6 | namespace Stage 7 | { 8 | 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /source/OPS_Core/ServiceLocator.cpp: -------------------------------------------------------------------------------- 1 | #include "OPS_Core/ServiceLocator.h" 2 | 3 | namespace OPS 4 | { 5 | namespace Core 6 | { 7 | ServiceLocator* ServiceLocator::m_instance = 0; 8 | 9 | void ServiceLocator::initialize() 10 | { 11 | OPS_ASSERT(m_instance == 0); 12 | 13 | m_instance = new ServiceLocator(); 14 | } 15 | 16 | void ServiceLocator::terminate() 17 | { 18 | OPS_ASSERT(m_instance != 0); 19 | 20 | delete m_instance; 21 | m_instance = 0; 22 | } 23 | 24 | ServiceLocator& ServiceLocator::instance() 25 | { 26 | OPS_ASSERT(m_instance != 0); 27 | 28 | return *m_instance; 29 | } 30 | 31 | ServiceLocatorBase::~ServiceLocatorBase() 32 | { 33 | OPS_ASSERT(m_serviceStorages.size() == 0); 34 | } 35 | 36 | void ServiceLocatorBase::clearServices() 37 | { 38 | ServiceStorageMap::iterator itStorage = m_serviceStorages.begin(); 39 | for(; itStorage != m_serviceStorages.end(); ++itStorage) 40 | delete itStorage->second; 41 | m_serviceStorages.clear(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/OPS_Core/Template.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | OPS_Core/Template.cpp - OPS_Core module, template implementation 3 | 4 | */ 5 | 6 | // Standard includes 7 | 8 | // OPS includes 9 | 10 | // Local includes 11 | 12 | // Namespaces using 13 | 14 | // Defines and macros 15 | 16 | // Enter namespace 17 | namespace OPS 18 | { 19 | 20 | // Constants and enums 21 | 22 | // Classes 23 | 24 | // Functions declaration 25 | 26 | // Variables 27 | 28 | // Classes implementation 29 | 30 | // Global classes implementation 31 | 32 | // Functions implementation 33 | 34 | // Exit namespace 35 | } 36 | -------------------------------------------------------------------------------- /source/OPS_Core/Threading.cpp: -------------------------------------------------------------------------------- 1 | #include "OPS_Core/Threading.h" 2 | 3 | namespace OPS 4 | { 5 | namespace Threading 6 | { 7 | } 8 | 9 | } -------------------------------------------------------------------------------- /source/OPS_Core/Threading_Platform_Unix.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpsGroup/open-ops/b1ab8da354c4aecc0fe76a562395f5861bffc207/source/OPS_Core/Threading_Platform_Unix.cpp -------------------------------------------------------------------------------- /source/OPS_Core/Threading_Platform_Win.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpsGroup/open-ops/b1ab8da354c4aecc0fe76a562395f5861bffc207/source/OPS_Core/Threading_Platform_Win.cpp -------------------------------------------------------------------------------- /source/OPS_Stage/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(OPS_Stage) 2 | 3 | ops_filesin(INTERFACE "../../include/OPS_Stage/" 4 | Config.h 5 | GenericWriter.h 6 | OPS_Stage.h 7 | Passes.h 8 | StdStreamWriter.h 9 | Utils.h 10 | WorkContext.h 11 | ) 12 | 13 | ops_project( 14 | OPS_Stage LIB 15 | SOURCES 16 | ${INTERFACE} 17 | Config.cpp 18 | Passes.cpp 19 | StdStreamWriter.cpp 20 | Utils.cpp 21 | WorkContext.cpp 22 | LIBRARIES 23 | OPS_Core 24 | Reprise 25 | PUBLIC 26 | ) 27 | 28 | add_subdirectory(testmod) 29 | -------------------------------------------------------------------------------- /source/OPS_Stage/ClangGenerator.cpp: -------------------------------------------------------------------------------- 1 | #include "OPS_Stage/ClangGenerator.h" 2 | 3 | #include "OPS_Stage/GenericWriter.h" 4 | 5 | namespace OPS 6 | { 7 | namespace Stage 8 | { 9 | 10 | static const char* const CLANG_GENERATOR_NAME = "ClangGenerator"; 11 | 12 | 13 | ClangGenerator::ClangGenerator(void) 14 | { 15 | } 16 | 17 | ClangGenerator::~ClangGenerator() 18 | { 19 | } 20 | 21 | std::string ClangGenerator::name() 22 | { 23 | return CLANG_GENERATOR_NAME; 24 | } 25 | 26 | void ClangGenerator::run() 27 | { 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/OPS_Stage/StdStreamWriter.cpp: -------------------------------------------------------------------------------- 1 | #include "OPS_Stage/StdStreamWriter.h" 2 | 3 | namespace OPS 4 | { 5 | namespace Stage 6 | { 7 | 8 | StdStreamWriter::StdStreamWriter(std::ostream& stream) : m_stream(stream) 9 | { 10 | } 11 | 12 | void StdStreamWriter::write(const char* string) 13 | { 14 | m_stream << string; 15 | } 16 | 17 | void StdStreamWriter::write(const wchar_t* string) 18 | { 19 | m_stream << string; 20 | } 21 | 22 | void StdStreamWriter::writeLine(const char* string) 23 | { 24 | m_stream << string << "\n"; 25 | } 26 | 27 | void StdStreamWriter::writeLine(const wchar_t* string) 28 | { 29 | m_stream << string << L"\n"; 30 | } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /source/OPS_Stage/WorkContext.cpp: -------------------------------------------------------------------------------- 1 | // Standard includes 2 | 3 | // OPS includes 4 | #include "OPS_Stage/WorkContext.h" 5 | 6 | // Local includes 7 | 8 | // Namespaces using 9 | 10 | // Defines and macros 11 | 12 | // Enter namespace 13 | namespace OPS 14 | { 15 | namespace Stage 16 | { 17 | 18 | // Constants and enums 19 | 20 | // Classes 21 | 22 | // Functions declaration 23 | 24 | // Variables 25 | 26 | // Classes implementation 27 | 28 | WorkContext::WorkContext() 29 | { 30 | } 31 | 32 | WorkContext::~WorkContext() 33 | { 34 | clearServices(); 35 | } 36 | 37 | void WorkContext::reset() 38 | { 39 | m_program.reset(new OPS::Reprise::ProgramUnit); 40 | m_satellitePrograms.clear(); 41 | clearServices(); 42 | } 43 | 44 | // Global classes implementation 45 | 46 | // Functions implementation 47 | 48 | // Exit namespace 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /source/OPS_Stage/testmod/.gitignore: -------------------------------------------------------------------------------- 1 | /[Bb]in 2 | /obj 3 | /[Dd]ebug 4 | /[Rr]elease 5 | /*.user 6 | /*.aps 7 | /*.eto 8 | -------------------------------------------------------------------------------- /source/OPS_Stage/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ops_project( 2 | OPS_Stage_test APP 3 | SOURCES 4 | main.cpp 5 | ../../OPS_Core/EntryPoint.cpp 6 | LIBRARIES 7 | OPS_Stage 8 | Frontend 9 | ) 10 | -------------------------------------------------------------------------------- /source/Reprise/.gitignore: -------------------------------------------------------------------------------- 1 | /[Bb]in 2 | /obj 3 | /[Dd]ebug 4 | /[Rr]elease 5 | /*.user 6 | /*.aps 7 | /*.eto 8 | -------------------------------------------------------------------------------- /source/Reprise/C2R_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ops_project( 2 | C2R_test APP 3 | SOURCES 4 | C2R_test.cpp 5 | LIBRARIES 6 | Reprise 7 | Frontend 8 | Backends 9 | ) 10 | -------------------------------------------------------------------------------- /source/Reprise/Service/Marker.cpp: -------------------------------------------------------------------------------- 1 | #include "Reprise/Service/Marker.h" 2 | 3 | namespace OPS 4 | { 5 | namespace Reprise 6 | { 7 | namespace Service 8 | { 9 | 10 | 11 | // Global functions implementation 12 | 13 | 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /source/Reprise/Service/Traversal.cpp: -------------------------------------------------------------------------------- 1 | #include "Reprise/Service/Traversal.h" 2 | 3 | namespace OPS 4 | { 5 | namespace Reprise 6 | { 7 | namespace Service 8 | { 9 | 10 | class VisitorAction 11 | { 12 | public: 13 | VisitorAction(OPS::BaseVisitor& visitor) 14 | :m_visitor(visitor) 15 | { 16 | } 17 | 18 | void operator()(RepriseBase& node) 19 | { 20 | node.accept(m_visitor); 21 | } 22 | 23 | private: 24 | OPS::BaseVisitor& m_visitor; 25 | }; 26 | 27 | void makePreOrderVisitorTraversal(RepriseBase& root, OPS::BaseVisitor& visitor) 28 | { 29 | VisitorAction act(visitor); 30 | makePreOrderTraversal(root, act); 31 | } 32 | 33 | // Visit subtrees first 34 | void makePostOrderVisitorTraversal(RepriseBase& root, OPS::BaseVisitor& visitor) 35 | { 36 | VisitorAction act(visitor); 37 | makePostOrderTraversal(root, act); 38 | } 39 | 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/Reprise/Utils.cpp: -------------------------------------------------------------------------------- 1 | #include "Reprise/Utils.h" 2 | 3 | // Enter namespace 4 | namespace OPS 5 | { 6 | namespace Reprise 7 | { 8 | 9 | RepriseManager* RepriseManager::s_instance = 0; 10 | 11 | unsigned g_unique_number = 0; 12 | 13 | std::string generateUniqueIndentifier(const std::string& partName) 14 | { 15 | return Strings::format("__uni%u%hs", g_unique_number++, partName.c_str()); 16 | } 17 | 18 | 19 | // Exit namespace 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /source/Reprise/testmod/.gitignore: -------------------------------------------------------------------------------- 1 | /[Bb]in 2 | /obj 3 | /[Dd]ebug 4 | /[Rr]elease 5 | /*.user 6 | /*.aps 7 | /*.eto 8 | -------------------------------------------------------------------------------- /source/Reprise/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ops_project( 2 | Reprise_test APP 3 | SOURCES 4 | c2r.cpp 5 | FullUnrollFor.cpp 6 | main.cpp 7 | StatementsList.cpp 8 | TestCollections.cpp 9 | TrackPtrTest.cpp 10 | c2r.h 11 | NodeCollector.h 12 | Tests.h 13 | LIBRARIES 14 | Reprise 15 | Frontend 16 | Backends 17 | ) -------------------------------------------------------------------------------- /source/Reprise/testmod/FullUnrollFor.cpp: -------------------------------------------------------------------------------- 1 | #include "Tests.h" 2 | #include "Reprise/Canto.h" 3 | 4 | using namespace OPS; 5 | using namespace OPS::Reprise; 6 | 7 | void fullUnrollFor(ForStatement& forStatement) 8 | { 9 | if (forStatement.getInitExpression().is_a()) 10 | { 11 | Canto::HirCCallExpression& callExpression = forStatement.getInitExpression().cast_to(); 12 | if (callExpression.getKind() == Canto::HirCCallExpression::HIRC_ASSIGN) 13 | { 14 | // ExpressionBase 15 | // callExpression.getArgument(0) 16 | } 17 | else 18 | throw StateError("Unexpected init expression. Must be simple assign."); 19 | } 20 | else 21 | throw StateError("Unexpected init expression. Must be assign."); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /source/Reprise/testmod/NodeCollector.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_REPRISE_TESTMOD_NODECOLLECTOR_INCLUDED_H__ 2 | #define OPS_REPRISE_TESTMOD_NODECOLLECTOR_INCLUDED_H__ 3 | 4 | #include "OPS_Core/Mixins.h" 5 | #include "Reprise/Reprise.h" 6 | 7 | template 8 | class Collector : OPS::NonCopyableMix 9 | { 10 | public: 11 | typedef NodeType* TNodeTypePtr; 12 | typedef std::vector TNodes; 13 | 14 | inline explicit Collector(ProgramUnit& program) : m_program(program) 15 | { 16 | } 17 | 18 | TNodes m_node; 19 | 20 | private: 21 | void collect(RepriseBase& reprise); 22 | 23 | ProgramUnit* m_program; 24 | }; 25 | 26 | 27 | #endif // OPS_REPRISE_TESTMOD_NODECOLLECTOR_INCLUDED_H__ 28 | -------------------------------------------------------------------------------- /source/Reprise/testmod/Tests.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_REPRISE_TESTMOD_TESTS_H_INCLUDED__ 2 | #define OPS_REPRISE_TESTMOD_TESTS_H_INCLUDED__ 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | 7 | void fullUnrollFor(OPS::Reprise::ForStatement& forStatement); 8 | void testCollections(); 9 | 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /source/Reprise/testmod/TrackPtrTest.cpp: -------------------------------------------------------------------------------- 1 | #include "Reprise/Reprise.h" 2 | 3 | #include 4 | 5 | 6 | /* 7 | int main() 8 | { 9 | using namespace OPS::Reprise; 10 | using namespace std; 11 | 12 | 13 | TrackPtr block(new BlockStatement()); 14 | TrackPtr block2(block); 15 | TrackPtr block3; 16 | typedef list > TStatementsList; 17 | TStatementsList statements; 18 | block3 = block2; 19 | if (block2 != block3) 20 | throw OPS::StateError("Unexpected."); 21 | if (block2 != block) 22 | throw OPS::StateError("Unexpected."); 23 | block->dumpState(); 24 | 25 | statements.push_back(block); 26 | statements.push_back(block2); 27 | statements.push_back(block3); 28 | block2.reset(0); 29 | 30 | 31 | return 0; 32 | } 33 | */ 34 | -------------------------------------------------------------------------------- /source/Reprise/testmod/c2r.h: -------------------------------------------------------------------------------- 1 | #ifndef OPS_REPRISE_TESTMOD_C2R_H_INCLUDED__ 2 | #define OPS_REPRISE_TESTMOD_C2R_H_INCLUDED__ 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | void testMI2SB(void); 7 | 8 | void testContinue(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /source/Reprise/testmod/out/test_eval.c: -------------------------------------------------------------------------------- 1 | int f(int aa) 2 | { 3 | return aa; 4 | } 5 | 6 | int main() 7 | { 8 | int i = f(6); 9 | int *j, *k; 10 | int A[12]; 11 | int *t; 12 | // i = 2147483649; 13 | (*(t = A)) = *t + 1; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /source/Reprise/testmod/out/test_for_unroll.c: -------------------------------------------------------------------------------- 1 | int f() 2 | { 3 | int n = -12; 4 | return 0; 5 | } 6 | 7 | int main() 8 | { 9 | int A[10]; 10 | int B[10]; 11 | int C[10]; 12 | int i; 13 | 14 | for (i = 0; i < 10; ++i) 15 | { 16 | C[i] = A[i] * B[i]; 17 | } 18 | 19 | 20 | } -------------------------------------------------------------------------------- /source/Reprise/testmod/tests/C2R/MI2SB/DefaultParamValue.c: -------------------------------------------------------------------------------- 1 | // Actually here: int f(int a = 12) 2 | int f(int a) 3 | { 4 | int bb = 12; 5 | return a + bb; 6 | } 7 | 8 | int main() 9 | { 10 | return f(13); 11 | } -------------------------------------------------------------------------------- /source/Reprise/testmod/tests/Lamport2.c: -------------------------------------------------------------------------------- 1 | int b[50][50],a[50],x[50],k; 2 | 3 | int main() 4 | { 5 | int i,j; 6 | for(i=1;i<10;i=i+1) 7 | {for ( j=1 ;j <10; j=j+1) 8 | { 9 | a[i+j]=b[i][j-1]+b[i-1][j]; 10 | b[i][j]=a[i+j-2]+b[i][j]; 11 | } 12 | } 13 | 14 | } 15 | 16 | -------------------------------------------------------------------------------- /source/Reprise/testmod/tests/Lamport2.f: -------------------------------------------------------------------------------- 1 | program Main 2 | integer b(0:49, 0:49), a(0:49), x(0:49), k 3 | integer i, j 4 | 5 | do i = 1, 9, 1 6 | do j = 1, 9, 1 7 | a(i+j) = b(i,j-1) + b(i-1,j) 8 | b(i,j) = a(i+j-2) + b(i,j) 9 | end do 10 | end do 11 | end program Main -------------------------------------------------------------------------------- /source/Reprise/testmod/tests/expr_conversion.c: -------------------------------------------------------------------------------- 1 | volatile int B[20]; 2 | 3 | 4 | int* func(int n) 5 | { 6 | return &n; 7 | } 8 | 9 | int main() 10 | { 11 | int A[10]; 12 | int i, j; 13 | 14 | j = i += 2; // complex assign in expr stmt 15 | j = i++; // postfix in expr stmt 16 | 17 | (*func(1))++; // posfix with deref 18 | //error: lvalue required as increment operand // *(func(1)++); // posfix with deref 19 | &A[0]++; // postfix array addr 20 | B[0]++; 21 | 22 | *func(1) += 5; 23 | &A[0] += 2; 24 | &B[0] += 2; 25 | B[0] += 2; 26 | i += i++ + 2; 27 | i *= 5; 28 | 29 | for (i = 0; i < 20; i += 2) 30 | { 31 | if (i > 50) 32 | break; 33 | B[i] = i; 34 | } 35 | 36 | for (i = 0; i < 20; i++) 37 | { 38 | if (i < 5) 39 | continue; 40 | B[i] = i; 41 | } 42 | 43 | for (i = 0; i < 20; ++i) 44 | { 45 | B[i] = i; 46 | } 47 | i = 0; 48 | 49 | return 0; 50 | } -------------------------------------------------------------------------------- /source/Reprise/testmod/tests/fullhouse.c: -------------------------------------------------------------------------------- 1 | int i, j; 2 | double f, e; 3 | char c; 4 | int A[10]; 5 | volatile int B[20]; 6 | 7 | int* func(int n) 8 | { 9 | return n; 10 | } 11 | 12 | int main() 13 | { 14 | int a, b, c, d, e, f; 15 | 16 | 17 | // a = (b + c * d - *func(f), a, b, c); 18 | i = i += 2; 19 | *func(1)++; 20 | &A[0]++; 21 | *func(1) += 5; 22 | &A[0] += 2; 23 | &B[0] += 2; 24 | B[0] += 2; 25 | i += i++ + 2; 26 | i *= 5; 27 | 28 | for (i = 0; i < 20; i += 2) 29 | { 30 | if (i > 50) 31 | break; 32 | B[i] = i; 33 | } 34 | 35 | for (i = 0; i < 20; i++) 36 | { 37 | if (i < 5) 38 | continue; 39 | B[i] = i; 40 | } 41 | 42 | for (i = 0; i < 20; ++i) 43 | { 44 | B[i] = i; 45 | } 46 | i = 0; 47 | while (i < 10) 48 | { 49 | A[i] = i; 50 | continue; 51 | i += 1; 52 | } 53 | if (i < 20) 54 | { 55 | i = 1; 56 | } 57 | if (i > 0 && i < 10) 58 | { 59 | i = 0; 60 | } 61 | else 62 | { 63 | j = i + 2; 64 | } 65 | 66 | l1: switch (i) 67 | { 68 | case 0: 69 | j = 0; 70 | break; 71 | case 1: 72 | j = 1; 73 | break; 74 | case 2: 75 | j = 2; 76 | break; 77 | default: 78 | j = 12; 79 | } 80 | goto l1; 81 | 82 | return 0; 83 | } -------------------------------------------------------------------------------- /source/Shared/.gitignore: -------------------------------------------------------------------------------- 1 | /[Bb]in 2 | /obj 3 | /[Dd]ebug 4 | /[Rr]elease 5 | /*.user 6 | /*.aps 7 | /*.eto 8 | -------------------------------------------------------------------------------- /source/Shared/Checks/CompositionCheck/CompositionCheckObjects.cpp: -------------------------------------------------------------------------------- 1 | #include "Shared/Checks/CompositionCheck/CompositionCheckObjects.h" 2 | #include "OPS_Core/Helpers.h" 3 | 4 | namespace OPS 5 | { 6 | namespace Shared 7 | { 8 | namespace Checks 9 | { 10 | 11 | CompositionCheckObjects::CompositionCheckObjects() 12 | { 13 | } 14 | 15 | CompositionCheckObjects& CompositionCheckObjects::operator << (CompositionCheckObjectTypes object) 16 | { 17 | OPS_ASSERT(object < CCOT_ObjectsCount); 18 | m_objects.insert(object); 19 | 20 | return *this; 21 | } 22 | 23 | bool CompositionCheckObjects::contains(CompositionCheckObjectTypes object) const 24 | { 25 | OPS_ASSERT(object < CCOT_ObjectsCount); 26 | 27 | return m_objects.find(object) != m_objects.end(); 28 | } 29 | 30 | } // OPS 31 | } // Shared 32 | } // Checks 33 | -------------------------------------------------------------------------------- /source/Shared/ContextNotifier/ContextObserverState.cpp: -------------------------------------------------------------------------------- 1 | #include "Shared/ContextNotifier/ContextObserverState.h" 2 | 3 | #include 4 | 5 | namespace OPS 6 | { 7 | 8 | namespace Shared 9 | { 10 | 11 | ContextObserverState::ContextObserverState() 12 | : m_isSyncronized(false) 13 | { 14 | } 15 | 16 | ContextObserverState::~ContextObserverState() 17 | { 18 | } 19 | 20 | int ContextObserverState::getChildCount() const 21 | { 22 | return 0; 23 | } 24 | 25 | Reprise::RepriseBase& ContextObserverState::getChild(int ) 26 | { 27 | throw Reprise::UnexpectedChildError("ContextObserverState::getChild()"); 28 | } 29 | 30 | bool ContextObserverState::isSyncronized() const 31 | { 32 | return m_isSyncronized; 33 | } 34 | 35 | void ContextObserverState::setSyncronized(bool isSyncronized) 36 | { 37 | if (m_isSyncronized != isSyncronized) 38 | { 39 | m_isSyncronized = isSyncronized; 40 | } 41 | } 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /source/Shared/ContextNotifier/ContextObserverStateManager.cpp: -------------------------------------------------------------------------------- 1 | #include "Shared/ContextNotifier/ContextObserverStateManager.h" 2 | 3 | #include 4 | #include 5 | 6 | namespace OPS 7 | { 8 | 9 | namespace Shared 10 | { 11 | 12 | ContextObserverStateManager::ContextObserverStateManager(const std::string& observerId) 13 | : m_observerId(observerId) 14 | { 15 | } 16 | 17 | ContextObserverStateManager::~ContextObserverStateManager() 18 | { 19 | } 20 | 21 | Reprise::ProgramUnit &ContextObserverStateManager::findProgramUnit( 22 | const Reprise::RepriseBase& context) 23 | { 24 | Reprise::ProgramUnit* program = context.findProgramUnit(); 25 | 26 | OPS_ASSERT(program != NULL); 27 | 28 | return *program; 29 | } 30 | 31 | bool ContextObserverStateManager::hasState(const Reprise::RepriseBase& context) const 32 | { 33 | return findProgramUnit(context).hasNote(m_observerId); 34 | } 35 | 36 | void ContextObserverStateManager::resetState(const Reprise::RepriseBase &context, 37 | ContextObserverState* state) 38 | { 39 | Reprise::ReprisePtr statePtr(state); 40 | 41 | findProgramUnit(context).setNote(m_observerId, Reprise::Note::newReprise(statePtr)); 42 | } 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /source/Shared/ExpressionHelpers/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ops_project( 2 | ExpressionHelpers_testmod APP 3 | SOURCES 4 | main.cpp 5 | LIBRARIES 6 | Reprise 7 | Frontend 8 | Shared 9 | Backends 10 | ) 11 | -------------------------------------------------------------------------------- /source/Shared/ExpressionHelpers/testmod/tests/test1.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i; 4 | i = 0; 5 | 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /source/Shared/LabelsShared/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ops_project( 2 | LabelsShared_testmod APP 3 | SOURCES 4 | main.cpp 5 | LIBRARIES 6 | Reprise 7 | Frontend 8 | Shared 9 | Backends 10 | ) 11 | -------------------------------------------------------------------------------- /source/Shared/LabelsShared/testmod/tests/test1.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i; 4 | label: 5 | i = 0; 6 | goto label; 7 | 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /source/Shared/LoopShared/LoopSharedDeepWalkers.h: -------------------------------------------------------------------------------- 1 | #ifndef LOOP_SHARED_DEEP_WALKERS_H 2 | #define LOOP_SHARED_DEEP_WALKERS_H 3 | 4 | #include "Reprise/Service/DeepWalker.h" 5 | #include "Reprise/ServiceFunctions.h" 6 | 7 | namespace OPS 8 | { 9 | namespace Shared 10 | { 11 | class AllLoopsInNestAreCanonisedDeepWalker: public OPS::Reprise::Service::DeepWalker 12 | { 13 | public: 14 | AllLoopsInNestAreCanonisedDeepWalker(): OPS::Reprise::Service::DeepWalker(), 15 | m_allLoopsInNestAreCanonised(true) 16 | { 17 | } 18 | 19 | public: 20 | bool isAllLoopsInNestAreCanonised() 21 | { 22 | return m_allLoopsInNestAreCanonised; 23 | } 24 | 25 | void visit(OPS::Reprise::ForStatement& forStatement) 26 | { 27 | if(OPS::Reprise::Editing::forHeaderIsCanonized(forStatement)) 28 | { 29 | OPS::Reprise::Service::DeepWalker::visit(forStatement); 30 | } 31 | else 32 | { 33 | m_allLoopsInNestAreCanonised = false; 34 | } 35 | } 36 | private: 37 | bool m_allLoopsInNestAreCanonised; 38 | }; 39 | } 40 | } 41 | 42 | #endif // LOOP_SHARED_DEEP_WALKERS_H 43 | -------------------------------------------------------------------------------- /source/Shared/ReadMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpsGroup/open-ops/b1ab8da354c4aecc0fe76a562395f5861bffc207/source/Shared/ReadMe.txt -------------------------------------------------------------------------------- /source/Shared/ReferenceMapper.cpp: -------------------------------------------------------------------------------- 1 | #include "Shared/ReferenceMapper.h" 2 | #include "Shared/ReprisePath.h" 3 | 4 | using namespace OPS::Reprise; 5 | 6 | namespace OPS 7 | { 8 | namespace Shared 9 | { 10 | 11 | void mapReferences(const Reprise::RepriseBase& left, 12 | Reprise::RepriseBase& right, 13 | RepriseReferenceMap& refMap) 14 | { 15 | RepriseReferenceMap::iterator it = refMap.begin(), itEnd = refMap.end(); 16 | 17 | for(;it != itEnd; ++it) 18 | { 19 | if (it->first != 0) 20 | { 21 | try 22 | { 23 | ReprisePath path = makePath(*it->first, &left); 24 | it->second = findByPath(right, path); 25 | } 26 | catch(InvalidReprisePath&) 27 | { 28 | // соответствующий узел не найден 29 | it->second = 0; 30 | } 31 | } 32 | else 33 | { 34 | it->second = 0; 35 | } 36 | } 37 | } 38 | 39 | RepriseBase* mapReference(const Reprise::RepriseBase& left, 40 | Reprise::RepriseBase& right, 41 | const Reprise::RepriseBase& sourceObject) 42 | { 43 | RepriseReferenceMap refMap; 44 | refMap[&sourceObject] = 0; 45 | mapReferences(left, right, refMap); 46 | 47 | return refMap[&sourceObject]; 48 | } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /source/Shared/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ops_project( 2 | Shared_test APP 3 | SOURCES 4 | main.cpp 5 | LIBRARIES 6 | Shared 7 | Frontend 8 | Analysis 9 | Backends 10 | ) -------------------------------------------------------------------------------- /source/Shared/testmod/tests/testLinearExpressions.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int m; 4 | int A[10][10]; 5 | int B[10][20]; 6 | int C[10]; 7 | int i; 8 | int j; 9 | int k; 10 | 11 | for(i=0;i<10;i=i+1) 12 | for(j=0;j 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "Reprise/Reprise.h" 13 | #include "Reprise/Service/DeepWalker.h" 14 | #include "Transforms/DataDistribution/Shared/BDParameters.h" 15 | 16 | namespace OPS 17 | { 18 | namespace Transforms 19 | { 20 | namespace DataDistribution 21 | { 22 | 23 | using OPS::Reprise::BasicCallExpression; 24 | using OPS::Reprise::ForStatement; 25 | using OPS::Reprise::Service::DeepWalker; 26 | 27 | class ChangeIndexesVisitor : public DeepWalker 28 | { 29 | public: 30 | using DeepWalker::visit; 31 | 32 | ChangeIndexesVisitor(std::list pragmas); 33 | void visit(BasicCallExpression& bckCall); 34 | private: 35 | std::list m_pragmas; 36 | 37 | void canonizeIndex(OPS::Reprise::ExpressionBase & expr, OPS::Reprise::VariableDeclaration* d); 38 | 39 | //OPS::Reprise::VariableDeclaration* get 40 | }; 41 | 42 | } 43 | } 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /source/Transforms/DataDistribution/Shared/include/ChangeIndexesVisitor.h: -------------------------------------------------------------------------------- 1 | #ifndef CHANGE_INDEXES_VISITOR_H 2 | #define CHANGE_INDEXES_VISITOR_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "Reprise/Reprise.h" 13 | #include "Reprise/Service/DeepWalker.h" 14 | #include "Transforms/DataDistribution/Shared/BDParameters.h" 15 | 16 | namespace OPS 17 | { 18 | namespace Transforms 19 | { 20 | namespace DataDistribution 21 | { 22 | 23 | using OPS::Reprise::BasicCallExpression; 24 | using OPS::Reprise::ForStatement; 25 | using OPS::Reprise::Service::DeepWalker; 26 | 27 | class ChangeIndexesVisitor : public DeepWalker 28 | { 29 | public: 30 | using DeepWalker::visit; 31 | 32 | ChangeIndexesVisitor(std::list pragmas); 33 | void visit(BasicCallExpression& bckCall); 34 | private: 35 | std::list m_pragmas; 36 | 37 | void canonizeIndex(OPS::Reprise::ExpressionBase & expr, OPS::Reprise::VariableDeclaration* d); 38 | 39 | //OPS::Reprise::VariableDeclaration* get 40 | }; 41 | 42 | } 43 | } 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /source/Transforms/DataDistribution/Shared/include/change_references_algorithms.h: -------------------------------------------------------------------------------- 1 | #ifndef CHANGE_REFERENCE_ALGORITHMS_H 2 | #define CHANGE_REFERENCE_ALGORITHMS_H 3 | 4 | 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "Reprise/Reprise.h" 15 | #include "Reprise/Service/DeepWalker.h" 16 | #include "Transforms/DataDistribution/Shared/BDParameters.h" 17 | #include "RenameDistributionArrayVisitor.h" 18 | #include "ChangeIndexesVisitor.h" 19 | #include "shared_helpers.h" 20 | #include "ArrayDistributionInfo.h" 21 | #include "ReferenceTable.h" 22 | 23 | namespace OPS 24 | { 25 | namespace Transforms 26 | { 27 | namespace DataDistribution 28 | { 29 | 30 | 31 | void change_references(std::list& references_without_multi_index, ReferenceTable& dim_table, std::list& array_distrib_refs_list, 32 | SubroutineDeclaration* current_function); 33 | 34 | } 35 | } 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /source/Transforms/DataDistribution/Shared/shared_helpers.h: -------------------------------------------------------------------------------- 1 | #ifndef SHARED_HELPERS_H 2 | #define SHARED_HELPERS_H 3 | 4 | #include "Reprise/Declarations.h" 5 | 6 | int getValueOfConstIntegerVariable(OPS::Reprise::VariableDeclaration* decl); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /source/Transforms/DataDistribution/Shared/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(DataDistribution_Shared_testmod) 2 | 3 | ops_project( 4 | DataDistribution_Shared_testmod APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Shared 11 | Backends 12 | Transforms 13 | OPSCoreSystem 14 | ) 15 | -------------------------------------------------------------------------------- /source/Transforms/Helpers/IsolateFrame/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(IsolateFrameTest) 2 | 3 | ops_project( 4 | IsolateFrameTest APP 5 | SOURCES 6 | test.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Shared 11 | Backends 12 | Transforms 13 | ) 14 | -------------------------------------------------------------------------------- /source/Transforms/Helpers/IsolateFrame/testmod/Samples/sample01.c: -------------------------------------------------------------------------------- 1 | 2 | int main() 3 | { 4 | int i, j, k; 5 | int N = 100; 6 | int X[N]; 7 | int Y[N]; 8 | int Z[N]; 9 | 10 | 11 | for (i = 0; i < N; i++) 12 | for(j = 0; j < N; j++) 13 | for (k = 0; k < N; k++) 14 | Z[i] = X[k] * Y[j]; 15 | return 0; 16 | 17 | } 18 | 19 | -------------------------------------------------------------------------------- /source/Transforms/Helpers/IsolateFrame/testmod/Samples/sample02.c: -------------------------------------------------------------------------------- 1 | 2 | int main() 3 | { 4 | int i, j, k; 5 | const int N = 100; 6 | int X[N]; 7 | int Y[N]; 8 | int Z[N]; 9 | 10 | 11 | for (i = 0; i < N; i++) 12 | for(j = 0; j < N; j++) 13 | for (k = 0; k < N; k++) 14 | Z[i] = X[k] * Y[j]; 15 | return 0; 16 | 17 | } 18 | 19 | -------------------------------------------------------------------------------- /source/Transforms/If/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(IfDistribution/testmod) 2 | add_subdirectory(IfExraction/testmod) 3 | add_subdirectory(IfSplitting/testmod) 4 | -------------------------------------------------------------------------------- /source/Transforms/If/CollapseIf/CollapseIf.h: -------------------------------------------------------------------------------- 1 | #ifndef COLLAPSE_IF_H 2 | #define COLLAPSE_IF_H 3 | 4 | #include "Reprise/Reprise.h" 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | /** 11 | * @brief CollapseIf 12 | * convert IfStatement to simple ExpressionStatement 13 | * @param ifstatement 14 | * @return 15 | * new ExpressionStatement - result of transformation; 0 if cannot transform 16 | */ 17 | Reprise::ExpressionStatement* collapseIfToAssign(Reprise::IfStatement* ifstatement); 18 | } 19 | } 20 | 21 | #endif //COLLAPSE_IF_H 22 | -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(IfDistribution_test) 2 | 3 | ops_project( 4 | IfDistribution_test APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Shared 11 | Backends 12 | Transforms 13 | ) 14 | -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample01.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator with else branch. 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c; 8 | 9 | if(a) 10 | { 11 | b = 0; 12 | c = 0; 13 | } 14 | else 15 | { 16 | b = 0; 17 | c = 0; 18 | } 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample02.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Possible to use IfDistribution transformation without introducing a new variable. 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c; 8 | 9 | if(a) 10 | { 11 | b = 0; 12 | c = 0; 13 | } 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample03.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains labeled operator in first part 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c; 8 | 9 | if(a) 10 | { 11 | A: 12 | b = 0; 13 | c = 0; 14 | } 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample04.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains labeled operator in second part 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c; 8 | 9 | if(a) 10 | { 11 | b = 0; 12 | A: 13 | c = 0; 14 | } 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample05.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains source conditional labeled operator 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c; 8 | 9 | A: 10 | if(a) 11 | { 12 | b = 0; 13 | c = 0; 14 | } 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample06.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains goto statement in first part 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c; 8 | 9 | if(a) 10 | { 11 | goto A; 12 | c = 0; 13 | } 14 | A: 15 | return 0; 16 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample07.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains goto statement in second part 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c; 8 | 9 | if(a) 10 | { 11 | b = 0; 12 | c = 0; 13 | goto A; 14 | } 15 | A: 16 | return 0; 17 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample08.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains return statement in first part 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c; 8 | 9 | if(a) 10 | { 11 | return 0; 12 | c = 0; 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample09.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains return statement in second part 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c; 8 | 9 | if(a) 10 | { 11 | b = 0; 12 | c = 0; 13 | return 0; 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample10.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains function call in condition of source conditional operator 3 | */ 4 | 5 | int f(int a) 6 | { 7 | return a; 8 | } 9 | 10 | int main() 11 | { 12 | int a, b, c; 13 | 14 | if(f(a)) 15 | { 16 | b = 0; 17 | c = 0; 18 | } 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample11.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains function call in first part of source conditional operator 3 | */ 4 | 5 | int f(int a) 6 | { 7 | return a; 8 | } 9 | 10 | int main() 11 | { 12 | int a, b, c; 13 | 14 | if(a) 15 | { 16 | b = f(0); 17 | c = 0; 18 | } 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample12.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains function call in second part of source conditional operator 3 | */ 4 | 5 | int f(int a) 6 | { 7 | return a; 8 | } 9 | 10 | int main() 11 | { 12 | int a, b, c; 13 | 14 | if(a) 15 | { 16 | b = 0; 17 | c = f(0); 18 | } 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample13.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains antidependence from source conditional operator to operator in first part 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c; 8 | 9 | if(a = b) 10 | { 11 | b = 0; 12 | c = 0; 13 | } 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample14.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains output from source conditional operator to operator in first part 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c; 8 | 9 | if(b = a) 10 | { 11 | b = 0; 12 | c = 0; 13 | } 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfDistribution/testmod/Samples/sample15.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains output dependence from source conditional operator to itself 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c; 8 | 9 | if(a = a + 1) 10 | { 11 | b = 0; 12 | c = 0; 13 | } 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfExraction/IfExtractionDeepWalkers.h: -------------------------------------------------------------------------------- 1 | #ifndef IF_EXTRACTION_DEEP_WALKERS_H 2 | #define IF_EXTRACTION_DEEP_WALKERS_H 3 | 4 | 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | 11 | } 12 | } 13 | 14 | #endif // IF_EXTRACTION_DEEP_WALKERS_H 15 | -------------------------------------------------------------------------------- /source/Transforms/If/IfExraction/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(IfExtraction_test) 2 | 3 | ops_project( 4 | IfExtraction_test APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Shared 11 | Backends 12 | Transforms 13 | ) 14 | -------------------------------------------------------------------------------- /source/Transforms/If/IfExraction/testmod/Samples/Sample01.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple canonized for statement with conditional statement 3 | */ 4 | 5 | int main() 6 | { 7 | int a, b, c, i; 8 | 9 | for(i = 0; i < 10; i = i + 1) 10 | { 11 | if(a) 12 | { 13 | b = 0; 14 | c = 0; 15 | } 16 | else 17 | { 18 | b = 1; 19 | c = 1; 20 | } 21 | } 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfSplitting/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(IfSplitting_test) 2 | 3 | ops_project( 4 | IfSplitting_test APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Shared 11 | Backends 12 | Transforms 13 | ) 14 | -------------------------------------------------------------------------------- /source/Transforms/If/IfSplitting/testmod/Samples/sample01.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int a; 4 | int b; 5 | int c; 6 | 7 | if(a = b + a) 8 | { 9 | c = -a; 10 | b = 0; 11 | } 12 | 13 | return 0; 14 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfSplitting/testmod/Samples/sample02.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int a; 4 | int b; 5 | int c; 6 | 7 | if(a && (b + a)) 8 | { 9 | c = -a; 10 | } 11 | else 12 | { 13 | b = 0; 14 | } 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfSplitting/testmod/Samples/sample03.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int a; 4 | int b; 5 | int c; 6 | 7 | if(a || (b + a)) 8 | { 9 | c = -a; 10 | } 11 | else 12 | { 13 | b = 0; 14 | } 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfSplitting/testmod/Samples/sample04.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int a; 4 | int b; 5 | int c; 6 | 7 | if(!(b + a)) 8 | { 9 | c = -a; 10 | } 11 | else 12 | { 13 | b = 0; 14 | } 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfSplitting/testmod/Samples/sample05.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains labeled source conditional operator 3 | */ 4 | int main() 5 | { 6 | int a; 7 | int b; 8 | int c; 9 | A: 10 | if(a && (b + a)) 11 | { 12 | c = -a; 13 | } 14 | else 15 | { 16 | b = 0; 17 | } 18 | 19 | return 0; 20 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfSplitting/testmod/Samples/sample06.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains labeled statement in then branch of source conditional operator 3 | */ 4 | int main() 5 | { 6 | int a; 7 | int b; 8 | int c; 9 | 10 | if(a && (b + a)) 11 | { 12 | A: 13 | c = -a; 14 | } 15 | else 16 | { 17 | b = 0; 18 | } 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /source/Transforms/If/IfSplitting/testmod/Samples/sample07.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple conditional operator. Contains labeled statement in else branch of source conditional operator 3 | */ 4 | int main() 5 | { 6 | int a; 7 | int b; 8 | int c; 9 | 10 | if(a && (b + a)) 11 | { 12 | c = -a; 13 | } 14 | else 15 | { 16 | A: 17 | b = 0; 18 | } 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /source/Transforms/Loops/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(LoopCycleOffset/testmod) 2 | 3 | -------------------------------------------------------------------------------- /source/Transforms/Loops/LoopCycleOffset/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(LoopCycleOffset_test) 2 | 3 | ops_project( 4 | LoopCycleOffset_test APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Shared 11 | Backends 12 | Transforms 13 | ) 14 | -------------------------------------------------------------------------------- /source/Transforms/Loops/LoopCycleOffset/testmod/Samples/sample01.c: -------------------------------------------------------------------------------- 1 | int i; 2 | int A[10]; 3 | int B[10]; 4 | int X[10]; 5 | int Y[10]; 6 | int Z[10]; 7 | int W[10]; 8 | 9 | int main() 10 | { 11 | for (i=100; i>0; i=i-1) 12 | { 13 | X[i] = A[i]+1; 14 | Y[i] = B[i]+2; 15 | Z[i] = X[i]+3; 16 | W[i] = Y[i]+4; 17 | } 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /source/Transforms/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | STATIC LIBRARY : Transforms Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this Transforms library project for you. 6 | 7 | No source files were created as part of your project. 8 | 9 | 10 | Transforms.vcproj 11 | This is the main project file for VC++ projects generated using an Application Wizard. 12 | It contains information about the version of Visual C++ that generated the file, and 13 | information about the platforms, configurations, and project features selected with the 14 | Application Wizard. 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | Other notes: 18 | 19 | AppWizard uses "TODO:" comments to indicate parts of the source code you 20 | should add to or customize. 21 | 22 | ///////////////////////////////////////////////////////////////////////////// 23 | -------------------------------------------------------------------------------- /source/Transforms/Scalar/ArithmeticOperatorExpansion/README: -------------------------------------------------------------------------------- 1 | Tranformation: ArithmeticOperatorExpansion 2 | Author: Anton Khayrudinov 3 | EMail: a.khayrudinov@gmail.com 4 | 5 | In order to use this transformation for a C program, "aoe-sr.h" header 6 | must be included: 7 | 8 | #include "aoe-sr.h" 9 | #include "somefile.h" 10 | 11 | int FuncYouWantToTransform(int a, char b) 12 | { 13 | return a * (b << 4) + b * 8; 14 | } 15 | 16 | The transformation finds all operators and, if possible, replaces them with 17 | calls to subroutines that require access to functions declared in "aoe-sr.h". 18 | If this header is not included beforehand, the transformation won't do anything. -------------------------------------------------------------------------------- /source/Transforms/Scalar/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(InductionSubstitution/testmod) 2 | add_subdirectory(SSASubstitutionForward/testmod) 3 | add_subdirectory(SubstitutionForward/testmod) 4 | # OpenOPS comment: add_subdirectory(LocalizationScalar/testmod) 5 | -------------------------------------------------------------------------------- /source/Transforms/Scalar/InductionSubstitution/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(InductionSubstitution_testmod) 2 | 3 | ops_project( 4 | InductionSubstitution_testmod APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Shared 11 | Backends 12 | Transforms 13 | ) 14 | -------------------------------------------------------------------------------- /source/Transforms/Scalar/InductionSubstitution/testmod/Samples/Induction.cpp: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i, k=0, p = 5, A[100]; 4 | int j = 0; 5 | i=0; 6 | while(i<10) 7 | { 8 | j = i + 1; 9 | A[k] = A [p]; 10 | k = k + 1; 11 | p = k + j; 12 | A[k] = A [p]; 13 | i = j + 1; 14 | } 15 | return i; 16 | } -------------------------------------------------------------------------------- /source/Transforms/Scalar/InductionSubstitution/testmod/Samples/Induction2.cpp: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i=0; 4 | i=0; 5 | while(i<10 ) 6 | { 7 | i = i + 1; 8 | } 9 | return i; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /source/Transforms/Scalar/SSASubstitutionForward/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(SSASubstitutionForward_test) 2 | 3 | ops_project( 4 | SSASubstitutionForward_test APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Shared 11 | Backends 12 | Transforms 13 | ) 14 | -------------------------------------------------------------------------------- /source/Transforms/Scalar/SubstitutionForward/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(SubstitutionForward_test) 2 | 3 | ops_project( 4 | SubstitutionForward_test APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Shared 11 | Backends 12 | Transforms 13 | ) 14 | -------------------------------------------------------------------------------- /source/Transforms/Scalar/SubstitutionForward/testmod/tests/test1.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i; 4 | int j; 5 | 6 | for (i = 0; i < 10; ++i) 7 | { 8 | j = i + i; 9 | if (5 != i + i) 10 | { 11 | } 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /source/Transforms/Subroutines/FragmentToSubroutine/testmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(FragmentToSubroutine_test) 2 | 3 | ops_project( 4 | FragmentToSubroutine_test APP 5 | SOURCES 6 | main.cpp 7 | LIBRARIES 8 | Reprise 9 | Frontend 10 | Shared 11 | Backends 12 | Transforms 13 | TEMPLATES 14 | QtGui 15 | QtWidgets 16 | ) 17 | -------------------------------------------------------------------------------- /source/Transforms/TransformationsPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "TransformationsPlugin.h" 2 | #include "Transforms/TransformsPasses.h" 3 | 4 | #include 5 | 6 | EXPORT_STATIC_PLUGIN2(TransformationsPlugin, OPS::Transforms::TransformationsPlugin) 7 | 8 | namespace OPS 9 | { 10 | namespace Transforms 11 | { 12 | TransformationsPlugin::TransformationsPlugin() 13 | { 14 | } 15 | 16 | void TransformationsPlugin::initialize() 17 | { 18 | using namespace OPS::Stage; 19 | 20 | RegisterAnalysisPass 21 | loopDistributionPass("Loop distribution"); 22 | } 23 | 24 | void TransformationsPlugin::terminate() 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Transforms/TransformationsPlugin.h: -------------------------------------------------------------------------------- 1 | #ifndef _TRANSFORMATIONS_PLUGIN_H_INCLUDED_ 2 | #define _TRANSFORMATIONS_PLUGIN_H_INCLUDED_ 3 | 4 | #include 5 | 6 | namespace OPS 7 | { 8 | namespace Transforms 9 | { 10 | class TransformationsPlugin 11 | : public Core::IPlugin 12 | { 13 | public: 14 | 15 | TransformationsPlugin(); 16 | 17 | public: // Core::IPlugin 18 | 19 | virtual void initialize(); // override 20 | virtual void terminate(); // override 21 | }; 22 | } 23 | } 24 | 25 | #endif // _TRANSFORMATIONS_PLUGIN_H_INCLUDED_ 26 | -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/arithmetic_result_type.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | signed char sc; 4 | unsigned char uc; 5 | int i; 6 | unsigned int ui; 7 | float f; 8 | double d; 9 | int* pi; 10 | 11 | -sc; // 0 int 12 | +sc; // 1 int 13 | !sc; // 2 int 14 | -uc; // 3 int 15 | +uc; // 4 int 16 | !uc; // 5 int 17 | uc << sc; // 6 int 18 | uc >> sc; // 7 int 19 | 20 | i + i; // 8 int 21 | uc - i; // 9 int 22 | i + f; // 10 float 23 | f + d; // 11 double 24 | pi - sc; // 12 int* 25 | i + pi; // 13 int* 26 | i + ui; // 14 uint 27 | sc & uc; // 15 int 28 | } 29 | -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/array_equal.c: -------------------------------------------------------------------------------- 1 | int A[10], B[10]; 2 | -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/conditional_result_type.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | 1 < 2; 4 | 3 > 4; 5 | 5 <= 6; 6 | 7 >= 8; 7 | 9 == 10; 8 | 11 != 12; 9 | 13 && 0; 10 | 15 || 0; 11 | !0; 12 | } 13 | -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/dump_labels.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int i, j; 4 | i = 0; 5 | j = 0; 6 | lab: i = i + 1; 7 | lab2: j = j + i; 8 | if (j < 10) 9 | goto lab; 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/func_ptr_result_type.c: -------------------------------------------------------------------------------- 1 | int foo(); 2 | int bar(); 3 | 4 | int (*p[2])(void) = {foo, bar}; 5 | 6 | int main() 7 | { 8 | foo(); 9 | (*p)(); 10 | foo; 11 | *p[0]; 12 | } 13 | -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/get_associated_variable.c: -------------------------------------------------------------------------------- 1 | int f(int a, double b) 2 | { 3 | int i, j; 4 | i = a; 5 | return b + i; 6 | } 7 | 8 | int main() 9 | { 10 | return f(10, 1.0); 11 | } 12 | -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/get_result_type.c: -------------------------------------------------------------------------------- 1 | typedef int Array[10]; 2 | 3 | int main() 4 | { 5 | int a[10]; 6 | int b[10][15]; 7 | int c[10][15][20]; 8 | Array d; 9 | 10 | a[2] = 1; 11 | b[2][3] = 2; 12 | c[2][3][4] = 3; 13 | d[0] = 4; 14 | } 15 | -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/goto_test.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | lab: return 0; 4 | goto lab; 5 | } -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/negative_test.c: -------------------------------------------------------------------------------- 1 | rgskgusfd 2 | fgksldkgsfd\g 3 | klksgfdsd 4 | fgsfdgsfdg -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/program_fragment.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int a[5]; 4 | int b[5]; 5 | 6 | int i; 7 | for (i = 0; i < 5; ++i) 8 | { 9 | a[i] += b[i]; 10 | b[i] += a[i]; 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/recursive_structs.c: -------------------------------------------------------------------------------- 1 | typedef struct NODE 2 | { 3 | struct NODE* next; 4 | } *PNODE; 5 | 6 | typedef struct NODE1 7 | { 8 | int val; 9 | } *PNODE1, *LPNODE1; 10 | 11 | int main() 12 | { 13 | return 0; 14 | } -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/struct_access.c: -------------------------------------------------------------------------------- 1 | struct A 2 | { 3 | int X; 4 | int Y; 5 | }; 6 | 7 | struct A a; 8 | 9 | int main() 10 | { 11 | a.X = 10; 12 | } -------------------------------------------------------------------------------- /tests/Reprise/UnitTests/vec_get_result_type.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | __attribute__ ((__vector_size__ (16))) float v; 4 | 5 | v; 6 | v[0]; 7 | -v; 8 | v + v; 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /unittests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CMakeLists.txt for unittests project 2 | 3 | project(unittests) 4 | 5 | file(GLOB_RECURSE CPP_FILES "./*.cpp") 6 | file(GLOB_RECURSE H_FILES "./*.h") 7 | 8 | set(opsSourceRootFilePath ${CMAKE_CURRENT_BINARY_DIR}/opsSourceRoot.cpp) 9 | 10 | if(NOT EXISTS ${opsSourceRootFilePath}) 11 | # 12 | file( 13 | WRITE 14 | ${opsSourceRootFilePath} 15 | "#include \nstd::wstring sourceRoot = L\"${ops_source_root_dir}\";\n") 16 | # 17 | endif() 18 | 19 | list(APPEND CPP_FILES ${opsSourceRootFilePath}) 20 | 21 | source_group(Generated FILES ${opsSourceRootFilePath}) 22 | 23 | ops_project( 24 | unittests APP 25 | SOURCES 26 | ${CPP_FILES} 27 | ${H_FILES} 28 | ../include/GTestIncludeWrapper.h 29 | FrontendHelper.h 30 | LIBRARIES 31 | ClangRepriseClang 32 | OPSCoreSystem 33 | TEMPLATES 34 | GTest 35 | ) 36 | 37 | add_test( 38 | NAME 39 | UnitTests 40 | COMMAND 41 | unittests ${ops_source_root_dir} 42 | ) 43 | 44 | # End of File 45 | -------------------------------------------------------------------------------- /unittests/googletest.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /unittests/main.cpp: -------------------------------------------------------------------------------- 1 | #include "OPS_Core/IO.h" 2 | #include "OPS_Core/Strings.h" 3 | #include "OPS_Core/Kernel.h" 4 | #include "OPSCoreSystem/OPSCoreSystem.h" 5 | #include "FrontendHelper.h" 6 | 7 | #include "GTestIncludeWrapper.h" 8 | 9 | #include 10 | 11 | int main(int argc, char **argv) 12 | { 13 | OPS::OPSCoreSystem opscore; 14 | 15 | ::testing::InitGoogleTest(&argc, argv); 16 | 17 | const int run_result = RUN_ALL_TESTS(); 18 | #if OPS_PLATFORM_IS_WIN32 19 | system("pause"); 20 | #endif 21 | return run_result; 22 | } 23 | --------------------------------------------------------------------------------