Exemple #1
0
        public Instruction VisitStore(Store store)
        {
            var src = store.Src.Accept(this);
            var dst = store.Dst.Accept(this);

            var m = dst.PropagatedExpression as MemoryAccess;

            if (m != null)
            {
                ctx.SetValueEa(m.EffectiveAddress, src.Value);
            }
            else
            {
                var sm = dst.PropagatedExpression as SegmentedAccess;
                if (sm != null)
                {
                    ctx.SetValueEa(sm.BasePointer, sm.EffectiveAddress, src.Value);
                }
            }

            var idDst = dst.PropagatedExpression as Identifier;

            if (idDst != null)
            {
                return(new Assignment(idDst, src.PropagatedExpression));
            }
            else if (!(dst.PropagatedExpression is Constant))
            {
                return(new Store(dst.PropagatedExpression, src.PropagatedExpression));
            }
            else
            {
                return(new Store(store.Dst, src.PropagatedExpression));
            }
        }
Exemple #2
0
        public Instruction VisitStore(Store store)
        {
            var src = store.Src.Accept(this);

            this.storing = true;
            var dst = store.Dst.Accept(this);

            this.storing = false;

            switch (dst.PropagatedExpression)
            {
            case SegmentedAccess sm:
                ctx.SetValueEa(sm.BasePointer, sm.EffectiveAddress, src.Value);
                break;

            case MemoryAccess m:
                ctx.SetValueEa(m.EffectiveAddress, src.Value);
                break;
            }

            var idDst = dst.PropagatedExpression as Identifier;

            if (idDst != null)
            {
                ctx.SetValue(idDst, src.Value);
                return(new Assignment(idDst, src.PropagatedExpression));
            }
            else if (!(dst.PropagatedExpression is Constant))
            {
                return(new Store(dst.PropagatedExpression, src.PropagatedExpression));
            }
            else
            {
                return(new Store(store.Dst, src.PropagatedExpression));
            }
        }