当前位置: 首页>>代码示例>>C#>>正文


C# IInstructionDecoder.DecodeSByte方法代码示例

本文整理汇总了C#中IInstructionDecoder.DecodeSByte方法的典型用法代码示例。如果您正苦于以下问题:C# IInstructionDecoder.DecodeSByte方法的具体用法?C# IInstructionDecoder.DecodeSByte怎么用?C# IInstructionDecoder.DecodeSByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IInstructionDecoder的用法示例。


在下文中一共展示了IInstructionDecoder.DecodeSByte方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);

            // 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.");
            }
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:31,代码来源:UnaryBranchInstruction.cs

示例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);

            // 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");
            }
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:32,代码来源:BinaryBranchInstruction.cs

示例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;
                    }
            }
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:26,代码来源:LeaveInstruction.cs

示例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;
                    }
            }
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:27,代码来源:BranchInstruction.cs

示例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);
//.........这里部分代码省略.........
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:101,代码来源:LdcInstruction.cs

示例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);

            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);
//.........这里部分代码省略.........
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:101,代码来源:LdcInstruction.cs


注:本文中的IInstructionDecoder.DecodeSByte方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。