aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHWriter.cpp
AgeCommit message (Collapse)Author
2009-04-22Lazy loading of builtins for precompiled headers.Douglas Gregor
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%) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69815 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22ObjCQualifiedClass is dead, remove it.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69783 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22pch support for protocol qualified id's.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69781 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22add three new objc expression types. @selector doesn't work because we have no Chris Lattner
way to serialize selectors yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69780 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22implement serialization support for @encode,Chris Lattner
fix a couple of bugs in reader support for ObjCInterfaceDecl, and add support for reading ObjCInterfaceType. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69779 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21Lazy deserialization of macro definitions for precompiled headers.Douglas Gregor
This optimization improves performance on the Carbon-prefixed "Hello, World!" example by 57%. For reference, we're now about 2.25x faster than GCC PCH. We're also pulling in far less of the PCH file: *** 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%) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69755 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21Don't bother writing a visible-declarations record for the translationDouglas Gregor
unit into the PCH file, since we won't be performing name lookup into it anyway. Reduces the size of the Carbon.h PCH file by ~200k. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69739 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21Lazy deserialization of the declaration chains associated withDouglas Gregor
identifiers from a precompiled header. This patch changes the primary name lookup method for entities within a precompiled header. Previously, we would load all of the names of declarations at translation unit scope into a large DenseMap (inside the TranslationUnitDecl's DeclContext), and then perform a special "last resort" lookup into this DeclContext when we knew there was a PCH file (see Sema::LookupName). Now, when we see an identifier named for the first time, we load all of the declarations with that name that are visible from the translation unit into the IdentifierInfo's chain of declarations. Thus, the explicit "look into the translation unit's DeclContext" code is gone, and Sema effectively uses the same IdentifierInfo-based name lookup mechanism whether we are using a PCH file or not. This approach should help PCH scale with the size of the input program rather than the size of the PCH file. The "Hello, World!" application with Carbon.h as a PCH file now loads 20% of the identifiers in the PCH file rather than 85% of the identifiers. 90% of the 20% of identifiers loaded are actually loaded when we deserialize the preprocessor state. The next step is to make the preprocessor load macros lazily, which should drastically reduce the number of types, declarations, and identifiers loaded for "Hello, World". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69737 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21Add pch reader/writer support for most of DeclObjC.h. Very close to ↵Steve Naroff
reading/writing all ObjC AST nodes that we will encounter in header files (still a few FIXME's). Once selector support is in place, we should be able to take this for a spin (and add test cases). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69674 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20Write the identifier table into the PCH file as an on-disk hash tableDouglas Gregor
that also includes the contents of the IdentifierInfo itself (the various fields and flags, along with the chain of identifiers visible at the top level that have that name). We don't make any use of the hash table yet, except that our identifier ID -> string mapping points into the hash table now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69625 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20Add pch reader/writer support for ObjCContainerDecl, ObjCInterfaceDecl, & ↵Steve Naroff
ObjCIvarDecl. Next step: Add selector support to PCHWriter::AddDeclarationName(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69619 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20the __gnuc_inline__ attribute is actually named __gnu_inline__,Chris Lattner
PR4023 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69618 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20Introduce the notion of a SemaConsumer, which is an ASTConsumer thatDouglas Gregor
also gets access to the Sema object performing semantic analysis. This will be used by the PCH writer to serialize Sema state. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69595 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20Add pch reader/writer support for ObjCMethodDecl.Steve Naroff
Test will be enabled with ObjCInterfaceDecl is added. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69594 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19Add location info for indirect goto.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69497 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18Don't emit name-lookup tables for functions or methods in the PCH filesDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69449 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18Store the type ID for __builtin_va_list in the PCH file, so that theDouglas Gregor
AST context's __builtin_va_list type will be set when the PCH file is loaded. This fixes the crash when CodeGen'ing a va_arg expression pulled in from a PCH file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69421 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18FunctionDecl::getBody() is getting an ASTContext argument for use inDouglas Gregor
lazy PCH deserialization. Propagate that argument wherever it needs to be. No functionality change, except that I've tightened up a few PCH tests in preparation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17Keep track of the number of statements/expressions written to and readDouglas Gregor
from a PCH file. It turns out that "Hello, World!" is bringing in 19% of all of the statements in Carbon.h, so we need to be lazy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69393 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17PCH support for inline assembly statements.Douglas Gregor
This completes support for all of C (+ extensions). We can (again) build a PCH file for Carbon.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17PCH support for blocksDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69373 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17PCH support for GNU statement expressionsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17PCH support for indirect gotos and address-of-label expressions.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69369 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17PCH support for labels and goto.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17PCH support for declaration statements, and a test for PredefinedExprDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69356 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17PCH support for return statements.Douglas Gregor
Optimize PCH encoding for switch-case statements slightly, by making the switch-case numbering local to a particular statement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17PCH support for do-while and for loopsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69334 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17PCH support for while and continue statementsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69332 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17PCH support for the first batch of statements, including null,Douglas Gregor
compound, case, default, if, switch, and break statements. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69329 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16Prepare PCH reader and writer for (de-)serialization of statements. NoDouglas Gregor
functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69319 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16Eliminate pch::TYPE_ATTR, which is never usedDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16PCH support for CompoundLiteralExpr. This is the last C expressionDouglas Gregor
that does not require PCH support for statements. Only AddrLabelExpr, StmtExpr, and BlockExpr remain (for C). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69255 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16PCH support for InitListExpr, DesignatedInitExpr, and ImplicitValueInitExpr.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16PCH support for ShuffleVectorExpr and BlockDeclRefExprDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69244 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15PCH support for TypesCompatibleExpr, ChooseExpr, and GNUNullExpr.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69242 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15PCH support for ExtVectorElementExpr and VAArgExpr.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69240 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15PCH support for CompoundAssignOperator and ConditionalOperatorDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69237 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15PCH support for ImaginaryLiteral and ArraySubscriptExprDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69233 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15PCH support for declaration attributesDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69225 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15PCH support for the string literal of a FileScopeAsmDecl.Douglas Gregor
Some minor cleanup. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69196 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15For source location entries that describe instantiations, encode theDouglas Gregor
token length in the PCH file rather than trying (and failing) to reconstruct it be getting the spelling token's length. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69191 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15PCH support for MemberExpr and CallExpr.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69186 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15PCH support for string literalsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69172 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15PCH support for UnaryOperator, SizeOfAlignOfExprDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69169 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15PCH support for CStyleCastExpr and BinaryOperator expression kinds.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14PCH support for ParenExprDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69106 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14Add PCH support for ImplicitCastExprs. This is the first expressionDouglas Gregor
kind PCH handles that has an expression as an operand, so most of this work is in the infrastructure to rebuild expression trees from the serialized representation. We now store expressions in post-order (e.g., Reverse Polish Notation), so that we can easily rebuild the appropriate expression tree. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69101 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14Add PCH support for PredefinedExpr and FloatingLiteral expressionsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69084 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14PCH support for a few very, very simple kinds of expressions. Hook upDouglas Gregor
expression (de-)serialization for VLAs, variable initializers, enum constant initializers, and bitfield widths. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69075 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14When writing a PCH file, keep track of all of the non-static,Douglas Gregor
non-inline external definitions (and tentative definitions) that are found at the top level. The corresponding declarations are stored in a record in the PCH file, so that they can be provided to the ASTConsumer (via HandleTopLevelDecl) when the PCH file is read. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69005 91177308-0d34-0410-b5e6-96231b3b80d8