Commit Graph

70 Commits

Author SHA1 Message Date
Rafael Espindola 9f34b7b93b Revert "Start setting dso_local in clang."
This reverts commit r324107.

I will have to test it on OS X.

llvm-svn: 324108
2018-02-02 17:29:22 +00:00
Rafael Espindola 7e34a308ff Start setting dso_local in clang.
This starts adding dso_local to clang.

The hope is to eventually have TargetMachine::shouldAssumeDsoLocal go
away. My objective for now is to move enough of it to clang to remove
the need for the TargetMachine one to handle PIE copy relocations and
-fno-plt. With that it should then be easy to implement a
-fno-copy-reloc in clang.

This patch just adds the cases where we assume a symbol to be local
based on the file being compiled for an executable or a shared
library.

llvm-svn: 324107
2018-02-02 17:17:39 +00:00
Jake Ehrlich ba874ad83e Reland "Fix vtable not receiving hidden visibility when using push(visibility)"
I had to reland this change in order to make the test work on windows

This change should resolve https://bugs.llvm.org/show_bug.cgi?id=35022

https://reviews.llvm.org/D39627

llvm-svn: 319269
2017-11-29 00:54:20 +00:00
Petr Hosek 32c9de009a Revert "[CodeGen] Fix vtable not receiving hidden visibility when using push(visibility)"
This reverts commit r318853: tests are failing on Windows bots

llvm-svn: 318866
2017-11-22 19:50:17 +00:00
Petr Hosek 9696dbb988 [CodeGen] Fix vtable not receiving hidden visibility when using push(visibility)
This change should resolve https://bugs.llvm.org/show_bug.cgi?id=35022

Patch by Jake Ehrlich

Differential Revision: https://reviews.llvm.org/D39627

llvm-svn: 318853
2017-11-22 17:59:30 +00:00
Peter Collingbourne 25a2b70cd0 CodeGen: Start using inrange annotations on vtable getelementptr.
This annotation allows the optimizer to split vtable groups, as permitted by
a change to the Itanium ABI [1] that prevents compilers from adjusting virtual
table pointers between virtual tables.

[1] https://github.com/MentorEmbedded/cxx-abi/pull/7

Differential Revision: https://reviews.llvm.org/D24431

llvm-svn: 289585
2016-12-13 20:50:44 +00:00
Peter Collingbourne 2849c4e841 CodeGen: New vtable group representation: struct of vtable arrays.
In a future change, this representation will allow us to use the new inrange
annotation on getelementptr to allow the optimizer to split vtable groups.

Differential Revision: https://reviews.llvm.org/D22296

llvm-svn: 289584
2016-12-13 20:40:39 +00:00
Peter Collingbourne bcf909d737 Update clang for D20348
Differential Revision: http://reviews.llvm.org/D20339

llvm-svn: 272710
2016-06-14 21:02:05 +00:00
Peter Collingbourne 4e6a540024 CodeGen: Use 32-bit gep offsets to address vtable address points.
The relative vtable ABI will use a struct rather than an array as the type
of a vtable. LLVM only allows 32-bit integers as struct indices, so we need
to use 32-bit integers to get addresses of address points. In order to keep
the code simple, we might as well do that unconditionally.

It's probably a reasonable implementation limit to support no more than 2
billion virtual functions per class.

This change causes quite a bit of churn in the test suite, so I'm making
it separately.

Differential Revision: http://reviews.llvm.org/D18113

llvm-svn: 263469
2016-03-14 19:07:10 +00:00
Yaron Keren 556b21aa10 Remove and forbid raw_svector_ostream::flush() calls.
After r244870 flush() will only compare two null pointers and return,
doing nothing but wasting run time. The call is not required any more
as the stream and its SmallString are always in sync.

Thanks to David Blaikie for reviewing.

llvm-svn: 244928
2015-08-13 18:12:56 +00:00
NAKAMURA Takumi 7b1ee5b0f9 Prune trailing LF.
llvm-svn: 236938
2015-05-09 21:10:13 +00:00
NAKAMURA Takumi c7da6da58e Revert r236879, "Do not emit thunks with available_externally linkage in comdats"
It broke pecoff, at least i686-cygwin.

llvm-svn: 236937
2015-05-09 21:10:07 +00:00
Derek Schuff 2312bd3811 Do not emit thunks with available_externally linkage in comdats
Functions with available_externally linkage will not be emitted to object
files (they will just be undefined symbols), so it does not make sense to
put them in comdats.

Creates a second overload of maybeSetTrivialComdat that uses the GlobalObject
instead of the Decl, and uses that in several places that had the faulty
logic.

Differential Revision: http://reviews.llvm.org/D9580

llvm-svn: 236879
2015-05-08 16:47:21 +00:00
David Blaikie e3b172afc3 [opaque pointer type] Update for GEP API changes in LLVM
Now the GEP constant utility functions require the type to be explicitly
passed (since eventually the pointer type will be opaque and not convey
the required type information). For now callers can still pass nullptr
(though none were needed here in Clang, which is nice) if
convenienc/necessary, but eventually that will be disallowed as well.

