public override void Visit(IModulus modulus) { if (Process(modulus)) { visitor.Visit(modulus); } base.Visit(modulus); }
private HLLocation ProcessModulusExpression(IModulus pExpression) { HLLocation locationLeftOperand = ProcessExpression(pExpression.LeftOperand); HLLocation locationRightOperand = ProcessExpression(pExpression.RightOperand); HLLocation locationTemporary = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type))); mCurrentBlock.EmitModulus(locationTemporary, locationLeftOperand, locationRightOperand); return(pExpression.ResultIsUnmodifiedLeftOperand ? locationLeftOperand : locationTemporary); }
/// <summary> /// Traverses the children of the modulus expression. /// </summary> public virtual void TraverseChildren(IModulus modulus) { Contract.Requires(modulus != null); this.TraverseChildren((IBinaryOperation)modulus); }
/// <summary> /// Performs some computation with the given modulus expression. /// </summary> /// <param name="modulus"></param> public virtual void Visit(IModulus modulus) { }
public override void TraverseChildren(IModulus modulus) { MethodEnter(modulus); base.TraverseChildren(modulus); MethodExit(); }
public override IExpression Rewrite(IModulus operation) { return(ReplaceOperation(operation)); }
public override void TraverseChildren(IModulus modulus) { var targetExpression = modulus.LeftOperand as ITargetExpression; if (targetExpression != null) { // x %= e bool statement = this.currentExpressionIsOpAssignStatement; this.currentExpressionIsOpAssignStatement = false; this.VisitAssignment(targetExpression, modulus, (IExpression e) => this.TraverseModulusRightOperandAndDoOperation(e), treatAsStatement: statement, pushTargetRValue: true, resultIsInitialTargetRValue: modulus.ResultIsUnmodifiedLeftOperand); } else { // x % e this.Traverse(modulus.LeftOperand); this.TraverseModulusRightOperandAndDoOperation(modulus); } }
/// <summary> /// Visits the specified modulus. /// </summary> /// <param name="modulus">The modulus.</param> public override void Visit(IModulus modulus) { Modulus mutableModulus = modulus as Modulus; if (alwaysMakeACopy || mutableModulus == null) mutableModulus = new Modulus(modulus); this.resultExpression = this.myCodeMutator.Visit(mutableModulus); }
/// <summary> /// /// </summary> /// <param name="modulus"></param> public Modulus(IModulus modulus) : base(modulus) { }
/// <summary> /// Generates IL for the specified modulus. /// </summary> /// <param name="modulus">The modulus.</param> public override void TraverseChildren(IModulus modulus) { this.Traverse(modulus.LeftOperand); this.Traverse(modulus.RightOperand); if (modulus.TreatOperandsAsUnsignedIntegers) this.generator.Emit(OperationCode.Rem_Un); else this.generator.Emit(OperationCode.Rem); this.StackSize--; }
public override void Visit(IModulus modulus) { if(Process(modulus)){visitor.Visit(modulus);} base.Visit(modulus); }
private HLLocation ProcessModulusExpression(IModulus pExpression) { HLLocation locationLeftOperand = ProcessExpression(pExpression.LeftOperand); HLLocation locationRightOperand = ProcessExpression(pExpression.RightOperand); HLLocation locationTemporary = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type))); mCurrentBlock.EmitModulus(locationTemporary, locationLeftOperand, locationRightOperand); return pExpression.ResultIsUnmodifiedLeftOperand ? locationLeftOperand : locationTemporary; }
public void Visit(IModulus modulus) { this.result = this.rewriter.Rewrite(modulus); }
/// <summary> /// Rewrites the given modulus expression. /// </summary> /// <param name="modulus"></param> public virtual IExpression Rewrite(IModulus modulus) { var mutableModulus = modulus as Modulus; if (mutableModulus == null) return modulus; this.RewriteChildren(mutableModulus); return mutableModulus; }
/// <summary> /// Performs some computation with the given modulus expression. /// </summary> /// <param name="modulus"></param> public virtual void Visit(IModulus modulus) { this.Visit((IBinaryOperation)modulus); }
public void Visit(IModulus modulus) { throw new NotImplementedException(); }
public override void TraverseChildren(IModulus modulus) { base.TraverseChildren(modulus); ((Modulus)modulus).Type = this.GetBinaryNumericOperationType(modulus, modulus.TreatOperandsAsUnsignedIntegers); }
public virtual void onASTElement(IModulus modulus) { }
/// <summary> /// /// </summary> /// <param name="modulus"></param> public Modulus(IModulus modulus) : base(modulus) { this.TreatOperandsAsUnsignedIntegers = modulus.TreatOperandsAsUnsignedIntegers; }
public void Visit(IModulus modulus) { this.result = this.copier.Copy(modulus); }
public override void Visit(IModulus modulus) { allElements.Add(new InvokInfo(Traverser, "IModulus", modulus)); }
/// <summary> /// Rewrites the given modulus expression. /// </summary> /// <param name="modulus"></param> public virtual IExpression Rewrite(IModulus modulus) { return modulus; }
public override void Visit(IModulus operation) { ProcessOperation(operation); }
//^ ensures this.path.Count == old(this.path.Count); /// <summary> /// Traverses the given modulus expression. /// </summary> /// <param name="modulus"></param> public virtual void Visit(IModulus modulus) { if (this.stopTraversal) return; //^ int oldCount = this.path.Count; this.path.Push(modulus); this.Visit(modulus.LeftOperand); this.Visit(modulus.RightOperand); //^ assume this.path.Count == oldCount+1; //True because all of the virtual methods of this class promise not to decrease this.path.Count. this.path.Pop(); }
/// <summary> /// Returns a shallow copy of the given modulus expression. /// </summary> /// <param name="modulus"></param> public Modulus Copy(IModulus modulus) { Contract.Requires(modulus != null); Contract.Ensures(Contract.Result<Modulus>() != null); return new Modulus(modulus); }
/// <summary> /// Traverses the modulus expression. /// </summary> public void Traverse(IModulus modulus) { Contract.Requires(modulus != null); if (this.preorderVisitor != null) this.preorderVisitor.Visit(modulus); if (this.StopTraversal) return; this.TraverseChildren(modulus); if (this.StopTraversal) return; if (this.postorderVisitor != null) this.postorderVisitor.Visit(modulus); }
/// <summary> /// Returns a deep copy of the given modulus expression. /// </summary> /// <param name="modulus"></param> public Modulus Copy(IModulus modulus) { Contract.Requires(modulus != null); Contract.Ensures(Contract.Result<Modulus>() != null); var mutableCopy = this.shallowCopier.Copy(modulus); this.CopyChildren((BinaryOperation)mutableCopy); return mutableCopy; }
public void Visit(IModulus modulus) { this.traverser.Traverse(modulus); }
public void Visit(IModulus modulus) { Contract.Requires(modulus != null); throw new NotImplementedException(); }
/// <summary> /// Visits the specified modulus. /// </summary> /// <param name="modulus">The modulus.</param> public override void Visit(IModulus modulus) { Modulus mutableModulus = new Modulus(modulus); this.resultExpression = this.myCodeCopier.DeepCopy(mutableModulus); }
public override void Visit(IModulus modulus) { base.Visit(modulus); Bpl.Expr rexp = TranslatedExpressions.Pop(); Bpl.Expr lexp = TranslatedExpressions.Pop(); TranslatedExpressions.Push(Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Mod, lexp, rexp)); }
/// <summary> /// Returns a deep copy of the given modulus expression. /// </summary> /// <param name="modulus"></param> public Modulus Copy(IModulus modulus) { var mutableCopy = this.shallowCopier.Copy(modulus); this.CopyChildren((BinaryOperation)mutableCopy); return mutableCopy; }
public override void TraverseChildren(IModulus modulus) { var needsParen = LowerPrecedenceThanParentExpression(modulus); var savedCurrentPrecedence = this.currentPrecedence; this.currentPrecedence = this.Precedence(modulus); if (needsParen) this.sourceEmitterOutput.Write("("); this.Traverse(modulus.LeftOperand); if (modulus.LeftOperand is ITargetExpression) this.sourceEmitterOutput.Write(" %= "); else this.sourceEmitterOutput.Write(" % "); this.Traverse(modulus.RightOperand); if (needsParen) this.sourceEmitterOutput.Write(")"); this.currentPrecedence = savedCurrentPrecedence; }
/// <summary> /// Returns a shallow copy of the given modulus expression. /// </summary> /// <param name="modulus"></param> public Modulus Copy(IModulus modulus) { return new Modulus(modulus); }
/// <summary> /// Visits the specified modulus. /// </summary> /// <param name="modulus">The modulus.</param> public override void Visit(IModulus modulus) { Modulus mutableModulus = modulus as Modulus; if (mutableModulus == null) { this.resultExpression = modulus; return; } this.resultExpression = this.myCodeMutator.Visit(mutableModulus); }