Exemplo n.º 1
0
        public void VpPhiWithConstants()
        {
            Constant   c1   = Constant.Word16(0x4711);
            Constant   c2   = Constant.Word16(0x4711);
            Identifier r1   = Reg16("r1");
            Identifier r2   = Reg16("r2");
            Identifier r3   = Reg16("r3");
            var        stm1 = new Statement(1, new Assignment(r1, c1), null);
            var        stm2 = new Statement(2, new Assignment(r2, c2), null);

            ssaIds[r1].DefStatement = stm1;
            ssaIds[r2].DefStatement = stm2;
            var         vp    = new ValuePropagator(arch, ssaIds, null);
            Instruction instr = new PhiAssignment(r3, new PhiFunction(r1.DataType, r1, r2));

            instr = instr.Accept(vp);
            Assert.AreEqual("r3 = 0x4711", instr.ToString());
        }
Exemplo n.º 2
0
        public void VpPhiWithConstants()
        {
            Constant   c1    = Constant.Word16(0x4711);
            Constant   c2    = Constant.Word16(0x4711);
            Identifier r1    = Reg16("r1");
            Identifier r2    = Reg16("r2");
            Identifier r3    = Reg16("r3");
            var        stm1  = new Statement(1, new Assignment(r1, c1), null);
            var        stm2  = new Statement(2, new Assignment(r2, c2), null);
            var        proc  = new Procedure("foo", arch.CreateFrame());
            var        ssa   = new SsaState(proc, null);
            var        r1Sid = ssa.Identifiers.Add(r1, null, null, false);
            var        r2Sid = ssa.Identifiers.Add(r2, null, null, false);

            r1Sid.DefStatement = stm1;
            r2Sid.DefStatement = stm2;
            var         vp    = new ValuePropagator(arch, ssa, listener);
            Instruction instr = new PhiAssignment(r3, new PhiFunction(r1.DataType, r1, r2));

            instr = instr.Accept(vp);
            Assert.AreEqual("r3 = 0x4711", instr.ToString());
        }
Exemplo n.º 3
0
 void InstructionVisitor.VisitPhiAssignment(PhiAssignment phi)
 {
     stms.Add(new AbsynLineComment(phi.ToString()));
 }
Exemplo n.º 4
0
 public void VpPhiWithConstants()
 {
     Constant c1 = Constant.Word16(0x4711);
     Constant c2 = Constant.Word16(0x4711);
     Identifier r1 = Reg16("r1");
     Identifier r2 = Reg16("r2");
     Identifier r3 = Reg16("r3");
     var stm1 = new Statement(1, new Assignment(r1, c1), null);
     var stm2 = new Statement(2, new Assignment(r2, c2), null);
     var proc = new Procedure("foo", arch.CreateFrame());
     var ssa = new SsaState(proc, null);
     var r1Sid = ssa.Identifiers.Add(r1, null, null, false);
     var r2Sid = ssa.Identifiers.Add(r2, null, null, false);
     r1Sid.DefStatement = stm1;
     r2Sid.DefStatement = stm2;
     var vp = new ValuePropagator(arch, ssa);
     Instruction instr = new PhiAssignment(r3, new PhiFunction(r1.DataType, r1, r2));
     instr = instr.Accept(vp);
     Assert.AreEqual("r3 = 0x4711", instr.ToString());
 }
Exemplo n.º 5
0
 void InstructionVisitor.VisitPhiAssignment(PhiAssignment phi)
 {
     stms.Add(new AbsynLineComment(phi.ToString()));
 }
Exemplo n.º 6
0
 public void VpPhiWithConstants()
 {
     Constant c1 = Constant.Word16(0x4711);
     Constant c2 = Constant.Word16(0x4711);
     Identifier r1 = Reg16("r1");
     Identifier r2 = Reg16("r2");
     Identifier r3 = Reg16("r3");
     var stm1 = new Statement(1, new Assignment(r1, c1), null);
     var stm2 = new Statement(2, new Assignment(r2, c2), null);
     ssaIds[r1].DefStatement = stm1;
     ssaIds[r2].DefStatement = stm2;
     var vp = new ValuePropagator(arch, ssaIds, null);
     Instruction instr = new PhiAssignment(r3, new PhiFunction(r1.DataType, r1, r2));
     instr = instr.Accept(vp);
     Assert.AreEqual("r3 = 0x4711", instr.ToString());
 }