public override void Visit(ILessThan addition)
 {
     if (!_found)
     {
         _found = true;
         MarkMutationTarget(addition);
     }
 }
 public override void Visit(ILessThan lessThan)
 {
     if (Process(lessThan))
     {
         visitor.Visit(lessThan);
     }
     base.Visit(lessThan);
 }
 public override void Visit(ILessThan addition)
 {
     if (!_found)
     {
           _found = true;
           MarkMutationTarget(addition);
     }
 }
Exemple #4
0
        private HLLocation ProcessLessThanExpression(ILessThan pExpression)
        {
            HLLocation locationLeftOperand  = ProcessExpression(pExpression.LeftOperand);
            HLLocation locationRightOperand = ProcessExpression(pExpression.RightOperand);
            HLLocation locationTemporary    = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type)));

            mCurrentBlock.EmitCompare(HLCompareType.LessThan, locationTemporary, locationLeftOperand, locationRightOperand);
            return(pExpression.ResultIsUnmodifiedLeftOperand ? locationLeftOperand : locationTemporary);
        }
Exemple #5
0
 /// <summary>
 /// Generates IL for the specified less than.
 /// </summary>
 /// <param name="lessThan">The less than.</param>
 public override void TraverseChildren(ILessThan lessThan)
 {
     this.Traverse(lessThan.LeftOperand);
       this.Traverse(lessThan.RightOperand);
       if (lessThan.IsUnsignedOrUnordered)
     this.generator.Emit(OperationCode.Clt_Un);
       else
     this.generator.Emit(OperationCode.Clt);
       this.StackSize--;
 }
Exemple #6
0
 public void Visit(ILessThan lessThan)
 {
     throw new NotImplementedException();
 }
Exemple #7
0
 /// <summary>
 /// Performs some computation with the given less-than expression.
 /// </summary>
 /// <param name="lessThan"></param>
 public virtual void Visit(ILessThan lessThan)
 {
     this.Visit((IBinaryOperation)lessThan);
 }
Exemple #8
0
 /// <summary>
 /// Traverses the children of the less-than expression.
 /// </summary>
 public virtual void TraverseChildren(ILessThan lessThan)
 {
     Contract.Requires(lessThan != null);
       this.TraverseChildren((IBinaryOperation)lessThan);
 }
Exemple #9
0
 /// <summary>
 /// Performs some computation with the given less-than expression.
 /// </summary>
 /// <param name="lessThan"></param>
 public virtual void Visit(ILessThan lessThan)
 {
 }
        public override void TraverseChildren(ILessThan lessThan)
{ MethodEnter(lessThan);
            base.TraverseChildren(lessThan);
     MethodExit();   }
    public override void TraverseChildren(ILessThan lessThan)
    {
      base.TraverseChildren(lessThan);
      Bpl.Expr rexp = TranslatedExpressions.Pop();
      Bpl.Expr lexp = TranslatedExpressions.Pop();

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

      TranslatedExpressions.Push(e);
    }
 public virtual void onASTElement(ILessThan lessThan) { }
Exemple #13
0
 public override void Visit(ILessThan operation)
 {
     ProcessOperation(operation);
 }
 public override void Visit(ILessThan lessThan)
 {
     if(Process(lessThan)){visitor.Visit(lessThan);}
     base.Visit(lessThan);
 }
Exemple #15
0
 private HLLocation ProcessLessThanExpression(ILessThan pExpression)
 {
     HLLocation locationLeftOperand = ProcessExpression(pExpression.LeftOperand);
     HLLocation locationRightOperand = ProcessExpression(pExpression.RightOperand);
     HLLocation locationTemporary = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type)));
     mCurrentBlock.EmitCompare(HLCompareType.LessThan, locationTemporary, locationLeftOperand, locationRightOperand);
     return pExpression.ResultIsUnmodifiedLeftOperand ? locationLeftOperand : locationTemporary;
 }
Exemple #16
0
 public void Visit(ILessThan lessThan)
 {
     this.result = this.rewriter.Rewrite(lessThan);
 }
Exemple #17
0
 /// <summary>
 /// Rewrites the given less-than expression.
 /// </summary>
 /// <param name="lessThan"></param>
 public virtual IExpression Rewrite(ILessThan lessThan)
 {
     var mutableLessThan = lessThan as LessThan;
       if (mutableLessThan == null) return lessThan;
       this.RewriteChildren(mutableLessThan);
       return mutableLessThan;
 }
Exemple #18
0
 public override void Visit(ILessThan binary)
 {
     _formattedValue = Format(binary.LeftOperand) + " < " + Format(binary.RightOperand);
 }
Exemple #19
0
 public override void TraverseChildren(ILessThan lessThan)
 {
     base.TraverseChildren(lessThan);
     ((LessThan)lessThan).Type = this.platformType.SystemBoolean;
 }
Exemple #20
0
 /// <summary>
 /// Visits the specified less than.
 /// </summary>
 /// <param name="lessThan">The less than.</param>
 public override void Visit(ILessThan lessThan)
 {
     LessThan mutableLessThan = lessThan as LessThan;
     if (alwaysMakeACopy || mutableLessThan == null) mutableLessThan = new LessThan(lessThan);
     this.resultExpression = this.myCodeMutator.Visit(mutableLessThan);
 }
