本文整理汇总了C#中ConditionCode类的典型用法代码示例。如果您正苦于以下问题:C# ConditionCode类的具体用法?C# ConditionCode怎么用?C# ConditionCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConditionCode类属于命名空间,在下文中一共展示了ConditionCode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RewriteBcc
private void RewriteBcc(ConditionCode cc, FlagM flags)
{
emitter.Branch(
emitter.Test(cc, orw.FlagGroup(flags)),
((M68kAddressOperand) di.op1).Address,
RtlClass.ConditionalTransfer);
}
示例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();
}
}
示例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);
}
示例4: Branch
public void Branch(ConditionCode condition, int immediate, bool is16Bit = false)
{
Emit(new BranchInstruction(is16Bit)
{
Condition = condition,
Immediate = immediate,
});
}
示例5: Move
public void Move(ConditionCode condition, int rd, int rn, bool is16Bit = false)
{
Emit(new MoveInstruction(is16Bit)
{
Condition = condition,
SourceRegister = rn,
DestinationRegister = rd,
});
}
示例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);
}
示例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);
}
示例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");
}
}
示例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);
}
}
}
示例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);
}
示例11: RewriteConditionalGoto
private void RewriteConditionalGoto(ConditionCode cc, MachineOperand op1)
{
emitter.Branch(CreateTestCondition(cc, instrCur.code), OperandAsCodeAddress(op1), RtlClass.ConditionalTransfer);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}