Пример #1
0
 public static bool Find(IEnumerable <SsaIdentifier> sids)
 {
     foreach (var sid in sids)
     {
         if (sid.DefStatement != null)
         {
             var odf = new OutDefinitionFinder(sid.Identifier);
             sid.DefStatement.Instruction.Accept(odf);
             if (odf.usedAsOutArgument)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Пример #2
0
        public void InsertDeclarations()
        {
            var deci = new DeclarationInserter(ssaIds, doms);

            foreach (Web web in this.webs)
            {
                bool isLive           = web.Uses.Count > 0;
                bool isOnlyUsedByPhis = web.Uses.All(u => u.Instruction is PhiAssignment);
                bool isMemoryId       = web.Identifier is MemoryIdentifier;
                if (isLive && !isOnlyUsedByPhis && !isMemoryId)
                {
                    deci.InsertDeclaration(web);
                }
                else
                {
                    var isDefinedByOutArg = OutDefinitionFinder.Find(web.Members);
                    if (isDefinedByOutArg)
                    {
                        deci.InsertDeclaration(web);
                    }
                }
            }
        }