Commit Graph

53 Commits

Author SHA1 Message Date
Anders Carlsson 548cc9d143 We always want to create a virtual function pointer entry if the path from the derived return value to the base overridden return value contains a virtual base class.
llvm-svn: 90024
2009-11-28 03:03:52 +00:00
Anders Carlsson d598850203 Move the vtable builder to an anonymous namespace.
llvm-svn: 90021
2009-11-27 22:21:51 +00:00
Anders Carlsson f942ee0297 Don't build the entire vtable when all we want is the index of a virtual method.
llvm-svn: 90017
2009-11-27 20:47:55 +00:00
Anders Carlsson 323bb04ef4 Lazily create the __cxa_pure_virtual reference.
llvm-svn: 89965
2009-11-26 19:54:33 +00:00
Anders Carlsson d420a31fe9 Use the new CovariantThunkAdjustment in the vtable builder.
Make the pure virtual methods map a set instead.

llvm-svn: 89961
2009-11-26 19:32:45 +00:00
Anders Carlsson 6d771bcd09 Add a Thunk struct to the vtable builder.
llvm-svn: 89935
2009-11-26 03:25:13 +00:00
Anders Carlsson 2f87c4f1a5 Add a CovariantThunkAdjustment struct that represents the adjustments needed for a covariant thunk.
llvm-svn: 89933
2009-11-26 03:09:37 +00:00
Anders Carlsson c778540f9a Add a ThunkAdjustment struct which holds a non-virtual and a virtual adjustment offset. Start using it. General cleanup in Mangle.cpp.
llvm-svn: 89925
2009-11-26 02:32:05 +00:00
Anders Carlsson 6445773279 It is common for vtables to contain pointers to functions that have either incomplete return types or incomplete argument types.
Handle this by returning the llvm::OpaqueType for those cases, which CodeGenModule::GetOrCreateLLVMFunction knows about, and treats as being an "incomplete function".

llvm-svn: 89736
2009-11-24 05:08:52 +00:00
Daniel Dunbar e128dd18ab IRgen: Switch the C++ mangler interfaces to take the SmallVector to write into,
instead of requiring clients to make a raw_svector_ostream, which is just an
implementation detail.

llvm-svn: 89548
2009-11-21 09:06:22 +00:00
Daniel Dunbar ef5d75afeb Sink free mangle* methods into MangleContext.
llvm-svn: 89547
2009-11-21 09:06:10 +00:00
Mike Stump cd2b821241 Fixup address point computations. WIP.
llvm-svn: 89386
2009-11-19 20:52:19 +00:00
Mike Stump aa51ad6815 Refine vtable, rtti and rtti name instantiation so that they follow
the key function.  All the code is wired up, but won't work yet, as I
had to turn off key function calculation as it doesn't work yet.

Also, we refine visibility of the vtable, rtti and rtti name to match
the class, as well as as arrange for all the symbols to be internal
for anonymous namespace entities.

llvm-svn: 89309
2009-11-19 04:04:36 +00:00
Mike Stump 1a139f8fb5 Improve instantiation control for rtti data and allow key functions to
instantiate a class.  WIP.

llvm-svn: 89289
2009-11-19 01:08:19 +00:00
Mike Stump 1960b20403 Refine linkage on thunks. WIP.
llvm-svn: 89287
2009-11-19 00:49:05 +00:00
Mike Stump c0f632d6b2 Set up vtable visibility appropriately.
llvm-svn: 89193
2009-11-18 04:00:48 +00:00
Mike Stump f5b2869b75 Finisgh off rest of class_type_info rtti generation.
llvm-svn: 88823
2009-11-14 23:32:21 +00:00
Mike Stump c5a332cefb Handle descructor printing better.
llvm-svn: 88723
2009-11-13 23:45:53 +00:00
Mike Stump 559387fe8b Also track address points for primaries bases.
llvm-svn: 88717
2009-11-13 23:13:20 +00:00
Anders Carlsson fb4dda4fed Instead of storing CXXMethodDecls in the vtable builder, store GlobalDecls so we can represent both the complete and deleting destructors. Also, when encountering a destructor decl, emit entries for both the complete and deleting destructors. Mike, please review.
With this change, FileCheck builds and runs the clang test suite without failures!

llvm-svn: 88663
2009-11-13 17:08:56 +00:00
Zhongxing Xu 1721ef7a53 Include header for printf.
llvm-svn: 87086
2009-11-13 05:46:16 +00:00
Mike Stump fa81808a11 Refine construction vtables; they don't include bits that don't have
virtual bases unless they are morally virtual.

