Пример #1
0
        public void VpUndoSlicingOfSegmentPointerCheckUses()
        {
            var es      = m.Reg16("es");
            var es_2    = m.Reg16("es_2");
            var bx      = m.Reg16("bx");
            var bx_3    = m.Reg16("bx_3");
            var bx_4    = m.Reg16("bx_4");
            var es_bx_1 = m.Reg32("es_bx_1");

            m.Store(m.SegMem(PrimitiveType.Byte, es, m.IAdd(bx, 4)), m.Byte(3));
            m.Assign(es_bx_1, m.SegMem(PrimitiveType.Word32, es, bx));
            m.Assign(es_2, m.Slice(PrimitiveType.Word16, es_bx_1, 16));
            m.Assign(bx_3, m.Cast(PrimitiveType.Word16, es_bx_1));
            var instr = m.Assign(bx_4, m.SegMem(PrimitiveType.Word16, es_2, m.IAdd(bx_3, 4)));

            RunValuePropagator();
            Assert.AreEqual("bx_4 = Mem8[es_bx_1 + 0x0004:word16]", instr.ToString());
        }
Пример #2
0
        public void VpDpbPhi()
        {
            var d3       = m.Reg32("d3", 3);
            var wLoc02_2 = m.Local16("wLoc02_2");
            var d3_3     = m.Reg32("d3_3", 3);
            var d3_4     = m.Reg32("d3_4", 3);
            var d3_5     = m.Reg32("d3_5", 3);
            var d3_6     = m.Reg32("d3_6", 3);

            m.Assign(wLoc02_2, m.Cast(PrimitiveType.Word16, d3));
            m.Label("m1");
            m.Assign(d3_3, m.Dpb(d3, m.Word16(3), 0));
            m.Goto("m3");
            m.Label("m2");
            m.Assign(d3_4, m.Dpb(d3, m.Word16(4), 0));
            m.Label("m3");
            m.Phi(d3_5, (d3_3, "m1"), (d3_4, "m2"));
            m.Assign(d3_6, m.Dpb(d3_5, wLoc02_2, 0));

            RunValuePropagator();

            var sExp =
                #region Expected
                @"d3: orig: d3
    uses: wLoc02_2 = (word16) d3
          d3_3 = SEQ(SLICE(d3, word16, 16), 3<16>)
          d3_4 = SEQ(SLICE(d3, word16, 16), 4<16>)
wLoc02_2: orig: wLoc04
    def:  wLoc02_2 = (word16) d3
    uses: d3_6 = SEQ(SLICE(d3_5, word16, 16), wLoc02_2)
d3_3: orig: d3_3
    def:  d3_3 = SEQ(SLICE(d3, word16, 16), 3<16>)
    uses: d3_5 = PHI((d3_3, m1), (d3_4, m2))
d3_4: orig: d3_4
    def:  d3_4 = SEQ(SLICE(d3, word16, 16), 4<16>)
    uses: d3_5 = PHI((d3_3, m1), (d3_4, m2))
d3_5: orig: d3_5
    def:  d3_5 = PHI((d3_3, m1), (d3_4, m2))
    uses: d3_6 = SEQ(SLICE(d3_5, word16, 16), wLoc02_2)
d3_6: orig: d3_6
    def:  d3_6 = SEQ(SLICE(d3_5, word16, 16), wLoc02_2)
// SsaProcedureBuilder
// Return size: 0
define SsaProcedureBuilder
SsaProcedureBuilder_entry:
	// succ:  l1
l1:
	wLoc02_2 = (word16) d3
	// succ:  m1
m1:
	d3_3 = SEQ(SLICE(d3, word16, 16), 3<16>)
	goto m3
	// succ:  m3
m2:
	d3_4 = SEQ(SLICE(d3, word16, 16), 4<16>)
	// succ:  m3
m3:
	d3_5 = PHI((d3_3, m1), (d3_4, m2))
	d3_6 = SEQ(SLICE(d3_5, word16, 16), wLoc02_2)
SsaProcedureBuilder_exit:
";

            #endregion
            AssertStringsEqual(sExp, m.Ssa);
        }