本文整理汇总了C#中IInstructionDecoder.DecodeInt方法的典型用法代码示例。如果您正苦于以下问题:C# IInstructionDecoder.DecodeInt方法的具体用法?C# IInstructionDecoder.DecodeInt怎么用?C# IInstructionDecoder.DecodeInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IInstructionDecoder
的用法示例。
在下文中一共展示了IInstructionDecoder.DecodeInt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
// Set the result
ctx.TokenType = ((HeapIndexToken)decoder.DecodeInt()) | HeapIndexToken.UserString;
ctx.Result = decoder.Compiler.CreateTemporary(BuiltInSigType.String);
}
示例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(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
// Retrieve the number of branch targets
uint count = decoder.DecodeUInt();
ctx.AllocateBranchTargets(count + 1);
// Populate the array
for (uint i = 0; i < count; i++)
ctx.BranchTargets[i] = decoder.DecodeInt();
}
示例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(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
switch (opcode)
{
case OpCode.Leave_s:
{
sbyte sb = decoder.DecodeSByte();
ctx.SetBranch(sb);
break;
}
case OpCode.Leave:
{
int sb = decoder.DecodeInt();
ctx.SetBranch(sb);
break;
}
}
}
示例4: 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(Context ctx, IInstructionDecoder decoder)
{
// Decode bases first
base.Decode(ctx, decoder);
switch (opcode)
{
case OpCode.Br_s:
{
sbyte target = decoder.DecodeSByte();
ctx.SetBranch(target);
}
break;
case OpCode.Br:
{
int target = decoder.DecodeInt();
ctx.SetBranch(target);
break;
}
}
}
示例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(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
Operand constantValueOperand;
// Opcode specific handling
switch (opcode)
{
case OpCode.Ldc_i4:
{
int i = decoder.DecodeInt();
constantValueOperand = Operand.CreateConstant(BuiltInSigType.Int32, i);
}
break;
case OpCode.Ldc_i4_s:
{
sbyte sb = decoder.DecodeSByte();
constantValueOperand = Operand.CreateConstant(BuiltInSigType.Int32, sb);
}
break;
case OpCode.Ldc_i8:
{
long l = decoder.DecodeLong();
constantValueOperand = Operand.CreateConstant(BuiltInSigType.Int64, l);
}
break;
case OpCode.Ldc_r4:
{
float f = decoder.DecodeFloat();
constantValueOperand = Operand.CreateConstant(BuiltInSigType.Single, f);
}
break;
case OpCode.Ldc_r8:
{
double d = decoder.DecodeDouble();
constantValueOperand = Operand.CreateConstant(BuiltInSigType.Double, d);
}
break;
case OpCode.Ldnull:
constantValueOperand = Operand.GetNull();
break;
case OpCode.Ldc_i4_0:
constantValueOperand = Operand.CreateConstant(0);
break;
case OpCode.Ldc_i4_1:
constantValueOperand = Operand.CreateConstant(1);
break;
case OpCode.Ldc_i4_2:
constantValueOperand = Operand.CreateConstant(2);
break;
case OpCode.Ldc_i4_3:
constantValueOperand = Operand.CreateConstant(3);
break;
case OpCode.Ldc_i4_4:
constantValueOperand = Operand.CreateConstant(4);
break;
case OpCode.Ldc_i4_5:
constantValueOperand = Operand.CreateConstant(5);
break;
case OpCode.Ldc_i4_6:
constantValueOperand = Operand.CreateConstant(6);
break;
case OpCode.Ldc_i4_7:
constantValueOperand = Operand.CreateConstant(7);
break;
case OpCode.Ldc_i4_8:
constantValueOperand = Operand.CreateConstant(8);
break;
case OpCode.Ldc_i4_m1:
constantValueOperand = Operand.CreateConstant(-1);
break;
default:
throw new System.NotImplementedException();
}
ctx.Operand1 = constantValueOperand;
ctx.Result = decoder.Compiler.CreateVirtualRegister(constantValueOperand.Type);
//.........这里部分代码省略.........
示例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(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
// Read the branch target
// Is this a short branch target?
if (opcode == OpCode.Brfalse_s || opcode == OpCode.Brtrue_s)
{
sbyte target = decoder.DecodeSByte();
ctx.SetBranch(target);
}
else if (opcode == OpCode.Brfalse || opcode == OpCode.Brtrue)
{
int target = decoder.DecodeInt();
ctx.SetBranch(target);
}
else if (opcode == OpCode.Switch)
{
// Don't do anything, the derived class will do everything
}
else
{
throw new NotSupportedException(@"Invalid opcode " + opcode.ToString() + " specified for UnaryBranchInstruction.");
}
}
示例7: 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(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
ConstantOperand constantValueOperand;
// Opcode specific handling
switch (opcode)
{
case OpCode.Ldc_i4:
{
int i = decoder.DecodeInt();
constantValueOperand = new ConstantOperand(new SigType(CilElementType.I4), i);
}
break;
case OpCode.Ldc_i4_s:
{
sbyte sb = decoder.DecodeSByte();
constantValueOperand = new ConstantOperand(new SigType(CilElementType.I4), sb);
}
break;
case OpCode.Ldc_i8:
{
long l = decoder.DecodeLong();
constantValueOperand = new ConstantOperand(new SigType(CilElementType.I8), l);
}
break;
case OpCode.Ldc_r4:
{
float f = decoder.DecodeFloat();
constantValueOperand = new ConstantOperand(new SigType(CilElementType.R4), f);
}
break;
case OpCode.Ldc_r8:
{
double d = decoder.DecodeDouble();
constantValueOperand = new ConstantOperand(new SigType(CilElementType.R8), d);
}
break;
case OpCode.Ldnull:
constantValueOperand = ConstantOperand.GetNull();
break;
case OpCode.Ldc_i4_0:
constantValueOperand = ConstantOperand.FromValue(0);
break;
case OpCode.Ldc_i4_1:
constantValueOperand = ConstantOperand.FromValue(1);
break;
case OpCode.Ldc_i4_2:
constantValueOperand = ConstantOperand.FromValue(2);
break;
case OpCode.Ldc_i4_3:
constantValueOperand = ConstantOperand.FromValue(3);
break;
case OpCode.Ldc_i4_4:
constantValueOperand = ConstantOperand.FromValue(4);
break;
case OpCode.Ldc_i4_5:
constantValueOperand = ConstantOperand.FromValue(5);
break;
case OpCode.Ldc_i4_6:
constantValueOperand = ConstantOperand.FromValue(6);
break;
case OpCode.Ldc_i4_7:
constantValueOperand = ConstantOperand.FromValue(7);
break;
case OpCode.Ldc_i4_8:
constantValueOperand = ConstantOperand.FromValue(8);
break;
case OpCode.Ldc_i4_m1:
constantValueOperand = ConstantOperand.FromValue(-1);
break;
default:
throw new System.NotImplementedException();
}
ctx.Operand1 = constantValueOperand;
ctx.Result = decoder.Compiler.CreateTemporary(constantValueOperand.Type);
//.........这里部分代码省略.........
示例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(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
// Read the branch target
// Is this a short branch target?
// FIXME: Remove unary branch instructions from this list.
if (opcode == OpCode.Beq_s || opcode == OpCode.Bge_s || opcode == OpCode.Bge_un_s || opcode == OpCode.Bgt_s ||
opcode == OpCode.Bgt_un_s || opcode == OpCode.Ble_s || opcode == OpCode.Ble_un_s || opcode == OpCode.Blt_s ||
opcode == OpCode.Blt_un_s || opcode == OpCode.Bne_un_s)
{
sbyte target = decoder.DecodeSByte();
ctx.SetBranch(target);
}
else if (opcode == OpCode.Beq || opcode == OpCode.Bge || opcode == OpCode.Bge_un || opcode == OpCode.Bgt ||
opcode == OpCode.Bgt_un || opcode == OpCode.Ble || opcode == OpCode.Ble_un || opcode == OpCode.Blt ||
opcode == OpCode.Blt_un || opcode == OpCode.Bne_un)
{
int target = decoder.DecodeInt();
ctx.SetBranch(target);
}
else
{
throw new NotSupportedException(@"Invalid branch opcode specified for BinaryBranchInstruction");
}
}