Example #1
0
        public void Transform()
        {
            try
            {
                new LiveCopyInserter(ssa).Transform();
                BuildWebOf();

                foreach (SsaIdentifier id in ssaIds)
                {
                    if (id.DefStatement != null && !(id.Identifier is MemoryIdentifier))
                    {
                        VisitStatement(id.DefStatement);
                    }
                }

                InsertDeclarations();

                WebReplacer replacer = new WebReplacer(this);
                foreach (Block bl in ssa.Procedure.ControlGraph.Blocks)
                {
                    for (int i = bl.Statements.Count - 1; i >= 0; --i)
                    {
                        Statement stm = bl.Statements[i];
                        stm.Instruction = stm.Instruction.Accept(replacer);
                        if (stm.Instruction == null)
                        {
                            bl.Statements.RemoveAt(i);
                        }
                    }
                }

                foreach (Web w in webs)
                {
                    if (w.InductionVariable != null)
                    {
                        ivs.Add(w.Identifier, w.InductionVariable);
                    }
                }
            }
            catch (Exception ex)
            {
                listener.Error(
                    listener.CreateProcedureNavigator(program, ssa.Procedure),
                    ex,
                    "An error occurred while renaming variables.");
            }
        }
Example #2
0
        public void Transform()
        {
            new LiveCopyInserter(proc, ssaIds).Transform();
            BuildWebOf();

            foreach (SsaIdentifier id in ssaIds)
            {
                if (id.DefStatement != null && !(id.Identifier is MemoryIdentifier))
                {
                    VisitStatement(id.DefStatement);
                }
            }

            InsertDeclarations();

            WebReplacer replacer = new WebReplacer(this);

            foreach (Block bl in proc.ControlGraph.Blocks)
            {
                for (int i = bl.Statements.Count - 1; i >= 0; --i)
                {
                    Statement stm = bl.Statements[i];
                    stm.Instruction = stm.Instruction.Accept(replacer);
                    if (stm.Instruction == null)
                    {
                        bl.Statements.RemoveAt(i);
                    }
                }
            }

            foreach (Web w in webs)
            {
                if (w.InductionVariable != null)
                {
                    ivs.Add(w.Identifier, w.InductionVariable);
                }
            }
        }
Example #3
0
		public void Transform()
		{
			new LiveCopyInserter(proc, ssaIds).Transform();
			BuildWebOf();

			foreach (SsaIdentifier id in ssaIds)
			{
				if (id.DefStatement != null && !(id.Identifier is MemoryIdentifier))
					VisitStatement(id.DefStatement);
			}

			InsertDeclarations();

			WebReplacer replacer = new WebReplacer(this);
			foreach (Block bl in proc.ControlGraph.Blocks)
			{
				for (int i = bl.Statements.Count - 1; i >= 0; --i)
				{
					Statement stm = bl.Statements[i];
					stm.Instruction = stm.Instruction.Accept(replacer);
					if (stm.Instruction == null)
					{
						bl.Statements.RemoveAt(i);
					}
				}
			}

			foreach (Web w in webs)
			{
				if (w.InductionVariable != null)
				{
					ivs.Add(w.Identifier, w.InductionVariable);
				}
			}
		}