示例#1
0
 /*-------------------- 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;
 }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
文件: Code.cs 项目: REALTOBIZ/mono
		/// <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));
		}
示例#5
0
文件: PERWAPI.cs 项目: nomit007/f4
 /// <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));
 }
示例#6
0
 /// <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));
 }
示例#7
0
 /// <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));
 }