예제 #1
0
		public void DeciWeb()
		{
			Build(new DiamondMock().Procedure);
			DeclarationInserter deci = new DeclarationInserter(ssaIds, doms);
			Web web = new Web();
			SsaIdentifier r_1 = ssaIds.Where(s => s.Identifier.Name == "r_1").Single();
            SsaIdentifier r_3 = ssaIds.Where(s => s.Identifier.Name == "r_3").Single();
            SsaIdentifier r_4 = ssaIds.Where(s => s.Identifier.Name == "r_4").Single();
			web.Add(r_1);
			web.Add(r_3);
			web.Add(r_4);
			deci.InsertDeclaration(web);
			Assert.AreEqual("word32 r_1", proc.ControlGraph.Blocks[2].Statements[0].Instruction.ToString());
		}
예제 #2
0
        public void DeciWeb()
        {
            Build(new DiamondMock().Procedure);
            DeclarationInserter deci = new DeclarationInserter(ssaIds, doms);
            Web           web        = new Web();
            SsaIdentifier r_1        = ssaIds.Where(s => s.Identifier.Name == "r_1").Single();
            SsaIdentifier r_3        = ssaIds.Where(s => s.Identifier.Name == "r_3").Single();
            SsaIdentifier r_4        = ssaIds.Where(s => s.Identifier.Name == "r_4").Single();

            web.Add(r_1);
            web.Add(r_3);
            web.Add(r_4);
            deci.InsertDeclaration(web);
            Assert.AreEqual("word32 r_1", proc.ControlGraph.Blocks[2].Statements[0].Instruction.ToString());
        }
예제 #3
0
		private void BuildWebOf()
		{
            this.webOf = new Dictionary<Identifier, Web>();
			foreach (SsaIdentifier sid in ssaIds)
			{
				Web w = new Web();
				w.Add(sid);
				webOf[sid.Identifier] = w;
				webs.Add(w);
			}
		}
예제 #4
0
		private void Merge(Web a, Web b)
		{
			Web c = new Web();
			foreach (SsaIdentifier sid in a.Members)
			{
				c.Add(sid);
				webOf[sid.Identifier] = c;
				foreach (Statement u in a.Uses)
					if (!c.Uses.Contains(u))
						c.Uses.Add(u);
			}
			foreach (SsaIdentifier sid in b.Members)
			{
				c.Add(sid);
				webOf[sid.Identifier] = c;
				foreach (Statement u in b.Uses)
					if (!c.Uses.Contains(u))
						c.Uses.Add(u);
			}
			webs.Remove(a);
			webs.Remove(b);
			webs.Add(c);
		}