public override void TraverseChildren(IGreaterThanOrEqual greaterThanOrEqual) {

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

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

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

      this.currentPrecedence = savedCurrentPrecedence;
    }
Exemple #2
0
 /// <summary>
 /// Visits the specified greater than or equal.
 /// </summary>
 /// <param name="greaterThanOrEqual">The greater than or equal.</param>
 public override void Visit(IGreaterThanOrEqual greaterThanOrEqual)
 {
     GreaterThanOrEqual mutableGreaterThanOrEqual = greaterThanOrEqual as GreaterThanOrEqual;
     if (alwaysMakeACopy || mutableGreaterThanOrEqual == null) mutableGreaterThanOrEqual = new GreaterThanOrEqual(greaterThanOrEqual);
     this.resultExpression = this.myCodeMutator.Visit(mutableGreaterThanOrEqual);
 }
Exemple #3
0
 public void Visit(IGreaterThanOrEqual greaterThanOrEqual)
 {
     Contract.Requires(greaterThanOrEqual != null);
       throw new NotImplementedException();
 }
 public override void Visit(IGreaterThanOrEqual greaterEqual) {
   base.Visit(greaterEqual);
   Bpl.Expr rexp = TranslatedExpressions.Pop();
   Bpl.Expr lexp = TranslatedExpressions.Pop();
   TranslatedExpressions.Push(Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Ge, lexp, rexp));
 }
Exemple #5
0
 /// <summary>
 /// Traverses the greater-than-or-equal expression.
 /// </summary>
 public void Traverse(IGreaterThanOrEqual greaterThanOrEqual)
 {
     Contract.Requires(greaterThanOrEqual != null);
       if (this.preorderVisitor != null) this.preorderVisitor.Visit(greaterThanOrEqual);
       if (this.StopTraversal) return;
       this.TraverseChildren(greaterThanOrEqual);
       if (this.StopTraversal) return;
       if (this.postorderVisitor != null) this.postorderVisitor.Visit(greaterThanOrEqual);
 }
Exemple #6
0
 public void Visit(IGreaterThanOrEqual greaterThanOrEqual)
 {
     this.traverser.Traverse(greaterThanOrEqual);
 }
 /// <summary>
 /// Rewrites the given greater-than-or-equal expression.
 /// </summary>
 /// <param name="greaterThanOrEqual"></param>
 public virtual IExpression Rewrite(IGreaterThanOrEqual greaterThanOrEqual)
 {
     return greaterThanOrEqual;
 }
Exemple #8
0
 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Traverses the given greater-than-or-equal expression.
 /// </summary>
 /// <param name="greaterThanOrEqual"></param>
 public virtual void Visit(IGreaterThanOrEqual greaterThanOrEqual)
 {
     if (this.stopTraversal) return;
       //^ int oldCount = this.path.Count;
       this.path.Push(greaterThanOrEqual);
       this.Visit(greaterThanOrEqual.LeftOperand);
       this.Visit(greaterThanOrEqual.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();
 }
 public override void Visit(IGreaterThanOrEqual greaterThanOrEqual)
 {
     if(Process(greaterThanOrEqual)){visitor.Visit(greaterThanOrEqual);}
     base.Visit(greaterThanOrEqual);
 }
Exemple #10
0
 /// <summary>
 /// Generates IL for the specified greater than or equal.
 /// </summary>
 /// <param name="greaterThanOrEqual">The greater than or equal.</param>
 public override void TraverseChildren(IGreaterThanOrEqual greaterThanOrEqual)
 {
     this.Traverse(greaterThanOrEqual.LeftOperand);
       this.Traverse(greaterThanOrEqual.RightOperand);
       if (greaterThanOrEqual.IsUnsignedOrUnordered && !TypeHelper.IsPrimitiveInteger(greaterThanOrEqual.LeftOperand.Type))
     this.generator.Emit(OperationCode.Clt_Un);
       else
     this.generator.Emit(OperationCode.Clt);
       this.generator.Emit(OperationCode.Ldc_I4_0);
       this.generator.Emit(OperationCode.Ceq);
       this.StackSize--;
 }
Exemple #11
0
 private HLLocation ProcessGreaterThanOrEqualExpression(IGreaterThanOrEqual pExpression)
 {
     HLLocation locationLeftOperand = ProcessExpression(pExpression.LeftOperand);
     HLLocation locationRightOperand = ProcessExpression(pExpression.RightOperand);
     HLLocation locationTemporary = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type)));
     mCurrentBlock.EmitCompare(HLCompareType.GreaterThanOrEqual, locationTemporary, locationLeftOperand, locationRightOperand);
     return pExpression.ResultIsUnmodifiedLeftOperand ? locationLeftOperand : locationTemporary;
 }
