summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* reduce indentation; NFCISanjay Patel2016-04-191-10/+7
| | | | llvm-svn: 266765
* Revert "[OPENMP] Codegen for untied tasks."Alexey Bataev2016-04-193-182/+73
| | | | | | This reverts commit r266754. llvm-svn: 266755
* [OPENMP] Codegen for untied tasks.Alexey Bataev2016-04-193-73/+182
| | | | | | | | If the untied clause is present on a task construct, any thread in the team can resume the task region after a suspension. Patch adds proper codegen for untied tasks. llvm-svn: 266754
* Revert "[OPENMP] Codegen for untied tasks."Alexey Bataev2016-04-193-180/+73
| | | | | | This reverts commit 266722. llvm-svn: 266724
* [OPENMP] Codegen for untied tasks.Alexey Bataev2016-04-193-73/+180
| | | | | | If the untied clause is present on a task construct, any thread in the team can resume the task region after a suspension. Patch adds proper codegen for untied tasks. llvm-svn: 266722
* [ObjC++] Fix crash when emitting debug info for a block member capturing this.Adrian Prantl2016-04-181-3/+8
| | | | | | rdar://problem/23871824 llvm-svn: 266698
* NFC: unify clang / LLVM atomic orderingJF Bastien2016-04-181-93/+73
| | | | | | | | | | | | | This makes the C11 / C++11 *ABI* atomic ordering accessible from LLVM, as discussed in http://reviews.llvm.org/D18200#inline-151433 This re-applies r266574 which I had reverted in r266575. Depends on http://reviews.llvm.org/D18875 Original review: http://reviews.llvm.org/D18876 llvm-svn: 266641
* Update InstrProf pass creator API referenceXinliang David Li2016-04-181-1/+1
| | | | llvm-svn: 266638
* Revert "NFC: unify clang / LLVM atomic ordering"JF Bastien2016-04-171-73/+93
| | | | | | | | This reverts commit b0495df9eae2824bee830cc4c94f5441f0d4cbc9. Same as for the corresponding LLVM revert, an assert seems to fire. llvm-svn: 266575
* NFC: unify clang / LLVM atomic orderingJF Bastien2016-04-171-93/+73
| | | | | | | | | | | | | | | Summary: Depends on http://reviews.llvm.org/D18875 This makes the C11 / C++11 *ABI* atomic ordering accessible from LLVM, as discussed in http://reviews.llvm.org/D18200#inline-151433 Reviewers: jyknight, reames Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18876 llvm-svn: 266574
* DebugInfo: Make DICompositeTypes distinct most of the timeDuncan P. N. Exon Smith2016-04-171-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since elements of most kinds of DICompositeType have back references, most are involved in uniquing cycles. Except via the ODR 'identifier:' field, which doesn't care about the storage type (see r266549), they have no hope of being uniqued. Distinct nodes are far more efficient, so use them for most kinds of DICompositeType definitions (i.e., when DIType::isForwardDecl is false). The exceptions: - DW_TAG_array_type, since their elements never have back-references and they never have ODR 'identifier:' fields; - DW_TAG_enumeration_type when there is no ODR 'identifier:' field, since their elements usually don't have back-references. This breaks the last major uniquing cycle I'm aware of in the debug info graph. The impact won't be enormous for C++ because references to ODR-uniqued nodes still use string-based DITypeRefs; but this should prevent a regression in C++ when we drop the string-based references. This wouldn't have been reasonable until r266549, when composite types stopped relying on being uniqued by structural equivalence to prevent blow-ups at LTO time. llvm-svn: 266556
* Revert 266186 as it breaks anything that includes type_traits on some platformsNemanja Ivanovic2016-04-154-19/+7
| | | | | | | | | | 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
* Update to match LLVM changes for PR27284.Adrian Prantl2016-04-151-5/+5
| | | | | | | | | (Reverse the ownership between DICompileUnit and DISubprogram.) http://reviews.llvm.org/D19034 <rdar://problem/25256815> llvm-svn: 266445
* [CodeGen] Avoid ctor/dtor boilerplate with some C++11Reid Kleckner2016-04-133-113/+94
| | | | | | | | | | | | | | Non-owning pointers that cache LLVM types and constants can use 'nullptr' default member initializers so that we don't need to mention them in the constructor initializer list. Owning pointers should use std::unique_ptr so that we don't need to manually delete them in the destructor. They also don't need to be mentioned in the constructor at that point. NFC llvm-svn: 266263
* [modules] Remove CXX_CTOR_INITIALIZERS_OFFSETS table. Instead of storing an IDRichard Smith2016-04-131-1/+1
| | | | | | | | of a table entry in the corresponding decl, store an offset from the current record to the relevant CXX_CTOR_INITIALIZERS record. This results in fewer indirections and a minor .pcm file size reduction. llvm-svn: 266254
* Enable support for __float128 in ClangNemanja Ivanovic2016-04-134-7/+19
| | | | | | | | | | | | | | | | 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-135-5/+5
| | | | | | | | | | 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
* [ObjC] Pop all cleanups created in EmitObjCForCollectionStmt beforeAkira Hatanaka2016-04-121-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | exiting the for-in loop. This commit fixes a bug where EmitObjCForCollectionStmt didn't pop cleanups for captures. For example, in the following for-in loop, a block which captures self is passed to foo1: for (id x in [self foo1:^{ use(self); }]) { use(x); break; } Previously, the code in EmitObjCForCollectionStmt wouldn't pop the cleanup for the captured self before exiting the loop, which caused code-gen to generate an IR in which objc_release was called twice on the captured self. This commit fixes the bug by entering a RunCleanupsScope before the loop condition is evaluated and forcing its cleanup before exiting the loop. rdar://problem/16865751 Differential Revision: http://reviews.llvm.org/D18618 llvm-svn: 266147
* Add a fixme for an old patch I had lying around that I'm not going to finish ↵David Blaikie2016-04-121-0/+5
| | | | | | any time so n llvm-svn: 266127
* Pass -backend-option to LLVM when there is no target machine.Yaxun Liu2016-04-121-16/+23
| | | | | | | | Clang should pass -backend-option to LLVM even though there is no target machine, since LLVM passes are used when emitting LLVM IR. Differential Revision: http://reviews.llvm.org/D17552 llvm-svn: 266117
* [OpenCL] Handle AddressSpaceConversion when target address space does not ↵Yaxun Liu2016-04-121-1/+4
| | | | | | | | | | | | | change. In codegen different address spaces may be mapped to the same address space for a target, e.g. in x86/x86-64 all address spaces are mapped to 0. Therefore AddressSpaceConversion should be translated by CreatePointerBitCastOrAddrSpaceCast instead of CreateAddrSpaceCast. Differential Revision: http://reviews.llvm.org/D18713 llvm-svn: 266107
* [OPENMP 4.0] Support for 'uniform' clause in 'declare simd' directive.Alexey Bataev2016-04-121-0/+1
| | | | | | | | | OpenMP 4.0 defines clause 'uniform' in 'declare simd' directive: 'uniform' '(' <argument-list> ')' The uniform clause declares one or more arguments to have an invariant value for all concurrent invocations of the function in the execution of a single SIMD loop. The special this pointer can be used as if was one of the arguments to the function in any of the linear, aligned, or uniform clauses. llvm-svn: 266041
* Emit the module hash by default with -flto=thin.Mehdi Amini2016-04-111-1/+2
| | | | | | | | | | | Reviewers: tejohnson Subscribers: joker.eph, cfe-commits Differential Revision: http://reviews.llvm.org/D18947 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 265977
* Remove redundant conditions of the form (A || (!A && B)) -> (A || B)Benjamin Kramer2016-04-111-1/+1
| | | | | | Found by cppcheck! PR27286 PR27287 PR27288 PR27289 llvm-svn: 265918
* [GCC] Attribute ifunc support in clangDmitry Polukhin2016-04-112-21/+101
| | | | | | | | | | | This patch add support for GCC attribute((ifunc("resolver"))) for targets that use ELF as object file format. In general ifunc is a special kind of function alias with type @gnu_indirect_function. LLVM patch http://reviews.llvm.org/D15525 Differential Revision: http://reviews.llvm.org/D15524 llvm-svn: 265917
* Use NoDebug compile units to mark debug metadata used only for sample-basedAdrian Prantl2016-04-081-5/+16
| | | | | | | | | | profiling and optimization remarks and indicate that no debug info shall be emitted for these compile units. http://reviews.llvm.org/D18808 <rdar://problem/25427165> llvm-svn: 265862
* Move EABIVersion from CodeGenOptions to TargetOptionsSaleem Abdulrasool2016-04-081-1/+1
| | | | | | | | | It is possible to argue that the EABIVersion field is similar in spirit to the ABI field in TargetOptions. It represents the embedded ABI that the target follows. This will allow us to thread this information into the target information construction. llvm-svn: 265807
* revert SVN r265702, r265640Saleem Abdulrasool2016-04-0824-37/+28
| | | | | | | | | | | Revert the two changes to thread CodeGenOptions into the TargetInfo allocation and to fix the layering violation by moving CodeGenOptions into Basic. Code Generation is arguably not particularly "basic". This addresses Richard's post-commit review comments. This change purely does the mechanical revert and will be followed up with an alternate approach to thread the desired information into TargetInfo. llvm-svn: 265806
* [OpenCL] Complete image types support.Alexey Bader2016-04-085-108/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Silencing a 32-bit shift implicit conversion warning from MSVC; NFC.Aaron Ballman2016-04-081-1/+1
| | | | llvm-svn: 265782
* Adapt to LLVM API changeSanjoy Das2016-04-082-2/+2
| | | | | | Replace mayBeOverridden with isInterposable llvm-svn: 265767
* Replace Sema-level implementation of -fassume-sane-operator-new with aRichard Smith2016-04-071-3/+13
| | | | | | | | | | | | | | CodeGen-level implementation. Instead of adding an attribute to clang's FunctionDecl, add the IR attribute directly. This means a module built with this flag is now compatible with code built without it and vice versa. This change also results in the 'noalias' attribute no longer being added to calls to operator new in the IR; it's now only added to the declaration. It also fixes a bug where we failed to add the attribute to the 'nothrow' versions (because we didn't implicitly declare them, there was no good time to inject a fake attribute). llvm-svn: 265728
* Basic: move CodeGenOptions from FrontendSaleem Abdulrasool2016-04-0724-28/+37
| | | | | | | | This is a mechanical move of CodeGenOptions from libFrontend to libBasic. This fixes the layering violation introduced earlier by threading CodeGenOptions into TargetInfo. It should also fix the modules based self-hosting builds. NFC. llvm-svn: 265702
* make __builtin_isfinite more efficient (PR27145)Sanjay Patel2016-04-071-19/+12
| | | | | | | | | | | | | | isinf (is infinite) and isfinite should be implemented with the same function except we change the comparison operator. See PR27145 for more details: https://llvm.org/bugs/show_bug.cgi?id=27145 Ref: forked off of the discussion in D18513. Differential Revision: http://reviews.llvm.org/D18648 llvm-svn: 265675
* Move class into an anonymous namespace. NFC.Benjamin Kramer2016-04-071-0/+2
| | | | llvm-svn: 265654
* NFC: use AtomicOrdering isStrongerThanJF Bastien2016-04-061-4/+6
| | | | | | | | | | Summary: As discussed in D18775. Reviewers: jyknight Differential Revision: http://reviews.llvm.org/D18840 llvm-svn: 265617
* Restore slightly less dodgy diagnostic handler for inline asmTim Northover2016-04-061-0/+25
| | | | | | | | Turns out it was there mostly to prevent Clang asking people to report a bug. This time we report something to Clang's real diagnostics handler so that it exits with something approximating a real error and tidies up after itself. llvm-svn: 265592
* NFC: make AtomicOrdering an enum classJF Bastien2016-04-068-114/+125
| | | | | | | | | | | | 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
* [CUDA] Add -fcuda-flush-denormals-to-zero.Justin Lebar2016-04-052-0/+12
| | | | | | | | | | | | | | | | | | Summary: Setting this flag causes all functions are annotated with the "nvvm-f32ftz" = "true" attribute. In addition, we annotate the module with "nvvm-reflect-ftz" set to 0 or 1, depending on whether -cuda-flush-denormals-to-zero is set. This is read by the NVVMReflect pass. Reviewers: tra, rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18671 llvm-svn: 265435
* Add -fno-jump-tables and-fjump-tables flagsNirav Dave2016-04-051-0/+4
| | | | | | | | | | | | | Add no-jump-tables flag to disable use of jump tables when lowering switch statements Reviewers: echristo, hans Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D18407 llvm-svn: 265425
* Fix "suggest parentheses" warning.James Y Knight2016-04-041-3/+3
| | | | llvm-svn: 265355
* Fix an unused-variable warning by using the variable in the placeJohn McCall2016-04-041-1/+1
| | | | | | it was supposed to have been used. llvm-svn: 265344
* IRGen-level lowering for the Swift calling convention.John McCall2016-04-049-45/+1115
| | | | llvm-svn: 265324
* [OPENMP] Codegen for teams directive for NVPTXCarlo Bertolli2016-04-045-21/+104
| | | | | | | | | | | | This patch implements the teams directive for the NVPTX backend. It is different from the host code generation path as it: Does not call kmpc_fork_teams. All necessary teams and threads are started upon touching the target region, when launching a CUDA kernel, and their execution is coordinated through sequential and parallel regions within the target region. Does not call kmpc_push_num_teams even if a num_teams of thread_limit clause is present. Setting the number of teams and the thread limit is implemented by the nvptx-related runtime. Please note that I am now passing a Clang Expr * to emitPushNumTeams instead of the originally chosen llvm::Value * type. The reason for that is that I want to avoid emitting expressions for num_teams and thread_limit if they are not needed in the target region. http://reviews.llvm.org/D17963 llvm-svn: 265304
* [Objective-C] Introduce objc_runtime_visible attribute.Douglas Gregor2016-04-011-0/+49
| | | | | | | | | | | | | | | | | | | | The objc_runtime_visible attribute deals with an odd corner case where a particular Objective-C class is known to the Objective-C runtime (and, therefore, accessible by name) but its symbol has been hidden for some reason. For such classes, teach CodeGen to use objc_lookUpClass to retrieve the Class object, rather than referencing the class symbol directly. Classes annotated with objc_runtime_visible have two major limitations that fall out from places where Objective-C metadata needs to refer to the class (or metaclass) symbol directly: * One cannot implement a subclass of an objc_runtime_visible class. * One cannot implement a category on an objc_runtime_visible class. Implements rdar://problem/25494092. llvm-svn: 265201
* [CodeGen] Emit lifetime.end intrinsic after objects are destructed inAkira Hatanaka2016-04-013-4/+16
| | | | | | | | | | | | | | | | landing pads. Previously, lifetime.end intrinsics were inserted only on normal control flows. This prevented StackColoring from merging stack slots for objects that were destroyed on the exception handling control flow since it couldn't tell their lifetime ranges were disjoint. This patch fixes code-gen to emit the intrinsic on both control flows. rdar://problem/22181976 Differential Revision: http://reviews.llvm.org/D18196 llvm-svn: 265197
* Adapt to LLVM API change in r265077.Adrian Prantl2016-03-311-3/+3
| | | | | | | | | EmissionKind moved from DIBuilder to DICompileUnit. <rdar://problem/25427165> llvm-svn: 265078
* Diagnostics: remove dodgy handler for bitcode inlineasm diagnostics.Tim Northover2016-03-311-8/+0
| | | | | | | | Whatever crash it was there to present appears to have been fixed in the backend now, and it had the nasty side-effect of causing clang to exit(0) and leave a .o containing goodness knows what even when an error hit. llvm-svn: 265038
* [PGO] Avoid instrumenting constants at value sitesBetul Buyukkurt2016-03-311-0/+3
| | | | | | | | | | Value profiling should not profile constants and/or constant expressions when they appear as callees in call instructions. Constant expressions form when a direct callee has bitcasts or inttoptr(ptrtint (callee)) nests surrounding it. Value profiling should avoid instrumenting such cases. Mostly NFC. llvm-svn: 265037
* [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
OpenPOWER on IntegriCloud