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); }
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); } } } }