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