EnsureSequence() public method

public EnsureSequence ( System.IO.Storage head, System.IO.Storage tail, DataType dt ) : Identifier
head System.IO.Storage
tail System.IO.Storage
dt DataType
return Identifier
コード例 #1
0
ファイル: FrameTests.cs プロジェクト: gitter-badger/reko
		public void SequenceTest()
		{
			IntelArchitecture arch = new IntelArchitecture(ProcessorMode.Real);
			Frame f = new Frame(PrimitiveType.Word16);
			Identifier ax = f.EnsureRegister(Registers.ax);
			Identifier dx = f.EnsureRegister(Registers.dx);
			Identifier dxax = f.EnsureSequence(dx, ax, PrimitiveType.Word32);

			using (FileUnitTester fut = new FileUnitTester("Core/SequenceTest.txt"))
			{
				f.Write(fut.TextWriter);
				fut.AssertFilesEqual();
			}

			Identifier dxax2 = f.EnsureSequence(dx,ax, PrimitiveType.Word32);
			Assert.IsTrue(dxax2 == dxax);
		}
コード例 #2
0
ファイル: ArmProcedureSerializer.cs プロジェクト: uxmal/reko
        public override FunctionType Deserialize(SerializedSignature ss, Frame frame)
        {
            int ncrn = 0;
            int nsaa = 0;
            // mem arg forb ret val

            var argser = new ArgumentDeserializer(
               this,
               Architecture,
               frame,
               Architecture.PointerType.Size,
               Architecture.WordWidth.Size);

            Identifier ret = null;
            if (ss.ReturnValue != null)
            {
                ret = argser.DeserializeReturnValue(ss.ReturnValue);
            }

            var args = new List<Identifier>();
            if (ss.Arguments != null)
            {
                foreach (var sArg in ss.Arguments)
                {
                    var dt = sArg.Type.Accept(TypeLoader);
                    var sizeInWords = (dt.Size + 3) / 4;

                    if (sizeInWords == 2 && (ncrn & 1) == 1)
                        ++ncrn;
                    Identifier arg;
                    if (sizeInWords <= 4 - ncrn)
                    {
                        if (sizeInWords == 2)
                        {
                            arg = frame.EnsureSequence(
                                Architecture.GetRegister(argRegs[ncrn]),
                                Architecture.GetRegister(argRegs[ncrn + 1]),
                                dt);
                            ncrn += 2;
                        }
                        else
                        {
                            arg = frame.EnsureRegister(
                                Architecture.GetRegister(argRegs[ncrn]));
                            ncrn += 1;
                        }
                    }
                    else
                    {
                        arg = frame.EnsureStackArgument(nsaa, dt);
                        nsaa += AlignedStackArgumentSize(dt);
                    }
                    args.Add(arg);
                }
            }
            return new FunctionType(ret, args.ToArray());
        }
コード例 #3
0
ファイル: ApplicationBuilder.cs プロジェクト: Godzil/reko
        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.");
        }
コード例 #4
0
ファイル: FrameTests.cs プロジェクト: gitter-badger/reko
		public void FrSequenceAccess()
		{
			Frame f = new Frame(PrimitiveType.Word16);
			Identifier ax = f.EnsureRegister(Registers.ax);
			Identifier dx = f.EnsureRegister(Registers.dx);
			Identifier dx_ax = f.EnsureSequence(dx, ax, PrimitiveType.Word32);
			SequenceStorage vDx_ax = (SequenceStorage) dx_ax.Storage;
			using (FileUnitTester fut = new FileUnitTester("Core/FrSequenceAccess.txt"))
			{
				f.Write(fut.TextWriter);
				fut.TextWriter.WriteLine("Head({0}) = {1}", dx_ax.Name, vDx_ax.Head.Name);
				fut.TextWriter.WriteLine("Tail({0}) = {1}", dx_ax.Name, vDx_ax.Tail.Name);

				fut.AssertFilesEqual();
			}
		}