Exemplo n.º 1
0
        public void DeadComment()
        {
            var dead = m.Reg16("dead");

            m.Comment("This is a comment");
            m.Assign(dead, m.Word16(0xDEAD));

            EliminateDeadCode();

            var sExp =
                @"
// This is a comment
";

            AssertProcedureCode(sExp);
        }
Exemplo n.º 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);
        }