llvm-svn: 233937
2015-04-02 18:55:21 +00:00
Rafael Espindola cb92c19fc4 Use a trivial comdat for C++ tables.
This produces comdats for vtables, typeinfo, typeinfo names, and vtts.

When combined with llvm not producing implicit comdats, not doing this would
cause code bloat on ELF and link errors on COFF.

llvm-svn: 226227
2015-01-15 23:18:01 +00:00
John McCall 8f80a61914 Remove the -fhidden-weak-vtables -cc1 option. It was dead,
gross, and increasingly replaced through other mechanisms.

llvm-svn: 201011
2014-02-08 00:41:16 +00:00
Reid Kleckner b60a3d5bc1 Eliminate the ItaniumVTableContext object from CodeGenVTables
Now CodeGenVTables has only one VTableContext object, which is either
Itanium or Microsoft.

Fixes a FIXME with no functionality change intended.

Ideally we could avoid the downcasts by pushing the things that
reference the Itanium vtable context into ItaniumCXXABI.cpp, but we're
not there yet.

llvm-svn: 197845
2013-12-20 23:58:52 +00:00
Timur Iskhodzhanov 5877663622 Fix vbtable indices when a class shares the vbptr with a non-virtual base
llvm-svn: 194082
2013-11-05 15:54:58 +00:00
Timur Iskhodzhanov 6745522f89 Extract ABI-specific parts of MangleContext into separate classes
Reviewed at http://llvm-reviews.chandlerc.com/D1807

llvm-svn: 191878
2013-10-03 06:26:13 +00:00
Timur Iskhodzhanov 8b5987eba5 Abstract out the emission of vtables, add basic support for vtable emission when using -cxx-abi microsoft
Reviewed at http://llvm-reviews.chandlerc.com/D1532

llvm-svn: 191523
2013-09-27 14:48:01 +00:00
Peter Collingbourne 66f82e68c3 [ms-cxxabi] Move CodeGenVTables::needsVTTParameter to ItaniumCXXABI.
This function only makes sense there.  Eventually it should no longer
be part of the CGCXXABI interface, as it is an Itanium-specific detail.

Differential Revision: http://llvm-reviews.chandlerc.com/D821

llvm-svn: 185213
2013-06-28 20:45:28 +00:00
Chris Lattner ece0409a1a simplify a bunch of code to use the well-known LLVM IR types computed by CodeGenModule.
llvm-svn: 149943
2012-02-07 00:39:47 +00:00
Dylan Noblesmith 2c1dd2716a Basic: import SmallString<> into clang namespace
(I was going to fix the TODO about DenseMap too, but
that would break self-host right now. See PR11922.)

llvm-svn: 149799
2012-02-05 02:13:05 +00:00
Benjamin Kramer e35328c878 Remove obsolete debugging macro, make helper static.
llvm-svn: 142730
2011-10-22 19:16:39 +00:00
Peter Collingbourne affe111ba5 Move all vtable layout data into new VTableLayout class
llvm-svn: 140506
2011-09-26 01:56:50 +00:00
Peter Collingbourne 5ee9ee490e Move vtable component accessors to VTableContext
llvm-svn: 140504
2011-09-26 01:56:41 +00:00
Peter Collingbourne 71c26936a0 Remove CodeGenVTables::ComputeVTableRelatedInformation dependency on CodeGen
llvm-svn: 140503
2011-09-26 01:56:36 +00:00
Peter Collingbourne 2d2595235d Move VTT builder to AST
llvm-svn: 140501
2011-09-26 01:56:24 +00:00
Peter Collingbourne 2000e4ead5 Remove CodeGenModule field from VTTBuilder
llvm-svn: 140499
2011-09-26 01:56:10 +00:00
Peter Collingbourne d9eb79ca73 Make the VTTBuilder class independent of LLVM core
llvm-svn: 140498
2011-09-26 01:56:06 +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
Jay Foad ed8db7d9df Convert ConstantExpr::getGetElementPtr and
ConstantExpr::getInBoundsGetElementPtr to use ArrayRef.

llvm-svn: 135673
2011-07-21 14:31:17 +00:00
Chris Lattner 2192fe50da de-constify llvm::Type, patch by David Blaikie!
llvm-svn: 135370
2011-07-18 04:24:23 +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
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
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
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
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 5963024ff6 Give VTTs the right visibility.
llvm-svn: 124540
2011-01-29 19:34:19 +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
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 bb7f7686c5 Set unnamed_addr in VTTs.
llvm-svn: 123280
2011-01-11 22:29:55 +00:00
Anders Carlsson 7f95cd1817 Rename RecordLayout::getPrimaryBaseWasVirtual to isPrimaryBaseVirtual.
llvm-svn: 120133
2010-11-24 23:12:57 +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
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
Douglas Gregor ae498b3211 The global variable for the VTT might not have external linkage; allow
us to find local variables, too. Fixes the last remaining
Boost.Rational failure.

llvm-svn: 103203
2010-05-06 22:18:21 +00:00
Anders Carlsson 8bdbb5be19 Store the entire base subobject in SubVTTIndices.
llvm-svn: 102890
2010-05-03 00:55:11 +00:00