/// <summary>
        /// Initializes a new instance of the <see cref="TestCaseMethodCompiler"/> class.
        /// </summary>
        /// <param name="compiler">The compiler.</param>
        /// <param name="method">The method.</param>
        public TestCaseMethodCompiler(TestCaseCompiler compiler, RuntimeMethod method)
            : base(compiler, method, null)
        {
            // Populate the pipeline
            Pipeline.AddRange(new IMethodCompilerStage[] {
                new CILDecodingStage(),
                new BasicBlockBuilderStage(),
                new ExceptionPrologueStage(),
                new OperandAssignmentStage(),
                new StaticAllocationResolutionStage(),
                new CILTransformationStage(),

                new LocalVariablePromotionStage(),
                new	EdgeSplitStage(),
                new DominanceCalculationStage(),
                new PhiPlacementStage(),
                new EnterSSAStage(),
                new SSAOptimizations(),
                new LeaveSSA(),

                new StackLayoutStage(),
                new PlatformIntrinsicTransformationStage(),
                new PlatformStubStage(),
                new LoopAwareBlockOrderStage(),
                //new SimpleTraceBlockOrderStage(),
                //new ReverseBlockOrderStage(),  // reverse all the basic blocks and see if it breaks anything
                new CodeGenerationStage(),
            });
        }
예제 #2
0
        /// <summary>
        /// Compiles the specified type system.
        /// </summary>
        /// <param name="typeSystem">The type system.</param>
        /// <returns></returns>
        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);

            IInternalTrace internalLog = new BasicInternalTrace();
            (internalLog.CompilerEventListener as BasicCompilerEventListener).DebugOutput = false;
            (internalLog.CompilerEventListener as BasicCompilerEventListener).ConsoleOutput = false;

            var linker = new TestAssemblyLinker();

            CompilerOptions compilerOptions = new CompilerOptions();
            compilerOptions.Linker = linker;

            TestCaseCompiler compiler = new TestCaseCompiler(architecture, typeSystem, typeLayout, internalLog, compilerOptions);
            compiler.Compile();

            return linker;
        }