Exemplo n.º 1
0
        public static void AnalyseMemoryRegionsWithPairInformation(AnalysisContext ac, EntryPoint ep)
        {
            var             memRegions = new List <Variable>();
            var             epVars     = SharedStateAnalyser.GetMemoryRegions(ep);
            List <Variable> otherEpVars;

            foreach (var pair in DeviceDriver.EntryPointPairs.FindAll(val =>
                                                                      val.EntryPoint1.Name.Equals(ep.Name) || val.EntryPoint2.Name.Equals(ep.Name)))
            {
                if (!pair.EntryPoint1.Name.Equals(ep.Name))
                {
                    otherEpVars = SharedStateAnalyser.GetMemoryRegions(pair.EntryPoint1);
                }
                else if (!pair.EntryPoint2.Name.Equals(ep.Name))
                {
                    otherEpVars = SharedStateAnalyser.GetMemoryRegions(pair.EntryPoint2);
                }
                else
                {
                    otherEpVars = epVars;
                }

                foreach (var v in epVars)
                {
                    if (otherEpVars.Any(val => val.Name.Equals(v.Name)) && !memRegions.Contains(v))
                    {
                        memRegions.Add(v);
                    }
                }
            }

            SharedStateAnalyser.EntryPointMemoryRegions[ep] = memRegions;
        }
Exemplo n.º 2
0
        public static List <Variable> GetPairMemoryRegions(EntryPoint ep1, EntryPoint ep2)
        {
            var result = new List <Variable>();

            result.AddRange(SharedStateAnalyser.GetMemoryRegions(ep1));

            foreach (var mr in SharedStateAnalyser.GetMemoryRegions(ep2))
            {
                if (result.Any(val => val.Name.Equals(mr.Name)))
                {
                    continue;
                }
                result.Add(mr);
            }

            return(result);
        }