public TestCaseMethodCompiler(TestCaseAssemblyCompiler assemblyCompiler, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method)
            : base(assemblyCompiler, type, method, null, compilationScheduler)
        {
            // Populate the pipeline
            this.Pipeline.AddRange(new IMethodCompilerStage[] {
                new DecodingStage(),
                new BasicBlockBuilderStage(),
                new ExceptionPrologueStage(),
                new OperandDeterminationStage(),
                new StaticAllocationResolutionStage(),
                new CILTransformationStage(),
                //new CILLeakGuardStage() { MustThrowCompilationException = true },

                new	EdgeSplitStage(),
                new DominanceCalculationStage(),
                new PhiPlacementStage(),
                new EnterSSAStage(),

                new ConstantPropagationStage(ConstantPropagationStage.PropagationStage.PreFolding),
                new ConstantFoldingStage() ,
                new ConstantPropagationStage(ConstantPropagationStage.PropagationStage.PostFolding),

                new LeaveSSA(),

                new StrengthReductionStage(),
                new StackLayoutStage(),
                new PlatformStubStage(),
                //new BlockReductionStage(),
                //new LoopAwareBlockOrderStage(),
                new SimpleTraceBlockOrderStage(),
                //new ReverseBlockOrderStage(),  // reverse all the basic blocks and see if it breaks anything
                //new BasicBlockOrderStage()
                new CodeGenerationStage(),
            });
        }
        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;

            CompilerOptions compilerOptions = new CompilerOptions();

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

            return compiler.linker;
        }