Граф коммитов

107 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 83941df274 Load the selector table lazily from the PCH file.
This results in a 10% speedup on the Cocoa-prefixed "Hello, World!",
all of which is (not surprisingly) user time. There was a tiny
reduction in the size of the PCH file for Cocoa.h, because certain
selectors aren't being written twice.

I'm using two new tricks here that I'd like to replicate elsewhere:
  (1) The selectors not used in the global method pool are packed into
  the blob after the global method pool's on-disk hash table and
  stored as keys, so that all selectors are in the same blob.
  (2) We record the offsets of each selector key when we write it into
  the global method pool (or after it, in the same blob). The offset
  table is written as a blob, so that we don't need to pack/unpack a
  SmallVector with its contents.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 17:48:32 +00:00
Steve Naroff d3f632eda7 Fix indexing error in PCHStmtReader::VisitArraySubscriptExpr().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70046 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 15:19:54 +00:00
Steve Naroff c4f0bbdb16 Add PCH support for ObjCMessageExpr (needed to build Mail).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70044 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 14:04:28 +00:00
Steve Naroff 87f0f8252d Fixup comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70040 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 12:18:35 +00:00
Steve Naroff 72de9219a7 Fix a major bug in PCHReader::ReadSelectorBlock().
Also simplify some syntax in PCHWriter::WritePreprocessor(), suggested by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70039 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 12:07:12 +00:00
Douglas Gregor c62a2fe195 Make sure that the consumer sees all interested decls. This fixes Preview
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70007 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 00:41:30 +00:00
Ted Kremenek de9a81b92e Add new checker-specific attribute 'objc_ownership_retain'. This isn't hooked up
to the checker yet, but essentially it allows a user to specify that an
Objective-C method or C function increments the reference count of a passed
object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70005 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 00:17:17 +00:00
Douglas Gregor ad38a8595f When we de-serialize an Objective-C protocol, hand it to the AST consumer so that we can create metadata
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70003 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 23:42:14 +00:00
Ted Kremenek 0fc169e864 Add new checker-specific attribute 'objc_ownership_returns'. This isn't hooked
up to the checker yet, but essentially it allows a user to specify that an
Objective-C method or C function returns an owned an Objective-C object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70001 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 23:09:54 +00:00
Douglas Gregor d5e662d722 Once the protocol list has been loaded from the PCH file, add it to
the Objective-C interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69993 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 22:01:00 +00:00
Douglas Gregor f0aaf7a597 PCH support for the global method pool (= instance and factory method
pools, combined). The methods in the global method pool are lazily
loaded from an on-disk hash table when Sema looks into its version of
the hash tables.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69989 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 21:10:55 +00:00
Steve Naroff 83d63c7881 Add PCH support for #import.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 20:03:17 +00:00
Steve Naroff 0777260728 Use cast_or_null instead of ternary operator (suggested by Doug).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69975 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 16:59:10 +00:00
Steve Naroff 521c91024f Allow the next catoregory slot to be null.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69969 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 16:08:42 +00:00
Douglas Gregor 8fc463adf0 Eliminate Sema::ObjCImplementations, relying instead on name lookup. What's good for uniformity is good for PCH (or is it the other way around?).
As part of this, make ObjCImplDecl inherit from NamedDecl (since
ObjCImplementationDecls now need to have names so that they can be
found). This brings ObjCImplDecl very, very close to
ObjCContainerDecl; we may be able to merge them soon.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69941 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 00:11:27 +00:00
Douglas Gregor 133f482ddc PCH support for categories in Objective-C interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69933 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 22:34:55 +00:00
Douglas Gregor 319ac896a0 PCH support for all of the predefined Objective-C types, such as id,
SEL, Class, Protocol, CFConstantString, and
__objcFastEnumerationState. With this, we can now run the Objective-C
methods and properties PCH tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69932 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 22:29:11 +00:00
Douglas Gregor b3efa98e32 Fix handling of C99 "extern inline" semantics when dealing with
multiple declarations of the function. Should fix PR3989 and
<rdar://problem/6818429>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69905 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 18:22:55 +00:00
Steve Naroff 8f06f84e8b More PushOnScopeChain() FIXME's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69894 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 16:00:56 +00:00
Steve Naroff a7503a735d Sema::ActOnStartClassInterface(): Use PushOnScopeChains().
This enables class recognition to work with PCH. I believe this means we can remove Sema::ObjCInterfaceDecls and it's usage within Sema::LookupName(). Will investigate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69891 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 15:15:40 +00:00
Steve Naroff 90cd1bb1ba Add PCH read/write support for Objective-C Selectors.
Note: This support is non-lazy. Once we get "Cocoa.h" humming, we can optimize this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 10:39:46 +00:00
Douglas Gregor 291be393aa PCH (de-)serialization of the protocols in an ObjCInterfaceDecl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69860 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 03:59:07 +00:00
Douglas Gregor 17eee4af16 Add the PCH reader stub for ObjCCompatibleAliasDecl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 03:51:49 +00:00
Douglas Gregor 8818c4fb69 PCH support for ObjCPropertyImplDecl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 03:43:53 +00:00
Douglas Gregor 8f36aba016 The ivars in an ObjCImplementationDecl are now stored in the
DeclContext rather than in a separate list. This makes PCH
(de-)serialization trivial, so that ivars can be loaded lazily.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69857 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 03:23:08 +00:00
Douglas Gregor 10b0e1fa3a PCH support for ObjCCategoryImplDecl (which can't be tested now).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69856 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 02:53:57 +00:00
Douglas Gregor 2c2d43c557 PCH (de-)serialization for ObjCImplDecl. This can't be tested yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69855 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 02:42:49 +00:00
Douglas Gregor 70e5a14c60 PCH support for Objective-C property declarations (UNTESTED!)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69843 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 23:20:34 +00:00
Douglas Gregor 2512308525 Add PCH statistics for the number/percent of lexical/visible declcontexts read
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69835 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 22:34:57 +00:00
Douglas Gregor 14c22f20c0 Support locally-declared external declarations in PCH files
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69833 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 22:18:58 +00:00
Douglas Gregor 4c0e86b392 Support tentative definitions in precompiled headers. This isn't likely
to happen (ever), but at least we'll do the right thing when it does.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69829 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 22:02:47 +00:00
Douglas Gregor 6cfc1a8b75 Eliminate some FIXMEs in the PCH reader that were either already fixed or aren't actually things to fix
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69827 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 21:15:06 +00:00
Douglas Gregor 0af2ca4b6d Minimize the number and kind of "external definitions" that the PCH
file needs to store. CodeGen needs to see these definitions (via
HandleTopLevelDecl), otherwise it won't be able to generate code for
them. 

This patch notifies the consumer (e.g., CodeGen) about function
definitions and variable definitions when the corresponding
declarations are deserialized. Hence, we don't eagerly deserialize the
declarations for every variable or function that has a definition in
the PCH file. This gives another 5% speedup for the Carbon-prefixed
"Hello, World!", and brings our PCH statistics down to something far
more reasonable:

*** PCH Statistics:
  13/20693 types read (0.062823%)
  17/59230 declarations read (0.028702%)
  54/44914 identifiers read (0.120230%)
  0/32954 statements read (0.000000%)
  5/6187 macros read (0.080815%)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69820 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 19:09:20 +00:00
Douglas Gregor 2deaea37a6 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%)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69815 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 18:49:13 +00:00
Douglas Gregor 01f4fa2928 Remove some debugging output from the PCH reader
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69803 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 14:18:52 +00:00
Chris Lattner 068360e16f ObjCQualifiedClass is dead, remove it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69783 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 06:50:37 +00:00
Chris Lattner c6fa4450b8 deserialization support for qualified interfaces
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69782 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 06:45:28 +00:00
Chris Lattner d7a3fcd48c pch support for protocol qualified id's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69781 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 06:40:03 +00:00
Chris Lattner 3a57a3765b add three new objc expression types. @selector doesn't work because we have no
way to serialize selectors yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69780 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 06:29:42 +00:00
Chris Lattner 4dcf151a55 implement serialization support for @encode,
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-22 05:57:30 +00:00
Douglas Gregor 71dfdb9bc9 Reorganize built-in initialization to separate the creation of target builtins from marking IdentifierInfos as builtins. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69774 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 04:56:28 +00:00
Douglas Gregor 37e2684abf Lazy deserialization of macro definitions for precompiled headers.
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-21 23:56:24 +00:00
Douglas Gregor 668c1a4fdc Lazy deserialization of the declaration chains associated with
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-21 22:25:48 +00:00
Steve Naroff 30833f8d77 Add pch reader/writer support for most of DeclObjC.h. Very close to 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-21 15:12:33 +00:00
Douglas Gregor 3251ceb90b Write the identifier table into the PCH file as an on-disk hash table
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-20 20:36:09 +00:00
Steve Naroff 33feeb019a Add pch reader/writer support for ObjCContainerDecl, ObjCInterfaceDecl, & 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-20 20:09:33 +00:00
Chris Lattner cf2a7211b4 the __gnuc_inline__ attribute is actually named __gnu_inline__,
PR4023


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69618 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 19:12:28 +00:00
Steve Naroff 53c9d8a4b8 Add pch reader/writer support for ObjCMethodDecl.
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-20 15:06:07 +00:00
Chris Lattner ad56d68425 Add location info for indirect goto.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69497 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19 01:04:21 +00:00
Douglas Gregor ad1de006ea Store the type ID for __builtin_va_list in the PCH file, so that the
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-18 05:55:16 +00:00