Beispiel #1
0
        private HLLocation ProcessUnaryNegationExpression(IUnaryNegation pExpression)
        {
            HLLocation locationOperand   = ProcessExpression(pExpression.Operand);
            HLLocation locationTemporary = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type)));

            mCurrentBlock.EmitBitwiseNegate(locationTemporary, locationOperand);
            return(locationTemporary);
        }
 public override void Visit(IUnaryNegation unaryNegation)
 {
     if (Process(unaryNegation))
     {
         visitor.Visit(unaryNegation);
     }
     base.Visit(unaryNegation);
 }
Beispiel #3
0
 public void Visit(IUnaryNegation unaryNegation)
 {
     throw new NotImplementedException();
 }
Beispiel #4
0
 /// <summary>
 /// Performs some computation with the given unary negation expression.
 /// </summary>
 /// <param name="unaryNegation"></param>
 public virtual void Visit(IUnaryNegation unaryNegation)
 {
     this.Visit((IUnaryOperation)unaryNegation);
 }
Beispiel #5
0
 /// <summary>
 /// Traverses the children of the unary negation expression.
 /// </summary>
 public virtual void TraverseChildren(IUnaryNegation unaryNegation)
 {
     Contract.Requires(unaryNegation != null);
       this.TraverseChildren((IUnaryOperation)unaryNegation);
 }
Beispiel #6
0
 /// <summary>
 /// Performs some computation with the given unary negation expression.
 /// </summary>
 /// <param name="unaryNegation"></param>
 public virtual void Visit(IUnaryNegation unaryNegation)
 {
 }
        public override void TraverseChildren(IUnaryNegation unaryNegation)
{ MethodEnter(unaryNegation);
            base.TraverseChildren(unaryNegation);
     MethodExit();   }
 public override void TraverseChildren(IUnaryNegation unaryNegation)
 {
   base.TraverseChildren(unaryNegation);
   Bpl.Expr exp = TranslatedExpressions.Pop();
   Bpl.Expr e, zero, realZero;
   zero = Bpl.Expr.Literal(0);
   realZero = new Bpl.NAryExpr(Bpl.Token.NoToken, new Bpl.FunctionCall(this.sink.Heap.Int2Real), new List<Bpl.Expr>(new Bpl.Expr[] {zero}));
   switch (unaryNegation.Type.TypeCode) {
     case PrimitiveTypeCode.Float32:
     case PrimitiveTypeCode.Float64:
       e = new Bpl.NAryExpr(
         unaryNegation.Token(),
         new Bpl.FunctionCall(this.sink.Heap.RealMinus),
         new List<Bpl.Expr>(new Bpl.Expr[] {realZero, exp})
         );
       break;
     default:
       e = Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Sub, Bpl.Expr.Literal(0), exp);
       break;
   }
   TranslatedExpressions.Push(e);
 }
Beispiel #9
0
 /// <summary>
 /// Visits the specified unary negation.
 /// </summary>
 /// <param name="unaryNegation">The unary negation.</param>
 public override void Visit(IUnaryNegation unaryNegation)
 {
     UnaryNegation mutableUnaryNegation = unaryNegation as UnaryNegation;
     if (alwaysMakeACopy || mutableUnaryNegation == null) mutableUnaryNegation = new UnaryNegation(unaryNegation);
     this.resultExpression = this.myCodeMutator.Visit(mutableUnaryNegation);
 }
Beispiel #10
0
 public override void TraverseChildren(IUnaryNegation unaryNegation)
 {
     base.TraverseChildren(unaryNegation);
     ((UnaryNegation)unaryNegation).Type = unaryNegation.Operand.Type;
 }
