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


C# Operand.ToString方法代码示例

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


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

示例1: SplitLongOperand

        public static void SplitLongOperand(BaseMethodCompiler methodCompiler, Operand operand, out Operand operandLow, out Operand operandHigh, Operand constantZero)
        {
            if (operand.Is64BitInteger)
            {
                methodCompiler.VirtualRegisters.SplitLongOperand(methodCompiler.TypeSystem, operand, 4, 0);
                operandLow = operand.Low;
                operandHigh = operand.High;
                return;
            }
            else
            {
                operandLow = operand;
                operandHigh = constantZero != null ? constantZero : Operand.CreateConstantSignedInt(methodCompiler.TypeSystem, 0);
                return;
            }

            throw new InvalidProgramException("@can not split" + operand.ToString());
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:18,代码来源:LongOperandTransformationStage.cs

示例2: ComputeOpCode

        /// <summary>
        /// Computes the opcode.
        /// </summary>
        /// <param name="destination">The destination operand.</param>
        /// <param name="source">The source operand.</param>
        /// <param name="third">The third operand.</param>
        /// <returns></returns>
        protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third)
        {
            if (destination.Register is SegmentRegister)
            {
                if (source.IsCPURegister) return SEG_RM;

                throw new ArgumentException(@"TODO: No opcode for move destination segment register");
            }

            if (source.Register is SegmentRegister)
            {
                if (destination.IsCPURegister) return RM_SEG;

                throw new ArgumentException(@"TODO: No opcode for move source segment register");
            }

            if (destination.IsCPURegister && source.IsConstant) return RM_C;

            if (destination.IsCPURegister && source.IsSymbol)
                return RM_C;

            if (destination.IsCPURegister && source.IsCPURegister)
            {
                Debug.Assert(!((source.IsByte || destination.IsByte) && (source.Register == GeneralPurposeRegister.ESI || source.Register == GeneralPurposeRegister.EDI)), source.ToString());

                if (source.IsByte || destination.IsByte) return RM_U8;
                if (source.IsChar || destination.IsChar || source.IsShort || destination.IsShort) return R_RM_16;
                return R_RM;
            }

            if (destination.IsSymbol && source.IsCPURegister)
            {
                if (destination.IsByte || destination.IsBoolean) return RM_C_U8;
                if (destination.IsChar || destination.IsShort) return M_C_16;
                return RM_C;
            }

            throw new ArgumentException(@"No opcode for operand type. [" + destination + ", " + source + ")");
        }
开发者ID:tgiphil,项目名称:MOSA-Project,代码行数:46,代码来源:Mov.cs

示例3: ComputeOpCode

        /// <summary>
        /// Computes the opcode.
        /// </summary>
        /// <param name="destination">The destination operand.</param>
        /// <param name="source">The source operand.</param>
        /// <param name="third">The third operand.</param>
        /// <returns></returns>
        protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third)
        {
            if (destination.IsRegister && destination.Register is SegmentRegister) return SR_R;

            if (source.IsRegister && source.Register is SegmentRegister)
                throw new ArgumentException(@"TODO: No opcode for move sourcee segment register");

            if (destination.IsRegister && source.IsConstant) return RM_C;

            if (destination.IsMemoryAddress && source.IsConstant)
            {
                if (destination.IsByte || destination.IsBoolean) return RM_C_U8;
                if (destination.IsChar || destination.IsShort) return M_C_16;
                return RM_C;
            }

            if (destination.IsRegister && source.IsSymbol) return RM_C;

            if (destination.IsMemoryAddress && source.IsSymbol) return RM_C;

            if (destination.IsRegister && source.IsRegister)
            {
                Debug.Assert(!((source.IsByte || destination.IsByte) && (source.Register == GeneralPurposeRegister.ESI || source.Register == GeneralPurposeRegister.EDI)), source.ToString());

                if (source.IsByte || destination.IsByte) return R_M_U8;
                if (source.IsChar || destination.IsChar || source.IsShort || destination.IsShort) return R_RM_16;
                return R_RM;
            }

            if (destination.IsRegister && source.IsMemoryAddress)
            {
                if (destination.IsByte) return R_M_U8;
                if (destination.IsChar || destination.IsShort) return R_RM_16;
                return R_RM;
            }

            if (destination.IsMemoryAddress && source.IsRegister)
            {
                if (destination.IsPointer && !source.IsPointer && destination.Type.ElementType != null)
                {
                    if (destination.Type.ElementType.IsUI1 || destination.Type.ElementType.IsBoolean) return RM_R_U8;
                    if (destination.Type.ElementType.IsChar || destination.Type.ElementType.IsUI2) return M_R_16;
                }
                if (destination.IsByte) return RM_R_U8;
                if (destination.IsChar || destination.IsShort) return M_R_16;
                return M_R;
            }

            if (destination.IsSymbol && source.IsRegister)
            {
                if (destination.IsByte || destination.IsBoolean) return RM_C_U8;
                if (destination.IsChar || destination.IsShort) return M_C_16;
                return RM_C;
            }

            throw new ArgumentException(@"No opcode for operand type. [" + destination + ", " + source + ")");
        }
开发者ID:pacificIT,项目名称:MOSA-Project,代码行数:64,代码来源:Mov.cs


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