• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# InstructionNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中InstructionNode的典型用法代码示例。如果您正苦于以下问题:C# InstructionNode类的具体用法?C# InstructionNode怎么用?C# InstructionNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InstructionNode类属于命名空间,在下文中一共展示了InstructionNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: CheckAssignmentForCompliance

        private static bool CheckAssignmentForCompliance(InstructionNode allocation, InstructionNode assignment)
        {
            // Only direct assignment without any casts is compliant. We can't perform casts or anything alike here,
            // as that is hard to complete at this point of time.

            var allocationType = (allocation.InvokeMethod != null) ? allocation.InvokeMethod.DeclaringType : allocation.Result.Type.ElementType;
            var storageType = (allocation.Instruction is CIL.NewarrInstruction) ? assignment.Operand1.Type.ElementType : assignment.MosaField.DeclaringType;

            return ReferenceEquals(allocationType, storageType);
        }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:10,代码来源:StaticAllocationResolutionStage.cs


示例17: 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

            Operand local = decoder.Compiler.GetLocalOperand((int)decoder.Instruction.Operand);
            ctx.Operand1 = local;
            ctx.Result = decoder.Compiler.CreateVirtualRegister(local.Type.ToManagedPointer());
        }
开发者ID:yonglehou,项目名称:MOSA-Project,代码行数:16,代码来源:LdlocaInstruction.cs


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

            MosaType type = (elementType == null)
                ? type = (MosaType)decoder.Instruction.Operand
                : type = decoder.TypeSystem.GetTypeFromTypeCode(elementType.Value);

            ctx.Result = LoadInstruction.CreateResultOperand(decoder, type);
        }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:16,代码来源:LdelemInstruction.cs


示例19: 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 field = (MosaField)decoder.Instruction.Operand;

            decoder.Compiler.Scheduler.TrackFieldReferenced(field);

            ctx.MosaField = field;
        }
开发者ID:pacificIT,项目名称:MOSA-Project,代码行数:16,代码来源:StfldInstruction.cs


示例20: 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)
        {
            base.Decode(ctx, decoder);

            var field = (MosaField)decoder.Instruction.Operand;

            decoder.Compiler.Scheduler.TrackFieldReferenced(field);

            ctx.MosaField = field;
            ctx.Result = LoadInstruction.CreateResultOperand(decoder, field.FieldType.ToManagedPointer());
        }
开发者ID:yonglehou,项目名称:MOSA-Project,代码行数:16,代码来源:LdfldaInstruction.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# InstructionsForm类代码示例发布时间:2022-05-24
下一篇:
C# InstructionBlock类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap