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)); }
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."); }
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); }
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."); }
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); }
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); }
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); }
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); }
public void AddSequenceArgument(SequenceStorage seq) { AddInParam(binder.EnsureSequence(seq.DataType, seq.Elements)); }
Identifier StorageVisitor <Identifier> .VisitSequenceStorage(SequenceStorage seq) { return(EnsureSequence(seq.Head, seq.Tail, PrimitiveType.CreateWord((int)seq.BitSize / 8))); }
Identifier StorageVisitor <Identifier> .VisitSequenceStorage(SequenceStorage seq) { return(EnsureSequence(PrimitiveType.CreateWord((int)seq.BitSize), seq.Elements)); }
public void SequenceReturn(SequenceStorage seq) { this.Return = seq; }
public void SequenceParam(SequenceStorage seq) { this.Parameters.Add(seq); }