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


C# Context.SetInstruction2方法代码示例

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


在下文中一共展示了Context.SetInstruction2方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1:

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, BaseMethodCompiler methodCompiler)
        {
            Operand n = context.Operand1;
            Operand d = context.Operand2;
            Operand result = context.Result;
            Operand result2 = methodCompiler.CreateVirtualRegister(methodCompiler.TypeSystem.BuiltIn.U4);

            Operand op0L, op0H;

            LongOperandTransformationStage.SplitLongOperand(methodCompiler, n, out op0L, out op0H);

            context.SetInstruction2(X86.Div, result2, result, op0H, op0L, d);
        }
开发者ID:tgiphil,项目名称:MOSA-Project,代码行数:18,代码来源:Div.cs

示例2:

		/// <summary>
		/// Replaces the intrinsic call site
		/// </summary>
		/// <param name="context">The context.</param>
		/// <param name="typeSystem">The type system.</param>
		void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, BaseMethodCompiler methodCompiler)
		{
			// xchg	bx, bx
			var bx = Operand.CreateCPURegister(methodCompiler.TypeSystem.BuiltIn.U2, GeneralPurposeRegister.EBX);
			context.SetInstruction2(X86.Xchg, bx, bx, bx, bx);
		}
开发者ID:yonglehou,项目名称:MOSA-Project,代码行数:11,代码来源:BochsDebug.cs

示例3:

        /// <summary>
        /// Visitation function for <see cref="IX86Visitor.Setcc"/> instructions.
        /// </summary>
        /// <param name="context">The context.</param>
        void IX86Visitor.Setcc(Context context)
        {
            Debug.Assert(context.Result.IsCPURegister);

            // SETcc can not use ESI or EDI registers
            if (context.Result.IsCPURegister && (context.Result.Register == GeneralPurposeRegister.ESI || context.Result.Register == GeneralPurposeRegister.EDI))
            {
                Operand result = context.Result;
                var condition = context.ConditionCode;

                Operand EAX = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EAX);

                context.SetInstruction2(X86.Xchg, EAX, result, result, EAX);
                context.AppendInstruction(X86.Setcc, condition, EAX);
                context.AppendInstruction2(X86.Xchg, result, EAX, EAX, result);
            }
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:21,代码来源:FinalTweakTransformationStage.cs

示例4: EmitFloatingPointConstants

        /// <summary>
        /// Visitation function for RemSigned.
        /// </summary>
        /// <param name="context">The context.</param>
        void IIRVisitor.RemSigned(Context context)
        {
            EmitFloatingPointConstants(context);

            Operand result = context.Result;
            Operand operand1 = context.Operand1;
            Operand operand2 = context.Operand2;

            Operand v1 = AllocateVirtualRegister(TypeSystem.BuiltIn.I4);
            Operand v2 = AllocateVirtualRegister(TypeSystem.BuiltIn.U4);
            Operand v3 = AllocateVirtualRegister(TypeSystem.BuiltIn.I4);

            // FIXME
            context.SetInstruction2(X86.Cdq, v1, v2, operand1);
            context.AppendInstruction2(X86.IDiv, result, v3, v1, v2, operand2);
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:20,代码来源:IRTransformationStage.cs

示例5: AllocateVirtualRegister

        /// <summary>
        /// Visitation function for MulSigned.
        /// </summary>
        /// <param name="context">The context.</param>
        void IIRVisitor.MulSigned(Context context)
        {
            Operand result = context.Result;
            Operand operand1 = context.Operand1;
            Operand operand2 = context.Operand2;

            Operand v1 = AllocateVirtualRegister(TypeSystem.BuiltIn.U4);
            context.SetInstruction2(X86.Mul, v1, result, operand1, operand2);
        }
开发者ID:yonglehou,项目名称:MOSA-Project,代码行数:13,代码来源:IRTransformationStage.cs

示例6: Mov

        /// <summary>
        /// Visitation function for <see cref="IX86Visitor.Mov"/> instructions.
        /// </summary>
        /// <param name="context">The context.</param>
        public void Mov(Context context)
        {
            if (context.Result.IsCPURegister && context.Operand1.IsCPURegister && context.Result.Register == context.Operand1.Register)
            {
                context.Empty();
                return;
            }

            // Mov can not use ESI or EDI registers with 8 or 16 bit memory or register
            if (context.Operand1.IsCPURegister && (context.Result.IsMemoryAddress || context.Result.IsCPURegister)
                && (context.Result.IsByte || context.Result.IsShort || context.Result.IsChar || context.Result.IsBoolean)
                && (context.Operand1.Register == GeneralPurposeRegister.ESI || context.Operand1.Register == GeneralPurposeRegister.EDI))
            {
                Operand source = context.Operand1;
                Operand dest = context.Result;

                var replace = (dest.IsMemoryAddress && dest.EffectiveOffsetBase == GeneralPurposeRegister.EAX)
                        ? GeneralPurposeRegister.EBX : GeneralPurposeRegister.EAX;

                Operand reg = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, replace);

                context.SetInstruction2(X86.Xchg, reg, source, source, reg);
                context.AppendInstruction(X86.Mov, dest, reg);
                context.AppendInstruction2(X86.Xchg, source, reg, reg, source);
            }
        }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:30,代码来源:FinalTweakTransformationStage.cs

