Пример #1
0
        public void AcceptStore(StoreStatement stmt)
        {
            object value = stmt.Value.Eval(Evaluator);

            _varValues[stmt.Container] = value;
            _execLeaf = stmt;
        }
 public void AcceptStore(StoreStatement stmt)
 {
     if (_variable.Equals(stmt.Container))
     {
         Result = true;
     }
 }
            public void AcceptStore(StoreStatement stmt)
            {
                Variable v = stmt.Container as Variable;

                if (v != null)
                {
                    _iva._unconstrainedVars.Add(v);
                }
            }
Пример #4
0
 /// <summary>
 /// Transforms a "store" statement. The default implementation clones that statement.
 /// </summary>
 /// <param name="stmt">"store" statement</param>
 public virtual void AcceptStore(StoreStatement stmt)
 {
     if (stmt.Container is Literal)
     {
         _tlit = (Literal)stmt.Container;
     }
     stmt.Container.Accept(this);
     Store((IStorableLiteral)_tlit, stmt.Value.Transform(this));
     CopyAttributesToLastStatement(stmt);
 }
Пример #5
0
 public override void AcceptStore(StoreStatement stmt)
 {
     if (stmt.Container is Variable)
     {
         var key = Tuple.Create(_funStack.Peek(), stmt.Container);
         var var = _locals[key];
         Store(var, stmt.Value.Transform(this));
         CopyAttributesToLastStatement(stmt);
     }
     else
     {
         base.AcceptStore(stmt);
     }
 }
Пример #6
0
        public Expression Veil(Expression e)
        {
            if (e.LeafCount < VeilThreshold)
            {
                return(e);
            }

            Variable       v    = CreateSymbol(e.ResultType);
            StoreStatement stmt = new StoreStatement()
            {
                Container = v,
                Value     = e
            };

            _tstores.Add(stmt);
            return(v);
        }
Пример #7
0
        public override void AcceptStore(StoreStatement stmt)
        {
            var sref = stmt.Container as SignalRef;

            if (sref == null)
            {
                Success = false;
                return;
            }
            if (sref.Prop != SignalRef.EReferencedProperty.Next)
            {
                Success = false;
                return;
            }
            var cstmt = new ConcurrentStatement(sref, stmt.Value);

            Statements.Add(cstmt);
        }
Пример #8
0
 public void AcceptStore(StoreStatement stmt)
 {
     if (stmt.Container.Type.CILType.IsValueType ||
         stmt.Container.Type.HasIntrinsicTypeOverride)
     {
         CreateLabelForNextInstruction(stmt);
         if (stmt.Label != null)
         {
             _closeBBOnNextInstr = true;
         }
         int rslot = stmt.Value.Accept(this);
         _litMode = ELiteralAcceptMode.Write;
         var lit = stmt.Container;
         lit.Accept(this);
         _litMode = ELiteralAcceptMode.Read;
     }
     else
     {
         // FIXME: Otherwise ignore it because sometimes, some bogus statements
         // like tmp := this occur.
     }
 }
Пример #9
0
 public void AcceptStore(StoreStatement stmt)
 {
     SimpleResult(stmt);
 }
Пример #10
0
 public void AddStore(StoreStatement store)
 {
     _stores.Add(store);
     AddExpression(store.Value);
 }
Пример #11
0
 public override void AcceptStore(StoreStatement stmt)
 {
     if (stmt.Container is Variable)
     {
         var key = Tuple.Create(_funStack.Peek(), stmt.Container);
         var var = _locals[key];
         Store(var, stmt.Value.Transform(this));
         CopyAttributesToLastStatement(stmt);
     }
     else
     {
         base.AcceptStore(stmt);
     }
 }
Пример #12
0
 public void AcceptStore(StoreStatement stmt)
 {
     Store(stmt.Container, stmt.Value);
 }
 public void AcceptStore(StoreStatement stmt)
 {
     IsEmpty = false;
 }
Пример #14
0
 public void AcceptStore(StoreStatement stmt)
 {
     Result = stmt;
 }
Пример #15
0
 public void AcceptStore(StoreStatement stmt)
 {
     Store(stmt.Container, stmt.Value);
 }
 public void AcceptStore(StoreStatement stmt)
 {
     Result = stmt;
 }
Пример #17
0
 public void AcceptStore(StoreStatement stmt)
 {
     SingleResult(GetAtomicSuccessor(stmt));
 }
 public void AcceptStore(StoreStatement stmt)
 {
     _result.Add(stmt);
 }
 public void AcceptStore(StoreStatement stmt)
 {
     SingleResult(GetAtomicSuccessor(stmt));
 }
Пример #20
0
 public void AcceptStore(StoreStatement stmt)
 {
     IsEmpty = false;
 }
