diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-04-28 21:18:29 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-04-28 21:18:29 +0000 |
commit | 1d583f28387ba092bd30f1109bd805248e3070e4 (patch) | |
tree | 2fe50f53456a5adab1ae6c85fd8e93640ebe9642 /clang/lib/Frontend/PCHReader.cpp | |
parent | cd07dd168d2950f45e903d1767509d67b568954a (diff) | |
download | bcm5719-llvm-1d583f28387ba092bd30f1109bd805248e3070e4.tar.gz bcm5719-llvm-1d583f28387ba092bd30f1109bd805248e3070e4.zip |
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
Diffstat (limited to 'clang/lib/Frontend/PCHReader.cpp')
-rw-r--r-- | clang/lib/Frontend/PCHReader.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp index 8324f8de0b2..64929dcb1db 100644 --- a/clang/lib/Frontend/PCHReader.cpp +++ b/clang/lib/Frontend/PCHReader.cpp @@ -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; |