本文整理汇总了C#中InstructionNode类的典型用法代码示例。如果您正苦于以下问题:C# InstructionNode类的具体用法?C# InstructionNode怎么用?C# InstructionNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InstructionNode类属于命名空间,在下文中一共展示了InstructionNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Decode
/// <summary>
/// Decodes the specified CIL instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
/// <remarks>
/// This method is used by instructions to retrieve immediate operands
/// From the instruction stream.
/// </remarks>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
int index;
// Opcode specific handling
switch (opcode)
{
case OpCode.Ldarg:
case OpCode.Ldarg_s: index = (int)decoder.Instruction.Operand; break;
case OpCode.Ldarg_0: index = 0; break;
case OpCode.Ldarg_1: index = 1; break;
case OpCode.Ldarg_2: index = 2; break;
case OpCode.Ldarg_3: index = 3; break;
default: throw new System.NotImplementedException();
}
// Push the loaded value onto the evaluation stack
var parameterOperand = decoder.Compiler.GetParameterOperand(index);
var result = LoadInstruction.CreateResultOperand(decoder, parameterOperand.Type);
ctx.Operand1 = parameterOperand;
ctx.Result = result;
}
示例2: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
// Opcode specific handling
int index;
switch (opcode)
{
case OpCode.Ldloc:
case OpCode.Ldloc_s: index = (int)decoder.Instruction.Operand; break;
case OpCode.Ldloc_0: index = 0; break;
case OpCode.Ldloc_1: index = 1; break;
case OpCode.Ldloc_2: index = 2; break;
case OpCode.Ldloc_3: index = 3; break;
default: throw new InvalidMetadataException();
}
// Push the loaded value onto the evaluation stack
var local = decoder.Compiler.LocalVariables[index];
var result = AllocateVirtualRegisterOrStackSlot(decoder.Compiler, local.Type);
ctx.Operand1 = local;
ctx.Result = result;
}
示例3: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
throw new NotImplementedException();
}
示例4: GetModifier
/// <summary>
/// Gets the instruction modifier.
/// </summary>
/// <param name="node">The context.</param>
/// <returns></returns>
protected override string GetModifier(InstructionNode node)
{
switch (((node.Instruction) as CIL.BaseCILInstruction).OpCode)
{
case OpCode.Beq_s: return @"==";
case OpCode.Beq: return @"==";
case OpCode.Bge_s: return @">=";
case OpCode.Bge: return @">=";
case OpCode.Bge_un_s: return @">= unordered";
case OpCode.Bge_un: return @">= unordered";
case OpCode.Bgt_s: return @">";
case OpCode.Bgt: return @">";
case OpCode.Bgt_un_s: return @"> unordered";
case OpCode.Bgt_un: return @"> unordered";
case OpCode.Ble_s: return @"<=";
case OpCode.Ble: return @"<=";
case OpCode.Ble_un_s: return @"<= unordered";
case OpCode.Ble_un: return @"<= unordered";
case OpCode.Blt_s: return @"<";
case OpCode.Blt: return @"<";
case OpCode.Blt_un_s: return @"< unordered";
case OpCode.Blt_un: return @"< unordered";
case OpCode.Bne_un_s: return @"!= unordered";
case OpCode.Bne_un: return @"!= unordered";
default: throw new InvalidOperationException(@"Opcode not set.");
}
}
示例5: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
// FIXME: Validate operands & verify instruction
ctx.Result = decoder.Compiler.CreateVirtualRegister(decoder.TypeSystem.BuiltIn.I4);
}
示例6: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
// Push the address on the stack
ctx.Result = decoder.Compiler.CreateVirtualRegister(decoder.TypeSystem.BuiltIn.U);
}
示例7: EmitFloatingPointConstants
/// <summary>
/// Emits the constant operands.
/// </summary>
/// <param name="node">The node.</param>
protected void EmitFloatingPointConstants(InstructionNode node)
{
if (node.OperandCount > 0)
node.Operand1 = EmitFloatingPointConstant(node.Operand1);
if (node.OperandCount > 1)
node.Operand2 = EmitFloatingPointConstant(node.Operand2);
if (node.OperandCount > 2)
node.Operand3 = EmitFloatingPointConstant(node.Operand3);
}
示例8: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
var type = (MosaType)decoder.Instruction.Operand;
throw new NotImplementCompilerException();
}
示例9: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
var type = (MosaType)decoder.Instruction.Operand;
ctx.Result = decoder.Compiler.CreateVirtualRegister(type.ToManagedPointer());
}
示例10: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
byte nocheck = (byte)decoder.Instruction.Operand;
//FUTURE:
//ctx.Other = nocheck;
}
示例11: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
var type = (MosaType)decoder.Instruction.Operand;
ctx.Result = decoder.Compiler.CreateVirtualRegister(decoder.TypeSystem.BuiltIn.Object);
ctx.MosaType = type;
}
示例12: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
var block = decoder.GetBlock((int)decoder.Instruction.Operand);
ctx.AddBranchTarget(block);
}
示例13: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
var type = (MosaType)decoder.Instruction.Operand;
ctx.Result = decoder.Compiler.AllocateVirtualRegisterOrStackSlot(type);
ctx.ResultCount = 1;
}
示例14: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
var type = (MosaMethod)decoder.Instruction.Operand;
//TODO
throw new NotImplementedException();
}
示例15: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
// Retrieve the type reference
var type = (MosaType)decoder.Instruction.Operand;
ctx.MosaType = type;
}