public static TestAssemblyLinker Compile(ITypeSystem typeSystem)
        {
            IArchitecture architecture = x86.Architecture.CreateArchitecture(x86.ArchitectureFeatureFlags.AutoDetect);

            // FIXME: get from architecture
            TypeLayout typeLayout = new TypeLayout(typeSystem, 4, 4);

            TestCaseAssemblyCompiler compiler = new TestCaseAssemblyCompiler(architecture, typeSystem, typeLayout);
            compiler.Compile();

            return compiler.linker;
        }
Example #2
0
        public static TestAssemblyLinker Compile(ITypeSystem typeSystem)
        {
            IArchitecture architecture = x86.Architecture.CreateArchitecture(x86.ArchitectureFeatureFlags.AutoDetect);

            // FIXME: get from architecture
            TypeLayout typeLayout = new TypeLayout(typeSystem, 4, 4);

            TestCaseAssemblyCompiler compiler = new TestCaseAssemblyCompiler(architecture, typeSystem, typeLayout);

            compiler.Compile();

            return(compiler.linker);
        }
Example #3
0
        private TestAssemblyLinker RunMosaCompiler(TestCompilerSettings settings, string assemblyFile)
        {
            IAssemblyLoader assemblyLoader = new AssemblyLoader();

            assemblyLoader.InitializePrivatePaths(settings.References);

            assemblyLoader.LoadModule(assemblyFile);

            foreach (string file in settings.References)
            {
                assemblyLoader.LoadModule(file);
            }

            typeSystem = new TypeSystem();
            typeSystem.LoadModules(assemblyLoader.Modules);

            TestAssemblyLinker linker = TestCaseAssemblyCompiler.Compile(typeSystem);

            return(linker);
        }
Example #4
0
        public TestCaseMethodCompiler(TestCaseAssemblyCompiler compiler, IArchitecture architecture, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method)
            : base(compiler.Pipeline.FindFirst <IAssemblyLinker>(), architecture, compilationScheduler, type, method, compiler.TypeSystem, compiler.TypeLayout)
        {
            this.assemblyCompiler = compiler;

            // Populate the pipeline
            this.Pipeline.AddRange(new IMethodCompilerStage[] {
                new DecodingStage(),
                //new InstructionLogger(),
                new BasicBlockBuilderStage(),
                //new InstructionLogger(),
                new OperandDeterminationStage(),
                //new InstructionLogger(),
                new StaticAllocationResolutionStage(),
                //new InstructionLogger(),
                //new ConstantFoldingStage(),
                new CILTransformationStage(),
                //new InstructionLogger(),
                new CILLeakGuardStage()
                {
                    MustThrowCompilationException = true
                },
                //new InstructionLogger(),
                //InstructionStatisticsStage.Instance,
                //new DominanceCalculationStage(),
                //new EnterSSA(),
                //new ConstantPropagationStage(),
                //new ConstantFoldingStage(),
                //new LeaveSSA(),
                new StackLayoutStage(),
                new PlatformStubStage(),
                //new InstructionLogger(),
                //new BlockReductionStage(),
                new LoopAwareBlockOrderStage(),
                //new SimpleTraceBlockOrderStage(),
                //new ReverseBlockOrderStage(),  // reverse all the basic blocks and see if it breaks anything
                //new BasicBlockOrderStage()
                new CodeGenerationStage(),
                //new InstructionLogger(),
            });
        }
        public TestCaseMethodCompiler(TestCaseAssemblyCompiler compiler, IArchitecture architecture, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method)
            : base(compiler.Pipeline.FindFirst<IAssemblyLinker>(), architecture, compilationScheduler, type, method, compiler.TypeSystem, compiler.Pipeline.FindFirst<ITypeLayout>())
        {
            this.assemblyCompiler = compiler;

            // Populate the pipeline
            this.Pipeline.AddRange(new IMethodCompilerStage[] {
                new DecodingStage(),
                //new InstructionLogger(),
                new BasicBlockBuilderStage(),
                //new InstructionLogger(),
                new OperandDeterminationStage(),
                //new InstructionLogger(),
                new StaticAllocationResolutionStage(),
                //new InstructionLogger(),
                //new ConstantFoldingStage(),
                new CILTransformationStage(),
                //new InstructionLogger(),
                new CILLeakGuardStage() { MustThrowCompilationException = true },
                //new InstructionLogger(),
                //InstructionStatisticsStage.Instance,
                //new DominanceCalculationStage(),
                //new EnterSSA(),
                //new ConstantPropagationStage(),
                //new ConstantFoldingStage(),
                //new LeaveSSA(),
                new StackLayoutStage(),
                new PlatformStubStage(),
                //new InstructionLogger(),
                //new BlockReductionStage(),
                new LoopAwareBlockOrderStage(),
                //new SimpleTraceBlockOrderStage(),
                //new ReverseBlockOrderStage(),  // reverse all the basic blocks and see if it breaks anything
                //new BasicBlockOrderStage()
                new CodeGenerationStage(),
                //new InstructionLogger(),
            });
        }