David Blaikie
83d382b1ca
Switch assert(0/false) llvm_unreachable.
...
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Douglas Gregor
e8bbc12152
Extend the ASTContext constructor to delay the initialization of
...
builtin types (When requested). This is another step toward making
ASTUnit build the ASTContext as needed when loading an AST file,
rather than doing so after the fact. No actual functionality change (yet).
llvm-svn: 138985
2011-09-02 00:18:52 +00:00
Eli Friedman
f5dfb31df0
Revert bad change. (It may look equivalent, but it isn't.)
...
llvm-svn: 137132
2011-08-09 18:16:09 +00:00
Eli Friedman
f481ccafd8
Cleanup; no functionality change.
...
llvm-svn: 137126
2011-08-09 17:38:12 +00:00
Chris Lattner
0e62c1cc0b
remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
...
them into the clang namespace.
llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Chris Lattner
2192fe50da
de-constify llvm::Type, patch by David Blaikie!
...
llvm-svn: 135370
2011-07-18 04:24:23 +00:00
Chris Lattner
8806e32f16
Rename CGT::VerifyFuncTypeComplete to isFuncTypeConvertible since
...
it is a predicate, not an action. Change the return type to be a bool,
not the incomplete member. Enhace it to detect the recursive compilation
case, allowing us to compile Eli's testcase on llvmdev:
struct T {
struct T (*p)(void);
} t;
into:
%struct.T = type { {}* }
@t = common global %struct.T zeroinitializer, align 8
llvm-svn: 134853
2011-07-10 00:18:59 +00:00
Jay Foad
83be361b8a
Replace the existing forms of ConstantArray::get() with a single form
...
that takes an ArrayRef.
llvm-svn: 133615
2011-06-22 09:24:39 +00:00
Anders Carlsson
d6f1518cc9
Fix another regression from the "skip vtable pointer initialization"
...
optimization. Make sure to require a vtable when trying to get the address
of a VTT, otherwise we would never end up emitting the VTT.
llvm-svn: 131400
2011-05-16 04:08:36 +00:00
Eli Friedman
49a94b1c7c
Add an implementation of thunks for varargs methods. The implementation is a bit messy, but it is correct as long as the method in question doesn't use indirect gotos. A couple of possible alternative implementations are outlined in FIXME's in this patch. rdar://problem/8077308 .
...
llvm-svn: 130993
2011-05-06 17:27:27 +00:00
Eli Friedman
43dca6a8d2
Simplify code a bit by using CallArgList::add. No intended functionality change.
...
llvm-svn: 130699
2011-05-02 17:57:46 +00:00
Anders Carlsson
e5ec21c977
Change CollectPrimaryBases to collect the bases in the right order. Fixes one half of PR9660.
...
llvm-svn: 129252
2011-04-10 18:00:32 +00:00
Anders Carlsson
68aad14dd3
Make -fdump-vtable-layouts also dump vtable indices for all virtual member functions in the class.
...
llvm-svn: 129250
2011-04-10 17:42:45 +00:00
Ken Dyck
bb4e977218
[Reapply r128776, modified so that it does not break debug info.]
...
Change the return type of CodeGenVTables::getVirtualBaseOffsetOffset() to
CharUnits. No change in functionality intended.
llvm-svn: 129072
2011-04-07 12:37:09 +00:00
Ken Dyck
3a09bc5ab0
[Reapply r128773. This is not the source of the issues Devang was seeing
...
with debug info.]
Use CharUnits for the offsets in the VirtualBaseClassOffsetOffsetsMapTy. No
change in functionality intended.
llvm-svn: 129048
2011-04-07 01:22:42 +00:00
Ken Dyck
25c82240e9
[Reapply r128771. It wasn't the source of the issues Devang saw with debug
...
info.]
Use CharUnits for the offset type in the ClassNamesAndOffsets map in
dumpLayout(). No change in functionality intended.
llvm-svn: 129046
2011-04-07 00:59:42 +00:00
Ken Dyck
42a9d29c2c
Reapply r128770. It's not the cause of the issues Devang saw with debug info.
...
Use CharUnits for the offsets in the VBaseOffsetOffsetsMapTy types. No
change in functionality intended.
llvm-svn: 129043
2011-04-07 00:55:01 +00:00
Devang Patel
84852bbb42
Revert r128770, r128771, r128773 and r128776 for now. It breaks debug info.
...
llvm-svn: 128842
2011-04-04 20:36:06 +00:00
Ken Dyck
1473c9a7c4
Change the return type of CodeGenVTables::getVirtualBaseOffsetOffset() to
...
CharUnits. No change in functionality intended.
llvm-svn: 128776
2011-04-02 17:52:22 +00:00
Ken Dyck
1b23db93df
Use CharUnits for the offsets in the VirtualBaseClassOffsetOffsetsMapTy. No
...
change in functionality intended.
llvm-svn: 128773
2011-04-02 17:13:02 +00:00
Ken Dyck
cf4ef5314f
Use CharUnits for the offset type in the ClassNamesAndOffsets map in
...
dumpLayout(). No change in functionality intended.
llvm-svn: 128771
2011-04-02 17:03:24 +00:00
Ken Dyck
1eac9f1546
Use CharUnits for the offsets in the VBaseOffsetOffsetsMapTy types. No
...
change in functionality intended.
llvm-svn: 128770
2011-04-02 16:57:20 +00:00
Ken Dyck
6b20919317
Convert BaseOffset::NonVirtualOffset to CharUnits. No change in
...
functionality intended.
llvm-svn: 128756
2011-04-02 01:32:03 +00:00
Ken Dyck
872d74a591
Convert offset parameters and return values of VTableComponent methods to
...
CharUnits. No change in functionality intended.
llvm-svn: 128754
2011-04-02 01:14:48 +00:00
Ken Dyck
496906629b
Convert the offsets in VCallOffsetMap to CharUnits. No change in
...
functionality intended.
llvm-svn: 128753
2011-04-02 00:51:15 +00:00
Ken Dyck
eff7fe645b
Convert offset parameters of VTableBuilder::IsOverriderUsed() to CharUnits.
...
No change in functionality intended.
llvm-svn: 128752
2011-04-02 00:44:58 +00:00
Ken Dyck
4680e9219a
Convert the return value of
...
VCallAndVBaseOffsetBuilder::getCurrentOffsetOffset() to CharUnits. No change
in functionality intended.
llvm-svn: 128603
2011-03-31 01:08:46 +00:00
Ken Dyck
47e1e54343
Convert the OffsetInLayoutClass parameter of
...
VCallAndVBaseOffsetBuilder::AddVBaseOffsets() to CharUnits. No change in
functionality intended.
llvm-svn: 128600
2011-03-31 00:56:47 +00:00
Ken Dyck
1a93b3b080
Convert the OffsetInLayoutClass of the VCallAndVBaseOffsetBuilder
...
constructor to CharUnits. No change in functionality intended.
llvm-svn: 128598
2011-03-31 00:48:04 +00:00
Ken Dyck
9b32ee1611
Convert the RealBaseOffset parameter of
...
VCallAndVBaseOffsetBuilder::AddVCallAndVBaseOffsets() to
CharUnits. No change in functionality intended.
llvm-svn: 128596
2011-03-31 00:37:24 +00:00
Jay Foad
20c0f02cc5
Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
...
PHINode::Create() giving the (known or expected) number of operands.
llvm-svn: 128538
2011-03-30 11:28:58 +00:00
Ken Dyck
b3ba775523
Convert the offset parameter of
...
VCallAndVBaseOffsetBuilder::AddVCallOffsets() to CharUnits. No change in
functionality intended.
llvm-svn: 128531
2011-03-30 10:11:40 +00:00
Ken Dyck
075de167f8
Convert local offset variable to CharUnits in AddVCallOffsets. No change in
...
functionality intended.
llvm-svn: 128522
2011-03-30 01:21:33 +00:00
Ken Dyck
078f3e6905
Convert a local offset variable to CharUnits. No change in functionality
...
intended.
llvm-svn: 128521
2011-03-30 01:14:22 +00:00
Ken Dyck
032a903982
Convert the OffsetInLayoutClass parameter of DeterminePrimaryVirtualBases()
...
to CharUnits. No change in functionality intended.
llvm-svn: 128520
2011-03-30 01:10:23 +00:00
Ken Dyck
45956a467e
Convert the OffsetInLayoutClass parameter of LayoutSecondaryVTables to
...
CharUnits. No change in functionality intended.
llvm-svn: 128516
2011-03-30 00:50:28 +00:00
Ken Dyck
f9742cca31
Convert offset parameter in LayoutPrimaryAndSecondaryVTables() to CharUnits.
...
No change in functionality intended.
llvm-svn: 128393
2011-03-27 20:33:38 +00:00
Ken Dyck
9a7e532dd8
Convert VTableBuilder::MostDerivedClassOffset to CharUnits. No change in
...
functionality intended.
llvm-svn: 128392
2011-03-27 20:20:28 +00:00
Ken Dyck
0d5804a622
Convert FinalOverriders::MostDerivedClassOffset to CharUnits. No change in
...
functionality intended.
llvm-svn: 128391
2011-03-27 20:10:29 +00:00
Ken Dyck
5f3601d35a
Remove a fixed FIXME comment (the base offset has already been converted to
...
CharUnits).
llvm-svn: 128386
2011-03-27 19:19:52 +00:00
Ken Dyck
f4be03ae04
Convert the offset parameters of AddMethods() to CharUnits. No change in
...
functionality intended.
llvm-svn: 128385
2011-03-27 19:15:11 +00:00
Ken Dyck
f736d9cb75
Convert the BaseOffsetInLayoutClass parameter of ComputeThisAdjustment() to
...
CharUnits. No change in functionality intended.
llvm-svn: 128384
2011-03-27 19:03:44 +00:00
Ken Dyck
7d876f3649
Convert offset members in MethodInfo to CharUnits. No change in
...
functionality intended.
llvm-svn: 128383
2011-03-27 18:57:53 +00:00
John McCall
358d056c14
We were emitting construction v-tables with internal linkage all the time.
...
Emit them instead with the linkage of the VTT.
I'm actually really ambivalent about this; it's what GCC does, but outside
of improving code size (if the linkage is coalescing), I'm not sure it's
at all relevant. Construction vtables are naturally referenced only by the
VTT, which is itself only referenced by complete-object constructors and
destructors; giving the construction vtables possibly-external linkage is
important if you have an optimization that drills through the VTT to a
reference to a particular construction vtable which it cannot just emit
itself.
llvm-svn: 128374
2011-03-27 09:00:25 +00:00
Douglas Gregor
1baf38f5a6
On Mac OS X, the presence of an 'availability' attribute for that
...
platform implies default visibility. To achieve these, refactor our
lookup of explicit visibility so that we search for both an explicit
VisibilityAttr and an appropriate AvailabilityAttr, favoring the
VisibilityAttr if it is present.
llvm-svn: 128336
2011-03-26 12:10:19 +00:00
Ken Dyck
58863dc46a
Convert the OffsetInLayoutClass parameter of
...
FinalOverriders::ComputeBaseOffsets() to CharUnits. No change in
functionality intended.
llvm-svn: 128323
2011-03-26 01:36:26 +00:00
Ken Dyck
785cbdb6da
Convert FinalOverriders::Offset to CharUnits. No change in functionality
...
intended.
llvm-svn: 128321
2011-03-26 01:29:16 +00:00
Ken Dyck
808457cfd6
Convert offset in MethodBaseOffsetPairTy to CharUnits. No change in
...
functionality intended.
llvm-svn: 128318
2011-03-26 01:18:17 +00:00
Ken Dyck
70b47e08dc
Convert the offsets in SubobjectOffsetMapTy to CharUnits. No change in
...
functionality intended.
llvm-svn: 128317
2011-03-26 01:09:13 +00:00
Ken Dyck
ce81203d9b
Convert several local variables to CharUnits. No change in functionality
...
intended.
llvm-svn: 128315
2011-03-26 00:51:24 +00:00
Ken Dyck
16ffcac1a2
Convert the BaseOffset member of BaseSubobject to CharUnits from bits. No
...
change in functionality intended.
llvm-svn: 128190
2011-03-24 01:21:01 +00:00
John McCall
32ea969415
Use a slightly more semantic interface for emitting call arguments.
...
llvm-svn: 127494
2011-03-11 20:59:21 +00:00
John McCall
5fe009660d
Tame this assert, hopefully fixing self-host.
...
llvm-svn: 127319
2011-03-09 07:12:35 +00:00
John McCall
a738c25f5e
Use the "undergoes default argument promotion" bit on parameters to
...
simplify the logic of initializing function parameters so that we don't need
both a variable declaration and a type in FunctionArgList. This also means
that we need to propagate the CGFunctionInfo down in a lot of places rather
than recalculating it from the FAL. There's more we can do to eliminate
redundancy here, and I've left FIXMEs behind to do it.
llvm-svn: 127314
2011-03-09 04:27:21 +00:00
Tilmann Scheller
99cc30c371
Revert "Add CC_Win64ThisCall and set it in the necessary places."
...
This reverts commit 126863.
llvm-svn: 126886
2011-03-02 21:36:49 +00:00
Tilmann Scheller
e60baf731b
Revert "Add preliminary support for MSVC-style vtables."
...
This reverts commit 126865.
llvm-svn: 126876
2011-03-02 20:40:50 +00:00
Tilmann Scheller
a6c995dbb2
Add preliminary support for MSVC-style vtables.
...
llvm-svn: 126865
2011-03-02 19:38:28 +00:00
Tilmann Scheller
454464b491
Add CC_Win64ThisCall and set it in the necessary places.
...
llvm-svn: 126863
2011-03-02 19:36:23 +00:00
Rafael Espindola
3968cd0f7b
For consistency, use llvm::raw_ostream in the rest of the mangle api.
...
llvm-svn: 125360
2011-02-11 02:52:17 +00:00
John McCall
ad7c5c1657
Reorganize CodeGen{Function,Module} to eliminate the unfortunate
...
Block{Function,Module} base class. Minor other refactorings.
Fixed a few address-space bugs while I was there.
llvm-svn: 125085
2011-02-08 08:22:06 +00:00
Anders Carlsson
e866d44417
Fix self-host; if a thunk already exists and has available_externally linkage, we should change its linkage instead of asserting.
...
llvm-svn: 124986
2011-02-06 20:09:44 +00:00
Anders Carlsson
8b02183ff3
When building with optimizations, emit thunks with available_externally linkage so devirtualized function calls can also be de-thunked.
...
llvm-svn: 124984
2011-02-06 18:31:40 +00:00
Anders Carlsson
fe8a9939f9
Simplify thunks code.
...
llvm-svn: 124983
2011-02-06 17:15:43 +00:00
Anders Carlsson
73f97534b0
Pass a 'ForVTable' flag to GetAddrOfThunk and pass it along to GetOrCreateLLVMFunction so that we
...
won't assert when building a thunk for an implicit virtual member function that is not marked used.
llvm-svn: 124967
2011-02-05 18:48:55 +00:00
Anders Carlsson
3c23948481
Re-land r124768, with a fix for PR9130.
...
We now emit everything except unused implicit virtual member functions when building the vtable.
llvm-svn: 124935
2011-02-05 04:35:53 +00:00
Rafael Espindola
af5b92e8f7
Revert 124768.
...
This reopens PR99114, but that one at least can be avoided with an #include.
PR9130 cannot.
llvm-svn: 124780
2011-02-03 06:30:58 +00:00
Anders Carlsson
bac84bef65
Don't try to mark virtual members referenced for classes where the key function
...
is not defined in the current translation unit. Doing so lead to compile errors
such as PR9114.
Instead, when CodeGen is building the vtable, don't try to emit a definition
for functions that aren't marked used in the current translation unit.
Fixes PR9114.
llvm-svn: 124768
2011-02-03 02:08:44 +00:00
Anders Carlsson
a03f3a85cb
When building with optimizations, emit vtables where the key is not in the
...
current translation unit as available_externally.
This helps devirtualize the second example in PR3100, comment 18:
struct S { S() {}; virtual void xyzzy(); };
inline void foo(S *s) { s->xyzzy(); }
void bar() { S s; foo(&s); }
This involved four major changes:
1. In DefineUsedVTables, always mark virtual member functions as referenced for
non-template classes and class template specializations.
2. In CodeGenVTables::ShouldEmitVTableInThisTU return true if optimizations are
enabled, even if the key function is not implemented in this translation
unit. We don't ever do this for code compiled with -fapple-kext, because we
don't ever want to devirtualize virtual member function calls in that case.
3. Give the correct linkage for vtables where the key function is not defined.
4. Update the linkage for RTTI structures when necessary.
llvm-svn: 124565
2011-01-30 20:45:54 +00:00
Anders Carlsson
265aa7c070
Change CodeGenModule::setTypeVisibility to take a TypeVisibilityKind enum instead of an "IsForRTTI" flag.
...
llvm-svn: 124546
2011-01-29 20:24:48 +00:00
Anders Carlsson
c6a47895f7
Get rid of an unneeded parameter from setGlobalVisibility.
...
llvm-svn: 124541
2011-01-29 19:39:23 +00:00
Anders Carlsson
883fc72c3c
Make emitting a VTT a two-step process, much like emitting a VTable. You first get the address of the VTT, and then pass it to EmitVTTDefinition.
...
llvm-svn: 124539
2011-01-29 19:16:51 +00:00
Anders Carlsson
93be9a90cc
Use CGM.CreateOrReplaceCXXRuntimeVariable in CGVTables.cpp
...
llvm-svn: 124538
2011-01-29 18:25:07 +00:00
Anders Carlsson
fd4834061c
Remove IsDefinition from CodeGenModule::setTypeVisibility; it is always true.
...
llvm-svn: 124529
2011-01-29 05:26:32 +00:00
Fariborz Jahanian
9f9438b314
More work to support -fapple-kext regarding
...
indirect vf calls and addition of extra entry
at bottom of vtbls.
llvm-svn: 124507
2011-01-28 23:42:29 +00:00
Rafael Espindola
facb7d0ade
Also set unnamed_addr on declarations.
...
llvm-svn: 123531
2011-01-15 08:23:14 +00:00
Rafael Espindola
d09776b945
Only add unnamed_addr to definitions.
...
llvm-svn: 123354
2011-01-13 01:12:55 +00:00
Rafael Espindola
5674c644cf
Add unnamed_addr to vtables.
...
llvm-svn: 123272
2011-01-11 21:10:26 +00:00
Anders Carlsson
7f95cd1817
Rename RecordLayout::getPrimaryBaseWasVirtual to isPrimaryBaseVirtual.
...
llvm-svn: 120133
2010-11-24 23:12:57 +00:00
Anders Carlsson
cadbc463e2
Move code off the primary base info iterator. No functionality change.
...
llvm-svn: 120132
2010-11-24 23:04:03 +00:00
John McCall
478382521e
When re-using a vtable slot for the nearest overridden method, just because
...
there's no return adjustment from the overridden to the overrider doesn't
mean there isn't a return adjustment from the overrider to the final
overrider. This matters if we're emitting a virtual this-adjustment thunk
because the overrider virtually inherits from the class providing the
nearest overridden method. Do the appropriate return adjustment in this case.
Fixes PR7611.
llvm-svn: 118466
2010-11-09 01:18:05 +00:00
Anders Carlsson
fd88a6160d
Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset.
...
llvm-svn: 117881
2010-10-31 23:22:37 +00:00
John McCall
c273f24196
Better solution: calculate the visibility of functions and variables
...
independently of whether they're definitions, then teach IR generation to
ignore non-explicit visibility when emitting declarations. Use this to
make sure that RTTI, vtables, and VTTs get the right visibility.
More of rdar://problem/8613093
llvm-svn: 117781
2010-10-30 11:50:40 +00:00
Argyrios Kyrtzidis
0c34b138df
Make sure the VTables for template instantiations are emitted even if the key function doesn't have a body.
...
llvm-svn: 116186
2010-10-11 03:25:57 +00:00
John McCall
5d865c3292
Teach IR generation to return 'this' from constructors and destructors
...
under the ARM ABI.
llvm-svn: 112588
2010-08-31 07:33:07 +00:00
John McCall
b3732bb3b7
Just disable the hidden-visibility optimization for now by hiding it behind
...
a -cc1 option. The Darwin linker complains about mixed visibility when linking
gcc-built objects with clang-built objects, and the optimization isn't really
that valuable. Platforms with less ornery linkers can feel free to enable this.
llvm-svn: 110979
2010-08-12 23:36:15 +00:00
John McCall
5513fce96b
It turns out that linkers (at least, the Darwin linker) don't necessarily
...
do the right thing with mixed-visibility symbols, so disable the visibility
optimization where that's possible, i.e. with template classes (since it's
possible that an arbitrary template might be subject to an explicit
instantiation elsewhere). 447.dealII actually does this.
I've put the code under an option that's currently not hooked up to anything.
llvm-svn: 110374
2010-08-05 20:39:18 +00:00
John McCall
c8bd9c277b
Extend the visibility-hidden optimization to linkonce_odr thunks for
...
functions with in-line definitions, since such thunks will be emitted at any
use of the function.
Completes the feature work for rdar://problem/7523229.
llvm-svn: 110285
2010-08-04 23:46:35 +00:00
John McCall
e16adc2b1e
Emit standard-library RTTI with external linkage, not weak_odr.
...
Apply hidden visibility to most RTTI; libstdc++ does not rely on exact
pointer equality for the type info (just the type info names). Apply
the same optimization to RTTI that we do to vtables.
Fixes PR5962.
llvm-svn: 110192
2010-08-04 08:34:44 +00:00
John McCall
8a705c15d9
Extend the hidden-visibility vtables optimization to template classes that
...
haven't been explicitly instantiated.
llvm-svn: 110189
2010-08-04 06:38:15 +00:00
John McCall
5696d6d316
Emit weak vtables of non-template classes with hidden visibility.
...
llvm-svn: 110107
2010-08-03 07:24:12 +00:00
Douglas Gregor
b412e174db
Remove the vast majority of the Destroy methods from the AST library,
...
since we aren't going to be calling them ever.
llvm-svn: 109377
2010-07-25 18:17:45 +00:00
Douglas Gregor
4f6e8deec4
Make sure to set the visible on a vtable; VTTs and typeinfo already
...
handle visibility properly. Fixes <rdar://problem/8091955>.
llvm-svn: 105977
2010-06-14 23:41:45 +00:00
Anders Carlsson
fd788405ac
Remove now unused code.
...
llvm-svn: 105448
2010-06-04 00:59:37 +00:00
Anders Carlsson
27860db29e
Use CXXRecordDecl::getFinalOverriders to get final overriders. This speeds up vtable layout by moving away from the old final overrider computation code that had O(N^2) complexity in some cases.
...
llvm-svn: 105447
2010-06-04 00:54:04 +00:00
John McCall
6a7f9f5c8f
Don't try to emit the vtable for a class just because we're emitting a
...
virtual function from it.
Fixes PR7241.
llvm-svn: 105345
2010-06-02 21:22:02 +00:00
Anders Carlsson
04e51cca94
More cleanup.
...
llvm-svn: 105301
2010-06-01 23:52:26 +00:00
Anders Carlsson
042ce2d8f1
More cleanup.
...
llvm-svn: 105299
2010-06-01 23:47:05 +00:00
Anders Carlsson
79547c3fbd
Cleanup.
...
llvm-svn: 105296
2010-06-01 23:17:37 +00:00
Anders Carlsson
107b4e096c
Remove unused parameter to FinalOverriders::PropagateOverrider.
...
llvm-svn: 105171
2010-05-30 18:23:41 +00:00
John McCall
23f6626262
Correctly pass aggregates by reference when emitting thunks.
...
llvm-svn: 104778
2010-05-26 22:34:26 +00:00