Exemple #21
0
 public override void Visit(ILessThan lessThan)
 {
     allElements.Add(new InvokInfo(Traverser, "ILessThan", lessThan));
 }
Exemple #22
0
 public virtual void onASTElement(ILessThan lessThan)
 {
 }
 /// <summary>
 /// Rewrites the given less-than expression.
 /// </summary>
 /// <param name="lessThan"></param>
 public virtual IExpression Rewrite(ILessThan lessThan)
 {
     return lessThan;
 }
Exemple #24
0
 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Traverses the given less-than expression.
 /// </summary>
 /// <param name="lessThan"></param>
 public virtual void Visit(ILessThan lessThan)
 {
     if (this.stopTraversal) return;
       //^ int oldCount = this.path.Count;
       this.path.Push(lessThan);
       this.Visit(lessThan.LeftOperand);
       this.Visit(lessThan.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 TraverseChildren(ILessThan lessThan) {
   base.TraverseChildren(lessThan);
   ((LessThan)lessThan).Type = this.platformType.SystemBoolean;
 }
Exemple #26
0
 /// <summary>
 /// Traverses the less-than expression.
 /// </summary>
 public void Traverse(ILessThan lessThan)
 {
     Contract.Requires(lessThan != null);
       if (this.preorderVisitor != null) this.preorderVisitor.Visit(lessThan);
       if (this.StopTraversal) return;
       this.TraverseChildren(lessThan);
       if (this.StopTraversal) return;
       if (this.postorderVisitor != null) this.postorderVisitor.Visit(lessThan);
 }
Exemple #27
0
    /// <summary>
    /// Returns a deep copy of the given less-than expression.
    /// </summary>
    /// <param name="lessThan"></param>
    public LessThan Copy(ILessThan lessThan) {
      Contract.Requires(lessThan != null);
      Contract.Ensures(Contract.Result<LessThan>() != null);

      var mutableCopy = this.shallowCopier.Copy(lessThan);
      this.CopyChildren((BinaryOperation)mutableCopy);
      return mutableCopy;
    }
Exemple #28
0
 public void Visit(ILessThan lessThan)
 {
     this.traverser.Traverse(lessThan);
 }
Exemple #29
0
    /// <summary>
    /// Returns a shallow copy of the given less-than expression.
    /// </summary>
    /// <param name="lessThan"></param>
    public LessThan Copy(ILessThan lessThan) {
      Contract.Requires(lessThan != null);
      Contract.Ensures(Contract.Result<LessThan>() != null);

      return new LessThan(lessThan);
    }
Exemple #30
0
 public void Visit(ILessThan lessThan)
 {
     Contract.Requires(lessThan != null);
       throw new NotImplementedException();
 }
 /// <summary>
 /// Performs some computation with the given less-than expression.
 /// </summary>
 /// <param name="lessThan"></param>
 public virtual void Visit(ILessThan lessThan)
 {
 }
 public override void Visit(ILessThan lessThan) {
   base.Visit(lessThan);
   Bpl.Expr rexp = TranslatedExpressions.Pop();
   Bpl.Expr lexp = TranslatedExpressions.Pop();
   TranslatedExpressions.Push(Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Lt, lexp, rexp));
 }
Exemple #33
0
 /// <summary>
 /// Visits the specified less than.
 /// </summary>
 /// <param name="lessThan">The less than.</param>
 public override void Visit(ILessThan lessThan)
 {
     LessThan mutableLessThan = new LessThan(lessThan);
     this.resultExpression = this.myCodeCopier.DeepCopy(mutableLessThan);
 }
Exemple #34
0
 public override IExpression Rewrite(ILessThan operation)
 {
     return(ReplaceOperation(operation));
 }
Exemple #35
0
 /// <summary>
 /// Returns a deep copy of the given less-than expression.
 /// </summary>
 /// <param name="lessThan"></param>
 public LessThan Copy(ILessThan lessThan)
 {
     var mutableCopy = this.shallowCopier.Copy(lessThan);
       this.CopyChildren((BinaryOperation)mutableCopy);
       return mutableCopy;
 }
Exemple #36
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="lessThan"></param>
 public LessThan(ILessThan lessThan)
     : base(lessThan)
 {
     this.unsignedOrUnordered = lessThan.IsUnsignedOrUnordered;
 }
Exemple #37
0
 /// <summary>
 /// Returns a shallow copy of the given less-than expression.
 /// </summary>
 /// <param name="lessThan"></param>
 public LessThan Copy(ILessThan lessThan)
 {
     return new LessThan(lessThan);
 }
    public override void TraverseChildren(ILessThan lessThan) {

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

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

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

      this.currentPrecedence = savedCurrentPrecedence;
    }
Exemple #39
0
 public void Visit(ILessThan lessThan)
 {
     this.result = this.copier.Copy(lessThan);
 }
Exemple #40
0
 public override void TraverseChildren(ILessThan lessThan)
 {
     MethodEnter(lessThan);
     base.TraverseChildren(lessThan);
     MethodExit();
 }
Exemple #41
0
 /// <summary>
 /// Visits the specified less than.
 /// </summary>
 /// <param name="lessThan">The less than.</param>
 public override void Visit(ILessThan lessThan)
 {
     LessThan mutableLessThan = lessThan as LessThan;
     if (mutableLessThan == null) {
       this.resultExpression = lessThan;
       return;
     }
     this.resultExpression = this.myCodeMutator.Visit(mutableLessThan);
 }