Beispiel #11
0
 /// <summary>
 /// Generates IL for the specified unary negation.
 /// </summary>
 /// <param name="unaryNegation">The unary negation.</param>
 public override void TraverseChildren(IUnaryNegation unaryNegation)
 {
     if (unaryNegation.CheckOverflow && TypeHelper.IsSignedPrimitiveInteger(unaryNegation.Type)) {
     this.generator.Emit(OperationCode.Ldc_I4_0);
     this.StackSize++;
     this.Traverse(unaryNegation.Operand);
     this.generator.Emit(OperationCode.Sub_Ovf);
     this.StackSize--;
     return;
       }
       this.Traverse(unaryNegation.Operand);
       this.generator.Emit(OperationCode.Neg);
 }
 public override void Visit(IUnaryNegation unaryNegation)
 {
     if(Process(unaryNegation)){visitor.Visit(unaryNegation);}
     base.Visit(unaryNegation);
 }
Beispiel #13
0
 private HLLocation ProcessUnaryNegationExpression(IUnaryNegation pExpression)
 {
     HLLocation locationOperand = ProcessExpression(pExpression.Operand);
     HLLocation locationTemporary = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type)));
     mCurrentBlock.EmitBitwiseNegate(locationTemporary, locationOperand);
     return locationTemporary;
 }
Beispiel #14
0
 public void Visit(IUnaryNegation unaryNegation)
 {
     this.result = this.rewriter.Rewrite(unaryNegation);
 }
Beispiel #15
0
 /// <summary>
 /// Rewrites the given unary negation expression.
 /// </summary>
 /// <param name="unaryNegation"></param>
 public virtual IExpression Rewrite(IUnaryNegation unaryNegation)
 {
     var mutableUnaryNegation = unaryNegation as UnaryNegation;
       if (mutableUnaryNegation == null) return unaryNegation;
       this.RewriteChildren(mutableUnaryNegation);
       return mutableUnaryNegation;
 }
Beispiel #16
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="unaryNegation"></param>
 public UnaryNegation(IUnaryNegation unaryNegation)
     : base(unaryNegation)
 {
     this.CheckOverflow = unaryNegation.CheckOverflow;
 }
 public virtual void onASTElement(IUnaryNegation unaryNegation) { }
Beispiel #18
0
 public override void Visit(IUnaryNegation unaryNegation)
 {
     allElements.Add(new InvokInfo(Traverser, "IUnaryNegation", unaryNegation));
 }
Beispiel #19
0
 public void Visit(IUnaryNegation unaryNegation)
 {
     this.result = this.copier.Copy(unaryNegation);
 }
 /// <summary>
 /// Rewrites the given unary negation expression.
 /// </summary>
 /// <param name="unaryNegation"></param>
 public virtual IExpression Rewrite(IUnaryNegation unaryNegation)
 {
     return unaryNegation;
 }
Beispiel #21
0
 public virtual void onASTElement(IUnaryNegation unaryNegation)
 {
 }
 public override void TraverseChildren(IUnaryNegation unaryNegation) {
   base.TraverseChildren(unaryNegation);
   ((UnaryNegation)unaryNegation).Type = unaryNegation.Operand.Type;
 }
Beispiel #23
0
 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Traverses the given unary negation expression.
 /// </summary>
 /// <param name="unaryNegation"></param>
 public virtual void Visit(IUnaryNegation unaryNegation)
 {
     if (this.stopTraversal) return;
       //^ int oldCount = this.path.Count;
       this.path.Push(unaryNegation);
       this.Visit(unaryNegation.Operand);
       //^ 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();
 }
Beispiel #24
0
    /// <summary>
    /// Returns a shallow copy of the given unary negation expression.
    /// </summary>
    /// <param name="unaryNegation"></param>
    public UnaryNegation Copy(IUnaryNegation unaryNegation) {
      Contract.Requires(unaryNegation != null);
      Contract.Ensures(Contract.Result<UnaryNegation>() != null);

      return new UnaryNegation(unaryNegation);
    }
