public override void Visit(IGreaterThan greaterThan)
 {
     if (Process(greaterThan))
     {
         visitor.Visit(greaterThan);
     }
     base.Visit(greaterThan);
 }
Esempio n. 2
0
        private HLLocation ProcessGreaterThanExpression(IGreaterThan pExpression)
        {
            HLLocation locationLeftOperand  = ProcessExpression(pExpression.LeftOperand);
            HLLocation locationRightOperand = ProcessExpression(pExpression.RightOperand);
            HLLocation locationTemporary    = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type)));

            mCurrentBlock.EmitCompare(HLCompareType.GreaterThan, locationTemporary, locationLeftOperand, locationRightOperand);
            return(pExpression.ResultIsUnmodifiedLeftOperand ? locationLeftOperand : locationTemporary);
        }
Esempio n. 3
0
        public override IExpression Rewrite(IGreaterThan greaterThan)
        {
            // Catch use of the x > null idiom used by Roslyn as generated
            // code for x != null statements.
            if (ExpressionHelper.IsNullLiteral(greaterThan.RightOperand))
            {
                var c = new NotEquality
                {
                    LeftOperand  = greaterThan.LeftOperand,
                    RightOperand = greaterThan.RightOperand,
                    Type         = greaterThan.Type
                };
                return(c);
            }

            return(base.Rewrite(greaterThan));
        }
Esempio n. 4
0
        public override IExpression Rewrite(IGreaterThan greaterThan)
        {
            var castIfPossible = greaterThan.LeftOperand as ICastIfPossible;

            if (castIfPossible != null)
            {
                var compileTimeConstant = greaterThan.RightOperand as ICompileTimeConstant;
                if (compileTimeConstant != null && compileTimeConstant.Value == null)
                {
                    return(this.Rewrite(new CheckIfInstance()
                    {
                        Operand = castIfPossible.ValueToCast,
                        TypeToCheck = castIfPossible.TargetType,
                        Type = greaterThan.Type,
                    }));
                }
            }
            return(base.Rewrite(greaterThan));
        }
 public override IExpression Rewrite(IGreaterThan greaterThan) {
   var castIfPossible = greaterThan.LeftOperand as ICastIfPossible;
   if (castIfPossible != null) {
     var compileTimeConstant = greaterThan.RightOperand as ICompileTimeConstant;
     if (compileTimeConstant != null && compileTimeConstant.Value == null) {
       return this.Rewrite(new CheckIfInstance() {
         Operand = castIfPossible.ValueToCast,
         TypeToCheck = castIfPossible.TargetType,
         Type = greaterThan.Type,
       });
     }
   }
   return base.Rewrite(greaterThan);
 }
Esempio n. 6
0
 public override IExpression Rewrite(IGreaterThan operation)
 {
     return(ReplaceOperation(operation));
 }
Esempio n. 7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="greaterThan"></param>
 public GreaterThan(IGreaterThan greaterThan)
     : base(greaterThan)
 {
     this.unsignedOrUnordered = greaterThan.IsUnsignedOrUnordered;
 }
Esempio n. 8
0
 /// <summary>
 /// Performs some computation with the given greater-than expression.
 /// </summary>
 /// <param name="greaterThan"></param>
 public virtual void Visit(IGreaterThan greaterThan)
 {
     this.Visit((IBinaryOperation)greaterThan);
 }
Esempio n. 9
0
 public void Visit(IGreaterThan greaterThan)
 {
     throw new NotImplementedException();
 }
    public override void TraverseChildren(IGreaterThan greaterThan)
    {
      base.TraverseChildren(greaterThan);
      Bpl.Expr rexp = TranslatedExpressions.Pop();
      Bpl.Expr lexp = TranslatedExpressions.Pop();

      Bpl.Expr e;
      switch (greaterThan.LeftOperand.Type.TypeCode) {
        case PrimitiveTypeCode.Float32:
        case PrimitiveTypeCode.Float64:
          e = new Bpl.NAryExpr(
            greaterThan.Token(),
            new Bpl.FunctionCall(this.sink.Heap.RealGreaterThan),
            new List<Bpl.Expr>(new Bpl.Expr[] {lexp, rexp})
            );
          break;
        default:
          e = Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Gt, lexp, rexp);
          break;
      }

      TranslatedExpressions.Push(e);
    }
