Implement a minor space optimization for the PCH identifier table,

which eliminates the storage for IdentifierInfo in the "uninteresting
identifier" cases. Sadly, this only brought back 7k of the 500k we
lost :(

llvm-svn: 70325
This commit is contained in:
Douglas Gregor
2009-04-28 21:18:29 +00:00
parent cd07dd168d
commit 1d583f2838
2 changed files with 45 additions and 12 deletions

View File

@@ -220,6 +220,23 @@ public:
const unsigned char* d,
unsigned DataLen) {
using namespace clang::io;
pch::IdentID ID = ReadUnalignedLE32(d);
bool IsInteresting = ID & 0x01;
// Wipe out the "is interesting" bit.
ID = ID >> 1;
if (!IsInteresting) {
// For unintersting identifiers, just build the IdentifierInfo
// and associate it with the persistent ID.
IdentifierInfo *II = KnownII;
if (!II)
II = &Reader.getIdentifierTable().CreateIdentifierInfo(
k.first, k.first + k.second);
Reader.SetIdentifierInfo(ID, II);
return II;
}
uint32_t Bits = ReadUnalignedLE32(d);
bool CPlusPlusOperatorKeyword = Bits & 0x01;
Bits >>= 1;
@@ -233,8 +250,7 @@ public:
Bits >>= 10;
unsigned TokenID = Bits & 0xFF;
Bits >>= 8;
pch::IdentID ID = ReadUnalignedLE32(d);
assert(Bits == 0 && "Extra bits in the identifier?");
DataLen -= 8;