[NFC][llvm][StringMap]Extract createTable and getHashTable functions and add...
[NFC][llvm][StringMap]Extract createTable and getHashTable functions and add the inline attribute to the getMinBucketToReserveForEntries function. 1. Extract createTable and getHashTable functions. 2. Add the inline attribute to the getMinBucketToReserveForEntries function. 3. Remove unnecessary local variable HTSize. Statements in the following order appear in llvm::StringMapImpl::init and llvm::StringMapImpl::RehashTable, so I extracted this code into a function. getHashTable is for the same reason, it appears in llvm::StringMapImpl::FindKey, llvm::StringMapImpl::LookupBucketFor and llvm::StringMapImpl::RehashTable. ``` auto **Table = static_cast<StringMapEntryBase **>(safe_calloc( NewNumBuckets + 1, sizeof(StringMapEntryBase **) + sizeof(unsigned))); // Allocate one extra bucket, set it to look filled so the iterators stop at // end. Table[NewNumBuckets] = (StringMapEntryBase *)2; ``` ``` unsigned *HashTable = (unsigned *)(TheTable + NumBuckets + 1); ``` Reviewed By: skan, sepavloff Differential Revision: https://reviews.llvm.org/D121934
Loading
Please sign in to comment