public override void Visit(IModulus modulus)
 {
     if (Process(modulus))
     {
         visitor.Visit(modulus);
     }
     base.Visit(modulus);
 }
Exemple #2
0
        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);
        }
Exemple #3
0
 /// <summary>
 /// Traverses the children of the modulus expression.
 /// </summary>
 public virtual void TraverseChildren(IModulus modulus)
 {
     Contract.Requires(modulus != null);
       this.TraverseChildren((IBinaryOperation)modulus);
 }
Exemple #4
0
 /// <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();   }
Exemple #6
0
 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);
   }
 }
Exemple #8
0
 /// <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);
 }
Exemple #9
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="modulus"></param>
 public Modulus(IModulus modulus)
     : base(modulus)
 {
 }
Exemple #10
0
 /// <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);
 }
Exemple #12
0
 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;
 }
Exemple #13
0
 public void Visit(IModulus modulus)
 {
     this.result = this.rewriter.Rewrite(modulus);
 }
Exemple #14
0
 /// <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;
 }
Exemple #15
0
 /// <summary>
 /// Performs some computation with the given modulus expression.
 /// </summary>
 /// <param name="modulus"></param>
 public virtual void Visit(IModulus modulus)
 {
     this.Visit((IBinaryOperation)modulus);
 }
Exemple #16
0
 public void Visit(IModulus modulus)
 {
     throw new NotImplementedException();
 }
Exemple #17
0
 public override void TraverseChildren(IModulus modulus)
 {
     base.TraverseChildren(modulus);
     ((Modulus)modulus).Type = this.GetBinaryNumericOperationType(modulus, modulus.TreatOperandsAsUnsignedIntegers);
 }
 public virtual void onASTElement(IModulus modulus) { }
Exemple #19
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="modulus"></param>
 public Modulus(IModulus modulus)
   : base(modulus) {
   this.TreatOperandsAsUnsignedIntegers = modulus.TreatOperandsAsUnsignedIntegers;
 }
Exemple #20
0
 public void Visit(IModulus modulus)
 {
     this.result = this.copier.Copy(modulus);
 }
Exemple #21
0
 public override void Visit(IModulus modulus)
 {
     allElements.Add(new InvokInfo(Traverser, "IModulus", modulus));
 }
Exemple #22
0
 public virtual void onASTElement(IModulus modulus)
 {
 }
 /// <summary>
 /// Rewrites the given modulus expression.
 /// </summary>
 /// <param name="modulus"></param>
 public virtual IExpression Rewrite(IModulus modulus)
 {
     return modulus;
 }
Exemple #24
0
 public override void Visit(IModulus operation)
 {
     ProcessOperation(operation);
 }
 public override void TraverseChildren(IModulus modulus) {
   base.TraverseChildren(modulus);
   ((Modulus)modulus).Type = this.GetBinaryNumericOperationType(modulus, modulus.TreatOperandsAsUnsignedIntegers);
 }
Exemple #26
0
 //^ 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();
 }
Exemple #27
0
    /// <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);
    }
Exemple #28
0
 /// <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);
 }
Exemple #29
0
    /// <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;
    }
Exemple #30
0
 public void Visit(IModulus modulus)
 {
     this.traverser.Traverse(modulus);
 }
 /// <summary>
 /// Performs some computation with the given modulus expression.
 /// </summary>
 /// <param name="modulus"></param>
 public virtual void Visit(IModulus modulus)
 {
 }
Exemple #32
0
 public void Visit(IModulus modulus)
 {
     Contract.Requires(modulus != null);
       throw new NotImplementedException();
 }
Exemple #33
0
 /// <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));
 }
Exemple #35
0
 /// <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;
    }
Exemple #37
0
 /// <summary>
 /// Returns a shallow copy of the given modulus expression.
 /// </summary>
 /// <param name="modulus"></param>
 public Modulus Copy(IModulus modulus)
 {
     return new Modulus(modulus);
 }
Exemple #38
0
 public override void TraverseChildren(IModulus modulus)
 {
     MethodEnter(modulus);
     base.TraverseChildren(modulus);
     MethodExit();
 }
Exemple #39
0
 /// <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);
 }