Commit Graph

8 Commits

Author SHA1 Message Date
Douglas Gregor 35b04d6fd2 Rename -fmodule-cache-path <blah> to -fmodules-cache-path=<blah> for consistency.
llvm-svn: 174645
2013-02-07 19:01:24 +00:00
Douglas Gregor 137f1b991e Enable the global module index by default. Introduce the
-fno-modules-global-index -cc1 option to allow one to disable the
index for performance testing purposes, but with a 10% win in
-fsyntax-only time, there is no reason a user would do this.

llvm-svn: 173707
2013-01-28 18:38:02 +00:00
NAKAMURA Takumi d7512b347a clang/test: Drop "REQUIRES:shell" in three tests. They can run on win32.
llvm-svn: 173419
2013-01-25 06:02:11 +00:00
Douglas Gregor e060e57bf7 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
2013-01-25 01:03:03 +00:00
Douglas Gregor c1bbec85a8 Rename the -cc1 option "-generate-module-index" to
"-fmodules-global-index" and expand its behavior to include both the
use and generation of the global module index.

llvm-svn: 173404
2013-01-25 00:45:27 +00:00
NAKAMURA Takumi e00c986897 clang/GlobalModuleIndex: Don't open the same file twice. Use raw_fd_ostream(fd, ...) instead.
FIXME: PathV2::unique_file() is assumed to open the file with binary mode on win32.
llvm-svn: 173330
2013-01-24 08:20:11 +00:00
NAKAMURA Takumi 7a23231e6b clang/test/Modules/global_index.m: XFAILing on win32 when investigating for now.
llvm-svn: 173326
2013-01-24 07:04:14 +00:00
Douglas Gregor 5e306b1233 Implement the writer side of the global module index.
The global module index is a "global" index for all of the module
files within a particular subdirectory in the module cache, which
keeps track of all of the "interesting" identifiers and selectors
known in each of the module files. One can perform a fast lookup in
the index to determine which module files will have more information
about entities with a particular name/selector. This information can
help eliminate redundant lookups into module files (a serious
performance problem) and help with creating auto-import/auto-include
Fix-Its.

The global module index is created or updated at the end of a
translation unit that has triggered a (re)build of a module by
scraping all of the .pcm files out of the module cache subdirectory,
so it catches everything. As with module rebuilds, we use the file
system's atomicity to synchronize.

llvm-svn: 173301
2013-01-23 22:38:11 +00:00