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


C# CGenState.MOVZBL方法代码示例

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


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

示例1: CGenValue

        public override Reg CGenValue(CGenState state) {
            Reg ret = this.Expr.CGenValue(state);
            switch (this.Kind) {
                case TypeCastType.DOUBLE_TO_FLOAT:
                case TypeCastType.FLOAT_TO_DOUBLE:
                case TypeCastType.PRESERVE_INT16:
                case TypeCastType.PRESERVE_INT8:
                case TypeCastType.NOP:
                    return ret;

                case TypeCastType.DOUBLE_TO_INT32:
                case TypeCastType.FLOAT_TO_INT32:
                    state.CGenConvertFloatToLong();
                    return Reg.EAX;

                case TypeCastType.INT32_TO_DOUBLE:
                case TypeCastType.INT32_TO_FLOAT:
                    state.CGenConvertLongToFloat();
                    return Reg.ST0;

                case TypeCastType.INT16_TO_INT32:
                    state.MOVSWL(Reg.AX, Reg.EAX);
                    return ret;

                case TypeCastType.INT8_TO_INT16:
                case TypeCastType.INT8_TO_INT32:
                    state.MOVSBL(Reg.AL, Reg.EAX);
                    return ret;

                case TypeCastType.UINT16_TO_UINT32:
                    state.MOVZWL(Reg.AX, Reg.EAX);
                    return ret;

                case TypeCastType.UINT8_TO_UINT16:
                case TypeCastType.UINT8_TO_UINT32:
                    state.MOVZBL(Reg.AL, Reg.EAX);
                    return ret;

                default:
                    throw new InvalidProgramException();
            }
        }
开发者ID:phisiart,项目名称:C-Compiler,代码行数:42,代码来源:TypeCast.cs

示例2: CGenValue

        public override Reg CGenValue(CGenState state) {
            Reg ret = this.Expr.CGenValue(state);
            switch (ret) {
                case Reg.EAX:
                    state.TESTL(Reg.EAX, Reg.EAX);
                    state.SETE(Reg.AL);
                    state.MOVZBL(Reg.AL, Reg.EAX);
                    return Reg.EAX;

                case Reg.ST0:
                    /// Compare Expr with 0.0
                    /// < see cref = "BinaryComparisonOp.OperateFloat(CGenState)" />
                    state.FLDZ();
                    state.FUCOMIP();
                    state.FSTP(Reg.ST0);
                    state.SETE(Reg.AL);
                    state.MOVZBL(Reg.AL, Reg.EAX);
                    return Reg.EAX;

                default:
                    throw new InvalidProgramException();
            }
        }
开发者ID:phisiart,项目名称:C-Compiler,代码行数:23,代码来源:UnaryOperators.cs

示例3: CGenValue

        public override Reg CGenValue(CGenState state) {
            Reg ret = this.Expr.CGenValue(state);
            if (ret != Reg.EAX) {
                throw new InvalidProgramException();
            }
            if (this.Expr.Type.Kind != ExprTypeKind.POINTER) {
                throw new InvalidProgramException();
            }

            ExprType type = ((PointerType)this.Expr.Type).RefType;
            switch (type.Kind) {
                case ExprTypeKind.ARRAY:
                case ExprTypeKind.FUNCTION:
                    return Reg.EAX;

                case ExprTypeKind.CHAR:
                    state.MOVSBL(0, Reg.EAX, Reg.EAX);
                    return Reg.EAX;

                case ExprTypeKind.UCHAR:
                    state.MOVZBL(0, Reg.EAX, Reg.EAX);
                    return Reg.EAX;

                case ExprTypeKind.SHORT:
                    state.MOVSWL(0, Reg.EAX, Reg.EAX);
                    return Reg.EAX;

                case ExprTypeKind.USHORT:
                    state.MOVZWL(0, Reg.EAX, Reg.EAX);
                    return Reg.EAX;

                case ExprTypeKind.LONG:
                case ExprTypeKind.ULONG:
                case ExprTypeKind.POINTER:
                    state.MOVL(0, Reg.EAX, Reg.EAX);
                    return Reg.EAX;

                case ExprTypeKind.FLOAT:
                    state.FLDS(0, Reg.EAX);
                    return Reg.ST0;

                case ExprTypeKind.DOUBLE:
                    state.FLDL(0, Reg.EAX);
                    return Reg.ST0;

                case ExprTypeKind.STRUCT_OR_UNION:
                    //// %esi = src address
                    //state.MOVL(Reg.EAX, Reg.ESI);

                    //// %edi = dst address
                    //state.CGenExpandStackBy(Utils.RoundUp(Type.SizeOf, 4));
                    //state.LEA(0, Reg.ESP, Reg.EDI);

                    //// %ecx = nbytes
                    //state.MOVL(Type.SizeOf, Reg.ECX);

                    //state.CGenMemCpy();

                    //return Reg.STACK;
                    return Reg.EAX;

                case ExprTypeKind.VOID:
                default:
                    throw new InvalidProgramException();
            }
        }
开发者ID:phisiart,项目名称:C-Compiler,代码行数:66,代码来源:Expressions.cs

示例4: OperateDouble

        /// <summary>
        /// Before: %st(0) = left, %st(1) = right, stack unchanged.
        /// After: with SetDouble, %eax = left op right, stack unchanged.
        /// </summary>
        public override sealed void OperateDouble(CGenState state) {
            // In the beginning, %st(0) = Left, %st(1) = Right.
            // 
            // float stack:
            // +-----+
            // | rhs | <- %st(1)
            // +-----+
            // | lhs | <- %st(0)
            // +-----+
            // 

            // 1. Do comparison between %st(0) and %st(1).
            //    Pop one Value from FPU stack.
            // 
            // float stack:
            // +-----+
            // | rhs | <- %st(0)
            // +-----+
            // 
            state.FUCOMIP();

            // 2. Pop another Value from FPU stack.
            // 
            // float stack:
            // +-----+ empty
            // 
            state.FSTP(Reg.ST0);

            // 3. Set bit based on comparison result.
            SetDouble(state);
            state.MOVZBL(Reg.AL, Reg.EAX);
        }
开发者ID:phisiart,项目名称:C-Compiler,代码行数:36,代码来源:BinaryOperators.cs

示例5: OperateULong

 /// <summary>
 /// <para>Before: %eax = left, %ebx = right, stack unchanged.</para>
 /// <para>After: with SetULong, %eax = left op right, stack unchanged.</para>
 /// </summary>
 public override sealed void OperateULong(CGenState state) {
     state.CMPL(Reg.EBX, Reg.EAX);
     SetULong(state);
     state.MOVZBL(Reg.AL, Reg.EAX);
 }
开发者ID:phisiart,项目名称:C-Compiler,代码行数:9,代码来源:BinaryOperators.cs


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