示例#1
0
        public void VpMkSequenceToAddress()
        {
            Constant seg = Constant.Create(PrimitiveType.SegmentSelector, 0x4711);
            Constant off = Constant.Word16(0x4111);
            arch.Expect(a => a.MakeSegmentedAddress(seg, off)).Return(Address.SegPtr(0x4711, 0x4111));
            mr.ReplayAll();

            Expression e = new MkSequence(PrimitiveType.Word32, seg, off);
            var vp = new ExpressionSimplifier(new SsaEvaluationContext(arch, ssaIds));
            e = e.Accept(vp);
            Assert.IsInstanceOf(typeof(Address), e);
            Assert.AreEqual("4711:4111", e.ToString());

            mr.VerifyAll();
        }
示例#2
0
		public void VisitMkSequence(MkSequence seq)
		{
			writer.Write("SEQ(");
			WriteExpression(seq.Head);
			writer.Write(", ");
			WriteExpression(seq.Tail);
			writer.Write(")");
		}
示例#3
0
		public void VpSequenceOfConstants()
		{
			Constant pre = Constant.Word16(0x0001);
			Constant fix = Constant.Word16(0x0002);
			Expression e = new MkSequence(PrimitiveType.Word32, pre, fix);
            var vp = new ExpressionSimplifier(new SsaEvaluationContext(arch, ssaIds));
			e = e.Accept(vp);
			Assert.AreEqual("0x00010002", e.ToString());
		}
 public void VisitMkSequence(MkSequence seq)
 {
     throw new NotImplementedException();
 }
示例#5
0
 public void VpMkSequenceToAddress()
 {
     Constant seg = Constant.Create(PrimitiveType.SegmentSelector, 0x4711);
     Constant off = Constant.Word16(0x4111);
     Expression e = new MkSequence(PrimitiveType.Word32, seg, off);
     var vp = new ExpressionSimplifier(new SsaEvaluationContext(ssaIds));
     e = e.Accept(vp);
     Assert.IsInstanceOf(typeof(Address), e);
     Assert.AreEqual("4711:4111", e.ToString());
 }
示例#6
0
 public void VisitMkSequence(MkSequence seq)
 {
     VisitBinaryExpression(Operator.IAdd, seq.DataType, seq.Head, seq.Tail);
 }
示例#7
0
 public override void VisitMkSequence(MkSequence seq)
 {
     seq.Head.Accept(this);
     seq.Tail.Accept(this);
     EnsureTypeVariable(seq);
 }
示例#8
0
        public Expression VisitMkSequence(MkSequence seq)
        {
            var newSeq = seq.Expressions.Select(e => e.Accept(this)).ToArray();

            return(new MkSequence(seq.DataType, newSeq));
        }
 public override Expression VisitMkSequence(MkSequence seq)
 {
     var head = seq.Head.Accept(this);
     var tail = seq.Tail.Accept(this);
     Constant c = seq.Tail as Constant;
     var ptHead = head.TypeVariable.DataType as PrimitiveType;
     if (head.TypeVariable.DataType is Pointer || (ptHead != null && ptHead.Domain == Domain.Selector))
     {
         if (c != null)
         {
             ComplexExpressionBuilder ceb = new ComplexExpressionBuilder(
                 seq.TypeVariable.DataType,
                 head.TypeVariable.DataType,
                 head.TypeVariable.OriginalDataType,
                 null,
                 head,
                 null,
                 StructureField.ToOffset(c));
             return ceb.BuildComplex();
         }
         else
         {
             var ceb = new ComplexExpressionBuilder(
                 seq.TypeVariable.DataType,
                 seq.TypeVariable.DataType,
                 seq.TypeVariable.OriginalDataType,
                 head,
                 new MemberPointerSelector(seq.DataType, head, tail),
                 null,
                 0);
             return ceb.BuildComplex();
         }
     }
     else
     {
     }
     return new MkSequence(seq.DataType, head, tail);
 }
示例#10
0
 void IExpressionVisitor.VisitMkSequence(MkSequence seq)
 {
     Method("Seq");
     WriteExpressions(seq.Expressions);
     writer.Write(")");
 }
示例#11
0
 void IExpressionVisitor.VisitMkSequence(MkSequence seq)
 {
     throw new NotImplementedException();
 }
示例#12
0
 public void VisitMkSequence(MkSequence seq)
 {
     VisitBinaryExpression(Operator.IAdd, seq.DataType, seq.Head, seq.Tail);
 }
示例#13
0
            public bool VisitMkSequence(MkSequence seq)
            {
                var dead = seq.Expressions.All(e => e.Accept(this));

                return(dead);
            }
 public override Expression VisitMkSequence(MkSequence seq)
 {
     var head = Rewrite(seq.Head, false);
     var tail = Rewrite(seq.Tail, false);
     Constant c = seq.Tail as Constant;
     var ptHead = DataTypeOf(head) as PrimitiveType;
     if (head.TypeVariable.DataType is Pointer || (ptHead != null && ptHead.Domain == Domain.Selector))
     {
         if (c != null)
         {
             return RewriteComplexExpression(head, null, c.ToInt32(), dereferenced);
         }
         else
         {
             var oldBase = this.basePtr;
             this.basePtr = head;
             Expression exp = RewriteComplexExpression(
                 tail,
                 null,
                 0,
                 dereferenced);
             this.basePtr = oldBase;
             return exp;
         }
     }
     else
     {
     }
     return new MkSequence(seq.DataType, head, tail);
 }
示例#15
0
		public override void VisitMkSequence(MkSequence seq)
		{
			seq.Head.Accept(this);
			seq.Tail.Accept(this);
			EnsureTypeVariable(seq);
		}
示例#16
0
 public virtual void VisitMkSequence(MkSequence seq)
 {
     seq.Head.Accept(this);
     seq.Tail.Accept(this);
 }
示例#17
0
		public Expression Transform(Expression baseptr, DataType dtAccess)
		{
            if (baseptr != null)
            {
                ArrayPointer = new MkSequence(dtPointer, baseptr, ArrayPointer);
            }
			return new ArrayAccess(
                dtAccess, 
                ArrayPointer,
                new BinaryExpression(
                    BinaryOperator.IMul, 
                    Index.DataType,
                    Index,
                    ElementSize));
		}
示例#18
0
 public BitRange VisitMkSequence(MkSequence seq)
 {
     return(seq.Expressions.Aggregate(
                BitRange.Empty, (range, e) => range | e.Accept(this)));
 }
示例#19
0
		public virtual void VisitMkSequence(MkSequence seq)
		{
			seq.Head.Accept(this);
			seq.Tail.Accept(this);
		}
示例#20
0
 public bool VisitMkSequence(MkSequence seq) =>
 seq.Expressions.Any(e => e.Accept(this));