Esempio n. 11
0
 private HLLocation ProcessGreaterThanExpression(IGreaterThan pExpression)
 {
     HLLocation locationLeftOperand = ProcessExpression(pExpression.LeftOperand);
     HLLocation locationRightOperand = ProcessExpression(pExpression.RightOperand);
     HLLocation locationTemporary = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type)));
     mCurrentBlock.EmitCompare(HLCompareType.GreaterThan, locationTemporary, locationLeftOperand, locationRightOperand);
     return pExpression.ResultIsUnmodifiedLeftOperand ? locationLeftOperand : locationTemporary;
 }
 /// <summary>
 /// Rewrites the given greater-than expression.
 /// </summary>
 /// <param name="greaterThan"></param>
 public virtual IExpression Rewrite(IGreaterThan greaterThan)
 {
     return greaterThan;
 }
        public override void TraverseChildren(IGreaterThan greaterThan)
{ MethodEnter(greaterThan);
            base.TraverseChildren(greaterThan);
     MethodExit();   }
Esempio n. 14
0
 public override void TraverseChildren(IGreaterThan greaterThan)
 {
     base.TraverseChildren(greaterThan);
     ((GreaterThan)greaterThan).Type = this.platformType.SystemBoolean;
 }
Esempio n. 15
0
 public override void Visit(IGreaterThan greaterThan)
 {
     allElements.Add(new InvokInfo(Traverser, "IGreaterThan", greaterThan));
 }
Esempio n. 16
0
 /// <summary>
 /// Generates IL for the specified greater than.
 /// </summary>
 /// <param name="greaterThan">The greater than.</param>
 public override void TraverseChildren(IGreaterThan greaterThan)
 {
     this.Traverse(greaterThan.LeftOperand);
       this.Traverse(greaterThan.RightOperand);
       if (greaterThan.IsUnsignedOrUnordered)
     this.generator.Emit(OperationCode.Cgt_Un);
       else
     this.generator.Emit(OperationCode.Cgt);
       this.StackSize--;
 }
 public override void Visit(IGreaterThan greaterThan)
 {
     if(Process(greaterThan)){visitor.Visit(greaterThan);}
     base.Visit(greaterThan);
 }
Esempio n. 18
0
 /// <summary>
 /// Rewrites the given greater-than expression.
 /// </summary>
 /// <param name="greaterThan"></param>
 public virtual IExpression Rewrite(IGreaterThan greaterThan)
 {
     var mutableGreaterThan = greaterThan as GreaterThan;
       if (mutableGreaterThan == null) return greaterThan;
       this.RewriteChildren(mutableGreaterThan);
       return mutableGreaterThan;
 }
Esempio n. 19
0
 public virtual void onASTElement(IGreaterThan greaterThan) { }
Esempio n. 20
0
 /// <summary>
 /// Performs some computation with the given greater-than expression.
 /// </summary>
 /// <param name="greaterThan"></param>
 public virtual void Visit(IGreaterThan greaterThan)
 {
 }
Esempio n. 21
0
 /// <summary>
 /// Visits the specified greater than.
 /// </summary>
 /// <param name="greaterThan">The greater than.</param>
 public override void Visit(IGreaterThan greaterThan)
 {
     GreaterThan mutableGreaterThan = greaterThan as GreaterThan;
     if (alwaysMakeACopy || mutableGreaterThan == null) mutableGreaterThan = new GreaterThan(greaterThan);
     this.resultExpression = this.myCodeMutator.Visit(mutableGreaterThan);
 }
