示例#1
0
        public override bool Equals(object obj)
        {
            SequenceStorage ss = obj as SequenceStorage;

            if (ss == null)
            {
                return(false);
            }
            return(Head.Equals(ss.Head) && Tail.Equals(ss.Tail));
        }
示例#2
0
        public Expression VisitSequenceStorage(SequenceStorage seq)
        {
            var exps = seq.Elements.Select(e => e.Accept(this) as Identifier).ToArray();

            if (exps.All(e => e != null))
            {
                return(binder.EnsureSequence(seq.DataType, exps.Select(i => i !.Storage).ToArray()));
            }
            throw new NotImplementedException("Handle case when stack parameter is passed.");
        }
示例#3
0
文件: Frame.cs 项目: feelworld/reko
 public Identifier FindSequence(Identifier n1, Identifier n2)
 {
     foreach (Identifier id in identifiers)
     {
         SequenceStorage seq = id.Storage as SequenceStorage;
         if (seq != null && seq.Head == n1 && seq.Tail == n2)
         {
             return(id);
         }
     }
     return(null);
 }
示例#4
0
        public Expression VisitSequenceStorage(SequenceStorage seq)
        {
            var h      = seq.Head.Storage.Accept(this);
            var t      = seq.Tail.Storage.Accept(this);
            var idHead = h as Identifier;
            var idTail = t as Identifier;

            if (idHead != null && idTail != null)
            {
                return(frame.EnsureSequence(idHead, idTail, PrimitiveType.CreateWord(idHead.DataType.Size + idTail.DataType.Size)));
            }
            throw new NotImplementedException("Handle case when stack parameter is passed.");
        }
示例#5
0
        public Identifier EnsureSequence(DataType dataType, string name, params Storage [] elements)
        {
            if (this.seqs.TryGetValue(elements, out var idSeq))
            {
                return(idSeq);
            }
            var seq = new SequenceStorage(name, dataType, elements);
            var id  = Identifier.Create(seq);

            seqs.Add(seq.Elements, id);
            ids.Add(id);
            return(id);
        }
示例#6
0
        public Identifier EnsureSequence(DataType dataType, params Storage [] elements)
        {
            var stg = new SequenceStorage(elements);

            if (this.seqs.TryGetValue(elements, out var idSeq))
            {
                return(idSeq);
            }
            var name = string.Join("_", elements.Select(e => e.Name));
            var seq  = new SequenceStorage(dataType, elements);
            var id   = new Identifier(name, dataType, seq);

            seqs.Add(seq.Elements, id);
            ids.Add(id);
            return(id);
        }
示例#7
0
        public Identifier EnsureSequence(string name, Storage head, Storage tail, DataType dataType)
        {
            if (!this.seqs.TryGetValue(head, out var seqs))
            {
                seqs = new Dictionary <Storage, Identifier>();
                this.seqs.Add(head, seqs);
            }
            if (seqs.TryGetValue(tail, out var id))
            {
                return(id);
            }
            var seq = new SequenceStorage(name, head, tail, dataType);

            id = new Identifier(name, dataType, seq);
            seqs.Add(tail, id);
            ids.Add(id);
            return(id);
        }
示例#8
0
        public Identifier EnsureSequence(Storage head, Storage tail, DataType dataType)
        {
            Identifier id;
            Dictionary <Storage, Identifier> seqs;

            if (!this.seqs.TryGetValue(head, out seqs))
            {
                seqs = new Dictionary <Storage, Identifier>();
                this.seqs.Add(head, seqs);
            }
            if (seqs.TryGetValue(tail, out id))
            {
                return(id);
            }
            var seq = new SequenceStorage(head, tail);

            id = new Identifier(string.Format("{0}_{1}", head.Name, tail.Name), dataType, seq);
            seqs.Add(tail, id);
            ids.Add(id);
            return(id);
        }
示例#9
0
 public void AddSequenceArgument(SequenceStorage seq)
 {
     AddInParam(binder.EnsureSequence(seq.DataType, seq.Elements));
 }
示例#10
0
 Identifier StorageVisitor <Identifier> .VisitSequenceStorage(SequenceStorage seq)
 {
     return(EnsureSequence(seq.Head, seq.Tail, PrimitiveType.CreateWord((int)seq.BitSize / 8)));
 }
示例#11
0
 Identifier StorageVisitor <Identifier> .VisitSequenceStorage(SequenceStorage seq)
 {
     return(EnsureSequence(PrimitiveType.CreateWord((int)seq.BitSize), seq.Elements));
 }
示例#12
0
 public void SequenceReturn(SequenceStorage seq)
 {
     this.Return = seq;
 }
示例#13
0
 public void SequenceParam(SequenceStorage seq)
 {
     this.Parameters.Add(seq);
 }