Example #1
0
        public static List <Identifier> Find(SsaIdentifierCollection ssaIds, Expression exp)
        {
            var inst = new UsedIdentifierFinder(ssaIds);

            exp.Accept(inst);
            return(inst.identifiers);
        }
Example #2
0
        public bool IsUsedInPhi(Identifier id)
        {
            var src = ssaIds[id].DefStatement;

            if (src == null)
            {
                return(false);
            }
            var assSrc = src.Instruction as Assignment;

            if (assSrc == null)
            {
                return(false);
            }
            new DefinedIdentifierFinder();
            return(UsedIdentifierFinder.Find(ssaIds, assSrc.Src)
                   .Select(c => ssaIds[c].DefStatement)
                   .Where(d => d != null)
                   .Select(ph => ph.Instruction as PhiAssignment)
                   .Where(ph => ph != null)
                   .Any());
            //.SelectMany(ph => ssaIds[ph.Ops].DefStatement)
            //.Where(opDef => IsOverwriting(opDef) &&
            //    ( (opDef == src ||
            //        PathFromTo(src, opDef) && PathFromTo(opDef, src))))
            //.Any();

            /*
             * function shouldPropagateInto(r )
             * src := the assignment dening r
             * for each subscripted component c of the RHS of r
             * if the denition for c is a phi-function ph then
             * for each operand op of ph
             * opdef := the denition for op
             * if opdef is an overwriting statement and either
             * (opdef = src) or
             * (there exists a CFG path from src to opdef and
             * from opdef to the statement containing r ) then
             * return false
             */
        }
Example #3
0
 public static List<Identifier> Find(SsaIdentifierCollection ssaIds, Expression exp)
 {
     var inst = new UsedIdentifierFinder(ssaIds);
     exp.Accept(inst);
     return inst.identifiers;
 }