public override void Visit(IGreaterThan greaterThan) { if (Process(greaterThan)) { visitor.Visit(greaterThan); } base.Visit(greaterThan); }
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); }
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)); }
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); }
public override IExpression Rewrite(IGreaterThan operation) { return(ReplaceOperation(operation)); }
/// <summary> /// /// </summary> /// <param name="greaterThan"></param> public GreaterThan(IGreaterThan greaterThan) : base(greaterThan) { this.unsignedOrUnordered = greaterThan.IsUnsignedOrUnordered; }
/// <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); }
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); }
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; }
public override void TraverseChildren(IGreaterThan greaterThan) { MethodEnter(greaterThan); base.TraverseChildren(greaterThan); MethodExit(); }
public override void TraverseChildren(IGreaterThan greaterThan) { base.TraverseChildren(greaterThan); ((GreaterThan)greaterThan).Type = this.platformType.SystemBoolean; }
public override void Visit(IGreaterThan greaterThan) { allElements.Add(new InvokInfo(Traverser, "IGreaterThan", greaterThan)); }
/// <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); }
/// <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; }
public virtual void onASTElement(IGreaterThan greaterThan) { }
/// <summary> /// Performs some computation with the given greater-than expression. /// </summary> /// <param name="greaterThan"></param> public virtual void Visit(IGreaterThan greaterThan) { }
/// <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); }
/// <summary> /// Traverses the children of the greater-than expression. /// </summary> public virtual void TraverseChildren(IGreaterThan greaterThan) { Contract.Requires(greaterThan != null); this.TraverseChildren((IBinaryOperation)greaterThan); }
public void Visit(IGreaterThan greaterThan) { this.result = this.rewriter.Rewrite(greaterThan); }
//^ 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(); }
/// <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); }
/// <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; }
public void Visit(IGreaterThan greaterThan) { this.traverser.Traverse(greaterThan); }
/// <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); }
public void Visit(IGreaterThan greaterThan) { Contract.Requires(greaterThan != null); throw new NotImplementedException(); }
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)); }
/// <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); }
public override void Visit(IGreaterThan operation) { ProcessOperation(operation); }
/// <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; }
public override void Visit(IGreaterThan binary) { _formattedValue = Format(binary.LeftOperand) + " > " + Format(binary.RightOperand); }
/// <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; }
public void Visit(IGreaterThan greaterThan) { this.result = this.copier.Copy(greaterThan); }
/// <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); }