Ejemplo n.º 1
0
        private bool HasAnyCommonLoops(IExpression expr, IExpression expr2)
        {
            List <IStatement> targetLoops = Containers.GetLoopsNeededForExpression(context, expr, -1, false);
            List <IStatement> indexLoops  = Containers.GetLoopsNeededForExpression(context, expr2, -1, false);

            return(indexLoops.Any(loop => Containers.ListContains(targetLoops, loop)));
        }
Ejemplo n.º 2
0
        private bool AreLoopsDisjoint(IForStatement loop, IExpression expr, IExpression expr2)
        {
            List <IStatement> targetLoops = Containers.GetLoopsNeededForExpression(context, expr, -1, false);
            List <IStatement> indexLoops  = Containers.GetLoopsNeededForExpression(context, expr2, -1, false);
            Set <IStatement>  parentLoops = new Set <IStatement>();

            parentLoops.AddRange(targetLoops);
            parentLoops.AddRange(indexLoops);
            if (Containers.ListContains(parentLoops, loop))
            {
                // expression has the form array[k][indices[k]] or array[indices[k][k]]
                return(false);
            }
            return(true);
        }