Ejemplo n.º 1
0
		public void LciInsertAssignmentLiveLoop()
		{
			Build(new LiveLoopMock().Procedure, MkArch());
			var lci = new LiveCopyInserter(ssa);

            var i_3 = ssaIds.Where(s => s.Identifier.Name == "i_3").Single();
			var idNew = lci.InsertAssignmentNewId(i_3.Identifier, proc.ControlGraph.Blocks[2], 2);
			Assert.AreEqual("i_7 = i_3", proc.ControlGraph.Blocks[2].Statements[2].Instruction.ToString());
			Assert.AreSame(proc.ControlGraph.Blocks[2].Statements[2], ssaIds[idNew].DefStatement);
		}
Ejemplo n.º 2
0
        public void LciRenameDominatedIdentifiers()
        {
            Build(new LiveLoopMock().Procedure, new FakeArchitecture());
            var lci   = new LiveCopyInserter(proc, ssaIds);
            var i_1   = ssaIds.Where(s => s.Identifier.Name == "i_1").Single();
            var idNew = lci.InsertAssignmentNewId(i_1.Identifier, proc.ControlGraph.Blocks[2], 2);

            lci.RenameDominatedIdentifiers(i_1, ssaIds[idNew]);
            Assert.AreEqual("return i_5", proc.ControlGraph.Blocks[2].ElseBlock.Statements[0].Instruction.ToString());
        }
Ejemplo n.º 3
0
		public void LciInsertAssignmentCopy()
		{
			Build(new LiveCopyMock().Procedure, MkArch());
			var lci = new LiveCopyInserter(ssa);

			int i = lci.IndexOfInsertedCopy(proc.ControlGraph.Blocks[2]);
			Assert.AreEqual(i, 0);
            var idNew = lci.InsertAssignmentNewId(ssaIds.Where(s => s.Identifier.Name == "reg").Single().Identifier, proc.ControlGraph.Blocks[2], i);
            Assert.AreEqual("reg_6 = reg", proc.ControlGraph.Blocks[2].Statements[0].Instruction.ToString());
            Assert.AreSame(proc.ControlGraph.Blocks[2].Statements[0], ssaIds[idNew].DefStatement);
		}