Exemple #12
0
 public void Visit(IGreaterThanOrEqual greaterThanOrEqual)
 {
     this.result = this.rewriter.Rewrite(greaterThanOrEqual);
 }
Exemple #13
0
 /// <summary>
 /// Rewrites the given greater-than-or-equal expression.
 /// </summary>
 /// <param name="greaterThanOrEqual"></param>
 public virtual IExpression Rewrite(IGreaterThanOrEqual greaterThanOrEqual)
 {
     var mutableGreaterThanOrEqual = greaterThanOrEqual as GreaterThanOrEqual;
       if (mutableGreaterThanOrEqual == null) return greaterThanOrEqual;
       this.RewriteChildren(mutableGreaterThanOrEqual);
       return mutableGreaterThanOrEqual;
 }
    public override void TraverseChildren(IGreaterThanOrEqual greaterEqual)
    {
      base.TraverseChildren(greaterEqual);
      Bpl.Expr rexp = TranslatedExpressions.Pop();
      Bpl.Expr lexp = TranslatedExpressions.Pop();

      Bpl.Expr e;
      switch (greaterEqual.LeftOperand.Type.TypeCode) {
        case PrimitiveTypeCode.Float32:
        case PrimitiveTypeCode.Float64:
          e = new Bpl.NAryExpr(
            greaterEqual.Token(),
            new Bpl.FunctionCall(this.sink.Heap.RealGreaterThanOrEqual),
            new List<Bpl.Expr>(new Bpl.Expr[] {lexp, rexp})
            );
          break;
        default:
          e = Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Ge, lexp, rexp);
          break;
      } 
      
      TranslatedExpressions.Push(e);
    }
 public override void TraverseChildren(IGreaterThanOrEqual greaterThanOrEqual) {
   base.TraverseChildren(greaterThanOrEqual);
   ((GreaterThanOrEqual)greaterThanOrEqual).Type = this.platformType.SystemBoolean;
 }
        public override void TraverseChildren(IGreaterThanOrEqual greaterThanOrEqual)
{ MethodEnter(greaterThanOrEqual);
            base.TraverseChildren(greaterThanOrEqual);
     MethodExit();   }
Exemple #17
0
    /// <summary>
    /// Returns a deep copy of the given greater-than-or-equal expression.
    /// </summary>
    /// <param name="greaterThanOrEqual"></param>
    public GreaterThanOrEqual Copy(IGreaterThanOrEqual greaterThanOrEqual) {
      Contract.Requires(greaterThanOrEqual != null);
      Contract.Ensures(Contract.Result<GreaterThanOrEqual>() != null);

      var mutableCopy = this.shallowCopier.Copy(greaterThanOrEqual);
      this.CopyChildren((BinaryOperation)mutableCopy);
      return mutableCopy;
    }
Exemple #18
0
 /// <summary>
 /// Performs some computation with the given greater-than-or-equal expression.
 /// </summary>
 /// <param name="greaterThanOrEqual"></param>
 public virtual void Visit(IGreaterThanOrEqual greaterThanOrEqual)
 {
 }