示例7: Mov

        public void Mov(Context context)
        {
            Operand source = context.Operand1;
            Operand result = context.Result;

            Debug.Assert(result.IsCPURegister);

            if (source.IsCPURegister && result.Register == source.Register)
            {
                context.Empty();
                return;
            }

            var size = context.Size;

            // Mov can not use ESI or EDI registers for 8/16bit values
            if (!(size == InstructionSize.Size16 || size == InstructionSize.Size8))
                return;

            if (source.IsCPURegister && (source.Register == GeneralPurposeRegister.ESI || source.Register == GeneralPurposeRegister.EDI))
            {
                Operand eax = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EAX);

                context.SetInstruction2(X86.Xchg, eax, source, source, eax);
                context.AppendInstruction(X86.Mov, result, eax);
                context.AppendInstruction2(X86.Xchg, source, eax, eax, source);
            }
        }
开发者ID:tgiphil,项目名称:MOSA-Project,代码行数:28,代码来源:FinalTweakTransformationStage.cs

示例8: Setcc

        public void Setcc(Context context)
        {
            Debug.Assert(context.Result.IsCPURegister);

            Operand result = context.Result;

            Debug.Assert(result.IsCPURegister);

            // SETcc can not use with ESI or EDI registers
            if (result.Register == GeneralPurposeRegister.ESI || result.Register == GeneralPurposeRegister.EDI)
            {
                var condition = context.ConditionCode;

                Operand eax = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EAX);

                context.SetInstruction2(X86.Xchg, eax, result, result, eax);
                context.AppendInstruction(X86.Setcc, condition, eax);
                context.AppendInstruction2(X86.Xchg, result, eax, eax, result);
            }
        }
开发者ID:tgiphil,项目名称:MOSA-Project,代码行数:20,代码来源:FinalTweakTransformationStage.cs

示例9: MovStore

        public void MovStore(Context context)
        {
            var size = context.Size;

            // Mov can not use ESI or EDI registers for 8/16bit values
            if (!(size == InstructionSize.Size16 || size == InstructionSize.Size8))
                return;

            Operand value = context.Operand3;

            if (value.IsCPURegister && (value.Register == GeneralPurposeRegister.ESI || value.Register == GeneralPurposeRegister.EDI))
            {
                Operand dest = context.Operand1;
                Operand offset = context.Operand2;

                Operand temporaryRegister = null;

                if (dest.Register != GeneralPurposeRegister.EAX && offset.Register != GeneralPurposeRegister.EAX)
                {
                    temporaryRegister = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EAX);
                }
                else if (dest.Register != GeneralPurposeRegister.EBX && offset.Register != GeneralPurposeRegister.EBX)
                {
                    temporaryRegister = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EBX);
                }
                else if (dest.Register != GeneralPurposeRegister.ECX && offset.Register != GeneralPurposeRegister.ECX)
                {
                    temporaryRegister = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.ECX);
                }
                else
                {
                    temporaryRegister = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EDX);
                }

                context.SetInstruction2(X86.Xchg, temporaryRegister, value, value, temporaryRegister);
                context.AppendInstruction(X86.MovStore, size, null, dest, offset, temporaryRegister);
                context.AppendInstruction2(X86.Xchg, value, temporaryRegister, temporaryRegister, value);
            }
        }
开发者ID:tgiphil,项目名称:MOSA-Project,代码行数:39,代码来源:FinalTweakTransformationStage.cs


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