John McCall
4f29b49de1
Support compound complex operations as l-values in C++. Add a test
...
case based on CodeGen/volatile-1.c which tests the current C++
semantics, and note the many, many places we fall short of them.
llvm-svn: 119402
2010-11-16 23:07:28 +00:00
Fariborz Jahanian
a3e54bd33e
Implements __block API for c++ objects. There is still
...
issue with runtime which I am discussing it with Blaine.
This is wip (so no test yet).
llvm-svn: 119368
2010-11-16 19:29:39 +00:00
John McCall
07bb19667a
Simplify some complex emission and implement correct semantics for
...
assignment to volatiles in C. This in effect reverts some of mjs's
work in and around r72572. Basically, the C++ standard is quite
clear, except that it lies about volatile behavior approximating
C's, whereas the C standard is almost actively misleading.
llvm-svn: 119344
2010-11-16 10:08:07 +00:00
John McCall
3eba6e67ec
Now that we have reliable cast kinds, simplify scalar cast IR gen.
...
llvm-svn: 119332
2010-11-16 06:21:14 +00:00
John McCall
d50a27111c
Kill CK_Unknown and flesh out the documentation for the existing CastKinds.
...
llvm-svn: 119331
2010-11-16 05:46:29 +00:00
John McCall
fa8edb11e1
Teach complex compound assignment IR-generation that the RHS of
...
a compound assignment is always already in the computation type.
llvm-svn: 119330
2010-11-16 05:45:35 +00:00
Bob Wilson
e4652b1f22
Change CXXNameMangler::mangleNeonVectorType to require the vector type to be
...
one of the special Neon types. We'll check for invalid Neon vectors when
they are created, so there's no point in handling them when mangling.
llvm-svn: 119299
2010-11-16 00:32:18 +00:00
Bob Wilson
59f9dec8cd
Use getTypeSize() method.
...
llvm-svn: 119297
2010-11-16 00:32:12 +00:00
John McCall
8d69a2160e
Add a new expression kind, OpaqueValueExpr, which is useful for
...
certain internal type-checking procedures as well as for representing
certain implicitly-generated operations. Uses to follow.
llvm-svn: 119289
2010-11-15 23:31:06 +00:00
Fariborz Jahanian
9db7b8b1ef
Some cleanup of block API code.
...
llvm-svn: 119174
2010-11-15 19:19:38 +00:00
Chandler Carruth
99da11cf04
Silence an unused variable warning during release builds by folding the
...
expression into the assert.
llvm-svn: 119143
2010-11-15 13:54:43 +00:00
John McCall
8cb679e4e1
Assorted work leading towards the elimination of CK_Unknown.
...
llvm-svn: 119138
2010-11-15 09:13:47 +00:00
John McCall
83fe49d1e1
Always emit full loads from volatile complex l-values.
...
Return the result of a complex assignment with the original values,
not by performing a load from the l-value; this is the correct
semantics in C, although not in C++.
llvm-svn: 119037
2010-11-14 09:40:28 +00:00
John McCall
d764625448
Add a few more complex-related cast kinds that arise due to arbitrary
...
implicit conversions; the last batch was specific to promotions.
I think this is the full set we need. I do think dividing the cast
kinds into floating and integral is probably a good idea.
Annotate a *lot* more C casts with useful cast kinds.
llvm-svn: 119036
2010-11-14 08:17:51 +00:00
Fariborz Jahanian
574940e16f
Removed unnecessary initialization of a flag which
...
somehow got several block tests fail with a linux built
compiler.
llvm-svn: 119027
2010-11-14 05:25:15 +00:00
Fariborz Jahanian
9ffe24f186
Initialize couple of fields.
...
llvm-svn: 119014
2010-11-13 23:48:30 +00:00
Fariborz Jahanian
e988bdac44
Block API patch to do copy ctor of copied-in cxx objects in
...
copy helper function and dtor of copied cxx objects
in dispose helper functions. __block variables
TBD next.
llvm-svn: 119011
2010-11-13 21:53:34 +00:00
John McCall
c5e62b47af
Introduce five new cast kinds for various conversions into and
...
between complex types.
llvm-svn: 118994
2010-11-13 09:02:35 +00:00
John McCall
e84af4e486
Introduce a null-to-pointer implicit cast kind.
...
llvm-svn: 118966
2010-11-13 01:35:44 +00:00
Benjamin Kramer
c78d86a2af
Reduce string thrashing.
...
llvm-svn: 118915
2010-11-12 18:45:23 +00:00
Bob Wilson
f58e8a4db7
Use ASTContext::getTypeInfo to find the vector element size.
...
llvm-svn: 118899
2010-11-12 17:24:49 +00:00
Bob Wilson
8470b33762
Add a separate NeonPolyVector kind to distinguish polynomial vector types.
...
Add support for mangling those types according to ARM's ABI.
llvm-svn: 118898
2010-11-12 17:24:46 +00:00
Bob Wilson
c155521a96
Add special-case mangling for Neon vector types.
...
llvm-svn: 118897
2010-11-12 17:24:43 +00:00
Benjamin Kramer
8c173cc364
Use a twine.
...
llvm-svn: 118892
2010-11-12 15:42:18 +00:00
Douglas Gregor
ad3832e213
Teach debug-info generation that SourceManager::getPresumedLoc() can
...
produce an invalid location even when given a valid location, if the
file system has changed underneath us. Recovery more gracefully.
llvm-svn: 118834
2010-11-11 20:45:16 +00:00
Fariborz Jahanian
2a5deb56a4
Adding couple of Block API, a bug fix and
...
a test change, all for blocks. wip.
llvm-svn: 118745
2010-11-11 00:11:38 +00:00
Bob Wilson
aeb56444f9
Add a variant of GCC-style vector types for ARM NEON.
...
NEON vector types need to be mangled in a special way to comply with ARM's ABI,
similar to some of the AltiVec-specific vector types. This patch is mostly
just renaming a bunch of "AltiVecSpecific" things, since they will no longer
be specific to AltiVec. Besides that, it just adds the new "NeonVector" enum.
llvm-svn: 118724
2010-11-10 21:56:12 +00:00
Charles Davis
99202b358f
Use the right calling convention when mangling names in the Microsoft C++
...
mangler. Now member functions and pointers thereof have their calling
convention mangled as __thiscall if they have the default CC (even though,
they technically still have the __cdecl CC).
llvm-svn: 118598
2010-11-09 18:04:24 +00:00
David Chisnall
82f755c58d
Remove the use of aliases in outputted code from ObjC (GNU runtime).
...
llvm-svn: 118498
2010-11-09 11:21:43 +00:00
Nick Lewycky
30d939681c
Remove debugging printf.
...
Fix linux build.
llvm-svn: 118497
2010-11-09 09:53:02 +00:00
Anders Carlsson
c1351cac17
Introduce the concept of a non-virtual base type to CGRecordLayoutBuilder as a first step towards fixing PR6995.
...
llvm-svn: 118491
2010-11-09 05:25:47 +00:00
Argyrios Kyrtzidis
8909686b22
Fix miscompilation regarding VLAs; subscription of VLA pointers was incorrect.
...
Fixes rdar://8644873 & http://llvm.org/PR8567 .
llvm-svn: 118468
2010-11-09 01:30:48 +00:00
John McCall
478382521e
When re-using a vtable slot for the nearest overridden method, just because
...
there's no return adjustment from the overridden to the overrider doesn't
mean there isn't a return adjustment from the overrider to the final
overrider. This matters if we're emitting a virtual this-adjustment thunk
because the overrider virtually inherits from the class providing the
nearest overridden method. Do the appropriate return adjustment in this case.
Fixes PR7611.
llvm-svn: 118466
2010-11-09 01:18:05 +00:00
Douglas Gregor
1ccc8416a0
Remove broken support for variadic templates, along with the various
...
abstractions (e.g., TemplateArgumentListBuilder) that were designed to
support variadic templates. Only a few remnants of variadic templates
remain, in the parser (parsing template type parameter packs), AST
(template type parameter pack bits and TemplateArgument::Pack), and
Sema; these are expected to be used in a future implementation of
variadic templates.
But don't get too excited about that happening now.
llvm-svn: 118385
2010-11-07 23:05:16 +00:00
John McCall
2faab302e0
ARM EH uses a different personality function in C.
...
llvm-svn: 118366
2010-11-07 02:35:25 +00:00
John McCall
cdf7ef5437
Simplify the logic for emitting guard variables for template static
...
data members by delaying the emission of the initializer until after
linkage and visibility have been set on the global. Also, don't
emit a guard unless the variable actually ends up with vague linkage,
and don't use thread-safe statics in any case.
llvm-svn: 118336
2010-11-06 09:44:32 +00:00
Anders Carlsson
ba37e1eb49
std::nullptr_t is a fundamental type for RTTI purposes.
...
llvm-svn: 118238
2010-11-04 05:28:09 +00:00
Anders Carlsson
2683fd6f8c
Mangle std::nullptr_t as specified by the Itanium C++ ABI.
...
llvm-svn: 118236
2010-11-04 04:31:32 +00:00
David Chisnall
e8431a7766
Some fixes for synthesized ivar metadata (GNU runtime).
...
llvm-svn: 118172
2010-11-03 16:12:44 +00:00
John McCall
8e7cb6dcfa
Ensure that static local variables in function templates inherit the
...
visibility of their function.
llvm-svn: 118065
2010-11-02 21:04:24 +00:00
Fariborz Jahanian
dc9bc5aeb8
Fix a crash mangling decayed val argument-typed function.
...
// rdar: //8620510 and PR7666
llvm-svn: 118019
2010-11-02 16:54:00 +00:00
Devang Patel
86f30f5a1d
Simplify. Builtin types' context is always implied.
...
llvm-svn: 117928
2010-11-01 16:52:40 +00:00
Anders Carlsson
fd88a6160d
Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset.
...
llvm-svn: 117881
2010-10-31 23:22:37 +00:00
John McCall
c273f24196
Better solution: calculate the visibility of functions and variables
...
independently of whether they're definitions, then teach IR generation to
ignore non-explicit visibility when emitting declarations. Use this to
make sure that RTTI, vtables, and VTTs get the right visibility.
More of rdar://problem/8613093
llvm-svn: 117781
2010-10-30 11:50:40 +00:00
Dale Johannesen
7d3dfc0622
Generate bitcasts going in and out of MMX parameters
...
in asm's. PR 8501, 8602988.
I don't like including Type.h where it is; the idea was
to get references to X86_MMXTy out of the common code.
Maybe there's a better way?
llvm-svn: 117736
2010-10-29 23:12:32 +00:00
Dan Gohman
e9e32dcb48
Use CodeGenFunction's getContext(), for consistency.
...
llvm-svn: 117734
2010-10-29 22:47:07 +00:00
John McCall
37bb6c9832
Restore r117644, this time properly ignoring -fvisibility and type visibility
...
for namespace-scope variable declarations.
Apply visibility in IR gen to variables that are merely declared
and never defined. We were previously emitting these with default
visibility unless they were declared with private_extern.
Ignore global visibility settings when computing visibility for
a declaration's context, and key several conditions on whether a
visibility attribute exists anywhere in the hierarchy as opposed
to whether it exists at the current level.
llvm-svn: 117729
2010-10-29 22:22:43 +00:00
Devang Patel
31d1e2153f
After processing named unions do not fall through to handle anonymous unions.
...
This is tested by funcargs.exp in gdb testsuite.
llvm-svn: 117659
2010-10-29 16:21:19 +00:00
Daniel Dunbar
df8792128f
Revert r117644, "Apply visibility in IR gen to variables that are merely
...
declared", it breaks things.
llvm-svn: 117653
2010-10-29 15:19:36 +00:00
John McCall
077dc60540
Don't assert on attempts to throw 'bool'. I wonder if in the history of C++
...
anyone has ever intentionally done this outside of a compiler test case.
llvm-svn: 117645
2010-10-29 08:14:02 +00:00
John McCall
4af6bf1fdc
Apply visibility in IR gen to variables that are merely declared
...
and never defined. We were previously emitting these with default
visibility unless they were declared with private_extern.
Ignore global visibility settings when computing visibility for
a declaration's context, and key several conditions on whether a
visibility attribute exists anywhere in the hierarchy as opposed
to whether it exists at the current level.
llvm-svn: 117644
2010-10-29 07:49:41 +00:00
Devang Patel
ed23f18d7e
Basic types are language defined builtins. They are always defined at top most level.
...
llvm-svn: 117613
2010-10-28 22:03:20 +00:00
John McCall
565141612f
When emitting l-values for bool non-__block decl references, make a pointer
...
using the memory type; fixes an assert.
Fixes rdar://problem/8605032
llvm-svn: 117610
2010-10-28 21:37:57 +00:00
Devang Patel
faadd7b72d
Directly use NamespaceDecl->getLocation() to find the source file.
...
llvm-svn: 117576
2010-10-28 19:12:46 +00:00
Devang Patel
8e0073008a
Stay within 80 columns.
...
llvm-svn: 117561
2010-10-28 17:27:32 +00:00
John McCall
9de9160d55
Implement an indirect-goto optimization for goto *&&lbl and respect this
...
in the scope checker. With that done, turn an indirect goto into a
protected scope into a hard error; otherwise IR generation has to start
worrying about declarations not dominating their scopes, as exemplified
in PR8473.
If this really affects anyone, I can probably adjust this to only hard-error
on possible indirect gotos into VLA scopes rather than arbitrary scopes.
But we'll see how people cope with the aggressive change on the marginal
feature.
llvm-svn: 117539
2010-10-28 08:53:48 +00:00
Devang Patel
1bee63f325
Fix context info for enums.
...
Radar 8595129
llvm-svn: 117507
2010-10-27 23:23:58 +00:00
John McCall
3a7f6926d1
Restore r117403 (fixing IR gen for bool atomics), this time being less
...
aggressive about the form we expect bools to be in. I don't really have
time to fix all the sources right now.
llvm-svn: 117486
2010-10-27 20:58:56 +00:00
Rafael Espindola
9d798a07e4
Revert r117403 as it caused PR8480.
...
llvm-svn: 117456
2010-10-27 17:13:49 +00:00
Fariborz Jahanian
1518a5eca7
Do the guarding of instantiated static data members
...
on if its linkage is weak. Currently this is the
case but may change in the future. (part of radar
8562966).
llvm-svn: 117452
2010-10-27 16:21:54 +00:00
Anders Carlsson
b00c2144b3
Also devirtualize calls to a member functions where the containing class has been marked final.
...
llvm-svn: 117445
2010-10-27 13:34:43 +00:00
Anders Carlsson
a7911fa3d7
If a virtual member function has the 'final' attribute, we can devirtualize calls to it.
...
llvm-svn: 117444
2010-10-27 13:28:46 +00:00
Fariborz Jahanian
67ca8c4c7b
Patch to provide guard when initializing instances
...
of static data member of a class template.
Fixes //rdar :// 8562966 and pr8409.
llvm-svn: 117410
2010-10-26 22:47:47 +00:00
John McCall
6bde954f47
Extract procedures to do scalar-to-memory and memory-to-scalar conversions
...
in IR gen, and use those to fix a correctness issue with bool atomic
intrinsics. rdar://problem/8461234
llvm-svn: 117403
2010-10-26 22:09:15 +00:00
Dan Gohman
8fc50c296a
Factor out the code for emitting code to load vtable pointer members
...
so that it's done in one place.
llvm-svn: 117386
2010-10-26 18:44:08 +00:00
Dan Gohman
dc2c4db598
Add infrastructure for emitting TBAA metadata with the "constant" flag.
...
llvm-svn: 117328
2010-10-25 23:51:23 +00:00
Dan Gohman
d831356635
Trim an unnecessary #include.
...
llvm-svn: 117321
2010-10-25 21:59:29 +00:00
Dan Gohman
7dfd13c167
Factor out the code for creating the Root and Char nodes, so that
...
they can be used outside of the main getTBAAInfo function.
llvm-svn: 117320
2010-10-25 21:48:30 +00:00
Fariborz Jahanian
c123623d28
After discussion with Doug and John, I am reverting
...
the patch.
llvm-svn: 117159
2010-10-22 22:05:03 +00:00
John McCall
457a04e3ce
Substantially revise how clang computes the visibility of a declaration to
...
more closely parallel the computation of linkage. This gets us to a state
much closer to what gcc emits, modulo bugs, which will undoubtedly arise in
abundance.
llvm-svn: 117147
2010-10-22 21:05:15 +00:00
Fariborz Jahanian
0196aa28ec
Patch fixes miscompile with non-trivial copy constructors and
...
statement expressions, //rdar: //8540501
llvm-svn: 117146
2010-10-22 21:01:02 +00:00
Devang Patel
401c916c8a
Delay record type's debug info emission, in -flimit-debug-info mode, if member expression's base is call expr.
...
llvm-svn: 117127
2010-10-22 18:56:27 +00:00
Devang Patel
db3910000a
Revert unintentional check-in.
...
llvm-svn: 117120
2010-10-22 18:31:12 +00:00
Devang Patel
f79199d140
Tidy up MIPS_linkage name. Provide it only if it does not match regular name, otherwise it confuses debugger.
...
This is tested by local.C in llvmgcc testsuite.
llvm-svn: 117107
2010-10-22 17:11:50 +00:00
Benjamin Kramer
fb5e584151
More class anonymization.
...
llvm-svn: 117106
2010-10-22 16:48:22 +00:00
Dan Gohman
2bb62c3d2b
Rename clang's TBAA tree root from "experimental" to "simple".
...
llvm-svn: 117046
2010-10-21 18:50:04 +00:00
Dan Gohman
5419ce6827
Add some more comments.
...
llvm-svn: 117043
2010-10-21 18:49:12 +00:00
Fariborz Jahanian
50c925fe96
This patch implements Next's IRGen for -fconstant-string-class=class-name.
...
PR6056, //rdar: //8564463
llvm-svn: 116819
2010-10-19 17:19:29 +00:00
Michael J. Spencer
f5a1fbcdf3
Fix Whitespace.
...
llvm-svn: 116798
2010-10-19 06:39:39 +00:00
Bill Wendling
9987c0ea42
We shouldn't keep track of MMX registers "needed" separately from the SSE
...
registers needed.
llvm-svn: 116772
2010-10-18 23:51:38 +00:00
John McCall
18e4edae82
Fix some bugs in local class mangling brought up in PR8355.
...
Patch by Richard Smith!
llvm-svn: 116752
2010-10-18 21:28:44 +00:00
Fariborz Jahanian
f34011e4ca
patch fixes class names missing from method names in debug information for
...
synthesized property. // rdar: //8498026
llvm-svn: 116717
2010-10-18 17:51:06 +00:00
Bill Wendling
5cd41c4b13
Reapply r116684 with fixes. The test cases needed to be updated.
...
llvm-svn: 116696
2010-10-18 03:41:31 +00:00
Bill Wendling
c7c9be661f
Temporarily revert r116684. It was causing failures with
...
Clang :: CodeGen/x86_32-arguments-darwin.c
Clang :: CodeGen/x86_32-arguments-linux.c
llvm-svn: 116687
2010-10-17 07:58:46 +00:00
Bill Wendling
812f4b123e
The "gcc.dg/compat/vector-1 -m32" test was broken after the MMX rewrite. The
...
function parameters weren't converted to use the correct type (x86_mmx). Add a
check, similar to the one in llvm-gcc, to see if we need the x86_mmx type for
that function parameter. If so, it coerces the type to be that.
llvm-svn: 116684
2010-10-17 07:38:01 +00:00
John McCall
d509182336
Coding by inspection has its problems.
...
llvm-svn: 116672
2010-10-16 16:34:08 +00:00
John McCall
17afe45a87
objc_exception_rethrow does not take an exception argument.
...
rdar://problem/8535238
llvm-svn: 116663
2010-10-16 08:21:07 +00:00
Daniel Dunbar
622581b73b
Revert r116656, "IRgen/Obj-C/NeXT: Fix the IR signature for
...
objc_exception_rethrow, so we don't...", since something is actually trying to
call this with the wrong signature (!). Unfortunately I don't understand the new
EH infrastructure well enough to fix it immediately.
llvm-svn: 116660
2010-10-16 05:04:10 +00:00
Daniel Dunbar
90bb5c2315
IRgen/Obj-C/NeXT: Fix the IR signature for objc_exception_rethrow, so we don't
...
generate unnecessary %al clear on x86_64.
llvm-svn: 116656
2010-10-16 04:08:16 +00:00
Dan Gohman
f47df3e02a
Mention the paragraphs in the standards which sanction TBAA.
...
llvm-svn: 116617
2010-10-15 20:54:41 +00:00
Dan Gohman
c44fd6486e
Use a different name for pointer types in tbaa, to be a little
...
more consistent with other names, and to look less like a magic name.
llvm-svn: 116616
2010-10-15 20:26:20 +00:00
Dan Gohman
2d0a3c7b8c
Add a comment.
...
llvm-svn: 116615
2010-10-15 20:24:53 +00:00
Dan Gohman
4a3b1b3ef4
Fix a typo in a comment Frits van Bommel spotted.
...
llvm-svn: 116614
2010-10-15 20:24:10 +00:00
Dan Gohman
2e29eb5a4b
Experimental TBAA support for enum types.
...
llvm-svn: 116613
2010-10-15 20:23:12 +00:00
Dan Gohman
d19ee8a07f
Don't leak the TBAA object.
...
llvm-svn: 116595
2010-10-15 18:04:46 +00:00
Dan Gohman
f5c5e0773e
Add a comment about odd "signed char" incompatibility between C++ and C.
...
llvm-svn: 116593
2010-10-15 17:52:03 +00:00
John McCall
1c9c3fd50a
Death to blocks, or at least the word "block" in one particular obnoxiously
...
ambiguous context.
llvm-svn: 116567
2010-10-15 04:57:14 +00:00
Daniel Dunbar
59ae137329
Update CMake.
...
llvm-svn: 116548
2010-10-15 00:39:31 +00:00
Dan Gohman
d65c196439
Add a TBAA type for pointer types.
...
llvm-svn: 116544
2010-10-15 00:01:39 +00:00
Dan Gohman
3f1cf0f373
Unsigned types are TBAA-compatible with their signed counterparts.
...
Also, handle unknown types conservatively.
llvm-svn: 116541
2010-10-14 23:39:00 +00:00
Dan Gohman
947c9af774
Experimental TBAA support.
...
This enables metadata generation by default, however the TBAA pass
in the optimizer is still disabled for now.
llvm-svn: 116536
2010-10-14 23:06:10 +00:00
Devang Patel
0f58561907
Use root non-virtual primary base class, not just immediate primary base class, for AT_containing_type.
...
This is tested by virtfunc.exp in gdb testsuite.
llvm-svn: 116535
2010-10-14 22:59:23 +00:00
Fariborz Jahanian
681c0754d9
Eliminate usage of ObjCSuperExpr used for
...
'super' as receiver of property or a setter/getter
methods. //rdar: //8525788
llvm-svn: 116483
2010-10-14 16:04:05 +00:00
Devang Patel
67f70aaf5a
Fix debug info for anon union.
...
This is tested by anon-union.exp.
llvm-svn: 116372
2010-10-12 23:24:54 +00:00
Fariborz Jahanian
77890879dd
Fixes a typo which caused byte offset in debug info
...
for ivars to be 0. Fixes pr8353.
llvm-svn: 116273
2010-10-11 23:55:47 +00:00
Devang Patel
33ddf69fb3
Fix debug info for functions whose context is a namespace.
...
This is tested by namespace.exp in gdb testsuite.
llvm-svn: 116248
2010-10-11 21:58:41 +00:00
Chris Lattner
a09e8efd1f
Per discussion with Sanjiv, remove the PIC16 target from mainline. When/if
...
it comes back, it will be largely a rewrite, so keeping the old codebase
in tree isn't helping anyone.
llvm-svn: 116191
2010-10-11 05:44:49 +00:00
Argyrios Kyrtzidis
0c34b138df
Make sure the VTables for template instantiations are emitted even if the key function doesn't have a body.
...
llvm-svn: 116186
2010-10-11 03:25:57 +00:00
Argyrios Kyrtzidis
f0e31c8b9c
Don't let typeinfo name symbols be 'internal hidden', it can lead to linker conflicts
...
with similarly named classes in anonymous namespaces.
llvm-svn: 116185
2010-10-11 03:25:53 +00:00
NAKAMURA Takumi
11f6be1ce8
lib/CodeGen/CodeGenModule.cpp: DLLImportLinkage should be processed also on declaration.
...
It enables clang to compile Mingw's headers.
llvm-svn: 116184
2010-10-11 02:30:56 +00:00
Argyrios Kyrtzidis
073c9cb592
Implement __builtin_ia32_vec_ext_v2si function (required by Qt).
...
llvm-svn: 116162
2010-10-10 03:19:11 +00:00
Bill Wendling
65b2a965fb
Add target implementations for the X86 builtins:
...
__builtin_ia32_vec_init_v8qi
__builtin_ia32_vec_init_v4hi
__builtin_ia32_vec_init_v2si
They are lowered to bitcasts. (These are all ready tested by the gcc testsuite.)
<rdar://problem/8529957>
llvm-svn: 116147
2010-10-09 08:47:25 +00:00
John McCall
a2fabff4f6
Permit constant evaluation of const floating-point variables with
...
constant initializers.
llvm-svn: 116138
2010-10-09 01:34:31 +00:00
Douglas Gregor
0bf3140424
Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked a
...
bit by me).
llvm-svn: 116122
2010-10-08 23:50:27 +00:00
Douglas Gregor
7a2b425ee1
Revert the hack Chris Lattner added in r97981 to work around
...
brokenness in the designated-initializer ASTs. The ASTs were fixed by
Alp Toker's patch (r116098) for PR6955. Fixes PR6537.
llvm-svn: 116101
2010-10-08 20:56:19 +00:00
Devang Patel
3db5480b27
Tighter check in r116060 blcoked enums also. Emit enum const's debug info.
...
llvm-svn: 116071
2010-10-08 18:24:19 +00:00
Devang Patel
5e8ee2bb89
Do not repeat debug info for file variable constants.
...
This is tested by file-statics.exp in gdb testsuite.
llvm-svn: 116060
2010-10-08 17:02:40 +00:00
Devang Patel
251f859b23
Identify functions with prototype appropriately in debug info.
...
This is tested by callfuncs.exp in gdb testsuite.
llvm-svn: 115989
2010-10-07 22:03:49 +00:00
Devang Patel
284fa417ec
Mark FunctionNoProtoType's argument as unspecified parameters.
...
llvm-svn: 115834
2010-10-06 20:51:45 +00:00
John McCall
569eafce63
Re-enable EH cleanups to destroy __block variables, now that we have a moment to
...
deal with the consequences. Fixes rdar://problem/8224178.
llvm-svn: 115816
2010-10-06 18:56:43 +00:00
Devang Patel
c0601d1e99
Do not emit subrange for incomplete array type.
...
This is tested by ptype.exp in gdb testsuite.
llvm-svn: 115805
2010-10-06 18:30:00 +00:00
Devang Patel
5b389f495b
Remove unused argument.
...
llvm-svn: 115789
2010-10-06 15:58:57 +00:00
John McCall
e5dd32da11
Teach PopCleanupBlock to correctly handle the possibility of branching through
...
a EH-only cleanup as part of a fallthrough branch-through. That this happens
for this test case is actually a separate bug.
llvm-svn: 115668
2010-10-05 20:48:15 +00:00
John McCall
0077b22aa4
If we're resolving all outstanding fixups, and there are multiple fixups
...
for the same destination, then we must potentially rewrite the initial branch
of every fixup. Without this patch, a short-circuit check meant to prevent
a switch case from being redundantly added was preventing later fixups from
being processed. Fixes PR8175 (again).
llvm-svn: 115586
2010-10-05 02:33:56 +00:00
John McCall
9916e3fa93
In the fragile ObjC ABI, save the caught exception to the side if there are
...
both @catches and a @finally, because the second call to @objc_exception_try_enter
will clobber the exception slot. Fixes rdar://problem/8440970.
llvm-svn: 115575
2010-10-04 23:42:51 +00:00
Devang Patel
3703ff4163
dyn_cast is more appropriate here.
...
llvm-svn: 115569
2010-10-04 22:28:23 +00:00
Devang Patel
95eea45aa5
Add missing '}' :)
...
llvm-svn: 115568
2010-10-04 22:13:18 +00:00
Devang Patel
44b8bf0f5b
Emit debug info for an aggregate while processing MemberExpr if the aggregate's debug info was delayed untill now.
...
llvm-svn: 115564
2010-10-04 21:46:04 +00:00
Devang Patel
cbc7bc94c9
Fix filename in header comment.
...
llvm-svn: 115561
2010-10-04 21:15:33 +00:00
Chris Lattner
64d7f2a014
when expanding a builtin, if the argument is required to be a constant,
...
force it to be a constant instead of emitting with EmitScalarExpr. In
-ftrapv mode, they are not the same.
This fixes rdar://8478728 + PR8221
llvm-svn: 115388
2010-10-02 00:09:12 +00:00
Chris Lattner
07e96866a2
tidy
...
llvm-svn: 115383
2010-10-01 23:43:16 +00:00
Devang Patel
d18c5aa20a
Mark explict methods as explict in debug info.
...
llvm-svn: 115379
2010-10-01 23:32:17 +00:00
Fariborz Jahanian
885e9dff93
Output debug info. for ivars declared in class
...
extension and implementation.
Fixes rdar://8493239.
llvm-svn: 115248
2010-10-01 00:01:53 +00:00
Devang Patel
91bbb5547d
Introduce -flimit-debug-info.
...
In this experimental mode try avoiding debug info emission for classes as much as possible. The goal is to reduce size of produced debuginfo without reducing quality of debug info in general. This is a work in progress.
llvm-svn: 115188
2010-09-30 19:05:55 +00:00
Devang Patel
7c086227e6
Attach aritifical attribute with implicit parameters.
...
Radar 8493141.
llvm-svn: 115104
2010-09-29 23:09:21 +00:00
Devang Patel
330b65e350
Emit method access specifier.
...
Radar 8490416.
llvm-svn: 115090
2010-09-29 21:46:16 +00:00
Devang Patel
db2732ac42
Update to reflect DIFactory::CreateSubprogram() interface change from r115084.
...
llvm-svn: 115085
2010-09-29 21:05:52 +00:00
Devang Patel
984cdeef37
Remove dead code.
...
llvm-svn: 115079
2010-09-29 20:05:01 +00:00
Daniel Dunbar
8caf6415a8
Add support for attribute((naked)), patch by Zoxc on cfe-commits!
...
- Minor style tweaks by me.
llvm-svn: 115056
2010-09-29 18:20:25 +00:00
Bill Wendling
11191f11b8
Accidentally committed some temporary changes on my branch when reverting patches.
...
llvm-svn: 114936
2010-09-28 01:28:56 +00:00
Bill Wendling
6d8c442e08
Temporarily revert 114929 114925 114924 114921. It looked like they (or at least
...
one of them) was causing a series of failures:
http://google1.osuosl.org:8011/builders/clang-x86_64-darwin10-selfhost/builds/4518
svn merge -c -114929 https://llvm.org/svn/llvm-project/cfe/trunk
--- Reverse-merging r114929 into '.':
U include/clang/Sema/Sema.h
U include/clang/AST/DeclCXX.h
U lib/Sema/SemaDeclCXX.cpp
U lib/Sema/SemaTemplateInstantiateDecl.cpp
U lib/Sema/SemaDecl.cpp
U lib/Sema/SemaTemplateInstantiate.cpp
U lib/AST/DeclCXX.cpp
svn merge -c -114925 https://llvm.org/svn/llvm-project/cfe/trunk
--- Reverse-merging r114925 into '.':
G include/clang/AST/DeclCXX.h
G lib/Sema/SemaDeclCXX.cpp
G lib/AST/DeclCXX.cpp
svn merge -c -114924 https://llvm.org/svn/llvm-project/cfe/trunk
--- Reverse-merging r114924 into '.':
G include/clang/AST/DeclCXX.h
G lib/Sema/SemaDeclCXX.cpp
G lib/Sema/SemaDecl.cpp
G lib/AST/DeclCXX.cpp
U lib/AST/ASTContext.cpp
svn merge -c -114921 https://llvm.org/svn/llvm-project/cfe/trunk
--- Reverse-merging r114921 into '.':
G include/clang/AST/DeclCXX.h
G lib/Sema/SemaDeclCXX.cpp
G lib/Sema/SemaDecl.cpp
G lib/AST/DeclCXX.cpp
llvm-svn: 114933
2010-09-28 01:09:49 +00:00
Douglas Gregor
ec3bec0c7a
Kill FunctionDecl's IsCopyAssignment bit; it duplicated what could
...
already be determined by isCopyAssignmentOperator(), and was set too
late in the process for all clients to see the appropriate
value. Cleanup only; no functionality change.
llvm-svn: 114916
2010-09-27 22:37:28 +00:00
Bill Wendling
1308667f18
Revert my patch changing the MMX "shift" intrinsics that take immediates into
...
"shift with non-immediate" intrinsics. It gets here because we they aren't
immediates anymore.
llvm-svn: 114890
2010-09-27 21:22:25 +00:00
Fariborz Jahanian
8fb87aec78
Patch implements passing arrays to functions expecting
...
vla. Implements pr7827.
llvm-svn: 114737
2010-09-24 17:30:16 +00:00
Daniel Dunbar
19964dbe3b
IRgen/ABI/ARM: Return large vectors in memory.
...
llvm-svn: 114619
2010-09-23 01:54:32 +00:00
Daniel Dunbar
b34b08098c
IRgen/ABI/ARM: Trust the backend to pass vectors correctly for the given ABI.
...
- Therefore, we can lower out the NEON wrapper structs and pass the vectors
directly. This makes a huge difference in the cleanliness of the IR after
optimization.
- I will trust, but verify, via future ABITest testing (for APCS-GNU, at
least).
llvm-svn: 114618
2010-09-23 01:54:28 +00:00
Chris Lattner
b2f659b7a0
fix the rest of rdar://8461279 - clang miscompiles address-space qualified atomics
...
llvm-svn: 114503
2010-09-21 23:40:48 +00:00
Chris Lattner
c9066d3072
same bug as before, this time with __sync_val_compare_and_swap.
...
llvm-svn: 114502
2010-09-21 23:35:30 +00:00
Chris Lattner
7cf46bfda0
fix __sync_bool_compare_and_swap to work with address-space qualified types.
...
llvm-svn: 114498
2010-09-21 23:24:52 +00:00
Fariborz Jahanian
521c72c756
Fixes an IRgen ICE due to cast of null pointer to
...
a vla type (fixes pr7827).
llvm-svn: 114495
2010-09-21 22:53:33 +00:00
Fariborz Jahanian
cb75021034
IRgen for gnu extension's conditional lvalue expression
...
with missing LHS. radar 8453812. Executable test is checked
into llvm test suite.
llvm-svn: 114457
2010-09-21 18:32:21 +00:00
Benjamin Kramer
3e0c527dcc
Adjust for debug info API change.
...
llvm-svn: 114438
2010-09-21 15:59:59 +00:00
Fariborz Jahanian
8162d4ad31
Implements in IRgen gnu extensions missing LHS for
...
complex conditionals. Radar 8453812.
llvm-svn: 114376
2010-09-20 23:50:22 +00:00
Nate Begeman
abb5a7370d
Check in support for OpenCL conditional operator on vector types.
...
llvm-svn: 114371
2010-09-20 22:41:17 +00:00
Fariborz Jahanian
4fbf4af0f6
Fixes IRgen bug in objc++ reference binding of a
...
getter expression.
Fixes // rdar://8437240
llvm-svn: 114299
2010-09-18 20:47:25 +00:00
Gabor Greif
bf98608a3d
do not rely on the implicit-dereference semantics of dyn_cast_or_null
...
llvm-svn: 114281
2010-09-18 13:00:17 +00:00
John McCall
f09d96f76d
Adjust a fixup's starting branch if it's being resolved because
...
it reached the outermost scope and it hasn't yet been forwarded
to a cleanup. Fixed PR8175.
llvm-svn: 114259
2010-09-18 02:24:39 +00:00
John Thompson
1224061281
Added '|' delimiter to separate inline asm multiple alternative constraints for Clang side of support.
...
llvm-svn: 114253
2010-09-18 01:15:13 +00:00
John McCall
8ea46b6654
Fix a bug with binding l-values to elided temporaries, and leave a couple
...
helpful asserts behind.
llvm-svn: 114250
2010-09-18 00:58:34 +00:00
Bill Wendling
d632616f86
The MMX shift-with-immediate builtins require the equivalent
...
shift-with-immediate LLVM intrinsics.
llvm-svn: 114239
2010-09-17 23:46:16 +00:00
David Chisnall
dd84ef1e62
Add a -ftrapv-handler= option which allows a handler to invoke instead of simply aborting when a signed operation overflows. This mirrors the (GCC-incompatible) behaviour from clang 1.0 and 1.1 when -ftrapv was specified, but allows the handler to be defined for each compilation unit.
...
llvm-svn: 114192
2010-09-17 18:29:54 +00:00
Fariborz Jahanian
5bbd1b0051
Patch to add IRgen support for Gnu's conditional operator
...
extension when missing LHS. This patch covers scalar
conditionals only. Others are wip.
(pr7726, radar 8353567).
llvm-svn: 114182
2010-09-17 15:51:28 +00:00
Daniel Dunbar
195fa00399
IRgen: Change CodeGenPasses to be a PassManager, so it can have CallGraphSCC or
...
Module. Patch by Mike Gist!
llvm-svn: 114171
2010-09-17 07:35:16 +00:00
John McCall
769250ea70
Currently we're initializing the vtable pointers of a class only after
...
the bases are completely initialized. This won't work --- base
initializer expressions can rely on the vtables having been set up.
Check for uses of 'this' in the initializers and force a vtable
initialization if found.
This might not be good enough; we might need to extend this to handle
the possibility of arbitrary code finding an external reference to this
(not yet completely-constructed!) object and accessing through it,
in which case we'll probably find ourselves doing a lot more unnecessary
stores.
llvm-svn: 114153
2010-09-17 02:31:44 +00:00
John McCall
7f9c92a9a0
When emitting a new-expression inside a conditional expression,
...
the cleanup might not be dominated by the allocation code.
In this case, we have to store aside all the delete arguments
in case we need them later. There's room for optimization here
in cases where we end up not actually needing the cleanup in
different branches (or being able to pop it after the
initialization code).
Also make sure we only call this operator delete along the path
where we actually allocated something.
Fixes rdar://problem/8439196.
llvm-svn: 114145
2010-09-17 00:50:28 +00:00
Daniel Dunbar
dd38fbc7fb
IRgen/ABI/x86-32: Realign indirect arguments when the ABI requires us to pass
...
them with a smaller alignment than the rest of codegen expects.
llvm-svn: 114115
2010-09-16 20:42:06 +00:00
Daniel Dunbar
7b7c2937ef
IRgen/ABI: Add support for realigning structures which are passed by indirect
...
reference.
llvm-svn: 114114
2010-09-16 20:42:02 +00:00
Daniel Dunbar
ed23de3348
IRgen/ABI/x86_32/Darwin: On Darwin, only structures with SSE vector types get passed
...
with a non-default-stack-ABI-alignment (of 16).
- This fixes the ABI convenient, but breaks codegen since we now have
underaligned arguments. Marginal improvement overall though, and will be
fixed in next commit.
llvm-svn: 114113
2010-09-16 20:42:00 +00:00
Daniel Dunbar
8a6c91ff76
IRgen/x86_32/Linux: Linux seems to align all stack objects to 4 bytes, unlike
...
Darwin. Checked vs the handiest Linux llvm-gcc I had around, someone on Linux is
welcome to investigate more.
llvm-svn: 114112
2010-09-16 20:41:56 +00:00
Fariborz Jahanian
c58ec3a9e5
Removes unused setter.
...
llvm-svn: 114085
2010-09-16 16:14:34 +00:00
John McCall
0bdb1fd477
Opportunistically use the C++ personality function in ObjC++
...
translation units that don't catch ObjC types. rdar://problem/8434851
llvm-svn: 114070
2010-09-16 06:16:50 +00:00
John McCall
2a8b9a3caa
Further beautification: this pointer can now be typed.
...
llvm-svn: 114061
2010-09-16 03:16:41 +00:00
John McCall
58649dc609
Initialize AggValueSlot's flags along all paths, plus minor beautification.
...
Prospective fix for broken commit in r114045.
llvm-svn: 114060
2010-09-16 03:13:23 +00:00
Fariborz Jahanian
b60e70f963
Patch to move RequiresGCollection bit to
...
AggValueSlot slot.
llvm-svn: 114045
2010-09-16 00:20:07 +00:00
Devang Patel
28b5286bda
While handling change of file, check if _current_ file is already seen or not. If current file is seen then it indicates that end of previous file's lexical scope.
...
This fixes radar 8396182.
llvm-svn: 114018
2010-09-15 20:50:40 +00:00
John McCall
7a626f63f7
one piece of code is responsible for the lifetime of every aggregate
...
slot. The easiest way to do that was to bundle up the information
we care about for aggregate slots into a new structure which demands
that its creators at least consider the question.
I could probably be convinced that the ObjC 'needs GC' bit should
be rolled into this structure.
Implement generalized copy elision. The main obstacle here is that
IR-generation must be much more careful about making sure that exactly
llvm-svn: 113962
2010-09-15 10:14:12 +00:00
John McCall
d441b1e637
Tweak this assert.
...
llvm-svn: 113863
2010-09-14 21:45:42 +00:00
John McCall
824c2f537c
Implement the EH cleanup to call 'operator delete' if a new-expression throws
...
(but not if destructors associated with the full-expression throw).
llvm-svn: 113836
2010-09-14 07:57:04 +00:00
Argyrios Kyrtzidis
9efa1ce145
Fix VLA miscompilation.
...
llvm.stacksave/llvm.stackrestore wasn't emitted for VLAs in inner scopes.
Fixes r8403108.
llvm-svn: 113822
2010-09-14 00:42:34 +00:00
Michael J. Spencer
09476212de
Revert "CMake: Update to use standard CMake dependency tracking facilities instead"
...
This reverts commit r113631
Conflicts:
CMakeLists.txt
lib/CodeGen/CMakeLists.txt
llvm-svn: 113817
2010-09-13 23:54:41 +00:00
Sebastian Redl
8eb06f17c4
Eagerly evaluate type traits in Sema instead of lazily in AST. They actually need Sema access to be correct, fixes coming up.
...
llvm-svn: 113782
2010-09-13 20:56:31 +00:00
Fariborz Jahanian
0aa35b9cf5
Block description for trivial block literals have
...
their 'isa' field scanned regardless.
llvm-svn: 113749
2010-09-13 16:09:44 +00:00
Chris Lattner
8ee6a4142a
Augment -ftrapv to check for divide by zero, mod by zero, and INT_MIN % -1.
...
Patch by John Regehr!
llvm-svn: 113705
2010-09-11 21:47:09 +00:00
Michael J. Spencer
9efc54890d
CMake: Fix mingw32 build.
...
llvm-svn: 113677
2010-09-11 02:13:48 +00:00
Fariborz Jahanian
933c6723a4
Fixes an obscure bug in importd block variable layout
...
information when imported variable is used
more than once. Originally though to be a bug in importing
block varibles. Fixes radar 8417746.
llvm-svn: 113675
2010-09-11 01:27:29 +00:00
Michael J. Spencer
0881f4a367
CMake: Update to use standard CMake dependency tracking facilities instead
...
of whatever we were using before...
llvm-svn: 113631
2010-09-10 21:13:16 +00:00
Sebastian Redl
b67655fc6d
Implement CXXNoexceptExpr codegen.
...
llvm-svn: 113629
2010-09-10 21:04:00 +00:00
Sebastian Redl
4202c0f2a9
Define and implement CXXNoexceptExpr. Create it in Sema.
...
llvm-svn: 113623
2010-09-10 20:55:43 +00:00
Fariborz Jahanian
f93ac89414
IRGen fix for using property-dot syntax to pass
...
reference object to a c++ member function.
fixes radar 8409336.
llvm-svn: 113602
2010-09-10 18:56:35 +00:00
Douglas Gregor
c9199f522f
Clean up CMake dependencies
...
llvm-svn: 113489
2010-09-09 15:44:58 +00:00
Fariborz Jahanian
cfddabf5a3
Block ivar layout must assume that the 'isa'
...
field of the block descriptor is GC'able (scanned)
as this what the runtime expects (one can send it
messages). Radar 8394947.
llvm-svn: 113454
2010-09-09 00:21:45 +00:00
Francois Pichet
5cc0a67f08
Fix warnings caused by new CXXUuidofExprClass enumerator.
...
llvm-svn: 113444
2010-09-08 23:47:05 +00:00
John McCall
68ff03728a
Implement ARM static local initialization guards, which are more compact than
...
Itanium guards and use a slightly different compiled-in API.
llvm-svn: 113330
2010-09-08 01:44:27 +00:00
Fariborz Jahanian
366a94822b
Local static block variable referecned in its
...
block-literal initializer expression causes IRgen to crash.
This patch fixes by saving it in StaticLocalDecl map
already used for such purposes. (radar 8390455).
llvm-svn: 113307
2010-09-07 23:26:17 +00:00
Fariborz Jahanian
535618b927
get rid of a warning.
...
llvm-svn: 113256
2010-09-07 19:57:04 +00:00
Fariborz Jahanian
56603ef7b2
Have Sema check for validity of CGString literal
...
instead of asserting in IRGen. Fixes radar 8390459.
llvm-svn: 113253
2010-09-07 19:38:13 +00:00
Argyrios Kyrtzidis
2fdb5b5955
LastFieldBitfield in CGObjCCommonMac::BuildAggrIvarLayout keeps bitfields or unnamed fields but later the code
...
assumes that it's always a bitfield. This can lead to a crash (reported at rdar://8368320).
llvm-svn: 113154
2010-09-06 12:00:10 +00:00
Chris Lattner
52bcf96384
move the hackaround for PR6537 to catch unions as well,
...
fixing the ICE in PR7151
llvm-svn: 113130
2010-09-06 00:13:11 +00:00
Chris Lattner
f53c096813
clean up some formatting.
...
llvm-svn: 113129
2010-09-06 00:11:41 +00:00
Nick Lewycky
1b36b55f89
No functional change. Replace Out << 'a' << 'b' with Out << "ab" and spell
...
David Vandevoorde's name correctly.
llvm-svn: 113103
2010-09-05 03:40:33 +00:00
Fariborz Jahanian
60babfb8a1
Casting of a property reference to 'void' did not
...
generate the necessary code. This patch fixes it.
// rdar://8389655
llvm-svn: 113079
2010-09-04 19:49:18 +00:00
John McCall
2917bd0fb4
Petty optimization.
...
llvm-svn: 113049
2010-09-04 01:26:37 +00:00
Fariborz Jahanian
087206dbcd
Truncate block variable of bool type to i1 when its
...
value is used. This matches with non-block variable
use of bool type. (Fixes radar 8390062).
llvm-svn: 113027
2010-09-03 23:07:53 +00:00
Fariborz Jahanian
9d798d13f3
Cope with llvm's reference to bool type of 'i1' vs. clang's
...
type of 'i8' for the same for __block variables of
type bool. refixes radar 8382559.
llvm-svn: 113015
2010-09-03 21:36:02 +00:00
John McCall
56f57589af
A constant initializer never matches the type of the variable it's
...
initializing; it at best matches the element type of the variable
it's initializing. Fixes PR8073.
llvm-svn: 112992
2010-09-03 18:58:50 +00:00
Daniel Dunbar
2f8df98c92
IRgen: Fix silly thinko in r112021, which was generating code for the same expr
...
twice. This showed up as an assert on the odd test case because we generated the
decl map entry twice.
llvm-svn: 112943
2010-09-03 02:07:00 +00:00
Dawn Perchik
335e16bad4
Add symantic support for the Pascal calling convention via
...
"__attribute((pascal))" or "__pascal" (and "_pascal" under
-fborland-extensions). Support still needs to be added to llvm.
llvm-svn: 112939
2010-09-03 01:29:35 +00:00
Bob Wilson
6061b05d51
Translate NEON vabdl, vaba, and vabal builtins to be implemented using the
...
vabd intrinsic combined with zext and add operations.
llvm-svn: 112937
2010-09-03 01:27:09 +00:00
John McCall
0d635f53a8
Re-commit r112916 with an additional fix for the self-host failures.
...
I've audited the remaining getFunctionInfo call sites.
llvm-svn: 112936
2010-09-03 01:26:39 +00:00
John McCall
c32f94b4ce
Revert r112916, it's breaking selfhost pretty badly.
...
llvm-svn: 112925
2010-09-03 00:40:45 +00:00
Daniel Dunbar
be13194655
Revert "Another i1 vs. i8 type mismatch issue. This time", it breaks some projects.
...
llvm-svn: 112922
2010-09-03 00:35:23 +00:00
John McCall
12d3891a27
It's not safe to use the generic CXXMethodDecl overload of CGT::getFunctionInfo
...
to set up a destructor call, because ABIs can tweak these conventions.
Fixes rdar://problem/8386802.
llvm-svn: 112916
2010-09-03 00:01:57 +00:00
Daniel Dunbar
a70fab8dd7
IRgen/Obj-C: Rewrite Objective-C bit-field access to compute the access strategy
...
using the same methods as used for normal structures.
- This fixes problems with reading past the end of the structure and with
handling straddled bit-field access.
llvm-svn: 112914
2010-09-02 23:53:31 +00:00
Daniel Dunbar
c7f9bbafe4
IRgen: Move CGBitFieldInfo strategy computation helpers to static member
...
functions.
llvm-svn: 112913
2010-09-02 23:53:28 +00:00
Douglas Gregor
040ad500c4
Fix a few more ConvertTypes that should be ConvertTypeForMems, fixing
...
two regressions in Boost.Config.
llvm-svn: 112908
2010-09-02 23:24:14 +00:00
Bob Wilson
5b4904f7a3
Add a bunch of missing bitcasts for clang NEON builtin expansions.
...
Radar 8388233
llvm-svn: 112890
2010-09-02 22:37:30 +00:00
Douglas Gregor
6429f5cf29
Eliminate CXXBindReferenceExpr, which was used in a ton of
...
well-intentioned but completely unused code.
llvm-svn: 112868
2010-09-02 21:50:02 +00:00
David Chisnall
cf60744cd7
Tidy up last commit, as per Devang's comments.
...
llvm-svn: 112840
2010-09-02 18:01:51 +00:00
Douglas Gregor
04f3621860
Revert my two IRgen fixes for "bool", then use a far simpler approach
...
based on ConvertTypeForMem. Thanks to John for pointing out the right
solution.
llvm-svn: 112838
2010-09-02 17:38:50 +00:00
Fariborz Jahanian
05bbef63b6
Another i1 vs. i8 type mismatch issue. This time
...
a 'bool' byref variable in memory. Fixes radar 8382559.
llvm-svn: 112835
2010-09-02 17:28:31 +00:00
David Chisnall
6bf98ff491
Use the unmangled name for the display name in Objective-C debug info. This should have no effect with the Mac runtime where clang (unlike GCC) uses the display name symbol name.
...
llvm-svn: 112833
2010-09-02 17:16:32 +00:00
Douglas Gregor
262e4e2ab5
Fix more i1/i8 pointer madness. Here, an overactive assertion
...
complains when the element type of a C++ "delete" expression is
different from what we would expect from the pointer type. When
deleting a bool*, we end up with an i1 on one side (where we compute
the LLVM type from the Clang bool type) and i8 on the other (where we
grab the LLVM type from the LLVM pointer type). I've weakened the
assertion appropriately, and the Boost Parallel Graph Library now
passes its regression tests.
llvm-svn: 112821
2010-09-02 15:34:35 +00:00
Douglas Gregor
e791a0546c
Fix a crash involving pointer-to-data-members of boolean type. We were
...
constructing an LLVM PointerType directly from the "bool"'s LLVM type
(i1), which resulted in unfortunate pointer type i1*. The fix is to
build the LLVM PointerType from the corresponding Clang PointerType,
so that we get i8* in the case of a bool.
John, please review. I also left a FIXME there because we seem to be
dropping "volatile", which would be rather unfortunate.
llvm-svn: 112819
2010-09-02 15:00:29 +00:00
John McCall
9bca923c10
Simplify some random accesses to the ASTContext from the ABI classes.
...
llvm-svn: 112816
2010-09-02 10:25:57 +00:00
John McCall
8ed55a54fd
Abstract IR generation of array cookies into the C++ ABI class and
...
implement ARM array cookies. Also fix a few unfortunate bugs:
- throwing dtors in deletes prevented the allocation from being deleted
- adding the cookie to the new[] size was not being considered for
overflow (and, more seriously, was screwing up the earlier checks)
- deleting an array via a pointer to array of class type was not
causing any destructors to be run and was passing the unadjusted
pointer to the deallocator
- lots of address-space problems, in case anyone wants to support
free store in a variant address space :)
llvm-svn: 112814
2010-09-02 09:58:18 +00:00
Bob Wilson
1b87c9a646
Translate NEON vmull, vmlal, and vmlsl builtins to llvm multiply-add/sub
...
with zext/sext operations, instead of to llvm intrinsics. I have a plan to
avoid the clang builtins for these, but it is going to take a little longer
and I want to get the NEON intrinsics updated before the 2.8 release.
llvm-svn: 112764
2010-09-01 23:20:27 +00:00
Fariborz Jahanian
61a312413c
Fix IRGen when property-dot syntax used to access
...
a c++ class object 'ivar'. Fixes radar 8366604.
llvm-svn: 112729
2010-09-01 19:36:41 +00:00
Ted Kremenek
0ef508d301
Split ObjCInterfaceDecl::ReferencedProtocols into two lists: ReferencedProtocols and AllReferencedProtocols. ReferencedProtocols
...
(and thus protocol_begin(), protocol_end()) now only contains the list of protocols that were directly referenced in
an @interface declaration. 'all_referenced_protocol_[begin,end]()' now returns the set of protocols that were referenced
in both the @interface and class extensions. The latter is needed for semantic analysis/codegen, while the former is
needed to maintain the lexical information of the original source.
Fixes <rdar://problem/8380046>.
llvm-svn: 112691
2010-09-01 01:21:15 +00:00
Chris Lattner
d426c8eae3
fix rdar://8360877 a really nasty miscompilation in Boost.Xpressive
...
caused by my ABI work. Passing:
struct outer {
int x;
struct epsilon_matcher {} e;
int f;
};
as {i32,i32} isn't safe, because the offset of the second element
needs to be at 8 when it is interpreted as a memory value.
llvm-svn: 112686
2010-09-01 00:50:20 +00:00
Chris Lattner
be5eb17536
same refactoring as before, this time on the argument side.
...
llvm-svn: 112684
2010-09-01 00:24:35 +00:00
Chris Lattner
52b3c13149
refactor some code to cut down on redundancy, no functionality change.
...
llvm-svn: 112683
2010-09-01 00:20:33 +00:00
John McCall
c134eb5ada
Amusingly, I missed this point of abstraction in all my earlier
...
member-pointer refactoring: dereferencing a member data pointer.
llvm-svn: 112640
2010-08-31 21:07:20 +00:00
Chris Lattner
04dc957260
Add support for windows x86-64 varargs, patch by Cameron Esfahani!
...
llvm-svn: 112603
2010-08-31 16:44:54 +00:00
John McCall
5d865c3292
Teach IR generation to return 'this' from constructors and destructors
...
under the ARM ABI.
llvm-svn: 112588
2010-08-31 07:33:07 +00:00
Sebastian Redl
50c682585f
Rename DeclContext::getLookupContext to getRedeclContext and change its semantics slightly. No functionality change in the absence of inline namespaces. Also, change a few places where inline namespaces actually make a difference to be prepared for them.
...
llvm-svn: 112563
2010-08-31 00:36:30 +00:00
Chris Lattner
a48fbe8c53
Fix PR8029, a x86-32 ABI regression in introduced in r112211
...
llvm-svn: 112537
2010-08-30 22:03:23 +00:00
Bob Wilson
b9225f7f85
Translate NEON vmovn builtin to a vector truncation instead of using an llvm
...
intrinsic.
llvm-svn: 112504
2010-08-30 19:57:13 +00:00
Alexis Hunt
3b7918625c
Revert my user-defined literal commits - r1124{58,60,67} pending
...
some issues being sorted out.
llvm-svn: 112493
2010-08-30 17:47:05 +00:00
Alexis Hunt
e3675ef0f3
Two minor fixes to user-defined literals:
...
- Zero-initialize UDLData so that crashes stop
- Stop complaining that we can't emit them (we most certainly can)
llvm-svn: 112467
2010-08-30 09:27:16 +00:00
Alexis Hunt
79eb5469e0
Implement C++0x user-defined string literals.
...
The extra data stored on user-defined literal Tokens is stored in extra
allocated memory, which is managed by the PreprocessorLexer because there isn't
a better place to put it that makes sure it gets deallocated, but only after
it's used up. My testing has shown no significant slowdown as a result, but
independent testing would be appreciated.
llvm-svn: 112458
2010-08-29 21:26:48 +00:00
Bob Wilson
0e7a398936
Translate NEON vaddl, vaddw, vsubl, and vsubw builtins to llvm add/sub
...
with zext/sext operations, instead of to llvm intrinsics. (We can also
get rid of the clang builtins and handle these entirely in the arm_neon.h
header if there is a way to express vector sext/zext in C.)
llvm-svn: 112413
2010-08-29 05:14:28 +00:00
Devang Patel
96b7f55a03
Debug info for friends!
...
Patch originally by Alexander Herz.
llvm-svn: 112275
2010-08-27 17:47:47 +00:00
Bob Wilson
7b0d032d0c
Add the new alignment arguments for NEON load/store intrinsics, based on the
...
types of the pointer address expressions used with those intrinsics.
llvm-svn: 112272
2010-08-27 17:14:29 +00:00
Chris Lattner
d7e54804ee
improve comments.
...
llvm-svn: 112214
2010-08-26 20:08:43 +00:00
Chris Lattner
d774ae9ed1
fix 2xi16 to pass as i32 instead of <2 x i16>. The former passes in
...
memory (as required) the later now passes in an xmm register. This
fixes gcc.dg/compat/vector_1 on x86-32.
llvm-svn: 112211
2010-08-26 20:05:13 +00:00
Chris Lattner
69e683fb35
vector of long and ulong are also classified as INTEGER in x86-64 abi,
...
this fixes rdar://8358475 a failure of the gcc.dg/compat/vector_1 abi
test.
llvm-svn: 112205
2010-08-26 18:13:50 +00:00
Chris Lattner
46830f2fd6
1 x ulonglong needs to be classified as INTEGER, just like 1 x longlong,
...
this fixes a miscompilation on the included testcase, rdar://8359248
llvm-svn: 112201
2010-08-26 18:03:20 +00:00
Argyrios Kyrtzidis
7648fb464b
Fix miscompilation. The cookie was not used when new'ing arrays with multiple dimensions.
...
llvm-svn: 112188
2010-08-26 15:23:38 +00:00
Chris Lattner
51e1cc2fe2
tame an assertion, fixing rdar://8357396
...
llvm-svn: 112174
2010-08-26 06:28:35 +00:00
Daniel Dunbar
d2bc53e925
CGValue: Increase width of allowed alignment. We could switch to log2, but we
...
don't currently need the bits anyway.
llvm-svn: 112173
2010-08-26 06:02:12 +00:00
John McCall
8e7d656a4a
De-memberify the VarDecl and FunctionDecl StorageClass enums.
...
This lets us remove Sema.h's dependency on Expr.h and Decl.h.
llvm-svn: 112156
2010-08-26 03:08:43 +00:00
Daniel Dunbar
e3d87d21f3
IRgen/NEON: Fix codegen of vzip and vzipq.
...
- Will be adding an executable test case to test-suite repo.
llvm-svn: 112126
2010-08-26 00:55:57 +00:00
Chris Lattner
9f8b451876
Finally pass "two floats in a 64-bit unit" as a <2 x float> instead of
...
as a double in the x86-64 ABI. This allows us to generate much better
code for certain things, e.g.:
_Complex float f32(_Complex float A, _Complex float B) {
return A+B;
}
Used to compile into (look at the integer silliness!):
_f32: ## @f32
## BB#0: ## %entry
movd %xmm1, %rax
movd %eax, %xmm1
movd %xmm0, %rcx
movd %ecx, %xmm0
addss %xmm1, %xmm0
movd %xmm0, %edx
shrq $32, %rax
movd %eax, %xmm0
shrq $32, %rcx
movd %ecx, %xmm1
addss %xmm0, %xmm1
movd %xmm1, %eax
shlq $32, %rax
addq %rdx, %rax
movd %rax, %xmm0
ret
Now we get:
_f32: ## @f32
movdqa %xmm0, %xmm2
addss %xmm1, %xmm2
pshufd $16, %xmm2, %xmm2
pshufd $1, %xmm1, %xmm1
pshufd $1, %xmm0, %xmm0
addss %xmm1, %xmm0
pshufd $16, %xmm0, %xmm1
movdqa %xmm2, %xmm0
unpcklps %xmm1, %xmm0
ret
and compile stuff like:
extern float _Complex ccoshf( float _Complex ) ;
float _Complex ccosf ( float _Complex z ) {
float _Complex iz;
(__real__ iz) = -(__imag__ z);
(__imag__ iz) = (__real__ z);
return ccoshf(iz);
}
into:
_ccosf: ## @ccosf
## BB#0: ## %entry
pshufd $1, %xmm0, %xmm1
xorps LCPI4_0(%rip), %xmm1
unpcklps %xmm0, %xmm1
movaps %xmm1, %xmm0
jmp _ccoshf ## TAILCALL
instead of:
_ccosf: ## @ccosf
## BB#0: ## %entry
movd %xmm0, %rax
movq %rax, %rcx
shlq $32, %rcx
shrq $32, %rax
xorl $-2147483648, %eax ## imm = 0xFFFFFFFF80000000
addq %rcx, %rax
movd %rax, %xmm0
jmp _ccoshf ## TAILCALL
There is still "stuff to be done" here for the struct case,
but this resolves rdar://6379669 - [x86-64 ABI] Pass and return
_Complex float / double efficiently
llvm-svn: 112111
2010-08-25 23:39:14 +00:00
Michael J. Spencer
b2f376bdd0
Fix horrible white space errors.
...
llvm-svn: 112067
2010-08-25 18:17:27 +00:00
John McCall
e302792b61
GCC didn't care for my attempt at API compatibility, so brute-force everything
...
to the new constants.
llvm-svn: 112047
2010-08-25 11:45:40 +00:00
John McCall
2536c6da0e
More incremental progress towards not including Expr.h in Sema.h.
...
llvm-svn: 112044
2010-08-25 10:28:54 +00:00
Daniel Dunbar
ead6824c3c
IRgen: Fix a horrible bug in pointer to bool conversion, which we were treating
...
as a truncation not a comparison to null.
llvm-svn: 112021
2010-08-25 03:32:38 +00:00
John McCall
8d75243029
Expression statements undergo lvalue-to-rvalue conversion in C,
...
but not in C++, so don't emit aggregate loads of volatile references
in null context in C++. Happens to have been caught by an assertion.
We do not get the scalar case right. Volatiles are really broken.
llvm-svn: 112019
2010-08-25 02:50:31 +00:00
Devang Patel
356e3e0c6a
Fix 'for' loop variables' scope.
...
llvm-svn: 112002
2010-08-25 00:28:56 +00:00
Devang Patel
22e99c2bad
Fix enum size and align. Tested by setvar.exp in gdb testsuite.
...
llvm-svn: 111936
2010-08-24 18:14:06 +00:00
Daniel Dunbar
64c222a6bc
Debug Info: Put full Clang version into the debug info, to make it easier to
...
identify what version of the compiler was used to build something.
llvm-svn: 111927
2010-08-24 17:41:09 +00:00
Devang Patel
41c2097058
Emit debug info for enum constants.
...
llvm-svn: 111852
2010-08-23 22:07:25 +00:00
Dan Gohman
66427b1fcf
Reinstate the code for emitting an initial debug type for a struct,
...
to handle the case where the struct is only forward-declared. In
this case, a temporary MDNode is not needed and not desired.
llvm-svn: 111842
2010-08-23 21:15:56 +00:00
Fariborz Jahanian
bf9294fb65
Support for IRGen of synthesize bitfield ivars in
...
objc-nonfragile-abi2 (radar 7824380).
llvm-svn: 111823
2010-08-23 18:51:39 +00:00
Douglas Gregor
f63e4c3334
Emit an error noting that Clang does not support code generation for
...
the ternary operator without a left-hand side in C++ (PR7726), from
Jean-Daniel Dupas!
llvm-svn: 111809
2010-08-23 14:50:27 +00:00
John McCall
61a148881f
chandlerc pointed out that ending a line with /\ is not very friendly. :)
...
llvm-svn: 111797
2010-08-23 06:56:36 +00:00
Chris Lattner
65526f0190
fix rdar://8340348, a miscompile of boost that was exposed by r109848.
...
That revision started classifying truly empty structs like "Y" and "X"
as being NoClass/NoClass and turning them into 'ignore'. The call code
turns around and allocates space for the ignored argument with
GetUndefRValue. The bug is that GetUndefRValue would return the address
as undef, instead of returning an object with a defined address but
undefined contents.
llvm-svn: 111794
2010-08-23 05:26:13 +00:00
John McCall
7a9aac2d9f
Abstract out everything having to do with member pointers into the ABI
...
class; they should just be completely opaque throughout IR gen now,
although I haven't really audited that.
Fix a bug apparently inherited from gcc-4.2 where we failed to null-check
member data pointers when performing derived-to-base or base-to-derived
conversions on them.
llvm-svn: 111789
2010-08-23 01:21:21 +00:00
John McCall
aa4149a2aa
Extract a method to check whether a function is the global placement
...
operator new[].
llvm-svn: 111788
2010-08-23 01:17:59 +00:00
John McCall
614dbdcd55
Go back to asking CodeGenTypes whether a type is zero-initializable.
...
Make CGT defer to the ABI on all member pointer types.
This requires giving CGT a handle to the ABI.
It's way easier to make that work if we avoid lazily creating the ABI.
Make it so.
llvm-svn: 111786
2010-08-22 21:01:12 +00:00
Douglas Gregor
932c19dc9f
Eliminate a stale assertion. Fixes Clang self-host.
...
llvm-svn: 111782
2010-08-22 18:26:35 +00:00
Douglas Gregor
630c76efb0
When performing value-initialization for a class with a non-trivial,
...
implicitly-defined default constructor, zero-initialize the memory
before calling the default constructor. Previously, we would only
zero-initialize in the case of a trivial default constructor.
Also, simplify the hideous logic that determines when we have a
trivial default constructor and, therefore, don't need to emit any
call at all.
llvm-svn: 111779
2010-08-22 16:15:35 +00:00
John McCall
c29eb8a9d1
Clean up a very silly use of first-class aggregates.
...
llvm-svn: 111777
2010-08-22 11:04:31 +00:00
John McCall
a1dee5300b
Experiment with using first-class aggregates to represent member function
...
pointers. I find the resulting code to be substantially cleaner, and it
makes it very easy to use the same APIs for data member pointers (which I have
conscientiously avoided here), and it avoids a plethora of potential
inefficiencies due to excessive memory copying, but we'll have to see if it
actually works.
llvm-svn: 111776
2010-08-22 10:59:02 +00:00
John McCall
131d97d809
Extract member function pointer comparison and null comparison into
...
the ABI code. Implement correct semantics for these on ARM.
I believe this completes the implementation of member function pointers
on ARM.
I think I'm going to switch member function pointers over to be
non-aggregates while I have all this in mind.
llvm-svn: 111774
2010-08-22 08:30:07 +00:00
John McCall
1c456c89dc
Abstract out member-pointer creation. I'm really unhappy about the current
...
duplication between the constant and non-constant paths in all of this.
Implement ARM ABI semantics for member pointer constants and conversion.
llvm-svn: 111772
2010-08-22 06:43:33 +00:00
John McCall
84fa510aa9
Abstract more member-pointerness out.
...
llvm-svn: 111771
2010-08-22 04:16:24 +00:00
John McCall
a8bbb82c55
Abstract out member-pointer conversions.
...
Pretty much everything having to do with member pointers is ABI-specific.
llvm-svn: 111770
2010-08-22 03:04:22 +00:00
Eli Friedman
04831926ec
Detabify.
...
llvm-svn: 111768
2010-08-22 01:00:03 +00:00
John McCall
d9c6c0b583
Implement the call parts of the member-function-pointer ARM C++ ABI.
...
llvm-svn: 111766
2010-08-22 00:59:17 +00:00
John McCall
475999dcf9
Extract calls to method pointers out as an ABI routine.
...
No functionality change.
llvm-svn: 111752
2010-08-22 00:05:51 +00:00
John McCall
86353416a7
The ARM C++ ABI is sufficiently different from the Itanium C++ ABI that
...
it deserves its own enumerator. Obviously the implementations should
closely follow the Itanium ABI except in cases of divergence.
llvm-svn: 111749
2010-08-21 22:46:04 +00:00
Daniel Dunbar
5c816378f8
IRgen: Set the alignment correctly when creating LValue for a decls.
...
- Fixes PR5598.
- Review appreciated.
llvm-svn: 111726
2010-08-21 04:20:22 +00:00
Daniel Dunbar
49e5d12e59
CodeGenFunction: Eliminate unused MakeQualifiers() function.
...
llvm-svn: 111725
2010-08-21 04:13:07 +00:00
Daniel Dunbar
26d2c39b95
Simplify.
...
llvm-svn: 111724
2010-08-21 04:05:54 +00:00
Daniel Dunbar
226bddaff1
IRgen/CGValue: Give MakeAddrLValue() an alignment argument, and eliminate old form of MakeAddr().
...
llvm-svn: 111723
2010-08-21 03:58:45 +00:00
Daniel Dunbar
4bb04cee6a
IRgen: Move remaining LValue::Set... methods to LValue::set... (non-static) methods.
...
llvm-svn: 111722
2010-08-21 03:51:29 +00:00
Daniel Dunbar
f166a523f1
IRgen: Move remaining MakeAddr() calls to MakeAddrLValue().
...
llvm-svn: 111721
2010-08-21 03:44:13 +00:00
Daniel Dunbar
e8b6cda15a
IRgen: The CVR qualifiers in a subobject adjustment should just come from the
...
field (I think).
- Doug, please check.
llvm-svn: 111720
2010-08-21 03:37:02 +00:00
Daniel Dunbar
b657ac51cf
IRgen/CGValue: Add getQuals(), so qualifiers can be modified on an LValue.
...
llvm-svn: 111719
2010-08-21 03:29:54 +00:00
Daniel Dunbar
e50dda95ee
IRgen/LValue: Add LValue::setNonGC instead of SetObjCNonGC, for consistency with isNonGC().
...
llvm-svn: 111718
2010-08-21 03:22:38 +00:00
Daniel Dunbar
2e442a00b3
IRgen: Switch more MakeAddr() users to MakeAddrLValue; this time for calls which were previously not computing the qualifier list. In most cases, I don't think it matters, but I believe this is conservatively more correct / consistent.
...
llvm-svn: 111717
2010-08-21 03:15:20 +00:00
Daniel Dunbar
f6fb7e2b53
IRgen: Switch a bunch of trivial MakeAddr calls to use MakeAddrLValue.
...
llvm-svn: 111716
2010-08-21 03:08:16 +00:00
Daniel Dunbar
b1d94a98dd
IRgen: Eliminate EmitPredefinedFunctionName(), it doesn't need to be factored out.
...
llvm-svn: 111715
2010-08-21 03:01:12 +00:00
Daniel Dunbar
93b00a98a3
IRgen: Add an LValue::MakeAddr variant which takes a type and uses that to build
...
the qualifiers.
Also, add CodeGenFunction::MakeAddrLValue() helper function which passes in the
ASTContext.
llvm-svn: 111714
2010-08-21 02:53:44 +00:00
Dan Gohman
25f9aaedc6
Delete an obsolete comment.
...
llvm-svn: 111711
2010-08-21 02:41:29 +00:00
Daniel Dunbar
e3b8dd433c
IRgen/CGValue: Add alignment to LValue, and use that alignment when generating lvalue load/stores.
...
llvm-svn: 111710
2010-08-21 02:39:23 +00:00
Daniel Dunbar
ab4dbea096
IRgen/LValue: Rename SetQualifiers() to Initialize().
...
llvm-svn: 111708
2010-08-21 02:31:58 +00:00
Daniel Dunbar
0381634a61
IRgen: Change Emit{Load,Store}OfScalar to take a required Alignment argument and
...
update callers as best I can.
- This is a work in progress, our alignment handling is very horrible / sketchy -- I am just aiming for monotonic improvement.
- Serious review appreciated.
llvm-svn: 111707
2010-08-21 02:24:36 +00:00
Daniel Dunbar
a94e3d1124
IRgen: Use Ty consistently in this function.
...
llvm-svn: 111705
2010-08-21 02:17:08 +00:00
Dan Gohman
b1aac3362c
CreateTemporaryType doesn't needs its Context argument.
...
llvm-svn: 111688
2010-08-20 22:39:57 +00:00
Dan Gohman
196f71006e
Introduce a new temporary MDNode concept. Temporary MDNodes are
...
not part of the IR, are not uniqued, and may be safely RAUW'd.
This replaces a variety of alternate mechanisms for achieving
the same effect.
llvm-svn: 111682
2010-08-20 22:02:57 +00:00
Fariborz Jahanian
a50b3a20f1
objective-c ivar refactoring patch. Iterations
...
over ivars for a varienty of puposes is now
consolidated into two small routines; DeepCollectObjCIvars
and ShallowCollectObjCIvars.
llvm-svn: 111679
2010-08-20 21:21:08 +00:00
Douglas Gregor
e3b3464d4e
Fix a major regression with value-initialization of class types with
...
trivial default constructors. We're weren't zero-initializing them,
which manifested as <rdar://problem/8320532> (a regression in the GCC
test suite) and is likely to have caused significant other breakage.
llvm-svn: 111650
2010-08-20 16:57:37 +00:00
Bob Wilson
b02244969d
Translate NEON vmovl intrinsics to zero/sign-extend operations.
...
llvm-svn: 111612
2010-08-20 03:36:08 +00:00
John McCall
f834bcd659
Mangle explicit template arguments in dependent or overloaded names.
...
llvm-svn: 111591
2010-08-20 00:17:19 +00:00
Charles Davis
6bcb07ad71
Add some enum goodness as requested by Chris. Now instead of storing the
...
active C++ ABI as a raw string, we store it as an enum. This should improve
performance somewhat.
And yes, this time, I started from a clean build directory, and
all the tests passed. :)
llvm-svn: 111507
2010-08-19 02:18:14 +00:00
Alexis Hunt
dcfba7b35b
Generate Attr subclasses with TableGen.
...
Now all classes derived from Attr are generated from TableGen.
Additionally, Attr* is no longer its own linked list; SmallVectors or
Attr* are used. The accompanying LLVM commit contains the updates to
TableGen necessary for this.
Some other notes about newly-generated attribute classes:
- The constructor arguments are a SourceLocation and a Context&,
followed by the attributes arguments in the order that they were
defined in Attr.td
- Every argument in Attr.td has an appropriate accessor named getFoo,
and there are sometimes a few extra ones (such as to get the length
of a variadic argument).
Additionally, specific_attr_iterator has been introduced, which will
iterate over an AttrVec, but only over attributes of a certain type. It
can be accessed through either Decl::specific_attr_begin/end or
the global functions of the same name.
llvm-svn: 111455
2010-08-18 23:23:40 +00:00
John McCall
78fbb61ed7
Contextual arity is a feature of mangling expressions; kill off
...
mangleCallExpression. Also, operator names with unknown arity should
be mangled as binary operators; this is actually covered by an oddly-
positioned sentence in the ABI document. Fixes PR7891.
llvm-svn: 111395
2010-08-18 19:18:59 +00:00
Chris Lattner
396639db95
zap dead code.
...
llvm-svn: 111365
2010-08-18 16:09:06 +00:00
Chris Lattner
aa94cc3fcd
fix typo
...
llvm-svn: 111334
2010-08-18 00:13:52 +00:00
Chris Lattner
b1995dffaf
Fix PR7889 by generalizing some over specialized code. There is no
...
reason that this should be limited to simple lvalues.
llvm-svn: 111331
2010-08-18 00:08:27 +00:00
Chris Lattner
00d5141aef
fix PR7892, a crash on valid in c++ codegen of __PRETTY_FUNCTION__
...
llvm-svn: 111330
2010-08-17 23:58:10 +00:00
Daniel Dunbar
56df97761d
StringRef'ication of lots stuff, patch by Peter Davies!
...
llvm-svn: 111314
2010-08-17 22:39:59 +00:00
John McCall
6d86202fa7
Whoops. Don't fall through into the overload case when mangling a
...
dependent call expression.
llvm-svn: 111300
2010-08-17 21:51:21 +00:00
Benjamin Kramer
35b077e674
Convert all uses of StringLiteral::getStrData() to StringLiteral::getString()
...
and remove getStrData(). Patch by Peter Davies (with some tweaks).
llvm-svn: 111229
2010-08-17 12:54:38 +00:00
Charles Davis
53c59df2f7
Implement support for member pointers under the Microsoft C++ ABI in the
...
AST library.
This also adds infrastructure for supporting multiple C++ ABIs in the AST.
llvm-svn: 111117
2010-08-16 03:33:14 +00:00
Argyrios Kyrtzidis
1cec2cc798
Remove dead code, caught by unused function warnings.
...
llvm-svn: 111091
2010-08-15 01:15:58 +00:00
Eli Friedman
1bb53d9cd6
Explicitly handle every case in the switch in RTTIBuilder::BuildTypeInfo.
...
llvm-svn: 111085
2010-08-15 00:24:31 +00:00
John McCall
32427785c0
More cleanup enabling.
...
llvm-svn: 111070
2010-08-14 07:46:19 +00:00
John McCall
612942d65f
Sketch out a framework for delaying the activation of a cleanup.
...
Not yet complete or used.
llvm-svn: 111044
2010-08-13 21:20:51 +00:00
Eli Friedman
a2622dd266
Zap unused UnaryOperator::OffsetOf.
...
llvm-svn: 110996
2010-08-13 01:36:11 +00:00
Fariborz Jahanian
f7f020bb2a
Make use of __func__ in a block actually refer to
...
block's helper function. Fixes radar 7860965.
llvm-svn: 110988
2010-08-13 00:19:55 +00:00
John McCall
b3732bb3b7
Just disable the hidden-visibility optimization for now by hiding it behind
...
a -cc1 option. The Darwin linker complains about mixed visibility when linking
gcc-built objects with clang-built objects, and the optimization isn't really
that valuable. Platforms with less ornery linkers can feel free to enable this.
llvm-svn: 110979
2010-08-12 23:36:15 +00:00
John McCall
398dc37d1f
Implement RTTI generation for Objective C types. Fixes PR7864.
...
llvm-svn: 110900
2010-08-12 02:17:33 +00:00
Devang Patel
caa23f0708
Emit debug info for static const class member.
...
llvm-svn: 110885
2010-08-12 00:02:44 +00:00
John McCall
5996699834
Revise r110163: don't mark weak functions nounwind, because the optimizer
...
treats that as a contract to be fulfilled by any replacements.
llvm-svn: 110864
2010-08-11 22:38:33 +00:00
Devang Patel
d76c1dbe39
Emit a stop point for delegate constructor call. This gives user a chance to step into constructor body.
...
llvm-svn: 110853
2010-08-11 21:04:37 +00:00
John McCall
ffe4630f3d
When re-raising an exception after a cleanup, we need to call _Unwind_Resume_or_Rethrow
...
instead of _Unwind_Resume. With SJLJ exceptions, this is spelled
"_Unwind_SjLj_Resume_or_Rethrow", not "_Unwind_SjLj_Resume", which has
significantly different semantics.
We should actually never be generating a call to _Unwind_SjLj_Resume directly;
even if we were generating true cleanups (which we aren't because of the
horrible hack), we should be calling __cxa_end_cleanup() on ARM. I
haven't implemented this because there's little point as long as the HH is
present.
I believe this fixes <rdar://problem/8281377>.
llvm-svn: 110851
2010-08-11 20:59:53 +00:00
Eli Friedman
961fc05418
Work in progress for PR7864. Someone more familiar with ObjC++ needs to fill
...
in the code after the "FIXME: Needs to be written".
llvm-svn: 110849
2010-08-11 20:41:51 +00:00
Fariborz Jahanian
d539d098a4
IRGen support for functions returning objc object
...
types. Fixes PR7865.
llvm-svn: 110832
2010-08-11 17:37:35 +00:00
John McCall
cebe0ca75e
Fix a bug in @finally emission in both the fragile and non-fragile EH schemes
...
where we weren't accounting for the possibility that a @finally block might
have internal cleanups and therefore might write to the cleanup destination slot.
Fixes <rdar://problem/8293901>.
llvm-svn: 110760
2010-08-11 00:16:14 +00:00
Devang Patel
8166571a25
Simplify
...
llvm-svn: 110716
2010-08-10 20:16:57 +00:00
John Thompson
a5c7d706b8
Slightly revised handling of mult-alt constraints, to avoid an assert, until we have the full fix.
...
llvm-svn: 110706
2010-08-10 19:20:14 +00:00
John McCall
62eb9a8e84
When initializing a static local, pop the guard-abort EH cleanup after
...
the variable is fully initialized.
llvm-svn: 110704
2010-08-10 18:51:44 +00:00
Devang Patel
76e3b53541
Do not use DIGlobalVariable to emit debugging information for enums.
...
llvm-svn: 110697
2010-08-10 18:27:15 +00:00
Devang Patel
dc866e119c
Simplify code and add comments, in code that generate debug info for constant integer globals, based on Chris's feedback.
...
llvm-svn: 110694
2010-08-10 17:53:33 +00:00
Devang Patel
e03edfd3e7
Even if a constant's evaluated value is used, emit debug info for the constant variable.
...
llvm-svn: 110660
2010-08-10 07:24:25 +00:00
Argyrios Kyrtzidis
13257c5527
Support ObjC implementation decls for PCH.
...
Strictly speaking, implementations don't go in headers but there's no law against it.
llvm-svn: 110567
2010-08-09 10:54:20 +00:00
Eric Christopher
6ff7161d51
Thread local variables aren't considered common linkage.
...
llvm-svn: 110530
2010-08-08 01:37:14 +00:00
Douglas Gregor
8b2d2fe234
Allow reference binding of a reference of Objective-C object type to
...
an lvalue of another, compatible Objective-C object type (e.g., a
subclass). Introduce a new initialization sequence step kind to
describe this binding, along with a new cast kind. Fixes PR7741.
llvm-svn: 110513
2010-08-07 11:51:51 +00:00
John McCall
7cd1d97e33
Inline a special case of EmitAggregateCopy into EmitNullInitialization
...
to avoid the awesome-but-wrong-in-this-case assertion in the canon EAC.
Fixes PR7834.
Also fix a subtle address-space bug in the memset path.
llvm-svn: 110511
2010-08-07 08:21:30 +00:00
John McCall
cf14216509
Store inheritance paths after CastExprs instead of inside them.
...
This takes some trickery since CastExpr has subclasses (and indeed,
is abstract).
Also, smoosh the CastKind into the bitfield from Expr.
Drops two words of storage from Expr in the common case of expressions
which don't need inheritance paths. Avoids a separate allocation and
another word of overhead in cases needing inheritance paths. Also has
the advantage of not leaking memory, since destructors for AST nodes are
never run.
llvm-svn: 110507
2010-08-07 06:22:56 +00:00
Chris Lattner
8139c98cf9
Correct -ftrapv to trap on errors, instead of calling the
...
__overflow_handler entrypoint that David Chisnall made up.
Calling __overflow_handler is not part of the contract of
-ftrapv provided by GCC, and should never have been checked
in in the first place.
According to:
http://permalink.gmane.org/gmane.comp.compilers.clang.devel/8699
David is using this for some of arbitrary precision integer stuff
or something, which is not an appropriate thing to implement on
this.
llvm-svn: 110490
2010-08-07 00:20:46 +00:00
Eli Friedman
165301d38d
Initialize variable to work around warning; unfortunately, there isn't any
...
way to tell gcc "really, values outside the enum aren't valid".
llvm-svn: 110450
2010-08-06 16:37:05 +00:00
Fariborz Jahanian
f95e358004
Finishing up block variable layout API by supporting
...
union type variables and their nesting inside other
aggregate types.
llvm-svn: 110448
2010-08-06 16:28:55 +00:00
Nate Begeman
ad5dd42817
vdup_lane was missing
...
<rdar://problem/8278732>
llvm-svn: 110420
2010-08-06 01:24:57 +00:00
Eli Friedman
e83d2b7649
Attempt to fix uninitialized value warning reported on cfe-commits.
...
llvm-svn: 110418
2010-08-06 01:17:25 +00:00
John McCall
491462425a
Don't crash when mangling empty anonymous unions. We never actually *need*
...
these, but it's convenient to mangle them when deferring them (in the 99.99%
case where it's not an anonymous union, of course).
llvm-svn: 110381
2010-08-05 22:02:13 +00:00
Fariborz Jahanian
903aba39ee
Add support for block imported struct variable layout info.
...
(objc gc and blocks in NeXt runtime).
llvm-svn: 110377
2010-08-05 21:00:25 +00:00
John McCall
5513fce96b
It turns out that linkers (at least, the Darwin linker) don't necessarily
...
do the right thing with mixed-visibility symbols, so disable the visibility
optimization where that's possible, i.e. with template classes (since it's
possible that an arbitrary template might be subject to an explicit
instantiation elsewhere). 447.dealII actually does this.
I've put the code under an option that's currently not hooked up to anything.
llvm-svn: 110374
2010-08-05 20:39:18 +00:00
John McCall
95bde46bbb
Argument evaluation order is not guaranteed. Split these out to force an order.
...
llvm-svn: 110354
2010-08-05 18:11:10 +00:00
John McCall
a9731a4179
Fix a major bug with -ftrapv and ++/--. Patch by David Keaton!
...
llvm-svn: 110347
2010-08-05 17:39:44 +00:00
Fariborz Jahanian
d652ac82b0
For now skip over aggregate non-byref block variables.
...
(objc gc specific).
llvm-svn: 110340
2010-08-05 16:13:18 +00:00
Fariborz Jahanian
89f3721dee
Trying to unbreak buildbot.
...
llvm-svn: 110339
2010-08-05 15:52:12 +00:00
Eli Friedman
d7c7232a1d
Add IRGen support for non-constant OffsetOfExpr.
...
llvm-svn: 110326
2010-08-05 09:58:49 +00:00
Eli Friedman
570024a8d9
Implement #pragma GCC visibility.
...
llvm-svn: 110315
2010-08-05 06:57:20 +00:00
Fariborz Jahanian
1f78a9ad56
Clean up of my last patch.
...
llvm-svn: 110290
2010-08-05 00:19:48 +00:00
Fariborz Jahanian
9659f6b540
Block variable layout bitmap API generation.
...
llvm-svn: 110287
2010-08-04 23:55:24 +00:00
John McCall
c8bd9c277b
Extend the visibility-hidden optimization to linkonce_odr thunks for
...
functions with in-line definitions, since such thunks will be emitted at any
use of the function.
Completes the feature work for rdar://problem/7523229.
llvm-svn: 110285
2010-08-04 23:46:35 +00:00
Fariborz Jahanian
afa3c0a875
More objc block variable layout info. work.
...
llvm-svn: 110239
2010-08-04 18:44:59 +00:00
Fariborz Jahanian
c05349e53a
Some early work for providing block layout info.
...
for objective-c/c++ blocks (NeXt runtime).
llvm-svn: 110213
2010-08-04 16:57:49 +00:00
John McCall
e16adc2b1e
Emit standard-library RTTI with external linkage, not weak_odr.
...
Apply hidden visibility to most RTTI; libstdc++ does not rely on exact
pointer equality for the type info (just the type info names). Apply
the same optimization to RTTI that we do to vtables.
Fixes PR5962.
llvm-svn: 110192
2010-08-04 08:34:44 +00:00
John McCall
8a705c15d9
Extend the hidden-visibility vtables optimization to template classes that
...
haven't been explicitly instantiated.
llvm-svn: 110189
2010-08-04 06:38:15 +00:00
John McCall
2dd7d44135
Some more correctness fixes and code-size optimizations for fragile-ABI
...
ObjC exceptions:
- don't enter a try for the catch blocks unless there's a finally
- put the setjmp buffer in the locals set for liveness reasons
- dump the sync object into an alloca in the locals set for liveness reasons
Some of this can go away if the backend starts to properly calculate liveness
in the presence of setjmp (which would also be a *much* stabler solution).
llvm-svn: 110188
2010-08-04 05:59:32 +00:00
John McCall
8601a75118
Do a very simple pass over every function we emit to infer whether we can
...
mark it nounwind based on whether it contains any non-nounwind calls.
<rdar://problem/8087431>
llvm-svn: 110163
2010-08-03 22:46:07 +00:00
Nate Begeman
f568b074db
Add support for VFP status & control operations for ARM.
...
llvm-svn: 110153
2010-08-03 21:32:34 +00:00
John McCall
5696d6d316
Emit weak vtables of non-template classes with hidden visibility.
...
llvm-svn: 110107
2010-08-03 07:24:12 +00:00
John McCall
8b0f4ff317
Further adjustments to -Wglobal-constructors; works for references and direct
...
initializations now.
llvm-svn: 110063
2010-08-02 21:13:48 +00:00
John McCall
42227edc79
Fix fragile-ABI ObjC exceptions in the presence of optimization with
...
the magic of inline assembly. Essentially we use read and write hazards
on the set of local variables to force flushing locals to memory
immediately before any protected calls and to inhibit optimizing locals
across the setjmp->catch edge. Fixes rdar://problem/8160285
llvm-svn: 109960
2010-07-31 23:20:56 +00:00
John McCall
45d494785d
Emit global destructors even if the destroyed object has no initializers or has
...
an initializer requiring temporary object disposal.
Fixes rdar:://problem/8246444.
llvm-svn: 109849
2010-07-30 04:56:58 +00:00
Chris Lattner
8a2f3c778e
fix PR5179 and correctly fix PR5831 to not miscompile.
...
The X86-64 ABI code didn't handle the case when a struct
would get classified and turn up as "NoClass INTEGER" for
example. This is perfectly possible when the first slot
is all padding (e.g. due to empty base classes). In this
situation, the first 8-byte doesn't take a register at all,
only the second 8-byte does.
This fixes this by enhancing the x86-64 abi stuff to allow
and handle this case, reverts the broken fix for PR5831,
and enhances the target independent stuff to be able to
handle an argument value in registers being accessed at an
offset from the memory value.
This is the last x86-64 calling convention related miscompile
that I'm aware of.
llvm-svn: 109848
2010-07-30 04:02:24 +00:00
Daniel Dunbar
cda4307308
Revert "Re-apply fixed version of 108749, correctly conditionalizing the new
...
sections on", this change uncovered a possible linker bug which resulted in the
wrong messages getting dispatched. Backing this out while we investigate...
llvm-svn: 109817
2010-07-29 22:57:21 +00:00
Nate Begeman
1194bd2bd8
Wire up sema checking for __builtin_arm_usat and __builtin_arm_ssat immediates.
...
llvm-svn: 109814
2010-07-29 22:48:34 +00:00
Chris Lattner
1f3a063f00
move the last hunk of getCoerceResult into the place
...
that needs it and remove getCoerceResult.
llvm-svn: 109807
2010-07-29 21:42:50 +00:00
Chris Lattner
60fbd7744f
now that direct and coerce are merged, getCoerceResult gets simpler.
...
llvm-svn: 109805
2010-07-29 21:29:53 +00:00
Chris Lattner
09794695ef
now that GetSSETypeAtOffset handles passing SSE class values as
...
float, the special case hack in getCoerceResult can go away.
llvm-svn: 109804
2010-07-29 21:22:50 +00:00
Argyrios Kyrtzidis
c904933aac
Change the name to something less terrible; suggestion by Doug. No functionality change.
...
llvm-svn: 109797
2010-07-29 20:08:05 +00:00
Chris Lattner
e556a71859
Implement the clang-side of detection for when to pass as
...
<2 x float> instead of double. This works but can't be turned
on until I teach codegen to pass <2 x float> as one XMM register
instead of two.
llvm-svn: 109790
2010-07-29 18:39:32 +00:00
Chris Lattner
50a357e962
Look at me, I can count!
...
llvm-svn: 109786
2010-07-29 18:19:50 +00:00
Argyrios Kyrtzidis
c81af03fb3
Merge PCHWriterDecl.cpp's isRequiredDecl and CodeGenModule::MayDeferGeneration into a new function,
...
DeclIsRequiredFunctionOrFileScopedVar.
This is essentially a CodeGen predicate that is also needed by the PCH mechanism to determine whether a decl
needs to be deserialized during PCH loading for codegen purposes.
Since this logic is shared by CodeGen and the PCH mechanism, move it to the ASTContext,
thus CodeGenModule's GetLinkageForFunction/GetLinkageForVariable and the GVALinkage enum is moved out of CodeGen.
This fixes current (and avoids future) codegen-from-PCH bugs.
llvm-svn: 109784
2010-07-29 18:15:58 +00:00
Chris Lattner
7f4b81af7a
fix rdar://8251384, another case where we could access beyond the
...
end of a struct. This improves the case when the struct being passed
contains 3 floats, either due to a struct or array of 3 things. Before
we'd generate this IR for the testcase:
define float @bar(double %X.coerce0, double %X.coerce1) nounwind {
entry:
%X = alloca %struct.foof, align 8 ; <%struct.foof*> [#uses=2]
%0 = bitcast %struct.foof* %X to %1* ; <%1*> [#uses=2]
%1 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1]
store double %X.coerce0, double* %1
%2 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1]
store double %X.coerce1, double* %2
%tmp = getelementptr inbounds %struct.foof* %X, i32 0, i32 2 ; <float*> [#uses=1]
%tmp1 = load float* %tmp ; <float> [#uses=1]
ret float %tmp1
}
which compiled (with optimization) to:
_bar: ## @bar
## BB#0: ## %entry
movd %xmm1, %rax
movd %eax, %xmm0
ret
Now we produce:
define float @bar(double %X.coerce0, float %X.coerce1) nounwind {
entry:
%X = alloca %struct.foof, align 8 ; <%struct.foof*> [#uses=2]
%0 = bitcast %struct.foof* %X to %0* ; <%0*> [#uses=2]
%1 = getelementptr %0* %0, i32 0, i32 0 ; <double*> [#uses=1]
store double %X.coerce0, double* %1
%2 = getelementptr %0* %0, i32 0, i32 1 ; <float*> [#uses=1]
store float %X.coerce1, float* %2
%tmp = getelementptr inbounds %struct.foof* %X, i32 0, i32 2 ; <float*> [#uses=1]
%tmp1 = load float* %tmp ; <float> [#uses=1]
ret float %tmp1
}
and:
_bar: ## @bar
## BB#0: ## %entry
movaps %xmm1, %xmm0
ret
llvm-svn: 109776
2010-07-29 18:13:09 +00:00
Chris Lattner
c95a398947
start setting up infrastructure for passing multi-floats
...
as <2 x float> instead of as double. The backend isn't ready
yet, but infrastructure in the frontend can come up.
llvm-svn: 109768
2010-07-29 17:49:08 +00:00
Chris Lattner
1c56d9ab56
rename Get8ByteTypeAtOffset -> GetINTEGERTypeAtOffset to
...
make it clear that this function should only return a type
that the codegen will classify the same as an INTEGER type.
llvm-svn: 109763
2010-07-29 17:40:35 +00:00
Chris Lattner
3f76342cfc
handle a case where we could access off the end of a function
...
that Eli pointed out, rdar://8249586
llvm-svn: 109762
2010-07-29 17:34:39 +00:00
Chris Lattner
cd84084f02
fix PR7742 / rdar://8250764, a miscompilation of struct
...
return where the struct has a base but no fields. This
was because the x86-64 abi logic was checking the wrong
predicate in one place.
This was introduced in r91874, which was a fix for PR5831,
which lacked a CHECK line, so I verified and added it.
llvm-svn: 109759
2010-07-29 17:04:54 +00:00
Chris Lattner
98076a25ce
This is a little bit far, but optimize cases like:
...
struct a {
struct c {
double x;
int y;
} x[1];
};
void foo(struct a A) {
}
into:
define void @foo(double %A.coerce0, i32 %A.coerce1) nounwind {
entry:
%A = alloca %struct.a, align 8 ; <%struct.a*> [#uses=1]
%0 = bitcast %struct.a* %A to %struct.c* ; <%struct.c*> [#uses=2]
%1 = getelementptr %struct.c* %0, i32 0, i32 0 ; <double*> [#uses=1]
store double %A.coerce0, double* %1
%2 = getelementptr %struct.c* %0, i32 0, i32 1 ; <i32*> [#uses=1]
store i32 %A.coerce1, i32* %2
instead of:
define void @foo(double %A.coerce0, i64 %A.coerce1) nounwind {
entry:
%A = alloca %struct.a, align 8 ; <%struct.a*> [#uses=1]
%0 = bitcast %struct.a* %A to %0* ; <%0*> [#uses=2]
%1 = getelementptr %0* %0, i32 0, i32 0 ; <double*> [#uses=1]
store double %A.coerce0, double* %1
%2 = getelementptr %0* %0, i32 0, i32 1 ; <i64*> [#uses=1]
store i64 %A.coerce1, i64* %2
I only do this now because I never want to look at this code again :)
llvm-svn: 109738
2010-07-29 07:43:55 +00:00
Chris Lattner
c8b7b53a1e
implement a todo: pass a eight-byte that consists of a
...
small integer + padding as that small integer. On code
like:
struct c { double x; int y; };
void bar(struct c C) { }
This means that we compile to:
define void @bar(double %C.coerce0, i32 %C.coerce1) nounwind {
entry:
%C = alloca %struct.c, align 8 ; <%struct.c*> [#uses=2]
%0 = getelementptr %struct.c* %C, i32 0, i32 0 ; <double*> [#uses=1]
store double %C.coerce0, double* %0
%1 = getelementptr %struct.c* %C, i32 0, i32 1 ; <i32*> [#uses=1]
store i32 %C.coerce1, i32* %1
instead of:
define void @bar(double %C.coerce0, i64 %C.coerce1) nounwind {
entry:
%C = alloca %struct.c, align 8 ; <%struct.c*> [#uses=3]
%0 = bitcast %struct.c* %C to %0* ; <%0*> [#uses=2]
%1 = getelementptr %0* %0, i32 0, i32 0 ; <double*> [#uses=1]
store double %C.coerce0, double* %1
%2 = getelementptr %0* %0, i32 0, i32 1 ; <i64*> [#uses=1]
store i64 %C.coerce1, i64* %2
which gives SRoA heartburn.
This implements rdar://5711709, a nice low number :)
llvm-svn: 109737
2010-07-29 07:30:00 +00:00
Chris Lattner
2cdfda44a1
fix a builder, why didn't clang++ catch this?
...
llvm-svn: 109735
2010-07-29 06:44:09 +00:00
Chris Lattner
fe34c1d53e
Kill off the 'coerce' ABI passing form. Now 'direct' and 'extend' always
...
have a "coerce to" type which often matches the default lowering of Clang
type to LLVM IR type, but the coerce case can be handled by making them
not be the same.
This simplifies things and fixes issues where X86-64 abi lowering would
return coerce after making preferred types exactly match up. This caused
us to compile:
typedef float v4f32 __attribute__((__vector_size__(16)));
v4f32 foo(v4f32 X) {
return X+X;
}
into this code at -O0:
define <4 x float> @foo(<4 x float> %X.coerce) nounwind {
entry:
%retval = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2]
%coerce = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2]
%X.addr = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3]
store <4 x float> %X.coerce, <4 x float>* %coerce
%X = load <4 x float>* %coerce ; <<4 x float>> [#uses=1]
store <4 x float> %X, <4 x float>* %X.addr
%tmp = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1]
%tmp1 = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1]
%add = fadd <4 x float> %tmp, %tmp1 ; <<4 x float>> [#uses=1]
store <4 x float> %add, <4 x float>* %retval
%0 = load <4 x float>* %retval ; <<4 x float>> [#uses=1]
ret <4 x float> %0
}
Now we get:
define <4 x float> @foo(<4 x float> %X) nounwind {
entry:
%X.addr = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3]
store <4 x float> %X, <4 x float>* %X.addr
%tmp = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1]
%tmp1 = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1]
%add = fadd <4 x float> %tmp, %tmp1 ; <<4 x float>> [#uses=1]
ret <4 x float> %add
}
This implements rdar://8248065
llvm-svn: 109733
2010-07-29 06:26:06 +00:00
Chris Lattner
9fa15c3608
ignore structs that wrap vectors in IR, the abstraction shouldn't add penalty.
...
Before we'd compile the example into something like:
%coerce.dive2 = getelementptr %struct.v4f32wrapper* %retval, i32 0, i32 0 ; <<4 x float>*> [#uses=1]
%1 = bitcast <4 x float>* %coerce.dive2 to <2 x double>* ; <<2 x double>*> [#uses=1]
%2 = load <2 x double>* %1, align 1 ; <<2 x double>> [#uses=1]
ret <2 x double> %2
Now we produce:
%coerce.dive2 = getelementptr %struct.v4f32wrapper* %retval, i32 0, i32 0 ; <<4 x float>*> [#uses=1]
%0 = load <4 x float>* %coerce.dive2, align 1 ; <<4 x float>> [#uses=1]
ret <4 x float> %0
llvm-svn: 109732
2010-07-29 05:02:29 +00:00
Chris Lattner
4200fe4e50
move the 'pretty 16-byte vector' inferring code up to be shared
...
with return values, improving stuff that returns __m128 etc.
llvm-svn: 109731
2010-07-29 04:56:46 +00:00
Chris Lattner
ce1bd754d8
simplify code by eliminating a premature optimization.
...
llvm-svn: 109730
2010-07-29 04:51:12 +00:00
Chris Lattner
3a44c7e55d
now that we have CGT around, we can start using preferred types
...
for return values too. Instead of compiling something like:
struct foo {
int *X;
float *Y;
};
struct foo test(struct foo *P) { return *P; }
to:
%1 = type { i64, i64 }
define %1 @test(%struct.foo* %P) nounwind {
entry:
%retval = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2]
%P.addr = alloca %struct.foo*, align 8 ; <%struct.foo**> [#uses=2]
store %struct.foo* %P, %struct.foo** %P.addr
%tmp = load %struct.foo** %P.addr ; <%struct.foo*> [#uses=1]
%tmp1 = bitcast %struct.foo* %retval to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.foo* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 16, i32 8, i1 false)
%0 = bitcast %struct.foo* %retval to %1* ; <%1*> [#uses=1]
%1 = load %1* %0, align 1 ; <%1> [#uses=1]
ret %1 %1
}
We now get the result more type safe, with:
define %struct.foo @test(%struct.foo* %P) nounwind {
entry:
%retval = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2]
%P.addr = alloca %struct.foo*, align 8 ; <%struct.foo**> [#uses=2]
store %struct.foo* %P, %struct.foo** %P.addr
%tmp = load %struct.foo** %P.addr ; <%struct.foo*> [#uses=1]
%tmp1 = bitcast %struct.foo* %retval to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.foo* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 16, i32 8, i1 false)
%0 = load %struct.foo* %retval ; <%struct.foo> [#uses=1]
ret %struct.foo %0
}
That memcpy is completely terrible, but I don't know how to fix it.
llvm-svn: 109729
2010-07-29 04:46:19 +00:00
Chris Lattner
029c0f1681
sink preferred type stuff lower. It's possible that this might
...
improve codegen for vaarg or something, because its codepath is
getting preferred types now.
llvm-svn: 109728
2010-07-29 04:41:05 +00:00
Chris Lattner
22326a10a7
dissolve some more complexity: make the x86-64 abi lowering code
...
compute its own preferred types instead of having CGT compute
them then pass them (circuituously) down into ABIInfo.
llvm-svn: 109726
2010-07-29 02:31:05 +00:00
Chris Lattner
c11301c76e
simplify Get8ByteTypeAtOffset by making it a member of X86_64ABIInfo
...
llvm-svn: 109724
2010-07-29 02:20:19 +00:00
Chris Lattner
458b2aaee0
now that ABIInfo depends on CGT, it has trivial access to such
...
things as TargetData, ASTContext, LLVMContext etc. Stop passing
them through so many APIs.
llvm-svn: 109723
2010-07-29 02:16:43 +00:00
Chris Lattner
2b03797222
cave in to reality and make ABIInfo depend on CodeGenTypes.
...
This will simplify a bunch of code, coming up next.
llvm-svn: 109722
2010-07-29 02:01:43 +00:00
Chris Lattner
f4ba08aeaf
pass argument vectors in a type that corresponds to the user type if
...
possible. This improves the example to pass <4 x float> instead of
<2 x double> but we still get awful code, and still don't get the
return value right.
llvm-svn: 109700
2010-07-28 23:47:21 +00:00
Chris Lattner
4b8585ef6a
tidy up
...
llvm-svn: 109699
2010-07-28 23:46:15 +00:00
Devang Patel
c7f16ab3e3
Override selected builtin names (e.g. "long int" instead of "long") to match names used by gcc in debug info. This makes gdb testsuite happy.
...
llvm-svn: 109694
2010-07-28 23:23:29 +00:00
Chris Lattner
fa560fedb7
fix some break statements to be formatted more consistently,
...
remove some now-dead code.
llvm-svn: 109690
2010-07-28 23:12:33 +00:00
Chris Lattner
31faff5d58
use Get8ByteTypeAtOffset for the return value path as well so we
...
don't get errors similar to PR7714 on the return path.
llvm-svn: 109689
2010-07-28 23:06:14 +00:00
Chris Lattner
b22f1c8bf7
refactor the autosizing code, eliminating duplication
...
and making Get8ByteTypeAtOffset always succeed and documented.
llvm-svn: 109685
2010-07-28 22:44:07 +00:00
Chris Lattner
4c1e484f39
fix PR7714 by not referencing off the end of a struct when passed by value in
...
x86-64 abi. This also improves codegen as well. Some refactoring is needed of
this code.
llvm-svn: 109681
2010-07-28 22:15:08 +00:00
Fariborz Jahanian
d5010898ab
Fix flags in global block descriptor when
...
block returns structs. Fies radar 8241648.
Executable test added to llvm test suite.
llvm-svn: 109620
2010-07-28 19:07:18 +00:00
Chris Lattner
ff941a666a
some cleanups and get alignments correct for various coerce cases.
...
llvm-svn: 109607
2010-07-28 18:24:28 +00:00
Gabor Greif
79ac9ed7ac
we are not supposed to create an improper callsite using a CallInstr; leave a fixme mentioning the simplification when CallSite can clone itself
...
llvm-svn: 109575
2010-07-28 09:19:33 +00:00
Devang Patel
a652fab052
construct debug info for "id" by hand.
...
Tested by mi1-var-obj.exp in gdb testsuite.
llvm-svn: 109571
2010-07-28 01:33:15 +00:00
John McCall
ba80390307
When creating a jump destination, its scope should be the scope of the
...
enclosing normal cleanup, not the top of the EH stack. I'm *really*
surprised this hasn't been causing more problems.
Fixes rdar://problem/8231514.
llvm-svn: 109569
2010-07-28 01:07:35 +00:00
Argyrios Kyrtzidis
c0279a9826
Revert r109546, it broke linux build.
...
llvm-svn: 109550
2010-07-27 22:37:14 +00:00
Argyrios Kyrtzidis
4fac280618
Merge PCHWriterDecl.cpp's isRequiredDecl and CodeGenModule::MayDeferGeneration into a new function,
...
DeclIsRequiredFunctionOrFileScopedVar.
This function is part of the public CodeGen interface since it's essentially a CodeGen predicate that is also
needed by the PCH mechanism to determine whether a decl needs to be deserialized during PCH loading for codegen purposes.
This fixes current (and avoids future) codegen-from-PCH bugs.
llvm-svn: 109546
2010-07-27 22:01:17 +00:00
Devang Patel
4f6e73b168
Always use current working directory for DW_AT_comp_dir.
...
llvm-svn: 109535
2010-07-27 20:49:59 +00:00
Devang Patel
6014edd117
Reapply 109303.
...
llvm-svn: 109507
2010-07-27 15:17:16 +00:00
Fariborz Jahanian
0ebca28f1d
2nd argument of __builtin_expect must be evaluated
...
if it hs side-effect to matchgcc's behaviour.
Addresses radar 8172109.
llvm-svn: 109467
2010-07-26 23:11:03 +00:00
John McCall
5cbe152ffc
Test for the presence of EH branch-throughs instead of normal branch-throughs.
...
I knew this code duplication would bite me.
llvm-svn: 109463
2010-07-26 22:44:58 +00:00
Devang Patel
6005082354
Revert 109303.
...
llvm-svn: 109426
2010-07-26 18:49:27 +00:00
Douglas Gregor
b412e174db
Remove the vast majority of the Destroy methods from the AST library,
...
since we aren't going to be calling them ever.
llvm-svn: 109377
2010-07-25 18:17:45 +00:00
John McCall
268b576b72
Mangle enum constant expressions. Fixes rdar://problem/8204122
...
llvm-svn: 109315
2010-07-24 01:17:35 +00:00
Devang Patel
268ad093a7
Untangle filename/dirname confusion. Store constructed strings on the side. Avoid use of Path.makeAbsolute().
...
DW_TAG_compile_unit uses two attributes DW_AT_name and DW_AT_comp_dir. Their expected values are:
$ clang foo.c -g
DW_AT_name - foo.c
DW_AT_comp_dir - `pwd`
$ clang one/two/foo.c -g
DW_AT_name - one/two/foo.c
DW_AT_comp_dir - `pwd`
$ clang /tmp/one/foo.c -g
DW_AT_name - /tmp/one/foo.c
DW_AT_comp_dir - empty
llvm-svn: 109303
2010-07-24 00:59:16 +00:00
John McCall
2ca705eb13
Support catching Objective C pointers in C++ under the non-fragile NeXT runtime.
...
Diagnose attempts to do this under the GNU or fragile NeXT runtimes.
llvm-svn: 109298
2010-07-24 00:37:23 +00:00
Fariborz Jahanian
72cdffa401
Return type of a setter call caused by
...
use of property-dot syntax using 'super' as receiver
is 'void'. This fixes a bug in generating correct
API for setter call. Fixes radar 8203426.
llvm-svn: 109297
2010-07-24 00:34:08 +00:00
Devang Patel
cb9fe9ec16
Revert r109263.
...
llvm-svn: 109284
2010-07-23 23:04:28 +00:00
John McCall
ad5d61e227
Revise cleanup IR generation to fix a major bug with cleanups (PR7686)
...
as well as some significant asymptotic inefficiencies with threading
multiple jumps through deep cleanups.
llvm-svn: 109274
2010-07-23 21:56:41 +00:00
Devang Patel
28f167699a
There is no need to use separate dir name for AT_comp_dir attribute. Using absolute path for filename allows clients to query complete file location info from gdb breakpoints. Save constructed full file name.
...
llvm-svn: 109263
2010-07-23 20:38:37 +00:00
Douglas Gregor
5cc2c8b9c3
Vectors are not integer types, so the type system should not classify
...
them as such. Type::is(Signed|Unsigned|)IntegerType() now return false
for vector types, and new functions
has(Signed|Unsigned|)IntegerRepresentation() cover integer types and
vector-of-integer types. This fixes a bunch of latent bugs.
Patch from Anton Yartsev!
llvm-svn: 109229
2010-07-23 15:58:24 +00:00
Devang Patel
0884a60eb5
Keep track of artificial scopes introduced by line directives. For example,
...
#line 41 "bar.c"
dummy (1, i);
#line 24 "bar.h"
i = f2 (i);
#line 44 "bar.c"
This is tested by step-line.exp in gdb testsuite.
llvm-svn: 109189
2010-07-22 22:29:16 +00:00
John McCall
775f9f9919
Turn off EH cleanups for __block variables; they caused some internal buildbot
...
failures. There's a radar tracking this.
llvm-svn: 109170
2010-07-22 21:25:44 +00:00
Fariborz Jahanian
6e7e8cc19d
atch for implementation of objective-c's -Wselector
...
warning flag in clang. Little more to do
for a PCH issue. Radar 6507158.
llvm-svn: 109129
2010-07-22 18:24:20 +00:00
Devang Patel
222f4be834
ObjCId is special "struct objc_object". Make this explicit in debug info.
...
This is tested by objc-rbreak.exp in gdb testsuite.
llvm-svn: 109050
2010-07-21 22:41:25 +00:00
Devang Patel
65497583b5
Fix regression caused by r108911.
...
Do not override known debug loc with unknown debug loc.
This is tested by sections.exp in gdb testsuite.
llvm-svn: 109022
2010-07-21 18:08:50 +00:00
David Chisnall
4715d161c0
Don't crash when sending a message inside a block with the non-fragile ABI (GNU runtime).
...
llvm-svn: 109012
2010-07-21 15:28:28 +00:00
David Chisnall
7fa204edc7
Mark the load after calling objc_msg_lookup_sender() so that it doesn't get optimised away (GNU runtime).
...
llvm-svn: 109010
2010-07-21 12:55:25 +00:00
John McCall
cda666ccd8
Rename LazyCleanup -> Cleanup. No functionality change for these last three
...
commits.
llvm-svn: 109000
2010-07-21 07:22:38 +00:00
John McCall
20141f2d8c
Rip out EHCleanupScope.
...
llvm-svn: 108999
2010-07-21 07:11:21 +00:00
John McCall
7535ee0352
Kill the CleanupBlock API.
...
llvm-svn: 108998
2010-07-21 07:04:01 +00:00
John McCall
65bea08879
Switch the fragile-ABI @finally/@synchronized cleanup over to using a lazy
...
cleanup.
llvm-svn: 108997
2010-07-21 06:59:36 +00:00
John McCall
0d42a41a63
Code simplification.
...
llvm-svn: 108996
2010-07-21 06:45:54 +00:00
John McCall
fb442ae7b9
Switch the main possibly-conditional temporary cleanup over to being lazy.
...
llvm-svn: 108995
2010-07-21 06:44:28 +00:00
John McCall
8680f87d99
Switch the destructor for a temporary arising from a reference binding over to
...
using a lazy cleanup.
llvm-svn: 108994
2010-07-21 06:29:51 +00:00
John McCall
da650e091f
Switch the __cxa_guard_abort cleanup to being a lazy cleanup.
...
llvm-svn: 108993
2010-07-21 06:20:50 +00:00
John McCall
a464ff9d15
Switch some random local-decl cleanups over to using lazy cleanups. Turn on
...
the block-release unwind cleanup: we're never going to test it if we don't turn
it on.
llvm-svn: 108992
2010-07-21 06:13:08 +00:00
John McCall
906da4bb52
Switch finally cleanups over to being lazy cleanups. We get basically nothing
...
from the laziness features here except better block ordering, but it removes yet
another CleanupBlock use.
llvm-svn: 108990
2010-07-21 05:47:49 +00:00
John McCall
f99a631e4e
Implement proper base/member destructor EH chaining.
...
llvm-svn: 108989
2010-07-21 05:30:47 +00:00
John McCall
53cad2ef04
Change PushDestructorCleanup to use lazy cleanups.
...
llvm-svn: 108979
2010-07-21 01:41:18 +00:00
John McCall
1d9875654f
Convert the EH cleanups for base and member destructors in a constructor into
...
lazy cleanups.
llvm-svn: 108978
2010-07-21 01:23:41 +00:00
Douglas Gregor
05fc5be32f
Implement zero-initialization for array new when there is an
...
initializer of (). Make sure to use a simple memset() when we can, or
fall back to generating a loop when a simple memset will not
suffice. Fixes <rdar://problem/8212208>, a regression due to my work
in r107857.
llvm-svn: 108977
2010-07-21 01:10:17 +00:00
John McCall
1e67040fb7
Convert the end-catch call for finally blocks to a lazy cleanup. This kills off
...
the last of the shared-code cleanups.
llvm-svn: 108975
2010-07-21 00:52:03 +00:00
John McCall
c20acd31f7
Convert the ObjC @synchronized cleanups to laziness. This is not actually
...
a big deal, except that I want to eliminate the shared-code EH cleanups
in preparation for a significant algorithmic fix.
llvm-svn: 108973
2010-07-21 00:41:47 +00:00
John McCall
8f51041184
Add a little helper method which will be useful soon.
...
llvm-svn: 108972
2010-07-21 00:40:03 +00:00
Devang Patel
0043977f09
Remove unintended code that was checked in as part of r108916.
...
llvm-svn: 108951
2010-07-20 22:32:37 +00:00
Devang Patel
11a42a4655
Remove unused argument.
...
llvm-svn: 108946
2010-07-20 22:20:10 +00:00
John McCall
5add20cefa
Fix the IR generation for catching pointers by references.
...
Fixes <rdar://problem/8212123>.
llvm-svn: 108944
2010-07-20 22:17:55 +00:00
Chris Lattner
32ac583d91
in 'new int[4]', constant fold the 4*4=16 instead of
...
doing an overflow check.
llvm-svn: 108943
2010-07-20 21:55:52 +00:00
Chris Lattner
f2f3870189
Follow the implementation approach suggested by PR6687,
...
which generates more efficient and more obviously conformant
code. We now test for overflow of the multiply then force
the result to -1 if so. On X86, this generates nice code
like this:
__Z4testl: ## @_Z4testl
## BB#0: ## %entry
subl $12, %esp
movl $4, %eax
mull 16(%esp)
testl %edx, %edx
movl $-1, %ecx
cmovel %eax, %ecx
movl %ecx, (%esp)
call __Znam
addl $12, %esp
ret
llvm-svn: 108927
2010-07-20 21:07:09 +00:00
Fariborz Jahanian
217af240b5
Adopt objc_assign_threadlocal() for __thread variables of GC types.
...
Implements radar 8203301.
llvm-svn: 108917
2010-07-20 20:30:03 +00:00
Devang Patel
6c01820900
Print template argument names for template class.
...
llvm-svn: 108916
2010-07-20 20:24:18 +00:00
Chris Lattner
26008e07de
implement rdar://5739832 - operator new should check for overflow in multiply,
...
causing clang to compile this code into something that correctly throws a
length error, fixing a potential integer overflow security attack:
void *test(long N) {
return new int[N];
}
int main() {
test(1L << 62);
}
We do this even when exceptions are disabled, because it is better for the
code to abort than for the attack to succeed.
This is heavily based on a patch that Fariborz wrote.
llvm-svn: 108915
2010-07-20 20:19:24 +00:00
Dan Gohman
481e40c681
Use getDebugLoc and setDebugLoc instead of getDbgMetadata and setDbgMetadata,
...
avoiding MDNode overhead.
llvm-svn: 108911
2010-07-20 20:13:52 +00:00
Chris Lattner
b7a95cf165
delete a loop that just generates dead code. In an example
...
like this:
void *test(long N) {
return new int[N][42][42];
}
the loop generates two dead mul instructions:
%tmp = load i64* %N.addr ; <i64> [#uses=2]
%0 = mul i64 %tmp, 7056 ; <i64> [#uses=1]
%1 = mul i64 %tmp, 42 ; <i64> [#uses=1]
%2 = mul i64 %1, 42 ; <i64> [#uses=0]
%call = call noalias i8* @_Znam(i64 %0) ; <i8*> [#uses=1]
The scale of these multiplies is already handled by the typesize stuff.
llvm-svn: 108884
2010-07-20 18:49:33 +00:00
Chris Lattner
cb46bdc34f
remove the special case for constant array sizes from
...
EmitCXXNewAllocSize. This code uses IRBuilder, which does
constant folding already.
llvm-svn: 108882
2010-07-20 18:45:57 +00:00
Jim Grosbach
71d963e954
Re-apply fixed version of 108749, correctly conditionalizing the new sections on
...
ObjC ABI version 2 this time.
llvm-svn: 108847
2010-07-20 16:20:26 +00:00
Sebastian Redl
c57d34bc35
Update ImplicitCastExpr to be able to represent an XValue.
...
llvm-svn: 108807
2010-07-20 04:20:21 +00:00
Stuart Hastings
7d7bc561bf
Correct line info for declarations/definitions. Radar 8063111.
...
llvm-svn: 108785
2010-07-19 23:56:31 +00:00
Jim Grosbach
50c63168ed
Temporarily revert. Some odd internal breakage is likely related.
...
llvm-svn: 108764
2010-07-19 22:43:34 +00:00
Jim Grosbach
f699594de8
Put ObjC method names, method types and class names in separate string literal
...
sections. rdar://8207705
llvm-svn: 108749
2010-07-19 20:54:43 +00:00
Eli Friedman
f8340deacd
Fix mangling for static member variables of classes inside an extern "C"
...
linkage specification. Not sure if this is the ideal fix, but I'm reasonably
sure it's correct vs. gcc.
llvm-svn: 108656
2010-07-18 20:49:59 +00:00
Chandler Carruth
bc8cab16c5
Improve the representation of the atomic builtins in a few ways. First, we make
...
their call expressions synthetically have the "deduced" types based on their
first argument. We only insert conversions in the AST for arguments whose
values require conversion to match the value type expected. This keeps PR7600
closed by maintaining the return type, but avoids assertions due to unexpected
implicit casts making the type unsigned (test case added from Daniel).
The magic is moved into the codegen for the atomic builtin which inserts the
casts as needed at the IR level to raise the type to an integer suitable for
the LLVM intrinsic. This shouldn't cause any real change in functionality, but
now we can make the builtin be more truly polymorphic.
llvm-svn: 108638
2010-07-18 07:23:17 +00:00
Chris Lattner
ad4f38b1a9
BUILD_ARCHIVE is the default for libraries, no need to set it.
...
llvm-svn: 108633
2010-07-18 00:14:47 +00:00
Eli Friedman
3ee1022f37
Fix crash initializing a bit-field with a non-constant in a place where we
...
try to evaluate the initializer as a constant.
llvm-svn: 108632
2010-07-17 23:55:01 +00:00
John McCall
36ea3723c0
The GNU-runtime ObjC personality function doesn't let us rethrow with URR for
...
multiple reasons. Rethrow with _objc_exception_throw instead. Fixes PR7656.
llvm-svn: 108595
2010-07-17 00:43:08 +00:00
Eli Friedman
eca55afea3
Fix for PR3800: make sure not to evaluate the expression for a read-write
...
asm operand twice.
llvm-svn: 108489
2010-07-16 00:55:21 +00:00
Daniel Dunbar
3348e2d175
IRgen: Support user defined attributes on block runtime functions.
...
- This issue here is that /usr/include/Blocks.h wants to define some of the
block runtime globals as weak, depending on the target. This doesn't work in
Clang because we aren't using the AST decl for these globals.
- The fix is a pretty gross hack which just watches all the decls for the
specific blocks globals we need to know about; if we see one we use it,
otherwise we use the hand coded type.
In time, I would like to clean this up by changing IRgen to ask Sema/AST for
the decl, which would then be lazily loaded from the builtin table if
necessary. This could be used in a whole host of places in IRgen and would
get rid of a lot of grotty hand coding of LLVM IR; however, we need some
extra Sema support for this as well as support for builtin global variables.
llvm-svn: 108482
2010-07-16 00:00:19 +00:00
Daniel Dunbar
900546d2e3
IRgen: Move blocks runtime interfaces to CodeGenModule.
...
llvm-svn: 108481
2010-07-16 00:00:15 +00:00
John McCall
70013b640f
When deferring the emission of declarations with initializers in C++, remember
...
the order they appeared in the translation unit. If they get emitted, put them
in their proper order. Fixes rdar://problem/7458115
llvm-svn: 108477
2010-07-15 23:40:35 +00:00
Devang Patel
8fd6499a97
Set "optimization is ON" and supply other optional parameters. This helps codegenerator preserve info in case the symbol is deleted.
...
llvm-svn: 108471
2010-07-15 23:09:46 +00:00
Douglas Gregor
8997690ff1
Don't suppress the emission of available_externally functions marked
...
with always_inline attribute. Thanks to Howard for the tip.
llvm-svn: 108469
2010-07-15 22:58:18 +00:00
Devang Patel
b3026df9fa
Mark implementation generated methods as artificial.
...
Tested by namespace.exp and virtfunc.exp from gdb testsuite.
llvm-svn: 108468
2010-07-15 22:57:00 +00:00
John McCall
ec624b2d19
After some discussion, the ABI list settled on a much more sensible mangling
...
for string literals.
llvm-svn: 108464
2010-07-15 21:53:03 +00:00
Douglas Gregor
cdb466e58f
Reinstate the scalar-cast-to-const-reference improvements, this time
...
with the proper spelling of "non-class prvalue". Silly me, I think
class rvalues were xvalues rather than prvalues!
Hah hah hah.
llvm-svn: 108443
2010-07-15 18:58:16 +00:00
Douglas Gregor
31e225cc90
Revert r108431 and r108433 (the cast-to-const-reference fixes), which
...
broke nightlytest.
llvm-svn: 108439
2010-07-15 18:41:54 +00:00
Devang Patel
99c372134d
Revert 108220 and subsequent patch.
...
This is not required (I am not 100% sure why) but method.exp from gdb testsuite flagged regression due to this patch.
llvm-svn: 108434
2010-07-15 18:16:09 +00:00
Douglas Gregor
6744cbda03
Spell isPRValue() properly.
...
llvm-svn: 108433
2010-07-15 18:12:28 +00:00
Douglas Gregor
1bae6a1be9
Teach CodeGenFunction::EmitCastLValue() to handle casts to an lvalue
...
that involve binding a reference to a pure rvalue temporary (e.g., not
a class temporary), by creating a new temporary and copying the result
there. Fixes PR6024.
llvm-svn: 108431
2010-07-15 18:04:13 +00:00
Douglas Gregor
cee039093a
CK_BitCast is not an lvalue bitcast any longer
...
llvm-svn: 108428
2010-07-15 16:39:55 +00:00
Daniel Dunbar
1d14dd1dc6
CodeGen: Tweak ABI handling for Minix, patch by Kees van Reeuwijk!
...
llvm-svn: 108423
2010-07-15 15:02:28 +00:00
Daniel Dunbar
6f2e839693
CodeGen/ObjC/NeXT: Fix Obj-C message send to match llvm-gcc when choosing
...
whether to use objc_msgSend_fpret; the choice is target dependent, not Obj-C ABI
dependent.
- <rdar://problem/8139758> arm objc _objc_msgSend_fpret bug
llvm-svn: 108379
2010-07-14 23:39:36 +00:00
Douglas Gregor
c357f4121e
Add lvalue-bitcast support for complex numbers.
...
llvm-svn: 108363
2010-07-14 21:35:45 +00:00
John McCall
4f3b5f302c
Fix the mangling of template template arguments, which do not always
...
follow <name>; instead they follow <type>, which has <name> as a subset.
Fixes PR7446.
llvm-svn: 108326
2010-07-14 06:43:17 +00:00
John McCall
afe20780ee
Remove a few mangling FIXMEs:
...
- TSTs whose template is a template template parameter already work
- we don't provide an imaginary type, so we can't mangle one
- we don't need a generic FIXME for vendor type qualifiers
llvm-svn: 108317
2010-07-14 04:38:21 +00:00
John McCall
05ddbb80d2
Implement the standard mangling for array-subscript expressions, and implement
...
the current proposals from David Vandervoorde for new, delete, throw, typeid,
imaginary literals, string literals, and null literals.
llvm-svn: 108315
2010-07-14 04:20:34 +00:00
John McCall
11e577b99a
Work around an obnoxious GCC warning by changing semantics in a hopefully-
...
harmless way.
llvm-svn: 108295
2010-07-13 23:19:49 +00:00
Douglas Gregor
51954276cc
Introduce a new cast kind for an "lvalue bitcast", which handles
...
reinterpret_casts (possibly indirectly via C-style/functional casts)
on values, e.g.,
int i;
reinterpret_cast<short&>(i);
The IR generated for this is essentially the same as for
*reinterpret_cast<short*>(&i).
Fixes PR6437, PR7593, and PR7344.
llvm-svn: 108294
2010-07-13 23:17:26 +00:00
John McCall
5c0e69ef0e
Switch the __cxa_rethrow cleanup to be lazy.
...
llvm-svn: 108288
2010-07-13 22:24:23 +00:00
John McCall
5c08ab956b
Allow for the possibility that __cxa_end_catch might throw for a catch-all block
...
or a catch of a record type by value or reference. Also convert this to a
lazy cleanup.
llvm-svn: 108287
2010-07-13 22:12:14 +00:00
John McCall
bb0260139a
Switch the __cxa_free_exception cleanup to be lazy.
...
llvm-svn: 108276
2010-07-13 21:17:51 +00:00
John McCall
2b7fc3828e
Teach IR generation how to lazily emit cleanups. This has a lot of advantages,
...
mostly in avoiding unnecessary work at compile time but also in producing more
sensible block orderings.
Move the destructor cleanups for local variables over to use lazy cleanups.
Eventually all cleanups will do this; for now we have some awkward code
duplication.
Tell IR generation just to never produce landing pads in -fno-exceptions.
This is a much more comprehensive solution to a problem which previously was
half-solved by checks in most cleanup-generation spots.
llvm-svn: 108270
2010-07-13 20:32:21 +00:00
Douglas Gregor
a8a089bfd5
Whenever we're creating an expression that is typically an rvalue
...
(e.g., a call, cast, etc.), immediately adjust the expression's type
to strip cv-qualifiers off of all non-class types (in C++) or all
types (in C). This effectively extends my previous fix for PR7463,
which was restricted to calls, to other kinds of expressions within
similar characteristics. I've audited every use of
getNonReferenceType() in the code base, switching to the newly-renamed
getNonLValueExprType() where necessary.
Big thanks to Eli for pointing out just how incomplete my original fix
for PR7463 actually was. We've been handling cv-qualifiers on rvalues
wrong for a very, very long time. Fixes PR7463.
llvm-svn: 108253
2010-07-13 18:40:04 +00:00
Devang Patel
01c8c100c2
Add volatile qualifiers for "this".
...
llvm-svn: 108245
2010-07-13 16:23:13 +00:00
Douglas Gregor
a700f68828
Reinstate the optimization suppressing available_externally functions
...
at -O0. The only change from the previous patch is that we don't try
to generate virtual method thunks for an available_externally
function.
llvm-svn: 108230
2010-07-13 06:02:28 +00:00
Devang Patel
0a34e31d81
const qualify debug info for "this" for const methods.
...
llvm-svn: 108220
2010-07-13 00:24:30 +00:00
Devang Patel
0aabb1200f
While collecting members for a class, always create delcaration entry for methods. Debug info for method definition will be generated while generating code for method body.
...
Tested by classes.exp in gdb testsuite.
llvm-svn: 108205
2010-07-12 22:54:41 +00:00
Douglas Gregor
553f3a9b30
Speculatively revert r108156; it appears to be breaking self-host.
...
llvm-svn: 108194
2010-07-12 21:08:32 +00:00
Douglas Gregor
dbb2806a7b
Do not generate LLVM IR for available_externally function bodies at
...
-O0, since we won't be using the definitions for anything anyway. For
lib/System/Path.o when built in Debug+Asserts mode, this leads to a 4%
improvement in compile time (and suppresses 440 function bodies).
<rdar://problem/7987644>
llvm-svn: 108156
2010-07-12 17:24:55 +00:00
Devang Patel
8f3f76f991
Handle forward declarations properly in debug info.
...
Patch by Alexander Kabaev.
PR 7595.
llvm-svn: 107900
2010-07-08 19:56:29 +00:00
John McCall
be349def4b
Mark calls to 'throw()' functions as nounwind, and mark the functions nounwind
...
as well.
llvm-svn: 107858
2010-07-08 06:48:12 +00:00
Douglas Gregor
747eb7840a
Reinstate the fix for PR7556. A silly use of isTrivial() was
...
suppressing copies of objects with trivial copy constructors.
llvm-svn: 107857
2010-07-08 06:14:04 +00:00
Chris Lattner
cb7696cf35
fix the clang side of PR7437: EmitAggregateCopy
...
was not producing a memcpy with the right address
spaces because of two places in it doing casts of
the arguments to i8, one of which that didn't
preserve the address space.
There is also an optimizer bug here.
llvm-svn: 107842
2010-07-08 00:07:45 +00:00
Douglas Gregor
e182370eda
Revert r107828 and r107827, the fix for PR7556, which seems to be
...
breaking bootstrap on Linux.
llvm-svn: 107837
2010-07-07 23:37:33 +00:00
Douglas Gregor
6df2b8c3ac
Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect its
...
newly-narrowed scope. No functionality change.
llvm-svn: 107828
2010-07-07 22:43:56 +00:00
Douglas Gregor
442612c285
Do not use CXXZeroValueInitExpr for class types. Instead, use
...
CXXConstructExpr/CXXTemporaryObjectExpr/CXXNewExpr as
appropriate. Fixes PR7556, and provides a slide codegen improvement
when copy-initializing a POD class type from a value-initialized
temporary. Previously, we weren't eliding the copy.
llvm-svn: 107827
2010-07-07 22:35:13 +00:00
Chris Lattner
3e2ee147d0
add driver support for minix, patch by Kees van Reeuwijk
...
from PR7583
llvm-svn: 107788
2010-07-07 16:01:42 +00:00
Argyrios Kyrtzidis
54fcbc7345
getBody() -> hasBody()
...
llvm-svn: 107773
2010-07-07 12:24:18 +00:00
Argyrios Kyrtzidis
36ea322579
Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH.
...
Makes de-serialization of the function body even more "lazier".
llvm-svn: 107768
2010-07-07 11:31:19 +00:00
John McCall
b609d3f5f9
Teach function-try-blocks on constructors and destructors to implicitly
...
rethrow. Fixes rdar://problem/7696603
llvm-svn: 107757
2010-07-07 06:56:46 +00:00
John McCall
09ae03299a
Provide a hook for the benefit of clients using clang IR gen as a subroutine:
...
emit metadata associating allocas and global values with a Decl*. This feature
is controlled by an option that (intentionally) cannot be enabled on the command
line.
To use this feature, simply set
CodeGenOptions.EmitDeclMetadata = true;
and then interpret the completely underspecified metadata. :)
llvm-svn: 107739
2010-07-06 23:57:41 +00:00
John McCall
189223e222
Make CGBuilderTy a typedef again; its functionality has been rolled back
...
into IRBuilder.
llvm-svn: 107687
2010-07-06 18:43:48 +00:00
John McCall
2d605ac1f5
When destroying a cleanup, kill any references to instructions in the entry
...
block before deleting it. Fixes PR7575.
This really just a short-term fix before implementing lazy cleanups.
llvm-svn: 107676
2010-07-06 17:35:03 +00:00
John McCall
466e221037
When creating functions to run global initializers and destructors, mark them
...
as nounwind in -fno-exceptions. Fixes rdar://problem/8090834.
llvm-svn: 107639
2010-07-06 04:38:10 +00:00
John McCall
bd30929e4d
Validated by nightly-test runs on x86 and x86-64 darwin, including after
...
self-host. Hopefully these results hold up on different platforms.
I tried to keep the GNU ObjC runtime happy, but it's hard for me to test.
Reimplement how clang generates IR for exceptions. Instead of creating new
invoke destinations which sequentially chain to the previous destination,
push a more semantic representation of *why* we need the cleanup/catch/filter
behavior, then collect that information into a single landing pad upon request.
Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional
control flow) are generated, since it's actually fairly closely tied in with
the former. Remove the need to track which cleanup scope a block is associated
with.
Document a lot of previously poorly-understood (by me, at least) behavior.
The new framework implements the Horrible Hack (tm), which requires every
landing pad to have a catch-all so that inlining will work. Clang no longer
requires the Horrible Hack just to make exceptions flow correctly within
a function, however. The HH is an unfortunate requirement of LLVM's EH IR.
llvm-svn: 107631
2010-07-06 01:34:17 +00:00
Chris Lattner
ceddafb846
Generate fewer first class aggregate values for other
...
coerce cases (e.g. {double,int}) which avoids fastisel
bailing out at -O0.
llvm-svn: 107628
2010-07-05 20:41:41 +00:00
Chris Lattner
c401de9998
in the "coerce" case, the ABI handling code ends up making the
...
alloca for an argument. Make sure the argument gets the proper
decl alignment, which may be different than the type alignment.
This fixes PR7567
llvm-svn: 107627
2010-07-05 20:21:00 +00:00
Chris Lattner
53b479ff6a
fix PR7564 a cast where the bitfield struct init code
...
wasn't handling array padding elements right.
llvm-svn: 107621
2010-07-05 18:03:30 +00:00
Chris Lattner
9a3459f1a6
AppendBitField really can never fail, so return its return value.
...
Everyone knows that no bugs are ever possible with bitfields.
llvm-svn: 107620
2010-07-05 17:04:23 +00:00
Charles Davis
3babfba597
Mangle Objective-C pointers and block pointers in the Microsoft C++ Mangler.
...
ObjC pointers were easy enough (as far as the ABI is concerned, they're
just pointers to structs), but I had to invent a new mangling for block
pointers. This is particularly worrying with the Microsoft ABI, because
it is a vendor-specific ABI; extending it could come back to bite us
later when MS extends it on their own (and you know they will).
llvm-svn: 107572
2010-07-03 16:56:59 +00:00
John McCall
1180f8e90f
Provide convenience routines to save and restore the current insertion
...
point.
llvm-svn: 107570
2010-07-03 09:25:20 +00:00
Charles Davis
3b10dd1bec
Fix mangling of array dimensions in the Microsoft C++ Mangler.
...
llvm-svn: 107568
2010-07-03 08:15:16 +00:00
Charles Davis
d49950a317
Mangle member pointer types in the Microsoft C++ Mangler.
...
llvm-svn: 107567
2010-07-03 08:01:32 +00:00
Charles Davis
0029a2a957
Fix mangling of function pointers in the Microsoft C++ Mangler.
...
llvm-svn: 107564
2010-07-03 05:53:41 +00:00
Charles Davis
77552766d9
Fix mangling of array parameters for functions in the Microsoft C++ Mangler.
...
Only actual functions get mangled correctly; I don't know how to fix it for
function pointers yet. Thanks to John McCall for the hint.
Also, mangle anonymous tag types. I don't have a suitable testcase yet; I have
a feeling that that's going to need support for static locals, and I haven't
figured out exactly how MSVC's scheme for mangling those works.
llvm-svn: 107561
2010-07-03 02:41:45 +00:00
Douglas Gregor
bac7490ffc
Remove unnecessary ASTContext parameter from
...
CXXRecordDecl::getDestructor(); no functionality change.
llvm-svn: 107394
2010-07-01 14:13:13 +00:00
Chris Lattner
0e7929f30c
fix rdar://8147692 - yet another crash due to my abi work.
...
llvm-svn: 107387
2010-07-01 06:20:47 +00:00
Daniel Dunbar
bb7ac52e02
Driver/IRgen: Add support for -momit-leaf-frame-pointer.
...
llvm-svn: 107367
2010-07-01 01:31:45 +00:00
Daniel Dunbar
3de064dfdf
Revert "IRgen: Make sure any prolog instructions get debug info.", the lexical
...
scope hasn't been set up yet so this isn't valid. It was just a cleanup to the
IR, so I'm going to ignore it for now.
llvm-svn: 107356
2010-07-01 00:16:31 +00:00
Daniel Dunbar
6696e22cc9
IRgen: Fix debug info regression in r106970; when we eliminate the return value
...
store make sure to move the debug metadata from the store (which is actual
'return' statement location) to the return instruction (which otherwise would
have the function end location as its debug info).
- Tested by gdb test suite.
llvm-svn: 107322
2010-06-30 21:27:58 +00:00
Daniel Dunbar
d7ac9a375a
IRgen: Make sure any prolog instructions get debug info.
...
llvm-svn: 107320
2010-06-30 21:27:56 +00:00
Chris Lattner
5c740f1523
Reapply:
...
r107173, "fix PR7519: after thrashing around and remembering how all this stuff"
r107216, "fix PR7523, which was caused by the ABI code calling ConvertType instead"
This includes a fix to make ConvertTypeForMem handle the "recursive" case, and call
it as such when lowering function types which have an indirect result.
llvm-svn: 107310
2010-06-30 19:14:05 +00:00
Fariborz Jahanian
02995320e9
Use isFunctionOrMethod for vars declared locallly
...
in method/blocks to decide not to mangle them.
llvm-svn: 107309
2010-06-30 18:57:21 +00:00
Fariborz Jahanian
0f19afb9d4
extern variable declared locally to objective-c++ method
...
should not be mangled either. Fixes radar 8016412.
llvm-svn: 107303
2010-06-30 18:27:47 +00:00
Chris Lattner
749b8ed5af
reduce nesting.
...
llvm-svn: 107292
2010-06-30 16:58:07 +00:00
Charles Davis
2a47730767
Mangle arrays in the Microsoft C++ Mangler. It's not quite finished (it
...
doesn't mangle array parameters right), but I think that should be fixed
in Sema (Doug, John, what do you think?).
Also, stub out the remaining mangleType() routines.
llvm-svn: 107264
2010-06-30 08:09:57 +00:00
Daniel Dunbar
e422266926
Revert r107173, "fix PR7519: after thrashing around and remembering how all this stuff", it broke bootstrap.
...
llvm-svn: 107232
2010-06-30 00:22:35 +00:00
Daniel Dunbar
8386469d7d
Revert r107216, "fix PR7523, which was caused by the ABI code calling ConvertType instead", it is part of a boostrap breaking sequence.
...
llvm-svn: 107231
2010-06-30 00:22:30 +00:00
Daniel Dunbar
8c94ffe776
IRgen: Assignment to Objective-C properties shouldn't reload the value, for
...
complex values either. Previously we did this properly for regular assignment,
but not for compound assignment.
- Also, tidy up assignment code a bit to look more like the scalar path.
llvm-svn: 107217
2010-06-29 22:44:21 +00:00
Chris Lattner
466b1419c6
fix PR7523, which was caused by the ABI code calling ConvertType instead
...
of ConvertTypeRecursive when it needed to in a few cases, causing pointer
types to get resolved at the wrong time.
llvm-svn: 107216
2010-06-29 22:39:04 +00:00
Daniel Dunbar
c85ea8e175
IRgen: Assignment to Objective-C properties shouldn't reload the value (which
...
would trigger an extra method call).
- While in the area, I also changed Clang to not emit an unnecessary load from
'x' in cases like 'y = (x = 1)'.
llvm-svn: 107210
2010-06-29 22:00:45 +00:00
Chris Lattner
cccaad9584
change ABIArgInfo to hold its llvm type with PATypeHolder so that
...
it doesn't dangle as types get refined. This fixes Shootout-C++/lists1
and probably also PR7522.
llvm-svn: 107196
2010-06-29 19:21:36 +00:00
Chris Lattner
34d6281ae5
relax the CGFunctionInfo::CGFunctionInfo ctor to allow any sequence
...
of CanQualTypes to be passed in.
llvm-svn: 107176
2010-06-29 18:13:52 +00:00
Chris Lattner
ab1e65e2ea
fix PR7519: after thrashing around and remembering how all this stuff
...
works, the fix is quite simple: just make sure to call ConvertTypeRecursive
when the function type being lowered is in the midst of ConvertType.
llvm-svn: 107173
2010-06-29 17:56:33 +00:00
Chris Lattner
e70a007b36
minor cleanups.
...
llvm-svn: 107150
2010-06-29 16:40:28 +00:00
Chris Lattner
22a931e3bb
Change X86_64ABIInfo to have ASTContext and TargetData ivars to
...
avoid passing ASTContext down through all the methods it has.
When classifying an argument, or argument piece, as INTEGER, check
to see if we have a pointer at exactly the same offset in the
preferred type. If so, use that pointer type instead of i64. This
allows us to compile A function taking a stringref into something
like this:
define i8* @foo(i64 %D.coerce0, i8* %D.coerce1) nounwind ssp {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=4]
%0 = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
store i64 %D.coerce0, i64* %0
%1 = getelementptr %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
store i8* %D.coerce1, i8** %1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
instead of this:
define i8* @foo(i64 %D.coerce0, i64 %D.coerce1) nounwind ssp {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%0 = insertvalue %0 undef, i64 %D.coerce0, 0 ; <%0> [#uses=1]
%1 = insertvalue %0 %0, i64 %D.coerce1, 1 ; <%0> [#uses=1]
%2 = bitcast %struct.DeclGroup* %D to %0* ; <%0*> [#uses=1]
store %0 %1, %0* %2, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
This implements rdar://7375902 - [codegen quality] clang x86-64 ABI lowering code punishing StringRef
llvm-svn: 107123
2010-06-29 06:01:59 +00:00
Chris Lattner
399d22ac1b
plumb preferred types down into X86_64ABIInfo::classifyArgumentType,
...
no functionality change.
llvm-svn: 107115
2010-06-29 01:14:09 +00:00
Chris Lattner
1d7c9f7f4b
Pass the LLVM IR version of argument types down into computeInfo.
...
This is somewhat annoying to do this at this level, but it avoids
having ABIInfo know depend on CodeGenTypes for a hint.
Nothing is using this yet, so no functionality change.
llvm-svn: 107111
2010-06-29 01:08:48 +00:00
Chris Lattner
9e748e9d6e
add IR names to coerced arguments.
...
llvm-svn: 107105
2010-06-29 00:14:52 +00:00
Chris Lattner
15ec361bd6
make the argument passing stuff in the FCA case smarter still, by
...
avoiding making the FCA at all when the types exactly line up. For
example, before we made:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%2 = insertvalue %struct.DeclGroup undef, i64 %0, 0 ; <%struct.DeclGroup> [#uses=1]
%3 = insertvalue %struct.DeclGroup %2, i64 %1, 1 ; <%struct.DeclGroup> [#uses=1]
store %struct.DeclGroup %3, %struct.DeclGroup* %D
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
... which has the pointless insertvalue, which fastisel hates, now we
make:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=4]
%2 = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
store i64 %0, i64* %2
%3 = getelementptr %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
store i64 %1, i64* %3
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
This only kicks in when x86-64 abi lowering decides it likes us.
llvm-svn: 107104
2010-06-29 00:06:42 +00:00
Chris Lattner
3dd716c3c3
Change CGCall to handle the "coerce" case where the coerce-to type
...
is a FCA to pass each of the elements as individual scalars. This
produces code fast isel is less likely to reject and is easier on
the optimizers.
For example, before we would compile:
struct DeclGroup { long NumDecls; char * Y; };
char * foo(DeclGroup D) {
return D.NumDecls+D.Y;
}
to:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(%struct.DeclGroup) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
store %struct.DeclGroup %0, %struct.DeclGroup* %D, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
Now we get:
%0 = type { i64, i64 }
%struct.DeclGroup = type { i64, i8* }
define i8* @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%2 = insertvalue %0 undef, i64 %0, 0 ; <%0> [#uses=1]
%3 = insertvalue %0 %2, i64 %1, 1 ; <%0> [#uses=1]
%4 = bitcast %struct.DeclGroup* %D to %0* ; <%0*> [#uses=1]
store %0 %3, %0* %4, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
Elimination of the FCA inside the function is still-to-come.
llvm-svn: 107099
2010-06-28 23:44:11 +00:00
Chris Lattner
d200eda487
make the trivial forms of CreateCoerced{Load|Store} trivial.
...
llvm-svn: 107091
2010-06-28 22:51:39 +00:00
Chris Lattner
93af332819
pass/return structs of char and short as i8/i16 to avoid
...
aweful through-memory coersion, just like we do for i32 now.
llvm-svn: 107078
2010-06-28 21:59:07 +00:00
Chris Lattner
d776fb150e
more tidying up.
...
llvm-svn: 107076
2010-06-28 21:43:59 +00:00
Chris Lattner
0cf2419cd7
random acts of tidying.
...
llvm-svn: 107050
2010-06-28 20:05:43 +00:00
Chris Lattner
a7d81ab7f3
X86-64:
...
pass/return structs of float/int as float/i32 instead of double/i64
to make the code generated for ABI cleaner. Passing in the low part
of a double is the same as passing in a float.
For example, we now compile:
struct DeclGroup { float NumDecls; };
float foo(DeclGroup D);
void bar(DeclGroup *D) {
foo(*D);
}
into:
%struct.DeclGroup = type { float }
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <float*> [#uses=1]
%0 = load float* %coerce.dive, align 1 ; <float> [#uses=1]
%call = call float @_Z3foo9DeclGroup(float %0) ; <float> [#uses=0]
ret void
}
instead of:
%struct.DeclGroup = type { float }
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp3 = alloca double ; <double*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <float*> [#uses=1]
%0 = bitcast double* %tmp3 to float* ; <float*> [#uses=1]
%1 = load float* %coerce.dive ; <float> [#uses=1]
store float %1, float* %0, align 1
%2 = load double* %tmp3 ; <double> [#uses=1]
%call = call float @_Z3foo9DeclGroup(double %2) ; <float> [#uses=0]
ret void
}
which is this machine code (at -O0):
__Z3barP9DeclGroup:
subq $24, %rsp
movq %rdi, 16(%rsp)
movq 16(%rsp), %rdi
leaq 8(%rsp), %rax
movl (%rdi), %ecx
movl %ecx, (%rax)
movss 8(%rsp), %xmm0
callq __Z3foo9DeclGroup
addq $24, %rsp
ret
vs this:
__Z3barP9DeclGroup:
subq $24, %rsp
movq %rdi, 16(%rsp)
movq 16(%rsp), %rdi
leaq 8(%rsp), %rax
movl (%rdi), %ecx
movl %ecx, (%rax)
movss 8(%rsp), %xmm0
movss %xmm0, (%rsp)
movsd (%rsp), %xmm0
callq __Z3foo9DeclGroup
addq $24, %rsp
ret
At -O3, it is the difference between this now:
__Z3barP9DeclGroup:
movss (%rdi), %xmm0
jmp __Z3foo9DeclGroup # TAILCALL
vs this before:
__Z3barP9DeclGroup:
movl (%rdi), %eax
movd %rax, %xmm0
jmp __Z3foo9DeclGroup # TAILCALL
llvm-svn: 107048
2010-06-28 19:56:59 +00:00
Fariborz Jahanian
c42461e145
Minor refactorin of my last patch (radar 7860965 related).
...
llvm-svn: 107047
2010-06-28 19:42:10 +00:00
Fariborz Jahanian
36ad0e99d5
Have __func__ and siblings point to block's implementation function
...
name. Fixes radar 7860965.
llvm-svn: 107044
2010-06-28 18:58:34 +00:00
Chris Lattner
c1028f689e
Fix UnitTests/2004-02-02-NegativeZero.c, which regressed when
...
I broke negate of FP values.
llvm-svn: 107019
2010-06-28 17:12:37 +00:00
Anders Carlsson
3f48c603fb
Correctly destroy reference temporaries with global storage. Remove ErrorUnsupported call when binding a global reference to a non-lvalue. Fixes PR7326.
...
llvm-svn: 106983
2010-06-27 17:52:15 +00:00
Anders Carlsson
18c205ecdf
Add a CreateReferenceTemporary that will do the right thing for variables with global storage.
...
llvm-svn: 106982
2010-06-27 17:23:46 +00:00
Anders Carlsson
2969c8c69d
Simplify CodeGenFunction::EmitReferenceBindingToExpr as a first step towards fixing PR7326.
...
llvm-svn: 106981
2010-06-27 16:56:04 +00:00
Anders Carlsson
ca68d357d4
Reduce indentation.
...
llvm-svn: 106980
2010-06-27 15:24:55 +00:00
Chris Lattner
818efb64a3
misc tidying
...
llvm-svn: 106978
2010-06-27 07:40:06 +00:00
Chris Lattner
5e016ae983
finally get around to doing a significant cleanup to irgen:
...
have CGF create and make accessible standard int32,int64 and
intptr types. This fixes a ton of 80 column violations
introduced by LLVMContextification and cleans up stuff a lot.
llvm-svn: 106977
2010-06-27 07:15:29 +00:00
Chris Lattner
e000907e13
tidy up OrderGlobalInits
...
llvm-svn: 106976
2010-06-27 06:32:58 +00:00
Chris Lattner
055097f024
If coercing something from int or pointer type to int or pointer type
...
(potentially after unwrapping it from a struct) do it without going through
memory. We now compile:
struct DeclGroup {
unsigned NumDecls;
};
int foo(DeclGroup D) {
return D.NumDecls;
}
into:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%coerce.val.ii = trunc i64 %0 to i32 ; <i32> [#uses=1]
store i32 %coerce.val.ii, i32* %coerce.dive
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp1 = load i32* %tmp ; <i32> [#uses=1]
ret i32 %tmp1
}
instead of:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp = alloca i64 ; <i64*> [#uses=2]
%coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
store i64 %0, i64* %tmp
%1 = bitcast i64* %tmp to i32* ; <i32*> [#uses=1]
%2 = load i32* %1, align 1 ; <i32> [#uses=1]
store i32 %2, i32* %coerce.dive
%tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp2 = load i32* %tmp1 ; <i32> [#uses=1]
ret i32 %tmp2
}
... which is quite a bit less terrifying.
llvm-svn: 106975
2010-06-27 06:26:04 +00:00
Chris Lattner
895c52ba8b
Same patch as the previous on the store side. Before we compiled this:
...
struct DeclGroup {
unsigned NumDecls;
};
int foo(DeclGroup D) {
return D.NumDecls;
}
to:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp = alloca i64 ; <i64*> [#uses=2]
store i64 %0, i64* %tmp
%1 = bitcast i64* %tmp to %struct.DeclGroup* ; <%struct.DeclGroup*> [#uses=1]
%2 = load %struct.DeclGroup* %1, align 1 ; <%struct.DeclGroup> [#uses=1]
store %struct.DeclGroup %2, %struct.DeclGroup* %D
%tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp2 = load i32* %tmp1 ; <i32> [#uses=1]
ret i32 %tmp2
}
which caused fast isel bailouts due to the FCA load/store of %2. Now
we generate this just blissful code:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp = alloca i64 ; <i64*> [#uses=2]
%coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
store i64 %0, i64* %tmp
%1 = bitcast i64* %tmp to i32* ; <i32*> [#uses=1]
%2 = load i32* %1, align 1 ; <i32> [#uses=1]
store i32 %2, i32* %coerce.dive
%tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp2 = load i32* %tmp1 ; <i32> [#uses=1]
ret i32 %tmp2
}
This avoids fastisel bailing out and is groundwork for future patch.
This reduces bailouts on CGStmt.ll to 911 from 935.
llvm-svn: 106974
2010-06-27 06:04:18 +00:00
Chris Lattner
1cd6698a7c
improve CreateCoercedLoad a bit to generate slightly less awful
...
IR when handling X86-64 by-value struct stuff. For example, we
use to compile this:
struct DeclGroup {
unsigned NumDecls;
};
int foo(DeclGroup D);
void bar(DeclGroup *D) {
foo(*D);
}
into:
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) ssp nounwind {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp3 = alloca i64 ; <i64*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%0 = bitcast i64* %tmp3 to %struct.DeclGroup* ; <%struct.DeclGroup*> [#uses=1]
%1 = load %struct.DeclGroup* %agg.tmp ; <%struct.DeclGroup> [#uses=1]
store %struct.DeclGroup %1, %struct.DeclGroup* %0, align 1
%2 = load i64* %tmp3 ; <i64> [#uses=1]
call void @_Z3foo9DeclGroup(i64 %2)
ret void
}
which would cause fastisel to bail out due to the first class aggregate load %1. With
this patch we now compile it into the (still awful):
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind ssp noredzone {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp3 = alloca i64 ; <i64*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <i32*> [#uses=1]
%0 = bitcast i64* %tmp3 to i32* ; <i32*> [#uses=1]
%1 = load i32* %coerce.dive ; <i32> [#uses=1]
store i32 %1, i32* %0, align 1
%2 = load i64* %tmp3 ; <i64> [#uses=1]
%call = call i32 @_Z3foo9DeclGroup(i64 %2) noredzone ; <i32> [#uses=0]
ret void
}
which doesn't bail out. On CGStmt.ll, this reduces fastisel bail outs from 958 to 935,
and is the precursor of better things to come.
llvm-svn: 106973
2010-06-27 05:56:15 +00:00
Chris Lattner
3fcc790cd8
Change IR generation for return (in the simple case) to avoid doing silly
...
load/store nonsense in the epilog. For example, for:
int foo(int X) {
int A[100];
return A[X];
}
we used to generate:
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
store i32 %tmp1, i32* %retval
%0 = load i32* %retval ; <i32> [#uses=1]
ret i32 %0
}
which codegen'd to this code:
_foo: ## @foo
## BB#0: ## %entry
subq $408, %rsp ## imm = 0x198
movl %edi, 400(%rsp)
movl 400(%rsp), %edi
movslq %edi, %rax
movl (%rsp,%rax,4), %edi
movl %edi, 404(%rsp)
movl 404(%rsp), %eax
addq $408, %rsp ## imm = 0x198
ret
Now we generate:
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
ret i32 %tmp1
}
and:
_foo: ## @foo
## BB#0: ## %entry
subq $408, %rsp ## imm = 0x198
movl %edi, 404(%rsp)
movl 404(%rsp), %edi
movslq %edi, %rax
movl (%rsp,%rax,4), %eax
addq $408, %rsp ## imm = 0x198
ret
This actually does matter, cutting out 2000 lines of IR from CGStmt.ll
for example.
Another interesting effect is that altivec.h functions which are dead
now get dce'd by the inliner. Hence all the changes to
builtins-ppc-altivec.c to ensure the calls aren't dead.
llvm-svn: 106970
2010-06-27 01:06:27 +00:00
Chris Lattner
726b3d09cd
reduce indentation
...
llvm-svn: 106967
2010-06-26 23:13:19 +00:00
Chris Lattner
6c5abe88bf
Implement rdar://7530813 - collapse multiple GEP instructions in IRgen
...
This avoids generating two gep's for common array operations. Before
we would generate something like:
%tmp = load i32* %X.addr ; <i32> [#uses=1]
%arraydecay = getelementptr inbounds [100 x i32]* %A, i32 0, i32 0 ; <i32*> [#uses=1]
%arrayidx = getelementptr inbounds i32* %arraydecay, i32 %tmp ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
Now we generate:
%tmp = load i32* %X.addr ; <i32> [#uses=1]
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i32 %tmp ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
Less IR is better at -O0.
llvm-svn: 106966
2010-06-26 23:03:20 +00:00
Chris Lattner
57ce97151f
minor cleanup: don't emit the base of an array subscript until after
...
we're done diddling around with the index stuff. Use a cheaper type
comparison.
llvm-svn: 106963
2010-06-26 22:40:46 +00:00
Chris Lattner
431bef4409
fix inc/dec to honor -fwrapv and -ftrapv, implementing PR7426.
...
llvm-svn: 106962
2010-06-26 22:18:28 +00:00
Chris Lattner
05dc78c096
move scalar inc/dec codegen into ScalarExprEmitter instead
...
of being in CGF. No functionality change.
llvm-svn: 106961
2010-06-26 22:09:34 +00:00
Chris Lattner
fa20e95043
use more efficient type comparison predicates.
...
llvm-svn: 106958
2010-06-26 21:52:32 +00:00
Chris Lattner
0bf27620f0
Fix unary minus to trap on overflow with -ftrapv, refactoring binop
...
code so we can use it from VisitUnaryMinus.
llvm-svn: 106957
2010-06-26 21:48:21 +00:00
Chris Lattner
51924e517b
Implement support for -fwrapv, rdar://7221421
...
As part of this, pull together trapv handling into the same enum.
This also add support for NSW multiplies.
This also makes PCH disagreement on overflow behavior silent, since it
really doesn't matter except for warnings and codegen (no macros get
defined etc).
llvm-svn: 106956
2010-06-26 21:25:03 +00:00
Chris Lattner
217e056e40
implement rdar://7432000 - signed negate should codegen as NSW.
...
While I'm in there, adjust pointer to member adjustments as well.
llvm-svn: 106955
2010-06-26 20:27:24 +00:00
Anders Carlsson
04775f8413
Change EmitReferenceBindingToExpr to take a decl instead of a boolean.
...
llvm-svn: 106949
2010-06-26 16:35:32 +00:00
Anders Carlsson
709ef8e46c
Add function for mangling reference temporaries.
...
llvm-svn: 106948
2010-06-26 16:09:40 +00:00
Charles Davis
f4db33cbdf
Mangle pointer and (lvalue) reference types in the Microsoft C++ Mangler.
...
Also, fix mangling of throw specs. Turns out MSVC totally ignores throw
specs when mangling names.
llvm-svn: 106937
2010-06-26 03:50:05 +00:00
Fariborz Jahanian
b66b08ef01
Minor change to my last patch to fix PR7490.
...
llvm-svn: 106875
2010-06-25 20:01:13 +00:00
Fariborz Jahanian
d5202e0926
IRGen for trivial initialization of dynamiccaly allocated
...
array of other done c++ objects. Fixes PR7490.
llvm-svn: 106869
2010-06-25 18:26:07 +00:00
Fariborz Jahanian
9b5528d278
Patch to correctly mangle block helper functions
...
when block literal is declared inside a ctor/dtor.
Fixes radr 8096995.
llvm-svn: 106700
2010-06-24 00:08:06 +00:00
Chris Lattner
37141f4fb4
improve altivec vector bool/pixel support, patch by Anton Yartsev
...
with several tweaks by me.
llvm-svn: 106619
2010-06-23 06:00:24 +00:00
Chris Lattner
b48a2d5d2f
polish the -finstrument-functions implementation, patch by Nelson Elhage!
...
llvm-svn: 106618
2010-06-23 05:21:28 +00:00
Douglas Gregor
49b4d73451
Type Type::isRealFloatingType() that vectors are not floating-point
...
types, updating callers of both isFloatingType() and
isRealFloatingType() accordingly. Caught at least one issue where we
allowed one to declare a vector of vectors (!), along with cleaning up
the standard-conversion logic for C++.
llvm-svn: 106595
2010-06-22 23:07:26 +00:00
Fariborz Jahanian
7966aff294
Fixes a problem in generation of meta-data for
...
category implementation whereby property list was missing.
NeXt ObjC runtime (radar 8093297).
llvm-svn: 106550
2010-06-22 16:33:55 +00:00
Anders Carlsson
ea836bc41c
Switch over to the new caching version of getMangledName.
...
llvm-svn: 106549
2010-06-22 16:16:50 +00:00
Anders Carlsson
2e2f4d2e6d
Add a new variant of getMangledName that caches the mangling for decls.
...
llvm-svn: 106547
2010-06-22 16:05:32 +00:00
Anders Carlsson
16d9f1788e
Add GlobalDecl::getCanonicalDecl.
...
llvm-svn: 106546
2010-06-22 16:00:14 +00:00
Fariborz Jahanian
469b200321
Per Chris's comment, remove another static (this one
...
is a static comparator operator).
llvm-svn: 106511
2010-06-22 00:23:08 +00:00
Chris Lattner
3c77a355e0
implement support for -finstrument-functions, patch by Nelson
...
Elhage!
llvm-svn: 106507
2010-06-22 00:03:40 +00:00
Fariborz Jahanian
c9fec975e6
Avoid using a local static for providing lexical
...
order of priorotized global object initializations.
llvm-svn: 106503
2010-06-21 23:31:29 +00:00
Fariborz Jahanian
9adb2e646c
In fragile-abi (32bit mode abi) generate global symbol
...
objc_category_name_xxx for each category implementation.
(fixes PR7431) patch by Nico Weber.
llvm-svn: 106492
2010-06-21 22:05:18 +00:00
Fariborz Jahanian
89bdd14f2f
In supporting init-priority, globals with the same init_priority must be
...
emitted in the order in which they are seen (still radar 8076356).
llvm-svn: 106485
2010-06-21 21:27:42 +00:00
Anders Carlsson
280e61f148
Fix an Obj-C++ miscompile when calling an Obj-C method that returns a C++ reference.
...
llvm-svn: 106477
2010-06-21 20:59:55 +00:00
Fariborz Jahanian
090e4e5773
Use more efficient API of SmallVector/array_pod_sort
...
for sorting (radar 8076356).
llvm-svn: 106453
2010-06-21 19:49:38 +00:00
Fariborz Jahanian
9f2a4eed0d
IRGen for implementation of init-priority attribute.
...
Test case will be checked in llvm test suite.
(finishes off radar 8076356).
llvm-svn: 106441
2010-06-21 18:45:05 +00:00
Douglas Gregor
5dd34744c5
Instantiations subject to an explicit template instantiation
...
declaration have default visibility even under
-fvisibility=hidden. Fixes <rdar://problem/8109763>.
llvm-svn: 106440
2010-06-21 18:41:26 +00:00
Nate Begeman
ed48c857dc
Implement remaining codegen for NEON, all operations should now work.
...
llvm-svn: 106407
2010-06-20 23:05:28 +00:00
Anton Korobeynikov
cc50b7d7d5
More AltiVec support.
...
Patch by Anton Yartsev!
llvm-svn: 106387
2010-06-19 09:47:18 +00:00
Eli Friedman
c96b2496fc
Fix for PR7415: refactor CodeGenModule::MayDeferGeneration and make it less
...
conservative for static variables in templated classes.
llvm-svn: 106385
2010-06-19 06:24:06 +00:00
Chris Lattner
87233f785b
Fix PR7097, a bad interaction between -fno-use-cxa-atexit and
...
-mconstructor-aliases by using a WeakVH instead of a raw pointer.
llvm-svn: 106384
2010-06-19 05:52:45 +00:00
Charles Davis
108f5a2748
Mangle tag types (unions, structs, classes, enums) in the Microsoft C++ Mangler.
...
Also, test that static members with default visibility in a struct have the
right mangling.
llvm-svn: 106276
2010-06-18 07:51:00 +00:00
Fariborz Jahanian
64cda8b5f3
objective-C++ IRGen: property reference as an
...
lvalue when performing a derived-to-base conversion.
Fixes radar 7501812. Added an executable test to
llvm-test suite.
llvm-svn: 106247
2010-06-17 23:00:29 +00:00
Fariborz Jahanian
9240f3dac7
Objective-c++ IRGen. Support for @selector expression as
...
an lvalue. Fixes PR7390.
llvm-svn: 106235
2010-06-17 19:56:20 +00:00
Charles Davis
8c02c13e19
Mangle operator names in the Microsoft C++ Mangler.
...
llvm-svn: 106211
2010-06-17 06:47:31 +00:00
Nate Begeman
dbafec1f3e
Remove last of the bool shifts for MS VC++, patch by dimitry andric
...
llvm-svn: 106206
2010-06-17 02:26:59 +00:00
Alexis Hunt
c675ec09f0
Update CMake build for new attribute changes.
...
llvm-svn: 106188
2010-06-17 00:37:02 +00:00
Rafael Espindola
23a8a06554
Change the test for which ABI/CC to use on ARM to be base on the environment
...
(the last argument of the triple).
llvm-svn: 106131
2010-06-16 19:01:17 +00:00
Fariborz Jahanian
4a30307840
Fixed conflict between objc_memmove_collectable builtin
...
decl. and one ddefined in darwin header file.
llvm-svn: 106107
2010-06-16 16:22:04 +00:00
Rafael Espindola
a92c442437
Don't set the calling convention for ARM if it is already the default.
...
llvm-svn: 106106
2010-06-16 16:13:39 +00:00
Charles Davis
89338af1ff
Start mangling function types in the Microsoft C++ Mangler.
...
llvm-svn: 106081
2010-06-16 05:33:16 +00:00
Douglas Gregor
6972a62c8f
Give Type::isIntegralType() an ASTContext parameter, so that it
...
provides C "integer type" semantics in C and C++ "integral type"
semantics in C++.
Note that I still need to update isIntegerType (and possibly other
predicates) using the same approach I've taken for
isIntegralType(). The two should have the same meaning, but currently
don't (!).
llvm-svn: 106074
2010-06-16 00:35:25 +00:00
Douglas Gregor
b90df60b3b
Introduce Type::isIntegralOrEnumerationType(), to cover those places
...
in C++ that involve both integral and enumeration types. Convert all
of the callers to Type::isIntegralType() that are meant to work with
both integral and enumeration types over to
Type::isIntegralOrEnumerationType(), to prepare to eliminate
enumeration types as integral types.
llvm-svn: 106071
2010-06-16 00:17:44 +00:00
Chandler Carruth
8509824cdb
Move CodeGenOptions.h *back* into Frontend. This should have been done when the
...
dependency edge was reversed such that CodeGen depends on Frontend.
llvm-svn: 106065
2010-06-15 23:19:56 +00:00
Fariborz Jahanian
021510e96f
Patch adds support for copying of those
...
objective-c++ class objects which have GC'able objc object
pointers and need to use ObjC's objc_memmove_collectable
API (radar 8070772).
llvm-svn: 106061
2010-06-15 22:44:06 +00:00
Daniel Dunbar
c1b1729b66
Break Frontend's dependency on Rewrite, Checker and CodeGen in shared library configuration
...
Currently, all AST consumers are located in the Frontend library,
meaning that in a shared library configuration, Frontend has a
dependency on Rewrite, Checker and CodeGen. This is suboptimal for
clients which only wish to make use of the frontend. CodeGen in
particular introduces a large number of unwanted dependencies.
This patch breaks the dependency by moving all AST consumers with
dependencies on Rewrite, Checker and/or CodeGen to their respective
libraries. The patch therefore introduces dependencies in the other
direction (i.e. from Rewrite, Checker and CodeGen to Frontend).
After applying this patch, Clang builds correctly using CMake and
shared libraries ("cmake -DBUILD_SHARED_LIBS=ON").
N.B. This patch includes file renames which are indicated in the
patch body.
Changes in this revision of the patch:
- Fixed some copy-paste mistakes in the header files
- Modified certain aspects of the coding to comply with the LLVM
Coding Standards
llvm-svn: 106010
2010-06-15 17:48:49 +00:00
Douglas Gregor
0832963acd
Implement -fvisibility-inlines-hidden. <rdar://problem/7819834>
...
llvm-svn: 106003
2010-06-15 17:05:35 +00:00
Douglas Gregor
4f6e8deec4
Make sure to set the visible on a vtable; VTTs and typeinfo already
...
handle visibility properly. Fixes <rdar://problem/8091955>.
llvm-svn: 105977
2010-06-14 23:41:45 +00:00
Douglas Gregor
1726d1517e
Add name mangling for address spaces. We use the vendor-extension
...
mangling for types, where the <source-name> is ASxxx (xxx is the
address-space number).
llvm-svn: 105975
2010-06-14 23:15:08 +00:00
Benjamin Kramer
7039fcbc5d
An implementation of __builtin__fpclassify the way Chris Lattner described by Jörg Blank.
...
llvm-svn: 105936
2010-06-14 10:30:41 +00:00
Charles Davis
2d7b10cc97
Microsoft C++ Mangler:
...
- Mangle qualifiers.
- Start mangling variables' types into the name. A variable declared with a
builtin type should now mangle properly.
llvm-svn: 105931
2010-06-14 05:29:01 +00:00
Nate Begeman
91e1feab7a
Add some missing shifts
...
Fix multiplies by scalar
Add SemaChecking code for all immediates
Add SemaChecking-gen support to arm_neon.td
llvm-svn: 105930
2010-06-14 05:21:25 +00:00
Nate Begeman
d773fe67dd
Most of NEON sema checking & fix to polynomial type detection
...
llvm-svn: 105908
2010-06-13 04:47:52 +00:00
Charles Davis
7dacc95299
Microsoft C++ Mangler:
...
- Don't mangle static variables at global scope.
- Add support for mangling builtin types. This will be used later.
llvm-svn: 105881
2010-06-12 08:11:16 +00:00
Nate Begeman
c6ac0ce89f
Shifts complete. Only vld & sema checking of constants remain.
...
llvm-svn: 105879
2010-06-12 06:06:07 +00:00
Nate Begeman
dd715805ab
vbsl, vrev* is implemented via arm_neon.h
...
llvm-svn: 105875
2010-06-12 03:11:41 +00:00
Nate Begeman
8ed060b95a
Most of remaining builtins, 2 generics, vld, and rounding shfits remain.
...
llvm-svn: 105848
2010-06-11 22:57:12 +00:00
Charles Davis
b6a5a0d9e1
When mangling for the Microsoft C++ ABI, mangle variables in the global
...
namespace, too.
llvm-svn: 105809
2010-06-11 04:25:47 +00:00
Charles Davis
9af2d4a614
Start implementing the Microsoft-style name mangler. Mangle simple names
...
(but not their types; that's later).
NOTE: Right now, variables in the global namespace don't get mangled, even
though they're supposed to be. This is because the default mangler
implements the shouldMangleDeclName() method that tells clang not to mangle
them. This will be fixed in a later patch.
llvm-svn: 105805
2010-06-11 03:07:32 +00:00
Charles Davis
95a546ee4d
Add an option to specify the target C++ ABI to the frontend. Use it to
...
select either the default Itanium ABI or the new, experimental Microsoft ABI.
llvm-svn: 105804
2010-06-11 01:06:47 +00:00
John McCall
c392f37ae8
Split DependentNameType into two types. DependentNameType represents the
...
case of an elaborated-type-specifier like 'typename A<T>::foo', and
DependentTemplateSpecializationType represents the case of an
elaborated-type-specifier like 'typename A<T>::template B<T>'. The TypeLoc
representation of a DependentTST conveniently exactly matches that of an
ElaboratedType wrapping a TST.
Kill off the explicit rebuild methods for RebuildInCurrentInstantiation;
the standard implementations work fine because the nested name specifier
is computable in the newly-entered context.
llvm-svn: 105801
2010-06-11 00:33:02 +00:00
Nate Begeman
e0935ffa50
Multiplies, some shifts, set_lane
...
llvm-svn: 105793
2010-06-10 18:11:55 +00:00
Nate Begeman
4a04b467d9
support _lane ops, and multiplies by scalar.
...
llvm-svn: 105770
2010-06-10 00:17:56 +00:00
Charles Davis
74ce85980b
Add a stub Microsoft Visual C++ ABI class (with stub mangler).
...
llvm-svn: 105767
2010-06-09 23:25:41 +00:00
Nate Begeman
d90aa43bdf
Implement codegen for hadd, hsub, max, min, mlal, movl, movn, padal, mov_n
...
Make note about how to handle the dozen or so multiply by scalar ops.
llvm-svn: 105734
2010-06-09 18:04:15 +00:00
John McCall
a5dd326ca5
Correctly handle > 257 substitutions in a single mangling, and don't introduce
...
a spurious substitution for an unscoped dependent template-id after introducing
a substitution for the scoped template-id.
llvm-svn: 105699
2010-06-09 07:26:17 +00:00
Nate Begeman
4307a25545
More accurate BuiltinsARM.def
...
vget_lane support
llvm-svn: 105684
2010-06-09 05:30:26 +00:00
Rafael Espindola
6bb986d530
Simplify the code a bit and avoid a gcc waring about uninitialized variables.
...
llvm-svn: 105676
2010-06-09 03:48:40 +00:00
Anders Carlsson
635186a8c4
Get rid of getMangledCXXCtorName and getMangledCXXDtorName.
...
llvm-svn: 105673
2010-06-09 02:36:32 +00:00
Anders Carlsson
09b5fe68ab
More mangling cleanup.
...
llvm-svn: 105672
2010-06-09 02:30:12 +00:00
Anders Carlsson
d4ce4e4bc0
Get rid of an unnecessary getMangledName overload.
...
llvm-svn: 105671
2010-06-09 02:20:01 +00:00
Rafael Espindola
9cdbd9dc08
Fix a gcc warning.
...
llvm-svn: 105670
2010-06-09 02:17:08 +00:00
Nate Begeman
5548309fa7
Implement transpose/zip/unzip & table lookup.
...
Test out some basic constant-checking.
llvm-svn: 105667
2010-06-09 01:10:23 +00:00
Anders Carlsson
851318a93a
On Darwin, initialization and destruction functions should go into the __StaticInit section.
...
llvm-svn: 105650
2010-06-08 22:47:50 +00:00
Anders Carlsson
b2839e4aa1
Add a global CreateGlobalInitOrDestructFunction and use it for creating global init or destruction functions.
...
llvm-svn: 105649
2010-06-08 22:40:05 +00:00
Anders Carlsson
9eb101c5d3
Rename __tcf_ to __cxx_global_array_dtor. Remove the UniqueAggreDestructorCount from CodeGenFunction and let LLVM handle uniquing the internal functions instead.
...
llvm-svn: 105648
2010-06-08 22:30:17 +00:00
Anders Carlsson
282bc10eaa
Move GenerateCXXAggrDestructorHelper to CGDeclCXX.cpp where it belongs.
...
llvm-svn: 105647
2010-06-08 22:17:27 +00:00
Anders Carlsson
165ec0a04f
Simplify GenerateCXXAggrDestructorHelper.
...
llvm-svn: 105646
2010-06-08 22:14:59 +00:00
Fariborz Jahanian
3b83618054
Block Code Gen. API. Call destructor on descriptior
...
entry previously constructed via copy constructor.
llvm-svn: 105641
2010-06-08 20:57:22 +00:00
Daniel Dunbar
ee6b692551
Makefiles: Set Clang CPP compiler flags in a single location, instead of scattered throughout the project Makefiles.
...
llvm-svn: 105638
2010-06-08 20:44:43 +00:00
Daniel Dunbar
e6c1daa8fd
Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
...
- This eliminates most dependencies on how Clang is installed relative to LLVM.
llvm-svn: 105637
2010-06-08 20:34:18 +00:00
Anders Carlsson
248704c517
Correctly mangle static variables of anonymous struct/union type.
...
llvm-svn: 105606
2010-06-08 14:49:03 +00:00
Nate Begeman
ae6b1d8010
Fix NEON intrinsic argument passing, support vext. Most now successfully make it through codegen to the .s file
...
llvm-svn: 105599
2010-06-08 06:03:01 +00:00
Rafael Espindola
895e51de4a
Fix what looks like a merge problem that broke __clear_cache.
...
llvm-svn: 105595
2010-06-08 03:52:53 +00:00
Rafael Espindola
bbd44ef673
Fix passing and returning of objects with non trivial copy constructors on
...
ARM.
Fixes PR7310.
llvm-svn: 105592
2010-06-08 02:42:08 +00:00
Nate Begeman
16372afeab
Implement ARM NEON up through vcvt, alphabetically.
...
llvm-svn: 105590
2010-06-08 00:17:19 +00:00
Nate Begeman
a011002195
Extend __builtin_shufflevector to expose the full power of the llvm shufflevector instruction. This means it can now be used for vector truncation and concatenation. This will be used for the ARM NEON implementation.
...
llvm-svn: 105589
2010-06-08 00:16:34 +00:00
Fariborz Jahanian
be21aa34a0
When using property-dot assignment syntax to call a setter method,
...
type of rhs need be compared to setter's argument and
not the getter type. Fixes radar 8062778
llvm-svn: 105560
2010-06-07 22:02:01 +00:00
Fariborz Jahanian
a2d7c34e93
Fixed a block regression caused by trying to use
...
an existing ir for load of a bock variable. This cannot be
done across basic blocks.
Fixes radar 8064140.
llvm-svn: 105549
2010-06-07 19:39:39 +00:00
Rafael Espindola
a54062ef0c
Implement __clear_cache on ARM.
...
llvm-svn: 105537
2010-06-07 17:26:50 +00:00
Nate Begeman
5968eb270a
weekend checkpoint of arm neon builtins codegen.
...
TODO: add remainder of builtins to CGBuiltin, add code to SemaChecking to validate constants.
llvm-svn: 105532
2010-06-07 16:01:56 +00:00
Abramo Bagnara
d73405829b
Added AccessSpecDecl node.
...
llvm-svn: 105525
2010-06-05 05:09:32 +00:00
Devang Patel
6ccba0fb6e
Preserve type info for local variables in optimized builds.
...
llvm-gcc enabled this couple of weeks ago.
llvm-svn: 105516
2010-06-05 01:14:40 +00:00
Fariborz Jahanian
ea882cd92e
Build AST for copy-construction of copied-in
...
class object in blocks and carry it to IRGen.
llvm-svn: 105487
2010-06-04 21:35:44 +00:00
Fariborz Jahanian
64176c2c97
For C++ copied in objects, use copy constructors in
...
setting up block's descriptor. This is on going work to
support c++ specific issues in setting up blocks
various APIs.
llvm-svn: 105469
2010-06-04 16:10:00 +00:00
Anders Carlsson
fd788405ac
Remove now unused code.
...
llvm-svn: 105448
2010-06-04 00:59:37 +00:00
Anders Carlsson
27860db29e
Use CXXRecordDecl::getFinalOverriders to get final overriders. This speeds up vtable layout by moving away from the old final overrider computation code that had O(N^2) complexity in some cases.
...
llvm-svn: 105447
2010-06-04 00:54:04 +00:00
Eli Friedman
cce5b81ce1
Don't intentionally try to ignore the value of a scalar expression when we
...
actually care about it. Fixes PR7291.
llvm-svn: 105404
2010-06-03 19:58:07 +00:00
Anders Carlsson
bcb2e4cb63
Don't try to explicitly zero out bit-fields.
...
llvm-svn: 105391
2010-06-03 15:36:07 +00:00
Fariborz Jahanian
d1b378e08d
Block C++ code gen. Adds support for block reference argument
...
types. Executable test will be added to LLVM test suite.
(radar 8041962).
llvm-svn: 105347
2010-06-02 21:35:17 +00:00
John McCall
6a7f9f5c8f
Don't try to emit the vtable for a class just because we're emitting a
...
virtual function from it.
Fixes PR7241.
llvm-svn: 105345
2010-06-02 21:22:02 +00:00
Anders Carlsson
b4d2cdbb46
Don't substitute 'St' for 'std' when the namespace is nested inside another namespace.
...
llvm-svn: 105330
2010-06-02 15:58:27 +00:00
Anders Carlsson
a85c1469c7
When building RTTI descriptors for pointer types, we need to get the unqualified array type and the qualifiers from it.
...
llvm-svn: 105326
2010-06-02 15:44:35 +00:00
Anders Carlsson
d951a7ebf8
Correctly mangle unsigned integer literals where the high bit is set.
...
llvm-svn: 105312
2010-06-02 05:07:26 +00:00
Anders Carlsson
728fe444f1
Correctly mangle variadic functions that don't have any other parameters.
...
llvm-svn: 105311
2010-06-02 04:40:13 +00:00
Anders Carlsson
d563923cf1
When mangling member function pointers, fake adding a substitution corresponding to the function type.
...
llvm-svn: 105310
2010-06-02 04:29:50 +00:00
Anders Carlsson
04e51cca94
More cleanup.
...
llvm-svn: 105301
2010-06-01 23:52:26 +00:00
Anders Carlsson
042ce2d8f1
More cleanup.
...
llvm-svn: 105299
2010-06-01 23:47:05 +00:00
Anders Carlsson
79547c3fbd
Cleanup.
...
llvm-svn: 105296
2010-06-01 23:17:37 +00:00
Charles Davis
7de6638173
Make methods non-virtual again for now. I accidentally committed this in
...
preparation for an alternate mangler.
llvm-svn: 105224
2010-05-31 17:07:59 +00:00
Chandler Carruth
9e814c0d80
Silence GCC warning about an accessible non-virtual destructor in a class with
...
virtual methods.
Please review cdavis, should these methods even be virtual?
llvm-svn: 105218
2010-05-31 08:27:42 +00:00
Anders Carlsson
107b4e096c
Remove unused parameter to FinalOverriders::PropagateOverrider.
...
llvm-svn: 105171
2010-05-30 18:23:41 +00:00
Alexis Hunt
ed05325dbe
Convert DeclNodes to use TableGen.
...
The macros required for DeclNodes use have changed to match the use of
StmtNodes. The FooFirst enumerator constants have been named firstFoo
to match usage elsewhere.
llvm-svn: 105165
2010-05-30 07:21:58 +00:00
Eli Friedman
c8731be34d
Fix for PR7040: Don't try to compute the LLVM type for a function where it
...
isn't possible to compute.
This patch is mostly refactoring; the key change is the addition of the code
starting with the comment, "Check whether the function has a computable LLVM
signature." The solution here is essentially the same as the way the
vtable code handles such functions.
llvm-svn: 105151
2010-05-30 06:03:20 +00:00
Daniel Dunbar
51c3387b5e
Fix personality function name when using SjLj exceptions.
...
llvm-svn: 104999
2010-05-28 19:43:36 +00:00
Fariborz Jahanian
3336de141a
zero-cost exception API for NeXt runtime.
...
rethrow inside @catch block must use objc_exception_rethrow
API. Fixes radar 8037512. Test will be added to LLVM
test suite.
llvm-svn: 104964
2010-05-28 17:34:43 +00:00
Dan Gohman
ed0347333e
This cast is no longer needed; the FIXME is fixed.
...
llvm-svn: 104919
2010-05-28 01:45:35 +00:00
Dan Gohman
3743b8cf49
This cast is no longer required.
...
llvm-svn: 104916
2010-05-28 01:39:35 +00:00
Jim Grosbach
4cf59b9e91
Update __builtin_setjmp codegen to match llvmCore changes in r104900.
...
llvm-svn: 104902
2010-05-27 23:54:20 +00:00
Anders Carlsson
da265b8d63
When null-initializing bases with data member pointers, don't assert on virtual bases. Just initialize them to null.
...
llvm-svn: 104868
2010-05-27 18:51:01 +00:00
John McCall
02269a66b3
Enable the implementation of __builtin_setjmp and __builtin_longjmp. Not all
...
LLVM backends support these yet.
llvm-svn: 104867
2010-05-27 18:47:06 +00:00
John McCall
943fae95f5
Implement __builtin_init_dwarf_reg_size_table and __builtin_dwarf_sp_column
...
for 32-bit MIPS processors. Hat-tip to rdivacky for providing gcc dumps
on this.
llvm-svn: 104816
2010-05-27 06:19:26 +00:00
John McCall
c2af939ab4
When deciding whether a deferred declaration has already been emitted,
...
aliases count as definitions regardless of whether their target has been
emitted yet. Fixes PR 7142.
llvm-svn: 104796
2010-05-27 01:45:30 +00:00
Daniel Dunbar
401304462a
AST: Rename PragmaPackAttr to MaxFieldAlignmentAttr, which is more accurate.
...
llvm-svn: 104795
2010-05-27 01:12:46 +00:00
John McCall
23f6626262
Correctly pass aggregates by reference when emitting thunks.
...
llvm-svn: 104778
2010-05-26 22:34:26 +00:00
Fariborz Jahanian
5f81b9f3f6
Patch to fix a irgen crash accessing an initialized local static
...
variable in a local function. Fixes pr7101.
llvm-svn: 104743
2010-05-26 21:45:50 +00:00
Charles Davis
c9e78145b0
Extract the ObjC and blocks manglers into their own class. No functionality
...
change.
llvm-svn: 104715
2010-05-26 18:25:27 +00:00
Douglas Gregor
0094eb26fc
Be sure to use the standard substitutions when mangling the names of
...
vtables, VTTs, and construction vtables. Fixes PR7201.
llvm-svn: 104675
2010-05-26 05:11:13 +00:00
Charles Davis
4e786ddccb
IRgen: Add a stub class for generating ABI-specific C++ code.
...
This class only supports name mangling (which is apparently used during C/ObjC
codegen). For now only the Itanium C++ ABI is supported. Patches to add a
second C++ ABI are forthcoming.
llvm-svn: 104630
2010-05-25 19:52:27 +00:00
Douglas Gregor
02df9da2ac
Fix compilation failure
...
llvm-svn: 104613
2010-05-25 17:12:30 +00:00
Douglas Gregor
7e10f3699a
Improve name mangling for blocks and support mangling of static local
...
variables within blocks. We loosely follow GCC's mangling, but since
these are always internal symbols the names don't really matter. I
intend to revisit block mangling later, because GCC's mangling is
rather verbose. <rdar://problem/8015719>.
llvm-svn: 104610
2010-05-25 17:04:15 +00:00
John McCall
7cb0220e53
If a function definition has any sort of weak linkage, its static local
...
variables should have that linkage. Otherwise, its static local
variables should have internal linkage. To avoid computing this excessively,
set a function's linkage before we emit code for it.
Previously we were assigning weak linkage to the static variables of
static inline functions in C++, with predictably terrible results. This
fixes that and also gives better linkage than 'weak' when merging is required.
llvm-svn: 104581
2010-05-25 04:30:21 +00:00
Benjamin Kramer
dc99965343
Add a comment for r104472.
...
llvm-svn: 104473
2010-05-23 20:57:46 +00:00
Benjamin Kramer
11d4d9ec4e
PR5863: Don't erase unreachable BBs which have an associated cleanup size.
...
This works around a crash where malloc reused the memory of an erased BB for a
new BB leaving old cleanup information pointing at the new block.
llvm-svn: 104472
2010-05-23 20:00:44 +00:00
John McCall
cc04e9f6b9
Re-teach IR gen to perform GC moves on rvalues resulting from various ObjC
...
expressions. Essentially, GC breaks a certain form of the return-value
optimization.
llvm-svn: 104454
2010-05-22 22:13:32 +00:00
Anders Carlsson
5b94443b16
Really fix PR7139. There was one boost test that we still failed, and my first fix broke self-host.
...
llvm-svn: 104447
2010-05-22 17:45:10 +00:00
Anders Carlsson
c0964b60e5
Re-land the fix for PR7139.
...
llvm-svn: 104446
2010-05-22 17:35:42 +00:00
Douglas Gregor
aae38d6610
Improve our handling of reference binding for subobjects of
...
temporaries. There are actually several interrelated fixes here:
- When converting an object to a base class, it's only an lvalue
cast when the original object was an lvalue and we aren't casting
pointer-to-derived to pointer-to-base. Previously, we were
misclassifying derived-to-base casts of class rvalues as lvalues,
causing various oddities (including problems with reference binding
not extending the lifetimes of some temporaries).
- Teach the code for emitting a reference binding how to look
through no-op casts and parentheses directly, since
Expr::IgnoreParenNoOpCasts is just plain wrong for this. Also, make
sure that we properly look through multiple levels of indirection
from the temporary object, but destroy the actual temporary object;
this fixes the reference-binding issue mentioned above.
- Teach Objective-C message sends to bind the result as a temporary
when needed. This is actually John's change, but it triggered the
reference-binding problem above, so it's included here. Now John
can actually test his return-slot improvements.
llvm-svn: 104434
2010-05-22 05:17:18 +00:00
John McCall
78a151138a
Push a return-value slot throughout ObjC message-send codegen. Will be
...
critical for ObjC++ correctness; hard to test independently of various
required Sema changes, though.
llvm-svn: 104422
2010-05-22 01:48:05 +00:00
Anders Carlsson
c866eb5ba9
Unbreak self-host.
...
llvm-svn: 104390
2010-05-21 22:17:48 +00:00
Anders Carlsson
da1641cd12
Rename CodeGenFunction::EmitMemSetToZero to EmitNullInitialization. Handle setting null data member pointers correctly. Fixes PR7139.
...
llvm-svn: 104387
2010-05-21 21:45:41 +00:00
Douglas Gregor
3fe900e410
Don't remove the break/continue scope of a for loop until after we've
...
emitted the increment expression. Fixes PR7189.
If someone knows how to write a useful test for this, I'd be grateful.
llvm-svn: 104335
2010-05-21 18:36:48 +00:00
Douglas Gregor
c5871f07f0
When generating the call arguments in a thunk to call the thunkee, do
...
not make copies non-POD arguments or arguments passed by reference:
just copy the pointers directly. This eliminates another source of the
dreaded memcpy-of-non-PODs. Fixes PR7188.
llvm-svn: 104327
2010-05-21 17:55:12 +00:00
Chandler Carruth
7ea01c3f8a
Add braces to avoid an ambiguous else, fixing a GCC warning.
...
llvm-svn: 104314
2010-05-21 10:29:28 +00:00
John McCall
9d42f0f174
Allocate space in a block record for implicit references to the Objective C
...
'self' variable arising from uses of the 'super' keyword. Also reorganize
some code so that BlockInfo (now CGBlockInfo) can be opaque outside of
CGBlocks.cpp.
Fixes rdar://problem/8010633.
llvm-svn: 104312
2010-05-21 04:11:14 +00:00
John McCall
c4094935c0
When emitting an lvalue for an anonymous struct or union member during
...
class initialization, drill down through an arbitrary number of anonymous
records.
llvm-svn: 104310
2010-05-21 01:18:57 +00:00
Fariborz Jahanian
60d215b6fd
Adds support for generation of objc_memmove_collectable API
...
in Objective-C++ mode.
llvm-svn: 104281
2010-05-20 21:38:57 +00:00
Fariborz Jahanian
6855ba2c95
Copy construction of non-trivial properties must not
...
be turned into a setter call (fixes radar 8008649).
llvm-svn: 104235
2010-05-20 16:46:55 +00:00
Douglas Gregor
265b8b8de0
Picky, picky
...
llvm-svn: 104230
2010-05-20 15:48:29 +00:00
Douglas Gregor
c19108118d
Fix a thinko
...
llvm-svn: 104229
2010-05-20 15:47:46 +00:00
Douglas Gregor
f22101a059
Assert that we do not try to memcpy a non-POD class type in C++. This
...
particular issue was the cause of the Boost.Interprocess failures, and
in general will lead to horrendous, hard-to-diagnose miscompiles. The
assertion itself has survives self-host and a full Boost build, so we
are close to eradicating this problem in C++.
Note that the assertion is *not* turned on for Objective-C++, where we
still have problems with introducing memcpy's of non-POD class
types. That part of the assertion will go away as soon as we fix the
known issues in Objective-C++.
llvm-svn: 104227
2010-05-20 15:39:01 +00:00
David Chisnall
29cefd1cc3
Fix my inability to spell 'continue' and a case where message sends returning non-pointer-sized things were generating invalid IR inside @try blocks.
...
llvm-svn: 104222
2010-05-20 13:45:48 +00:00
Douglas Gregor
7c38f153ac
Rework our handling of binding a reference to a temporary
...
subobject. Previously, we could only properly bind to a base class
subobject while extending the lifetime of the complete object (of a
derived type); for non-static data member subobjects, we could memcpy
(!) the result and bind to that, which is rather broken.
Now, we pull apart the expression that we're binding to, to figure out
which subobject we're accessing, then construct the temporary object
(adding a destruction if needed) and, finally, dig out the subobject
we actually meant to access.
This fixes yet another instance where we were memcpy'ing rather than
doing the right thing. However, note the FIXME in references.cpp:
there's more work to be done for binding to subobjects, since the AST
is incorrectly modeling some member accesses in base classes as
lvalues when they are really rvalues.
llvm-svn: 104219
2010-05-20 08:36:28 +00:00
Douglas Gregor
aa2ac80eaa
When creating a this-adjustment thunk where the return value is of C++
...
class type (that uses a return slot), pass the return slot to the
callee directly rather than allocating new storage and trying to copy
the object. This appears to have been the cause of the remaining two
Boost.Interprocess failures.
llvm-svn: 104215
2010-05-20 05:54:35 +00:00
John McCall
87fe5d5618
Support implicitly closing on 'this' in a block. Fixed PR7165.
...
(the codegen works here, too, but that's annoying to test without execution)
llvm-svn: 104202
2010-05-20 01:18:31 +00:00
Benjamin Kramer
fdb61d78e9
Implement codegen for __builtin_isnormal.
...
llvm-svn: 104118
2010-05-19 11:24:26 +00:00
Douglas Gregor
a941dcae16
Add support for Microsoft's __thiscall, from Steven Watanabe!
...
llvm-svn: 104026
2010-05-18 16:57:00 +00:00
Anders Carlsson
be48c548c5
Correctly initialize bases with member pointers. This should fix PR6441 but that test case is a bit weird and I'd like to investigate further before closing that bug.
...
llvm-svn: 104025
2010-05-18 16:51:41 +00:00
Anders Carlsson
061ca524b7
Keep track of the LLVM field numbers for non-virtual bases.
...
llvm-svn: 104013
2010-05-18 05:22:06 +00:00
Anders Carlsson
af9e5afe54
Start laying out bases as individual fields. We still use ugly i8 arrays but this is a step in the right direction.
...
llvm-svn: 104012
2010-05-18 05:12:20 +00:00
Anders Carlsson
864d1b555e
Add CodeGenTypes::ContainsPointerToDataMember overload that takes a CXXRecordDecl.
...
llvm-svn: 104011
2010-05-18 03:47:15 +00:00
John McCall
96fa4845f7
Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointed
...
out. The remaining ones are okay.
llvm-svn: 103973
2010-05-17 21:00:27 +00:00
Chandler Carruth
0450cc684c
Fix an ambiguous else warning from GCC by adding some much needed curlies.
...
llvm-svn: 103972
2010-05-17 20:58:49 +00:00
John McCall
3e294929b8
Correctly generate IR for ObjC messages sends to protocol-qualified types.
...
Fixes rdar://problem/7992749
llvm-svn: 103965
2010-05-17 20:12:43 +00:00
Daniel Dunbar
f7a8825484
IRgen: Remove dead function.
...
llvm-svn: 103945
2010-05-17 16:46:02 +00:00
Daniel Dunbar
cd20ce1513
C++/Darwin/i386 ABI: Fix some problems with empty record handling.
...
- Check bases as part of isEmptyRecord().
- C++ record fields are never empty in the Itanium ABI.
llvm-svn: 103944
2010-05-17 16:46:00 +00:00
Douglas Gregor
9154b5dffe
Ensure that destructors are called for NRVO'd objects when the
...
function does not return. Thanks to Eli for pointing out this corner
case.
llvm-svn: 103941
2010-05-17 15:52:46 +00:00
David Chisnall
f9c4225af6
Pick the correct personality function based on the language. This prevents link failures when C/ObjC code uses __attribute__((cleanup())) (previously this was inserting references to two libstc++ symbols; the personality function and the __terminate() function).
...
This is still probably wrong for Objective-C++ and adds a couple of lines in CGException that should probably be in the CGObjCRuntime subclass. The personality function is now only looked up in one place in CGException though, so this should be easier to fix in the future.
llvm-svn: 103938
2010-05-17 13:49:20 +00:00
Douglas Gregor
51150ab1f1
When initializing thread-safe statics, put the call to
...
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures, along with the regressions that r103880
caused.
The crucial difference between this and r103880 is that we now follow
LLVM's little dance with the llvm.eh.exception and llvm.eh.selector
calls, then use _Unwind_Resume_or_Rethrow to rethrow.
llvm-svn: 103892
2010-05-16 01:24:12 +00:00
Douglas Gregor
c278d1b3b9
Revert r103880 (thread-safe static initialization w/ exceptions),
...
because it's causing strange linker errors. Unfixes PR7144.
llvm-svn: 103890
2010-05-16 00:44:00 +00:00
Fariborz Jahanian
1b8b8bf25f
Minor twik to my last patch. (for radar 7986354).
...
llvm-svn: 103889
2010-05-16 00:10:46 +00:00
Fariborz Jahanian
e1b45a5e6b
Fix API gen for objc_msgSend property of aggregate types
...
in Objective-c++ mode. Fixes radar 7986354.
llvm-svn: 103887
2010-05-15 23:05:52 +00:00
Douglas Gregor
58142dd8a1
When initializing thread-safe statics, put the call to
...
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures.
llvm-svn: 103880
2010-05-15 17:55:51 +00:00
John McCall
b0efad148c
Modify this comment per Doug's suggestion: we don't need to mangle protocols.
...
llvm-svn: 103875
2010-05-15 17:06:29 +00:00
Douglas Gregor
170125648c
When applying the named return value optimization, we still need to
...
destroy the variable along the exceptional edge; it's only during
normal execution that we avoid destroying this variable.
llvm-svn: 103872
2010-05-15 16:39:56 +00:00
John McCall
8b07ec253d
Substantially alter the design of the Objective C type AST by introducing
...
ObjCObjectType, which is basically just a pair of
one of {primitive-id, primitive-Class, user-defined @class}
with
a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared). ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.
Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet. Remove some number of methods that are no
longer used, at least after this patch.
By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.
llvm-svn: 103870
2010-05-15 11:32:37 +00:00
Douglas Gregor
290c93ec0d
Implement a simple form of the C++ named return value optimization for
...
return statements. We perform NRVO only when all of the return
statements in the function return the same variable. Fixes some link
failures in Boost.Interprocess (which is relying on NRVO), and
probably improves performance for some C++ applications.
llvm-svn: 103867
2010-05-15 06:46:45 +00:00
Douglas Gregor
6fd1b1802f
Implement semantic analysis and an AST representation for the named
...
return value optimization. Sema marks return statements with their
NRVO candidates (which may or may not end up using the NRVO), then, at
the end of a function body, computes and marks those variables that
can be allocated into the return slot.
I've checked this locally with some debugging statements (not
committed), but there won't be any tests until CodeGen comes along.
llvm-svn: 103865
2010-05-15 06:01:05 +00:00
Douglas Gregor
222cf0efbc
Recognize when the named return value optimization applies in a
...
"return" statement and mark the corresponding CXXConstructExpr as
elidable. Teach CodeGen that eliding a temporary is different from
eliding an object construction.
This is just a baby step toward NRVO.
llvm-svn: 103849
2010-05-15 00:13:29 +00:00
Daniel Dunbar
36d4d1541c
C++/ABI/x86_64: Member pointers should be classified as INTEGER.
...
llvm-svn: 103843
2010-05-15 00:00:37 +00:00
Daniel Dunbar
4bd95c65e7
C++/ABI/i386: Member function pointers should be passed by value.
...
llvm-svn: 103842
2010-05-15 00:00:30 +00:00
Douglas Gregor
1c073f47da
Emit an lvalue dynamic_cast even if the result is not used. Another
...
part (or possibly all) of PR7132.
llvm-svn: 103810
2010-05-14 21:31:02 +00:00
Douglas Gregor
fa8b4955bb
When a failed dynamic_cast<T&> (which is an lvalue) results in a
...
throw, it should use invoke when needed. The fixes the
Boost.Statechrt failures that motivated PR7132, but there are a few
side issues to tackle as well.
llvm-svn: 103803
2010-05-14 21:14:41 +00:00
Anders Carlsson
a1bc38d53e
Remove an unused function.
...
llvm-svn: 103793
2010-05-14 19:48:27 +00:00
Anders Carlsson
1cf9274a5a
Move ContainsPointerToDataMember to CodeGenTypes. No functionality change.
...
llvm-svn: 103792
2010-05-14 19:41:56 +00:00
Devang Patel
ec2a9abd4a
Fix thinko in yesterday's fix.
...
Providing linkage name for function static variable confuses gdb, so don't do that.
llvm-svn: 103779
2010-05-14 16:55:25 +00:00
Anders Carlsson
65c6d541dd
Make sure that value-initialized pointers to data members are initialized correctly.
...
llvm-svn: 103771
2010-05-14 15:05:19 +00:00
Daniel Dunbar
6b45b67b26
C++/Darwin/x86: Teach IRgen it can pass reference types in registers.
...
llvm-svn: 103761
2010-05-14 03:40:53 +00:00
Devang Patel
98f217118f
Fix context in class static variable's debugging information entry.
...
This fixes bunch of failures in gdb testsuite.
llvm-svn: 103745
2010-05-13 23:52:37 +00:00
Douglas Gregor
500d9f8221
Disable the available_externally optimization for inline virtual
...
methods for which the key function is guaranteed to be in another
translation unit. Unfortunately, this guarantee isn't the case when
dealing with shared libraries that fail to export these virtual method
definitions.
I'm reopening PR6747 so we can consider this again at a later point in
time.
llvm-svn: 103741
2010-05-13 21:36:56 +00:00
Douglas Gregor
88d292ccb8
Rework when and how vtables are emitted, by tracking where vtables are
...
"used" (e.g., we will refer to the vtable in the generated code) and
when they are defined (i.e., because we've seen the key function
definition). Previously, we were effectively tracking "potential
definitions" rather than uses, so we were a bit too eager about emitting
vtables for classes without key functions.
The new scheme:
- For every use of a vtable, Sema calls MarkVTableUsed() to indicate
the use. For example, this occurs when calling a virtual member
function of the class, defining a constructor of that class type,
dynamic_cast'ing from that type to a derived class, casting
to/through a virtual base class, etc.
- For every definition of a vtable, Sema calls MarkVTableUsed() to
indicate the definition. This happens at the end of the translation
unit for classes whose key function has been defined (so we can
delay computation of the key function; see PR6564), and will also
occur with explicit template instantiation definitions.
- For every vtable defined/used, we mark all of the virtual member
functions of that vtable as defined/used, unless we know that the key
function is in another translation unit. This instantiates virtual
member functions when needed.
- At the end of the translation unit, Sema tells CodeGen (via the
ASTConsumer) which vtables must be defined (CodeGen will define
them) and which may be used (for which CodeGen will define the
vtables lazily).
From a language perspective, both the old and the new schemes are
permissible: we're allowed to instantiate virtual member functions
whenever we want per the standard. However, all other C++ compilers
were more lazy than we were, and our eagerness was both a performance
issue (we instantiated too much) and a portability problem (we broke
Boost test cases, which now pass).
Notes:
(1) There's a ton of churn in the tests, because the order in which
vtables get emitted to IR has changed. I've tried to isolate some of
the larger tests from these issues.
(2) Some diagnostics related to
implicitly-instantiated/implicitly-defined virtual member functions
have moved to the point of first use/definition. It's better this
way.
(3) I could use a review of the places where we MarkVTableUsed, to
see if I missed any place where the language effectively requires a
vtable.
Fixes PR7114 and PR6564.
llvm-svn: 103718
2010-05-13 16:44:06 +00:00
Devang Patel
c5ffabc94f
If given location is invalid then use current location.
...
This fixes recent regressions reported by gdb testsuite.
Tighter verification of debug info generated by FE found these regressions.
Refactor code to extract line number and column number from SourceLocation.
llvm-svn: 103678
2010-05-12 23:46:38 +00:00
Devang Patel
3c2d51a1b9
Use end location of DeclStmt to mark stop point.
...
This is meaningful for blocks. This patch fixes bunch of test failures in gdb testsuite.
llvm-svn: 103533
2010-05-12 00:39:34 +00:00
Abramo Bagnara
6150c884df
Merged Elaborated and QualifiedName types.
...
llvm-svn: 103517
2010-05-11 21:36:43 +00:00
Daniel Dunbar
12ebb47a07
IRgen/i386/C++: Fix isSingleElementStruct computation for C++ record decls.
...
- Fixes PR7098.
llvm-svn: 103514
2010-05-11 21:15:36 +00:00
Douglas Gregor
6a047c979f
It's bad form to create VarDecl's without DeclContexts
...
llvm-svn: 103484
2010-05-11 18:17:16 +00:00
Fariborz Jahanian
2d2623c710
Minor refactoring of my last patch.
...
llvm-svn: 103475
2010-05-11 16:31:10 +00:00
Devang Patel
82bbfb58e3
Initialize Column.
...
llvm-svn: 103448
2010-05-10 23:48:38 +00:00
Fariborz Jahanian
43a40f9399
Objective-C++ Code gen. Handle code gen. for property
...
reference dot-syntax notation in a varierty of cases.
Fixes radar 7964490.
llvm-svn: 103440
2010-05-10 22:57:35 +00:00
Devang Patel
b319adec49
If variable location is invalid then use current location.
...
This fixes radar 7959934.
llvm-svn: 103408
2010-05-10 17:24:58 +00:00
David Chisnall
e0b5b3a1c5
Tweaked selector mangling again (GNU runtime).
...
llvm-svn: 103368
2010-05-09 01:01:43 +00:00
David Chisnall
2ec6cff9d0
Fixed linkage problem from last commit (GNU runtime).
...
llvm-svn: 103355
2010-05-08 21:55:04 +00:00
David Chisnall
0a24fd3744
Tweaked selector generation (GNU runtime). Removed the use of GlobalAliases in the generated bitcode.
...
llvm-svn: 103353
2010-05-08 20:58:05 +00:00
Devang Patel
67eba80672
If there is not any debug info for type then do not emit debug info for this variable.
...
A recent change to tightly verify debug info prepared by FE caught this.
This fixes unittest build.
llvm-svn: 103320
2010-05-07 23:05:55 +00:00
Fariborz Jahanian
7828ab1ed9
Minor mod. to my last patch.
...
llvm-svn: 103280
2010-05-07 18:59:54 +00:00
Fariborz Jahanian
fdf474b05e
Fixes a Code gen crash trying to use a dot-syntax for
...
a property of a c++ class object (radar 7957369).
llvm-svn: 103279
2010-05-07 18:56:13 +00:00
Devang Patel
ba4ad7f2fd
Avoid use of DIDescriptor::getNode(). Use overloaded operators instead.
...
llvm-svn: 103273
2010-05-07 18:12:35 +00:00
Douglas Gregor
d8bb3aff76
Do not give implicitly-defined virtual members functions
...
available_externally linkage, since they may not have been given a
strong definition in another translation unit. Without this patch, the
following test case fails to link with a GCC-compiled libstdc++:
#include <sstream>
int main() { std::basic_stringbuf<char> bs; }
Fixes the last problem with the Boost.IO library.
llvm-svn: 103208
2010-05-06 23:13:35 +00:00
Douglas Gregor
1411bb8f76
Fix typo in comment; 80 col violation
...
llvm-svn: 103204
2010-05-06 22:33:50 +00:00
Douglas Gregor
ae498b3211
The global variable for the VTT might not have external linkage; allow
...
us to find local variables, too. Fixes the last remaining
Boost.Rational failure.
llvm-svn: 103203
2010-05-06 22:18:21 +00:00
Fariborz Jahanian
b8993384f3
Code Gen support for Getter/Setter synthesis of
...
C++ object properties. (still radar 7468090).
llvm-svn: 103182
2010-05-06 15:45:36 +00:00
Chris Lattner
44456d294c
simplify EmitAggMemberInitializer a bit and make it work in 32-bit mode,
...
fixing PR7063.
llvm-svn: 103171
2010-05-06 06:35:23 +00:00
Chris Lattner
3628326b44
add todos for isinf_sign and isnormal, which I don't intend to implement
...
in the near future.
llvm-svn: 103169
2010-05-06 06:13:53 +00:00
Chris Lattner
dbff4bf5f4
implement codegen support for __builtin_isfinite, part of PR6083
...
llvm-svn: 103168
2010-05-06 06:04:13 +00:00
Chris Lattner
43660c5bc0
implement part of PR6083: codegen support for isinf. Like isnan,
...
this is generating correct but suboptimal (extra extend to double)
code for the float case. Will investigate next.
llvm-svn: 103166
2010-05-06 05:35:16 +00:00
Chandler Carruth
f3983652eb
Clean up the {} and else placement. This fixes an ambiguous else as well as
...
picking a more consistent pattern.
llvm-svn: 103142
2010-05-06 00:20:39 +00:00
Chris Lattner
3baada6fd7
Pass the globaldecl into GetOrCreateLLVMFunction so that llvm
...
function attributes like byval get applied to the function
definition. This fixes PR7058 and makes i386 llvm/clang bootstrap
pass all the same tests as x86-64 bootstrap for me (the llvmc
tests still fail in both).
llvm-svn: 103131
2010-05-05 22:55:13 +00:00
Fariborz Jahanian
25491a22af
This patch deals with Sema Part of Setter/Getter synthesis
...
of properties which are of C++ objects. Code Gen to follow
(Radar 7468090).
llvm-svn: 103123
2010-05-05 21:52:17 +00:00
Douglas Gregor
d450f06ef4
When we emit a non-constant initializer for a global variable of
...
reference type, make sure that the initializer we build is the
of the appropriate type for the *reference*, not for the thing that it
refers to. Fixes PR7050.
llvm-svn: 103115
2010-05-05 20:15:55 +00:00
Douglas Gregor
370eadf38d
For thread-safe static initialization of local statics with
...
destructors, place the __cxa_atexit call after the __cxa_guard_release
call, mimicking GCC/LLVM-GCC behavior. Noticed while debugging
something related.
llvm-svn: 103088
2010-05-05 15:38:32 +00:00
Alexis Hunt
656bb314d9
Reapplying patch to change StmtNodes.def to StmtNodes.td, this time
...
with no whitespace. This will allow statements to be referred to in
attribute TableGen files.
llvm-svn: 103087
2010-05-05 15:24:00 +00:00
Alexis Hunt
a8136cc408
Revert r103072; I accidentally ended up deleting a bunch of trailing
...
whitespace which makes this patch unreadable. Will recommit without the
whitespace.
llvm-svn: 103086
2010-05-05 15:23:54 +00:00
Douglas Gregor
94f9a4820a
Reimplement code generation for copying fields in the
...
implicitly-generated copy constructor. Previously, Sema would perform
some checking and instantiation to determine which copy constructors,
etc., would be called, then CodeGen would attempt to figure out which
copy constructor to call... but would get it wrong, or poke at an
uninstantiated default argument, or fail in other ways.
The new scheme is similar to what we now do for the implicit
copy-assignment operator, where Sema performs all of the semantic
analysis and builds specific ASTs that look similar to the ASTs we'd
get from explicitly writing the copy constructor, so that CodeGen need
only do a direct translation.
However, it's not quite that simple because one cannot explicit write
elementwise copy-construction of an array. So, I've extended
CXXBaseOrMemberInitializer to contain a list of indexing variables
used to copy-construct the elements. For example, if we have:
struct A { A(const A&); };
struct B {
A array[2][3];
};
then we generate an implicit copy assignment operator for B that looks
something like this:
B::B(const B &other) : array[i0][i1](other.array[i0][i1]) { }
CodeGen will loop over the invented variables i0 and i1 to visit all
elements in the array, so that each element in the destination array
will be copy-constructed from the corresponding element in the source
array. Of course, if we're dealing with arrays of scalars or class
types with trivial copy-assignment operators, we just generate a
memcpy rather than a loop.
Fixes PR6928, PR5989, and PR6887. Boost.Regex now compiles and passes
all of its regression tests.
Conspicuously missing from this patch is handling for the exceptional
case, where we need to destruct those objects that we have
constructed. I'll address that case separately.
llvm-svn: 103079
2010-05-05 05:51:00 +00:00
Anders Carlsson
58fe1756fb
Use a more appropriate LLVM type for the vtable pointer.
...
llvm-svn: 103078
2010-05-05 05:47:36 +00:00
Douglas Gregor
ecc60b99f9
Unbreak CMake build.
...
llvm-svn: 103077
2010-05-05 05:41:05 +00:00
Alexis Hunt
b9f408a873
Change StmtNodes.def to StmtNodes.td in anticipation of a rewrite of attributes
...
llvm-svn: 103072
2010-05-05 04:13:52 +00:00
John McCall
4a39ab8078
Emit the globals, metadata, etc. associated with static variables even when
...
they're unreachable. This matters because (if they're POD, or if this is C)
the scope containing the variable might be reachable even if the variable
isn't. Fixes PR7044.
llvm-svn: 103052
2010-05-04 20:45:42 +00:00
Fariborz Jahanian
60c7e16b64
Fixes a code gen. crash when ivar object has trivial constructor.
...
llvm-svn: 103028
2010-05-04 19:29:32 +00:00
Douglas Gregor
c8be95274d
When instantiating a function that was declared via a typedef, e.g.,
...
typedef int functype(int, int);
functype func;
also instantiate the synthesized function parameters for the resulting
function declaration.
With this change, Boost.Wave builds and passes all of its regression
tests.
llvm-svn: 103025
2010-05-04 18:18:31 +00:00
Fariborz Jahanian
eeb233793d
Fixes a code gen crash when block is a reference type, etc.
...
(radar 7495203).
llvm-svn: 103022
2010-05-04 17:59:32 +00:00
John McCall
e61b02bcaf
When inheriting a default argument expression, inherit the full expression,
...
not just the inner expression. This is important if the expression has any
temporaries. Fixes PR 7028.
Basically a symptom of really tragic method names.
llvm-svn: 102998
2010-05-04 01:53:42 +00:00
Fariborz Jahanian
751f7bc03c
Fixes a Code Gen. Crash when calling destructor on a __block
...
variabe. Blocks and their construction/destruction is
wip though.
llvm-svn: 102985
2010-05-04 00:26:07 +00:00
John McCall
5828ee7a27
Just bail out immediately when emitting an unreachable function-local static
...
variable. Surprisingly, this does seem to be the right way to solve this.
llvm-svn: 102961
2010-05-03 21:39:56 +00:00
Douglas Gregor
aee1f51485
If we're generating code to create a pointer-to-member function
...
aggregate and the result of the aggregate is unused, bail out
early. Fixes PR7027.
llvm-svn: 102942
2010-05-03 20:00:27 +00:00
Anders Carlsson
3572d44190
When computing the address of a virtual member function pointer, use the pointer width instead of hardcoding for 64-bit.
...
llvm-svn: 102921
2010-05-03 16:05:06 +00:00
Anders Carlsson
d040e6b25a
Don't build an aggregate constructor loop when the constructor is trivial.
...
llvm-svn: 102912
2010-05-03 15:09:17 +00:00
Anders Carlsson
16e94af67c
Don't copy or initialize empty classes. Fixes PR7012.
...
llvm-svn: 102891
2010-05-03 01:20:20 +00:00
Anders Carlsson
8bdbb5be19
Store the entire base subobject in SubVTTIndices.
...
llvm-svn: 102890
2010-05-03 00:55:11 +00:00
Anders Carlsson
f4da2cf20a
Remove OldGetAddressOfBaseClass - bye bye ambiguities.
...
llvm-svn: 102889
2010-05-03 00:32:27 +00:00
Anders Carlsson
c58fb552f3
Get rid of the last caller of OldGetAddressOfBaseClass.
...
llvm-svn: 102888
2010-05-03 00:29:58 +00:00
Anders Carlsson
c4d0d0fed1
More work towards getting rid of OldGetAddressOfBaseClass.
...
llvm-svn: 102887
2010-05-03 00:07:07 +00:00
Anders Carlsson
e089060fd0
Get rid of a call to GetAddressOfDirectBaseInCompleteClass.
...
llvm-svn: 102886
2010-05-02 23:57:15 +00:00
Anders Carlsson
859b3064cb
Have getSubVTTIndex take a BaseSubobject instead of just a base.
...
llvm-svn: 102885
2010-05-02 23:53:25 +00:00
Anders Carlsson
4d205ba87f
Pass ForVirtualBase all the way to GetVTTParameter.
...
llvm-svn: 102883
2010-05-02 23:33:10 +00:00
Anders Carlsson
f8a71f08d1
Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.
...
llvm-svn: 102882
2010-05-02 23:29:11 +00:00
Anders Carlsson
e11f9ce9dc
Revert my last change and add a 'ForVirtualBase' parameter to EmitCXXConstructorCall instead.
...
llvm-svn: 102881
2010-05-02 23:20:53 +00:00
Anders Carlsson
4c638f1217
Pass the construction kind down to EmitCXXConstructorCall.
...
llvm-svn: 102880
2010-05-02 23:01:10 +00:00
Anders Carlsson
245820b9d9
Remove another unused function.
...
llvm-svn: 102871
2010-05-02 18:13:35 +00:00
Anders Carlsson
54eb4843b1
Remove an unused function.
...
llvm-svn: 102870
2010-05-02 18:12:22 +00:00
Benjamin Kramer
2718b4d757
CodeGen: Shrink RValue. 4 words -> 2 words.
...
llvm-svn: 102863
2010-05-02 14:59:10 +00:00
David Chisnall
ff5f88c38e
As per Chris' request, return the Instruction from EmitCall and add the metadata in the caller.
...
llvm-svn: 102862
2010-05-02 13:41:58 +00:00
Douglas Gregor
b139cd5843
Complete reimplementation of the synthesis for implicitly-defined copy
...
assignment operators.
Previously, Sema provided type-checking and template instantiation for
copy assignment operators, then CodeGen would synthesize the actual
body of the copy constructor. Unfortunately, the two were not in sync,
and CodeGen might pick a copy-assignment operator that is different
from what Sema chose, leading to strange failures, e.g., link-time
failures when CodeGen called a copy-assignment operator that was not
instantiation, run-time failures when copy-assignment operators were
overloaded for const/non-const references and the wrong one was
picked, and run-time failures when by-value copy-assignment operators
did not have their arguments properly copy-initialized.
This implementation synthesizes the implicitly-defined copy assignment
operator bodies in Sema, so that the resulting ASTs encode exactly
what CodeGen needs to do; there is no longer any special code in
CodeGen to synthesize copy-assignment operators. The synthesis of the
body is relatively simple, and we generate one of three different
kinds of copy statements for each base or member:
- For a class subobject, call the appropriate copy-assignment
operator, after overload resolution has determined what that is.
- For an array of scalar types or an array of class types that have
trivial copy assignment operators, construct a call to
__builtin_memcpy.
- For an array of class types with non-trivial copy assignment
operators, synthesize a (possibly nested!) for loop whose inner
statement calls the copy constructor.
- For a scalar type, use built-in assignment.
This patch fixes at least a few tests cases in Boost.Spirit that were
failing because CodeGen picked the wrong copy-assignment operator
(leading to link-time failures), and I suspect a number of undiagnosed
problems will also go away with this change.
Some of the diagnostics we had previously have gotten worse with this
change, since we're going through generic code for our
type-checking. I will improve this in a subsequent patch.
llvm-svn: 102853
2010-05-01 20:49:11 +00:00
Anders Carlsson
b136e626ea
Simplify EmitCopyCtorCall.
...
llvm-svn: 102849
2010-05-01 17:07:40 +00:00
Anders Carlsson
aab3b57359
Simplify EmitClassAggrMemberwiseCopy.
...
llvm-svn: 102848
2010-05-01 17:02:18 +00:00
Anders Carlsson
ab826ad169
Clean up EmitClassMemberwiseCopy further.
...
llvm-svn: 102846
2010-05-01 16:54:05 +00:00
Anders Carlsson
820022c55c
Get rid of a parameter from EmitClassMemberwiseCopy.
...
llvm-svn: 102845
2010-05-01 16:49:43 +00:00
Anders Carlsson
7911150a3d
When defining implicit copy constructors, use SetBaseOrMemberInitializers to initialize the bases.
...
llvm-svn: 102842
2010-05-01 16:39:01 +00:00
David Chisnall
c0cf422d56
Attach message send metadata to the lookup as well as to the call (GNU runtime).
...
llvm-svn: 102839
2010-05-01 12:56:56 +00:00
David Chisnall
ea529a43d4
Make super message lookups cacheable (GNUstep Runtime)
...
llvm-svn: 102837
2010-05-01 12:37:16 +00:00
David Chisnall
9eecafa480
Tweaked EmitCall() to permit the caller to provide some metadata to attach to the call site.
...
Used this in CGObjCGNU to attach metadata about message sends to permit speculative inlining.
llvm-svn: 102833
2010-05-01 11:15:56 +00:00
John McCall
4d4dcc8ed7
When synthesizing Objective C records, give the synthetic fields public
...
access. Fixes an assertion.
Fixes rdar://problem/7927811. Too lazy to reduce a test case.
llvm-svn: 102776
2010-04-30 21:35:41 +00:00
Anders Carlsson
d6c5391cd9
Remove an unnecessary parameter from EmitClassCopyAssignment.
...
llvm-svn: 102747
2010-04-30 19:45:28 +00:00
David Chisnall
d6a6af6a53
Fixed incorrect type of alloca (GNU runtime).
...
llvm-svn: 102711
2010-04-30 13:36:12 +00:00
John McCall
b3cec96a7c
Account for the VTT argument when making an implicit copy constructor for
...
a class with virtual bases. Just a patch until Sema starts (correctly) doing
most of this analysis.
Fixes PR 6622.
llvm-svn: 102692
2010-04-30 05:56:45 +00:00
John McCall
48bf349471
Fix -fno-rtti -fexceptions by forcing the emission of (non-"builtin") RTTI
...
when used by the exceptions routines. Fixes PR 6974.
llvm-svn: 102684
2010-04-30 01:15:21 +00:00
John McCall
dac3ea6e8d
Teach EHCleanupBlock to deal appropriately with the possibility that there
...
might not have been an insertion block set at start. Fixes PR6975.
llvm-svn: 102677
2010-04-30 00:06:43 +00:00
Anders Carlsson
786a3d910e
Get the base class addresses before calling EmitClassCopyAssignment.
...
llvm-svn: 102676
2010-04-30 00:04:01 +00:00
Anders Carlsson
2b4ec8d003
Remove an unnecessary argument to EmitClassCopyAssignment.
...
llvm-svn: 102674
2010-04-29 23:51:42 +00:00
Devang Patel
dfcd0661a1
Use clang::VarDecl name instead of llvm::GlobalVariable name.
...
llvm::GLobalVariable name may not match user visibile name for function static variables.
llvm-svn: 102644
2010-04-29 17:48:37 +00:00
Daniel Dunbar
0c00537583
IRgen/NeXT: Put the synthesized _objc_super, _message_ref_t decls in a valid DeclContext, to satisfy the invariants that should hold on a RecordDecl.
...
llvm-svn: 102624
2010-04-29 16:29:11 +00:00
Fariborz Jahanian
499b902510
Support for construct/destruct of ivar array
...
of c++ objects (NeXt runtime).
radar 7900343.
llvm-svn: 102546
2010-04-28 22:30:33 +00:00
Douglas Gregor
882211c1da
Completely reimplement __builtin_offsetof, based on a patch by Roberto
...
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-28 22:16:22 +00:00
Fariborz Jahanian
0dec1e0d56
IRGen for initialization/destruction of
...
ivar class objects (NeXt runtime).
(radar 7900343).
llvm-svn: 102533
2010-04-28 21:28:56 +00:00
David Chisnall
01aa46795e
Changed signature of GenerateMessageSend() function to pass the ObjCInterfaceDecl for class messages and removed the boolean IsClassMessage argument, which wasn't used anywhere.
...
Emitted some metadata on message sends to allow a later pass to do some speculative inlining of class methods (GNU runtime). Speculative inlining of instance methods requires type feedback to be useful (work in progress), but for class methods it works quite nicely.
llvm-svn: 102514
2010-04-28 19:33:36 +00:00
Benjamin Kramer
9c05bf46d1
Remove unused function.
...
llvm-svn: 102499
2010-04-28 15:54:45 +00:00
David Chisnall
d472c85285
Emit the correct symbol name for the class (GNU runtime).
...
llvm-svn: 102497
2010-04-28 14:29:56 +00:00
Douglas Gregor
7988def89f
Improve name mangling for dependent template names (e.g., typename
...
T::template apply<U>), handling a few cases where we previously failed
and performing substitutions on such dependent names. Fixes a crash in
Boost.PropertyTree.
llvm-svn: 102490
2010-04-28 05:58:56 +00:00
John McCall
d06fb865eb
Properly pass the address of a lazily-generated function declaration with
...
incomplete type. Fixes PR6911.
llvm-svn: 102473
2010-04-28 00:00:30 +00:00
David Chisnall
e6d0073fa9
Fixed message send to void (broken by my last commit - GNU runtime).
...
llvm-svn: 102459
2010-04-27 20:33:30 +00:00
David Chisnall
75afda6c33
Ensure return from a message to nil is always 0 (GNU runtime).
...
This works around stack corruption / crashes resulting from PR6944, and also
works around people who expect 'what works on my machine' to work everywhere
(GCC crashes in a number of cases on SPARC that should now work correctly with
clang).
llvm-svn: 102430
2010-04-27 15:08:48 +00:00
Daniel Dunbar
19d6355b77
Fix comments.
...
llvm-svn: 102429
2010-04-27 14:51:07 +00:00
John McCall
2408e32096
Make the InjectedClassNameType the canonical type of the current instantiation
...
of a class template or class template partial specialization. That is to
say, in
template <class T> class A { ... };
or
template <class T> class B<const T*> { ... };
make 'A<T>' and 'B<const T*>' sugar for the corresponding InjectedClassNameType
when written inside the appropriate context. This allows us to track the
current instantiation appropriately even inside AST routines. It also allows
us to compute a DeclContext for a type much more efficiently, at some extra
cost every time we write a template specialization (which can be optimized,
but I've left it simple in this patch).
llvm-svn: 102407
2010-04-27 00:57:59 +00:00
Devang Patel
42fb6f8b9a
Enable debug info for local variables at -O1+.
...
llvm-svn: 102398
2010-04-26 23:28:46 +00:00
Chris Lattner
5e8416a77f
emit dtors with the right calling convention in -fno-use-cxa-atexit
...
mode.
llvm-svn: 102377
2010-04-26 20:35:54 +00:00
Douglas Gregor
46a572b871
Make the static type of the exception variable in an Objective-C
...
@catch a VarDecl. The dynamic type is still a ParmVarDecl, but that
will change soon. No effective functionality change.
llvm-svn: 102341
2010-04-26 16:46:50 +00:00
Daniel Dunbar
710cb20cd6
IRgen/NeXT: Fix several alignment issues with Objective-C metadata symbols:
...
- Fix some places that had the alignment hard coded.
- Use ABI type alignment, not preferred type alignment -- neither of this is exactly right, as we really want the C type alignment as required by the runtime, but the ABI alignment is a more correct choice.
This should be equivalent for x86_64, but fixes the alignment for ARM.
llvm-svn: 102314
2010-04-25 20:39:32 +00:00
Daniel Dunbar
5e63927d41
IRgen/NeXT: Reuse EmitImageInfo for both fragile and non-fragile ABI. This fixes Clang to correctly emit the "CorrectedSynthesize" bit when using the non-fragile ABI.
...
llvm-svn: 102312
2010-04-25 20:39:01 +00:00
Anders Carlsson
06eed9bee2
Land another cleanup patch.
...
llvm-svn: 102293
2010-04-25 01:03:12 +00:00
Anders Carlsson
53e1ba948d
Revert enough of my patches to fix self-host again :(
...
llvm-svn: 102289
2010-04-25 00:52:09 +00:00
Anders Carlsson
dde8b46e62
Cleanup SynthesizeCXXCopyConstructor.
...
llvm-svn: 102286
2010-04-24 23:11:18 +00:00
Anders Carlsson
84e3b62ac0
Clean up SynthesizeCXXCopyAssignment a little.
...
llvm-svn: 102285
2010-04-24 23:09:21 +00:00
Anders Carlsson
c4ba0cd2ea
RenameGetAddressOfBaseOfCompleteClass to GetAddressOfDirectBaseInCompleteClass to reflect that it only handles direct bases.
...
llvm-svn: 102284
2010-04-24 23:01:49 +00:00
Anders Carlsson
26b6e23d57
More cleanup.
...
llvm-svn: 102282
2010-04-24 22:43:39 +00:00
Anders Carlsson
9523ad4fd3
Simplify EmitClassMemberwiseCopy now that it's only used for fields.
...
llvm-svn: 102281
2010-04-24 22:36:50 +00:00
Anders Carlsson
90235beb55
DefineImplicitCopyConstructor now uses SetBaseOrMemberInitializers to create implicit base initializers. (Member initializers are still handled by CodeGenFunction::SynthesizeCXXCopyConstructor for now).
...
llvm-svn: 102279
2010-04-24 22:25:18 +00:00
Anders Carlsson
bea9e74e82
Rename GetAddressOfBaseClass to OldGetAddressOfBaseClass.
...
llvm-svn: 102275
2010-04-24 21:51:08 +00:00
Anders Carlsson
795213efde
Get rid of the old GetNonVirtualBaseClassOffset and change all call sites to use the new version.
...
llvm-svn: 102274
2010-04-24 21:27:51 +00:00
Anders Carlsson
8a64c1c94c
Change CodeGenFunction::GetAddressOfDerivedClass to take a BasePath.
...
llvm-svn: 102273
2010-04-24 21:23:59 +00:00
Anders Carlsson
c6eaea70af
Convert more call sites over to the new GetAddressOfBaseClass.
...
llvm-svn: 102272
2010-04-24 21:12:55 +00:00
Anders Carlsson
d829a02514
Add a new GetAddressOfBaseClass overload that takes a base path and. Use it for derived-to-base casts.
...
llvm-svn: 102270
2010-04-24 21:06:20 +00:00
Benjamin Kramer
20f2d4382f
Fix pasto, add a comment.
...
llvm-svn: 102263
2010-04-24 20:26:20 +00:00
Benjamin Kramer
bbb5deace6
Factor code. No functionality change.
...
llvm-svn: 102262
2010-04-24 20:19:58 +00:00
Daniel Dunbar
fca18c1b41
NeXT: Clean up dispatch method policy selection.
...
- Replace -cc1 level -fobjc-legacy-dispatch with -fobjc-dispatch-method={legacy,non-legacy,mixed}.
- Lift "mixed" vs "non-mixed" policy choice up to driver level, instead of being buried in CGObjCMac.cpp.
- No intended functionality change.
llvm-svn: 102255
2010-04-24 17:56:46 +00:00
Anders Carlsson
0c509eeac7
CastExpr should not hold a pointer to the base path. More cleanup.
...
llvm-svn: 102249
2010-04-24 16:57:13 +00:00
Dan Gohman
7905d187e6
Fix a place in inline asm lowering which was creating a TruncInst with a
...
pointer operand. This fixes an abort on
MultiSource/Applications/ClamAV/libclamav_mbox.c.
llvm-svn: 102238
2010-04-24 04:55:02 +00:00
Devang Patel
8471593892
Revert accidental check-in.
...
llvm-svn: 102226
2010-04-24 00:49:16 +00:00
Devang Patel
f8b55d478c
Revert r102215. This causes clang crash while compiling a test case from gdb testsuite.
...
llvm-svn: 102224
2010-04-24 00:40:35 +00:00
Douglas Gregor
96c79498fb
Improve the AST representation of Objective-C @try/@catch/@finally
...
statements. Instead of the @try having a single @catch , where all of
the @catch's were chained (using an O(n^2) algorithm nonetheless),
@try just holds an array of its @catch blocks. The resulting AST is
slightly more compact (not important) and better represents the actual
language semantics (good).
llvm-svn: 102221
2010-04-23 22:50:49 +00:00
Fariborz Jahanian
d3fa70181d
More -fno-constant-cfstrings API work.
...
llvm-svn: 102219
2010-04-23 22:33:39 +00:00
Anders Carlsson
9759793855
Add an InheritancePath parameter to the ImplicitCastExpr constructor.
...
llvm-svn: 102218
2010-04-23 22:18:37 +00:00
Daniel Dunbar
e3883874c5
NeXT/EH: When generating the rethrow code for a finally block, make sure to
...
chain outwards when inside a nested exception scope.
- A real test for this is going into LLVM test-suite.
llvm-svn: 102204
2010-04-23 19:12:32 +00:00
Daniel Dunbar
5a6b3e0865
NeXT/EH: Tidy up EH code a bit, don't emit the catch block EH handler if it is unreachable.
...
llvm-svn: 102203
2010-04-23 19:12:24 +00:00
Fariborz Jahanian
e804c28745
More work toward implementing
...
NeXt's -fno-constant-cfstrings - wip.
llvm-svn: 102189
2010-04-23 17:41:07 +00:00
Chris Lattner
db6d5cb892
Implement PR6845. We allow matching constraints to have different
...
input and output types when the smaller value isn't mentioned in the
asm string. Extend this support from integers to also allowing
fp values to be mismatched (if not mentioned in the asm string).
llvm-svn: 102188
2010-04-23 17:27:29 +00:00
Douglas Gregor
914af2182b
Handle compound assignment expressions (i += j) as lvalues, which is
...
permitted in C++ but not in C. Fixes PR6900. Clang can now handle all
of Boost.Lambda's regression tests.
llvm-svn: 102170
2010-04-23 04:16:32 +00:00
Douglas Gregor
ffe0884bc4
Emit a lame diagnostic when we can't mangle operator names
...
llvm-svn: 102168
2010-04-23 03:19:53 +00:00
Douglas Gregor
173627188d
Mangle dependent template names such as the nested-name-specifier in
...
T::apply <U>::type
Fixes PR6899, although I want to dig a little deeper into the FIXME
for dependent template names that refer to operators.
llvm-svn: 102167
2010-04-23 03:10:43 +00:00
Douglas Gregor
19043f0a6a
I hate default statements. Fixes PR6874.
...
llvm-svn: 102160
2010-04-23 02:02:43 +00:00
Fariborz Jahanian
63408e848b
Support for -fno-constant-cfstrings option - wip.
...
llvm-svn: 102112
2010-04-22 20:26:39 +00:00
Daniel Dunbar
5981377698
IRgen: Fix another case where we generated an invalid access component when we
...
immediately narrowed the access size. Fix this (and previous case) by just
choosing a better access size up-front.
llvm-svn: 102068
2010-04-22 15:22:33 +00:00
Daniel Dunbar
5d6c07e0e9
IRgen: Fix case where we might generate an access component with width == 0, if
...
we have to narrow the access side immediately (can happen with packed,
-fno-bitfield-type-align).
llvm-svn: 102067
2010-04-22 14:56:10 +00:00
Daniel Dunbar
b219780b72
Suppress compiler warning.
...
llvm-svn: 102047
2010-04-22 03:17:06 +00:00
Daniel Dunbar
fc66e0ed87
IRgen: Set alignment correctly on bit-field accesses.
...
llvm-svn: 102046
2010-04-22 03:17:04 +00:00
Daniel Dunbar
488f55c271
IRgen: Rewrite bit-field access policy to not access data beyond the bounds of the structure, which we also now verify as part of the post-layout consistency checks.
...
- This fixes some pedantic bugs with packed structures, as well as major problems with -fno-bitfield-type-align.
- Fixes PR5591, PR5567, and all known -fno-bitfield-type-align issues.
- Review appreciated.
llvm-svn: 102045
2010-04-22 02:35:46 +00:00
Daniel Dunbar
b6f4b05914
IRgen: Fix CGRecordLayout::print to print the bit-field infos in a consistent order.
...
llvm-svn: 102044
2010-04-22 02:35:36 +00:00
John McCall
2e6567ae60
Call PerformCopyInitialization to properly initialize the exception temporary
...
in a throw expression. Use EmitAnyExprToMem to emit the throw expression,
which magically elides the final copy-constructor call (which raises a new
strict-compliance bug, but baby steps). Give __cxa_throw a destructor pointer
if the exception type has a non-trivial destructor.
llvm-svn: 102039
2010-04-22 01:10:34 +00:00
Devang Patel
b9ab309650
Encode field accessibility.
...
llvm-svn: 102033
2010-04-21 23:12:37 +00:00
Daniel Dunbar
53fac692fa
ABI/x86-32 & x86-64: Alignment on 'byval' must be set when when the alignment
...
exceeds the minimum ABI alignment.
llvm-svn: 102019
2010-04-21 19:49:55 +00:00
Daniel Dunbar
557893d2a8
IRgen/x86-32: Factor out getIndirectResult(), to match x86-64 factoring.
...
llvm-svn: 102015
2010-04-21 19:10:51 +00:00
Daniel Dunbar
2ba67440b6
IRgen: Add checking that the LLVM and AST record layout offsets agree (for
...
non-bit-fields).
llvm-svn: 102014
2010-04-21 19:10:49 +00:00
Anders Carlsson
34f54d55e2
Comment out an assert for now.
...
llvm-svn: 102007
2010-04-21 18:03:05 +00:00
John McCall
bf814c79b6
I failed to notice that my last patch wasn't doing as much as it could
...
because EmitBranch actually clears the insert point. This version
actually accomplishes what I initially wanted.
llvm-svn: 101998
2010-04-21 11:18:06 +00:00
John McCall
e683359fc9
Teach EmitBlock to put the target block immediately after the current block
...
(if there's a current block). The chief advantage of doing this is that it
lets us pick blocks (e.g. EH blocks) to push to the end of the function so
that fallthrough happens consistently --- i.e. it gives us the flexibility
of ordering blocks as we please without having to change the order in which
we generate code. There are standard (?) optimization passes which can do some
of that for us, but better to generate reasonable code to begin with.
llvm-svn: 101997
2010-04-21 10:29:06 +00:00
John McCall
2188696d98
Miscellaneous codegen cleanups. Mostly, don't create new basic blocks
...
just to save the current insertion state! This change significantly
simplifies the IR CFG in exceptions code.
llvm-svn: 101996
2010-04-21 10:05:39 +00:00
Douglas Gregor
9a12919421
Overhaul the AST representation of Objective-C message send
...
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 00:45:42 +00:00
Fariborz Jahanian
acdfa7acfe
Fixes a code gen. bug by removing an assert.
...
It is ok to have c++-ness inside extern "C"
block. Fixes pr6644.
llvm-svn: 101948
2010-04-20 22:02:31 +00:00
Anders Carlsson
91baecfeb3
Back out r101911 and see if it makes the bots happy.
...
llvm-svn: 101921
2010-04-20 18:05:10 +00:00
Daniel Dunbar
20b551a443
IRgen: Always use i8 arrays to access union bit-fields. This is ugly, but
...
matches how we currently handle structs, and this correctly handles
-fno-bitfield-type-align.
llvm-svn: 101918
2010-04-20 17:52:30 +00:00
Anders Carlsson
6a0227df49
Fix a bug which triggered the assertion I added yesterday. Basically, when we initialize the vtable pointer for a virtual base, and there was another path from the most derived class to another base with the same class type, we would use the wrong base.
...
llvm-svn: 101911
2010-04-20 16:22:16 +00:00
Anders Carlsson
53cebd1ea6
Move code to apply a non-virtual and virtual offset out into a separate function.
...
llvm-svn: 101909
2010-04-20 16:03:35 +00:00
Chris Lattner
9cffdf1331
don't slap noalias attribute on stret result arguments.
...
This mirror's Dan's patch for llvm-gcc in r97989, and
fixes the miscompilation in PR6525. There is some contention
over whether this is the right thing to do, but it is the
conservative answer and demonstrably fixes a miscompilation.
llvm-svn: 101877
2010-04-20 05:44:43 +00:00
Anders Carlsson
652758c3ec
Pass the nearest virtual base decl to InitializeVTablePointers. No functionality change right now.
...
llvm-svn: 101872
2010-04-20 05:22:15 +00:00
Anders Carlsson
3d4218570a
Assert that the path from the derived to the base class in CodeGenFunction::GetAddressOfBaseClass is not ambiguous.
...
llvm-svn: 101869
2010-04-20 05:07:22 +00:00
Douglas Gregor
c4df407604
Keep track of the actual storage specifier written on a variable or
...
function declaration, since it may end up being changed (e.g.,
"extern" can become "static" if a prior declaration was static). Patch
by Enea Zaffanella and Paolo Bolzoni.
llvm-svn: 101826
2010-04-19 22:54:31 +00:00
Daniel Dunbar
ccabe48235
AST: Dump ASTRecordLayout objects when they are created with -fdump-record-layouts.
...
llvm-svn: 101815
2010-04-19 20:44:53 +00:00
Daniel Dunbar
2ea5183b59
IRgen: Kill unused function and move the type match assert to after record dumping.
...
llvm-svn: 101814
2010-04-19 20:44:47 +00:00
Fariborz Jahanian
fd34b0ac84
Check for darwin befoer cheking for version.
...
(related to radar 7866951).
llvm-svn: 101799
2010-04-19 18:38:31 +00:00
Fariborz Jahanian
4d55b2d049
Some renaming of methods, fixes typo
...
(related to PR6769).
llvm-svn: 101794
2010-04-19 18:15:02 +00:00
Fariborz Jahanian
dfb3983525
Force clang to produce legacy api for messaging
...
in for pre-snowleoprd (NeXt runtime). Fixes
radar 7866951
llvm-svn: 101791
2010-04-19 17:53:30 +00:00
Rafael Espindola
47cf5b581a
Add comment explaning the use of c99 inline in c++.
...
llvm-svn: 101787
2010-04-19 16:58:20 +00:00
Dan Gohman
145f3f1e83
Fix -Wcast-qual warnings.
...
llvm-svn: 101786
2010-04-19 16:39:44 +00:00
David Chisnall
44ec555a87
Don't just emit ivar metadata - emit CORRECT ivar metadata. (GNU runtime)
...
llvm-svn: 101759
2010-04-19 01:37:25 +00:00
David Chisnall
18cf7378de
Fix emitting ivar metadata for synthesized ivars and some 64-bit fixes. (GNU runtime)
...
llvm-svn: 101758
2010-04-19 00:45:34 +00:00
Rafael Espindola
683fe4fc4c
If a method is virtual and the class key function is in another file, emit the method as available_externally.
...
Fixes PR6747
llvm-svn: 101757
2010-04-19 00:44:22 +00:00
Fariborz Jahanian
3fef72f0ba
Local static variables must be available module-wise
...
as they are accessible in static methods in a class
local to the same function. Fixes PR6769.
llvm-svn: 101756
2010-04-18 21:01:23 +00:00
Nuno Lopes
247a138ec6
recommit r101568 to fix PR6766
...
as a side-effect, remove two FIXMEs now fixed
llvm-svn: 101726
2010-04-18 19:06:43 +00:00
Anders Carlsson
d5f27b0583
Simplify wide bit-field layout in CGRecordLayoutBuilder, and also fix a bug where assigning to a bit-field member would overwrite other parts of the struct.
...
llvm-svn: 101681
2010-04-17 22:54:57 +00:00
Anders Carlsson
8345a70c67
Fix an assert when assigning a boolean value to a bitfield of type _Bool.
...
llvm-svn: 101678
2010-04-17 21:52:22 +00:00
Anders Carlsson
2295f13bb0
Unnamed bit-fields in a union should be laid out with a type that doesn't affect alignment.
...
llvm-svn: 101673
2010-04-17 21:04:52 +00:00
Anders Carlsson
1de2f5710b
Factor union field layout code out into a separate function. No functionality change.
...
llvm-svn: 101671
2010-04-17 20:49:27 +00:00
Anders Carlsson
11e5140db9
Vtable -> VTable renames across the board.
...
llvm-svn: 101666
2010-04-17 20:15:18 +00:00
Chris Lattner
a299f2c872
fix integrated assembler with i386 objc code.
...
llvm-svn: 101660
2010-04-17 18:26:20 +00:00
Anders Carlsson
c6db5ab8b2
Fix a bug where we would sometimes incorrectly mark an vtable function as unused.
...
llvm-svn: 101643
2010-04-17 17:24:33 +00:00
Benjamin Kramer
b11416d061
Add raw_ostream operators to NamedDecl for convenience. Switch over all users of getNameAsString on a stream.
...
The next step is to print the name directly into the stream, avoiding a temporary std::string copy.
llvm-svn: 101632
2010-04-17 09:33:03 +00:00
Chris Lattner
b714a4b4a0
revert r101568, which miscompiles this testcase, distilled from ldecod:
...
void exit_picture()
{
char yuv_types[4][6]= {"4:0:0","4:2:0","4:2:2","4:4:4"};
foo(yuv_types);
}
llvm-svn: 101623
2010-04-17 06:53:44 +00:00
Nuno Lopes
74b595256a
fix PR6766: codegen of var initialized with wide char
...
llvm-svn: 101568
2010-04-16 23:19:41 +00:00
Chris Lattner
3cff64ab58
fix a bogus assertion exposed by a recent change: packing the
...
struct may cause it to shrink more than one byte. Before
my recent changes we compiled the new test into:
%0 = type { [6 x i8] }
@x = global %0 { [6 x i8] undef }, align 2 ; <%0*> [#uses=0]
which is obviously bogus. Now we compile it into:
%0 = type <{ i32, i8, i8 }>
@x = global %0 zeroinitializer, align 2 ; <%0*> [#uses=0]
Where the last byte only is tail padding.
llvm-svn: 101536
2010-04-16 21:02:32 +00:00
Nuno Lopes
5863c999e7
emit padding as undef values, take 2
...
merge also a few tests I had here for this feature, and FileCheck'ize one file
llvm-svn: 101535
2010-04-16 20:56:35 +00:00
Anders Carlsson
be6f3181dd
Make CGRecordLayoutBuilder deal with wide bit-fields. Will land tests shortly (Daniel, please review).
...
llvm-svn: 101472
2010-04-16 16:23:02 +00:00
Chris Lattner
79bf976518
tidy up
...
llvm-svn: 101447
2010-04-16 06:12:51 +00:00
Daniel Dunbar
9c78d63fbc
IRgen: Change CGBitFieldInfo to take the AccessInfo as constructor arguments, it is now an immutable object.
...
Also, add some checking of various invariants that should hold on the CGBitFieldInfo access.
llvm-svn: 101345
2010-04-15 05:09:32 +00:00
Daniel Dunbar
bb13845c5f
IRgen: Eliminate now unused fields from CGBitFieldInfo.
...
llvm-svn: 101344
2010-04-15 05:09:28 +00:00
Daniel Dunbar
67aba79b74
IRgen: (Reapply 101222, with fixes) Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
...
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.
- No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.
The new fixes from r101222 are:
1. The shift to the target position needs to occur after the value is extended to the correct size. This broke Clang bootstrap, among other things no doubt.
2. Swap the order of arguments to OR, to get a tad more constant folding.
llvm-svn: 101339
2010-04-15 03:47:33 +00:00
Eric Christopher
1bbc7086ff
Rewrite handling of 64-bit palignr intrinsics to be vector shuffles.
...
Stop multiplying constant by 8 accordingly in the header and change
intrinsic definition for what types we expect.
Add to existing palignr test to check that we're emitting the correct things.
llvm-svn: 101332
2010-04-15 01:43:08 +00:00
Daniel Dunbar
d51c1a6e09
IRgen/NeXT: Simplify to use AST record layout for getting offsets instead of the
...
IRgen record layout, which this code doesn't need to depend on.
llvm-svn: 101257
2010-04-14 17:02:21 +00:00
Daniel Dunbar
91ea6ac3e9
Speculatively revert "IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.", I think it might be breaking bootstrap.
...
llvm-svn: 101235
2010-04-14 05:48:35 +00:00
Daniel Dunbar
230e1541b3
IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
...
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.
- No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.
llvm-svn: 101222
2010-04-14 04:08:03 +00:00
Daniel Dunbar
b2b40a479d
IRgen: Tweak CGBitFieldInfo doxyments & add an accessor.
...
llvm-svn: 101221
2010-04-14 04:07:59 +00:00
Chris Lattner
dad4062b4d
implement altivec.h and a bunch of support code, patch by Anton Yartsev!
...
llvm-svn: 101215
2010-04-14 03:54:58 +00:00
Daniel Dunbar
3447a02d5f
IRgen: Move EmitLoadOfBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
...
- This lets the method focus slightly more on emitting clean IR to honor the policy which has been selected. On 403.gcc's combine.c, x86_64, -O0, this reduces the number of lines in the .ll file (~= # of instructions) by 2.5%.
- No intended functionality change -- at -O3 this should produce equivalent if not identical output. On 403.gcc's combine.c, x86_64, -O3, this isn't quite true and some of the changes are regressions, but I'm not going to worry about that until we move to a new access policy.
- There is still some room for improvement in the generated IR, in particular we can usually fold the sign-extension of the bit-field into one of the component access. See the FIXME.
llvm-svn: 101192
2010-04-13 23:34:15 +00:00
Daniel Dunbar
b935b9370d
IRgen: Enhance CGBitFieldInfo with enough information to fully describe the "policy" with which a bit-field should be accessed.
...
- For now, these policies are computed to match the current IRgen strategy, although the new information isn't being used yet (except in -fdump-record-layouts).
- Design comments appreciated.
llvm-svn: 101178
2010-04-13 20:58:55 +00:00
Fariborz Jahanian
5e575c03b8
Removes a FIXME.
...
llvm-svn: 101161
2010-04-13 18:43:37 +00:00
Fariborz Jahanian
7e9d52aaca
Variation of objc_copyStruct API generation when
...
property (atomic/nonatomic) is of aggregate type with
gc'able member objects) (NeXT runtime).
llvm-svn: 101156
2010-04-13 18:32:24 +00:00
Chris Lattner
ff0e2a36e2
Rework the ConstStructBuilder code to emit missing initializer
...
elements with explicit zero values instead of with tail padding.
On an example like this:
struct foo { int a; int b; };
struct foo fooarray[] = {
{1, 2},
{4},
};
We now lay this out as:
@fooarray = global [2 x %struct.foo] [%struct.foo { i32 1, i32 2 }, %struct.foo { i32 4, i32 0 }]
instead of as:
@fooarray = global %0 <{ %struct.foo { i32 1, i32 2 }, %1 { i32 4, [4 x i8] zeroinitializer } }>
Preserving both the struct type of the second element, but also the array type of the entire thing.
llvm-svn: 101155
2010-04-13 18:16:19 +00:00
Chris Lattner
d8d760ce66
unbreak tests.
...
llvm-svn: 101153
2010-04-13 17:57:11 +00:00
Chris Lattner
cfa3e7ae6a
move a bunch of ConstStructBuilder methods out of line.
...
llvm-svn: 101152
2010-04-13 17:45:57 +00:00
Chris Lattner
7a4a29f89a
minor cleanups
...
llvm-svn: 101151
2010-04-13 17:39:09 +00:00
Fariborz Jahanian
08b0f66d2e
Add support for objc_copyStruct to enforce
...
atomicity of aggregate properties in setter/getter
methods. wip.
llvm-svn: 101107
2010-04-13 00:38:05 +00:00
Devang Patel
74c10507a6
Fix debug info for cleanup block.
...
llvm-svn: 101100
2010-04-13 00:08:43 +00:00
Chris Lattner
933f67887f
fix PR6660/6168: emit padding as zeros instead of undef. Because
...
trailing fields may not be represented in initializer lists, they
are being handled as padding and those fields *must* be zero
initialized.
llvm-svn: 101067
2010-04-12 21:10:05 +00:00
Daniel Dunbar
f9c24f8403
IRgen: Factor out ComputeBitFieldInfo.
...
llvm-svn: 101066
2010-04-12 21:01:28 +00:00
Fariborz Jahanian
5a8c2034a4
Add some API code for future work.
...
llvm-svn: 101052
2010-04-12 18:18:10 +00:00
Daniel Dunbar
b97bff9aa9
IRgen: Add CGRecordLayout::dump, and dump (irgen) record layouts as part of -fdump-record-layouts.
...
llvm-svn: 101051
2010-04-12 18:14:18 +00:00
Anders Carlsson
1c0f8bb4ce
Have the CXXBaseOrMemberInitializer keep track of whether an initializer initializes a virtual base or not.
...
llvm-svn: 101004
2010-04-12 00:51:03 +00:00
Anders Carlsson
3383e2ad74
Fix another bug where we wouldn't generate secondary vtables for construction vtables in some cases.
...
llvm-svn: 100998
2010-04-11 22:20:36 +00:00
Anders Carlsson
d78b224e91
More renames.
...
llvm-svn: 100991
2010-04-11 22:07:06 +00:00
Anders Carlsson
b41c633a34
Rename a function parameter.
...
llvm-svn: 100990
2010-04-11 22:03:57 +00:00
Anders Carlsson
de0338abac
Clarify an assertion.
...
llvm-svn: 100986
2010-04-11 20:23:06 +00:00
Anders Carlsson
343a26b56d
Fix a bug where we were adding too many vcall offsets in some cases.
...
llvm-svn: 100985
2010-04-11 20:04:11 +00:00
Anders Carlsson
0b5522114e
Enable an assert and remove a now unnecessary assert.
...
llvm-svn: 100953
2010-04-10 21:50:08 +00:00
Anders Carlsson
88cf34f2b4
Fix a bug where we would add the same function twice in a vtable.
...
llvm-svn: 100949
2010-04-10 20:39:29 +00:00
Chris Lattner
bd7b0a8d55
revert 100942, pending discussion.
...
llvm-svn: 100946
2010-04-10 19:33:39 +00:00
Anders Carlsson
be1b9cbc63
Rename VtableComponent and VtableBuilder.
...
llvm-svn: 100945
2010-04-10 19:13:06 +00:00
David Chisnall
916fb83f39
Fix for PR6811.
...
llvm-svn: 100942
2010-04-10 19:06:38 +00:00
Chris Lattner
bc3be65d2e
fix PR6805: llvm.objectsize changed to take an i1 instead of an i32.
...
llvm-svn: 100938
2010-04-10 18:34:14 +00:00
Benjamin Kramer
1554e4a4bb
A bunch of string-related microoptimizations in Mangler.
...
llvm-svn: 100928
2010-04-10 16:03:31 +00:00
Benjamin Kramer
2e8ca0b86d
Fix use after free. Incrementing an use_iterator after its user is erased is unsafe.
...
llvm-svn: 100926
2010-04-10 11:02:40 +00:00
John McCall
e2f3524f83
Doug pointed out that we have a perfectly reasonable expression here to
...
serve as a source of source locations for the can't-yet-mangle diagnostic.
llvm-svn: 100924
2010-04-10 09:39:25 +00:00
Gabor Greif
d394aec87d
rely even less on CallInst internals
...
llvm-svn: 100919
2010-04-10 03:45:50 +00:00
Gabor Greif
d0ef1346f3
do not rely on CallInst interna, use CallSite to access arguments
...
llvm-svn: 100918
2010-04-10 02:56:12 +00:00
John McCall
e8917e0fd2
Mangle some expressions with codegen implications but no mangling "overhead".
...
llvm-svn: 100909
2010-04-09 22:54:09 +00:00
John McCall
6936c863b0
Provide an extremely unsatisfactory diagnostic (instead of crashing) when
...
mangling an unknown expression kind. Also conveniently tells the user what
kind of expression they should add to the mangler!
llvm-svn: 100907
2010-04-09 22:26:14 +00:00
John McCall
09277542f2
Provide manglings for bool and character literal expressions. These are
...
just integer-literal expressions with special case implementations in the AST.
Fixes rdar://problem/7825453.
llvm-svn: 100905
2010-04-09 21:48:08 +00:00
Anders Carlsson
af2a317e05
Rename CGVtable files to CGVTables.
...
llvm-svn: 100778
2010-04-08 16:30:25 +00:00
Anders Carlsson
ae9e9a63bd
Clarify an assert.
...
llvm-svn: 100776
2010-04-08 16:18:36 +00:00
Douglas Gregor
bc6a434773
Unbreak the build
...
llvm-svn: 100775
2010-04-08 16:07:47 +00:00
Douglas Gregor
eadd3cace9
Eliminate excessive PCH deserialization caused by the search for
...
__cxxabiv1::__fundamental_type_info in every translation
unit. Previously, we would perform name lookup for
__cxxabiv1::__fundamental_type_info at the end of IRGen for a each
translation unit, to determine whether it was present. If so, we we
produce type information for all of the fundamental types. However,
this name lookup causes PCH deserialization of a significant part of the
translation unit, which has a woeful impact on performance.
With this change, we now look at each record type after we've
generated its vtable to see if it is
__cxxabiv1::__fundamental_type_info. If so, we generate type info for
all of the fundamental types. This works because
__cxxabiv1::__fundamental_type_info should always have a key function
(typically the virtual destructor), that will be defined once in the
support library. The fundamental type information will end up there.
Fixes <rdar://problem/7840011>.
llvm-svn: 100772
2010-04-08 15:52:03 +00:00
Daniel Dunbar
c75c8bd757
IRgen: Move the bit-field access type into CGBitFieldInfo, and change bit-field LValues to just store the base address of object containing the bit-field.
...
llvm-svn: 100745
2010-04-08 02:59:45 +00:00
John McCall
8586bfd85d
@llvm.sqrt isn't really close enough to C's sqrt to justify emitting calls
...
to the intrinsic, even when math-errno is off.
Fixes rdar://problem/7828230 by falling back on the library function.
llvm-svn: 100613
2010-04-07 08:20:20 +00:00
Chris Lattner
fdb76ccfb4
a ridiculous amount of propagation through the backend later,
...
have the code generate slap a srcloc metadata on inline asm nodes.
This allows us to diagnose invalid inline asms with such nice
diagnostics as:
<inline asm>:1:2: error: unrecognized instruction
abc incl %eax
^
asm.c:2:12: note: generated from here
__asm__ ("abc incl %0" : "+r" (X));
^
2 diagnostics generated.
llvm-svn: 100608
2010-04-07 05:46:54 +00:00
Chris Lattner
c0e8a59ac9
fit in 80 cols
...
llvm-svn: 100534
2010-04-06 17:29:22 +00:00
Daniel Dunbar
196ea449ed
IRgen: Move BitFieldIsSigned bit into CGBitFieldInfo.
...
llvm-svn: 100513
2010-04-06 01:07:44 +00:00
Daniel Dunbar
d45491077a
Simplify.
...
llvm-svn: 100512
2010-04-06 01:07:41 +00:00
Daniel Dunbar
60d81e8611
Simplify.
...
llvm-svn: 100511
2010-04-06 01:07:39 +00:00
Daniel Dunbar
dc406b8e92
IRgen: Move BitField LValues to just hold a reference to the CGBitFieldInfo.
...
- Unfortunately, this requires some horrible code in CGObjCMac which always
allocats a CGBitFieldInfo because we don't currently build a proper layout
for Objective-C classes. It needs to be cleaned up, but I don't want the
bit-field cleanups to be blocked on that.
llvm-svn: 100474
2010-04-05 21:36:35 +00:00
Devang Patel
a2c048eaf8
Emit debug info for objc getters and setters.
...
llvm-svn: 100462
2010-04-05 21:09:15 +00:00
Daniel Dunbar
cd3d5e76ce
IRgen: Lift BitFieldInfo to CGBitFieldInfo at namespace level.
...
llvm-svn: 100433
2010-04-05 16:20:44 +00:00
Daniel Dunbar
b76c4cd5ec
Add a FIXME and reduce nesting.
...
llvm-svn: 100432
2010-04-05 16:20:33 +00:00
Mon P Wang
cc2ab0cdc9
Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
...
llvm-svn: 100305
2010-04-04 03:10:52 +00:00
Rafael Espindola
8e7ca8e0b1
Don't produce a vtable for a class if we have an explicit template instantiation declaration and no key function. We will produce the vtable at the explicit template instantiation.
...
Fixes PR6748
llvm-svn: 100266
2010-04-03 04:26:42 +00:00
Daniel Dunbar
7e5aba433d
IRgen/NeXT: Remove my refactoring-enabling asserts, and add a FIXME.
...
llvm-svn: 100237
2010-04-02 22:29:40 +00:00
Daniel Dunbar
8c7f981833
IRgen/Obj-C: Eliminate FindIvarInterface, now that ivar's are in the right DeclContexts (-2 FIXMEs). We still have an annoying linear scan + hidden dependency on how Obj-C layout is done.
...
- This is also an algorithmic improvement in IRgen for Obj-C, although it probably doesn't matter in practice.
llvm-svn: 100228
2010-04-02 21:14:02 +00:00
Chris Lattner
18a584b56c
NewDebugLoc got renamed to DebugLoc.
...
llvm-svn: 100219
2010-04-02 20:21:43 +00:00
Mon P Wang
f7f3bff646
Revert r100193 since it causes failures in objc in clang
...
llvm-svn: 100200
2010-04-02 18:43:42 +00:00
Douglas Gregor
45cf7e3d2a
Rework our handling of copy construction of temporaries, which was a
...
poor (and wrong) approximation of the actual rules governing when to
build a copy and when it can be elided.
The correct implementation is actually simpler than the
approximation. When we only enumerate constructors as part of
initialization (e.g., for direct initialization or when we're copying
from a class type or one of its derived classes), we don't create a
copy. When we enumerate all conversion functions, we do create a
copy. Before, we created some extra copies and missed some
others. The new test copy-initialization.cpp shows a case where we
missed creating a (required, non-elidable) copy as part of a
user-defined conversion, which resulted in a miscompile. This commit
also fixes PR6757, where the missing copy made us reject well-formed
code in the ternary operator.
This commit also cleans up our handling of copy elision in the case
where we create an extra copy of a temporary object, which became
necessary now that we produce the right copies. The code that seeks to
find the temporary object being copied has moved into
Expr::getTemporaryObject(); it used to have two different
not-quite-the-same implementations, one in Sema and one in CodeGen.
Note that we still do not attempt to perform the named return value
optimization, so we miss copy elisions for return values and throw
expressions.
llvm-svn: 100196
2010-04-02 18:24:57 +00:00
Mon P Wang
4b82a88764
Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
...
llvm-svn: 100193
2010-04-02 18:04:30 +00:00
Daniel Dunbar
031d4d40d0
CG/NeXT: Assert some invariants on an ivar's containing decl context that I am about to refactor based on, following some testing.
...
llvm-svn: 100188
2010-04-02 15:43:29 +00:00
Chris Lattner
e675d0f924
adjust to IRBuilder change and use faster DebugLoc apis.
...
llvm-svn: 100093
2010-04-01 06:31:43 +00:00
Douglas Gregor
0208535fda
Extend DependentNameType with a keyword enum that specifies whether
...
this was parsed as a typename-specifier, elaborated-type-specifier
(including the kind), or just a dependent qualified type name.
llvm-svn: 100039
2010-03-31 20:19:30 +00:00
Douglas Gregor
c1d2d8a014
Rename TypenameType to DependentNameType in anticipation of some
...
refactoring work in this area.
llvm-svn: 100019
2010-03-31 17:34:00 +00:00
Benjamin Kramer
9e2e1c9024
Minor include pruning.
...
llvm-svn: 100007
2010-03-31 15:04:05 +00:00
Chris Lattner
be49c03ff4
use the new optimized debug info metadata accessors. In
...
addition to the inherent win, this eliminates the pointless
cost of going through the name -> mdkind stringmap that we
were paying.
llvm-svn: 99983
2010-03-31 03:36:01 +00:00
Daniel Dunbar
034299ef25
IRGen: Move the auxiliary data structures tracking AST -> LLVM mappings out of CodeGenTypes, to per-record CGRecordLayout structures.
...
- I did a cursory check that this was perf neutral, FWIW.
llvm-svn: 99978
2010-03-31 01:09:11 +00:00
Daniel Dunbar
e75a64f2d3
CGRecordLayoutBuilder: Switch unions to use same mechanism for tracking field and bit-field info as structs.
...
- Anders, please check.
llvm-svn: 99977
2010-03-31 00:55:13 +00:00
Douglas Gregor
d7f18dd750
Drastically simplify the computation of linkage for typeinfo by using
...
the existing (and already well-tested) linkage computation for types,
with minor tweaks for dynamic classes and (pointers to) incomplete
types. Fixes PR6597.
llvm-svn: 99968
2010-03-31 00:15:35 +00:00
Daniel Dunbar
23ee4b7710
IRGen: Hide CGRecordLayoutBuilder class, because I can.
...
llvm-svn: 99967
2010-03-31 00:11:27 +00:00
John McCall
d9c7c6568e
Introduce a new kind of derived-to-base cast which bypasses the need for
...
null checks, and make sure we elide null checks when accessing base class
members.
llvm-svn: 99963
2010-03-30 23:58:03 +00:00
Bob Wilson
adb58e32cc
Revert Mon Ping's 99930 due to broken llvm-gcc buildbots.
...
llvm-svn: 99949
2010-03-30 22:28:46 +00:00
Daniel Dunbar
6915cbe7a2
IRGen: Narrow getCGRecordLayout type.
...
llvm-svn: 99946
2010-03-30 22:26:12 +00:00
Daniel Dunbar
072d0bb247
IRgen: Move CGRecordLayout to its own happy little file.
...
llvm-svn: 99945
2010-03-30 22:26:10 +00:00
Daniel Dunbar
f4ffa0dabf
Minor formatting/FIXME cleanups.
...
llvm-svn: 99944
2010-03-30 22:26:07 +00:00
Rafael Espindola
49b85ab6e6
Remember the regparm attribute in FunctionType::ExtInfo.
...
Fixes PR3782.
llvm-svn: 99940
2010-03-30 22:15:11 +00:00
Mon P Wang
231e99743a
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset
...
llvm-svn: 99930
2010-03-30 21:02:45 +00:00
Rafael Espindola
c50c27cca8
the big refactoring bits of PR3782.
...
This introduces FunctionType::ExtInfo to hold the calling convention and the
noreturn attribute. The next patch will extend it to include the regparm
attribute and fix the bug.
llvm-svn: 99920
2010-03-30 20:24:48 +00:00
Rafael Espindola
ff6a1fc1f3
Don't produce a vtable if we are just instantiating a method and the
...
class has no key function.
Fix PR6738.
llvm-svn: 99900
2010-03-30 18:07:27 +00:00
Benjamin Kramer
9e649c3cfe
Replace some constant-sized SmallVectors.
...
llvm-svn: 99884
2010-03-30 11:36:44 +00:00
Anders Carlsson
f141dd1b95
Remove the old vtable layout code.
...
llvm-svn: 99869
2010-03-30 03:43:47 +00:00
Anders Carlsson
a086edc0e6
Remove UseNewVTableCode checks.
...
llvm-svn: 99868
2010-03-30 03:35:35 +00:00
Anders Carlsson
9d08fc1cd2
Use the new function in EmitClassAggrMemberwiseCopy, fixing the same assert as seen in PR6628 but for arrays this time.
...
llvm-svn: 99867
2010-03-30 03:30:08 +00:00
Anders Carlsson
093bdff0c5
Factor emitting a call to a copy constructor out into a separate function.
...
llvm-svn: 99866
2010-03-30 03:27:09 +00:00
Anders Carlsson
b9fd57f198
Introduce a CXXTemporariesCleanupScope RAII object and use it to cleanup the temporaries code.
...
llvm-svn: 99865
2010-03-30 03:14:41 +00:00
Anders Carlsson
10834b8d56
Handle default arguments when calling copy constructors for bases or members when synthesizing a copy constructor. Fixes PR6628.
...
llvm-svn: 99864
2010-03-30 02:57:48 +00:00
Anders Carlsson
85e64359df
Flip the switch and use the new vtable layout code for everything. I've verified that this passes a self-host but I'll let the bots self host as well before removing the now dead code.
...
llvm-svn: 99861
2010-03-30 02:21:54 +00:00
Ted Kremenek
dbb8cd1d34
Cache results computed by CGDebugInfo::getOrCreateFile() in a DenseMap.
...
This reduces '-c -g' time on one file in 403.gcc by 12%.
llvm-svn: 99857
2010-03-30 00:27:51 +00:00
Ted Kremenek
ac031880af
Remove FIXME comment.
...
llvm-svn: 99828
2010-03-29 19:10:41 +00:00
Ted Kremenek
23c29f0cbe
Change 'TypeCache' from being an std::map to a llvm::DenseMap. This reduces codegen time
...
on one .i file from 403.gcc by 0.5%.
llvm-svn: 99823
2010-03-29 18:29:57 +00:00
Chris Lattner
5902e7bb22
emit signed integer subtractions as 'sub nsw', patch by
...
Anton Yartsev!
llvm-svn: 99817
2010-03-29 17:28:16 +00:00
Anders Carlsson
eba1a60ef0
Another vtable layout fix, making us match gcc better.
...
llvm-svn: 99812
2010-03-29 15:08:41 +00:00
Anders Carlsson
cb6207f723
Handle pure virtual member functions.
...
llvm-svn: 99807
2010-03-29 05:40:50 +00:00
Anders Carlsson
a627ac7ee6
More vtable work - it's not possible to use the new vtable code for everything by setting a flag inside CGVtable.cpp. My plan is to run some tests and bootstrap and once that's done flip the bit.
...
llvm-svn: 99804
2010-03-29 03:38:52 +00:00
Anders Carlsson
800ded68b5
Only add thunks for the most derived class. This fixes some link errors I was seeing in files generated by the vtable tester utility.
...
llvm-svn: 99801
2010-03-29 02:53:58 +00:00
Anders Carlsson
383f4cc8b9
Flip the switch to always get vtables from the VTT when necessary, I've verified that clang bootstraps with this.
...
llvm-svn: 99800
2010-03-29 02:38:51 +00:00
Anders Carlsson
2d016af623
Use the newly added function in the VTT builder.
...
llvm-svn: 99799
2010-03-29 02:14:35 +00:00
Anders Carlsson
f6f24c609b
Cleanup, no functionality change.
...
llvm-svn: 99798
2010-03-29 02:08:26 +00:00
Anders Carlsson
9a97e2ef95
Add the thunks needed by this vtable.
...
llvm-svn: 99793
2010-03-29 01:38:05 +00:00
Anders Carlsson
848d86e5c4
Make sure to sort the vtable thunks by their vtable index :) With this we now pass the test from http://www.codesourcery.com/public/cxx-abi/abi-examples.html#vtable-ctor successfully.
...
llvm-svn: 99792
2010-03-29 01:28:05 +00:00
Anders Carlsson
948d3f4ec6
Fix another thinko, so that flags don't depend on previous bases.
...
llvm-svn: 99791
2010-03-29 01:16:41 +00:00
Anders Carlsson
74d7dfcf8e
When generating base ctors/dtors, we need to lookup virtual bases using the vtable.
...
llvm-svn: 99790
2010-03-29 01:14:25 +00:00
Anders Carlsson
27d86bddfe
Fix thinko.
...
llvm-svn: 99788
2010-03-29 01:12:13 +00:00
Anders Carlsson
5889027ccc
Use construction vtables when needed. This is currently guarded by -fdump-vtable-layouts since it doesn't work 100% yet :)
...
llvm-svn: 99787
2010-03-29 01:08:49 +00:00
Anders Carlsson
8baeaf0a26
Two bug fixes, we weren't updating the thunk index when creating the vtable initializer and we weren't storing the secondary virtual pointer indices.
...
llvm-svn: 99786
2010-03-29 01:04:16 +00:00
Anders Carlsson
d589593c93
Reapply r99775 with a fix for a silly bug - we were setting the vtable pointer for all bases, even those without a vtable pointer :)
...
llvm-svn: 99777
2010-03-28 21:07:49 +00:00
Anders Carlsson
fcc9f91287
Looks like I broke self-host again :(.
...
llvm-svn: 99776
2010-03-28 20:55:21 +00:00
Anders Carlsson
74eab715ae
More improvements to setting the vtable pointer. We now no longer set the vtable pointer for non-virtual primary bases. We also do a pre-order traversal of the class hierarchy; this is necessary in order to get the right vbase offset offsets in base ctors/dtors.
...
llvm-svn: 99775
2010-03-28 20:34:31 +00:00
Anders Carlsson
e87fae9afa
Factor vtable pointer setting code out into a separate function.
...
llvm-svn: 99773
2010-03-28 19:40:00 +00:00
Anders Carlsson
174376629a
Give thunks the same linkage as their original methods.
...
llvm-svn: 99729
2010-03-27 20:50:27 +00:00
Rafael Espindola
adcc1d18e2
When given the magic class __cxxabiv1::__fundamental_type_info, produce
...
the typeinfo for the fundamental types.
Fixes PR6685.
llvm-svn: 99701
2010-03-27 02:52:14 +00:00
John McCall
39ec71f2e9
When mapping restrict to noalias, look for 'restrict' on the parameter variable
...
instead of the canonical parameter type (which has correctly dropped all such
direct qualifiers). Fixes PR6695.
llvm-svn: 99688
2010-03-27 00:47:27 +00:00
Nick Lewycky
3cfe6af8b5
Implement new mangling for vectors.
...
llvm-svn: 99616
2010-03-26 07:18:04 +00:00
Anders Carlsson
aaf8acfea1
Revert r99612 and see if it fixes self-host.
...
llvm-svn: 99614
2010-03-26 06:35:42 +00:00
Anders Carlsson
6fffc64dd2
Don't initialize virtual pointers for primary bases, they've already been initialized.
...
llvm-svn: 99612
2010-03-26 05:53:12 +00:00
Anders Carlsson
1f9348c1fc
Simplify InitializeVtablePtrs in preparation of making it work with construction vtables.
...
llvm-svn: 99609
2010-03-26 04:39:42 +00:00
Anders Carlsson
f1a994ce33
Add and implement CodeGenVTables::getSecondaryVirtualPointerIndex (not used yet).
...
llvm-svn: 99608
2010-03-26 04:23:58 +00:00
Anders Carlsson
92d95f2f7b
Use the new vtable layout code for construction vtables.
...
llvm-svn: 99606
2010-03-26 04:13:46 +00:00
Anders Carlsson
5670d96524
More cleanup.
...
llvm-svn: 99605
2010-03-26 04:10:39 +00:00
Anders Carlsson
a208b3997d
Way more VTT builder cleanup.
...
llvm-svn: 99604
2010-03-26 03:56:54 +00:00
Anders Carlsson
45bd753b4a
More VTT builder cleanup.
...
llvm-svn: 99588
2010-03-26 00:58:21 +00:00
Anders Carlsson
c1b4747d5a
More VTT cleanup.
...
llvm-svn: 99586
2010-03-26 00:50:17 +00:00
Anders Carlsson
e67698bd73
Start cleaning up the VTT builder to make it work more like the VTable builder.
...
llvm-svn: 99581
2010-03-26 00:35:45 +00:00
Anders Carlsson
382a96550b
Remove some VTT builder arguments that were always zero.
...
llvm-svn: 99576
2010-03-26 00:11:51 +00:00
Fariborz Jahanian
f9c4585c80
Fix a code gen. bug involving generation of getter method
...
from properties of _Complex type. (radar 7351147).
llvm-svn: 99558
2010-03-25 21:56:43 +00:00
Anders Carlsson
151b062fee
Don't add address points for virtual primary bases that aren't primary bases in the complete class.
...
llvm-svn: 99555
2010-03-25 21:45:14 +00:00
Daniel Dunbar
3f540c0d7d
Remove support for nand atomic builtins. They are inconsistently implemented in
...
gcc, and the common expectation seems to be that they are unused. If and when
someone cares we can add them back with well documented demantics.
llvm-svn: 99522
2010-03-25 17:13:09 +00:00
Anders Carlsson
a5736bde2e
Use the new vtable layout code for construction vtables.
...
llvm-svn: 99516
2010-03-25 16:49:53 +00:00
Anders Carlsson
a4147148ff
When -fdump-vtable-layouts is specified, construction vtable initializers will be generated using the new vtable layout code. (The code is still not completely in place but this is a huge step forward).
...
llvm-svn: 99508
2010-03-25 15:26:28 +00:00
Anders Carlsson
d03325c54f
More address point map shuffling.
...
llvm-svn: 99462
2010-03-25 00:51:13 +00:00
Anders Carlsson
0534b0201e
Shuffle some code around; this will make it easier to use the new layout code for address points.
...
llvm-svn: 99461
2010-03-25 00:35:49 +00:00
Douglas Gregor
02dde146e0
When returning from a function that has a reference return type, use
...
EmitReferenceBindingToExpr() rather than assuming we have an
lvalue. This is just the lowest hanging fruit for PR6024, which still
requires a bit of work.
llvm-svn: 99447
2010-03-24 23:14:04 +00:00
Douglas Gregor
2538674a98
Change two class forward declarations to struct forward declarations, silencing a Clang warning
...
llvm-svn: 99405
2010-03-24 16:59:08 +00:00
Fariborz Jahanian
47b4629b3b
Code gen for multi-dimensional dynamic allocations.
...
Fixes PR6641.
llvm-svn: 99404
2010-03-24 16:57:01 +00:00
Anders Carlsson
e90954de64
More vtable improvements. We now compute and keep track of all vtable related information which avoids computing the same vtable layout over and over.
...
llvm-svn: 99403
2010-03-24 16:42:11 +00:00
Anders Carlsson
67fbf9853f
Use getNamedGlobal instead of getGlobalVariable. (Fixes self-host).
...
llvm-svn: 99385
2010-03-24 05:32:05 +00:00
Anders Carlsson
b35ea55e2e
More vtable work; preparations for moving over to the new vtable layout code (finally).
...
llvm-svn: 99381
2010-03-24 03:57:14 +00:00
Anders Carlsson
95e0223baf
Remove old thunks code.
...
llvm-svn: 99374
2010-03-24 00:57:54 +00:00
Anders Carlsson
68fdb871dc
Flip the switch and use the new vtable layout code for thunks by default. Add a thunks.cpp test.
...
llvm-svn: 99367
2010-03-24 00:41:37 +00:00
Anders Carlsson
bad991dbfd
Add CodeGenFunction::GenerateThunk and implement it.
...
llvm-svn: 99365
2010-03-24 00:39:18 +00:00
Anders Carlsson
4a3cdf5ac7
Minor cleanup.
...
llvm-svn: 99364
2010-03-24 00:35:44 +00:00
Rafael Espindola
fa1708fdea
revert 99311. Looks like it broke darwin bootstrap.
...
llvm-svn: 99317
2010-03-23 19:55:22 +00:00
Rafael Espindola
4d3745ade6
Avoid producing implicit methods when we have a explicit template instantiation
...
declaration.
llvm-svn: 99311
2010-03-23 18:56:16 +00:00
Fariborz Jahanian
6c67b90752
Code gen for compound assignment of complex
...
types using property syntax to access setter/getters.
(also radar 7351147).
llvm-svn: 99307
2010-03-23 18:43:00 +00:00
Anders Carlsson
55e89f877c
More work on thunks - don't assert if there's a variable with the same name as the thunk already.
...
llvm-svn: 99303
2010-03-23 18:18:41 +00:00
Fariborz Jahanian
3131496622
Patch to implement code gen. use of compound assignent on
...
properties of complex type. Radar 7351147.
llvm-svn: 99299
2010-03-23 18:08:50 +00:00
Anders Carlsson
cd836f0b5f
More thunks scaffolding.
...
llvm-svn: 99294
2010-03-23 17:17:29 +00:00
Anders Carlsson
5c5abad5d9
More work on thunks.
...
llvm-svn: 99287
2010-03-23 16:36:50 +00:00
Anders Carlsson
274fc82289
Move ThunkInfo as well.
...
llvm-svn: 99280
2010-03-23 15:17:13 +00:00
Anders Carlsson
67fd3a50dc
Move ReturnAdjustment and ThisAdjustment out into CGVtable.h
...
llvm-svn: 99279
2010-03-23 15:13:06 +00:00
Anders Carlsson
995891667f
Use the canonical destructor, which fixes the self-host build. Thanks to Eli for noticing.
...
llvm-svn: 99260
2010-03-23 05:15:24 +00:00
Anders Carlsson
917229cf75
Baby steps towards making thunks be emitted from the new vtable layout code.
...
llvm-svn: 99254
2010-03-23 04:59:02 +00:00
Anders Carlsson
7cea12ff9b
Some renames.
...
llvm-svn: 99253
2010-03-23 04:44:10 +00:00
Anders Carlsson
af82f63b47
Always emit associated thunks when emitting the function itself. Remove getVtableAddressPoint, it's not used.
...
llvm-svn: 99252
2010-03-23 04:31:31 +00:00
Anders Carlsson
8841024a7c
Rename MaybeEmitVtable to EmitVTableRelatedData in preparation for making it emit thunks as well.
...
llvm-svn: 99251
2010-03-23 04:15:00 +00:00
Anders Carlsson
a864caff8c
Rename CGVtableInfo to CodeGenVTables in preparation of adding another VTableInfo class.
...
llvm-svn: 99250
2010-03-23 04:11:45 +00:00
Douglas Gregor
65f7a3f801
Comment the reasons for the strange little dance we do with the main file name for debug information
...
llvm-svn: 99215
2010-03-22 21:28:29 +00:00
Anders Carlsson
290c6ed7c7
More work on thunks; almost there now.
...
llvm-svn: 99199
2010-03-22 20:06:40 +00:00
Anders Carlsson
7eb99a607d
Add less than operators to ThisAdjustment, ReturnAdjustment and ThunkInfo. Sort the thunks before dumping them.
...
llvm-svn: 99184
2010-03-22 16:30:44 +00:00
Anders Carlsson
53a47bf901
Improve dumping of thunks.
...
llvm-svn: 99181
2010-03-22 16:10:59 +00:00
Anders Carlsson
64decd3586
We want to add all thunks, not just 'this' adjustment thunks.
...
llvm-svn: 99177
2010-03-22 15:47:01 +00:00
Anders Carlsson
4b2411e9d2
AddThunk should take a const reference.
...
llvm-svn: 99140
2010-03-21 20:27:14 +00:00
Rafael Espindola
46b7987f85
Fix PR6648 by not creating a temporary with the type of a
...
CXXExprWithTemporaries.
Not emitting the expression as an aggregate might be the right thing to do,
but is orthogonal. Emitting it as an scalar expression will still try to
create a temporary for the incomplete type of the CXXExprWithTemporaries and
fail.
llvm-svn: 99134
2010-03-21 17:11:05 +00:00
David Chisnall
12ae54d42f
Fixed synthesizing properties declared in properties (GNU runtime).
...
llvm-svn: 99077
2010-03-20 19:53:29 +00:00
Daniel Dunbar
4ff562d557
IRgen: Wrap atomic intrinsics with memory barriers, to ensure we honor the semantics.
...
- This should be conservatively correct, we eventually should have target hooks for platforms that are less strict.
llvm-svn: 99050
2010-03-20 07:04:11 +00:00
Daniel Dunbar
fe06df4bf3
C++: Add support for -fno-use-cxa-atexit.
...
- So much typing, so little gain...
Also, rename the __cxx_global_initialization function just to match llvm-gcc.
llvm-svn: 99039
2010-03-20 04:15:41 +00:00
Daniel Dunbar
7572284f4f
IRgen: Inline GenerateCXXGlobal[VarDecl]InitFunc into sole caller.
...
llvm-svn: 99038
2010-03-20 04:15:29 +00:00
John McCall
7ec5043c2c
Change CodeGenModule to rely on the Module's symbol table instead of
...
shadowing it in the GlobalDeclMap. Eliminates the string-uniquing
requirement for mangled names, which should help C++ codegen times a little.
Forces us to do string lookups instead of pointer lookups, which might hurt
codegen times a little across the board. We'll see how it plays out.
Removing the string-uniquing requirement implicitly fixes any bugs like
PR6635 which arose from the fact that we had multiple uniquing tables for
different kinds of identifiers.
llvm-svn: 99012
2010-03-19 23:29:14 +00:00
Douglas Gregor
fc7a4813ab
Try to improve computation of the main file name for debug
...
information, to address recent gdb failures.
llvm-svn: 98959
2010-03-19 14:49:09 +00:00
Douglas Gregor
c6b5a3df1e
For debug information, get the main file name from the source manager
...
rather than from the -main-file-name flag, since the source manager
has proper path information. Fixes <rdar://problem/7769538>.
llvm-svn: 98898
2010-03-18 23:46:43 +00:00
Benjamin Kramer
966e934b34
Replace some SmallVectors with arrays.
...
llvm-svn: 98833
2010-03-18 16:59:57 +00:00
Anders Carlsson
18c582d9c8
When dumping vtables, also dump the thunks.
...
llvm-svn: 98799
2010-03-18 02:44:19 +00:00
Anders Carlsson
56446146fd
More work on thunks.
...
llvm-svn: 98765
2010-03-17 20:06:32 +00:00
Rafael Espindola
cd7eef900f
Correctly mangle dependent TypenameType.
...
Fixes PR6625.
llvm-svn: 98707
2010-03-17 04:28:11 +00:00
David Chisnall
2bfc50bf68
Fixed copy-and-paste error causing categories to contain the protocols declared on the class, not the protocols declared on the category.
...
llvm-svn: 98455
2010-03-13 22:20:45 +00:00
Douglas Gregor
b14d123774
Give explicit template instantiations weak ODR linkage. Former
...
iterations of this patch gave explicit template instantiation
link-once ODR linkage, which permitted the back end to eliminate
unused symbols. Weak ODR linkage still requires the symbols to be
generated.
llvm-svn: 98441
2010-03-13 18:23:07 +00:00
Benjamin Kramer
69b3c43391
Use raw_ostream instead of sprintf.
...
llvm-svn: 98438
2010-03-13 12:06:51 +00:00
Kovarththanan Rajaratnam
ba2c65277a
Use SmallString instead of SmallVector
...
llvm-svn: 98436
2010-03-13 10:17:05 +00:00
Douglas Gregor
17b76185f1
Re-revert the explicit template instantiation linkage patch. I am beginning to look incompetent
...
llvm-svn: 98425
2010-03-13 03:49:57 +00:00
Douglas Gregor
89cae0f224
Reinstate patch to turn explicit template instantiations into weak symbols
...
llvm-svn: 98424
2010-03-13 03:14:19 +00:00
Jeffrey Yasskin
f6442f80cb
Allow users to set CPPFLAGS and CXXFLAGS on the make command line.
...
Tested: make CPPFLAGS=-m64 CXXFLAGS=-m64 -j8 && (cd tools/clang;make test)
llvm-svn: 98399
2010-03-12 22:55:16 +00:00
Fariborz Jahanian
c6140734c5
Fix a rare corner case bug which exposed a serious block API generation
...
when initialized variable is a byref block variable and is referenced recursively
in the initializer (you guessed it, it is block implementation of
fibonacci number). Fix, on the other hand is trvial, by generating the
API for byref variable before API for its initializer. We will have this
test added to our internal test suite as a clang-style test is not possible
due to very convoluted IR sequence. Fixes radar 7745514.
llvm-svn: 98393
2010-03-12 21:40:43 +00:00
Devang Patel
a42d3ea60e
If main file name is empty then use "<unknown>".
...
llvm-svn: 98385
2010-03-12 21:04:27 +00:00
Anders Carlsson
5d3b901e48
More this adjustment simplification.
...
llvm-svn: 98333
2010-03-12 05:28:07 +00:00
Douglas Gregor
539bc40906
Revert the linkage change for explicit template instantiations; something is amiss
...
llvm-svn: 98332
2010-03-12 05:13:59 +00:00
Anders Carlsson
3c289673d6
Remove OldOffset.
...
llvm-svn: 98331
2010-03-12 05:02:01 +00:00
Anders Carlsson
2b2b8f1949
Remove debug output.
...
llvm-svn: 98330
2010-03-12 04:55:20 +00:00
Anders Carlsson
8a2402989d
Begin simplifying handling of thunks.
...
llvm-svn: 98329
2010-03-12 04:54:20 +00:00
Douglas Gregor
ee3f72299c
Give explicit template instantiations weak linkage (but don't defer
...
them). Fixes PR6578.
llvm-svn: 98328
2010-03-12 04:49:06 +00:00
Devang Patel
01bb5ce932
Keep track of Record context to ensure that record elements are properly nested in debug info.
...
llvm-svn: 98283
2010-03-11 20:01:48 +00:00
Chris Lattner
9723d6c699
fix PR6433, crash on va_arg of typedef.
...
llvm-svn: 98264
2010-03-11 18:19:55 +00:00
Anders Carlsson
dd819c981f
Use the new vtable layout code for computing virtual base offset offsets.
...
llvm-svn: 98257
2010-03-11 16:06:20 +00:00
Rafael Espindola
4d5c3d99e5
Correctly mangle address of member in template arguments. Fixes PR6460
...
llvm-svn: 98254
2010-03-11 14:07:00 +00:00
Anders Carlsson
4cbe83cccb
Rename getVirtualBaseOffsetIndex to getVirtualBaseOffsetOffset to reflect what it actually does.
...
llvm-svn: 98248
2010-03-11 07:15:17 +00:00
Anders Carlsson
e4424888e4
When possible, use the vbase offset offsets from the most derived class directly.
...
llvm-svn: 98247
2010-03-11 07:00:45 +00:00
Anders Carlsson
7f6b71e222
Keep track of, and dump, vbase offset offsets.
...
llvm-svn: 98245
2010-03-11 06:43:12 +00:00
Anders Carlsson
9f28dbc53a
Fix tests.
...
llvm-svn: 98242
2010-03-11 06:10:52 +00:00
Anders Carlsson
d5531e2d18
Run the new vtable builder for construction vtables as well now. Note that we still don't use the data it generates.
...
llvm-svn: 98239
2010-03-11 05:48:21 +00:00
John McCall
ea8d8bb718
Support PPC-32 DWARF EH intrinisics. Thanks to rdivacky for his assistance.
...
llvm-svn: 98206
2010-03-11 00:10:12 +00:00
Chris Lattner
4d94109903
set alignment on static locals properly, patch by Arnaud de Grandmaison!
...
llvm-svn: 98204
2010-03-10 23:59:59 +00:00
Anders Carlsson
423406f335
Fix calculation of whether a member function needs a thunk in construction vtables.
...
llvm-svn: 98191
2010-03-10 21:25:37 +00:00
Anders Carlsson
115b4756b5
We were mistakenly marking morally virtual bases as being uninteresting. Fix this.
...
llvm-svn: 98180
2010-03-10 19:39:11 +00:00
Anders Carlsson
703a08605f
Ignore non-interesting bases when emitting construction vtables.
...
llvm-svn: 98177
2010-03-10 19:15:26 +00:00
Anders Carlsson
804cf51dcf
Don't accidentally mark some functions in construction vtables as unused. Also land the test for a previous checkin, now that it's correct.
...
llvm-svn: 98139
2010-03-10 06:51:42 +00:00
John McCall
e78aac41de
Create a new InjectedClassNameType to represent bare-word references to the
...
injected class name of a class template or class template partial specialization.
This is a non-canonical type; the canonical type is still a template
specialization type. This becomes the TypeForDecl of the pattern declaration,
which cleans up some amount of code (and complicates some other parts, but
whatever).
Fixes PR6326 and probably a few others, primarily by re-establishing a few
invariants about TypeLoc sizes.
llvm-svn: 98134
2010-03-10 03:28:59 +00:00
Anders Carlsson
02b99d6b7c
When building construction vtables, we need to check if a primary virtual base is actually a primary virtual base in the layout class.
...
llvm-svn: 98131
2010-03-10 03:02:01 +00:00
Anders Carlsson
ca82a4fdba
Improve vcall offset handling in construction vtables. With this we layout the construction vtables from the ABI examples correctly.
...
llvm-svn: 98127
2010-03-10 02:33:41 +00:00
Rafael Espindola
e7113ca907
Delay codegen of vtables when handling implicit instantiations.
...
This fixes PR6474.
llvm-svn: 98123
2010-03-10 02:19:29 +00:00
Devang Patel
05c37d2800
Use SmallString instead of alloca.
...
llvm-svn: 98112
2010-03-10 00:19:43 +00:00
Devang Patel
93f274c161
Fix file reference for derived and composite types. Now, dwarf writer uses strict verifier that ignores debug info for such types if their file info is unknown.
...
llvm-svn: 98096
2010-03-09 22:49:11 +00:00
Devang Patel
4f26205ba8
More then one anonymous aggregates on one line creates chaos when MDNode uniquness is combined with RAUW operation. Right solution is to avoid using RAUW.
...
This fixes PR 6554.
llvm-svn: 98083
2010-03-09 21:32:27 +00:00
Devang Patel
f2aa707895
Use getLast() instead of getBasename().
...
llvm-svn: 98072
2010-03-09 19:14:07 +00:00
Devang Patel
408dcf60aa
Start using DIFile. Corresponding llvm patch is r98020.
...
llvm-svn: 98021
2010-03-09 00:44:50 +00:00
Chris Lattner
e18aaf2c4b
add a codegen hack to work around an AST bug, allowing us to compile the
...
code in PR6537. This should be reverted when the ast bug is fixed.
llvm-svn: 97981
2010-03-08 21:08:07 +00:00
Devang Patel
d3cbaa1ddf
Avoid using DIDescriptor.isNull().
...
llvm-svn: 97976
2010-03-08 20:53:17 +00:00
Devang Patel
9cf2705a5d
Revert r97949.
...
llvm-svn: 97964
2010-03-08 19:20:58 +00:00
Devang Patel
4ce8ebb087
Avoid DIDescriptor.isNull() checks.
...
llvm-svn: 97949
2010-03-08 18:26:57 +00:00
Douglas Gregor
de4827dd34
Extend ObjCMessageExpr for class method sends with the source location
...
of the class name.
llvm-svn: 97943
2010-03-08 16:40:19 +00:00
Douglas Gregor
c934bc840c
Perform overload resolution when static_cast'ing from a
...
pointer-to-member-to-derived to a pointer-to-member-to-base. Fixes
PR6072.
llvm-svn: 97923
2010-03-07 23:24:59 +00:00
Douglas Gregor
577cf97cf3
Don't turn off mangling in implicitly extern "C" system headers. GCC
...
doesn't do this on any of the major platforms, and we don't really
support any of the platforms that do (nor will we actually handle
those headers well). Fixes PR6217; see PR6530 for details on what we
would need to do to support these platforms.
llvm-svn: 97899
2010-03-07 05:10:40 +00:00
Benjamin Kramer
f0a0f68c79
Add a message to these asserts.
...
llvm-svn: 97873
2010-03-06 09:07:19 +00:00
Rafael Espindola
d51c9b9a9f
Use static method in GlobalValue
...
llvm-svn: 97872
2010-03-06 07:35:18 +00:00
Eli Friedman
99d20f83ba
PR6515: Implement __builtin_signbit and friends.
...
I'm reasonably sure my implementation is correct, but it would be nice if
someone could double-check.
llvm-svn: 97864
2010-03-06 02:17:52 +00:00
John McCall
beec5a080f
Implement __builtin_dwarf_sp_column for i386 (Darwin and not), x86-64 (all),
...
and ARM. Implement __builtin_init_dwarf_reg_size_table for i386 (both) and
x86-64 (all).
llvm-svn: 97859
2010-03-06 00:35:14 +00:00
Blaine Garst
f27ab71d9f
add support for a 1<<29 bit in the block flags field to mark blocks using alternate struct return ABI
...
llvm-svn: 97775
2010-03-05 01:29:59 +00:00
Rafael Espindola
4c489c7030
Don't produce an alias for a destructor if the target is weak.
...
This fixes bootstrap on ELF systems :-)
llvm-svn: 97773
2010-03-05 01:21:10 +00:00
Rafael Espindola
bef98689ad
really fix 6473 by handling weakref in constant expressions.
...
llvm-svn: 97750
2010-03-04 21:26:03 +00:00
Rafael Espindola
2e42fec3a0
Fix PR6473.
...
Clang's support for weakref is now better than llvm-gcc's :-)
We don't introduce a new symbol and we correctly mark undefined references weak only if there is no
definition or regular undefined references in the same file.
llvm-svn: 97733
2010-03-04 18:17:24 +00:00
John McCall
731be6620c
Revert changes r97693, r97700, and r97718.
...
Our testing framework can't deal with disabled targets yet.
llvm-svn: 97719
2010-03-04 04:29:44 +00:00
Fariborz Jahanian
9eba9dfb0c
Refactor local class name mangling and make it
...
ABI conforming.
llvm-svn: 97702
2010-03-04 01:02:03 +00:00
John McCall
81d4d12504
Implement __builtin_dwarf_sp_column().
...
llvm-svn: 97700
2010-03-04 00:44:01 +00:00
John McCall
6abe39c61e
Create a TargetMachine whenever we create a CodeGenAction. The codegen of
...
some builtins will rely on target knowledge.
llvm-svn: 97693
2010-03-04 00:23:29 +00:00
Fariborz Jahanian
281aae6328
Fix code gen bug generating code for
...
((id)cat)->isa. Fixes radar 7709015.
llvm-svn: 97672
2010-03-03 22:09:47 +00:00
Chris Lattner
576def7fbe
fix PR6475, we were doing side-effecting stuff in an assert.
...
llvm-svn: 97669
2010-03-03 21:52:23 +00:00
Fariborz Jahanian
a529c25555
Implements mangling of local class names to
...
fix a code gen crash. This is WIP as not
all ABI cases are covered (there is a FIXME to
this effect). Fixes radar 7696748.
llvm-svn: 97658
2010-03-03 19:41:08 +00:00
Chris Lattner
5cc15e058b
add framework for ARM builtins, Patch by Edmund Grimley Evans!
...
llvm-svn: 97656
2010-03-03 19:03:45 +00:00
John McCall
515c3c548c
Sketch out an implementation for __builtin_dwarf_cfa. I have no idea
...
why the front-end is calculating the argument to llvm.eh.dwarf.cfa().
llvm-svn: 97653
2010-03-03 10:30:05 +00:00
John McCall
66769f8544
Implement __builtin_eh_return.
...
llvm-svn: 97643
2010-03-03 05:38:58 +00:00
Anders Carlsson
5b0057c05b
Fix a bug with base offset merging that Devang noticed.
...
llvm-svn: 97641
2010-03-03 04:58:02 +00:00
John McCall
d4f4b7f5ee
Add proper target hooks for __builtin_extract_return_address and
...
__builtin_frob_return_address. The implementations for both are
still trivial in the default case.
llvm-svn: 97638
2010-03-03 04:15:11 +00:00
John McCall
1950a11939
Don't emit derived-to-base destructor aliases if we don't have a definition
...
for the base destructor, because aliases to declarations aren't legal.
Fixes PR 6471.
llvm-svn: 97637
2010-03-03 03:40:11 +00:00
Rafael Espindola
70e040d552
During codegen assert that any copy assignment, destructor or constructor that
...
we need to synthesize has been marked as used by Sema.
Change Sema to avoid these asserts.
llvm-svn: 97589
2010-03-02 21:28:26 +00:00
Anders Carlsson
93b1b49082
Simplify code.
...
llvm-svn: 97551
2010-03-02 05:40:45 +00:00
John McCall
b6cc2c0439
Inspired by seeing "MIPS" go by in the commits, I've gone ahead and
...
implemented a (codegen) target hook for __builtin_extend_pointer.
I'm also making it return a uint64_t instead of an unsigned word; this
comports with typical usage (i.e. the one use I know of).
I don't know if any of the existing targets requires this hook to be
set (other than x86 and x86_64, which I know do not).
llvm-svn: 97547
2010-03-02 03:50:12 +00:00
Anders Carlsson
6f1f002651
Rename BaseOffset to Offset and make it signed in preparation of more construction vtable work.
...
llvm-svn: 97546
2010-03-02 03:44:06 +00:00
John McCall
4b613fae35
After much consultation aimed at figuring out what this builtin actually
...
does, document the results and then implement __builtin_extend_pointer for
platforms where it's a no-op.
llvm-svn: 97540
2010-03-02 02:31:24 +00:00
John McCall
bd8d9bd39c
Split out types that are non-canonical unless dependent as their own
...
category. Use this in a few places to eliminate unnecessary TST cases and
do some future-proofing. Provide terrible manglings for typeof. Mangle
decltype with some hope of accuracy.
Our manglings for some of the cases covered in the testcase are different
from gcc's, which I've raised as an issue with the ABI list.
llvm-svn: 97523
2010-03-01 23:49:17 +00:00
John McCall
de9607bc6f
The latest draft uses 'dt' to mangle member expressions, and now so do we.
...
llvm-svn: 97479
2010-03-01 19:12:25 +00:00
Douglas Gregor
a51c67424e
Improve name mangling for dependently-scoped declaration references.
...
llvm-svn: 97422
2010-02-28 22:05:49 +00:00
Douglas Gregor
5610db6923
Add name mangling for DeclRefExprs that refer to external names
...
llvm-svn: 97418
2010-02-28 21:40:32 +00:00
Anders Carlsson
5b79c31471
Remove debug output.
...
llvm-svn: 97407
2010-02-28 18:39:30 +00:00
Anders Carlsson
7162ab947b
Handle unused functions in construction vtables correctly.
...
llvm-svn: 97406
2010-02-28 18:37:33 +00:00
Anders Carlsson
8b37bb7c48
When laying out vtables for virtual bases in construction vtables, we need to check if the vtable is a primary base in the layout class.
...
llvm-svn: 97402
2010-02-28 18:08:38 +00:00
Anders Carlsson
e3385f566b
More improvements to construction vtables; we know handle vbase offsets correctly (I hope).
...
llvm-svn: 97361
2010-02-28 01:43:58 +00:00
Anders Carlsson
62c6c72bab
Pass information about whether a base is virtual or not down to getCtorVtable, we need this information in the vtable builder.
...
llvm-svn: 97356
2010-02-28 00:36:23 +00:00
Anders Carlsson
31f595f5ef
Add new function.
...
llvm-svn: 97353
2010-02-28 00:10:58 +00:00
Anders Carlsson
f98b47d3b9
Fix to dumpLayout; we want to be able to dump address points even if the vtable doesn't have any methods.
...
llvm-svn: 97350
2010-02-27 23:58:01 +00:00
Anders Carlsson
c3f92a16f2
Add a simple construction vtable test.
...
llvm-svn: 97344
2010-02-27 21:09:00 +00:00
Anders Carlsson
9391375d95
Start fleshing out construction vtable support.
...
llvm-svn: 97342
2010-02-27 20:39:05 +00:00
Anders Carlsson
603d7d1910
Enable the new vtable layout code for vtables that aren't construction vtables. (This doesn't mean that we emit LLVM IR using it yet, it just means that it's running and hopefully not crashing or asserting).
...
llvm-svn: 97341
2010-02-27 20:02:53 +00:00
Anders Carlsson
9f19aaaa3a
Move ComputeThisAdjustmentBaseOffset to VtableBuilder.
...
llvm-svn: 97340
2010-02-27 19:57:44 +00:00
Anders Carlsson
b26c2abac7
Make sure to insert the primary base in the set :)
...
llvm-svn: 97339
2010-02-27 19:51:04 +00:00
Anders Carlsson
e02a926a1c
Use the real base offset when calculating vbase offsets.
...
llvm-svn: 97338
2010-02-27 19:21:58 +00:00
Anders Carlsson
4d0729a7cc
Figured out why the test was failing, this will hopefully fix it.
...
llvm-svn: 97336
2010-02-27 19:00:53 +00:00
Anders Carlsson
2b381bbb5c
Don't add this adjustments for pure virtual member functions.
...
llvm-svn: 97334
2010-02-27 18:16:50 +00:00
Anders Carlsson
01d3c7da60
We want to store method info for unused functions.
...
llvm-svn: 97333
2010-02-27 18:09:40 +00:00
Anders Carlsson
4068798cbc
Finish up the changes to this adjustments.
...
llvm-svn: 97328
2010-02-27 16:52:49 +00:00
Anders Carlsson
d46ed89d79
Stub out more of the 'this' pointer adjustment fixes I've been planning. Start using a set vector for primary bases so they will be ordered.
...
llvm-svn: 97326
2010-02-27 16:18:19 +00:00
Anders Carlsson
d2025417ef
Fix another vtable layout bug; we weren't looking hard enough for overriden functions when determining if an overrider will ever be used.
...
llvm-svn: 97306
2010-02-27 06:38:03 +00:00
Anders Carlsson
d69b2f93ea
Handle vcall offset sharing between destructors.
...
llvm-svn: 97304
2010-02-27 04:12:52 +00:00
Anders Carlsson
b08aaa3e10
Fix a bug where we were generating an unnecessary vtable for a virtual base that's already a primary virtual base.
...
llvm-svn: 97303
2010-02-27 04:05:52 +00:00
John McCall
43c6ffbeec
Sundry fixes to the new vtable builder.
...
llvm-svn: 97258
2010-02-26 20:22:44 +00:00
David Chisnall
36c6320d78
Don't generate method metadata for @dynamic properties. Fixes PR6354.
...
llvm-svn: 97199
2010-02-26 01:11:38 +00:00
John McCall
2da83a3a38
Use the power of types to track down another canonicalization bug in
...
the ABI-computation interface. Fixes <rdar://problem/7691046>.
llvm-svn: 97197
2010-02-26 00:48:12 +00:00
Anders Carlsson
9e3b3a3bbe
Improve vcall offset handling.
...
llvm-svn: 97174
2010-02-25 22:23:13 +00:00
Anders Carlsson
ed7d0e8be8
Fux a bug where we were trying to add overriders for non-virtual bases of virtual bases more than once.
...
llvm-svn: 97173
2010-02-25 22:18:35 +00:00
Sanjiv Gupta
9ac3092d34
Targets (like pic16) may have mangled the name of global variables,
...
so get the name from Var rather than the original decl.
llvm-svn: 97114
2010-02-25 05:20:44 +00:00
Anders Carlsson
01bbef516e
Remove dead code.
...
llvm-svn: 97109
2010-02-25 03:57:50 +00:00
Anders Carlsson
422f778ba1
Move the vcall and vbase offset layout code out into its own class.
...
llvm-svn: 97107
2010-02-25 03:45:56 +00:00
Anders Carlsson
3c1ec97a28
Get rid of 'this' adjustments from the FinalOverriders class since they can be different for the same overrider in different parts of the vtable.
...
llvm-svn: 97068
2010-02-24 22:32:18 +00:00
Anders Carlsson
d8d698da60
Improve this adjustment pointer calculation.
...
llvm-svn: 97067
2010-02-24 22:27:12 +00:00
Anders Carlsson
8025e7b1b9
Make ComputeThisAdjustmentBaseOffset public for now.
...
llvm-svn: 97066
2010-02-24 22:18:01 +00:00
John McCall
aea181de04
Fix an iterator-invalidation bug that was causing selfhost errors
...
on non-darwin platforms. Fixes PR6411. Test case doesn't reduce,
unfortunately.
llvm-svn: 97055
2010-02-24 20:32:01 +00:00
Anders Carlsson
a9f633b060
Generate correct vcall offsets when we have a primary virtual base that is not a primary base in the complete class hierarchy.
...
llvm-svn: 97039
2010-02-24 16:43:12 +00:00
John McCall
8ee376f08a
Canonicalize parameter and return types before computing ABI info. Eliminates
...
a common source of oddities and, in theory, removes some redundant ABI
computations. Also fixes a miscompile I introduced yesterday by refactoring
some code and causing a slightly different code path to be taken that
didn't perform *parameter* type canonicalization, just normal type
canonicalization; this in turn caused a bit of ABI code to misfire because
it was looking for 'double' or 'float' but received 'const float'.
llvm-svn: 97030
2010-02-24 07:14:12 +00:00
Devang Patel
b407338fe2
Emit debug info for VectorType.
...
llvm-svn: 96999
2010-02-23 22:59:39 +00:00
Rafael Espindola
c18086ae17
Add support for the weakref attribute. We still produce "alias weak" as llvm-gcc does, but are more strict on what uses of weakref we accept.
...
llvm-svn: 96992
2010-02-23 22:00:30 +00:00
Blaine Garst
fc83aa04db
Unconditionally support block introspection data in a new field at the end
...
of the block descriptor field. This field is the ObjC style @encode
signature of the implementation function, and was to this point
conditionally provided in the block literal data structure. That
provisional support is removed.
Additionally, eliminate unused enumerations for the block literal flags field.
The first shipping ABI unconditionally set (1<<29) but this bit is unused
by the runtime, so the second ABI will unconditionally have (1<<30) set so
that the runtime can in fact distinguish whether the additional data is
present or not.
llvm-svn: 96989
2010-02-23 21:51:17 +00:00
Eli Friedman
1e6bc133ce
Make previous fix handle a few more edge cases.
...
llvm-svn: 96962
2010-02-23 18:25:09 +00:00
Eli Friedman
ad5f0789f6
PR6400: Handle an extreme edge case in mangling correctly.
...
llvm-svn: 96961
2010-02-23 18:20:18 +00:00
Eli Friedman
d2c0de6b44
PR6386: Fix a recent regression in IRGen of cast-to-union constructs.
...
llvm-svn: 96958
2010-02-23 17:58:35 +00:00
Anders Carlsson
8939e400b6
Implement IsOverriderUsed. This can't be tested yet due to some other bugs :)
...
llvm-svn: 96897
2010-02-23 06:34:44 +00:00
Anders Carlsson
a8796c692c
Stub out IsOverriderUsed.
...
llvm-svn: 96883
2010-02-23 04:26:39 +00:00
Anders Carlsson
0570f71255
More fixes. Don't try to emit a virtual base vtable if the virtual base in question is a primary virtual base of some other base.
...
llvm-svn: 96881
2010-02-23 03:48:14 +00:00
Anders Carlsson
bae46277fe
Always emit vcall offset for the primary base, not only if it's virtual. Remove a debug printf, and add the test case that now passes.
...
llvm-svn: 96880
2010-02-23 03:26:17 +00:00
Anders Carlsson
510d22d097
Simplify the vcall offset calculation and make it give the correct answers :) My test case now has the right values but in the wrong order.
...
llvm-svn: 96877
2010-02-23 03:14:49 +00:00
Anders Carlsson
30f5301e54
More work on vcall offsets. We now emit the right number of vcall offsets in my local test case, but not the right values.
...
llvm-svn: 96874
2010-02-23 02:47:31 +00:00
Anders Carlsson
075056a8f9
Move BaseOffset out of the FinalOverriders class.
...
llvm-svn: 96853
2010-02-23 01:34:28 +00:00
John McCall
f8ff7b9fd1
Perform two more constructor/destructor code-size optimizations:
...
1) emit base destructors as aliases to their unique base class destructors
under some careful conditions. This is enabled for the same targets that can
support complete-to-base aliases, i.e. not darwin.
2) Emit non-variadic complete constructors for classes with no virtual bases
as calls to the base constructor. This is enabled on all targets and in
theory can trigger in situations that the alias optimization can't (mostly
involving virtual bases, mostly not yet supported).
These are bundled together because I didn't think it worthwhile to split them,
not because they really need to be.
llvm-svn: 96842
2010-02-23 00:48:20 +00:00
Douglas Gregor
f4f2e0247f
Change the name of the vtable-debugging environment variable to
...
CLANG_VTABLE_DEBUG.
llvm-svn: 96785
2010-02-22 16:48:26 +00:00
Douglas Gregor
76eb74a1cd
Don't use NamedDecl::getNameAsCString() when dealing with C++ methods,
...
since they may not have normal identifiers for names. Fixes PR6369.
llvm-svn: 96784
2010-02-22 16:44:27 +00:00
Douglas Gregor
36c569fb33
Eliminate the default arguments to ASTContext::getFunctionType(),
...
fixing up a few callers that thought they were propagating NoReturn
information but were in fact saying something about exception
specifications.
llvm-svn: 96766
2010-02-21 22:15:06 +00:00
Anders Carlsson
350b56eed5
Add the CK_UnusedFunctionPointer component kind for unused function pointers.
...
llvm-svn: 96695
2010-02-19 20:08:13 +00:00
John McCall
b81884d347
More refactoring around constructor/destructor code generation.
...
Fix some bugs with function-try-blocks and simplify normal try-block
code generation.
This implementation excludes a deleting destructor's call to
operator delete() from the function-try-block, which I believe
is correct but which I can't find straightforward support for at
a moment's glance.
llvm-svn: 96670
2010-02-19 09:25:03 +00:00
Anders Carlsson
2d3d903872
Dump this-adjustments for destructors as well.
...
llvm-svn: 96660
2010-02-19 06:03:53 +00:00
John McCall
d4324148d7
Re-introduce the ctor/dtor alias optimization, this time hidden behind a
...
command-line option which defaults off.
llvm-svn: 96649
2010-02-19 01:32:20 +00:00
Fariborz Jahanian
aef662206b
Patch removes IVars list from ObjCInterfaceDecl and
...
instead relies on their DeclContext for iteration, etc.
llvm-svn: 96638
2010-02-19 00:31:17 +00:00
Blaine Garst
5421a83e4a
remove unused function & enumerations
...
llvm-svn: 96635
2010-02-19 00:24:37 +00:00
John McCall
334ce7c1c4
Revert the ctor/dtor alias optimization for now; the buildbots can detect
...
some failure here that I can't.
llvm-svn: 96612
2010-02-18 21:31:48 +00:00
John McCall
5c60a6f597
Make deleting and complete dtor variants defer to other dtor variants by
...
calling them as subroutines. This triggers whenever the alias optimization
doesn't, i.e. when the dtor has linkonce linkage or there are virtual bases
or it's the deleting dtor.
llvm-svn: 96605
2010-02-18 19:59:28 +00:00
Anders Carlsson
f8b53536ed
Attempt to fix the 32-bit test failures.
...
llvm-svn: 96595
2010-02-18 18:20:49 +00:00
Anders Carlsson
e5faca7cda
Fix another bug and add another class.
...
llvm-svn: 96590
2010-02-18 17:32:33 +00:00
Anders Carlsson
8847d9e40a
More work on vcall offsets.
...
llvm-svn: 96587
2010-02-18 17:26:40 +00:00
Anders Carlsson
78277c7705
Start stubbing out vcall offset handling.
...
llvm-svn: 96585
2010-02-18 17:00:09 +00:00
Anders Carlsson
5a7654a9d8
Store the base offset of the final overrider in the OverriderInfo struct, to be used for vcall offsets.
...
llvm-svn: 96582
2010-02-18 16:29:24 +00:00
Anders Carlsson
c8316a2e08
Remove some dead code.
...
llvm-svn: 96581
2010-02-18 16:24:20 +00:00
John McCall
89b12b34f6
Extract out function-body code generation into its own method. No functionality
...
change.
llvm-svn: 96564
2010-02-18 03:17:58 +00:00
Chris Lattner
d2408f78a5
silence warning in a cleaner way
...
llvm-svn: 96520
2010-02-17 21:42:34 +00:00
Fariborz Jahanian
999ddbcf8e
Patch to remove arbitrary imporation of 'self' into
...
a block without it being used. This causes over release
of objects in certain runtime-senitive apps.
(fixes radar 7581175).
llvm-svn: 96501
2010-02-17 19:54:08 +00:00
Fariborz Jahanian
586ca163b4
Did not intend to check this in.
...
llvm-svn: 96486
2010-02-17 18:11:55 +00:00
Fariborz Jahanian
c0309cd3d1
Use proper lexcial context for newly added ivars.
...
llvm-svn: 96484
2010-02-17 18:10:54 +00:00
Anders Carlsson
231461f88f
Make FinalOverriders handle virtual bases correctly. Unfortunately this can't be tested just yet.
...
llvm-svn: 96481
2010-02-17 17:48:25 +00:00
Anders Carlsson
d2fd302726
Handle primary bases in AddVCallOffsets.
...
llvm-svn: 96461
2010-02-17 06:30:02 +00:00
Chandler Carruth
c20a9586c4
Silence GCC warning by marking an assert-only variable as unused.
...
llvm-svn: 96459
2010-02-17 06:24:18 +00:00
Anders Carlsson
b0a588f038
First cut at emitting vcall offsets.
...
llvm-svn: 96455
2010-02-17 06:07:19 +00:00
John McCall
67cea74745
Emit complete constructors and destructors as aliases to base constructors
...
and destructors when the two entities are semantically identical, i.e. when
the class has no virtual base classes. We only do this for linkage types
for which aliases are supported, i.e. internal and external, i.e. not linkonce.
llvm-svn: 96451
2010-02-17 03:52:49 +00:00
Anders Carlsson
db042200c0
Pass through whether a base is virtual or not.
...
llvm-svn: 96449
2010-02-17 03:11:55 +00:00
Sanjiv Gupta
ba1e267a4c
implement EmitVAArg. pretty much the same way other targets do.
...
llvm-svn: 96446
2010-02-17 02:25:52 +00:00
Anders Carlsson
03db9e9cd3
Correctly calculate base offsets for 'this' pointer adjustments involving virtual bases. This can't be tested yet due to lack of vcall offsets :)
...
llvm-svn: 96441
2010-02-17 02:05:23 +00:00
John McCall
347132b32f
IRgen optimization: cache the value of 'this' and 'vtt' instead of
...
repeatedly reloading from an alloca. We still need to create the alloca
for debug info purposes (although we currently create it in all cases
because of some abstraction boundaries that're hard to break down).
llvm-svn: 96403
2010-02-16 22:04:33 +00:00
Devang Patel
7585580ccc
Distinguish two lexical blocks at the same level.
...
llvm-svn: 96397
2010-02-16 21:41:20 +00:00
Daniel Dunbar
fd09df7839
IRgen: Switch 'retval' to use CreateIRTemp.
...
llvm-svn: 96376
2010-02-16 19:45:20 +00:00
Daniel Dunbar
d004918ccb
IRgen: Add CreateIRTemp, which creates a temporary alloca but with type converted "not-for-memory". Dunno a better name.
...
llvm-svn: 96374
2010-02-16 19:44:13 +00:00
Daniel Dunbar
27bacafb71
IRgen: Switch EmitCompoundLiteralLValue to use CreateMemTemp.
...
llvm-svn: 96373
2010-02-16 19:43:39 +00:00
Anders Carlsson
13f0f66223
Handle layout of vtables for virtual bases.
...
llvm-svn: 96355
2010-02-16 16:49:35 +00:00
Anders Carlsson
b716a543c9
Move some code around in preparation for virtual base vtables.
...
llvm-svn: 96354
2010-02-16 16:26:28 +00:00
Anders Carlsson
14157939ab
Fix a bug where we would not emit secondary vtables for bases of a primary base.
...
llvm-svn: 96351
2010-02-16 16:02:57 +00:00
Anders Carlsson
77904f1d5b
Emit vbase offsets.
...
llvm-svn: 96329
2010-02-16 04:59:55 +00:00
Anders Carlsson
dc2dba306c
More work on the new layout code.
...
llvm-svn: 96328
2010-02-16 04:49:44 +00:00
John McCall
6ce747220a
When emitting complete destructors for classes with virtual bases, compute
...
the offset to the virtual bases statically inside of relying on the virtual
base offsets in the object's vtable(s). This is both more efficient and
sound against the destructor's manipulation of the vtables.
Also extract a few helper routines.
Oh and we seem to pass all tests with an optimized clang now.
llvm-svn: 96327
2010-02-16 04:15:37 +00:00
Devang Patel
e8814ce0a6
Use getLocStart(), instead of getLocEnd(), to record starting location of objc method. :)
...
llvm-svn: 96245
2010-02-15 18:08:38 +00:00
Duncan Sands
998f9d975b
Uniformize the names of type predicates: rather than having isFloatTy and
...
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris!
llvm-svn: 96224
2010-02-15 16:14:01 +00:00
John McCall
7538eec67b
When emitting an aggregate into a temporary, make sure we set the alignment
...
on the alloca.
The fact that codegen makes this class of bug so wonderfully easy to make is
embarrassing.
llvm-svn: 96204
2010-02-15 01:23:36 +00:00
Anders Carlsson
033d48697f
Don't compute final overriders or build vtables for bases that don't need a vtable.
...
llvm-svn: 96171
2010-02-14 17:05:59 +00:00
Anders Carlsson
073a0c88cc
Build fix.
...
llvm-svn: 96140
2010-02-14 00:44:19 +00:00
Anders Carlsson
6a7e6a4c3c
Baby steps towards teaching FinalOverriders about virtual bases.
...
llvm-svn: 96139
2010-02-14 00:37:35 +00:00
Anders Carlsson
1888b44988
Don't try to layout construction vtables for now.
...
llvm-svn: 96138
2010-02-14 00:22:59 +00:00
Anders Carlsson
258a1e35e8
Improve support for non-virtual 'this' pointer adjustments. With this, it should be possible to use the new vtable layout code for all class hierarchies that do not involve virtual bases.
...
llvm-svn: 96137
2010-02-14 00:16:19 +00:00
Anders Carlsson
d3adb0ced9
Add basic support for simple non-virtual 'this' pointer adjustments.
...
llvm-svn: 96136
2010-02-13 23:40:17 +00:00
Anders Carlsson
cce9ee8970
Add support for very simple non-virtual this adjustments in the FinalOverriders class.
...
llvm-svn: 96133
2010-02-13 23:17:31 +00:00
Anders Carlsson
c809cbdc3f
Cleanup; remove some duplicated code.
...
llvm-svn: 96131
2010-02-13 22:39:18 +00:00
Anders Carlsson
a678aa1e51
Assert if we encounter this adjustments.
...
llvm-svn: 96125
2010-02-13 22:23:31 +00:00
Anders Carlsson
e75aaa97b3
Start laying out secondary vtables.
...
llvm-svn: 96123
2010-02-13 22:05:23 +00:00
Anders Carlsson
3f9917de6e
Merge base offsets and dump them.
...
llvm-svn: 96121
2010-02-13 21:33:22 +00:00
Anders Carlsson
c1290adab7
Don't make return adjustments for pure virtual member functions.
...
llvm-svn: 96120
2010-02-13 21:16:54 +00:00
Anders Carlsson
cf5a882da1
Handle virtual bases in return adjustment types.
...
llvm-svn: 96119
2010-02-13 21:07:32 +00:00
Anders Carlsson
f3f67846c8
Handle virtual bases in ComputeBaseOffset.
...
llvm-svn: 96117
2010-02-13 20:41:15 +00:00
Anders Carlsson
6a6cbfc55f
More work on covariant return types. We now handle non-virtual adjustments fine.
...
llvm-svn: 96114
2010-02-13 20:11:51 +00:00
Charles Davis
4ea31ab369
Emit the 'alignstack' LLVM function attribute when we encounter a function
...
marked 'force_align_arg_pointer'. Almost there; now all I need to do is finish
up the backend.
llvm-svn: 96100
2010-02-13 15:54:06 +00:00
Chandler Carruth
a932bbca75
Fix think-o, attributes can't come *within* the type of the variable.
...
llvm-svn: 96099
2010-02-13 10:42:55 +00:00
Chandler Carruth
94eab4ad04
Silence unused variable warning in a build without assertions.
...
llvm-svn: 96098
2010-02-13 10:38:52 +00:00
Benjamin Kramer
e047e11189
Remove dead {include, semicolon, variable}.
...
llvm-svn: 96087
2010-02-13 09:15:07 +00:00
Benjamin Kramer
02c673781d
Use a different name for this iterator. MSVC and clang++ didn't like "I" in the same scope twice.
...
llvm-svn: 96086
2010-02-13 09:11:28 +00:00
Anders Carlsson
eee53d9c06
More work on return type adjustments in the new vtable builder.
...
llvm-svn: 96070
2010-02-13 02:02:03 +00:00
John McCall
ef3057c419
Switch the standard DeclarationName comparator to be a tri-valued comparator.
...
Use that while fixing a nasty misuse of qsort in vtable codegen which, somehow,
has not actually caused a crash.
llvm-svn: 96062
2010-02-13 01:04:05 +00:00
Eli Friedman
18c28f6cdc
if-0 out printf.
...
llvm-svn: 96052
2010-02-13 00:03:21 +00:00
Anders Carlsson
0760481f26
Fix a refacto that broke the clang-on-clang build.
...
llvm-svn: 95994
2010-02-12 18:14:46 +00:00
Anders Carlsson
5272c2574a
Start stubbing out more of the covariant thunk support.
...
llvm-svn: 95990
2010-02-12 17:37:14 +00:00
Anders Carlsson
8e661e15f2
Keep track of whether a final overrider needs a return type adjustment.
...
llvm-svn: 95985
2010-02-12 17:13:23 +00:00
Anders Carlsson
136bd19224
Move overrider out into a separate struct.
...
llvm-svn: 95984
2010-02-12 16:55:34 +00:00
Anders Carlsson
e8a9756e63
Keep track of the address points for all primary bases, and add the ability to dump multiple address points for a single offset.
...
llvm-svn: 95970
2010-02-12 07:43:48 +00:00
John McCall
84c416b9f6
Fix a bug causing an assertion when a covariant return type differed from
...
an overriden type only by reduced qualification.
llvm-svn: 95968
2010-02-12 06:15:07 +00:00
Anders Carlsson
65b4978f7f
More work on vtable layout. We can now layout vtables with primary bases.
...
llvm-svn: 95965
2010-02-12 05:25:12 +00:00
Anders Carlsson
09da3372b6
When dumping vtables, dump whether a virtual member function is pure or not.
...
llvm-svn: 95963
2010-02-12 02:38:13 +00:00
Anders Carlsson
9fbf6d95f6
More work on the final overriders.
...
llvm-svn: 95954
2010-02-12 01:40:03 +00:00
Devang Patel
f4df65cf60
Do not ignore anonymous records.
...
llvm-svn: 95953
2010-02-12 01:31:06 +00:00
Devang Patel
e003dd1721
Cache new compile unit.
...
llvm-svn: 95952
2010-02-12 01:30:31 +00:00
Anders Carlsson
e8ac42ad5c
Stub out the final overriders class.
...
llvm-svn: 95922
2010-02-11 21:24:32 +00:00
Anders Carlsson
dd27b5d7bb
Use getAs instead of cast/dyn_cast on types. (I'm sure Doug will appreciate this).
...
llvm-svn: 95911
2010-02-11 19:45:15 +00:00
Anders Carlsson
727ffb14a1
Move two functions to the top. No functionality change.
...
llvm-svn: 95908
2010-02-11 19:39:49 +00:00
Anders Carlsson
5bd8d19291
More vtable layout dumper improvements. Handle destructors, dump the complete function type of the member functions (using PredefinedExpr::ComputeName.
...
llvm-svn: 95887
2010-02-11 18:20:28 +00:00
Anders Carlsson
932c2f2a9a
Keep track of, and dump, vtable address points.
...
llvm-svn: 95874
2010-02-11 17:18:51 +00:00
Anders Carlsson
5d40c6f658
Check in the beginnings of my new vtable layout builder idea.
...
Right now, it's off by default but can be tested by passing -fdump-vtable-layouts to clang -cc1. This option will cause all vtables that will normally be emitted as part of codegen to also be dumped using the new layout code.
I've also added a very simple new vtable layout test case.
llvm-svn: 95865
2010-02-11 08:02:13 +00:00
Ted Kremenek
7f4945aa9c
Remove use of 'std::string' from Attr objects, using instead a byte
...
array allocated using the allocator in ASTContext. This addresses
these strings getting leaked when using a BumpPtrAllocator (in
ASTContext).
Fixes: <rdar://problem/7636765>
llvm-svn: 95853
2010-02-11 05:28:37 +00:00
Douglas Gregor
d505812422
Eliminate a bunch of unnecessary ASTContexts from members functions of
...
Decl subclasses. No functionality change.
llvm-svn: 95841
2010-02-11 01:19:42 +00:00
Douglas Gregor
0a5a2216e2
Eliminate the ASTContext parameter from RecordDecl::getDefinition()
...
and CXXRecordDecl::getDefinition(); it's totally unnecessary. No
functionality change.
llvm-svn: 95836
2010-02-11 01:04:33 +00:00
Fariborz Jahanian
989908fbac
Generate the objc_read_weak API when calling
...
a __weak block. Fixes radar 7628591.
llvm-svn: 95822
2010-02-10 23:34:57 +00:00
Chris Lattner
c55042c20f
hopefully silence a warning on the clang-i386-darwin9 tester.
...
llvm-svn: 95812
2010-02-10 21:41:43 +00:00
Daniel Dunbar
3241d400c8
Switch to using -fsjlj-exceptions instead of hard-coding it. Notably, this fixes
...
calls to the UnwindResumeOrRethrow function for C++/Obj-C exception handling,
for Darwin ARM.
llvm-svn: 95787
2010-02-10 18:49:11 +00:00
Devang Patel
535fdaf020
Refactor code that generates debug info for variables that has BlocksAttr.
...
llvm-svn: 95786
2010-02-10 18:49:08 +00:00
Devang Patel
1b5330afe9
Use current location as the location of compiler generated arguments, e.g. self, _cmd etc.
...
llvm-svn: 95743
2010-02-10 01:09:50 +00:00
Benjamin Kramer
f3a499ad88
StringRefize two random methods, remove a dead variable and a weird constructor call.
...
This maybe fixes some of the errors GCC 4.5 gives on this code.
llvm-svn: 95684
2010-02-09 19:31:24 +00:00
Devang Patel
0ae70d16b8
Fix virtual bases' debug info.
...
llvm-svn: 95678
2010-02-09 19:09:28 +00:00
Devang Patel
cce7e85165
Mark implicit "this" argument as an artificial argument.
...
llvm-svn: 95673
2010-02-09 17:57:50 +00:00
Daniel Dunbar
a7566f163a
IRgen: Add CreateMemTemp, for creating an temporary memory object for a particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing.
...
- This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome!
PR6240.
llvm-svn: 95648
2010-02-09 02:48:28 +00:00
Jakob Stoklund Olesen
819e54b65c
Pass inline keyword to optimizer as the new InlineHint function attribute.
...
At the moment the inlinehint attribute is ignored by the Inliner unless you
pass a -respect-inlinehint option. This will soon be the default.
The inlinehint attribute is set if the inline keyword is explicitly specified
on any declaration.
llvm-svn: 95623
2010-02-09 00:10:00 +00:00
Daniel Dunbar
3d33fab7fc
Reapply r95393, without the change to CGExpr. I was wrong in assuming that the
...
element type always matched the converted LLVM type for ExprType.
llvm-svn: 95596
2010-02-08 22:53:07 +00:00
John McCall
340aafaac6
Emit global references with constant initializers as constants. Fixes PR5585.
...
The standard actually says that such references should have internal linkage,
but gcc doesn't do that, so we probably can't get away with it.
llvm-svn: 95577
2010-02-08 21:46:50 +00:00
Anders Carlsson
ff8cce4395
Make sure to set vtable pointers in the destructors as well.
...
llvm-svn: 95525
2010-02-07 19:45:40 +00:00
Anders Carlsson
6d0e5bd8f3
Use the right type when taking the address of a non-virtual member function pointer. Fixes PR6258.
...
llvm-svn: 95524
2010-02-07 17:37:13 +00:00
Anders Carlsson
cee2d2f016
Use the right linkage for static variables inside C++ inline functions.
...
llvm-svn: 95512
2010-02-07 02:03:08 +00:00
Anders Carlsson
10d369d1a2
Improved handling of the visibility attribute. Declarations now inherit their parent's visibility.
...
(This is kind of a risky change, but I did a self-host build and everything appears to work fine!)
llvm-svn: 95511
2010-02-07 01:44:36 +00:00
Anders Carlsson
9878f9f73b
Make EmitStartEHSpec and EmitEndEHSpec return early when exceptions are disabled.
...
llvm-svn: 95509
2010-02-06 23:59:05 +00:00
Anders Carlsson
fcd764a168
Add support for threadsafe statics, and make them the default (matching gcc).
...
Daniel, I'd appreciate a review of the driver/cc1 parts.
llvm-svn: 95508
2010-02-06 23:23:06 +00:00
Anders Carlsson
5ade5d39b4
Call destructors for constructed bases as well.
...
llvm-svn: 95502
2010-02-06 20:00:21 +00:00
Anders Carlsson
ba63167b64
If a constructor throws an exception we need to execute the destructors for all fully constructed members. Fixes ctor_dtor_count.cpp in the test suite.
...
llvm-svn: 95501
2010-02-06 19:50:17 +00:00
Douglas Gregor
61f6db54e1
Switch CodeGen's "is this variable declaration a definition?" logic
...
over to VarDecl::isThisDeclarationADefinition(), which handles
variables declared with linkage specifications better (among other
things). CMake 2.9 (from CVS) now builds with clang++ and is somewhat
functional.
llvm-svn: 95486
2010-02-06 05:15:45 +00:00
Anders Carlsson
2c4de4c31e
Only append 'L' for internal variable declarations, not all declarations. (Found by the mangle checker, yay)
...
llvm-svn: 95485
2010-02-06 04:52:27 +00:00
Ted Kremenek
9c193965ba
Remove unused variable.
...
llvm-svn: 95476
2010-02-06 03:29:18 +00:00
Anders Carlsson
6710c5351e
Use the correct function info for constructors when applying function attributes. Fixes PR6245.
...
llvm-svn: 95474
2010-02-06 02:44:09 +00:00
Douglas Gregor
cae03b1e6d
Assert when we try to mangle a dependent template name, rather than
...
crashing unceremoniously.
llvm-svn: 95464
2010-02-06 01:09:36 +00:00
John McCall
ca972cd1f1
Rearrange some checks to avoid call to isCopyConstructor() and clarify path
...
taken for non-trivial constructors.
llvm-svn: 95457
2010-02-06 00:25:16 +00:00
John McCall
ab26cfa58d
Standardize the parsing of function type attributes in a way that
...
follows (as conservatively as possible) gcc's current behavior: attributes
written on return types that don't apply there are applied to the function
instead, etc. Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks). Consistently consume CC/noreturn
information throughout codegen; enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().
llvm-svn: 95436
2010-02-05 21:31:56 +00:00
Douglas Gregor
a643780483
Revert r95393, which broke Clang's self-host.
...
llvm-svn: 95430
2010-02-05 21:10:36 +00:00
Douglas Gregor
a16b0cae9a
Implement name mangling for template template parameters
...
llvm-svn: 95427
2010-02-05 20:45:00 +00:00
Daniel Dunbar
9c4e4651d5
IRgen: A few more ConvertType cleanups.
...
llvm-svn: 95423
2010-02-05 20:02:42 +00:00
Daniel Dunbar
d0bc7b9d13
IRgen: Factor out EmitAggExprToLValue.
...
llvm-svn: 95416
2010-02-05 19:38:31 +00:00
Fariborz Jahanian
df506b934e
Fix a code gen bug accessing 'isa' field via a message call
...
(Fixes radar 7609722).
llvm-svn: 95406
2010-02-05 19:18:30 +00:00
Daniel Dunbar
8848175547
IRgen: Fix some CreateTempAlloca calls to use ConvertTypeForMem when that is
...
conceptually correct. Review appreciated (Chris, Eli, Anders).
llvm-svn: 95401
2010-02-05 18:56:49 +00:00
Anders Carlsson
cb86e1088a
Fix the bug that was breaking self-host, and re-land the static ctor fixes.
...
llvm-svn: 95400
2010-02-05 18:38:45 +00:00
Charles Davis
5a5473f0f8
Now that we store calling conventions in the types, use them instead of
...
getting the calling convention from the target function, which may or may not
exist. Fixes PR5280.
llvm-svn: 95399
2010-02-05 18:13:10 +00:00
Daniel Dunbar
363589bded
IRgen: Use hasAggregateLLVMType instead of isSingleValueType() for cases that
...
need to deal with aggregates specially; this is consistent with the rest of IRgen.
Also, simplify EmitParmDecl and don't worry about using Decl::getNameAsString.
llvm-svn: 95393
2010-02-05 17:51:33 +00:00
Douglas Gregor
af77cd220a
Revert r95363 and r95375, which broke self-host.
...
llvm-svn: 95389
2010-02-05 16:18:08 +00:00
Anders Carlsson
c6eec40189
Check in a mangle checker that's turned off by default.
...
llvm-svn: 95377
2010-02-05 07:31:37 +00:00
Anders Carlsson
893555ce66
Fix array initialization test.
...
llvm-svn: 95375
2010-02-05 07:00:11 +00:00
Anders Carlsson
ecac409cb0
If a global initializer has a non-trivial destructor it can't be emitted as a constant (even if it has a trivial constructor).
...
llvm-svn: 95363
2010-02-05 05:19:42 +00:00
John McCall
ae580fede3
Always start tag definitions before completing them. Assert same.
...
Fixes latent and not-so-latent objc++ and blocks++ bugs.
llvm-svn: 95340
2010-02-05 01:33:36 +00:00
John McCall
67da35c832
Extract a common structure for holding information about the definition
...
of a C++ record. Exposed a lot of problems where various routines were
silently doing The Wrong Thing (or The Acceptable Thing in The Wrong Order)
when presented with a non-definition. Also cuts down on memory usage.
llvm-svn: 95330
2010-02-04 22:26:26 +00:00
Anders Carlsson
824e0613de
When binding an lvalue to a reference, we always need to pop temporaries.
...
With this fix, and the other fixes committed today a make check-all with a clang-built LLVM now gives:
Expected Passes : 6933
Expected Failures : 46
Unsupported Tests : 40
Unexpected Failures: 27
which means that we pass 99.96% of all tests :) The resulting 27 tests are all LLVMC tests and seem to be because of differences in the clang and gcc drivers.
llvm-svn: 95313
2010-02-04 17:32:58 +00:00
Anders Carlsson
9b942c65a5
Fix a bug where we would not mark temporaries as conditional when emitting a conditional operator as an lvalue.
...
llvm-svn: 95311
2010-02-04 17:26:01 +00:00
Anders Carlsson
ae612d22ac
Rename StartConditionalBranch/FinishConditionalBranch to BeginConditionalBranch/EndConditionalBranch.
...
llvm-svn: 95308
2010-02-04 17:18:07 +00:00
Anders Carlsson
c4325486b9
Fix another pointer-to-member function miscompile, this time when trying to call a virtual member function.
...
llvm-svn: 95307
2010-02-04 17:08:48 +00:00
Anders Carlsson
7914dad72d
Calculate offset correctly when taking the address of a virtual member function.
...
llvm-svn: 95305
2010-02-04 16:38:05 +00:00
John McCall
d061b4429e
Mangle member expressions. Also invented.
...
llvm-svn: 95284
2010-02-04 02:56:29 +00:00
John McCall
11ef09f8b5
Add a cautionary note about the mangling I just invented.
...
llvm-svn: 95275
2010-02-04 01:48:38 +00:00
John McCall
09de8ecd88
Add mangling support for calls, sizeof/alignof, constructor calls,
...
float literals, and unresolved lookups (which required hand-wavey extensions).
llvm-svn: 95273
2010-02-04 01:42:13 +00:00
Daniel Dunbar
45858d2d59
Revert "Numerous changes to selector handling:", this breaks a whole bunch of
...
working code, for no apparent reason.
llvm-svn: 95244
2010-02-03 20:11:42 +00:00
Anders Carlsson
66498388a7
Handle reference binding in aggregate initializers. Fixes another 47 tests.
...
llvm-svn: 95235
2010-02-03 19:13:55 +00:00
Anders Carlsson
9b92ef90f0
Add a band-aid fix for clang self-hosting. A better fix will follow shortly.
...
llvm-svn: 95232
2010-02-03 18:54:13 +00:00
Anders Carlsson
b247350ef7
More cleanup.
...
llvm-svn: 95226
2010-02-03 17:33:16 +00:00
Anders Carlsson
3b227bd629
Revert the new reference binding code; I came up with a way simpler solution for the reference binding bug that is preventing self-hosting.
...
llvm-svn: 95223
2010-02-03 16:38:03 +00:00
David Chisnall
5bb4efdf3c
First pass at adding GC support for GNU runtime. GC ivar maps not yet constructed, GC flag not set.
...
Please don't try using this yet - the runtime support is still very immature and your code will almost certainly crash if you do.
llvm-svn: 95222
2010-02-03 15:59:02 +00:00
Douglas Gregor
7dc5c17d92
When a function or variable somehow depends on a type or declaration
...
that is in an anonymous namespace, give that function or variable
internal linkage.
This change models an oddity of the C++ standard, where names declared
in an anonymous namespace have external linkage but, because anonymous
namespace are really "uniquely-named" namespaces, the names cannot be
referenced from other translation units. That means that they have
external linkage for semantic analysis, but the only sensible
implementation for code generation is to give them internal
linkage. We now model this notion via the UniqueExternalLinkage
linkage type. There are several changes here:
- Extended NamedDecl::getLinkage() to produce UniqueExternalLinkage
when the declaration is in an anonymous namespace.
- Added Type::getLinkage() to determine the linkage of a type, which
is defined as the minimum linkage of the types (when we're dealing
with a compound type that is not a struct/class/union).
- Extended NamedDecl::getLinkage() to consider the linkage of the
template arguments and template parameters of function template
specializations and class template specializations.
- Taught code generation to rely on NamedDecl::getLinkage() when
determining the linkage of variables and functions, also
considering the linkage of the types of those variables and
functions (C++ only). Map UniqueExternalLinkage to internal
linkage, taking out the explicit checks for
isInAnonymousNamespace().
This fixes much of PR5792, which, as discovered by Anders Carlsson, is
actually the reason behind the pass-manager assertion that causes the
majority of clang-on-clang regression test failures. With this fix,
Clang-built-Clang+LLVM passes 88% of its regression tests (up from
67%). The specific numbers are:
LLVM:
Expected Passes : 4006
Expected Failures : 32
Unsupported Tests : 40
Unexpected Failures: 736
Clang:
Expected Passes : 1903
Expected Failures : 14
Unexpected Failures: 75
Overall:
Expected Passes : 5909
Expected Failures : 46
Unsupported Tests : 40
Unexpected Failures: 811
Still to do:
- Improve testing
- Check whether we should allow the presence of types with
InternalLinkage (in addition to UniqueExternalLinkage) given
variables/functions internal linkage in C++, as mentioned in
PR5792.
- Determine how expensive the getLinkage() calls are in practice;
consider caching the result in NamedDecl.
- Assess the feasibility of Chris's idea in comment #1 of PR5792.
llvm-svn: 95216
2010-02-03 09:33:45 +00:00
Chris Lattner
eb1e610d00
remove a big chunk of #if 0 code.
...
llvm-svn: 95201
2010-02-03 05:28:17 +00:00
Douglas Gregor
db56b919e5
Provide a real fix for PR6199, reverting the old workaround. Here, we
...
realize that CXXConstructExpr is always implicit, so we should just
return its argument (if there is only one) rather than directly
invoking the constructor.
llvm-svn: 95192
2010-02-03 03:01:57 +00:00
David Chisnall
92b762e256
Numerous changes to selector handling:
...
- Don't use GlobalAliases with non-0 GEPs (GNU runtime) - this was unsupported and LLVM will be generating errors if you do it soon. This also simplifies the code generated by the GNU runtime a bit.
- Make GetSelector() return a constant (GNU runtime), not a load of a store of a constant.
- Recognise @selector() expressions as valid static initialisers (as GCC does).
- Add methods to GCObjCRuntime to emit selectors as constants (needed for using @selector() expressions as constants. These need implementing for the Mac runtimes - I couldn't figure out how to do this, they seem to require a load.
- Store an ObjCMethodDecl in an ObjCSelectorExpr so that we can get at the type information for the selector. This is needed for generating typed selectors from @selector() expressions (as GCC does). Ideally, this information should be stored in the Selector, but that would be an invasive change. We should eventually add checks for common uses of @selector() expressions. Possibly adding an attribute that can be applied to method args providing the types of a selector so, for example, you'd do something like this:
- (id)performSelector: __attribute__((selector_types(id, SEL, id)))(SEL)
withObject: (id)object;
Then, any @selector() expressions passed to the method will be check to ensure that it conforms to this signature. We do this at run time on the GNU runtime already, but it would be nice to do it at compile time on all runtimes.
- Made @selector() expressions emit type info if available and the runtime supports it.
Someone more familiar with the Mac runtime needs to implement the GetConstantSelector() function in CGObjCMac. This currently just assert()s.
llvm-svn: 95189
2010-02-03 02:09:30 +00:00
John McCall
2adddcae7e
Remove abstract expression kinds from the StmtClass enum. Update a few users
...
appropriately. Call out a few missing cases in the expression mangler.
llvm-svn: 95176
2010-02-03 00:55:45 +00:00
Douglas Gregor
a71cc15361
Implement promotion for enumeration types.
...
WHAT!?!
It turns out that Type::isPromotableIntegerType() was not considering
enumeration types to be promotable, so we would never do the
promotion despite having properly computed the promotion type when the
enum was defined. Various operations on values of enum type just
"worked" because we could still compute the integer rank of an enum
type; the oddity, however, is that operations such as "add an enum and
an unsigned" would often have an enum result type (!). The bug
actually showed up as a spurious -Wformat diagnostic
(<rdar://problem/7595366>), but in theory it could cause miscompiles.
In this commit:
- Enum types with a promotion type of "int" or "unsigned int" are
promotable.
- Tweaked the computation of promotable types for enums
- For all of the ABIs, treat enum types the same way as their
underlying types (*not* their promotion types) for argument passing
and return values
- Extend the ABI tester with support for enumeration types
llvm-svn: 95117
2010-02-02 20:10:50 +00:00
Anders Carlsson
5dc86337fb
Set the correct vtable pointers _before_ generating code for any member initializers. Fixes about ~2000 clang/LLVM tests in the clang-on-clang build.
...
llvm-svn: 95116
2010-02-02 19:58:43 +00:00
Chandler Carruth
173bfe477b
Use the Arg variable rather than re-computing it. This also silences GCC's
...
unused variable warning.
llvm-svn: 95085
2010-02-02 12:15:55 +00:00
John McCall
49786a6c31
Codegen CXXConstructExprs with trivial constructors as constants.
...
Eliminates a lot of spurious global initializers, fixing PR6205.
llvm-svn: 95077
2010-02-02 08:02:49 +00:00
Anders Carlsson
75b1f959da
Check in a test case and a nasty workaround for PR6199.
...
llvm-svn: 95076
2010-02-02 07:10:35 +00:00
Anders Carlsson
e8bfe412ec
Improve handling of emitting 'null' pointers to data members.
...
llvm-svn: 95066
2010-02-02 05:17:25 +00:00
Anders Carlsson
259688ce29
Move pointer to data member emission to CodeGenModule and use it in CGExprConstant. Fixes PR5674.
...
llvm-svn: 95063
2010-02-02 03:37:46 +00:00
Daniel Dunbar
96ebba5770
ARM/APCS: Fix classification of small complex integer types as "integer like".
...
llvm-svn: 95030
2010-02-01 23:31:26 +00:00
Daniel Dunbar
eedf151cb1
ARM/APCS: Pass Complex types following llvm-gcc.
...
llvm-svn: 95029
2010-02-01 23:31:19 +00:00
Devang Patel
ab793231c1
Fix FIXME and surrounding comment.
...
llvm-svn: 95023
2010-02-01 22:51:29 +00:00
Devang Patel
e8fb4b7fd6
Use appropriate context descriptor in RecordDecl's debug info.
...
llvm-svn: 95016
2010-02-01 22:40:08 +00:00
Devang Patel
3efd1470c9
Do not use clang type name to name a local variable, e.g. Decl.
...
llvm-svn: 95010
2010-02-01 21:52:22 +00:00
Devang Patel
1c0954cca7
Do not use clang type name to name a local variable, e.g. Decl.
...
llvm-svn: 95009
2010-02-01 21:39:52 +00:00
Devang Patel
7b7f46f5a6
Use DeclContext as getContextDescriptor() argument.
...
llvm-svn: 95008
2010-02-01 21:34:11 +00:00
Daniel Dunbar
ca5e3eb7f7
NeXT: Add support for -fobjc-legacy-dispatch.
...
llvm-svn: 95005
2010-02-01 21:07:33 +00:00
Chris Lattner
5b5d2db3f6
Don't explicitly force utf strings into the __TEXT,__ustring
...
by setting the section of the generated global. This is an
optimization done by the code generator, and the code being
removed didn't handle the case when the string contained an
embedded nul (which the code generator does correctly
handle). This is rdar://7589850
llvm-svn: 95003
2010-02-01 20:59:08 +00:00
Sebastian Redl
5ca7984bb4
In C++, an initializer on a variable doesn't necessarily mean it's the definition. With that in mind, rename getDefinition to getAnyInitializer (to distinguish it from getInit) and reimplement it in terms of isThisDeclarationADefinition. Update all code to use this new function.
...
llvm-svn: 94999
2010-02-01 20:16:42 +00:00
Devang Patel
973f2eb0cd
Emit debug info for namespaces.
...
llvm-svn: 94991
2010-02-01 19:16:32 +00:00
Eli Friedman
a682427e42
Switch expressions like T() and T(1,2) over to new-style initialization. I'm
...
not quite sure what we want to do about the AST representation; comments
welcome.
llvm-svn: 94967
2010-01-31 20:58:15 +00:00
Eli Friedman
604179775a
Simplify EmitMemberInitializer; no intended functionality change.
...
llvm-svn: 94965
2010-01-31 19:07:50 +00:00
Anders Carlsson
ab0ddb57b1
Start creating CXXBindReferenceExpr nodes when binding complex types to references.
...
llvm-svn: 94964
2010-01-31 18:34:51 +00:00
Douglas Gregor
7ae2d7758f
Rework base and member initialization in constructors, with several
...
(necessarily simultaneous) changes:
- CXXBaseOrMemberInitializer now contains only a single initializer
rather than a set of initialiation arguments + a constructor. The
single initializer covers all aspects of initialization, including
constructor calls as necessary but also cleanup of temporaries
created by the initializer (which we never handled
before!).
- Rework + simplify code generation for CXXBaseOrMemberInitializers,
since we can now just emit the initializer as an initializer.
- Switched base and member initialization over to the new
initialization code (InitializationSequence), so that it
- Improved diagnostics for the new initialization code when
initializing bases and members, to match the diagnostics produced
by the previous (special-purpose) code.
- Simplify the representation of type-checked constructor initializers in
templates; instead of keeping the fully-type-checked AST, which is
rather hard to undo at template instantiation time, throw away the
type-checked AST and store the raw expressions in the AST. This
simplifies instantiation, but loses a little but of information in
the AST.
- When type-checking implicit base or member initializers within a
dependent context, don't add the generated initializers into the
AST, because they'll look like they were explicit.
- Record in CXXConstructExpr when the constructor call is to
initialize a base class, so that CodeGen does not have to infer it
from context. This ensures that we call the right kind of
constructor.
There are also a few "opportunity" fixes here that were needed to not
regress, for example:
- Diagnose default-initialization of a const-qualified class that
does not have a user-declared default constructor. We had this
diagnostic specifically for bases and members, but missed it for
variables. That's fixed now.
- When defining the implicit constructors, destructor, and
copy-assignment operator, set the CurContext to that constructor
when we're defining the body.
llvm-svn: 94952
2010-01-31 09:12:51 +00:00
Anders Carlsson
6276b2506d
When performing a derived-to-base cast that we know will not change the offset, we don't need to null check the input pointer. Fixes PR5965.
...
llvm-svn: 94942
2010-01-31 02:39:02 +00:00
Anders Carlsson
600f737b95
When doing a base-to-derived cast we don't need to null check the derived value if the class offset is 0.
...
llvm-svn: 94939
2010-01-31 01:43:37 +00:00
Anders Carlsson
84673e200f
Some class related cleanup.
...
llvm-svn: 94938
2010-01-31 01:36:53 +00:00
Anders Carlsson
087bc13d96
More asm cleanup.
...
llvm-svn: 94920
2010-01-30 20:05:21 +00:00
Anders Carlsson
c7c5baa482
Yay for more StringRefs.
...
llvm-svn: 94917
2010-01-30 19:12:25 +00:00
Devang Patel
bb4820dc8e
Use appropriate context for typedefs.
...
llvm-svn: 94849
2010-01-29 22:29:31 +00:00
Devang Patel
92e2541599
Maintain a map of regions (lexical scopes) and use it to find context for a global variable.
...
llvm-svn: 94817
2010-01-29 18:11:03 +00:00
Douglas Gregor
16810ca647
Name mangling for cast expressions, from Matthias Schiffer! Fixes PR5876.
...
llvm-svn: 94811
2010-01-29 16:37:09 +00:00
Anders Carlsson
42c876dff2
Use EmitLValueForFieldInitialization when synthesizing the copy ctor as well.
...
llvm-svn: 94800
2010-01-29 05:41:25 +00:00
Anders Carlsson
db78f0ad04
Add a new EmitLValueForFieldInitialization that will be used for initializing fields (and reference type fields in particular).
...
llvm-svn: 94799
2010-01-29 05:24:29 +00:00
Anders Carlsson
5d8645b150
Simplify EmitLValueForField - we can get whether the field is part of a union or not from the FieldDecl (through its DeclContext).
...
llvm-svn: 94798
2010-01-29 05:05:36 +00:00
Daniel Dunbar
45c7ff1d79
ARM/APCS ABI: Fix some problems with bit-fields in structures. After rereading
...
the ABI spec, this turns out to simplify the code. We still have some annoying
code which mismatches the spec with regard to empty structures.
llvm-svn: 94796
2010-01-29 03:22:29 +00:00
Anders Carlsson
ba6c437d52
Add an CXXBindReferenceExpr (not used just yet).
...
llvm-svn: 94791
2010-01-29 02:39:32 +00:00
Devang Patel
7bfc596fcf
s/CGDebugInfo::getContext/CGDebugInfo::getContextDescriptor/g to avoid confusion.
...
llvm-svn: 94760
2010-01-28 23:15:27 +00:00
Devang Patel
128aa9d176
Fix indentation.
...
llvm-svn: 94758
2010-01-28 21:54:15 +00:00
Devang Patel
4c3e7e99ca
Static methods do not need "this" pointer argument.
...
llvm-svn: 94756
2010-01-28 21:43:50 +00:00
Devang Patel
946edc1aa6
Emit base classes info first, as expected by the debugger.
...
llvm-svn: 94755
2010-01-28 21:41:35 +00:00
Anders Carlsson
b1ef991097
Fix an incorrect union layout assert. Fixes PR6164.
...
llvm-svn: 94754
2010-01-28 18:22:03 +00:00
Devang Patel
0d61eebd81
s/FunctionNames/DebugInfoNames/g
...
llvm-svn: 94753
2010-01-28 18:21:00 +00:00
Devang Patel
84033fb240
Emit vtable info.
...
llvm-svn: 94751
2010-01-28 18:11:52 +00:00
Devang Patel
abb4413728
While emitting debugging infor for a C++ class, identify the holder of class's vtable, if any.
...
llvm-svn: 94712
2010-01-28 00:54:21 +00:00
Devang Patel
3d4e6d9dd0
Include "this" pointer argument while emitting debug info for a C++ method.
...
llvm-svn: 94710
2010-01-28 00:28:01 +00:00
Ken Dyck
160146eba2
Change the return type of ASTContext::getDeclAlignInBytes() to CharUnits and,
...
now that the "InBytes" part of the name is implied by the return type, rename
it to getDeclAlign().
llvm-svn: 94681
2010-01-27 17:10:57 +00:00
David Chisnall
358e751a7b
Unique ObjC strings (GNU Runtime); fix for PR6142. Note: Doing this in the runtime-specific code is a bit ugly. It would be a good idea to hoist all of the string / protocol uniqueing code up into CGObjCRuntime or CodeGenModule and only handle emitting the original versions in the runtime-specific code.
...
llvm-svn: 94676
2010-01-27 12:49:23 +00:00
Anders Carlsson
40446e8a0a
Structs and classes with non-trivial destructors or copy constructors should be passed indirectly in the 32-bit ABI. Fixes PR6094.
...
llvm-svn: 94656
2010-01-27 03:25:19 +00:00
Mike Stump
ded0a406b4
Refine the non-virtual this adjustments for thunks by using the offset
...
to the declaring class from the nearest virtual base class. WIP.
llvm-svn: 94606
2010-01-26 22:44:01 +00:00
Mike Stump
a04ecfb701
Refine the non-virtual this adjustments for thunks by using the offset
...
to the declaring class from the nearest virtual base class. WIP.
This fixes 40% of all the problems remaining in one of my testcases.
llvm-svn: 94592
2010-01-26 21:35:27 +00:00
Ken Dyck
7df3cbeb01
Convert one last size variable to CharUnits (follow-on to 94577).
...
llvm-svn: 94579
2010-01-26 19:59:28 +00:00
Ken Dyck
3eb55cfe8a
Use CharUnits for sizes, offsets, alignments, and padding amounts for values
...
that are in character units.
llvm-svn: 94577
2010-01-26 19:44:24 +00:00
Ken Dyck
5262b11962
Use CharUnits for alignments in character units.
...
llvm-svn: 94571
2010-01-26 19:13:33 +00:00
Ken Dyck
a0f99ff230
Use CharUnits for alignment of UTF16 string in GetAddrOfConstantCFString().
...
llvm-svn: 94564
2010-01-26 18:46:23 +00:00
Ken Dyck
e5402e4749
Use CharUnits for alignment in EmitNullInitializationLValue().
...
llvm-svn: 94563
2010-01-26 18:35:11 +00:00
Anders Carlsson
ca4a5459d8
Use the right definition when emitting a global variable. Fixes PR5564.
...
llvm-svn: 94555
2010-01-26 17:43:42 +00:00
Anders Carlsson
7228117108
Change getUnique to return a GlobalDecl. Fixes PR6147.
...
llvm-svn: 94554
2010-01-26 17:36:47 +00:00
Ken Dyck
98ca79435a
Introduce CodeGenModule::GetTargetTypeStoreSize() to calculate the store size
...
of LLVM types in character units.
llvm-svn: 94542
2010-01-26 13:48:07 +00:00
Anders Carlsson
d6b21e4842
If a global variable has an initializer with side effects, it can never be deferred (even if it's in an anonymous namespace).
...
llvm-svn: 94525
2010-01-26 06:15:16 +00:00
Anders Carlsson
0b5f1ddf0a
Fix another debug info crash with virtual bases.
...
llvm-svn: 94520
2010-01-26 05:26:39 +00:00
Anders Carlsson
17ed0496c5
Fix the test I broke, and also fix a crash when declaring a virtual destructor. Add debug info support for pure virtual member functions.
...
llvm-svn: 94519
2010-01-26 05:19:50 +00:00
Anders Carlsson
b85f0ab976
Factor creating the DISubprogram for a member function out into a separate function.
...
llvm-svn: 94513
2010-01-26 04:49:33 +00:00
Anders Carlsson
c1821155bf
Simplify CGDebugInfo::CollectCXXMemberFunctions a little. More to come.
...
llvm-svn: 94511
2010-01-26 04:40:11 +00:00
Anders Carlsson
20bbbd489b
Make sure to always mark a global variable as not being constant if it has a C++ initializer.
...
llvm-svn: 94504
2010-01-26 04:02:23 +00:00
Mike Stump
77537b136e
Be sure to track the non-virtual part of the vcall offset in complex
...
multiple inheritance cases. WIP.
This fixes 20% of the outstanding problems found by the randomized
tester.
llvm-svn: 94499
2010-01-26 03:42:22 +00:00
Mike Stump
90181eb294
Fixup a missing vcall entry. WIP.
...
llvm-svn: 94478
2010-01-26 00:05:04 +00:00
Devang Patel
c54353d935
First cut at emitting inheritance info.
...
llvm-svn: 94473
2010-01-25 23:32:18 +00:00
Devang Patel
7af03fb4f0
Emit debug info for virtual functions.
...
llvm-svn: 94467
2010-01-25 23:17:15 +00:00
Fariborz Jahanian
5cda92820f
global variable that binds reference to a non-lvalue reproted
...
as NYI now.
llvm-svn: 94453
2010-01-25 21:40:39 +00:00
Fariborz Jahanian
210031b79c
Fix a code gen. bug involving compiling global references.
...
(fixes radar 7574896).
llvm-svn: 94434
2010-01-25 18:30:26 +00:00
Chris Lattner
83b0dd16c3
fix rdar://7556129 a crash in blocks debug info codegen.
...
llvm-svn: 94402
2010-01-25 03:34:56 +00:00
Chris Lattner
bf78478d35
simplify code.
...
llvm-svn: 94401
2010-01-25 03:29:35 +00:00
Chris Lattner
0bcc858a2b
-fno-rtti is now the default.
...
llvm-svn: 94379
2010-01-24 20:43:31 +00:00
Alexis Hunt
aecc45cb3c
Mangle static variables with an extra name to distinguish them from non-static variables in the same TU.
...
Fixes PR5966 for real this time; also reverts r92911, which had a incorrect fix.
llvm-svn: 94352
2010-01-24 03:04:27 +00:00
Anders Carlsson
60ddba67a8
Fix a nasty bug where temporaries weren't marked as being conditional in some cases.
...
llvm-svn: 94341
2010-01-24 00:20:05 +00:00
Eli Friedman
d6ef69a7db
Add bzero builtin; this should help codegen quality for code using this
...
function.
llvm-svn: 94320
2010-01-23 19:00:10 +00:00
Benjamin Kramer
8f8f405c71
No need to terminate this buffer.
...
llvm-svn: 94313
2010-01-23 18:16:07 +00:00
David Chisnall
481e3a87fe
Created __builtin___NSStringMakeConstantString() builtin, which generates constant Objective-C strings.
...
llvm-svn: 94274
2010-01-23 02:40:42 +00:00
Mike Stump
1f49d65235
Finish off fixing up debug information.
...
llvm-svn: 94193
2010-01-22 18:48:47 +00:00
Douglas Gregor
0599df16a6
Eliminate some Clang warnings
...
llvm-svn: 94177
2010-01-22 15:41:14 +00:00
Benjamin Kramer
d6b28fc6ad
Simplify code.
...
llvm-svn: 94175
2010-01-22 13:59:13 +00:00
Mike Stump
9eb76d47f2
Ensure we output all non-virtual base vtables. Fixes PR5890.
...
llvm-svn: 94163
2010-01-22 06:45:05 +00:00
Mike Stump
d2808449e4
Update debugging code.
...
llvm-svn: 94145
2010-01-22 02:51:26 +00:00
Anders Carlsson
f768db7775
Move the VTT related code into its own file, CGVTT.cpp
...
llvm-svn: 94079
2010-01-21 16:50:45 +00:00
Devang Patel
3f4a77e082
A Decl->getName() is not unique. However, the debug info descriptors
...
are uniqued. The debug info descriptor describing record's context is
necessary to keep two Decl's descriptor unique if their name match.
There is more work to do to create descriptors for DeclContext.
As a temp. step use type's name in FwdDecl.
llvm-svn: 94050
2010-01-20 23:56:40 +00:00
Devang Patel
5e1a83c196
Emit human readable names for operators.
...
llvm-svn: 93837
2010-01-19 02:02:11 +00:00
Devang Patel
7a12ad0dc1
First cut at emitting debugging information for C++ member functions.
...
There is lot more work to do in this area.
llvm-svn: 93836
2010-01-19 01:54:44 +00:00
Devang Patel
757daca99c
Use llvm::Function name as the linkage name, but strip off leading '01' from display name.
...
llvm-svn: 93822
2010-01-19 00:25:12 +00:00
Devang Patel
889ce76f41
Refactor.
...
llvm-svn: 93814
2010-01-19 00:00:59 +00:00
Devang Patel
ddf6a57f3e
llvm::Function name is the linkage name. If it has a '01' as a prefix then probably there is a reason.
...
llvm-svn: 93808
2010-01-18 23:27:28 +00:00
Anders Carlsson
07894e8a0e
More VTT builder fixes. With these fixes we now correctly handle the very complex VTT example from the Itanium ABI spec.
...
llvm-svn: 93725
2010-01-18 17:13:59 +00:00
Anders Carlsson
3d1a09552c
Move some common code into BuildVTT.
...
llvm-svn: 93710
2010-01-18 04:45:46 +00:00
Anders Carlsson
1af3df854f
Fix a bunch of VTT layout bugs, add simple tests for VTT layout.
...
llvm-svn: 93709
2010-01-18 04:25:18 +00:00
Anders Carlsson
827b245fd6
Minor VTT builder cleanup, no functionality change.
...
llvm-svn: 93696
2010-01-17 23:53:20 +00:00
Anders Carlsson
42f1376f35
Get the ctor vtable address points directly from the VTT builder.
...
llvm-svn: 93681
2010-01-17 17:10:44 +00:00
Tanya Lattner
dbfd16014a
Add codgen for BI__builtin_llvm_memory_barrier.
...
llvm-svn: 93611
2010-01-16 01:21:14 +00:00
Eli Friedman
8fdc2cb46a
Fix crash generating debug info for constructor for anonymous struct.
...
llvm-svn: 93601
2010-01-16 00:43:13 +00:00
Eli Friedman
cab014721b
Fix a couple bugs in copy assignment operator synthesis.
...
llvm-svn: 93546
2010-01-15 20:06:11 +00:00
Ken Dyck
02990837ad
Convert the type of the LValue offset variable in APValue to CharUnits, moving
...
the LValue-related methods of APValue out of line to avoid header file leaching.
llvm-svn: 93512
2010-01-15 12:37:54 +00:00
Devang Patel
2d63010a9c
Emit linkage name even if it matches regular name. The code generator uses linkage name to find subprogram entry for the current function.
...
llvm-svn: 93461
2010-01-14 21:46:57 +00:00
Devang Patel
ea84f59f5c
Add comment.
...
llvm-svn: 93434
2010-01-14 18:06:13 +00:00
David Chisnall
035ead209f
Made ObjC method name mangling match GCC (which does it in a stupid and broken way that can give conflicts on method names containing underscores, but is needed for gdb to work because gdb does not know how to read ObjC class tables and relies on the mangling).
...
llvm-svn: 93427
2010-01-14 14:08:19 +00:00
Anders Carlsson
5f9a881e1e
Store the address points for constructor vtables directly in the VTT builder, because that's the only time they're needed.
...
llvm-svn: 93412
2010-01-14 02:29:07 +00:00
Anders Carlsson
2a4adbea96
Add a DenseMapInfo specialization for BaseSubobject.
...
llvm-svn: 93399
2010-01-14 01:39:42 +00:00
Devang Patel
4274a326be
Because CurLoc is the current source location as far as CGDebugInfo is concerned. It is expected that this is set (usually left bracket location of function body compound statement) before EmitfunctionStart() is used.
...
llvm-svn: 93389
2010-01-14 00:48:09 +00:00
Devang Patel
934661ed73
Emit human readable names for c/c++ functions. Avoid emitting linkage name if it matches regular name.
...
llvm-svn: 93383
2010-01-14 00:36:21 +00:00
Anders Carlsson
20871481d2
Add a BaseSubobject class to uniquely identify a base class subobject. Not yet used.
...
llvm-svn: 93345
2010-01-13 20:11:15 +00:00
Chris Lattner
e3e76e2a69
Use the new isInteger() method in a couple places, some random cleanup, and
...
add a fixme.
llvm-svn: 93179
2010-01-11 19:58:10 +00:00
David Chisnall
c8fc573ea0
Fix type mismatch on 64-bit platforms (GNU ObjC).
...
llvm-svn: 93169
2010-01-11 19:02:35 +00:00
Ken Dyck
40775003e6
Roll out ASTContext::getTypeSizeInChars(), replacing instances of
...
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits
ones as appropriate.
Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType,
fromQuantity(), and getQuantity() for clarity.
llvm-svn: 93153
2010-01-11 17:06:35 +00:00
Anton Korobeynikov
b322c3a34b
Try to make cmake happy
...
llvm-svn: 93119
2010-01-10 13:06:34 +00:00
Anton Korobeynikov
55bcea1e65
Generalize target weirdness handling having proper layering in mind:
...
1. Add helper class for sema checks for target attributes
2. Add helper class for codegen of target attributes
As a proof-of-concept - implement msp430's 'interrupt' attribute.
llvm-svn: 93118
2010-01-10 12:58:08 +00:00
Anton Korobeynikov
89b14a4309
Rename file to generalization in next commits
...
llvm-svn: 93117
2010-01-10 12:57:30 +00:00
Chris Lattner
bb8976e36e
implement codegen support for preinc as an lvalue, PR5514.
...
llvm-svn: 93076
2010-01-09 21:44:40 +00:00
Chris Lattner
116ce8f172
refactor pre/postinc logic into CGF and require the caller to pass in the
...
lvalue to poke, no functionality change.
llvm-svn: 93075
2010-01-09 21:40:03 +00:00
Chris Lattner
34c72dd683
revert r92749, which is just dead code.
...
llvm-svn: 93074
2010-01-09 21:14:47 +00:00
Eli Friedman
5866fe306d
Fix for PR5967: Make const-marking for LLVM globals correct for cases requiring
...
run-time initialization, and emit run-time initializers aggresively to avoid
ordering issues with deferred globals.
llvm-svn: 92976
2010-01-08 00:50:11 +00:00
David Chisnall
df34917a38
Export a public symbol for classes with the GNU runtime.
...
llvm-svn: 92973
2010-01-08 00:14:31 +00:00
Nuno Lopes
950d5b2cd3
fix PR5869: mangle static symbols like gcc does to make it easier to diff symbol tables
...
llvm-svn: 92911
2010-01-07 09:36:51 +00:00
Douglas Gregor
2a34df3264
Fix linkage for RTTI names by re-using the logic for computing the
...
linkage of vtables. Before this, we were emitting RTTI names for
template instantiations with strong external linkage rather than with
weak ODR linkage.
llvm-svn: 92857
2010-01-06 22:00:56 +00:00
Douglas Gregor
ccecc1bb43
Fix marking of virtual members for nested classes whose first non-pure virtual function has a body inlined in the class
...
llvm-svn: 92855
2010-01-06 20:27:16 +00:00
David Chisnall
9a2073c035
Fix for PR5691
...
llvm-svn: 92846
2010-01-06 18:02:59 +00:00
Daniel Dunbar
a671c2a9fe
Fix (invalid) may-be-uninitialized warning.
...
llvm-svn: 92828
2010-01-06 07:13:04 +00:00
Douglas Gregor
d01472beee
Revert my available_externally vtables experiment. It's breaking the LLVM-with-Clang build with linker errors that I have yet to investigate.
...
llvm-svn: 92822
2010-01-06 04:50:56 +00:00
Mike Stump
81478719a7
Reorder to avoid invalidating idx which is an accessor into VCall.
...
llvm-svn: 92819
2010-01-06 03:09:19 +00:00
Douglas Gregor
26751ffc53
Silence bogus GCC warning
...
llvm-svn: 92787
2010-01-05 21:55:26 +00:00
Douglas Gregor
1a68ab6c83
Make use of available_externally linkage for vtables when the
...
non-inline key function of a class template instantiation, when no key
function is present, the class template instantiation itself was
instantiated with an explicit instantiation declaration (aka extern
template). I'm fairly certain that the C++0x specification gives us
this lattitude, although GCC doesn't take advantage of it.
llvm-svn: 92779
2010-01-05 21:40:05 +00:00
Douglas Gregor
a318efd1f2
Improve key-function computation for templates. In particular:
...
- All classes can have a key function; templates don't change that.
non-template classes when computing the key function.
- We always mark all of the virtual member functions of class
template instantiations.
- The vtable for an instantiation of a class template has weak
linkage.
We could probably use available_externally linkage for vtables of
classes instantiated by explicit instantiation declarations (extern
templates), but GCC doesn't do this and I'm not 100% that the ABI
permits it.
llvm-svn: 92753
2010-01-05 19:06:31 +00:00
Mike Stump
79ed590c85
Add code to skip the emission of available externally functions at -O0. WIP.
...
llvm-svn: 92749
2010-01-05 18:48:04 +00:00
Anders Carlsson
a0b025e40f
When emitting member function pointers, use the canonical decl if the member function is virtual. Fixes PR5940.
...
llvm-svn: 92680
2010-01-05 05:04:05 +00:00
Daniel Dunbar
d443c0a02a
Revert r92431, this code isn't dead and broke the ntfs build.
...
llvm-svn: 92493
2010-01-04 18:47:06 +00:00
Daniel Dunbar
5b9019515a
Fix -Asserts warning.
...
llvm-svn: 92491
2010-01-04 18:02:28 +00:00
Eli Friedman
6257e08a3d
Get rid of more dead code.
...
llvm-svn: 92439
2010-01-03 01:11:47 +00:00
Eli Friedman
c52a9367b3
Get rid of some unnecessary code.
...
llvm-svn: 92432
2010-01-02 23:43:59 +00:00
Eli Friedman
14e4005851
Delete impossible case.
...
llvm-svn: 92431
2010-01-02 23:28:56 +00:00
Anders Carlsson
c92a37e917
Speculative MSVC fix.
...
llvm-svn: 92421
2010-01-02 18:46:23 +00:00
Anders Carlsson
93a1884fde
Move address points to CGVtableInfo, no functionality change.
...
llvm-svn: 92420
2010-01-02 18:02:32 +00:00
Anders Carlsson
e36a6b3e44
Correctly pass VTT parameters to constructors and destructors. The VTTs aren't yet used in the ctors/dtors, but that will follow.
...
llvm-svn: 92409
2010-01-02 01:01:18 +00:00
Anders Carlsson
27da15ba8e
Move a few more functions away from CGCXX and to CGClass and CGExprCXX.
...
llvm-svn: 92399
2010-01-01 20:29:01 +00:00
Mike Stump
9d44fdb397
Fix last patch, catch of reference to non-pointer.
...
llvm-svn: 92386
2010-01-01 03:20:32 +00:00
Mike Stump
5ee041873b
Fix catching a reference to a pointer.
...
llvm-svn: 92385
2010-01-01 02:51:52 +00:00
Anders Carlsson
2d21394190
If the key function of a record is inline, then the RTTI data should have weak_odr linkage.
...
llvm-svn: 92371
2009-12-31 19:36:25 +00:00
Anders Carlsson
7ae81bb711
More RTTI builder cleanup.
...
llvm-svn: 92360
2009-12-31 17:43:53 +00:00
Anders Carlsson
a442499072
Fix a bunch of bugs with VMI RTTI building, and add a whole bunch of tests.
...
llvm-svn: 92319
2009-12-30 23:47:56 +00:00
Anders Carlsson
ac2f681777
More RTTI cleanup, test that RTTI classes have the correct vtables.
...
llvm-svn: 92284
2009-12-30 01:00:12 +00:00
Anders Carlsson
79c184e975
Match gcc and treat vector types as fundamental types.
...
llvm-svn: 92278
2009-12-29 22:30:11 +00:00
Anders Carlsson
ef88695860
Handle enum types as well.
...
llvm-svn: 92276
2009-12-29 22:13:01 +00:00
Anders Carlsson
0e4151c685
Test linkage of RTTI descriptors of array types.
...
llvm-svn: 92274
2009-12-29 21:58:32 +00:00
Anders Carlsson
26cf4ab8e2
Fix function type RTTI linkage and add tests.
...
llvm-svn: 92266
2009-12-29 20:20:19 +00:00
Chris Lattner
3f8e5dd898
strength reduce this call away.
...
llvm-svn: 92253
2009-12-29 07:49:13 +00:00
Anders Carlsson
88ea2455f8
Get rid of FixedWidthIntType, as suggested by Chris and Eli.
...
llvm-svn: 92246
2009-12-29 07:07:36 +00:00
Chris Lattner
9f021fd05d
adjust for llvm api changes.
...
llvm-svn: 92236
2009-12-28 23:41:39 +00:00
Chris Lattner
5e124bf913
this form of SetDebugLocation is about to go away, add some #includes that
...
are about to not come in implicitly.
llvm-svn: 92228
2009-12-28 21:44:41 +00:00
Anton Korobeynikov
73d50b9141
Promote arguments of frameaddr / returnaddr builtins to i32 type, when needed.
...
This is needed for the platforms, where bitwidth of "int" is not 32 bits
(e.g. 16 on msp430).
llvm-svn: 92176
2009-12-27 14:27:22 +00:00
Eli Friedman
1e26278b3b
Add a sanity assertion so that we don't silently generate bad code; I'll file
...
a bug with a testcase hitting this assertion in a moment.
llvm-svn: 92175
2009-12-27 07:02:50 +00:00
Eli Friedman
af76ad73ed
Fix obvious mistake.
...
llvm-svn: 92172
2009-12-27 03:44:17 +00:00
Benjamin Kramer
d20ef75b91
Remove some dead variables clang-analyzer found.
...
llvm-svn: 92162
2009-12-25 15:43:36 +00:00
Eli Friedman
b8841af8bd
Minor optimization; emit proper unsupported messages for a couple of cases.
...
llvm-svn: 92153
2009-12-25 06:17:05 +00:00
Eli Friedman
2e06e8bbcc
Some small improvements to dead code elimination; helps a bit on
...
LLVM-Code-Symbols test.
llvm-svn: 92152
2009-12-25 05:29:40 +00:00
Eli Friedman
fddc26cc64
Make copy constructor elimination work in more cases; the case in question
...
here affects clang-on-clang.
llvm-svn: 92151
2009-12-24 23:33:34 +00:00
Anders Carlsson
fb404888af
Move a bunch of class related functions to CGClass.cpp, no functionality change.
...
llvm-svn: 92148
2009-12-24 22:46:43 +00:00
Anders Carlsson
bfb3671b25
Pass the return value slot to all call exprs.
...
llvm-svn: 92145
2009-12-24 21:13:40 +00:00
Anders Carlsson
1749083e2e
Fill in the return value slot in CGExprAgg::VisitCallExpr. This takes us halfway towards fixing PR5824.
...
llvm-svn: 92142
2009-12-24 20:40:36 +00:00
Anders Carlsson
61a401caec
Pass ReturnValueSlot to EmitCall. No functionality change yet.
...
llvm-svn: 92138
2009-12-24 19:25:24 +00:00
Anders Carlsson
0435ed5875
Add a ReturnValueSlot class. Change the argument order in EmitCall to match the other overload better.
...
llvm-svn: 92136
2009-12-24 19:08:58 +00:00
Douglas Gregor
5c13090bd4
Fix double-destruction assertion to account for temporaries in conditionals
...
llvm-svn: 92134
2009-12-24 18:16:21 +00:00
Douglas Gregor
4cd5d53ebf
Assert that we aren't trying to push the same C++ temporary onto the live temporary stack twice. A little insurance against PR5867 surprising us again
...
llvm-svn: 92132
2009-12-24 17:48:05 +00:00
Mike Stump
d538a6d364
Remove some dead code.
...
llvm-svn: 92123
2009-12-24 07:29:41 +00:00
Mike Stump
4a779b93e4
Cleanup some dead code.
...
llvm-svn: 92122
2009-12-24 06:52:05 +00:00
Mike Stump
bb2f57dd39
Don't set hidden for a non-external symbol as that would make it extenal.
...
Refine codegen for visibility and hidden. WIP.
llvm-svn: 92118
2009-12-24 02:33:48 +00:00
David Chisnall
3a509cd8cc
Fix for bug 5691.
...
This fixes throwing exceptions inside @catch blocks nested inside outer @try blocks and also fixes jumping from an inner @finally to an outer @finally (via any relevant @catch blocks).
The code exhibiting this bug was based on code from CGObjCMac. I believe that this bug may still be present on the Mac runtimes, although the test case in the bug contains a few GNUisms and won't compile without some minor tweaks with Apple's libobjc.
llvm-svn: 92117
2009-12-24 02:26:34 +00:00
Mike Stump
a8a2a33af9
Fix recent regression caught by g++.old-deja/g++.mike/eh19.C.
...
llvm-svn: 92109
2009-12-24 01:10:27 +00:00
Mike Stump
f3c23c0cd4
Fix regression found by g++.dg/eh/alias1.C.
...
llvm-svn: 92072
2009-12-23 22:48:20 +00:00
Anders Carlsson
a88d197284
Mangle block pointer types. Fixes PR5858.
...
llvm-svn: 92069
2009-12-23 22:31:44 +00:00
Douglas Gregor
247894b361
There is no such thing as typeinfo for a cv-qualified type. Assert
...
that this is true when mangling, then fix up the various places in
Sema and/or CodeGen that need to remove qualifiers. Addresses a
linking issue when building LLVM with Clang.
llvm-svn: 92064
2009-12-23 22:04:40 +00:00
Chris Lattner
f0a9ba37d4
simplify my previous patch.
...
llvm-svn: 92057
2009-12-23 21:33:41 +00:00
Chris Lattner
4e1a323b85
fix opencl extvector element extraction on rvalues. We previously
...
error_unsupported on test10 and crashed on test11.
llvm-svn: 92056
2009-12-23 21:31:11 +00:00
Anders Carlsson
910847c149
Mangle template template parameters. Fixes PR5861.
...
llvm-svn: 92030
2009-12-23 19:30:55 +00:00
Eric Christopher
c87915629b
Update for the intrinsic changes in llvm: the object size intrinsic
...
only takes a boolean second argument now. Update tests accordingly.
Currently the builtin still accepts the full range for compatibility.
llvm-svn: 91983
2009-12-23 03:49:37 +00:00
Ken Dyck
8c89d59c82
Move the implementation of ASTContext::getTypeSizeInChars() to the .cpp file to
...
avoid #including CharUnits.h in ASTContext.h.
llvm-svn: 91903
2009-12-22 14:23:30 +00:00
Anders Carlsson
8a35c7982c
Make sure that we mangle overloaded operators that are member functions correctly, giving them the correct arity.
...
With this seemingly insignificant fix, we are now able to build and link clang using clang itself! (LLVM still has to be built with gcc for the time being).
llvm-svn: 91893
2009-12-22 06:36:32 +00:00
Daniel Dunbar
3780f0b680
x86_64: Structures with no fields but which have padding should be classified as
...
integer.
- This is consistent, but may not be correct. I will revisit x86_64 ABI handling for C++ as a whole at some point.
- PR5831.
llvm-svn: 91874
2009-12-22 01:19:25 +00:00
Douglas Gregor
507eb87f05
Eliminate the ASTContext argument to CXXConstructorDecl::isCopyConstructor, since the context is available in the Decl
...
llvm-svn: 91862
2009-12-22 00:34:07 +00:00
Douglas Gregor
0f139a1df1
Improve on my previous fix for debug information. Rather than
...
recursing in CGDebugInfo::CreateTypeNode, teach
CanonicalizeTypeForDebugInfo---now called UnwrapTypeForDebugInfo---to
keep unwrapping the type until we hit something that can be
represented by debug information. Thanks to Anders for pointing this out!
llvm-svn: 91840
2009-12-21 20:18:30 +00:00
Douglas Gregor
0915b43ac2
Teach debug info generation to handle TemplateSpecializationType,
...
ElaboratedType, QualifiedNameType, and SubstTemplateTypeParmType type
nodes. Also, produce an "unsupported" diagnostic for C++0x type nodes
and "typeof" nodes, rather than asserting nondescriptly.
llvm-svn: 91837
2009-12-21 19:57:21 +00:00
Anders Carlsson
2b7f444366
Incomplete structs should also have internal linkage.
...
llvm-svn: 91805
2009-12-21 00:41:42 +00:00
Anders Carlsson
18e6ee1b20
Correcly handle pointers to member pointer types where the class or the pointee is incomplete.
...
llvm-svn: 91804
2009-12-20 23:37:55 +00:00
Anders Carlsson
d008129f34
Rework the way pointer types are handled by the RTTI builder. We now get the right linkage for indirect pointers to incomplete structs.
...
llvm-svn: 91799
2009-12-20 22:30:54 +00:00
Daniel Dunbar
e017ecc9e2
Remove ';' after method definition. Noticed by clang++, which one would think
...
would have a higher respect for its own code. This is getting old, is this
warning really adding value?
llvm-svn: 91779
2009-12-19 17:50:07 +00:00
Eli Friedman
357e8c94d6
Fix for PR5524: make reference binding in default argument work correctly.
...
llvm-svn: 91733
2009-12-19 00:20:10 +00:00
Eli Friedman
70724ad2ff
Work in progress for setting the vtable pointers for all bases correctly in
...
the constructor. This doesn't handle cases requiring the VTT at the moment,
and generates unnecessary stores, but I think it's essentially correct.
llvm-svn: 91731
2009-12-18 23:47:41 +00:00
Eli Friedman
2b677cd4ff
Cleanup switch so it doesn't have a default case.
...
llvm-svn: 91725
2009-12-18 23:28:34 +00:00
Eli Friedman
303e45750e
Fix for PR5830: fix the computation of the offset to a virtual base.
...
llvm-svn: 91724
2009-12-18 23:27:44 +00:00
Daniel Dunbar
91b640abfc
Fix a few MSVC warnings.
...
llvm-svn: 91714
2009-12-18 20:58:47 +00:00
Anders Carlsson
28a133d602
CK_UserDefinedConversion is a valid kind when doing copy ctor elision.
...
llvm-svn: 91695
2009-12-18 17:29:21 +00:00
Ken Dyck
01e620efaa
Change the return type of ASTContext::getTypeSizeInChars() from uint64_t to the
...
new opaque value type, CharUnits. This will help us avoid accidentally mixing
quantities that are in bit and character units.
llvm-svn: 91689
2009-12-18 15:55:54 +00:00
Ken Dyck
acfe6aa83a
Rename getByteSize() and getTypeSizeInBytes() in ASTContext to getCharWidth()
...
and getTypeSizeInChars() to reflect their basis in character type units, not
that of a possibly independent architecture-specific byte.
llvm-svn: 91688
2009-12-18 15:24:05 +00:00
Anders Carlsson
0087bc851c
Fix regression I introduced when dynamic_cast-ing to a reference type.
...
llvm-svn: 91687
2009-12-18 14:55:04 +00:00
Anders Carlsson
b396f43520
It's perfectly fine to see UserDefinedConversion casts when emitting scalar expressions.
...
llvm-svn: 91686
2009-12-18 14:42:03 +00:00
Douglas Gregor
357b6fd3e5
Address some of Anders comments
...
llvm-svn: 91670
2009-12-18 05:19:44 +00:00
Douglas Gregor
e1314a64b8
Switch the initialization required by return statements over to the
...
new InitializationSequence. This fixes some bugs (e.g., PR5808),
changed some diagnostics, and caused more churn than expected. What's
new:
- InitializationSequence now has a "C conversion sequence" category
and step kind, which falls back to
- Changed the diagnostics for returns to always have the result type
of the function first and the type of the expression second.
CheckSingleAssignmentConstraints to peform checking in C.
- Improved ASTs for initialization of return values. The ASTs now
capture all of the temporaries we need to create, but
intentionally do not bind the tempoary that is actually returned,
so that it won't get destroyed twice.
- Make sure to perform an (elidable!) copy of the class object that
is returned from a class.
- Fix copy elision in CodeGen to properly see through the
subexpressions that occur with elidable copies.
- Give "new" its own entity kind; as with return values and thrown
objects, we don't bind the expression so we don't call a
destructor for it.
Note that, with this patch, I've broken returning move-only types in
C++0x. We'll fix it later, when we tackle NRVO.
llvm-svn: 91669
2009-12-18 05:02:21 +00:00
Daniel Dunbar
24c7f5efc5
Add -dwarf-debug-flags, which provides a way to embed the cc1 level options used
...
to compile a translation unit into the debug info for that file.
- Used by parts of Darwin build process to check compiler flags, etc.
- <rdar://problem/7256886> clang does not emit AT_APPLE_flags
llvm-svn: 91661
2009-12-18 02:43:17 +00:00
Mike Stump
0da53228e6
Handle case when DestPtr is 0.
...
llvm-svn: 91658
2009-12-18 02:14:27 +00:00
Anders Carlsson
3f4336cb1f
Rename GetAddrOfRTTI to GetAddrOfRTTIDescriptor. Remove the overload that takes a CXXRecordDecl since we were just creating a QualType from it anyway.
...
llvm-svn: 91590
2009-12-17 07:09:17 +00:00
Mike Stump
cd8faeb0b1
Ensure we run cleanups for CXXTemporaries on the exceptional edge. WIP.
...
llvm-svn: 91588
2009-12-17 06:08:47 +00:00
Anders Carlsson
1fd734276d
Simplify RTTIBuilder::finish.
...
llvm-svn: 91585
2009-12-17 05:10:59 +00:00
Anders Carlsson
e5a94105eb
Move the Info vector into the RTTIBuilder struct. No functionality change.
...
llvm-svn: 91583
2009-12-17 05:06:03 +00:00
Eli Friedman
7f4933f6c7
Fix for PR5801: codegen memcpy, memmove, memset directly to LLVM intrinsics.
...
llvm-svn: 91573
2009-12-17 00:14:28 +00:00
Douglas Gregor
4f4b186215
When value-initializing a class with no user-defined constructors but
...
with a non-trivial default constructor, zero-initialize the storage
and then call the default constructor. Fixes PR5800.
llvm-svn: 91548
2009-12-16 18:50:27 +00:00
Anders Carlsson
d681a29ac0
Baby steps towards fixing PR5589. If a class needs a vtable pointer, add one.
...
llvm-svn: 91545
2009-12-16 17:27:20 +00:00
Anders Carlsson
07863b8b6e
Use GetAddrOfRTTI everywhere and remove GenerateRTTI and GenerateRTTIRef. With this change, we can now compile and link TableGen.
...
llvm-svn: 91520
2009-12-16 07:05:41 +00:00
Anders Carlsson
18ada9856f
Handle ImplicitValueInitExpr in AggExprEmitter.
...
llvm-svn: 91519
2009-12-16 06:57:54 +00:00
Anders Carlsson
b7e93e268f
Mangle CXXOperatorCallExprs, fixes PR5796.
...
llvm-svn: 91507
2009-12-16 05:48:46 +00:00
Mike Stump
b85ffb689e
Add an addition check for undefined behavior for when we hit a
...
__builtin_unreachable. WIP.
llvm-svn: 91499
2009-12-16 03:07:12 +00:00
Mike Stump
3f6f9febad
Implement additional undefined checks for additional loads and stores. WIP.
...
llvm-svn: 91498
2009-12-16 02:57:00 +00:00
Fariborz Jahanian
2b9fc83db5
Fixes a code gen bug related to accessing a now
...
non-existing 'isa' field of a non-existing struct type
all related to legacy type definition for 'id' which we have
dropped in clang in favor of a built-in type.
(fixes radar 7470820).
llvm-svn: 91455
2009-12-15 21:34:52 +00:00
Anders Carlsson
6e997b2993
ShouldDestroyTemporaries? I don't think so.
...
llvm-svn: 91450
2009-12-15 20:51:39 +00:00
Chris Lattner
2f3da9b205
update to match LLVM API change:
...
Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait. This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.
llvm-svn: 91422
2009-12-15 07:26:51 +00:00
Eli Friedman
2151725325
Fix a small bug in ComputeMethodVtableIndices.
...
llvm-svn: 91411
2009-12-15 03:31:17 +00:00
Eli Friedman
d777cccb47
Don't force the emission of destructor definitions.
...
llvm-svn: 91394
2009-12-15 02:06:15 +00:00
Mike Stump
cf16d2cc42
Fix spacing.
...
llvm-svn: 91386
2009-12-15 01:22:35 +00:00
Mike Stump
9a4e0128a8
Ensure we preserve line information for each trap for
...
-fcatch-undefined-behavior if we aren't optimizing. WIP.
llvm-svn: 91382
2009-12-15 00:59:40 +00:00
Mike Stump
e8c3b3eca4
Switch codegen for -fcatch-undefined-bahavior over to __builtin_trap
...
instead of abort to improve codesize and codegen.
llvm-svn: 91374
2009-12-15 00:35:12 +00:00
Mike Stump
590d18f103
We have to allow one to form an address for one past the end. WIP.
...
llvm-svn: 91347
2009-12-14 22:14:31 +00:00
Mike Stump
ba6a0c40c4
Add support for detecting undefined shift behavior. WIP.
...
llvm-svn: 91341
2009-12-14 21:58:14 +00:00
Fariborz Jahanian
9ac0a04b29
Patch to fix 32-bit @try failure with internal assertion when compiling
...
an Objective-C rethrow nested inside another try/catch block. (fixes radar 7466728).
llvm-svn: 91335
2009-12-14 21:35:01 +00:00
Mike Stump
f8858af909
Simplifiy.
...
llvm-svn: 91324
2009-12-14 20:52:00 +00:00
Nate Begeman
67dfd4236a
Revert mmx palignr to use an intrinsic, since mmx shuffle patterns are missing.
...
llvm-svn: 91269
2009-12-14 05:15:02 +00:00
Nate Begeman
72ec6bc6f4
Support x86's PALIGNR instruction without the use of a palignr intrinsic.
...
llvm-svn: 91264
2009-12-14 04:57:03 +00:00
Anders Carlsson
e66e2942fc
Mangle unary, binary and ternary expressions correctly.
...
llvm-svn: 91257
2009-12-14 01:45:37 +00:00
Anders Carlsson
c67974ccb1
Simplify BuildSimpleType in the RTTBuilder to avoid using an std::vector.
...
llvm-svn: 91255
2009-12-13 23:47:29 +00:00
Anders Carlsson
399f499f0c
Don't use a cookie if the global placement new function is used.
...
llvm-svn: 91251
2009-12-13 20:34:34 +00:00
Anders Carlsson
adbe4249d6
Fix regression in my last commit - if a struct has a trivial destructor but no usual deallocation function we don't need a cookie.
...
llvm-svn: 91249
2009-12-13 20:10:12 +00:00
Anders Carlsson
21122cf657
More array cookie improvements.
...
llvm-svn: 91247
2009-12-13 20:04:38 +00:00
Anders Carlsson
f5af8dead7
If the usual array deallocation function of a class takes two arguments, we need to pass the number of bytes allocated to the deallocation function, just not the number of bytes in a single element.
...
llvm-svn: 91246
2009-12-13 18:48:07 +00:00
Anders Carlsson
e7025c55a4
Change the RTTIBuilder's finish member function to take a pointer to the constants array + the length of the array.
...
llvm-svn: 91241
2009-12-13 16:38:01 +00:00
Chandler Carruth
8abbc657a9
Silence some release build warnings.
...
llvm-svn: 91234
2009-12-13 01:37:04 +00:00
Fariborz Jahanian
751c1e7b24
patch to add a property from a protocol to a class that adopts the protocol.
...
(fixes radar 7466494).
llvm-svn: 91227
2009-12-12 21:26:21 +00:00
Jeffrey Yasskin
1615d45daa
Un-namespace-qualify llvm_unreachable. It's a macro, so the qualification gave
...
no extra safety anyway.
llvm-svn: 91207
2009-12-12 05:05:38 +00:00
Mike Stump
d954638f02
Implement runtime checks for undefined behavior. WIP.
...
This implements a new flag -fcatch-undefined-behavior. The flag turns
on additional runtime checks for:
T a[I];
a[i] abort when i < 0 or i >= I.
Future stuff includes shifts by >= bitwidth amounts.
llvm-svn: 91198
2009-12-12 01:27:46 +00:00
Fariborz Jahanian
ffe912c647
Patch to allow C-style cast from 'void *' to block pointer type.
...
(fixes radar 7465023).
llvm-svn: 91171
2009-12-11 22:40:48 +00:00
Eli Friedman
b095e15af4
Fix for PR5714: make sure globals that will be modified aren't marked const.
...
llvm-svn: 91156
2009-12-11 21:23:03 +00:00
Eli Friedman
3ace52b3a7
Fix linkage of type info and vtable for classes without linkage.
...
llvm-svn: 91152
2009-12-11 20:48:18 +00:00
Eli Friedman
75c9b97123
Make sure mangling doesn't crash in another case. Add some more tests.
...
llvm-svn: 91149
2009-12-11 20:21:38 +00:00
Eli Friedman
30e94d047e
Fix for PR5706: let mangleName deal with mangling names without identifiers
...
correctly.
llvm-svn: 91136
2009-12-11 18:00:57 +00:00
Anders Carlsson
1d6ad50826
Move info vectors and add assertions in preparation of moving the vector directly into RTTIBuilder.
...
llvm-svn: 91129
2009-12-11 16:41:51 +00:00
Anders Carlsson
a0b98f083a
Use GetAddrOfRTTI when getting the RTTI pointer for a base class.
...
llvm-svn: 91127
2009-12-11 16:37:06 +00:00
Benjamin Kramer
b11118bd0b
Random string-related cleanups.
...
llvm-svn: 91119
2009-12-11 13:33:18 +00:00
Eli Friedman
68396b16f6
Move the code for converting a member pointer to a bool so that it is usable
...
for logical not.
llvm-svn: 91112
2009-12-11 09:26:29 +00:00
Eli Friedman
1762cf2ad0
Fix for PR5718: implement equality comparisons for member function pointers.
...
llvm-svn: 91108
2009-12-11 07:36:43 +00:00
Anders Carlsson
fd7dfeb779
Improve linkage of RTTI data structures. Introduce CodeGenModule::GetAddrOfRTTI which figures out the right linkage of the RTTI information for the given type and whether it should be defined or not. I will migrate clients over to GetAddrOfRTTI in subsequent commits (with tests).
...
llvm-svn: 91098
2009-12-11 02:46:30 +00:00
Anders Carlsson
c988201417
Use named flags in RTTIBuilder::BuildPointerType.
...
llvm-svn: 91088
2009-12-11 01:27:37 +00:00
Anders Carlsson
0c6a7d8f42
When extending the lifetime of a temporary, make sure to emit a branch to the cleanup exit block. This fixes a broken module error in LLVMCConfigurationEmitter.cpp.
...
llvm-svn: 91086
2009-12-11 01:00:09 +00:00
Anders Carlsson
afd1edb52e
When an exception needs to be freed by calling __cxa_exception_free, make sure to stash away the exception pointer somewhere.
...
This fixes an "Instruction does not dominate all uses!" verification error when compiling TableGen.
llvm-svn: 91084
2009-12-11 00:32:37 +00:00
Mike Stump
37077bf651
Fix spacing.
...
llvm-svn: 91078
2009-12-11 00:02:10 +00:00
Eli Friedman
d70bbfd7d8
Support unary type traits in a scalar context. Not that I've actually seen
...
this construct, but might as well for completeness.
llvm-svn: 91071
2009-12-10 22:40:32 +00:00
Anders Carlsson
781161dc55
Make sure that explicitly instantiated functions get the right linkage.
...
llvm-svn: 91069
2009-12-10 22:25:34 +00:00
Anders Carlsson
bf56946073
Mangle static variables inside Objective-C methods in Objective-C++. We currently mangle them the same way as gcc does.
...
llvm-svn: 91042
2009-12-10 03:14:39 +00:00
Eli Friedman
d5bc94e2eb
Get rid of static variable.
...
llvm-svn: 91041
2009-12-10 02:21:21 +00:00
Anders Carlsson
fefc7b8e7b
Actually store the pointer into the global variable, spotted by Eli.
...
llvm-svn: 91036
2009-12-10 01:58:33 +00:00
Mike Stump
3c6a12ca65
Setup cleanup on eh edge out of the construction of the cleanup object
...
during throw to deallocate the exception object. WIP.
llvm-svn: 91035
2009-12-10 01:52:30 +00:00
Anders Carlsson
a72ddd4609
Handle emitting static variables that have reference type.
...
llvm-svn: 91027
2009-12-10 01:05:11 +00:00
Anders Carlsson
364051c6a6
Separate generating code for static variables and global variables.
...
llvm-svn: 91026
2009-12-10 00:57:45 +00:00
Anders Carlsson
633c6f6f36
Move more decl related functions to CGDeclCXX.cpp
...
llvm-svn: 91012
2009-12-10 00:30:05 +00:00
Anders Carlsson
bc49cfed84
Add CGDeclCXX.cpp and move EmitCXXGlobalVarDeclInit there.
...
llvm-svn: 91006
2009-12-10 00:16:00 +00:00
Mike Stump
75546b8c88
Fixup spacing.
...
llvm-svn: 91001
2009-12-10 00:06:18 +00:00
Mike Stump
2600491817
Fix spacing.
...
llvm-svn: 91000
2009-12-10 00:05:14 +00:00
Mike Stump
f5cbb08c4b
Ensure we only generate one terminate handler.
...
llvm-svn: 90998
2009-12-10 00:02:42 +00:00
Mike Stump
3b60f034f9
Remove obsolete FIXME and some dead fallback code.
...
llvm-svn: 90997
2009-12-09 23:52:09 +00:00
Mike Stump
102530719f
Add terminate handler to cleanups on exceptional edges.
...
llvm-svn: 90996
2009-12-09 23:49:53 +00:00
Fariborz Jahanian
531c16f9fb
Code gen for ObjCIsaExpr AST used as lvalue.
...
(fixes radar 7457534).
llvm-svn: 90995
2009-12-09 23:35:29 +00:00
Mike Stump
25b20fc2ae
Add terminate handler for copy constructors for thrown objects. WIP.
...
llvm-svn: 90994
2009-12-09 23:31:35 +00:00
Mike Stump
2b488873bf
Break out code for reuse. WIP.
...
llvm-svn: 90991
2009-12-09 22:59:31 +00:00
Mike Stump
f16b8c30d9
Add throw support. WIP.
...
llvm-svn: 90982
2009-12-09 19:24:08 +00:00
Fariborz Jahanian
a5fee26d28
Codegen. support for ObjCIsaExpr AST which until now
...
was not needed (fixes radar 7453430).
llvm-svn: 90981
2009-12-09 19:05:56 +00:00
Mike Stump
aff69af918
Add cleanups for exceptional edges. WIP.
...
llvm-svn: 90940
2009-12-09 03:35:49 +00:00
Eli Friedman
4f678f3de1
Fix for PR5709: use the computed type of the declaration instead of the
...
type of the builtin when generating the function declaration for a builtin
library call.
llvm-svn: 90936
2009-12-09 03:05:59 +00:00
Fariborz Jahanian
859c415567
More detailed analysis of typecast to an objective-c pointer
...
in objective-c++ mode without being too lenient.
llvm-svn: 90895
2009-12-08 23:09:15 +00:00
Mike Stump
4a6b337cfd
Add fixme.
...
llvm-svn: 90884
2009-12-08 22:12:48 +00:00
Mike Stump
e6d54ca553
Remove some old code. WIP.
...
llvm-svn: 90882
2009-12-08 21:46:41 +00:00
Daniel Dunbar
17c4f8d746
Update CGExprConstant for change to emit padding values as undef.
...
- This fixes 2003-05-21-BitfieldHandling.
llvm-svn: 90876
2009-12-08 21:12:32 +00:00
Benjamin Kramer
ba8451b243
Use StringRef in CGDebugInfo::EmitFunctionStart.
...
llvm-svn: 90856
2009-12-08 14:04:35 +00:00
Benjamin Kramer
43c7c5befd
Use a Twine to concatenate the name instead of going through std::string.
...
llvm-svn: 90854
2009-12-08 13:07:37 +00:00
Benjamin Kramer
1d20564b8d
Use Path.makeAbsolute() and make a constant std::string a const char*.
...
llvm-svn: 90851
2009-12-08 11:02:29 +00:00
John McCall
ce54657e95
DeclRefExpr stores a ValueDecl internally.
...
Template instantiation can re-use DeclRefExprs.
llvm-svn: 90848
2009-12-08 09:08:17 +00:00
Eli Friedman
80888c7b38
Build fix.
...
llvm-svn: 90841
2009-12-08 06:54:20 +00:00
Eli Friedman
bb5008a32a
Fix for PR5707: make sure implicit copy constructors initialize the vtable
...
pointer.
llvm-svn: 90840
2009-12-08 06:46:18 +00:00
Eli Friedman
48c6b0d14f
Slight tweak to vtable linkage.
...
llvm-svn: 90832
2009-12-08 04:09:14 +00:00
Eli Friedman
f2c79b6b9c
Misc key function fixes.
...
llvm-svn: 90831
2009-12-08 03:56:49 +00:00
Eli Friedman
8aaff69e86
Fix some direct checks of expressions which might be surrounded by parentheses.
...
llvm-svn: 90825
2009-12-08 02:09:46 +00:00
Eli Friedman
cd6a50f3e5
Make copy assignment operator synthesis not explode for classes with complex
...
or non-record aggregate members.
It might be worth spending some time to optimize this code (and the parallel
code for copy constructors) to memcpy in larger chunks, rather than copying
one member at a time. Not sure exactly how beneficial that would be, but
it seems like could help for large classes with, for example, a vtable pointer
forcing the generation of a copy constructor.
llvm-svn: 90823
2009-12-08 01:57:53 +00:00
Jeffrey Yasskin
567ae47b4a
Remove several .c_str() to be forward-compatible with StringRef.
...
llvm-svn: 90822
2009-12-08 01:46:24 +00:00
Mike Stump
02c23d68cb
Fixup catch parameters with class reference type. WIP.
...
llvm-svn: 90821
2009-12-08 01:29:31 +00:00
Anders Carlsson
220bf4fc5a
No need to add tail padding if the resulting LLVM struct type will have the same size as the final record size.
...
llvm-svn: 90820
2009-12-08 01:24:23 +00:00
Eli Friedman
31bc3ad275
A bunch more thunk fixes from misc testing.
...
(Yes, I do intend to commit some tests for this.)
llvm-svn: 90818
2009-12-07 23:56:34 +00:00
Mike Stump
1d849219a5
Add codegen support for exception specifications. WIP.
...
llvm-svn: 90817
2009-12-07 23:38:24 +00:00
Eli Friedman
f6c175b745
Correctly handle conditional operators involving throw.
...
llvm-svn: 90800
2009-12-07 20:25:53 +00:00
Eli Friedman
5445f6e5b6
Make the comma operator consistently call EnsureInsertPoint.
...
llvm-svn: 90799
2009-12-07 20:18:11 +00:00
Mike Stump
62afe99814
Work around emitters that can't deal with dead code contexts yet.
...
llvm-svn: 90796
2009-12-07 20:12:14 +00:00
Anders Carlsson
1aaecfa02d
Mangle basic_ostream and basic_iostream specializations.
...
llvm-svn: 90794
2009-12-07 19:56:42 +00:00
Mike Stump
52d7141186
Remove obsolete fallback code for objectsize.
...
llvm-svn: 90780
2009-12-07 18:58:11 +00:00
Nuno Lopes
7251327d75
implement PR5274: mark 'restrict' parameters as noalias
...
llvm-svn: 90778
2009-12-07 18:30:06 +00:00
Anders Carlsson
e1b3e6292a
It's OK to try to emit a vtable definition more than once. Fixes PR5697.
...
llvm-svn: 90751
2009-12-07 07:59:52 +00:00
Eli Friedman
c0dacee1e0
Erm, revert for the moment; I didn't test this as thoroughly as I should have
...
(although it does pass regression tests).
llvm-svn: 90747
2009-12-07 04:45:50 +00:00
Eli Friedman
c5d3a6ae3d
Tweak the formula for non-virtual offsets to something which appears a bit
...
more accurate.
llvm-svn: 90746
2009-12-07 04:38:34 +00:00
Anders Carlsson
5ebf8b44e9
Move key functions to a separate map.
...
llvm-svn: 90745
2009-12-07 04:35:11 +00:00
Eli Friedman
f2eda5efd2
Be a bit more complete about accumulating SavedThisAdjustments.
...
llvm-svn: 90723
2009-12-06 22:33:51 +00:00
Eli Friedman
8174f2c23c
Work-in-progess rewrite of thunks: move thunk generation outside of vtable
...
generation, and make sure we generate thunks when the function is defined
rather than when the vtable is defined.
llvm-svn: 90722
2009-12-06 22:01:30 +00:00
Anders Carlsson
3efc6e6f46
Add rudimentary support for member pointers to CGDebugInfo.
...
llvm-svn: 90711
2009-12-06 18:00:51 +00:00
Chris Lattner
72ecc68e11
use new helpers to simplify code.
...
llvm-svn: 90709
2009-12-06 17:22:42 +00:00
Anders Carlsson
fe5f7d916f
Set the correct linkage for VTTs as well.
...
llvm-svn: 90689
2009-12-06 01:09:21 +00:00
Anders Carlsson
232324c5c0
More linkage improvements.
...
llvm-svn: 90687
2009-12-06 00:53:22 +00:00
Anders Carlsson
0911ae8ef2
Pass the desired vtable linkage to GenerateVtable directly. Only call MaybeMarkVirtualImplicitMembersReferenced for non-inline functions.
...
llvm-svn: 90686
2009-12-06 00:23:49 +00:00
Anders Carlsson
7e28c5f2e2
Make GenerateVtable a private member function of CGVtableInfo.
...
llvm-svn: 90684
2009-12-06 00:01:05 +00:00
Anders Carlsson
4ed44eb7d9
Only emit the vtable definition if the class has a key function and we're emitting it, or if the class doesn't have a key function and we are emitting the complete constructor.
...
llvm-svn: 90681
2009-12-05 22:42:54 +00:00
Anders Carlsson
0ab79e22ab
If a class does not have a key function, its linkage should be weak_odr.
...
llvm-svn: 90680
2009-12-05 22:24:38 +00:00
Anders Carlsson
58b271d450
Use createGlobalVariable for creating vtable variables too.
...
llvm-svn: 90679
2009-12-05 22:19:10 +00:00
Anders Carlsson
b3f54b748d
CodeGenModule::GenerateVtable now returns a pointer directly to the vtable and not to the address point.
...
llvm-svn: 90676
2009-12-05 21:28:12 +00:00
Anders Carlsson
a95d4c51dc
Make sure that hte vtable always has an i8* array type.
...
llvm-svn: 90675
2009-12-05 21:09:05 +00:00
Anders Carlsson
c8e39ec79f
Add a function for getting the vtable address point of a class.
...
llvm-svn: 90674
2009-12-05 21:03:56 +00:00
Anders Carlsson
b694f05ffb
Simplify BuildVTT.
...
llvm-svn: 90673
2009-12-05 21:02:25 +00:00
Anders Carlsson
b78d093fcc
Let the VTT builder pretend that getVtable returns a pointer to the vtable and not to the vtable address point.
...
llvm-svn: 90672
2009-12-05 20:58:49 +00:00
Anders Carlsson
78c2898e02
Change getCtorVtable to not return the address point offset, but the global variable.
...
llvm-svn: 90671
2009-12-05 20:42:53 +00:00
Anders Carlsson
5a1a84f9fa
Simplify some code.
...
llvm-svn: 90670
2009-12-05 18:38:15 +00:00
Anders Carlsson
21bbc1e705
Factor vtable related GlobalVariable creation out into a separate function. Add vtable linkage test.
...
llvm-svn: 90667
2009-12-05 17:04:47 +00:00
Chris Lattner
e99c110d06
implement rdar://7346691 by codegen'ing struct/array initializers
...
to a memset or a memcpy from a global when possible.
llvm-svn: 90658
2009-12-05 08:22:11 +00:00
Chris Lattner
e08ea7874a
various cleanups.
...
llvm-svn: 90657
2009-12-05 08:21:30 +00:00
Chris Lattner
ffcd06ea7c
simplify a condition and add a testcase.
...
llvm-svn: 90652
2009-12-05 06:49:57 +00:00
Eli Friedman
6c08ce7706
Skip actually generating the vtable unless we are defining it. This avoids
...
the side-effects of generating the methods in the vtable (including PR5676).
llvm-svn: 90635
2009-12-05 01:05:03 +00:00
Anders Carlsson
a30e1750cd
Don't emit explicit specializations of static member variable declarations.
...
llvm-svn: 90624
2009-12-04 23:50:01 +00:00
Mike Stump
bee78dd31b
Add support for function try blocks.
...
llvm-svn: 90622
2009-12-04 23:26:17 +00:00
John McCall
b96ec56871
Fix "using typename" and the instantiation of non-dependent using declarations.
...
llvm-svn: 90614
2009-12-04 22:46:56 +00:00
Benjamin Kramer
62ab616666
Return bool as a bool instead of a uint64_t.
...
llvm-svn: 90610
2009-12-04 22:45:27 +00:00
Alexis Hunt
9b3a395bf3
Put in FIXME that this mangling is not official in.
...
llvm-svn: 90594
2009-12-04 21:11:13 +00:00
Alexis Hunt
bf2f0c2e34
Switch mangling of literal operator names to a string that's
...
a) legal
b) likely to be chosen as the official mangling
This will break ABI compatibility with all literal operator names,
so you may need to recompile any such code. Sorry.
llvm-svn: 90587
2009-12-04 21:01:37 +00:00
Mike Stump
afe4764fa5
Be sure to instantiate rtti for non-polymorphic bases.
...
llvm-svn: 90586
2009-12-04 20:55:13 +00:00
Anders Carlsson
ce460529c0
When generating a virtual destructor, don't try to make a virtual call to the base class destructor because then we'll just re-enter the same destructor!
...
This was done to fix PR5619, so I went ahead and passed a dummy VTT pointer for now.
llvm-svn: 90578
2009-12-04 19:33:17 +00:00
Mike Stump
875912ac13
Fixup nested try blocks.
...
llvm-svn: 90576
2009-12-04 19:21:57 +00:00
Mike Stump
5c820758f5
Fix warning and be sure to set up the rethrow pointer if we fall off
...
the end of all the catches.
llvm-svn: 90574
2009-12-04 19:03:47 +00:00
Anders Carlsson
bad80eb792
Rename 'Class' to 'MostDerivedClass'
...
llvm-svn: 90573
2009-12-04 18:36:22 +00:00
Anders Carlsson
19462d681a
Store the vtable components in a SmallVector.
...
llvm-svn: 90571
2009-12-04 16:24:46 +00:00
Anders Carlsson
4e1d75f3ed
Use a different ConstantArray::get.
...
llvm-svn: 90570
2009-12-04 16:22:27 +00:00
Anders Carlsson
472404f8a6
Move the vtable vector directly into the Vtable builder.
...
llvm-svn: 90569
2009-12-04 16:19:30 +00:00
Anders Carlsson
7bb7076b51
Change getIndex to return false if the index wasn't found. Avoids an extra hash lookup.
...
llvm-svn: 90568
2009-12-04 15:49:02 +00:00
Eli Friedman
65d87222b2
Minor cleanup; no functionality change.
...
llvm-svn: 90565
2009-12-04 08:52:11 +00:00
Eli Friedman
81fb0d2656
Remove unused argument.
...
llvm-svn: 90563
2009-12-04 08:40:51 +00:00
Eli Friedman
c07aebee90
Eliminate submethods vector.
...
llvm-svn: 90562
2009-12-04 08:36:58 +00:00
Eli Friedman
3d2e9de337
Eliminate the inner loop in VtableBuilder::OverrideMethod.
...
llvm-svn: 90561
2009-12-04 08:34:14 +00:00
Anders Carlsson
5c9e7b16a5
Correctly mangle the 'std' namespace inside extern "C++" blocks.
...
llvm-svn: 90544
2009-12-04 06:23:23 +00:00
Anders Carlsson
f3935b4d4b
Make sure that overridden method decls are always canonical.
...
llvm-svn: 90542
2009-12-04 05:51:56 +00:00
Eli Friedman
94bc2dade6
Fix regression in vtable improvements.
...
llvm-svn: 90540
2009-12-04 04:30:03 +00:00
Mike Stump
8c1253b4c2
Try/catch statements seem to be working well enough to turn on.
...
llvm-svn: 90538
2009-12-04 03:57:07 +00:00
Mike Stump
2ab55765f7
Disable for now, doesn't play nice with the temporary code.
...
llvm-svn: 90537
2009-12-04 03:55:53 +00:00
Eli Friedman
b05eb963e0
Rename method to something easier to search for.
...
llvm-svn: 90536
2009-12-04 03:54:56 +00:00
Anders Carlsson
a93e980fbc
More work in preparation of getting rid of the submethods loop.
...
llvm-svn: 90535
2009-12-04 03:52:52 +00:00
Anders Carlsson
f2f31f4371
Remove an unused member variable.
...
llvm-svn: 90534
2009-12-04 03:46:21 +00:00
Anders Carlsson
e609636e0d
Add a way to get the index of a method. Assert that we have the same index for now.
...
llvm-svn: 90533
2009-12-04 03:41:37 +00:00
Anders Carlsson
b07567c315
Add a premature optimization.
...
llvm-svn: 90532
2009-12-04 03:07:26 +00:00
Anders Carlsson
50f147460a
Add the method directly to the vtable.
...
llvm-svn: 90531
2009-12-04 03:06:03 +00:00
Anders Carlsson
79bce40365
Get rid of the PureVirtualMethods map.
...
llvm-svn: 90530
2009-12-04 02:58:12 +00:00
Anders Carlsson
ddf42c8d80
Move handling of pure virtual methods to AppendMethods (and rename it to AppendMethodsToVtable).
...
llvm-svn: 90529
2009-12-04 02:56:03 +00:00
Anders Carlsson
5b3ea9bf1c
Move covariant thunk handling to AppendMethods too.
...
llvm-svn: 90528
2009-12-04 02:52:22 +00:00
Anders Carlsson
86809cd8ab
Move 'this' pointer adjustment thunks to AppendMethods.
...
llvm-svn: 90527
2009-12-04 02:43:50 +00:00
Eli Friedman
4b1942cb8b
Make functions returning a struct indirectly evaluate the returned struct
...
directly into the sret pointer. This is an optimization in C, but is required
for correctness in C++ for classes with a non-trivial copy constructor.
llvm-svn: 90526
2009-12-04 02:43:40 +00:00
Anders Carlsson
495634e5ac
Factor appending methods to a vtable out into a separate function.
...
llvm-svn: 90525
2009-12-04 02:39:04 +00:00
Anders Carlsson
4c837d258f
Get rid of the Thunks struct too.
...
llvm-svn: 90524
2009-12-04 02:26:15 +00:00
Anders Carlsson
c521f952d6
Remove the CovariantThunk struct.
...
llvm-svn: 90523
2009-12-04 02:22:02 +00:00
Anders Carlsson
597c776c41
Remove the GlobalDecl from the Thunk as well.
...
llvm-svn: 90522
2009-12-04 02:14:12 +00:00
Anders Carlsson
8c889abc1a
Remove the GlobalDecl from the CovariantThunk struct, we can just look it up in the Methods table now.
...
llvm-svn: 90519
2009-12-04 02:11:21 +00:00
Anders Carlsson
cdf1898086
Start populating the VtableMembers structure.
...
llvm-svn: 90517
2009-12-04 02:08:24 +00:00
Anders Carlsson
a84b6e85f0
Add a data structure for efficient storing of vtable methods. Not used yet.
...
llvm-svn: 90515
2009-12-04 02:01:07 +00:00
Mike Stump
114ab9f695
Fixup reference binding for catch parameters.
...
Fixup throws and rethrows to use invoke as appropriate.
llvm-svn: 90513
2009-12-04 01:51:45 +00:00
Eli Friedman
6d11ec8cb8
Update chunk of #if 0'ed code to remove fixed FIXME and make it compile. We
...
probably want to do some sort of performance assessment before enabling it,
though.
llvm-svn: 90510
2009-12-04 01:30:56 +00:00
Mike Stump
5f141b75f9
These are done.
...
llvm-svn: 90494
2009-12-03 22:55:42 +00:00
Mike Stump
7398ff0f07
Improve catch parameter bindings for scalar non-pointers. WIP.
...
llvm-svn: 90492
2009-12-03 22:38:15 +00:00
Anders Carlsson
ce2cd01647
Handle static_assert inside functions.
...
llvm-svn: 90461
2009-12-03 17:26:31 +00:00
Mike Stump
cdeb800152
Eli, I copied my code from this code... Let's fix the souce of the bad idea!
...
Thanks.
llvm-svn: 90458
2009-12-03 16:55:20 +00:00
Eli Friedman
c339081c24
Fix for PR5659: correct a rather nasty oversight in the type conversion for
...
member pointer types.
llvm-svn: 90450
2009-12-03 12:44:31 +00:00
Daniel Dunbar
7230fa5630
Convert ABIArgInfo::dump to raw_ostream.
...
llvm-svn: 90440
2009-12-03 09:13:49 +00:00
Anders Carlsson
c6089fda20
Attempt to fix the MSVC build.
...
llvm-svn: 90427
2009-12-03 07:30:40 +00:00
Eli Friedman
4039f35344
Fix thunk generation for thunks with a parameter with reference type.
...
llvm-svn: 90412
2009-12-03 04:49:52 +00:00
Eli Friedman
551fe84d0e
Minor cleanup.
...
llvm-svn: 90411
2009-12-03 04:27:05 +00:00
Mike Stump
e2d4a2c3a8
Add support for thunking dtors. Oh why does this make my head hurt?
...
llvm-svn: 90409
2009-12-03 03:47:56 +00:00
Mike Stump
2842b4cf86
Reflow.
...
llvm-svn: 90407
2009-12-03 03:40:14 +00:00
Anders Carlsson
dabfa3cd8b
Revert r90402 for now, virt.cpp is failing.
...
llvm-svn: 90406
2009-12-03 03:28:24 +00:00
Anders Carlsson
e692f7c309
Use Eli's ComputeThunkAdjustment for calculating the return adjustment.
...
llvm-svn: 90402
2009-12-03 03:15:31 +00:00
Anders Carlsson
5f91fd64b6
Add CodeGenModule::ComputeThunkAdjustment, which Eli wrote.
...
llvm-svn: 90401
2009-12-03 03:06:55 +00:00
Anders Carlsson
80bc5d5d04
Remove the index from the Thunk struct.
...
llvm-svn: 90400
2009-12-03 02:41:55 +00:00
Anders Carlsson
29a1f751b3
Change the Thunks map to use the vtable index as the key.
...
llvm-svn: 90399
2009-12-03 02:39:59 +00:00
Anders Carlsson
0e1e7632bc
Add the global decl to the Thunk struct.
...
llvm-svn: 90398
2009-12-03 02:36:40 +00:00
Anders Carlsson
9f98f7a9e5
Remove unused struct fields.
...
llvm-svn: 90397
2009-12-03 02:34:59 +00:00
Anders Carlsson
657f139abe
Delay computing the return adjustments for covariant thunks until when they are added to the vtable.
...
llvm-svn: 90396
2009-12-03 02:32:59 +00:00
Anders Carlsson
2ca285fc5c
No need to create the covariant thunk in both places now.
...
llvm-svn: 90394
2009-12-03 02:22:59 +00:00
Anders Carlsson
1157e8fc68
Whoops, forgot to save :)
...
llvm-svn: 90393
2009-12-03 02:20:26 +00:00
Anders Carlsson
06c14b6f65
Remove the index field from the CovariantThunk structure.
...
llvm-svn: 90392
2009-12-03 02:16:14 +00:00
Anders Carlsson
73295f96c5
Change the CovariantThunk map to use the vtable index as its key.
...
llvm-svn: 90391
2009-12-03 02:12:03 +00:00
Anders Carlsson
c38b40a709
Store a GlobalDecl in the return adjustment.
...
llvm-svn: 90387
2009-12-03 02:03:29 +00:00
Anders Carlsson
2bd3c0fa34
Do not include the 'this' pointer adjustment in the covariant return type. Instead, store it in the (now oddly named) Thunks map.
...
llvm-svn: 90386
2009-12-03 01:58:20 +00:00