-static const unsigned DAMTableSize =
- sizeof(DoesntAccessMemoryTable)/sizeof(DoesntAccessMemoryTable[0]);
-
-/// doesNotAccessMemory - Return true if we know that the function does not
-/// access memory at all. Since basicaa does no analysis, we can only do simple
-/// things here. In particular, if we have an external function with the name
-/// of a standard C library function, we are allowed to assume it will be
-/// resolved by libc, so we can hardcode some entries in here.
-bool BasicAliasAnalysis::doesNotAccessMemory(Function *F) {
- if (!F->isExternal()) return false;
-
- static bool Initialized = false;
- if (!Initialized) {
- // Sort the table the first time through.
- std::sort(DoesntAccessMemoryTable, DoesntAccessMemoryTable+DAMTableSize,
- StringCompare());
- Initialized = true;
- }
-
- const char **Ptr = std::lower_bound(DoesntAccessMemoryTable,
- DoesntAccessMemoryTable+DAMTableSize,
- F->getName().c_str(), StringCompare());
- return Ptr != DoesntAccessMemoryTable+DAMTableSize && *Ptr == F->getName();
-}