Lines Matching refs:Cache
497 // Create a numbered basic block to lazily compute and cache instruction
791 /// cache arrays are properly kept sorted.
792 static void AssertSorted(MemoryDependenceAnalysis::NonLocalDepInfo &Cache,
794 if (Count == -1) Count = Cache.size();
798 assert(!(Cache[i] < Cache[i-1]) && "Cache isn't sorted!");
819 NonLocalDepInfo &Cache = CacheP.first;
827 if (!Cache.empty()) {
828 // Okay, we have a cache entry. If we know it is not dirty, just return it
832 return Cache;
837 for (NonLocalDepInfo::iterator I = Cache.begin(), E = Cache.end();
842 // Sort the cache so that we can do fast binary search lookups below.
843 std::sort(Cache.begin(), Cache.end());
847 // << Cache.size() << " cached: " << *QueryInst;
861 unsigned NumSortedEntries = Cache.size();
862 DEBUG(AssertSorted(Cache));
874 // the cache set. If so, find it.
875 DEBUG(AssertSorted(Cache, NumSortedEntries));
877 std::upper_bound(Cache.begin(), Cache.begin()+NumSortedEntries,
879 if (Entry != Cache.begin() && std::prev(Entry)->getBB() == DirtyBB)
883 if (Entry != Cache.begin()+NumSortedEntries &&
924 Cache.push_back(NonLocalDepEntry(DirtyBB, Dep));
942 return Cache;
1004 /// Pointer/PointeeSize using either cached information in Cache or by doing a
1005 /// lookup (which may use dirty cache info if available). If we do a lookup,
1006 /// add the result to the cache.
1009 BasicBlock *BB, NonLocalDepInfo *Cache, unsigned NumSortedEntries) {
1012 // the cache set. If so, find it.
1014 std::upper_bound(Cache->begin(), Cache->begin()+NumSortedEntries,
1016 if (Entry != Cache->begin() && (Entry-1)->getBB() == BB)
1020 if (Entry != Cache->begin()+NumSortedEntries && Entry->getBB() == BB)
1030 // Otherwise, we have to scan for the value. If we have a dirty cache
1040 // Eliminating the dirty entry from 'Cache', so update the reverse info.
1056 Cache->push_back(NonLocalDepEntry(BB, Dep));
1060 // to Cache!
1073 /// SortNonLocalDepInfoCache - Sort the NonLocalDepInfo cache, given a certain
1077 SortNonLocalDepInfoCache(MemoryDependenceAnalysis::NonLocalDepInfo &Cache,
1079 switch (Cache.size() - NumSortedEntries) {
1085 NonLocalDepEntry Val = Cache.back();
1086 Cache.pop_back();
1088 std::upper_bound(Cache.begin(), Cache.end()-1, Val);
1089 Cache.insert(Entry, Val);
1094 if (Cache.size() != 1) {
1095 NonLocalDepEntry Val = Cache.back();
1096 Cache.pop_back();
1098 std::upper_bound(Cache.begin(), Cache.end(), Val);
1099 Cache.insert(Entry, Val);
1104 std::sort(Cache.begin(), Cache.end());
1143 // If we already have a cache entry for this CacheKey, we may need to do some
1144 // work to reconcile the cache entry and the current query.
1186 NonLocalDepInfo *Cache = &CacheInfo->NonLocalDeps;
1197 for (NonLocalDepInfo::iterator I = Cache->begin(), E = Cache->end();
1211 for (NonLocalDepInfo::iterator I = Cache->begin(), E = Cache->end();
1230 // Otherwise, either this is a new block, a block with an invalid cache
1232 // than its valid cache info. If empty, the result will be valid cache info,
1234 if (Cache->empty())
1250 unsigned NumSortedEntries = Cache->size();
1251 DEBUG(AssertSorted(*Cache));
1262 // cache value will only see properly sorted cache arrays.
1263 if (Cache && NumSortedEntries != Cache->size()) {
1264 SortNonLocalDepInfoCache(*Cache, NumSortedEntries);
1266 // Since we bail out, the "Cache" set won't contain all of the
1282 DEBUG(AssertSorted(*Cache, NumSortedEntries));
1284 Loc, isLoad, BB, Cache,
1338 // We may have added values to the cache list before this PHI translation.
1339 // If so, we haven't done anything to ensure that the cache remains sorted.
1341 // getNonLocalPointerDepFromBB and other routines that could reuse the cache
1342 // value will only see properly sorted cache arrays.
1343 if (Cache && NumSortedEntries != Cache->size()) {
1344 SortNonLocalDepInfoCache(*Cache, NumSortedEntries);
1345 NumSortedEntries = Cache->size();
1347 Cache = nullptr;
1424 // Since we had a phi translation failure, the cache for CacheKey won't
1435 // Refresh the CacheInfo/Cache pointer so that it isn't invalidated.
1437 Cache = &CacheInfo->NonLocalDeps;
1438 NumSortedEntries = Cache->size();
1440 // Since we did phi translation, the "Cache" set won't contain all of the
1453 if (!Cache) {
1454 // Refresh the CacheInfo/Cache pointer if it got invalidated.
1456 Cache = &CacheInfo->NonLocalDeps;
1457 NumSortedEntries = Cache->size();
1460 // Since we failed phi translation, the "Cache" set won't contain all of the
1474 for (NonLocalDepInfo::reverse_iterator I = Cache->rbegin(); ; ++I) {
1475 assert(I != Cache->rend() && "Didn't find current block??");
1488 // Okay, we're done now. If we added new values to the cache, re-sort it.
1489 SortNonLocalDepInfoCache(*Cache, NumSortedEntries);
1490 DEBUG(AssertSorted(*Cache));
1511 // Eliminating the dirty entry from 'Cache', so update the reverse info.
1544 /// This method attempts to keep the cache coherent using the reverse map.
1669 // The cache is not valid for any specific block anymore.