/*-------------------- Constructors ---------------------------------*/ public BranchInstr(BranchOp inst, CILLabel dst) : base((uint)inst) { dest = dst; shortVer = (inst < BranchOp.br) || (inst == BranchOp.leave_s); if (shortVer) size++; else size += 4; }
public static Test FromBranchOp(BranchOp op, bool isUnsigned, TypeRef type) { var style = default(TestOp); switch (op) { case BranchOp.Br: case BranchOp.Leave: throw new InvalidOperationException("branch is unconditional"); case BranchOp.Brtrue: style = TestOp.True; break; case BranchOp.Brfalse: style = TestOp.False; break; case BranchOp.Breq: style = TestOp.Equal; break; case BranchOp.Brne: style = TestOp.NotEqual; break; case BranchOp.BrLt: style = TestOp.LessThan; break; case BranchOp.BrLe: style = TestOp.LessThanOrEqual; break; case BranchOp.BrGt: style = TestOp.GreaterThan; break; case BranchOp.BrGe: style = TestOp.GreaterThanOrEqual; break; default: throw new ArgumentOutOfRangeException(); } return(new Test(style, isUnsigned, type)); }
public virtual void WriteBranchOp(BranchOp s, ExpressionUsage u) { Begin(u); WriteExpression(s.Left, ExpressionUsage.Operand); switch (s.BranchType) { case BranchType.And: Write(And); break; case BranchType.Or: Write(Or); break; default: throw new SourceException(s.Source, "Invalid BranchOpType: " + s.BranchType); } WriteExpression(s.Right, ExpressionUsage.Operand); End(u); }
/// <summary> /// Add a branch instruction /// </summary> /// <param name="inst">the branch instruction</param> /// <param name="lab">the label that is the target of the branch</param> public void Branch(BranchOp inst, CILLabel lab) { AddToBuffer(new BranchInstr((int)inst,lab)); }
/// <summary> /// Add a branch instruction /// </summary> /// <param name="inst">the branch instruction</param> /// <param name="lab">the label that is the target of the branch</param> public void Branch(BranchOp inst, CILLabel lab) { Debug.Assert(lab != null); AddToBuffer(new BranchInstr(inst,lab)); }
/// <summary> /// Add a branch instruction /// </summary> /// <param name="inst">the branch instruction</param> /// <param name="lab">the label that is the target of the branch</param> public void Branch(BranchOp inst, CILLabel lab) { AddToBuffer(new BranchInstr((int)inst, lab)); }
/// <summary> /// Add a branch instruction /// </summary> /// <param name="inst">the branch instruction</param> /// <param name="lab">the label that is the target of the branch</param> public void Branch(BranchOp inst, CILLabel lab) { Contract.Requires(lab != null); AddToBuffer(new BranchInstr(inst, lab)); }