summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [OpenMP] Reorganize code to allow specialized code generation for different ↵Samuel Antao2016-02-064-1/+68
| | | | | | | | | | | | | | | | | | | | | | | devices. Summary: Different devices may in some cases require different code generation schemes in order to implement OpenMP. This is required not only for performance reasons, but also because it may not be possible to have the current (default) implementation working for these devices. E.g. GPU's cannot implement the same scheme a target such as powerpc or x86b would use, in the sense that it does not have the ability to fork threads, instead all the threads are always executing and need to be managed by the implementation. This patch proposes a reorganization of the code in the OpenMP code generation to pave the way to have specialized implementation of OpenMP support. More than a "real" patch this is more a request for comments in order to understand if what is proposed is acceptable or if there are better/easier ways to do it. In this patch part of the common OpenMP codegen infrastructure is moved to a new file under a new namespace (CGOpenMPCommon) so it can be shared between the default implementation and the specialized one. When CGOpenMPRuntime is created, an attempt to select a specialized implementation is done. In the patch a specialization for nvptx targets is done which currently checks if the target is an OpenMP device and trap if it is not. Let me know comments suggestions you may have. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: Hahnfeld, cfe-commits, fraggamuffin, caomhin, jholewinski Differential Revision: http://reviews.llvm.org/D16784 llvm-svn: 259977
* Fix a crash when emitting dbeug info for forward-declared scoped enums.Adrian Prantl2016-02-061-1/+13
| | | | | | | | | | It is possible for enums to be created as part of their own declcontext. We need to cache a placeholder to avoid the type being created twice before hitting the cache. <rdar://problem/24493203> llvm-svn: 259975
* Eliminate an unnecessary enum, use the LLVM version. NFCPaul Robinson2016-02-051-13/+1
| | | | llvm-svn: 259950
* Add an ARC autoreleased-return-value caller marker on i386.John McCall2016-02-051-0/+5
| | | | | | rdar://24531556 llvm-svn: 259932
* CodeGen: correct Windows ARM C++ assertionSaleem Abdulrasool2016-02-051-15/+0
| | | | | | | | | | | Because the Decl is explicitly passed as nullptr further up the call chain, it is possible to invoke isa on a nullptr, which will assert. Guard against the nullptr. Take the opportunity to reuse the helper method rather than re-implementing this logic. llvm-svn: 259874
* [PGO] code simplification: use existing VP annotation API /NFCXinliang David Li2016-02-041-27/+3
| | | | llvm-svn: 259819
* [PGO] cc1 option name change for profile instrumentationRong Xu2016-02-045-9/+9
| | | | | | | | | | | | This patch changes cc1 option -fprofile-instr-generate to an enum option -fprofile-instrument={clang|none}. It also changes cc1 options -fprofile-instr-generate= to -fprofile-instrument-path=. The driver level option -fprofile-instr-generate and -fprofile-instr-generate= remain intact. This change will pave the way to integrate new PGO instrumentation in IR level. Review: http://reviews.llvm.org/D16730 llvm-svn: 259811
* [OPENMP 4.0] Fixed support of array sections/array subscripts.Alexey Bataev2016-02-044-102/+178
| | | | | | Codegen for array sections/array subscripts worked only for expressions with arrays as base. Patch fixes codegen for bases with pointer/reference types. llvm-svn: 259776
* [cfi] Safe handling of unaddressable vtable pointers (clang).Evgeniy Stepanov2016-02-034-5/+55
| | | | | | | | | | | Avoid crashing when printing diagnostics for vtable-related CFI errors. In diagnostic mode, the frontend does an additional check of the vtable pointer against the set of all known vtable addresses and lets the runtime handler know if it is safe to inspect the vtable. http://reviews.llvm.org/D16823 llvm-svn: 259716
* Add builtins for bitreverse intrinsicMatt Arsenault2016-02-031-42/+45
| | | | | | | Follow the naming convention that bswap uses since it's a similar sort of operation. llvm-svn: 259671
* [OpenMP] Parsing + sema for target parallel for directive.Arpith Chacko Jacob2016-02-033-0/+10
| | | | | | | | | | | Summary: This patch adds parsing + sema for the target parallel for directive along with testcases. Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16759 llvm-svn: 259654
* 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
* Work around build failure due to GCC 4.8.1 bug. We don't completely understandRichard Smith2016-02-021-14/+6
| | | | | | | | | | the details of the bug, but avoiding overloading llvm::cast with another function template sidesteps it. See gcc.gnu.org/PR58022 for details of the bug, and llvm.org/PR26362 for more backgound on how it manifested in Clang. Patch by Igor Sugak! llvm-svn: 259598
* [CUDA] Do not allow dynamic initialization of global device side variables.Artem Belevich2016-02-022-11/+17
| | | | | | | | | | | | | | In general CUDA does not allow dynamic initialization of global device-side variables. One exception is that CUDA allows records with empty constructors as described in section E2.2.1 of CUDA 7.5 Programming guide. This patch applies initializer checks for all device-side variables. Empty constructors are accepted, but no code is generated for them. Differential Revision: http://reviews.llvm.org/D15305 llvm-svn: 259592
* Make CodeGen headers self-contained.Benjamin Kramer2016-02-021-1/+1
| | | | llvm-svn: 259518
* Make the remaining headers self-contained.Benjamin Kramer2016-02-022-8/+5
| | | | llvm-svn: 259507
* Add backend dignostic printer for unsupported featuresOliver Stannard2016-02-021-11/+64
| | | | | | | | | | | | | | Re-commit of r258950 after fixing layering violation. The related LLVM patch adds a backend diagnostic type for reporting unsupported features, this adds a printer for them to clang. In the case where debug location information is not available, I've changed the printer to report the location as the first line of the function, rather than the closing brace, as the latter does not give the user any information. This also affects optimisation remarks. llvm-svn: 259499
* Move DebugInfoKind into its own header to cut the cyclic dependency edge ↵Benjamin Kramer2016-02-029-53/+50
| | | | | | from Driver to Frontend. llvm-svn: 259489
* Class Property: generate metadata for class properties in protocols.Manman Ren2016-01-291-5/+16
| | | | | | | | | | The list of class properties is saved in Old ABI: protocol->ext->class_properties (protocol->ext->size will be updated) New ABI: protocol->class_properties (protocol->size will be updated) rdar://23891898 llvm-svn: 259268
* Class Property: generate metadata for class properties in categories.Manman Ren2016-01-291-4/+21
| | | | | | | | | | | The list of class properties is saved in Old ABI: category->class_properties (category->size will be updated as well) New ABI: category->class_properties (a flag in objc_image_info to indicate whether or not the list of class properties is present) rdar://23891898 llvm-svn: 259267
* Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith ↵Yaron Keren2016-01-292-3/+3
| | | | | | r259192 post commit comment. llvm-svn: 259232
* Class Property: generate metadata for class properties in classes.Manman Ren2016-01-291-28/+57
| | | | | | | | | | The list of class properties is saved in Old ABI: cls->isa->ext->properties New ABI: cls->isa->ro->properties rdar://23891898 llvm-svn: 259229
* Use a consistent spelling for vtables.Eric Christopher2016-01-296-19/+19
| | | | llvm-svn: 259137
* [CUDA] Generate CUDA's printf alloca in its function's entry block.Justin Lebar2016-01-281-39/+18
| | | | | | | | | | | | | | | Summary: This is necessary to prevent llvm from generating stacksave intrinsics around this alloca. NVVM doesn't have a stack, and we don't handle said intrinsics. Reviewers: rnk, echristo Subscribers: cfe-commits, jhen, tra Differential Revision: http://reviews.llvm.org/D16664 llvm-svn: 259122
* Check for frontend errors after releasing the Builder.Manman Ren2016-01-281-3/+6
| | | | | | | | | | | | | Frontend can emit errors when releaseing the Builder. If there are errors before or when releasing the Builder, we reset the module to stop here before invoking the backend. Before this commit, clang will continue to invoke the backend and backend can crash. Differential Revision: http://reviews.llvm.org/D16564 llvm-svn: 259116
* Fix strange indent.Nico Weber2016-01-281-2/+2
| | | | llvm-svn: 259063
* [Coverage] Use a set to track visited FileIDs (NFC)Vedant Kumar2016-01-281-3/+3
| | | | llvm-svn: 259061
* Revert r259036, it introduces a cyclic library dependencyOliver Stannard2016-01-281-65/+11
| | | | llvm-svn: 259043
* Add backend dignostic printer for unsupported featuresOliver Stannard2016-01-281-11/+65
| | | | | | | | | | | | | | | | | | Re-commit of r258950 after fixing layering violation. Add backend dignostic printer for unsupported features The related LLVM patch adds a backend diagnostic type for reporting unsupported features, this adds a printer for them to clang. In the case where debug location information is not available, I've changed the printer to report the location as the first line of the function, rather than the closing brace, as the latter does not give the user any information. This also affects optimisation remarks. Differential Revision: http://reviews.llvm.org/D16591 llvm-svn: 259036
* Revert r258951 (and r258950), "Refactor backend diagnostics for unsupported ↵NAKAMURA Takumi2016-01-281-64/+11
| | | | | | | | | | | features" It broke layering violation in LLVMIR. clang r258950 "Add backend dignostic printer for unsupported features" llvm r258951 "Refactor backend diagnostics for unsupported features" llvm-svn: 259016
* Class Property: handle class properties.Manman Ren2016-01-271-2/+2
| | | | | | | | At places where we handle instance properties, if necessary. rdar://23891898 llvm-svn: 258979
* ARMv7k: select ABI based on v7k Arch rather than watchos OS.Tim Northover2016-01-271-1/+1
| | | | | | | | Various bits we'd like to use the new ABI actually compile with "-arch armv7k -miphoneos-version-min=9.0". Not ideal, but also not ridiculous given how slices work. llvm-svn: 258976
* Emit calls to objc_unsafeClaimAutoreleasedReturnValue whenJohn McCall2016-01-275-171/+454
| | | | | | | | | | | | | | | | | reclaiming a call result in order to ignore it or assign it to an __unsafe_unretained variable. This avoids adding an unwanted retain/release pair when the return value is not actually returned autoreleased (e.g. when it is returned from a nonatomic getter or a typical collection accessor). This runtime function is only available on the latest Apple OS releases; the backwards-compatibility story is that you don't get the optimization unless your deployment target is recent enough. Sorry. rdar://20530049 llvm-svn: 258962
* Add backend dignostic printer for unsupported featuresOliver Stannard2016-01-271-11/+64
| | | | | | | | | | | | | | The related LLVM patch adds a backend diagnostic type for reporting unsupported features, this adds a printer for them to clang. In the case where debug location information is not available, I've changed the printer to report the location as the first line of the function, rather than the closing brace, as the latter does not give the user any information. This also affects optimisation remarks. Differential Revision: http://reviews.llvm.org/D16591 llvm-svn: 258950
* [WinEH] Annotate calls to __RTtypeid with a funclet bundleDavid Majnemer2016-01-261-2/+5
| | | | | | | | | | Clang's CodeGen has several paths which end up invoking or calling a function. The one that we used for calls to __RTtypeid did not appropriately annotate the call with a funclet bundle. This fixes PR26329. llvm-svn: 258877
* Remove autoconf supportChris Bieneman2016-01-261-19/+0
| | | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 llvm-svn: 258862
* [MS ABI] Allow a member pointers' converted type to changeDavid Majnemer2016-01-266-4/+42
| | | | | | | | | | | | | | | | | | | | | | | | Member pointers in the MS ABI are tricky for a variety of reasons. The size of a member pointer is indeterminate until the program reaches a point where the representation is required to be known. However, *pointers* to member pointers may exist without knowing the pointee type's representation. In these cases, we synthesize an opaque LLVM type for the pointee type. However, we can be in a situation where the underlying member pointer's representation became known mid-way through the program. To account for this, we attempted to manicure CodeGen's type-cache so that we can replace the opaque member pointer type with the real deal while leaving the pointer types unperturbed. This, unfortunately, is a problematic approach to take as we will violate CodeGen's invariants. These violations are mostly harmless but let's do the right thing instead: invalidate the type-cache if a member pointer's LLVM representation changes. This fixes PR26313. llvm-svn: 258839
* Fix Clang-tidy modernize-use-nullptr warnings; other minor fixes.Eugene Zelenko2016-01-261-4/+5
| | | | | | Differential revision: http://reviews.llvm.org/D16567 llvm-svn: 258836
* [OpenMP] Parsing + sema for target parallel directive.Arpith Chacko Jacob2016-01-263-0/+9
| | | | | | | | | | | | | Summary: This patch adds parsing + sema for the target parallel directive and its clauses along with testcases. Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16553 Rebased to current trunk and updated test cases. llvm-svn: 258832
* Use instance_properties instead of properties. NFC.Manman Ren2016-01-263-6/+6
| | | | | | | | | | | All current properties are instance properties. This is the second patch in a series of patches to support class properties in addition to instance properties in objective-c. rdar://23891898 llvm-svn: 258824
* [OpenMP] Parsing + sema for defaultmap clause.Arpith Chacko Jacob2016-01-261-0/+1
| | | | | | | | | | | Summary: This patch adds parsing + sema for the defaultmap clause associated with the target directive (among others). Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16527 llvm-svn: 258817
* [OPENMP 4.5] Allow arrays in 'reduction' clause.Alexey Bataev2016-01-263-64/+107
| | | | | | OpenMP 4.5, alogn with array sections, allows to use variables of array type in reductions. llvm-svn: 258804
* Recommit: R258773 [OpenCL] Pipe builtin functionsXiuli Pan2016-01-261-0/+136
| | | | | | | | | | | | | | | | | Fix arc patch fuzz error. Summary: Support for the pipe built-in functions for OpenCL 2.0. The pipe builtin functions may have infinite kinds of element types, one approach would be to just generate calls that would always use generic types such as void*. This patch is based on bader's opencl support patch on SPIR-V branch. Reviewers: Anastasia, pekka.jaaskelainen Subscribers: keryell, bader, cfe-commits Differential Revision: http://reviews.llvm.org/D15914 llvm-svn: 258782
* Revert "[OpenCL] Pipe builtin functions"David Majnemer2016-01-261-135/+0
| | | | | | | This reverts commit r258773, it broke the build bots: http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/43853 llvm-svn: 258775
* [OpenCL] Pipe builtin functionsXiuli Pan2016-01-261-0/+135
| | | | | | | | | | | | | | | | Summary: Support for the pipe built-in functions for OpenCL 2.0. The pipe builtin functions may have infinite kinds of element types, one approach would be to just generate calls that would always use generic types such as void*. This patch is based on bader's opencl support patch on SPIR-V branch. Reviewers: Anastasia, pekka.jaaskelainen Subscribers: keryell, bader, cfe-commits Differential Revision: http://reviews.llvm.org/D15914 llvm-svn: 258773
* Fix use of constexpr std::pair that's not in C++11.Evgeniy Stepanov2016-01-251-1/+1
| | | | llvm-svn: 258749
* [cfi] Cross-DSO CFI diagnostic mode (clang part)Evgeniy Stepanov2016-01-254-46/+154
| | | | | | | | | | | | | | * Runtime diagnostic data for cfi-icall changed to match the rest of cfi checks * Layout of all CFI diagnostic data changed to put Kind at the beginning. There is no ABI stability promise yet. * Call cfi_slowpath_diag instead of cfi_slowpath when needed. * Emit __cfi_check_fail function, which dispatches a CFI check faliure according to trap/recover settings of the current module. * A tiny driver change to match the way the new handlers are done in compiler-rt. llvm-svn: 258745
* Update comments to match the implementation.Manman Ren2016-01-251-0/+1
| | | | llvm-svn: 258735
* [CUDA] Don't generate aliases for static extern "C" functions.Justin Lebar2016-01-251-0/+4
| | | | | | | | | | | | | | Summary: These aliases are done to support inline asm, but there's nothing we can do: NVPTX doesn't support aliases. Reviewers: tra Subscribers: cfe-commits, jhen, echristo Differential Revision: http://reviews.llvm.org/D16501 llvm-svn: 258734
* [PGO] Windows buildbot failure fix. [NFC]Betul Buyukkurt2016-01-241-2/+3
| | | | llvm-svn: 258652
OpenPOWER on IntegriCloud