Commit Graph

58420 Commits

Author SHA1 Message Date
Douglas Gregor b985eebcdf 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%)

llvm-svn: 69820
2009-04-22 19:09:20 +00:00
Chris Lattner 63660175f8 Add missing dependency, patch by Jason Haslam!
llvm-svn: 69819
2009-04-22 18:59:57 +00:00
Duncan Sands 7bccadac92 Testcase for PR2958.
llvm-svn: 69818
2009-04-22 18:55:17 +00:00
Devang Patel 51c3619018 Fix cut-n-pasto.
llvm-svn: 69816
2009-04-22 18:51:05 +00:00
Douglas Gregor 4621c6ae15 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
2009-04-22 18:49:13 +00:00
Ted Kremenek 6c867a1460 BugReporter (extensive diagnostics):
- Remove stale assertion that was breaking the test suite.
- When popping location contexts, only add a control-flow piece for fileID
  locations.

llvm-svn: 69814
2009-04-22 18:37:42 +00:00
Ted Kremenek 0752a5dff3 BugReporter (extensive diagnostic algorithm): The initial control-flow edge now
starts from the first character of the first statement.

llvm-svn: 69813
2009-04-22 18:16:20 +00:00
Ted Kremenek 22579c4c8f PathDiagnosticLocation: ranges for terminators now only include the first
character instead of the entire range for the IfStmt, ForStmt, etc. We may
gradually refine these ranges later, but basically terminator ranges just refer
to the first keyword.