Esempio n. 22
0
 /// <summary>
 /// Traverses the children of the greater-than expression.
 /// </summary>
 public virtual void TraverseChildren(IGreaterThan greaterThan)
 {
     Contract.Requires(greaterThan != null);
       this.TraverseChildren((IBinaryOperation)greaterThan);
 }
Esempio n. 23
0
 public virtual void onASTElement(IGreaterThan greaterThan)
 {
 }
Esempio n. 24
0
 public void Visit(IGreaterThan greaterThan)
 {
     this.result = this.rewriter.Rewrite(greaterThan);
 }
Esempio n. 25
0
 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Traverses the given greater-than expression.
 /// </summary>
 /// <param name="greaterThan"></param>
 public virtual void Visit(IGreaterThan greaterThan)
 {
     if (this.stopTraversal) return;
       //^ int oldCount = this.path.Count;
       this.path.Push(greaterThan);
       this.Visit(greaterThan.LeftOperand);
       this.Visit(greaterThan.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();
 }
Esempio n. 26
0
 public override void TraverseChildren(IGreaterThan greaterThan) {
   base.TraverseChildren(greaterThan);
   ((GreaterThan)greaterThan).Type = this.platformType.SystemBoolean;
 }
Esempio n. 27
0
 /// <summary>
 /// Traverses the greater-than expression.
 /// </summary>
 public void Traverse(IGreaterThan greaterThan)
 {
     Contract.Requires(greaterThan != null);
       if (this.preorderVisitor != null) this.preorderVisitor.Visit(greaterThan);
       if (this.StopTraversal) return;
       this.TraverseChildren(greaterThan);
       if (this.StopTraversal) return;
       if (this.postorderVisitor != null) this.postorderVisitor.Visit(greaterThan);
 }
Esempio n. 28
0
    /// <summary>
    /// Returns a deep copy of the given greater-than expression.
    /// </summary>
    /// <param name="greaterThan"></param>
    public GreaterThan Copy(IGreaterThan greaterThan) {
      Contract.Requires(greaterThan != null);
      Contract.Ensures(Contract.Result<GreaterThan>() != null);

      var mutableCopy = this.shallowCopier.Copy(greaterThan);
      this.CopyChildren((BinaryOperation)mutableCopy);
      return mutableCopy;
    }
Esempio n. 29
0
 public void Visit(IGreaterThan greaterThan)
 {
     this.traverser.Traverse(greaterThan);
 }
Esempio n. 30
0
    /// <summary>
    /// Returns a shallow copy of the given greater-than expression.
    /// </summary>
    /// <param name="greaterThan"></param>
    public GreaterThan Copy(IGreaterThan greaterThan) {
      Contract.Requires(greaterThan != null);
      Contract.Ensures(Contract.Result<GreaterThan>() != null);

      return new GreaterThan(greaterThan);
    }
Esempio n. 31
0
 public void Visit(IGreaterThan greaterThan)
 {
     Contract.Requires(greaterThan != null);
       throw new NotImplementedException();
 }
 /// <summary>
 /// Performs some computation with the given greater-than expression.
 /// </summary>
 /// <param name="greaterThan"></param>
 public virtual void Visit(IGreaterThan greaterThan)
 {
 }
Esempio n. 33
0
 public override void Visit(IGreaterThan greaterThan) {
   base.Visit(greaterThan);
   Bpl.Expr rexp = TranslatedExpressions.Pop();
   Bpl.Expr lexp = TranslatedExpressions.Pop();
   TranslatedExpressions.Push(Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Gt, lexp, rexp));
 }
Esempio n. 34
0
 /// <summary>
 /// Visits the specified greater than.
 /// </summary>
 /// <param name="greaterThan">The greater than.</param>
 public override void Visit(IGreaterThan greaterThan)
 {
     GreaterThan mutableGreaterThan = new GreaterThan(greaterThan);
     this.resultExpression = this.myCodeCopier.DeepCopy(mutableGreaterThan);
 }
Esempio n. 35
0
 public override void Visit(IGreaterThan operation)
 {
     ProcessOperation(operation);
 }
