Implement the reader of the global module index and wire it into the
authorDouglas Gregor <dgregor@apple.com>
Fri, 25 Jan 2013 01:03:03 +0000 (01:03 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 25 Jan 2013 01:03:03 +0000 (01:03 +0000)
commite060e57bf74681939ffab90ff743ab8594a8b866
treea1dfdd31544afed4c34e2e1b9fc9eb8bc97d16ec
parentc1bbec85a87c9a929b1814a0b316ed28e6e224af
Implement the reader of the global module index and wire it into the
AST reader.

The global module index tracks all of the identifiers known to a set
of module files. Lookup of those identifiers looks first in the global
module index, which returns the set of module files in which that
identifier can be found. The AST reader only needs to look into those
module files and any module files not known to the global index (e.g.,
because they were (re)built after the global index), reducing the
number of on-disk hash tables to visit. For an example source I'm
looking at, we go from 237844 total identifier lookups into on-disk
hash tables down to 126817.

Unfortunately, this does not translate into a performance advantage.
At best, it's a wash once the global module index has been built, but
that's ignore the cost of building the global module index (which
is itself fairly large). Profiles show that the global module index
code is far less efficient than it should be; optimizing it might give
enough of an advantage to justify its continued inclusion.

llvm-svn: 173405
clang/include/clang/Serialization/ASTReader.h
clang/include/clang/Serialization/GlobalModuleIndex.h
clang/lib/Frontend/CompilerInstance.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/GlobalModuleIndex.cpp
clang/lib/Serialization/ModuleManager.cpp
clang/test/Modules/global_index.m