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


C# InstructionNode类代码示例

本文整理汇总了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;
        }
开发者ID:yonglehou,项目名称:MOSA-Project,代码行数:35,代码来源:LdargInstruction.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(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;
        }
开发者ID:tgiphil,项目名称:MOSA-Project,代码行数:30,代码来源:LdlocInstruction.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(InstructionNode ctx, IInstructionDecoder decoder)
        {
            // Decode base classes first
            base.Decode(ctx, decoder);

            throw new NotImplementedException();
        }
开发者ID:tgiphil,项目名称:MOSA-Project,代码行数:12,代码来源:ArglistInstruction.cs

示例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.");
     }
 }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:32,代码来源:BinaryBranchInstruction.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(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);
        }
开发者ID:pacificIT,项目名称:MOSA-Project,代码行数:13,代码来源:RefanytypeInstruction.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(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);
        }
开发者ID:yonglehou,项目名称:MOSA-Project,代码行数:13,代码来源:LocalallocInstruction.cs

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

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

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

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

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

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

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

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

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


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