public void FPUG_ExtractReturnFromFpuStack()
        {
            var top_1   = m.Reg("FakeTop_1", Top);
            var top_2   = m.Reg("FakeTop_2", Top);
            var top_3   = m.Reg("FakeTop_3", Top);
            var a       = m.Reg64("a");
            var f       = m.Reg32("f");
            var uses    = new Identifier[] { top_1 };
            var defines = new Identifier[] { top_2 };

            m.Call(f, 4, uses, defines);
            m.Assign(a, MemST(top_2));
            m.Assign(top_3, m.IAddS(top_2, 1));

            RunFpuStackReturnGuesser();

            var expected =
                @"
call f (retsize: 4;)
	uses: Top:FakeTop_1
	defs: FPU -1:rRet0
FakeST8[FakeTop_1 - 1<8>:real64] = rRet0
FakeTop_2 = FakeTop_1 - 1<i8>
a = FakeST[FakeTop_2:real64]
FakeTop_3 = FakeTop_2 + 1<i8>
";

            AssertProcedureCode(expected);
        }
예제 #2
0
        public void CoaIdentifier()
        {
            var a = m.Reg32("a");
            var b = m.Reg32("b");
            var c = m.Reg32("c");

            m.Assign(a, b);
            m.Assign(c, m.IAddS(a, 1));

            RunCoalescer();

            var sExp =
                @"
c = b + 1<i32>
";

            AssertProcedureCode(sExp);
        }