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


C# CGenState.ADDL方法代码示例

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


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

示例1: CalcAndSaveByte

 public override void CalcAndSaveByte(CGenState state) {
     state.ADDL(1, Reg.EAX);
     state.MOVB(Reg.AL, 0, Reg.ECX);
 }
开发者ID:phisiart,项目名称:C-Compiler,代码行数:4,代码来源:UnaryOperators.cs

示例2: CalcAndSavePtr

 public override void CalcAndSavePtr(CGenState state) {
     state.ADDL(this.Expr.Type.SizeOf, Reg.EAX);
     state.MOVL(Reg.EAX, 0, Reg.ECX);
 }
开发者ID:phisiart,项目名称:C-Compiler,代码行数:4,代码来源:UnaryOperators.cs

示例3: CalcAndSaveWord

 public override void CalcAndSaveWord(CGenState state) {
     state.ADDL(1, Reg.EAX);
     state.MOVW(Reg.AX, 0, Reg.ECX);
 }
开发者ID:phisiart,项目名称:C-Compiler,代码行数:4,代码来源:UnaryOperators.cs

示例4: CalcAndSaveLong

 public override void CalcAndSaveLong(CGenState state) {
     state.ADDL(1, Reg.EAX);
     state.MOVL(Reg.EAX, 0, Reg.ECX);
 }
开发者ID:phisiart,项目名称:C-Compiler,代码行数:4,代码来源:UnaryOperators.cs

示例5: CGenAddress

        public override void CGenAddress(CGenState state) {
            if (this.Expr.Type.Kind != ExprTypeKind.STRUCT_OR_UNION) {
                throw new InvalidProgramException();
            }

            // %eax = address of struct or union
            this.Expr.CGenAddress(state);

            // offset inside the pack
            Int32 offset = ((StructOrUnionType)this.Expr.Type)
                        .Attribs
                        .First(_ => _.name == this.Name)
                        .offset;

            state.ADDL(offset, Reg.EAX);
        }
开发者ID:phisiart,项目名称:C-Compiler,代码行数:16,代码来源:Expressions.cs

示例6: CGenValue

        public override Reg CGenValue(CGenState state) {

            // %eax is the address of the struct/union
            if (this.Expr.CGenValue(state) != Reg.EAX) {
                throw new InvalidProgramException();
            }

            if (this.Expr.Type.Kind != ExprTypeKind.STRUCT_OR_UNION) {
                throw new InvalidProgramException();
            }

            // size of the struct or union
            Int32 struct_size = this.Expr.Type.SizeOf;

            // offset inside the pack
            Int32 attrib_offset = ((StructOrUnionType)this.Expr.Type)
                        .Attribs
                        .First(_ => _.name == this.Name)
                        .offset;

            // can't be a function designator.
            switch (this.Type.Kind) {
                case ExprTypeKind.ARRAY:
                case ExprTypeKind.STRUCT_OR_UNION:
                    state.ADDL(attrib_offset, Reg.EAX);
                    return Reg.EAX;

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

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

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

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

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

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

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

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

示例7: OperateULong

 public override void OperateULong(CGenState state) {
     state.ADDL(Reg.EBX, Reg.EAX);
 }
开发者ID:phisiart,项目名称:C-Compiler,代码行数:3,代码来源:BinaryOperators.cs


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