本文整理汇总了C#中Mosa.Compiler.Framework.Context.SetInstruction2方法的典型用法代码示例。如果您正苦于以下问题:C# Context.SetInstruction2方法的具体用法?C# Context.SetInstruction2怎么用?C# Context.SetInstruction2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mosa.Compiler.Framework.Context
的用法示例。
在下文中一共展示了Context.SetInstruction2方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1:
/// <summary>
/// Replaces the intrinsic call site
/// </summary>
/// <param name="context">The context.</param>
/// <param name="typeSystem">The type system.</param>
void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, BaseMethodCompiler methodCompiler)
{
Operand n = context.Operand1;
Operand d = context.Operand2;
Operand result = context.Result;
Operand result2 = methodCompiler.CreateVirtualRegister(methodCompiler.TypeSystem.BuiltIn.U4);
Operand op0L, op0H;
LongOperandTransformationStage.SplitLongOperand(methodCompiler, n, out op0L, out op0H);
context.SetInstruction2(X86.Div, result2, result, op0H, op0L, d);
}
示例2:
/// <summary>
/// Replaces the intrinsic call site
/// </summary>
/// <param name="context">The context.</param>
/// <param name="typeSystem">The type system.</param>
void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, BaseMethodCompiler methodCompiler)
{
// xchg bx, bx
var bx = Operand.CreateCPURegister(methodCompiler.TypeSystem.BuiltIn.U2, GeneralPurposeRegister.EBX);
context.SetInstruction2(X86.Xchg, bx, bx, bx, bx);
}
示例3:
/// <summary>
/// Visitation function for <see cref="IX86Visitor.Setcc"/> instructions.
/// </summary>
/// <param name="context">The context.</param>
void IX86Visitor.Setcc(Context context)
{
Debug.Assert(context.Result.IsCPURegister);
// SETcc can not use ESI or EDI registers
if (context.Result.IsCPURegister && (context.Result.Register == GeneralPurposeRegister.ESI || context.Result.Register == GeneralPurposeRegister.EDI))
{
Operand result = context.Result;
var condition = context.ConditionCode;
Operand EAX = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EAX);
context.SetInstruction2(X86.Xchg, EAX, result, result, EAX);
context.AppendInstruction(X86.Setcc, condition, EAX);
context.AppendInstruction2(X86.Xchg, result, EAX, EAX, result);
}
}
示例4: EmitFloatingPointConstants
/// <summary>
/// Visitation function for RemSigned.
/// </summary>
/// <param name="context">The context.</param>
void IIRVisitor.RemSigned(Context context)
{
EmitFloatingPointConstants(context);
Operand result = context.Result;
Operand operand1 = context.Operand1;
Operand operand2 = context.Operand2;
Operand v1 = AllocateVirtualRegister(TypeSystem.BuiltIn.I4);
Operand v2 = AllocateVirtualRegister(TypeSystem.BuiltIn.U4);
Operand v3 = AllocateVirtualRegister(TypeSystem.BuiltIn.I4);
// FIXME
context.SetInstruction2(X86.Cdq, v1, v2, operand1);
context.AppendInstruction2(X86.IDiv, result, v3, v1, v2, operand2);
}
示例5: AllocateVirtualRegister
/// <summary>
/// Visitation function for MulSigned.
/// </summary>
/// <param name="context">The context.</param>
void IIRVisitor.MulSigned(Context context)
{
Operand result = context.Result;
Operand operand1 = context.Operand1;
Operand operand2 = context.Operand2;
Operand v1 = AllocateVirtualRegister(TypeSystem.BuiltIn.U4);
context.SetInstruction2(X86.Mul, v1, result, operand1, operand2);
}
示例6: Mov
/// <summary>
/// Visitation function for <see cref="IX86Visitor.Mov"/> instructions.
/// </summary>
/// <param name="context">The context.</param>
public void Mov(Context context)
{
if (context.Result.IsCPURegister && context.Operand1.IsCPURegister && context.Result.Register == context.Operand1.Register)
{
context.Empty();
return;
}
// Mov can not use ESI or EDI registers with 8 or 16 bit memory or register
if (context.Operand1.IsCPURegister && (context.Result.IsMemoryAddress || context.Result.IsCPURegister)
&& (context.Result.IsByte || context.Result.IsShort || context.Result.IsChar || context.Result.IsBoolean)
&& (context.Operand1.Register == GeneralPurposeRegister.ESI || context.Operand1.Register == GeneralPurposeRegister.EDI))
{
Operand source = context.Operand1;
Operand dest = context.Result;
var replace = (dest.IsMemoryAddress && dest.EffectiveOffsetBase == GeneralPurposeRegister.EAX)
? GeneralPurposeRegister.EBX : GeneralPurposeRegister.EAX;
Operand reg = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, replace);
context.SetInstruction2(X86.Xchg, reg, source, source, reg);
context.AppendInstruction(X86.Mov, dest, reg);
context.AppendInstruction2(X86.Xchg, source, reg, reg, source);
}
}
示例7: Mov
public void Mov(Context context)
{
Operand source = context.Operand1;
Operand result = context.Result;
Debug.Assert(result.IsCPURegister);
if (source.IsCPURegister && result.Register == source.Register)
{
context.Empty();
return;
}
var size = context.Size;
// Mov can not use ESI or EDI registers for 8/16bit values
if (!(size == InstructionSize.Size16 || size == InstructionSize.Size8))
return;
if (source.IsCPURegister && (source.Register == GeneralPurposeRegister.ESI || source.Register == GeneralPurposeRegister.EDI))
{
Operand eax = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EAX);
context.SetInstruction2(X86.Xchg, eax, source, source, eax);
context.AppendInstruction(X86.Mov, result, eax);
context.AppendInstruction2(X86.Xchg, source, eax, eax, source);
}
}
示例8: Setcc
public void Setcc(Context context)
{
Debug.Assert(context.Result.IsCPURegister);
Operand result = context.Result;
Debug.Assert(result.IsCPURegister);
// SETcc can not use with ESI or EDI registers
if (result.Register == GeneralPurposeRegister.ESI || result.Register == GeneralPurposeRegister.EDI)
{
var condition = context.ConditionCode;
Operand eax = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EAX);
context.SetInstruction2(X86.Xchg, eax, result, result, eax);
context.AppendInstruction(X86.Setcc, condition, eax);
context.AppendInstruction2(X86.Xchg, result, eax, eax, result);
}
}
示例9: MovStore
public void MovStore(Context context)
{
var size = context.Size;
// Mov can not use ESI or EDI registers for 8/16bit values
if (!(size == InstructionSize.Size16 || size == InstructionSize.Size8))
return;
Operand value = context.Operand3;
if (value.IsCPURegister && (value.Register == GeneralPurposeRegister.ESI || value.Register == GeneralPurposeRegister.EDI))
{
Operand dest = context.Operand1;
Operand offset = context.Operand2;
Operand temporaryRegister = null;
if (dest.Register != GeneralPurposeRegister.EAX && offset.Register != GeneralPurposeRegister.EAX)
{
temporaryRegister = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EAX);
}
else if (dest.Register != GeneralPurposeRegister.EBX && offset.Register != GeneralPurposeRegister.EBX)
{
temporaryRegister = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EBX);
}
else if (dest.Register != GeneralPurposeRegister.ECX && offset.Register != GeneralPurposeRegister.ECX)
{
temporaryRegister = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.ECX);
}
else
{
temporaryRegister = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EDX);
}
context.SetInstruction2(X86.Xchg, temporaryRegister, value, value, temporaryRegister);
context.AppendInstruction(X86.MovStore, size, null, dest, offset, temporaryRegister);
context.AppendInstruction2(X86.Xchg, value, temporaryRegister, temporaryRegister, value);
}
}