private void ConstructAnnotationDependenceGraph()
        {
            if (CommandLineOptions.Clo.Trace)
            {
                Console.WriteLine("Annotation dependence analysis: Building dependence graph");
            }

            IAnnotationReachabilityChecker reachabilityChecker;

            if (CommandLineOptions.Clo.StagedHoudiniReachabilityAnalysis)
            {
                reachabilityChecker = new AnnotationReachabilityChecker(prog, AllAnnotationIdentifiers());
            }
            else
            {
                reachabilityChecker = new DummyAnnotationReachabilityChecker();
            }

            AnnotationDependences = new Graph <string>();
            foreach (var c in AllAnnotationIdentifiers())
            {
                AnnotationDependences.AddEdge(c, c);
                foreach (var vd in annotationDependsOn[c])
                {
                    if (variableDirectlyReferredToByAnnotations.ContainsKey(vd))
                    {
                        foreach (var d in variableDirectlyReferredToByAnnotations[vd])
                        {
                            if (reachabilityChecker.MayReach(d, c))
                            {
                                AnnotationDependences.AddEdge(c, d);
                            }
                        }
                    }
                }
            }

            if (CommandLineOptions.Clo.StagedHoudiniMergeIgnoredAnnotations)
            {
                MergeIgnoredAnnotations();
            }
        }
Ejemplo n.º 2
0
    private void ConstructAnnotationDependenceGraph()
    {
      if (CommandLineOptions.Clo.Trace)
      {
        Console.WriteLine("Annotation dependence analysis: Building dependence graph");
      }

      IAnnotationReachabilityChecker reachabilityChecker;
      
      if(CommandLineOptions.Clo.StagedHoudiniReachabilityAnalysis) {
        reachabilityChecker = new AnnotationReachabilityChecker(prog, AllAnnotationIdentifiers());
      } else {
        reachabilityChecker = new DummyAnnotationReachabilityChecker();
      }

      AnnotationDependences = new Graph<string>();
      foreach (var c in AllAnnotationIdentifiers())
      {
        AnnotationDependences.AddEdge(c, c);
        foreach (var vd in annotationDependsOn[c])
        {
          if (variableDirectlyReferredToByAnnotations.ContainsKey(vd))
          {
            foreach (var d in variableDirectlyReferredToByAnnotations[vd])
            {
              if(reachabilityChecker.MayReach(d, c))
              {
                AnnotationDependences.AddEdge(c, d);
              }
            }
          }
        }
      }

      if(CommandLineOptions.Clo.StagedHoudiniMergeIgnoredAnnotations) {
        MergeIgnoredAnnotations();
      }

    }