Пример #21
0
        public void AcceptCompoundStatement(CompoundStatement stmt)
        {
            if (stmt.Statements.Count != 2)
            {
                return;
            }

            StoreStatement initializer = stmt.Statements[0] as StoreStatement;
            LoopBlock      loop        = stmt.Statements[1].AsWhileLoop();

            if (initializer == null || loop == null)
            {
                return;
            }

            IList <Statement> body = loop.Body.AsStatementList();

            if (body.Count == 0)
            {
                return;
            }

            StoreStatement step = body.Last() as StoreStatement;

            if (step == null)
            {
                return;
            }

            CompoundStatement newBody = new CompoundStatement();

            newBody.Statements.AddRange(body.Take(body.Count - 1));

            loop.Initializer = initializer;
            loop.Body        = newBody;
            loop.Step        = step;

            if (Level == EForLoopLevel.Strict ||
                Level == EForLoopLevel.StrictOneInc)
            {
                StoreStatement initStore = initializer;

                if (initStore.Container == null)
                {
                    return;
                }

                Variable counterVar = initStore.Container as Variable;
                if (counterVar == null)
                {
                    return;
                }

                loop.CounterVariable = counterVar;

                Type counterType = counterVar.Type.CILType;
                if (!counterType.IsEnumerable())
                {
                    return;
                }

                if (loop.Body.Modifies(counterVar))
                {
                    return;
                }

                loop.CounterStart = initStore.Value;

                if (step.Container == null)
                {
                    return;
                }

                if (!step.Container.Equals(counterVar))
                {
                    return;
                }

                Expression stepExpr = step.Value;

                Matching x       = new Matching();
                Matching mctr    = (LiteralReference)counterVar;
                Matching mctrInc = mctr + x;
                Matching mctrDec = mctr - x;
                if (((Expression.MatchFunction)mctrInc)(stepExpr))
                {
                    loop.CounterStep      = x.Result;
                    loop.CounterDirection = LoopBlock.ECounterDirection.Increment;
                }
                else if (((Expression.MatchFunction)mctrDec)(stepExpr))
                {
                    loop.CounterStep      = x.Result;
                    loop.CounterDirection = LoopBlock.ECounterDirection.Decrement;
                }
                else
                {
                    return;
                }

                BinOp cmp = loop.HeadCondition as BinOp;
                if (cmp == null)
                {
                    return;
                }

                LiteralReference lhs = cmp.Children[0] as LiteralReference;
                if (lhs == null)
                {
                    return;
                }
                if (!lhs.ReferencedObject.Equals(counterVar))
                {
                    return;
                }

                loop.CounterStop = cmp.Children[1];

                switch (loop.CounterDirection)
                {
                case LoopBlock.ECounterDirection.Decrement:
                    switch (cmp.Operation)
                    {
                    case BinOp.Kind.Gt:
                    case BinOp.Kind.NEq:
                        loop.CounterLimitKind = LoopBlock.ELimitKind.ExcludingStopValue;
                        break;

                    case BinOp.Kind.GtEq:
                        loop.CounterLimitKind = LoopBlock.ELimitKind.IncludingStopValue;
                        break;

                    default:
                        return;
                    }
                    break;

                case LoopBlock.ECounterDirection.Increment:
                    switch (cmp.Operation)
                    {
                    case BinOp.Kind.Lt:
                    case BinOp.Kind.NEq:
                        loop.CounterLimitKind = LoopBlock.ELimitKind.ExcludingStopValue;
                        break;

                    case BinOp.Kind.LtEq:
                        loop.CounterLimitKind = LoopBlock.ELimitKind.IncludingStopValue;
                        break;

                    default:
                        return;
                    }
                    break;
                }

                if (Level == EForLoopLevel.StrictOneInc)
                {
                    object inc;
                    try
                    {
                        inc = loop.CounterStep.Eval(new DefaultEvaluator());
                    }
                    catch (BreakEvaluationException)
                    {
                        return;
                    }
                    if (inc == null)
                    {
                        return;
                    }
                    long stepValue = TypeConversions.ToLong(inc);
                    if (stepValue == 1)
                    {
                        switch (loop.CounterDirection)
                        {
                        case LoopBlock.ECounterDirection.Increment:
                            loop.CounterDirection = LoopBlock.ECounterDirection.IncrementOne;
                            break;

                        case LoopBlock.ECounterDirection.Decrement:
                            loop.CounterDirection = LoopBlock.ECounterDirection.DecrementOne;
                            break;
                        }
                    }
                    else if (stepValue == -1)
                    {
                        switch (loop.CounterDirection)
                        {
                        case LoopBlock.ECounterDirection.Increment:
                            loop.CounterDirection = LoopBlock.ECounterDirection.DecrementOne;
                            break;

                        case LoopBlock.ECounterDirection.Decrement:
                            loop.CounterDirection = LoopBlock.ECounterDirection.IncrementOne;
                            break;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }

            Result = loop;
        }
Пример #22
0
 /// <summary>
 /// Transforms a "store" statement. The default implementation clones that statement.
 /// </summary>
 /// <param name="stmt">"store" statement</param>
 public virtual void AcceptStore(StoreStatement stmt)
 {
     if (stmt.Container is Literal)
         _tlit = (Literal)stmt.Container;
     stmt.Container.Accept(this);
     Store((IStorableLiteral)_tlit, stmt.Value.Transform(this));
     CopyAttributesToLastStatement(stmt);
 }
Пример #23
0
 public void AcceptStore(StoreStatement stmt)
 {
 }
Пример #24
0
 public void AcceptStore(StoreStatement stmt)
 {
     Check(stmt);
 }
Пример #25
0
 public void AcceptStore(StoreStatement stmt)
 {
 }
 public void AcceptStore(StoreStatement stmt)
 {
     RequireType(stmt.Container.Type, _design);
     stmt.Container.Accept(this);
     Resolve(stmt.Value);
 }
Пример #27
0
 public void AcceptStore(StoreStatement stmt)
 {
     _result.Add(stmt);
 }
Пример #28
0
 public void AcceptStore(StoreStatement stmt)
 {
     SimpleResult(stmt);
 }
Пример #29
0
 public void AcceptStore(StoreStatement stmt)
 {
     Check(stmt);
 }
 public void AcceptStore(StoreStatement stmt)
 {
     if (_variable.Equals(stmt.Container))
         Result = true;
 }