summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Builtins.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-22 18:49:13 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-22 18:49:13 +0000
commit4621c6ae15fb08e324e1b4e613cde5729e2a5c1a (patch)
tree76b9c64288e46f0b4f0ffa9143c8875c45d4f323 /clang/lib/AST/Builtins.cpp
parent6c867a1460a01866e6dcaffdc8320f6784e327a5 (diff)
downloadbcm5719-llvm-4621c6ae15fb08e324e1b4e613cde5729e2a5c1a.tar.gz
bcm5719-llvm-4621c6ae15fb08e324e1b4e613cde5729e2a5c1a.zip
Lazy loading of builtins for precompiled headers.
PCH files now contain complete information about builtins, including any declarations that have been synthesized as part of building the PCH file. When using a PCH file, we do not initialize builtins at all; when needed, they'll be found in the PCH file. This optimization translations into a 9% speedup for "Hello, World!" with Carbon.h as a prefix header and roughly a 5% speedup for 403.gcc with its prefix header. We're also reading less of the PCH file for "Hello, World!": *** PCH Statistics: 286/20693 types read (1.382110%) 1630/59230 declarations read (2.751984%) 764/44914 identifiers read (1.701029%) 1/32954 statements read (0.003035%) 5/6187 macros read (0.080815%) down from *** PCH Statistics: 411/20693 types read (1.986179%) 2553/59230 declarations read (4.310316%) 1093/44646 identifiers read (2.448148%) 1/32954 statements read (0.003035%) 21/6187 macros read (0.339421%) llvm-svn: 69815
Diffstat (limited to 'clang/lib/AST/Builtins.cpp')
-rw-r--r--clang/lib/AST/Builtins.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/AST/Builtins.cpp b/clang/lib/AST/Builtins.cpp
index ece9eeed767..3e1b3dc2a1f 100644
--- a/clang/lib/AST/Builtins.cpp
+++ b/clang/lib/AST/Builtins.cpp
@@ -58,6 +58,24 @@ void Builtin::Context::InitializeBuiltins(IdentifierTable &Table,
Table.get(TSRecords[i].Name).setBuiltinID(i+Builtin::FirstTSBuiltin);
}
+void
+Builtin::Context::GetBuiltinNames(llvm::SmallVectorImpl<const char *> &Names,
+ bool NoBuiltins) {
+ // Final all target-independent names
+ for (unsigned i = Builtin::NotBuiltin+1; i != Builtin::FirstTSBuiltin; ++i)
+ if (!BuiltinInfo[i].Suppressed &&
+ (!NoBuiltins || !strchr(BuiltinInfo[i].Attributes, 'f')))
+ Names.push_back(BuiltinInfo[i].Name);
+
+ // Find target-specific names.
+ for (unsigned i = 0, e = NumTSRecords; i != e; ++i)
+ if (!TSRecords[i].Suppressed &&
+ (!NoBuiltins ||
+ (TSRecords[i].Attributes &&
+ !strchr(TSRecords[i].Attributes, 'f'))))
+ Names.push_back(TSRecords[i].Name);
+}
+
bool
Builtin::Context::isPrintfLike(unsigned ID, unsigned &FormatIdx,
bool &HasVAListArg) {
OpenPOWER on IntegriCloud