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

C# ConditionCode类代码示例

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

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



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

示例1: RewriteBcc

 private void RewriteBcc(ConditionCode cc, FlagM flags)
 {
     emitter.Branch(
         emitter.Test(cc, orw.FlagGroup(flags)),
         ((M68kAddressOperand) di.op1).Address,
         RtlClass.ConditionalTransfer);
 }
开发者ID:killbug2004,项目名称:reko,代码行数:7,代码来源:Rewriter.Control.cs


示例2: GetConditionCode

        public static byte GetConditionCode(ConditionCode condition)
        {
            switch (condition)
            {
                case ConditionCode.Always: return Bits.b1110;
                case ConditionCode.Never: return Bits.b1111;
                case ConditionCode.Equal: return Bits.b0000;
                case ConditionCode.GreaterOrEqual: return Bits.b1010;
                case ConditionCode.GreaterThan: return Bits.b1100;
                case ConditionCode.LessOrEqual: return Bits.b1101;
                case ConditionCode.LessThan: return Bits.b1011;
                case ConditionCode.NotEqual: return Bits.b0001;
                case ConditionCode.UnsignedGreaterOrEqual: return Bits.b0010;
                case ConditionCode.UnsignedGreaterThan: return Bits.b1000;
                case ConditionCode.UnsignedLessOrEqual: return Bits.b1001;
                case ConditionCode.UnsignedLessThan: return Bits.b0011;
                case ConditionCode.NotSigned: return Bits.b0000;
                case ConditionCode.Signed: return Bits.b0000;
                case ConditionCode.Zero: return Bits.b0101;
                case ConditionCode.Overflow: return Bits.b0110;
                case ConditionCode.NoOverflow: return Bits.b0111;
                case ConditionCode.Positive: return Bits.b0101;

                default: throw new NotSupportedException();
            }
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:26,代码来源:MachineCodeEmitter.cs


示例3: RewriteBxx

 private void RewriteBxx(Pdp11Instruction instr, ConditionCode cc, FlagM flags)
 {
     this.rtlCluster.Class = RtlClass.Transfer;
     m.Branch(
         m.Test(cc, frame.EnsureFlagGroup(arch.GetFlagGroup((uint)flags))),
         ((AddressOperand)instr.op1).Address,
         RtlClass.ConditionalTransfer);
 }
开发者ID:uxmal,项目名称:reko,代码行数:8,代码来源:Pdp11Rewriter.Control.cs


示例4: Branch

 public void Branch(ConditionCode condition, int immediate, bool is16Bit = false)
 {
     Emit(new BranchInstruction(is16Bit)
     {
         Condition = condition,
         Immediate = immediate,
     });
 }
开发者ID:rfw,项目名称:satori,代码行数:8,代码来源:Assembler.cs


示例5: Move

 public void Move(ConditionCode condition, int rd, int rn, bool is16Bit = false)
 {
     Emit(new MoveInstruction(is16Bit)
     {
         Condition = condition,
         SourceRegister = rn,
         DestinationRegister = rd,
     });
 }
开发者ID:rfw,项目名称:satori,代码行数:9,代码来源:Assembler.cs


示例6: EmitBranch

        public void EmitBranch(ConditionCode conditionCode, int register)
        {
            Debug.Assert(register <= 0xF);

            uint value = 0;

            value |= (uint)(GetConditionCode(conditionCode) << 28);
            value |= (uint)0x12FFF10;
            value |= (uint)register;

            Write(value);
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:12,代码来源:MachineCodeEmitter.cs


示例7: RewriteDbcc

        private void RewriteDbcc(ConditionCode cc, FlagM flags)
        {
            if (cc != ConditionCode.None)
            {
                emitter.Branch(
                    emitter.Test(cc, orw.FlagGroup(flags)),
                    di.Address + 4,
                    RtlClass.ConditionalTransfer);
            }
            var src = orw.RewriteSrc(di.op1, di.Address);

            emitter.Assign(src, emitter.ISub(src, 1));
            emitter.Branch(
                emitter.Ne(src, emitter.Int32(-1)),
                (Address) orw.RewriteSrc(di.op2, di.Address, true),
                RtlClass.ConditionalTransfer);
        }
开发者ID:killbug2004,项目名称:reko,代码行数:17,代码来源:Rewriter.Control.cs


示例8: Negate

 public static ConditionCode Negate(ConditionCode cc)
 {
     switch (cc)
     {
     case ConditionCode.UGT: return ConditionCode.ULE;
     case ConditionCode.ULE: return ConditionCode.UGT;
     case ConditionCode.ULT: return ConditionCode.UGE;
     case ConditionCode.GT:  return ConditionCode.LE;
     case ConditionCode.GE:  return ConditionCode.LT;
     case ConditionCode.LT:  return ConditionCode.GE;
     case ConditionCode.LE:  return ConditionCode.GT;
     case ConditionCode.UGE: return ConditionCode.ULT;
     case ConditionCode.NE:  return ConditionCode.EQ;
     case ConditionCode.EQ:  return ConditionCode.NE;
     case ConditionCode.SG:  return ConditionCode.GE;
     case ConditionCode.NS:  return ConditionCode.LT;
     default: throw new ArgumentException(string.Format("Don't know how to negate ConditionCode.{0}.",  cc), "cc");
     }
 }
开发者ID:nemerle,项目名称:reko,代码行数:19,代码来源:ConditionCodeEliminator.cs


示例9: RewriteBranch

 private void RewriteBranch(bool updateLinkregister, bool toLinkRegister, ConditionCode cc)
 {
     cluster.Class = RtlClass.ConditionalTransfer;
     var ccrOp = instr.op1 as RegisterOperand;
     Expression cr;
     if (ccrOp != null)
     {
         cr = RewriteOperand(instr.op1);
     }
     else 
     {
         cr = frame.EnsureRegister(arch.CrRegisters[0]);
     }
     if (toLinkRegister)
     {
         var dst = frame.EnsureRegister(arch.lr);
         if (updateLinkregister)
         {
             emitter.If(emitter.Test(cc, cr), new RtlCall(dst, 0, RtlClass.ConditionalTransfer));
         }
         else
         {
             emitter.If(emitter.Test(cc, cr), new RtlReturn(0, 0, RtlClass.Transfer));
         }
     }
     else
     {
         var dst = RewriteOperand(ccrOp != null ? instr.op2 : instr.op1);
         if (updateLinkregister)
         {
             emitter.If(emitter.Test(cc, cr), new RtlCall(dst, 0, RtlClass.ConditionalTransfer));
         }
         else
         {
             emitter.Branch(emitter.Test(cc, cr), (Address)dst, RtlClass.ConditionalTransfer);
         }
     }
 }
开发者ID:uxmal,项目名称:reko,代码行数:38,代码来源:PowerPcRewriter.Control.cs


示例10: AppendInstruction

 /// <summary>
 /// Appends the instruction.
 /// </summary>
 /// <param name="instruction">The instruction.</param>
 /// <param name="result">The result.</param>
 /// <param name="operand1">The operand1.</param>
 /// <param name="operand2">The operand2.</param>
 public void AppendInstruction(BaseInstruction instruction, ConditionCode condition, Operand result, Operand operand1, Operand operand2)
 {
     AppendInstruction();
     Node.SetInstruction(instruction, condition, result, operand1, operand2);
 }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:12,代码来源:Context.cs


示例11: RewriteConditionalGoto

 private void RewriteConditionalGoto(ConditionCode cc, MachineOperand op1)
 {
     emitter.Branch(CreateTestCondition(cc, instrCur.code), OperandAsCodeAddress(op1), RtlClass.ConditionalTransfer);
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:4,代码来源:X86Rewriter.Control.cs


示例12: SetInstruction

 /// <summary>
 /// Sets the instruction.
 /// </summary>
 /// <param name="instruction">The instruction.</param>
 /// <param name="condition">The condition.</param>
 /// <param name="updateStatus">if set to <c>true</c> [update status].</param>
 /// <param name="result">The result.</param>
 /// <param name="operand1">The operand1.</param>
 /// <param name="operand2">The operand2.</param>
 public void SetInstruction(BaseInstruction instruction, ConditionCode condition, bool updateStatus, Operand result, Operand operand1, Operand operand2)
 {
     Node.SetInstruction(instruction, condition, updateStatus, result, operand1, operand2);
 }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:13,代码来源:Context.cs


示例13: EmitInstructionWithRegister

        public void EmitInstructionWithRegister(ConditionCode conditionCode, byte opcode, bool setCondition, int firstRegister, int destinationRegister, ShiftType secondShiftType, int secondRegister)
        {
            Debug.Assert(opcode <= 0xF);
            Debug.Assert(destinationRegister <= 0xF);
            Debug.Assert(firstRegister <= 0xF);
            Debug.Assert(secondRegister <= 0xF);

            uint value = 0;

            value |= (uint)(GetConditionCode(conditionCode) << 28);
            value |= (uint)(0x0 << 25);
            value |= (uint)(opcode << 21);
            value |= (uint)(setCondition ? 1 : 0 << 20);
            value |= (uint)(firstRegister << 16);
            value |= (uint)(destinationRegister << 12);
            value |= (uint)(GetShiftTypeCode(secondShiftType) << 4);
            value |= (uint)secondRegister;

            Write(value);
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:20,代码来源:MachineCodeEmitter.cs


示例14: EmitInstructionWithImmediate

        public void EmitInstructionWithImmediate(ConditionCode conditionCode, byte opcode, bool setCondition, int firstRegister, int destinationRegister, int rotate, int immediate)
        {
            Debug.Assert(opcode <= 0xF);
            Debug.Assert(destinationRegister <= 0xF);
            Debug.Assert(firstRegister <= 0xF);
            Debug.Assert(rotate <= 0xF);
            Debug.Assert(immediate <= 0xFF);

            uint value = 0;

            value |= (uint)(GetConditionCode(conditionCode) << 28);
            value |= (uint)(0x1 << 25);
            value |= (uint)(opcode << 21);
            value |= (uint)(setCondition ? 1 : 0 << 20);
            value |= (uint)(firstRegister << 16);
            value |= (uint)(destinationRegister << 12);
            value |= (uint)(rotate << 8);
            value |= (uint)immediate;

            Write(value);
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:21,代码来源:MachineCodeEmitter.cs


示例15: EmitMultiplyWithAccumulate

        public void EmitMultiplyWithAccumulate(ConditionCode conditionCode, bool setCondition, int firstRegister, int destinationRegister, int secondRegister, int accumulateRegister)
        {
            Debug.Assert(destinationRegister <= 0xF);
            Debug.Assert(secondRegister <= 0xF);
            Debug.Assert(firstRegister <= 0xF);

            uint value = 0;

            value |= (uint)(GetConditionCode(conditionCode) << 28);
            value |= (uint)(1 << 21);
            value |= (uint)(setCondition ? 1 : 0 << 20);
            value |= (uint)(destinationRegister << 16);
            value |= (uint)(firstRegister << 12);
            value |= (uint)(secondRegister << 8);
            value |= (uint)(Bits.b1001 << 4);
            value |= (uint)accumulateRegister;

            Write(value);
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:19,代码来源:MachineCodeEmitter.cs


示例16: EmitSingleDataTransfer

        public void EmitSingleDataTransfer(ConditionCode conditionCode, Indexing indexing, OffsetDirection offsetDirection, TransferSize transferSize, WriteBack writeBack, TransferType transferType, int firstRegister, int destinationRegister, ShiftType secondShiftType, int secondRegister)
        {
            Debug.Assert(destinationRegister <= 0xF);
            Debug.Assert(firstRegister <= 0xF);
            Debug.Assert(secondRegister <= 0xF);

            uint value = 0;

            value |= (uint)(GetConditionCode(conditionCode) << 28);
            value |= (uint)(1 << 26);
            value |= (uint)(1 << 25);
            value |= (uint)((indexing == Indexing.Post ? 0 : 1) << 24);
            value |= (uint)((transferSize == TransferSize.Word ? 0 : 1) << 23);
            value |= (uint)((offsetDirection == OffsetDirection.Down ? 0 : 1) << 22);
            value |= (uint)((writeBack == WriteBack.NoWriteBack ? 0 : 1) << 21);
            value |= (uint)((transferType == TransferType.Store ? 0 : 1) << 20);
            value |= (uint)(destinationRegister << 12);
            value |= (uint)(firstRegister << 16);
            value |= (uint)(GetShiftTypeCode(secondShiftType) << 4);
            value |= (uint)secondRegister;

            Write(value);
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:23,代码来源:MachineCodeEmitter.cs


示例17: Compare

        private static bool? Compare(VariableState operand1, VariableState operand2, ConditionCode conditionCode)
        {
            switch (conditionCode)
            {
                case ConditionCode.Equal: return operand1.ConstantUnsignedLongInteger == operand2.ConstantUnsignedLongInteger;
                case ConditionCode.NotEqual: return operand1.ConstantUnsignedLongInteger != operand2.ConstantUnsignedLongInteger;
                case ConditionCode.GreaterOrEqual: return operand1.ConstantUnsignedLongInteger >= operand2.ConstantUnsignedLongInteger;
                case ConditionCode.GreaterThan: return operand1.ConstantUnsignedLongInteger > operand2.ConstantUnsignedLongInteger;
                case ConditionCode.LessOrEqual: return operand1.ConstantUnsignedLongInteger <= operand2.ConstantUnsignedLongInteger;
                case ConditionCode.LessThan: return operand1.ConstantUnsignedLongInteger < operand2.ConstantUnsignedLongInteger;

                case ConditionCode.Always: return true;
                case ConditionCode.Never: return false;

                // unknown integer comparison
                default: return null;
            }
        }
开发者ID:pacificIT,项目名称:MOSA-Project,代码行数:18,代码来源:SparseConditionalConstantPropagation.cs


示例18: CreateTestCondition

 private Expression CreateTestCondition(ConditionCode cc, Opcode opcode)
 {
     var grf = orw.FlagGroup(IntelInstruction.UseCc(opcode));
     var tc = new TestCondition(cc, grf);
     return tc;
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:6,代码来源:X86Rewriter.Control.cs


示例19: RewriteLoop

 private void RewriteLoop(FlagM useFlags, ConditionCode cc)
 {
     Identifier cx = orw.AluRegister(Registers.ecx, instrCur.dataWidth);
     emitter.Assign(cx, emitter.ISub(cx, 1));
     if (useFlags != 0)
     {
         emitter.Branch(
             new BinaryExpression(Operator.Cand, PrimitiveType.Bool,
                 new TestCondition(cc, orw.FlagGroup(useFlags)),
                 emitter.Ne0(cx)),
             OperandAsCodeAddress(instrCur.op1),
             RtlClass.ConditionalTransfer);
     }
     else
     {
         emitter.Branch(emitter.Ne0(cx), OperandAsCodeAddress(instrCur.op1), RtlClass.ConditionalTransfer);
     }
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:18,代码来源:X86Rewriter.Control.cs


示例20: BranchCc

 public void BranchCc(ConditionCode cc, string label)
 {
     Identifier f;
     switch (cc)
     {
     case ConditionCode.EQ:
     case ConditionCode.NE: f = Flags("Z"); break;
     default: throw new ArgumentOutOfRangeException("Condition code: " + cc);
     }
     branchBlock = BlockOf(label);
     Emit(new Branch(new TestCondition(cc, f), branchBlock));
     TerminateBlock();
 }
开发者ID:killbug2004,项目名称:reko,代码行数:13,代码来源:ProcedureBuilder.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ConditionType类代码示例发布时间:2022-05-24
下一篇:
C# Condition类代码示例发布时间: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