Home | History | Annotate | Download | only in Analysis

Lines Matching refs:Cache

654 /// cache arrays are properly kept sorted.
655 static void AssertSorted(MemoryDependenceAnalysis::NonLocalDepInfo &Cache,
657 if (Count == -1) Count = Cache.size();
661 assert(!(Cache[i] < Cache[i-1]) && "Cache isn't sorted!");
682 NonLocalDepInfo &Cache = CacheP.first;
690 if (!Cache.empty()) {
691 // Okay, we have a cache entry. If we know it is not dirty, just return it
695 return Cache;
700 for (NonLocalDepInfo::iterator I = Cache.begin(), E = Cache.end();
705 // Sort the cache so that we can do fast binary search lookups below.
706 std::sort(Cache.begin(), Cache.end());
710 // << Cache.size() << " cached: " << *QueryInst;
724 unsigned NumSortedEntries = Cache.size();
725 DEBUG(AssertSorted(Cache));
737 // the cache set. If so, find it.
738 DEBUG(AssertSorted(Cache, NumSortedEntries));
740 std::upper_bound(Cache.begin(), Cache.begin()+NumSortedEntries,
742 if (Entry != Cache.begin() && prior(Entry)->getBB() == DirtyBB)
746 if (Entry != Cache.begin()+NumSortedEntries &&
787 Cache.push_back(NonLocalDepEntry(DirtyBB, Dep));
805 return Cache;
840 /// Pointer/PointeeSize using either cached information in Cache or by doing a
841 /// lookup (which may use dirty cache info if available). If we do a lookup,
842 /// add the result to the cache.
846 NonLocalDepInfo *Cache, unsigned NumSortedEntries) {
849 // the cache set. If so, find it.
851 std::upper_bound(Cache->begin(), Cache->begin()+NumSortedEntries,
853 if (Entry != Cache->begin() && (Entry-1)->getBB() == BB)
857 if (Entry != Cache->begin()+NumSortedEntries && Entry->getBB() == BB)
867 // Otherwise, we have to scan for the value. If we have a dirty cache
877 // Eliminating the dirty entry from 'Cache', so update the reverse info.
892 Cache->push_back(NonLocalDepEntry(BB, Dep));
896 // to Cache!
909 /// SortNonLocalDepInfoCache - Sort the a NonLocalDepInfo cache, given a certain
913 SortNonLocalDepInfoCache(MemoryDependenceAnalysis::NonLocalDepInfo &Cache,
915 switch (Cache.size() - NumSortedEntries) {
921 NonLocalDepEntry Val = Cache.back();
922 Cache.pop_back();
924 std::upper_bound(Cache.begin(), Cache.end()-1, Val);
925 Cache.insert(Entry, Val);
930 if (Cache.size() != 1) {
931 NonLocalDepEntry Val = Cache.back();
932 Cache.pop_back();
934 std::upper_bound(Cache.begin(), Cache.end(), Val);
935 Cache.insert(Entry, Val);
940 std::sort(Cache.begin(), Cache.end());
982 // If we already have a cache entry for this CacheKey, we may need to do some
983 // work to reconcile the cache entry and the current query.
1024 NonLocalDepInfo *Cache = &CacheInfo->NonLocalDeps;
1035 for (NonLocalDepInfo::iterator I = Cache->begin(), E = Cache->end();
1049 for (NonLocalDepInfo::iterator I = Cache->begin(), E = Cache->end();
1059 // Otherwise, either this is a new block, a block with an invalid cache
1061 // than its valid cache info. If empty, the result will be valid cache info,
1063 if (Cache->empty())
1079 unsigned NumSortedEntries = Cache->size();
1080 DEBUG(AssertSorted(*Cache));
1093 DEBUG(AssertSorted(*Cache, NumSortedEntries));
1094 MemDepResult Dep = GetNonLocalInfoForBlock(Loc, isLoad, BB, Cache,
1141 // We may have added values to the cache list before this PHI translation.
1142 // If so, we haven't done anything to ensure that the cache remains sorted.
1144 // getNonLocalPointerDepFromBB and other routines that could reuse the cache
1145 // value will only see properly sorted cache arrays.
1146 if (Cache && NumSortedEntries != Cache->size()) {
1147 SortNonLocalDepInfoCache(*Cache, NumSortedEntries);
1148 NumSortedEntries = Cache->size();
1150 Cache = 0;
1229 // Since we had a phi translation failure, the cache for CacheKey won't
1240 // Refresh the CacheInfo/Cache pointer so that it isn't invalidated.
1242 Cache = &CacheInfo->NonLocalDeps;
1243 NumSortedEntries = Cache->size();
1245 // Since we did phi translation, the "Cache" set won't contain all of the
1258 if (Cache == 0) {
1259 // Refresh the CacheInfo/Cache pointer if it got invalidated.
1261 Cache = &CacheInfo->NonLocalDeps;
1262 NumSortedEntries = Cache->size();
1265 // Since we failed phi translation, the "Cache" set won't contain all of the
1279 for (NonLocalDepInfo::reverse_iterator I = Cache->rbegin(); ; ++I) {
1280 assert(I != Cache->rend() && "Didn't find current block??");
1293 // Okay, we're done now. If we added new values to the cache, re-sort it.
1294 SortNonLocalDepInfoCache(*Cache, NumSortedEntries);
1295 DEBUG(AssertSorted(*Cache));
1316 // Eliminating the dirty entry from 'Cache', so update the reverse info.
1349 /// This method attempts to keep the cache coherent using the reverse map.
1482 // The cache is not valid for any specific block anymore.