summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/ItaniumCXXABI.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* P0012R1: add Itanium ABI support for throwing non-noexcept function pointers ↵Richard Smith2016-12-011-41/+42
| | | | | | and catching as noexcept. llvm-svn: 288305
* Revert r285664, cxx-abi-dev chose to go in a different direction for the ABI ↵Richard Smith2016-12-011-109/+4
| | | | | | here. llvm-svn: 288304
* Make CGVTables use ConstantInitBuilder. NFC.John McCall2016-11-281-2/+5
| | | | llvm-svn: 288081
* Implement ABI proposal for throwing noexcept function pointers, per discussionRichard Smith2016-11-011-4/+109
| | | | | | | | on cxx-abi-dev (thread starting 2016-10-11). This is currently hidden behind a cc1-only -m flag, pending discussion of how best to deal with language changes that require use of new symbols from the ABI library. llvm-svn: 285664
* [Devirtualization] Decorate vfunction load with invariant.loadPiotr Padlewski2016-10-291-1/+16
| | | | | | | | | | | | | | | | Summary: This patch was introduced one year ago, but because my google account was disabled, I didn't get email with failing buildbot and I missed revert of this commit. There was small but in test regex. I am back. Reviewers: rsmith, rengolin Subscribers: nlewycky, rjmccall, cfe-commits Differential Revision: https://reviews.llvm.org/D26117 llvm-svn: 285497
* Refactor call emission to package the function pointer together withJohn McCall2016-10-261-21/+29
| | | | | | | | | | | abstract information about the callee. NFC. The goal here is to make it easier to recognize indirect calls and trigger additional logic in certain cases. That logic will come in a later patch; in the meantime, I felt that this was a significant improvement to the code. llvm-svn: 285258
* CodeGen: inherit DLLExport attribute in Windows ItaniumSaleem Abdulrasool2016-09-301-11/+19
| | | | | | | | When emitting the fundamental type information constants, inherit the DLLExportAttr from `__fundamental_type_info`. We would previously not honor the `__declspec(dllexport)` on the type information. llvm-svn: 282980
* Re-commit r282556, reverted in r282564, with a fix to CallArgList::addFrom toRichard Smith2016-09-281-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | function correctly when targeting MS ABIs (this appears to have never mattered prior to this change). Update test case to always cover both 32-bit and 64-bit Windows ABIs, since they behave somewhat differently from each other here. Update test case to also cover operators , && and ||, which it appears are also affected by P0145R3 (they're not explicitly called out by the design document, but this is the emergent behavior of the existing wording). Original commit message: P0145R3 (C++17 evaluation order tweaks): evaluate the right-hand side of assignment and compound-assignment operators before the left-hand side. (Even if it's an overloaded operator.) This completes the implementation of P0145R3 + P0400R0 for all targets except Windows, where the evaluation order guarantees for <<, >>, and ->* are unimplementable as the ABI requires the function arguments are evaluated from right to left (because parameter destructors are run from left to right in the callee). llvm-svn: 282619
* Revert r282556. This change made several bots unhappy.Richard Smith2016-09-281-3/+2
| | | | llvm-svn: 282564
* P0145R3 (C++17 evaluation order tweaks): evaluate the right-hand side ofRichard Smith2016-09-271-2/+3
| | | | | | | | | | | | | assignment and compound-assignment operators before the left-hand side. (Even if it's an overloaded operator.) This completes the implementation of P0145R3 + P0400R0 for all targets except Windows, where the evaluation order guarantees for <<, >>, and ->* are unimplementable as the ABI requires the function arguments are evaluated from right to left (because parameter destructors are run from left to right in the callee). llvm-svn: 282556
* Alter the iOS/tvOS ARM64 C++ ABI to ignore the upper half of theJohn McCall2016-09-161-2/+12
| | | | | | | | | | | | | | | | | | | | | virtual table offset in a member function pointer. We are reserving this space for future ABI use relating to alternative v-table configurations. In the meantime, continue to zero-initialize this space when actually emitting a member pointer literal. This will successfully interoperate with existing compilers. Future versions of the compiler may place additional data in this location, and at that point, code emitted by compilers prior to this patch will fail if exposed to such a member pointer. This is therefore a somewhat hard ABI break. However, because it is limited to an uncommon case of an uncommon language feature, and especially because interoperation with the standard library does not depend on member pointers, we believe that with a sufficiently advance compiler change the impact of this break will be minimal in practice. llvm-svn: 281693
* CodeGen: Clean up implementation of vtable initializer builder. NFC.Peter Collingbourne2016-09-081-4/+2
| | | | | | | | | | | | | - Simplify signature of CreateVTableInitializer function. - Move vtable component builder to a separate function. - Remove unnecessary accessors from VTableLayout class. This is in preparation for a future change that will alter the type of the vtable initializer. Differential Revision: https://reviews.llvm.org/D22642 llvm-svn: 280897
* Widen type of __offset_flags in RTTI on Mingw64Reid Kleckner2016-08-251-4/+14
| | | | | | | | | | | | Otherwise we can't handle secondary base classes at offsets greater than 2**24. This agrees with libstdc++abi. We could extend this change to other LLP64 platforms, but then we would want to update libc++abi and it would require additional review. Fixes PR29116 llvm-svn: 279786
* CodeGen: simplify the CC handling for TLS wrappersSaleem Abdulrasool2016-08-011-2/+1
| | | | | | | | | Use the calling convention of the wrapper directly to set the calling convention to ensure that the calling convention matches. Incorrectly setting the calling convention results in the code path being entirely nullified as InstCombine + SimplifyCFG will prune the mismatched CC calls. llvm-svn: 277390
* Don't crash when generating code for __attribute__((naked)) member functions.Justin Lebar2016-07-271-0/+4
| | | | | | | | | | | | | | Summary: Previously this crashed inside EmitThisParam(). There should be no prelude for naked functions, so just skip the whole thing. Reviewers: majnemer Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D22715 llvm-svn: 276925
* CodeGen: Start emitting checked loads when both trapping CFI and ↵Peter Collingbourne2016-06-251-5/+11
| | | | | | | | -fwhole-program-vtables are enabled. Differential Revision: http://reviews.llvm.org/D21122 llvm-svn: 273757
* Implement C++17 P0386R2, inline variables. (The 'inline' specifier gives aRichard Smith2016-06-251-4/+16
| | | | | | | variable weak discardable linkage and partially-ordered initialization, and is implied for constexpr static data members.) llvm-svn: 273754
* CodeGen: Update Clang to use the new type metadata.Peter Collingbourne2016-06-241-2/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D21054 llvm-svn: 273730
* Update clang for D20348Peter Collingbourne2016-06-141-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D20339 llvm-svn: 272710
* Introduce CGCXXABI::canCallMismatchedFunctionTypeDerek Schuff2016-05-101-0/+1
| | | | llvm-svn: 269089
* Enable support for __float128 in Clang and enable it on pertinent platformsNemanja Ivanovic2016-05-091-2/+3
| | | | | | | | | | | | | | | | | | This patch corresponds to reviews: http://reviews.llvm.org/D15120 http://reviews.llvm.org/D19125 It adds support for the __float128 keyword, literals and target feature to enable it. Based on the latter of the two aforementioned reviews, this feature is enabled on Linux on i386/X86 as well as SystemZ. This is also the second attempt in commiting this feature. The first attempt did not enable it on required platforms which caused failures when compiling type_traits with -std=gnu++11. If you see failures with compiling this header on your platform after this commit, it is likely that your platform needs to have this feature enabled. llvm-svn: 268898
* Revert 266186 as it breaks anything that includes type_traits on some platformsNemanja Ivanovic2016-04-151-3/+2
| | | | | | | | | | Since this patch provided support for the __float128 type but disabled it on all platforms by default, some platforms can't compile type_traits with -std=gnu++11 since there is a specialization with __float128. This reverts the patch until D19125 is approved (i.e. we know which platforms need this support enabled). llvm-svn: 266460
* Enable support for __float128 in ClangNemanja Ivanovic2016-04-131-2/+3
| | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D15120 It adds support for the __float128 keyword, literals and a target feature to enable it. This support is disabled by default on all targets and any target that has support for this type is free to add it. Based on feedback that I've received from target maintainers, this appears to be the right thing for most targets. I have not heard from the maintainers of X86 which I believe supports this type. I will subsequently investigate the impact of enabling this on X86. llvm-svn: 266186
* [OpenCL] Move OpenCLImageTypes.def from clangAST to clangBasic library.Alexey Bader2016-04-131-1/+1
| | | | | | | | | | Putting OpenCLImageTypes.def to clangAST library violates layering requirement: "It's not OK for a Basic/ header to include an AST/ header". This fixes the modules build. Differential revision: http://reviews.llvm.org/D18954 Reviewers: Richard Smith, Vassil Vassilev. llvm-svn: 266180
* [OpenCL] Complete image types support.Alexey Bader2016-04-081-12/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I. Current implementation of images is not conformant to spec in the following points: 1. It makes no distinction with respect to access qualifiers and therefore allows to use images with different access type interchangeably. The following code would compile just fine: void write_image(write_only image2d_t img); kernel void foo(read_only image2d_t img) { write_image(img); } // Accepted code which is disallowed according to s6.13.14. 2. It discards access qualifier on generated code, which leads to generated code for the above example: call void @write_image(%opencl.image2d_t* %img); In OpenCL2.0 however we can have different calls into write_image with read_only and wite_only images. Also generally following compiler steps have no easy way to take different path depending on the image access: linking to the right implementation of image types, performing IR opts and backend codegen differently. 3. Image types are language keywords and can't be redeclared s6.1.9, which can happen currently as they are just typedef names. 4. Default access qualifier read_only is to be added if not provided explicitly. II. This patch corrects the above points as follows: 1. All images are encapsulated into a separate .def file that is inserted in different points where image handling is required. This avoid a lot of code repetition as all images are handled the same way in the code with no distinction of their exact type. 2. The Cartesian product of image types and image access qualifiers is added to the builtin types. This simplifies a lot handling of access type mismatch as no operations are allowed by default on distinct Builtin types. Also spec intended access qualifier as special type qualifier that are combined with an image type to form a distinct type (see statement above - images can't be created w/o access qualifiers). 3. Improves testing of images in Clang. Author: Anastasia Stulova Reviewers: bader, mgrang. Subscribers: pxli168, pekka.jaaskelainen, yaxunl. Differential Revision: http://reviews.llvm.org/D17821 llvm-svn: 265783
* NFC: make AtomicOrdering an enum classJF Bastien2016-04-061-1/+1
| | | | | | | | | | | | Summary: See LLVM change D18775 for details, this change depends on it. Reviewers: jyknight, reames Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18776 llvm-svn: 265569
* [CodeGenCXX] Fix ItaniumCXXABI::getAlignmentOfExnObject to return 8-byteAkira Hatanaka2016-03-311-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | alignment on Darwin. Itanium C++ ABI specifies that _Unwind_Exception should be double-word aligned (16B). To conform to the ABI, libraries implementing exception handling declare the struct with __attribute__((aligned)), which aligns the unwindHeader field (and the end of __cxa_exception) to the default target alignment (which is typically 16-bytes). struct __cxa_exception { ... // struct is declared with __attribute__((aligned)). _Unwind_Exception unwindHeader; }; Based on the assumption that _Unwind_Exception is declared with __attribute__((aligned)), ItaniumCXXABI::getAlignmentOfExnObject returns the target default alignment for __attribute__((aligned)). It turns out that libc++abi, which is used on Darwin, doesn't declare the struct with the attribute and therefore doesn't guarantee that unwindHeader is aligned to the alignment specified by the ABI, which in some cases causes the program to crash because of unaligned memory accesses. This commit avoids crashes due to unaligned memory accesses by having getAlignmentOfExnObject return an 8-byte alignment on Darwin. I've only fixed the problem for Darwin, but we should also figure out whether other platforms using libc++abi need similar fixes. rdar://problem/25314277 Differential revision: http://reviews.llvm.org/D18479 llvm-svn: 264998
* [TLS on Darwin] use CXX_FAST_TLS calling convention for tls_init.Manman Ren2016-03-181-2/+10
| | | | | | | | | | This makes sure we don't generate a lot of code to spill/reload CSRs when calling tls_init from the access functions. This helps performance when tls_init is not inlined into the access functions. llvm-svn: 263854
* Directly get the canonical Type instead of going around through a ↵Yaron Keren2016-03-161-1/+1
| | | | | | CanQualType temporary, NFC. llvm-svn: 263635
* CodeGen: Use 32-bit gep offsets to address vtable address points.Peter Collingbourne2016-03-141-2/+2
| | | | | | | | | | | | | | | | | 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
* Preserve ExtParameterInfos into CGFunctionInfo.John McCall2016-03-111-6/+3
| | | | | | | | | As part of this, make the function-arrangement interfaces a little simpler and more semantic. NFC. llvm-svn: 263191
* Add whole-program vtable optimization feature to Clang.Peter Collingbourne2016-02-241-3/+1
| | | | | | | | | This patch introduces the -fwhole-program-vtables flag, which enables the whole-program vtable optimization feature (D16795) in Clang. Differential Revision: http://reviews.llvm.org/D16821 llvm-svn: 261767
* Fix Itanium RTTI emission so that we emit fundamental type information into theRichard Smith2016-02-031-2/+11
| | | | | | | | | | | | | | | | C++ ABI library for the same set of types for which we expect the C++ ABI library to provide the RTTI. Specifically: 1) __int128 and unsigned __int128 are now emitted into the ABI library. We always expected them to be there but never actually made sure to emit them. 2) Do not expect OpenCL builtin types to have type info in the C++ ABI library. Neither libc++abi nor libstdc++ puts them there when built with either GCC or Clang. This matches GCC's behavior. llvm-svn: 259616
* Use a consistent spelling for vtables.Eric Christopher2016-01-291-1/+1
| | | | llvm-svn: 259137
* [cfi] Do not emit bit set entry for available_externally vtables.Evgeniy Stepanov2016-01-231-1/+2
| | | | | | | | In the Itanium ABI, vtable may be emitted speculatively as an available_externally global. Such vtable may not be present at the link time and should not have a corresponding CFI bit set entry. llvm-svn: 258596
* [CodeGen] Attach attributes to thread local wrapper function.Akira Hatanaka2016-01-151-4/+20
| | | | | | | | | | This commit is a follow-up to r251734, r251476, and r249735, which fixes a bug where function attributes were not attached to thread local wrapper functions. rdar://problem/20828324 llvm-svn: 257865
* [OpenCL] Pipe type supportXiuli Pan2016-01-091-0/+6
| | | | | | | | | | | | | | | Summary: Support for OpenCL 2.0 pipe type. This is a bug-fix version for bader's patch reviews.llvm.org/D14441 Reviewers: pekka.jaaskelainen, Anastasia Subscribers: bader, Anastasia, cfe-commits Differential Revision: http://reviews.llvm.org/D15603 llvm-svn: 257254
* [TLS on Darwin] use CXX_FAST_TLS calling convention for access functions.Manman Ren2015-12-171-3/+11
| | | | | | | | Also set nounwind attribute. rdar://problem/9001553 llvm-svn: 255860
* Add the `pass_object_size` attribute to clang.George Burgess IV2015-12-021-3/+2
| | | | | | | | | | | | | `pass_object_size` is our way of enabling `__builtin_object_size` to produce high quality results without requiring inlining to happen everywhere. A link to the design doc for this attribute is available at the Differential review link below. Differential Revision: http://reviews.llvm.org/D13263 llvm-svn: 254554
* Fix use-after-free when a C++ thread_local variable gets replaced (because itsRichard Smith2015-12-011-13/+9
| | | | | | | type changes when the initializer is attached). Don't hold onto the GlobalVariable*; recompute it from the VarDecl* instead. llvm-svn: 254359
* [TLS on Darwin] treat all Darwin platforms in the same way.Manman Ren2015-11-111-3/+3
| | | | | | rdar://problem/9001553 llvm-svn: 252820
* [TLS on Darwin] change how we handle globals with linkonce or weak linkage.Manman Ren2015-11-111-7/+7
| | | | | | | | | | | | This is about how we handle static member of a template. Before this commit, we use internal linkage for the IR thread-local variable, which is inefficient. With this commit, we will start to follow Itanium C++ ABI. rdar://problem/23415206 Reviewed by John McCall. llvm-svn: 252814
* [CodeGen] Call SetInternalFunctionAttributes to attach functionAkira Hatanaka2015-10-311-1/+2
| | | | | | | | | | | | | | | | | attributes to internal functions. This patch fixes CodeGenModule::CreateGlobalInitOrDestructFunction to use SetInternalFunctionAttributes instead of SetLLVMFunctionAttributes to attach function attributes to internal functions. Also, make sure the correct CGFunctionInfo is passed instead of always passing what arrangeNullaryFunction returns. rdar://problem/20828324 Differential Revision: http://reviews.llvm.org/D13610 llvm-svn: 251734
* Watch and TV OS: wire up basic ABI choicesTim Northover2015-10-301-0/+1
| | | | | | | This sets the mostly expected Darwin default ABI options for these two platforms. Active changes from these defaults for watchOS are in a later patch. llvm-svn: 251708
* Revert "Decorating virtual functions load with invariant.load" and fixRenato Golin2015-10-011-10/+1
| | | | | | | This reverts commit r248982 as it was breaking the ARM buildbots and the fix didn't work. This reverts commit r248984, the fix that didn't work. llvm-svn: 249005
* Decorating virtual functions load with invariant.loadPiotr Padlewski2015-10-011-1/+10
| | | | | | http://reviews.llvm.org/D13279 llvm-svn: 248982
* [WinEH] Pass the catch adjectives to catchpad directlyReid Kleckner2015-09-161-2/+2
| | | | | | | | | This avoids building a fake LLVM IR global variable just to ferry an i32 down into LLVM codegen. It also puts a nail in the coffin of using MS ABI C++ EH with landingpads, since now we'll assert in the lpad code when flags are present. llvm-svn: 247843
* Decorating vptr load & stores with !invariant.groupPiotr Padlewski2015-09-151-7/+16
| | | | | | | | | | Adding !invariant.group to vptr load/stores for devirtualization purposes. For more goto: http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html http://reviews.llvm.org/D12026 llvm-svn: 247725
* [OpenCL] Add new types for OpenCL 2.0.Alexey Bader2015-09-151-0/+10
| | | | | | | | Patch by Pedro Ferreira. Reviewers: pekka.jaaskelainen Differential Revision: http://reviews.llvm.org/D12855 llvm-svn: 247676
* ItaniumCXXABI.cpp: Fix a warning. [-Wunused-variable]NAKAMURA Takumi2015-09-151-2/+1
| | | | llvm-svn: 247655
OpenPOWER on IntegriCloud