private TestCaseAssemblyCompiler(IArchitecture architecture, ITypeSystem typeSystem, ITypeLayout typeLayout, IInternalTrace internalTrace, CompilerOptions compilerOptions)
            : base(architecture, typeSystem, typeLayout, internalTrace, compilerOptions)
        {
            linker = new TestAssemblyLinker();

            // Build the assembly compiler pipeline
            Pipeline.AddRange(new IAssemblyCompilerStage[] {
                new DelegateTypePatchStage(),
                new PlugStage(),
                new AssemblyMemberCompilationSchedulerStage(),
                new MethodCompilerSchedulerStage(),
                new TypeLayoutStage(),
                new MetadataStage(),
                linker
            });

            architecture.ExtendAssemblyCompilerPipeline(Pipeline);
        }
        /// <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;
        }