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