Exemple #19
0
    /// <summary>
    /// Returns a shallow copy of the given greater-than-or-equal expression.
    /// </summary>
    /// <param name="greaterThanOrEqual"></param>
    public GreaterThanOrEqual Copy(IGreaterThanOrEqual greaterThanOrEqual) {
      Contract.Requires(greaterThanOrEqual != null);
      Contract.Ensures(Contract.Result<GreaterThanOrEqual>() != null);

      return new GreaterThanOrEqual(greaterThanOrEqual);
    }
Exemple #20
0
 /// <summary>
 /// Traverses the children of the greater-than-or-equal expression.
 /// </summary>
 public virtual void TraverseChildren(IGreaterThanOrEqual greaterThanOrEqual)
 {
     Contract.Requires(greaterThanOrEqual != null);
       this.TraverseChildren((IBinaryOperation)greaterThanOrEqual);
 }
Exemple #21
0
 /// <summary>
 /// Visits the specified greater than or equal.
 /// </summary>
 /// <param name="greaterThanOrEqual">The greater than or equal.</param>
 public override void Visit(IGreaterThanOrEqual greaterThanOrEqual)
 {
     GreaterThanOrEqual mutableGreaterThanOrEqual = new GreaterThanOrEqual(greaterThanOrEqual);
     this.resultExpression = this.myCodeCopier.DeepCopy(mutableGreaterThanOrEqual);
 }
Exemple #22
0
 /// <summary>
 /// Performs some computation with the given greater-than-or-equal expression.
 /// </summary>
 /// <param name="greaterThanOrEqual"></param>
 public virtual void Visit(IGreaterThanOrEqual greaterThanOrEqual)
 {
     this.Visit((IBinaryOperation)greaterThanOrEqual);
 }
Exemple #23
0
 /// <summary>
 /// Returns a deep copy of the given greater-than-or-equal expression.
 /// </summary>
 /// <param name="greaterThanOrEqual"></param>
 public GreaterThanOrEqual Copy(IGreaterThanOrEqual greaterThanOrEqual)
 {
     var mutableCopy = this.shallowCopier.Copy(greaterThanOrEqual);
       this.CopyChildren((BinaryOperation)mutableCopy);
       return mutableCopy;
 }
Exemple #24
0
 public void Visit(IGreaterThanOrEqual greaterThanOrEqual)
 {
     throw new NotImplementedException();
 }
Exemple #25
0
 /// <summary>
 /// Returns a shallow copy of the given greater-than-or-equal expression.
 /// </summary>
 /// <param name="greaterThanOrEqual"></param>
 public GreaterThanOrEqual Copy(IGreaterThanOrEqual greaterThanOrEqual)
 {
     return new GreaterThanOrEqual(greaterThanOrEqual);
 }
Exemple #26
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="greaterThanOrEqual"></param>
 public GreaterThanOrEqual(IGreaterThanOrEqual greaterThanOrEqual)
     : base(greaterThanOrEqual)
 {
     this.unsignedOrUnordered = greaterThanOrEqual.IsUnsignedOrUnordered;
 }
Exemple #27
0
 public void Visit(IGreaterThanOrEqual greaterThanOrEqual)
 {
     this.result = this.copier.Copy(greaterThanOrEqual);
 }
 public virtual void onASTElement(IGreaterThanOrEqual greaterThanOrEqual) { }
Exemple #29
0
 /// <summary>
 /// Visits the specified greater than or equal.
 /// </summary>
 /// <param name="greaterThanOrEqual">The greater than or equal.</param>
 public override void Visit(IGreaterThanOrEqual greaterThanOrEqual)
 {
     GreaterThanOrEqual mutableGreaterThanOrEqual = greaterThanOrEqual as GreaterThanOrEqual;
     if (mutableGreaterThanOrEqual == null) {
       this.resultExpression = greaterThanOrEqual;
       return;
     }
     this.resultExpression = this.myCodeMutator.Visit(mutableGreaterThanOrEqual);
 }