本文整理汇总了C#中CompilerPipeline类的典型用法代码示例。如果您正苦于以下问题:C# CompilerPipeline类的具体用法?C# CompilerPipeline怎么用?C# CompilerPipeline使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompilerPipeline类属于命名空间,在下文中一共展示了CompilerPipeline类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BaseMethodCompiler
/// <summary>
/// Initializes a new instance of the <see cref="BaseMethodCompiler" /> class.
/// </summary>
/// <param name="compiler">The assembly compiler.</param>
/// <param name="method">The method to compile by this instance.</param>
/// <param name="basicBlocks">The basic blocks.</param>
/// <param name="threadID">The thread identifier.</param>
protected BaseMethodCompiler(BaseCompiler compiler, MosaMethod method, BasicBlocks basicBlocks, int threadID)
{
Compiler = compiler;
Method = method;
Type = method.DeclaringType;
Scheduler = compiler.CompilationScheduler;
Architecture = compiler.Architecture;
TypeSystem = compiler.TypeSystem;
TypeLayout = compiler.TypeLayout;
Trace = compiler.CompilerTrace;
Linker = compiler.Linker;
BasicBlocks = basicBlocks ?? new BasicBlocks();
Pipeline = new CompilerPipeline();
StackLayout = new StackLayout(Architecture, method.Signature.Parameters.Count + (method.HasThis || method.HasExplicitThis ? 1 : 0));
VirtualRegisters = new VirtualRegisters(Architecture);
LocalVariables = emptyOperandList;
ThreadID = threadID;
DominanceAnalysis = new Dominance(Compiler.CompilerOptions.DominanceAnalysisFactory, BasicBlocks);
PluggedMethod = compiler.PlugSystem.GetPlugMethod(Method);
stop = false;
MethodData = compiler.CompilerData.GetCompilerMethodData(Method);
MethodData.Counters.Clear();
EvaluateParameterOperands();
}
示例2: AssemblyCompiler
/// <summary>
/// Initializes a new compiler instance.
/// </summary>
/// <param name="architecture">The compiler target architecture.</param>
/// <param name="typeSystem">The type system.</param>
protected AssemblyCompiler(IArchitecture architecture, ITypeSystem typeSystem)
{
if (architecture == null)
throw new ArgumentNullException(@"architecture");
this.architecture = architecture;
this.pipeline = new CompilerPipeline();
this.typeSystem = typeSystem;
}
示例3: AssemblyCompiler
/// <summary>
/// Initializes a new compiler instance.
/// </summary>
/// <param name="architecture">The compiler target architecture.</param>
/// <param name="assembly">The assembly of this compiler.</param>
/// <exception cref="System.ArgumentNullException">Either <paramref name="architecture"/> or <paramref name="assembly"/> is null.</exception>
protected AssemblyCompiler(IArchitecture architecture, IMetadataModule assembly)
{
if (architecture == null)
throw new ArgumentNullException(@"architecture");
_architecture = architecture;
_assembly = assembly;
_pipeline = new CompilerPipeline();
}
示例4: AssemblyCompiler
/// <summary>
/// Initializes a new compiler instance.
/// </summary>
/// <param name="architecture">The compiler target architecture.</param>
/// <param name="typeSystem">The type system.</param>
protected AssemblyCompiler(IArchitecture architecture, ITypeSystem typeSystem, ITypeLayout typeLayout, IInternalTrace internalTrace, CompilerOptions compilerOptions)
{
if (architecture == null)
throw new ArgumentNullException(@"architecture");
this.pipeline = new CompilerPipeline();
this.architecture = architecture;
this.typeSystem = typeSystem;
this.typeLayout = typeLayout;
this.internalTrace = internalTrace;
this.compilerOptions = compilerOptions;
this.genericTypePatcher = new GenericTypePatcher(typeSystem);
}
示例5: BaseCompiler
/// <summary>
/// Initializes a new compiler instance.
/// </summary>
/// <param name="architecture">The compiler target architecture.</param>
/// <param name="typeSystem">The type system.</param>
/// <param name="typeLayout">The type layout.</param>
/// <param name="compilationScheduler">The compilation scheduler.</param>
/// <param name="compilerTrace">The compiler trace.</param>
/// <param name="linker">The linker.</param>
/// <param name="compilerOptions">The compiler options.</param>
/// <exception cref="System.ArgumentNullException">@Architecture</exception>
protected BaseCompiler(BaseArchitecture architecture, TypeSystem typeSystem, MosaTypeLayout typeLayout, ICompilationScheduler compilationScheduler, CompilerTrace compilerTrace, BaseLinker linker, CompilerOptions compilerOptions)
{
if (architecture == null)
throw new ArgumentNullException(@"Architecture");
Pipeline = new CompilerPipeline();
Architecture = architecture;
TypeSystem = typeSystem;
TypeLayout = typeLayout;
CompilerTrace = compilerTrace;
CompilerOptions = compilerOptions;
Counters = new Counters();
CompilationScheduler = compilationScheduler;
PlugSystem = new PlugSystem();
Linker = linker;
if (Linker == null)
{
Linker = compilerOptions.LinkerFactory();
Linker.Initialize(compilerOptions.BaseAddress, architecture.Endianness, architecture.ElfMachineType);
}
// Create new dictionary
IntrinsicTypes = new Dictionary<string, Type>();
// Get all the classes that implement the IIntrinsicInternalMethod interface
IEnumerable<Type> types = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(p => typeof(IIntrinsicInternalMethod).IsAssignableFrom(p) && p.IsClass);
// Iterate through all the found types
foreach (var t in types)
{
// Now get all the ReplacementTarget attributes
var attributes = (ReplacementTargetAttribute[])t.GetCustomAttributes(typeof(ReplacementTargetAttribute), true);
for (int i = 0; i < attributes.Length; i++)
{
// Finally add the dictionary entry mapping the target string and the type
IntrinsicTypes.Add(attributes[i].Target, t);
}
}
PlatformInternalRuntimeType = GetPlatformInternalRuntimeType();
}
示例6: BaseCompiler
/// <summary>
/// Initializes a new compiler instance.
/// </summary>
/// <param name="architecture">The compiler target architecture.</param>
/// <param name="typeSystem">The type system.</param>
/// <param name="typeLayout">The type layout.</param>
/// <param name="compilationScheduler">The compilation scheduler.</param>
/// <param name="internalTrace">The internal trace.</param>
/// <param name="compilerOptions">The compiler options.</param>
protected BaseCompiler(BaseArchitecture architecture, TypeSystem typeSystem, MosaTypeLayout typeLayout, ICompilationScheduler compilationScheduler, IInternalTrace internalTrace, ILinker linker, CompilerOptions compilerOptions)
{
if (architecture == null)
throw new ArgumentNullException(@"Architecture");
Pipeline = new CompilerPipeline();
Architecture = architecture;
TypeSystem = typeSystem;
TypeLayout = typeLayout;
InternalTrace = internalTrace;
CompilerOptions = compilerOptions;
Counters = new Counters();
CompilationScheduler = compilationScheduler;
PlugSystem = new PlugSystem();
Linker = linker;
if (Linker == null)
{
Linker = compilerOptions.LinkerFactory();
Linker.Initialize(compilerOptions.OutputFile, architecture.Endianness, architecture.ElfMachineType);
}
}
示例7: ExtendMethodCompilerPipeline
/// <summary>
/// Extends the method compiler pipeline with ARM specific stages.
/// </summary>
/// <param name="methodCompilerPipeline">The method compiler pipeline to extend.</param>
public override void ExtendMethodCompilerPipeline(CompilerPipeline methodCompilerPipeline)
{
}
示例8: ExtendMethodCompilerPipeline
/// <summary>
/// Extends the method compiler pipeline with x86 specific stages.
/// </summary>
/// <param name="methodCompilerPipeline">The method compiler pipeline to extend.</param>
public override void ExtendMethodCompilerPipeline(CompilerPipeline methodCompilerPipeline)
{
// FIXME: Create a specific code generator instance using requested feature flags.
// FIXME: Add some more optimization passes, which take advantage of advanced x86 instructions
// and packed operations available with MMX/SSE extensions
methodCompilerPipeline.InsertAfter<PlatformStubStage>(
new IMethodCompilerStage[]
{
//InstructionLogger.Instance,
new LongOperandTransformationStage(),
//InstructionLogger.Instance,
new AddressModeConversionStage(),
//InstructionLogger.Instance,
new IRTransformationStage(),
//InstructionLogger.Instance,
new TweakTransformationStage(),
//InstructionLogger.Instance,
new MemToMemConversionStage(),
//InstructionLogger.Instance,
new ExceptionHeaderPreprocessingStage(),
});
methodCompilerPipeline.InsertAfter<IBlockOrderStage>(
new IMethodCompilerStage[]
{
new SimplePeepholeOptimizationStage(),
//InstructionLogger.Instance,
});
//FlowGraphVisualizationStage.Instance,
}
示例9: ExtendAssemblyCompilerPipeline
/// <summary>
/// Extends the assembly compiler pipeline with ARM specific stages.
/// </summary>
/// <param name="assemblyCompilerPipeline">The assembly compiler pipeline to extend.</param>
public override void ExtendAssemblyCompilerPipeline(CompilerPipeline assemblyCompilerPipeline)
{
//assemblyCompilerPipeline.InsertAfterFirst<IAssemblyCompilerStage>(
// new InterruptVectorStage()
//);
//assemblyCompilerPipeline.InsertAfterFirst<InterruptVectorStage>(
// new ExceptionVectorStage()
//);
//assemblyCompilerPipeline.InsertAfterLast<TypeLayoutStage>(
// new MethodTableBuilderStage()
//);
}
示例10: ExtendAssemblyCompilerPipeline
/// <summary>
/// Extends the assembly compiler pipeline with architecture specific assembly compiler stages.
/// </summary>
/// <param name="assemblyPipeline">The pipeline to extend.</param>
public abstract void ExtendAssemblyCompilerPipeline(CompilerPipeline assemblyPipeline);
示例11: CompilerBase
/// <summary>
/// Initializes a new instance of.
/// </summary>
protected CompilerBase()
{
_pipeline = new CompilerPipeline();
}
示例12: ExtendPreCompilerPipeline
/// <summary>
/// Extends the pre-compiler pipeline with x86 compiler stages.
/// </summary>
/// <param name="compilerPipeline">The pipeline to extend.</param>
public override void ExtendPreCompilerPipeline(CompilerPipeline compilerPipeline)
{
compilerPipeline.InsertAfterFirst<ICompilerStage>(
new InterruptVectorStage()
);
compilerPipeline.InsertAfterLast<ICompilerStage>(
new SSESetupStage()
);
}
示例13: ExtendCompilerPipeline
/// <summary>
/// Extends the compiler pipeline with x86 specific stages.
/// </summary>
/// <param name="compilerPipeline">The pipeline to extend.</param>
public override void ExtendCompilerPipeline(CompilerPipeline compilerPipeline)
{
compilerPipeline.InsertAfterFirst<ICompilerStage>(
new InterruptVectorStage()
);
compilerPipeline.InsertAfterFirst<InterruptVectorStage>(
new ExceptionVectorStage()
);
compilerPipeline.InsertAfterLast<TypeLayoutStage>(
new MethodTableBuilderStage()
);
}
示例14: ExtendCompilerPipeline
/// <summary>
/// Extends the pre-compiler pipeline with x86 compiler stages.
/// </summary>
/// <param name="compilerPipeline">The pipeline to extend.</param>
public override void ExtendCompilerPipeline(CompilerPipeline compilerPipeline)
{
compilerPipeline.Add(
new StartUpStage()
);
compilerPipeline.Add(
new InterruptVectorStage()
);
compilerPipeline.Add(
new SSEInitStage()
);
}
示例15: BaseMethodCompiler
/// <summary>
/// Initializes a new instance of the <see cref="BaseMethodCompiler"/> class.
/// </summary>
/// <param name="compiler">The assembly compiler.</param>
/// <param name="method">The method to compile by this instance.</param>
/// <param name="instructionSet">The instruction set.</param>
protected BaseMethodCompiler(BaseCompiler compiler, RuntimeMethod method, InstructionSet instructionSet)
{
this.compiler = compiler;
this.method = method;
this.type = method.DeclaringType;
this.compilationScheduler = compiler.Scheduler;
this.moduleTypeSystem = method.Module;
this.architecture = compiler.Architecture;
this.typeSystem = compiler.TypeSystem;
this.typeLayout = Compiler.TypeLayout;
this.internalTrace = Compiler.InternalTrace;
this.linker = compiler.Linker;
this.basicBlocks = new BasicBlocks();
this.instructionSet = instructionSet ?? new InstructionSet(256);
this.pipeline = new CompilerPipeline();
this.stackLayout = new StackLayout(architecture, method.Parameters.Count + (method.Signature.HasThis || method.Signature.HasExplicitThis ? 1 : 0));
this.virtualRegisterLayout = new VirtualRegisterLayout(architecture, stackLayout);
EvaluateParameterOperands();
this.stopMethodCompiler = false;
}