Beispiel #25
0
 /// <summary>
 /// Traverses the unary negation expression.
 /// </summary>
 public void Traverse(IUnaryNegation unaryNegation)
 {
     Contract.Requires(unaryNegation != null);
       if (this.preorderVisitor != null) this.preorderVisitor.Visit(unaryNegation);
       if (this.StopTraversal) return;
       this.TraverseChildren(unaryNegation);
       if (this.StopTraversal) return;
       if (this.postorderVisitor != null) this.postorderVisitor.Visit(unaryNegation);
 }
Beispiel #26
0
    /// <summary>
    /// Returns a deep copy of the given unary negation expression.
    /// </summary>
    /// <param name="unaryNegation"></param>
    public UnaryNegation Copy(IUnaryNegation unaryNegation) {
      Contract.Requires(unaryNegation != null);
      Contract.Ensures(Contract.Result<UnaryNegation>() != null);

      var mutableCopy = this.shallowCopier.Copy(unaryNegation);
      this.CopyChildren((UnaryOperation)mutableCopy);
      return mutableCopy;
    }
Beispiel #27
0
 public void Visit(IUnaryNegation unaryNegation)
 {
     this.traverser.Traverse(unaryNegation);
 }
 /// <summary>
 /// Performs some computation with the given unary negation expression.
 /// </summary>
 /// <param name="unaryNegation"></param>
 public virtual void Visit(IUnaryNegation unaryNegation)
 {
 }
Beispiel #29
0
 public void Visit(IUnaryNegation unaryNegation)
 {
     Contract.Requires(unaryNegation != null);
       throw new NotImplementedException();
 }
Beispiel #30
0
 /// <summary>
 /// Visits the specified unary negation.
 /// </summary>
 /// <param name="unaryNegation">The unary negation.</param>
 public override void Visit(IUnaryNegation unaryNegation)
 {
     UnaryNegation mutableUnaryNegation = new UnaryNegation(unaryNegation);
     this.resultExpression = this.myCodeCopier.DeepCopy(mutableUnaryNegation);
 }
 public override void Visit(IUnaryNegation unaryNegation) {
   base.Visit(unaryNegation);
   Bpl.Expr exp = TranslatedExpressions.Pop();
   Bpl.Expr zero = Bpl.Expr.Literal(0); // TODO: (mschaef) will this work in any case?
   TranslatedExpressions.Push( Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Sub, zero, exp) );
 }
Beispiel #32
0
 /// <summary>
 /// Returns a deep copy of the given unary negation expression.
 /// </summary>
 /// <param name="unaryNegation"></param>
 public UnaryNegation Copy(IUnaryNegation unaryNegation)
 {
     var mutableCopy = this.shallowCopier.Copy(unaryNegation);
       this.CopyChildren((UnaryOperation)mutableCopy);
       return mutableCopy;
 }
 public override void TraverseChildren(IUnaryNegation unaryNegation) {
   base.TraverseChildren(unaryNegation);
 }
Beispiel #34
0
 /// <summary>
 /// Returns a shallow copy of the given unary negation expression.
 /// </summary>
 /// <param name="unaryNegation"></param>
 public UnaryNegation Copy(IUnaryNegation unaryNegation)
 {
     return new UnaryNegation(unaryNegation);
 }
Beispiel #35
0
 public override void TraverseChildren(IUnaryNegation unaryNegation)
 {
     MethodEnter(unaryNegation);
     base.TraverseChildren(unaryNegation);
     MethodExit();
 }
Beispiel #36
0
 /// <summary>
 /// Visits the specified unary negation.
 /// </summary>
 /// <param name="unaryNegation">The unary negation.</param>
 public override void Visit(IUnaryNegation unaryNegation)
 {
     UnaryNegation mutableUnaryNegation = unaryNegation as UnaryNegation;
     if (mutableUnaryNegation == null) {
       this.resultExpression = unaryNegation;
       return;
     }
     this.resultExpression = this.myCodeMutator.Visit(mutableUnaryNegation);
 }