llvm-svn: 69812
2009-04-22 18:03:00 +00:00
Daniel Dunbar e4f25b706b Reapply r69771, with updates & fixes:
Rework the shadow struct that is layed out for Objective-C classes.

 - Superclasses are now always laid out in their shadow structure at
   the first field.

 - Prior to this, the entire class heirarchy was flattened into a
   single structure which meant that alignment, padding, and bitfields
   were incorrect (the ASTRecordLayout was correct however, which
   meant our debug info didn't coincide with ivar offsets, for
   example).

 - This is still very suboptimal (for example, ivar are looked up
   recursively, but I believe the ivar layout itself is now at least
   close to correct.

 - <rdar://problem/6773388> error: objc[29823]: layout bitmap sliding
   backwards

llvm-svn: 69811
2009-04-22 17:43:55 +00:00
David Greene 753ed8fd9c Implement multiclass inheritance.
llvm-svn: 69810
2009-04-22 16:42:54 +00:00
Dan Gohman 79af854f55 Simplify trivial cast-of-cast SCEVs.
llvm-svn: 69809
2009-04-22 16:20:48 +00:00
Dan Gohman 54fd2869a3 SCEVExpander's InsertCastOfTo knows how to move existing cast
instructions in order to avoid inserting new ones. However, if
the cast instruction is the SCEVExpander's InsertPt, this
causes subsequently emitted instructions to be inserted near
the cast, and not at the location of the original insert point.
Fix this by adjusting the insert point in such cases.
This fixes PR4009.

llvm-svn: 69808
2009-04-22 16:11:16 +00:00
Dan Gohman 9dd9a45e12 Use BasicBlock::iterator instead of Instruction* for insert points,
to better handle inserting instructions at the end of a block.

llvm-svn: 69807
2009-04-22 16:05:50 +00:00
Dan Gohman 87d138c3b9 Make SCEVExpanders private methods private, instead of protected.
llvm-svn: 69806
2009-04-22 16:00:36 +00:00
Dan Gohman 956ae9dc15 Use CloneModule's ValueMap in more places, instead of looking
up functions by name.

llvm-svn: 69805
2009-04-22 15:57:18 +00:00
Dan Gohman a4fea5b227 ISD::ADD_PARTS is gone; use ISD::SMUL_LOHI as an example instead.
llvm-svn: 69804
2009-04-22 15:55:31 +00:00
Douglas Gregor 3d48e3d6f5 Remove some debugging output from the PCH reader
llvm-svn: 69803
2009-04-22 14:18:52 +00:00
Ted Kremenek 9ebfe91dea ccc-analyzer: Don't create preprocessed files about the ignored 'cdecl' attribute. We know Clang doesn't support it yet.
llvm-svn: 69802
2009-04-22 13:42:27 +00:00
Sanjiv Gupta 107b2818ce Make the function begin label start after ther data pointer.
The address of data frame for function can be obtained by subtracting 2 from the function begin label.

llvm-svn: 69801
2009-04-22 12:02:36 +00:00
Daniel Dunbar 202f3dc5b3 Remove lookupFieldDeclFromIvar from ObjCIvarDecl interface.
- This is only used by CGObjCRuntime now.

llvm-svn: 69800
2009-04-22 12:00:04 +00:00
Daniel Dunbar 24579842a5 Simplify addRecordToClass, it is not legal to call it on a forward
declaration now.

llvm-svn: 69799
2009-04-22 10:56:29 +00:00
Duncan Sands ab4c600e8b These tests are x86 specific.
llvm-svn: 69798
2009-04-22 10:39:51 +00:00
Daniel Dunbar 7d4e1c5e4a Don't convert interface types (to structs) as part of CodeGenTypes.
- This has pros and cons, but for now the pros seem to significantly
   outway the con.

The con is that we will always need to cast in the runtime
implementation to a struct type, if we wish to access an interface
directly.

The pros are:
 - Avoid the cost of generating types which are used. Most
   manipulation of Objective-C objects is done through messages, and
   only the implementation of a class will directly access
   memory. Previously, we would convert the type even if it only
   appear as a function parameter, for example.

 - We don't need to worry about incomplete types, and
   UpdateCompletedType for interfaces is gone.

 - It becomes easier to narrow the interface to the shadow struct for
   Objective-C interfaces (so it can be eliminated).

Currently the runtimes still use the CodeGenTypes machinery to
generate the LLVM structure they need via ConvertTagDecl, but this can
eventually be replaced.

llvm-svn: 69797
2009-04-22 10:28:39 +00:00
Daniel Dunbar 7b4dfc8b78 Add CGObjCRuntime::GetConcreteClassStruct to encapsulate access to the
underlying llvm::StructType for an interface.

llvm-svn: 69796
2009-04-22 09:39:34 +00:00
Daniel Dunbar 66cb01313b Add another workaround for -include.
- If we don't find a file looking relative to the current working
   directory, fall back to header search. This is closer to what would
   happen if the lookup was starting from right directory in the first
   place (except it will find files in the directory of the main
   source file, which I *think* should not be found).

 - PR3992.

llvm-svn: 69794
2009-04-22 08:53:01 +00:00
Daniel Dunbar 83a66f78d2 Simplify.
llvm-svn: 69793
2009-04-22 08:50:59 +00:00
Owen Anderson 6cbf5bb9bb Real fix for PR3549, by using caching for predecessor counts in addition to the predecessors themselves. This halves the time
to optimize the testcase, beyond what my previous patch did.

llvm-svn: 69792
2009-04-22 08:50:12 +00:00
Owen Anderson 9ea578ea70 Add caching of predecessor counts as well as predecessors themselves.
llvm-svn: 69791
2009-04-22 08:46:33 +00:00
Daniel Dunbar 725dc2c5bb Emit meta data using the Ivar, not a looked up FieldDecl.
llvm-svn: 69790
2009-04-22 08:22:17 +00:00
Daniel Dunbar 89623deca1 Use ComputeIvarBaseOffset instead of looking up by hand.
llvm-svn: 69789
2009-04-22 08:20:31 +00:00
Owen Anderson bb754826c9 Use PredIteratorCache in LCSSA, which gives a 37% overall speedup on the testcase from PR3549. More improvements to come.
llvm-svn: 69788
2009-04-22 08:09:13 +00:00
Daniel Dunbar 9fd114d577 Merge ivar access amongst the three runtimes.
- For now, this means we are always doing the address computations by
   hand instead of constructing a proper GEP. Right now, however, this
   is less important than having fewer entry points to dealing with
   Objective-C interface layout.

llvm-svn: 69787
2009-04-22 07:32:20 +00:00
Daniel Dunbar 6067720a41 Make sure this test runs on all 3 Objective-C implementations.
llvm-svn: 69786
2009-04-22 07:28:06 +00:00
Owen Anderson ecf6910f41 Fix for PR3946, in which SmallVector could behave strangely in corner cases.
Patch by Peter Johnson.

llvm-svn: 69785
2009-04-22 07:16:54 +00:00
Chris Lattner 43e6f8c08b implement debug info support for id<proto> and interface<proto>
llvm-svn: 69784
2009-04-22 06:58:56 +00:00
Chris Lattner ad8f750f71 ObjCQualifiedClass is dead, remove it.
llvm-svn: 69783
2009-04-22 06:50:37 +00:00
Chris Lattner 587cbe1ef2 deserialization support for qualified interfaces
llvm-svn: 69782
2009-04-22 06:45:28 +00:00
Chris Lattner 6e054afc9e pch support for protocol qualified id's.
llvm-svn: 69781
2009-04-22 06:40:03 +00:00
Chris Lattner 8f0734972b add three new objc expression types. @selector doesn't work because we have no
way to serialize selectors yet.

llvm-svn: 69780
2009-04-22 06:29:42 +00:00
Chris Lattner 19cea4eeb4 implement serialization support for @encode,
fix a couple of bugs in reader support for ObjCInterfaceDecl,
and add support for reading ObjCInterfaceType.

llvm-svn: 69779
2009-04-22 05:57:30 +00:00
Chris Lattner 01146a5fa9 rename methods.* -> objc_methods.*
llvm-svn: 69778
2009-04-22 05:31:53 +00:00
Chris Lattner dc00437fa0 change implicit int warnings to point to the identifier, not the
start of the declspec.  The fixit still goes there, and we underline
the declspec.  This helps when the start of the declspec came from a
macro that expanded from a system header.  For example, we now produce:

t.c:2:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static x;
~~~~~~ ^

llvm-svn: 69777
2009-04-22 05:27:59 +00:00
Ted Kremenek 9dae596dc1 Update checker build.
llvm-svn: 69776
2009-04-22 05:13:56 +00:00
Daniel Dunbar 722f424178 Make ObjCInterfaceDecl's const in some more places.
llvm-svn: 69775
2009-04-22 05:08:15 +00:00
Douglas Gregor f89771cb87 Reorganize built-in initialization to separate the creation of target builtins from marking IdentifierInfos as builtins. No functionality change
llvm-svn: 69774
2009-04-22 04:56:28 +00:00
Daniel Dunbar 658ba85820 Revert r69771, I missed some (obvious) details. :/
llvm-svn: 69773
2009-04-22 04:39:47 +00:00
Daniel Dunbar aefc2b9be3 Mark another TypeForDecl const and make getObjCInterfaceType's argument const.
llvm-svn: 69772
2009-04-22 04:34:53 +00:00
Daniel Dunbar 25b81ef847 Rework the shadow struct that is layed out for Objective-C classes.
- Superclasses are now always laid out their shadow structure at the
   first field.

 - Prior to this, the entire class heirarchy was flattened into a
   single structure which meant that alignment, padding, and bitfields
   weren't packed correctly (the ASTRecordLayout was correct however,
   which meant our debug info didn't coincide with ivar offsets, for
   example).

 - This is still very suboptimal, but I believe the ivar layout itself
   is now at least close to correct.

 - <rdar://problem/6773388> error: objc[29823]: layout bitmap sliding
   backwards

llvm-svn: 69771
2009-04-22 03:45:12 +00:00
Chris Lattner ed462a8d44 Fix rdar://6814950 - stdint.h isn't "-pedantic -std=c89" clean,
by marking the predefines buffer as a system header.  The problem 
with stdint is that it was getting problems like this:

/Volumes/Projects/cvs/llvm/Debug/lib/clang/1.0/include/stdint.h:43:9: warning: 'long long' is an extension when C99 mode is not enabled
typedef __INT64_TYPE__ int64_t;
        ^
<built-in>:73:29: note: instantiated from:
#define __INT64_TYPE__ long long
                            ^

We correctly silence warnings in system headers, but only if the 
spelling location of the token came from the system header.  This is
designed so that if you use a system macro in your code that you don't
get punished for its definition.  This is all cool except that the 
predefines buffer wasn't considered a system header.

llvm-svn: 69770
2009-04-22 03:42:19 +00:00
Chris Lattner 2dfdb3ea94 move 64-bit abi functions to lazy model, everything is lazy now, yay.
llvm-svn: 69767
2009-04-22 02:53:24 +00:00