private Expression ParseBinaryOperation(OperationCode currentOpcode) { switch (currentOpcode) { default: Debug.Assert(false); goto case OperationCode.Xor; case OperationCode.Add: case OperationCode.Add_Ovf: case OperationCode.Add_Ovf_Un: return this.ParseAddition(currentOpcode); case OperationCode.And: return this.ParseBinaryOperation(new BitwiseAnd()); case OperationCode.Ceq: return this.ParseBinaryOperation(new Equality()); case OperationCode.Cgt: return this.ParseBinaryOperation(new GreaterThan()); case OperationCode.Cgt_Un: return this.ParseBinaryOperation(new GreaterThan() { IsUnsignedOrUnordered = true }); case OperationCode.Clt: return this.ParseBinaryOperation(new LessThan()); case OperationCode.Clt_Un: return this.ParseBinaryOperation(new LessThan() { IsUnsignedOrUnordered = true }); case OperationCode.Div: return this.ParseBinaryOperation(new Division()); case OperationCode.Div_Un: return this.ParseUnsignedBinaryOperation(new Division() { TreatOperandsAsUnsignedIntegers = true }); case OperationCode.Mul: case OperationCode.Mul_Ovf: case OperationCode.Mul_Ovf_Un: return this.ParseMultiplication(currentOpcode); case OperationCode.Or: return this.ParseBinaryOperation(new BitwiseOr()); case OperationCode.Rem: return this.ParseBinaryOperation(new Modulus()); case OperationCode.Rem_Un: return this.ParseUnsignedBinaryOperation(new Modulus() { TreatOperandsAsUnsignedIntegers = true }); case OperationCode.Shl: return this.ParseBinaryOperation(new LeftShift()); case OperationCode.Shr: return this.ParseBinaryOperation(new RightShift()); case OperationCode.Shr_Un: RightShift shrun = new RightShift(); shrun.RightOperand = this.PopOperandStack(); shrun.LeftOperand = this.PopOperandStackAsUnsigned(); return shrun; case OperationCode.Sub: case OperationCode.Sub_Ovf: case OperationCode.Sub_Ovf_Un: return this.ParseSubtraction(currentOpcode); case OperationCode.Xor: return this.ParseBinaryOperation(new ExclusiveOr()); } }
/// <summary> /// Visits the specified right shift. /// </summary> /// <param name="rightShift">The right shift.</param> public override void Visit(IRightShift rightShift) { RightShift mutableRightShift = new RightShift(rightShift); this.resultExpression = this.myCodeCopier.DeepCopy(mutableRightShift); }
/// <summary> /// Visits the specified right shift. /// </summary> /// <param name="rightShift">The right shift.</param> /// <returns></returns> protected virtual IExpression DeepCopy(RightShift rightShift) { return this.DeepCopy((BinaryOperation)rightShift); }
/// <summary> /// Rewrites the children of the given right shift expression. /// </summary> public virtual void RewriteChildren(RightShift rightShift) { this.RewriteChildren((BinaryOperation)rightShift); }
/// <summary> /// Visits the specified right shift. /// </summary> /// <param name="rightShift">The right shift.</param> public override void Visit(IRightShift rightShift) { RightShift mutableRightShift = rightShift as RightShift; if (alwaysMakeACopy || mutableRightShift == null) mutableRightShift = new RightShift(rightShift); this.resultExpression = this.myCodeMutator.Visit(mutableRightShift); }
/// <summary> /// Visits the specified right shift. /// </summary> /// <param name="rightShift">The right shift.</param> /// <returns></returns> public virtual IExpression Visit(RightShift rightShift) { return this.Visit((BinaryOperation)rightShift); }