Esempio n. 36
0
 /// <summary>
 /// Returns a deep copy of the given greater-than expression.
 /// </summary>
 /// <param name="greaterThan"></param>
 public GreaterThan Copy(IGreaterThan greaterThan)
 {
     var mutableCopy = this.shallowCopier.Copy(greaterThan);
       this.CopyChildren((BinaryOperation)mutableCopy);
       return mutableCopy;
 }
Esempio n. 37
0
 public override void Visit(IGreaterThan binary)
 {
     _formattedValue = Format(binary.LeftOperand) + " > " + Format(binary.RightOperand);
 }
Esempio n. 38
0
 /// <summary>
 /// Returns a shallow copy of the given greater-than expression.
 /// </summary>
 /// <param name="greaterThan"></param>
 public GreaterThan Copy(IGreaterThan greaterThan)
 {
     return new GreaterThan(greaterThan);
 }
    public override void TraverseChildren(IGreaterThan greaterThan) {

      if (greaterThan.IsUnsignedOrUnordered && !TypeHelper.IsPrimitiveInteger(greaterThan.LeftOperand.Type)) {
        this.sourceEmitterOutput.Write("!(");
        this.Traverse(greaterThan.LeftOperand);
        this.sourceEmitterOutput.Write(" <= ");
        this.Traverse(greaterThan.RightOperand);
        this.sourceEmitterOutput.Write(")");
        return;
      }

      var needsParen = LowerPrecedenceThanParentExpression(greaterThan);
      var savedCurrentPrecedence = this.currentPrecedence;
      this.currentPrecedence = this.Precedence(greaterThan);

      if (needsParen) this.sourceEmitterOutput.Write("(");
      if (greaterThan.IsUnsignedOrUnordered && TypeHelper.IsPrimitiveInteger(greaterThan.LeftOperand.Type) && 
        greaterThan.LeftOperand.Type != TypeHelper.UnsignedEquivalent(greaterThan.LeftOperand.Type)) {
        if (needsParen) this.sourceEmitterOutput.Write("(");
        this.PrintTypeReferenceName(TypeHelper.UnsignedEquivalent(greaterThan.LeftOperand.Type));
        if (needsParen) this.sourceEmitterOutput.Write(")");
      }
      this.Traverse(greaterThan.LeftOperand);
      this.sourceEmitterOutput.Write(" > ");
      if (greaterThan.IsUnsignedOrUnordered && TypeHelper.IsPrimitiveInteger(greaterThan.RightOperand.Type) && 
        greaterThan.RightOperand.Type != TypeHelper.UnsignedEquivalent(greaterThan.RightOperand.Type)) {
        if (needsParen) this.sourceEmitterOutput.Write("(");
        this.PrintTypeReferenceName(TypeHelper.UnsignedEquivalent(greaterThan.RightOperand.Type));
        if (needsParen) this.sourceEmitterOutput.Write(")");
      }
      this.Traverse(greaterThan.RightOperand);
      if (needsParen) this.sourceEmitterOutput.Write(")");

      this.currentPrecedence = savedCurrentPrecedence;
    }
Esempio n. 40
0
 public void Visit(IGreaterThan greaterThan)
 {
     this.result = this.copier.Copy(greaterThan);
 }
Esempio n. 41
0
 public override void TraverseChildren(IGreaterThan greaterThan)
 {
     MethodEnter(greaterThan);
     base.TraverseChildren(greaterThan);
     MethodExit();
 }
Esempio n. 42
0
 /// <summary>
 /// Visits the specified greater than.
 /// </summary>
 /// <param name="greaterThan">The greater than.</param>
 public override void Visit(IGreaterThan greaterThan)
 {
     GreaterThan mutableGreaterThan = greaterThan as GreaterThan;
     if (mutableGreaterThan == null) {
       this.resultExpression = greaterThan;
       return;
     }
     this.resultExpression = this.myCodeMutator.Visit(mutableGreaterThan);
 }