public override void Visit(IGreaterThan greaterThan)
 {
     if (Process(greaterThan))
     {
         visitor.Visit(greaterThan);
     }
     base.Visit(greaterThan);
 }
Exemplo 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);
        }
Exemplo 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));
        }
Exemplo 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);
 }
Exemplo n.º 6
0
 public override IExpression Rewrite(IGreaterThan operation)
 {
     return(ReplaceOperation(operation));
 }
Exemplo n.º 7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="greaterThan"></param>
 public GreaterThan(IGreaterThan greaterThan)
     : base(greaterThan)
 {
     this.unsignedOrUnordered = greaterThan.IsUnsignedOrUnordered;
 }
Exemplo 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);
 }
Exemplo 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);
    }
Exemplo 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;
 }
Exemplo n.º 13
0
        public override void TraverseChildren(IGreaterThan greaterThan)
{ MethodEnter(greaterThan);
            base.TraverseChildren(greaterThan);
     MethodExit();   }
Exemplo n.º 14
0
 public override void TraverseChildren(IGreaterThan greaterThan)
 {
     base.TraverseChildren(greaterThan);
     ((GreaterThan)greaterThan).Type = this.platformType.SystemBoolean;
 }
Exemplo n.º 15
0
 public override void Visit(IGreaterThan greaterThan)
 {
     allElements.Add(new InvokInfo(Traverser, "IGreaterThan", greaterThan));
 }
Exemplo 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);
 }
Exemplo 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;
 }
Exemplo n.º 19
0
 public virtual void onASTElement(IGreaterThan greaterThan) { }
Exemplo n.º 20
0
 /// <summary>
 /// Performs some computation with the given greater-than expression.
 /// </summary>
 /// <param name="greaterThan"></param>
 public virtual void Visit(IGreaterThan greaterThan)
 {
 }
Exemplo 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);
 }
Exemplo 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);
 }
Exemplo n.º 23
0
 public virtual void onASTElement(IGreaterThan greaterThan)
 {
 }
Exemplo n.º 24
0
 public void Visit(IGreaterThan greaterThan)
 {
     this.result = this.rewriter.Rewrite(greaterThan);
 }
Exemplo 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();
 }
Exemplo n.º 26
0
 public override void TraverseChildren(IGreaterThan greaterThan) {
   base.TraverseChildren(greaterThan);
   ((GreaterThan)greaterThan).Type = this.platformType.SystemBoolean;
 }
Exemplo 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);
 }
Exemplo 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;
    }
Exemplo n.º 29
0
 public void Visit(IGreaterThan greaterThan)
 {
     this.traverser.Traverse(greaterThan);
 }
Exemplo 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);
    }
Exemplo 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)
 {
 }
Exemplo 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));
 }
Exemplo 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);
 }
Exemplo n.º 35
0
 public override void Visit(IGreaterThan operation)
 {
     ProcessOperation(operation);
 }
Exemplo 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;
 }
Exemplo n.º 37
0
 public override void Visit(IGreaterThan binary)
 {
     _formattedValue = Format(binary.LeftOperand) + " > " + Format(binary.RightOperand);
 }
Exemplo 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;
    }
Exemplo n.º 40
0
 public void Visit(IGreaterThan greaterThan)
 {
     this.result = this.copier.Copy(greaterThan);
 }
Exemplo n.º 41
0
 public override void TraverseChildren(IGreaterThan greaterThan)
 {
     MethodEnter(greaterThan);
     base.TraverseChildren(greaterThan);
     MethodExit();
 }
Exemplo 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);
 }