本文整理汇总了C#中MosaMethod类的典型用法代码示例。如果您正苦于以下问题:C# MosaMethod类的具体用法?C# MosaMethod怎么用?C# MosaMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MosaMethod类属于命名空间,在下文中一共展示了MosaMethod类的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="instructionSet">The instruction set.</param>
protected BaseMethodCompiler(BaseCompiler compiler, MosaMethod method, BasicBlocks basicBlocks, InstructionSet instructionSet)
{
this.Compiler = compiler;
this.Method = method;
this.Type = method.DeclaringType;
this.Scheduler = compiler.CompilationScheduler;
this.Architecture = compiler.Architecture;
this.TypeSystem = compiler.TypeSystem;
this.TypeLayout = Compiler.TypeLayout;
this.InternalTrace = Compiler.InternalTrace;
this.Linker = compiler.Linker;
this.BasicBlocks = basicBlocks ?? new BasicBlocks();
this.InstructionSet = instructionSet ?? new InstructionSet(256);
this.Pipeline = new CompilerPipeline();
this.StackLayout = new StackLayout(Architecture, method.Signature.Parameters.Count + (method.HasThis || method.HasExplicitThis ? 1 : 0));
this.VirtualRegisters = new VirtualRegisters(Architecture);
this.LocalVariables = emptyOperandList;
this.DominanceAnalysis = new DominanceAnalysis(Compiler.CompilerOptions.DominanceAnalysisFactory, this.BasicBlocks);
EvaluateParameterOperands();
this.stop = false;
Debug.Assert(this.Linker != null);
}
示例2: CompilerTrace
public CompilerTrace(IInternalTrace internalTrace, MosaMethod method, string stage)
: this(internalTrace)
{
this.Stage = stage;
this.Method = method;
this.Active = internalTrace.TraceFilter.IsMatch(this.Method, this.Stage);
}
示例3: TraceLog
public TraceLog(TraceType type, MosaMethod method, string stage, bool active)
: this(type)
{
this.Stage = stage;
this.Method = method;
this.Active = active;
}
示例4: IsMatch
public bool IsMatch(MosaMethod method, string stage)
{
if (!Active)
return false;
return IsMatch(method.DeclaringType.Name, method.Name, stage);
}
示例5: 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();
}
示例6: TraceLog
public TraceLog(TraceType type, MosaMethod method, string stage, TraceFilter filter)
: this(type)
{
Stage = stage;
Method = method;
Active = filter.IsMatch(Method, Stage);
}
示例7: CalculateStackSizeForParameters
/// <summary>
/// Calculates the stack size for parameters.
/// </summary>
/// <param name="typeLayout">The type layouts.</param>
/// <param name="operands">The operands.</param>
/// <param name="method">The method.</param>
/// <returns></returns>
protected static int CalculateStackSizeForParameters(MosaTypeLayout typeLayout, BaseArchitecture architecture, List<Operand> operands, MosaMethod method)
{
Debug.Assert((method.Signature.Parameters.Count + (method.HasThis ? 1 : 0) == operands.Count) ||
(method.DeclaringType.IsDelegate && method.Signature.Parameters.Count == operands.Count), method.FullName);
int offset = method.Signature.Parameters.Count - operands.Count;
int result = 0;
for (int index = operands.Count - 1; index >= 0; index--)
{
Operand operand = operands[index];
int size, alignment;
architecture.GetTypeRequirements(typeLayout, operand.Type, out size, out alignment);
var param = (index + offset >= 0) ? method.Signature.Parameters[index + offset] : null;
if (param != null && operand.IsR8 && param.ParameterType.IsR4)
{
// adjust for parameter size on stack when method parameter is R4 while the calling variable is R8
architecture.GetTypeRequirements(typeLayout, param.ParameterType, out size, out alignment);
}
result = (int)Alignment.AlignUp(result, (uint)alignment) + size;
}
return result;
}
示例8: AotMethodCompiler
/// <summary>
/// Initializes a new instance of the <see cref="AotMethodCompiler" /> class.
/// </summary>
/// <param name="compiler">The compiler.</param>
/// <param name="method">The method.</param>
/// <param name="basicBlocks">The basic blocks.</param>
/// <param name="instructionSet">The instruction set.</param>
public AotMethodCompiler(BaseCompiler compiler, MosaMethod method, BasicBlocks basicBlocks, InstructionSet instructionSet)
: base(compiler, method, basicBlocks, instructionSet)
{
var compilerOptions = compiler.CompilerOptions;
Pipeline.Add(new IMethodCompilerStage[] {
new CILDecodingStage(),
new BasicBlockBuilderStage(),
new StackSetupStage(),
new ExceptionPrologueStage(),
new OperandAssignmentStage(),
new StaticAllocationResolutionStage(),
new CILTransformationStage(),
new ConvertCompoundMoveStage(),
(compilerOptions.EnableSSA) ? new PromoteLocalVariablesStage() : null,
(compilerOptions.EnableSSA) ? new EdgeSplitStage() : null,
(compilerOptions.EnableSSA) ? new PhiPlacementStage() : null,
(compilerOptions.EnableSSA) ? new EnterSSAStage() : null,
(compilerOptions.EnableSSA && compilerOptions.EnableSSAOptimizations) ? new SSAOptimizations() : null,
(compilerOptions.EnableSSA) ? new LeaveSSA() : null,
(compilerOptions.EnableSSA) ? new ConvertCompoundMoveStage() : null,
new PlatformStubStage(),
new PlatformEdgeSplitStage(),
new GreedyRegisterAllocatorStage(),
new StackLayoutStage(),
new EmptyBlockRemovalStage(),
new BlockOrderingStage(),
new CodeGenerationStage(),
});
}
示例9: SimMethodCompiler
/// <summary>
/// Initializes a new instance of the <see cref="SimMethodCompiler" /> class.
/// </summary>
/// <param name="compiler">The compiler.</param>
/// <param name="method">The method.</param>
/// <param name="simAdapter">The sim adapter.</param>
/// <param name="basicBlocks">The basic blocks.</param>
/// <param name="instructionSet">The instruction set.</param>
public SimMethodCompiler(SimCompiler compiler, MosaMethod method, ISimAdapter simAdapter, BasicBlocks basicBlocks, InstructionSet instructionSet)
: base(compiler, method, basicBlocks, instructionSet)
{
var compilerOptions = Compiler.CompilerOptions;
// Populate the pipeline
Pipeline.Add(new IMethodCompilerStage[] {
new CILDecodingStage(),
new BasicBlockBuilderStage(),
new StackSetupStage(),
new ExceptionPrologueStage(),
new OperandAssignmentStage(),
//new SingleUseMarkerStage(),
//new OperandUsageAnalyzerStage(),
new StaticAllocationResolutionStage(),
new CILTransformationStage(),
new ConvertCompoundMoveStage(),
//new CheckIROperandCountStage(),
(compilerOptions.EnableSSA) ? new PromoteLocalVariablesStage() : null,
(compilerOptions.EnableSSA) ? new EdgeSplitStage() : null,
(compilerOptions.EnableSSA) ? new PhiPlacementStage() : null,
(compilerOptions.EnableSSA) ? new EnterSSAStage() : null,
(compilerOptions.EnableSSA && compilerOptions.EnableSSAOptimizations) ? new SSAOptimizations() : null,
(compilerOptions.EnableSSA) ? new LeaveSSA() : null,
(compilerOptions.EnableSSA) ? new ConvertCompoundMoveStage() : null,
new PlatformStubStage(),
//new CheckPlatformOperandCountStage(),
new PlatformEdgeSplitStage(),
new GreedyRegisterAllocatorStage(),
new StackLayoutStage(),
new EmptyBlockRemovalStage(),
new BlockOrderingStage(),
new SimCodeGeneratorStage(simAdapter),
});
}
示例10: IsScheduled
public bool IsScheduled(MosaMethod method)
{
lock (methods)
{
return methods.Contains(method);
}
}
示例11: GetPlugMethod
/// <summary>
/// Gets the plug.
/// </summary>
/// <param name="method">The method.</param>
/// <returns></returns>
public MosaMethod GetPlugMethod(MosaMethod method)
{
MosaMethod plug = null;
plugMethods.TryGetValue(method, out plug);
return plug;
}
示例12: CompilerMethodData
public CompilerMethodData(MosaMethod mosaMethod)
{
if (mosaMethod == null)
throw new ArgumentNullException("mosaMethod");
Method = mosaMethod;
this.Calls = new List<MosaMethod>();
this.CalledBy = new List<MosaMethod>();
this.CompileCount = 0;
}
示例13:
void ITraceListener.SubmitInstructionTraceInformation(MosaMethod method, string stage, string log)
{
if (string.IsNullOrEmpty(MethodPipelineExportDirectory))
return;
string filename = (method.FullName + ".txt").Replace("<", "[").Replace(">", "]");
if (filename.Length > 200)
filename = filename.Substring(0, 200);
string fullname = Path.Combine(MethodPipelineExportDirectory, filename);
File.AppendAllText(fullname, "[" + stage + "]" + Environment.NewLine + Environment.NewLine + log + Environment.NewLine);
}
示例14: ExplorerMethodCompiler
/// <summary>
/// Initializes a new instance of the <see cref="ExplorerMethodCompiler" /> class.
/// </summary>
/// <param name="compiler">The compiler.</param>
/// <param name="method">The method.</param>
/// <param name="basicBlocks">The basic blocks.</param>
/// <param name="threadID">The thread identifier.</param>
public ExplorerMethodCompiler(ExplorerCompiler compiler, MosaMethod method, BasicBlocks basicBlocks, int threadID)
: base(compiler, method, basicBlocks, threadID)
{
var compilerOptions = Compiler.CompilerOptions;
// Populate the pipeline
Pipeline.Add(new IMethodCompilerStage[] {
new CILDecodingStage(),
new ExceptionPrologueStage(),
new OperandAssignmentStage(),
new StackSetupStage(),
new CILProtectedRegionStage(),
new ExceptionStage(),
new StaticAllocationResolutionStage(),
new CILTransformationStage(),
new UnboxValueTypeStage(),
(compilerOptions.EnableInlinedMethods) ? new InlineStage() : null,
(compilerOptions.EnableSSA) ? new EdgeSplitStage() : null,
(compilerOptions.EnableSSA) ? new PhiPlacementStage() : null,
(compilerOptions.EnableSSA) ? new EnterSSAStage() : null,
(compilerOptions.EnableSparseConditionalConstantPropagation && compilerOptions.EnableSSA) ? new SparseConditionalConstantPropagationStage() : null,
(compilerOptions.EnableOptimizations) ? new IROptimizationStage() : null,
//(compilerOptions.TwoPassOptimizationStages && compilerOptions.EnableOptimizations && compilerOptions.EnableSparseConditionalConstantPropagation && compilerOptions.EnableSSA) ? new SparseConditionalConstantPropagationStage() : null,
//(compilerOptions.TwoPassOptimizationStages && compilerOptions.EnableOptimizations && compilerOptions.EnableSparseConditionalConstantPropagation && compilerOptions.EnableSSA) ? new IROptimizationStage() : null,
(compilerOptions.EnableSSA) ? new LeaveSSA() : null,
new IRCleanupStage(),
(compilerOptions.EnableInlinedMethods) ? new InlineEvaluationStage() : null,
//new StopStage(),
new PlatformStubStage(),
new PlatformEdgeSplitStage(),
new VirtualRegisterRenameStage(),
new GreedyRegisterAllocatorStage(),
new StackLayoutStage(),
new EmptyBlockRemovalStage(),
new BlockOrderingStage(),
new CodeGenerationStage(compilerOptions.EmitBinary),
new GraphVizStage(),
(compilerOptions.EmitBinary) ? new ProtectedRegionLayoutStage() : null,
(compilerOptions.EmitBinary) ? new DisassemblyStage() : null
});
}
示例15: GetCompilerMethodData
public CompilerMethodData GetCompilerMethodData(MosaMethod method)
{
lock (compilerMethods)
{
CompilerMethodData compilerMethod;
if (!compilerMethods.TryGetValue(method, out compilerMethod))
{
compilerMethod = new CompilerMethodData(method);
compilerMethods.Add(method, compilerMethod);
}
return compilerMethod;
}
}