public ExplorerMethodCompiler(ExplorerAssemblyCompiler assemblyCompiler, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method, CompilerOptions compilerOptions) : base(assemblyCompiler, type, method, null, compilationScheduler) { // Populate the pipeline this.Pipeline.AddRange(new IMethodCompilerStage[] { new DecodingStage(), new BasicBlockBuilderStage(), new ExceptionPrologueStage(), new OperandDeterminationStage(), //new SingleUseMarkerStage(), //new OperandUsageAnalyzerStage(), new StaticAllocationResolutionStage(), new CILTransformationStage(), (compilerOptions.EnableSSA) ? new EdgeSplitStage() : null, (compilerOptions.EnableSSA) ? new DominanceCalculationStage() : null, (compilerOptions.EnableSSA) ? new PhiPlacementStage() : null, (compilerOptions.EnableSSA) ? new EnterSSAStage() : null, (compilerOptions.EnableSSA) ? new SSAOptimizations() : null, //(compilerOptions.EnableSSA) ? new ConstantPropagationStage(ConstantPropagationStage.PropagationStage.PreFolding) : null, //(compilerOptions.EnableSSA) ? new ConstantFoldingStage() : null, //(compilerOptions.EnableSSA) ? new ConstantPropagationStage(ConstantPropagationStage.PropagationStage.PostFolding) : null, (compilerOptions.EnableSSA) ? new LeaveSSA() : null, new StrengthReductionStage(), new StackLayoutStage(), new PlatformStubStage(), //new LoopAwareBlockOrderStage(), new SimpleTraceBlockOrderStage(), //new SimpleRegisterAllocatorStage(), new CodeGenerationStage(), }); }
public static void Compile(ITypeSystem typeSystem, ITypeLayout typeLayout, IInternalTrace internalTrace, string platform, bool enabledSSA) { IArchitecture architecture; switch (platform.ToLower()) { case "x86": architecture = x86.Architecture.CreateArchitecture(x86.ArchitectureFeatureFlags.AutoDetect); break; case "avr32": architecture = AVR32.Architecture.CreateArchitecture(AVR32.ArchitectureFeatureFlags.AutoDetect); break; default: architecture = x86.Architecture.CreateArchitecture(x86.ArchitectureFeatureFlags.AutoDetect); break; } CompilerOptions compilerOptions = new CompilerOptions(); compilerOptions.EnableSSA = enabledSSA; ExplorerAssemblyCompiler compiler = new ExplorerAssemblyCompiler(architecture, typeSystem, typeLayout, internalTrace, compilerOptions); compiler.Compile(); }