llvm-svn: 87071
2009-11-13 02:35:38 +00:00
Mike Stump 653d0b99df Refine the construction vtables with respect to offsets. WIP.
llvm-svn: 87067
2009-11-13 02:13:54 +00:00
Mike Stump 83066c8dee Allow the tracking of address points for construction vtables as well.
llvm-svn: 87063
2009-11-13 01:54:23 +00:00
Mike Stump 2b34bc5a96 Refine which vtbl is refernced in VTTs.
llvm-svn: 87043
2009-11-12 23:36:21 +00:00
Mike Stump ca0de33113 Refine offsets into vtables for the VTT.
llvm-svn: 87041
2009-11-12 23:14:15 +00:00
Mike Stump 8677bc27bf Refine vtable pointers for secondary vtables inside VTTs to point to
the right base vtable.  WIP.

llvm-svn: 87039
2009-11-12 22:56:32 +00:00
Mike Stump 2cefe38365 Fix the offset calculations for non-virtual bases with overrides.
Refine the VTT entries for virtual bases to refer to the complete
object's vtable instead of constructor vtables.

Refine the AddressPoint calculations for VTT entries for virtual bases.

llvm-svn: 87021
2009-11-12 20:47:57 +00:00
Mike Stump fd84d6d808 Fix ctor vtable name. WIP.
llvm-svn: 86879
2009-11-11 20:32:03 +00:00
Mike Stump eac4559790 Push ctor vtable construction down further. WIP.
llvm-svn: 86878
2009-11-11 20:26:26 +00:00
Mike Stump c7b9f5e762 More VTT work. We now track offsets and use the ctor vtable builder
interface.  WIP.

llvm-svn: 86793
2009-11-11 03:08:24 +00:00
Mike Stump 8b2d2d0707 Stub out most of the VTT building code. WIP.
llvm-svn: 86772
2009-11-11 00:35:07 +00:00
Mike Stump b47222144b Only generate a VTT for classes that need a VTT.
llvm-svn: 86699
2009-11-10 19:13:04 +00:00
Mike Stump d846d0825b Add vtable caching to prevent multiple vtables for the same class from
being generated.

Add the most derived vtable pointer to the VTT.

llvm-svn: 86671
2009-11-10 07:44:33 +00:00
Mike Stump 9f23a149cb Be sure to clear out VCall when we clear out VCalls.
Start implementing VTTs.  WIP.

llvm-svn: 86650
2009-11-10 02:30:51 +00:00
Mike Stump cd6f9ed906 Refine the non-virtual this adjustment. Optimize out virtual this
adjustments of zero.

llvm-svn: 86300
2009-11-06 23:27:42 +00:00
Mike Stump 72431bd9ea Refine the vcall for a function that is defined in a virtual base
class that is overridden in a base that isn't morally virtual.

llvm-svn: 86217
2009-11-06 02:38:24 +00:00
Mike Stump 4627132ebc Refine codegen for covariant thunks that return references.
llvm-svn: 85916
2009-11-03 19:03:17 +00:00
Mike Stump 75ce573815 Refine vcall/vbase ordering with vtable construction.
llvm-svn: 85677
2009-10-31 20:06:59 +00:00
Mike Stump 476e2dfe19 Refactor a bit.
llvm-svn: 85424
2009-10-28 20:44:03 +00:00
Mike Stump 375faa8dd7 Finish off pure virtual function handling.
llvm-svn: 85354
2009-10-28 00:35:46 +00:00
Mike Stump bb9ff05778 Prep work for putting ___cxa_pure_virtual in the vtables for pure functions.
llvm-svn: 85345
2009-10-27 23:46:47 +00:00
Mike Stump 18e8b477e8 Refactor code a little.
llvm-svn: 85343
2009-10-27 23:36:26 +00:00
Chandler Carruth 6e0df53865 Switch vtable to linkeonce_odr. Patch by nlewycky.
llvm-svn: 85131
2009-10-26 17:14:14 +00:00
Mike Stump 8bccbfdafe Refine non-virtual part of the this adjustment for thunks. Refine
non-virtual part of the return result adjustments for covariant
thunks.  WIP.

llvm-svn: 84178
2009-10-15 09:30:16 +00:00
Mike Stump 37dbe96a06 Track the offset to the current virtual base in CurrentVBaseOffset.
Track path information completely to ensure we get all the overrides.  WIP.

llvm-svn: 84166
2009-10-15 02:04:03 +00:00
Mike Stump b21c4eede4 Shift the vcall slots for non-virtual bases of a virtual base, up into
the virtual base so they can be reused properly.  Don't reuse vcall
slots across a virtual boundary.  WIP.  I have a testcase, but there
are still things that need to be fixed before the testcase can go in.

llvm-svn: 84120
2009-10-14 18:14:51 +00:00
Mike Stump 284312176a Refine handling for non-virtual bases in return value adjustments for
covariant thunks.  WIP.

llvm-svn: 84046
2009-10-13 22:54:56 +00:00
Mike Stump 7373095ebf Ensure we sign extend.
llvm-svn: 84031
2009-10-13 21:31:09 +00:00
Mike Stump ad47e7ea81 Remove FIXME. We construct VBIndex very early, before any calls to OverrideMethod.
llvm-svn: 83981
2009-10-13 17:23:44 +00:00