summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix -Werror build.Richard Smith2016-03-081-1/+1
| | | | llvm-svn: 262965
* P0017R1: In C++1z, an aggregate class can have (public non-virtual) base ↵Richard Smith2016-03-083-12/+59
| | | | | | classes; these are initialized as if they were data members. llvm-svn: 262963
* Module Debugging: Fix a crash when emitting debug info for nested tag typesAdrian Prantl2016-03-071-0/+9
| | | | | | | | whose DeclContext is not yet complete by deferring their emission. rdar://problem/24918680 llvm-svn: 262851
* [OPENMP] Codegen for distribute directive: fix bug in ordering of parameters.Carlo Bertolli2016-03-071-1/+1
| | | | llvm-svn: 262833
* Reapply r262741 [OPENMP] Codegen for distribute directiveCarlo Bertolli2016-03-074-104/+356
| | | | | | | | This patch provide basic implementation of codegen for teams directive, excluding all clauses except dist_schedule. It also fixes parts of AST reader/writer to enable correct pre-compiled header handling. http://reviews.llvm.org/D17170 llvm-svn: 262832
* Resolved Bug 26414.Amjad Aboud2016-03-071-3/+6
| | | | | | | | | https://llvm.org/bugs/show_bug.cgi?id=26414 Since interrupt handler must be returned with iret, tail call can't be used. Differential Revision: http://reviews.llvm.org/D17853 llvm-svn: 262830
* Fixed -Wdocumentation warning - typo in a parameter nameSimon Pilgrim2016-03-051-1/+1
| | | | llvm-svn: 262783
* Revert r262741 - [OPENMP] Codegen for distribute directiveSamuel Antao2016-03-044-356/+104
| | | | | | Was causing a failure in one of the buildbot slaves. llvm-svn: 262744
* [OPENMP] Codegen for distribute directiveCarlo Bertolli2016-03-044-104/+356
| | | | | | | | This patch provide basic implementation of codegen for teams directive, excluding all clauses except dist_schedule. It also fixes parts of AST reader/writer to enable correct pre-compiled header handling. http://reviews.llvm.org/D17170 llvm-svn: 262741
* Make TargetInfo store an actual DataLayout instead of a string.James Y Knight2016-03-044-15/+15
| | | | | | | | | | | | | | Use it to calculate UserLabelPrefix, instead of specifying it (often incorrectly). Note that the *actual* user label prefix has always come from the DataLayout, and is handled within LLVM. The main thing clang's TargetInfo::UserLabelPrefix did was to set the #define value. Having these be different from each-other is just silly. Differential Revision: http://reviews.llvm.org/D17183 llvm-svn: 262737
* [OPENMP 4.0] Codegen for 'declare reduction' construct.Alexey Bataev2016-03-047-12/+135
| | | | | | | Emit function for 'combiner' part of 'declare reduction' construct and 'initialilzer' part, if any. llvm-svn: 262699
* [Coverage] Fix the start/end locations of switch statementsVedant Kumar2016-03-041-1/+1
| | | | | | | | | | | | While pushing switch statements onto the region stack we neglected to specify their start/end locations. This results in a crash (PR26825) if we end up in nested macro expansions without enough information to handle the relevant file exits. I added a test in switchmacro.c and fixed up a bunch of incorrect CHECK lines that specify strange end locations for switches. llvm-svn: 262697
* [X86] Pass __m64 types via SSE registers for GCC compatibilityDavid Majnemer2016-03-041-6/+22
| | | | | | | | | | For compatibility with GCC, classify __m64 as SSE. However, clang is a platform compiler for certain targets; retain our old behavior on those targets: classify __m64 as integer. This fixes PR26832. llvm-svn: 262688
* [OPENMP] firstprivate and private clauses of teams, host codegenerationCarlo Bertolli2016-03-031-0/+17
| | | | | | | | Add code generation support for firstprivate and private clauses of teams on the host. Add extensive regression tests including lambda functions and vla testing. http://reviews.llvm.org/D17582 llvm-svn: 262663
* Add code generation for teams directive inside target regionCarlo Bertolli2016-03-034-9/+136
| | | | llvm-svn: 262652
* [OpenMP] Code generation for teams - kernel launchingSamuel Antao2016-03-032-8/+217
| | | | | | | | | | | | | | | Summary: This patch implements the launching of a target region in the presence of a nested teams region, i.e calls tgt_target_teams with the required arguments gathered from the enclosed teams directive. The actual codegen of the region enclosed by the teams construct will be contributed in a separate patch. Reviewers: hfinkel, arpith-jacob, kkwli0, carlo.bertolli, ABataev Subscribers: cfe-commits, caomhin, fraggamuffin Differential Revision: http://reviews.llvm.org/D17019 llvm-svn: 262625
* [OPENMP 4.0] Initial support for 'omp declare reduction' construct.Alexey Bataev2016-03-033-0/+16
| | | | | | | | | | | | | | | | | Add parsing, sema analysis and serialization/deserialization for 'declare reduction' construct. User-defined reductions are defined as #pragma omp declare reduction( reduction-identifier : typename-list : combiner ) [initializer ( initializer-expr )] These custom reductions may be used in 'reduction' clauses of OpenMP constructs. The combiner specifies how partial results can be combined into a single value. The combiner can use the special variable identifiers omp_in and omp_out that are of the type of the variables being reduced with this reduction-identifier. Each of them will denote one of the values to be combined before executing the combiner. It is assumed that the special omp_out identifier will refer to the storage that holds the resulting combined value after executing the combiner. As the initializer-expr value of a user-defined reduction is not known a priori the initializer-clause can be used to specify one. Then the contents of the initializer-clause will be used as the initializer for private copies of reduction list items where the omp_priv identifier will refer to the storage to be initialized. The special identifier omp_orig can also appear in the initializer-clause and it will refer to the storage of the original variable to be reduced. Differential Revision: http://reviews.llvm.org/D11182 llvm-svn: 262582
* [OPENMP 4.5] Initial support for data members in 'linear' clause.Alexey Bataev2016-03-031-2/+10
| | | | | | | | OpenMP 4.5 allows to privatize data members of current class in member functions. Patch adds initial support for privatization of data members in 'linear' clause, no codegen support. llvm-svn: 262578
* [PGO] Change profile use cc1 option to handle IR level profilesRong Xu2016-03-022-4/+6
| | | | | | | | | | | | | | | | | | This patch changes cc1 option for PGO profile use from -fprofile-instr-use=<path> to -fprofile-instrument-use-path=<path>. -fprofile-instr-use=<path> is now a driver only option. In addition to decouple the cc1 option from the driver level option, this patch also enables IR level profile use. cc1 option handling now reads the profile header and sets CodeGenOpt ProfileUse (valid values are {None, Clang, LLVM} -- this is a common enum for -fprofile-instrument={}, for the profile instrumentation), and invoke the pipeline to enable the respective PGO use pass. Reviewers: silvas, davidxl Differential Revision: http://reviews.llvm.org/D17737 llvm-svn: 262515
* Serialize `#pragma detect_mismatch`.Nico Weber2016-03-024-10/+7
| | | | | | | This is like r262493, but for pragma detect_mismatch instead of pragma comment. The two pragmas have similar behavior, so use the same approach for both. llvm-svn: 262506
* [CUDA] Do not generate unnecessary runtime init code.Artem Belevich2016-03-021-1/+14
| | | | | | Differential Revision: http://reviews.llvm.org/D17780 llvm-svn: 262499
* [CUDA] Emit host-side 'shadows' for device-side global variablesArtem Belevich2016-03-023-27/+111
| | | | | | | | | | | | | ... and register them with CUDA runtime. This is needed for commonly used cudaMemcpy*() APIs that use address of host-side shadow to access their counterparts on device side. Fixes PR26340 Differential Revision: http://reviews.llvm.org/D17779 llvm-svn: 262498
* Serialize `#pragma comment`.Nico Weber2016-03-024-18/+22
| | | | | | | | | | | | | | `#pragma comment` was handled by Sema calling a function on ASTConsumer, and CodeGen then implementing this function and writing things to its output. Instead, introduce a PragmaCommentDecl AST node and hang one off the TranslationUnitDecl for every `#pragma comment` line, and then use the regular serialization machinery. (Since PragmaCommentDecl has codegen relevance, it's eagerly deserialized.) http://reviews.llvm.org/D17799 llvm-svn: 262493
* [Sema] PR26444 fix crash when alignment value is >= 2**16David Majnemer2016-03-021-1/+1
| | | | | | | | | | | Sema allows max values up to 2**28, use unsigned instead of unsiged short to hold values that large. Differential Revision: http://reviews.llvm.org/D17248 Patch by Don Hinton! llvm-svn: 262466
* [OPENMP 4.5] Codegen for data members in 'reduction' clause.Alexey Bataev2016-03-021-0/+41
| | | | | | | | OpenMP 4.5 allows to privatize non-static data members of current class in non-static member functions. Patch supports codegen for non-static data members in 'reduction' clauses. llvm-svn: 262460
* Reword a misleading comment discussing landingpads and SEHReid Kleckner2016-03-011-2/+4
| | | | | | SEH doesn't use landingpads anymore. llvm-svn: 262382
* [MSVC Compat] Correctly handle finallys nested within finallysDavid Majnemer2016-03-013-9/+11
| | | | | | | | | We'd lose track of the parent CodeGenFunction, leading us to get confused with regard to which function a nested finally belonged to. Differential Revision: http://reviews.llvm.org/D17752 llvm-svn: 262379
* [PGO] clang cc1 option change to enable IR level instrumentationRong Xu2016-02-291-0/+6
| | | | | | | | | | | This patch expands cc1 option -fprofile-instrument= with a new value: -fprofile-instrument=llvm which enables IR level PGO instrumentation. Reviewers: davidxl, silvas Differential Revision: http://reviews.llvm.org/D17622 llvm-svn: 262239
* Add __builtin_canonicalizeMatt Arsenault2016-02-271-0/+5
| | | | llvm-svn: 262122
* [OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttrXiuli Pan2016-02-261-4/+3
| | | | | | | | | | | | | | | Summary: OpenCL access qualifiers are now not only used for image types, refine it to avoid misleading, Add semacheck for OpenCL access qualifier as well as test caees. Reviewers: pekka.jaaskelainen, Anastasia, aaron.ballman Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D16040 llvm-svn: 261961
* [OPENMP 4.5] Codegen for member decls in 'lastprivate' clause.Alexey Bataev2016-02-251-15/+2
| | | | | | | | | OpenMP 4.5 allows to privatize non-static member decls in non-static member functions. Patch captures such decls by reference in general (for bitfields, by value) and then operates with this capture. For bitfields, at the end of codegen for lastprivates original bitfield is updated with the value of captured copy. llvm-svn: 261824
* [CUDA] Mark all CUDA device-side function defs, decls, and calls as convergent.Justin Lebar2016-02-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is important for e.g. the following case: void sync() { __syncthreads(); } void foo() { do_something(); sync(); do_something_else(): } Without this change, if the optimizer does not inline sync() (which it won't because __syncthreads is also marked as noduplicate, for now anyway), it is free to perform optimizations on sync() that it would not be able to perform on __syncthreads(), because sync() is not marked as convergent. Similarly, we need a notion of convergent calls, since in the case when we can't statically determine a call's target(s), we need to know whether it's safe to perform optimizations around the call. This change is conservative; the optimizer will remove these attrs where it can, see r260318, r260319. Reviewers: majnemer Subscribers: cfe-commits, jhen, echristo, tra Differential Revision: http://reviews.llvm.org/D17056 llvm-svn: 261779
* Add whole-program vtable optimization feature to Clang.Peter Collingbourne2016-02-248-36/+78
| | | | | | | | | 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
* Objective-C: Add a size field to non-fragile category metadata.Manman Ren2016-02-241-1/+7
| | | | | | | | | | | This is mainly for extensibility. Note that fragile category metadata, metadata for classes and protocols all have a size field. Initial patch was provided by Greg Parker. rdar://problem/24804226 llvm-svn: 261756
* [WinEH] Make sure terminate handlers have funclet operandsDavid Majnemer2016-02-242-11/+16
| | | | | | | Calls to the terminate handler must be annotated within the exception region they are within. llvm-svn: 261751
* Default vaarg lowering should support indirect struct types.James Y Knight2016-02-243-20/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes PR11517 for SPARC. On most targets, clang lowers va_arg itself, eschewing the use of the llvm vaarg instruction. This is necessary (at least for now) as the type argument to the vaarg instruction cannot represent all the ABI information that is needed to support complex calling conventions. However, on targets with a simpler varrags ABIs, the LLVM instruction can work just fine, and clang can simply lower to it. Unfortunately, even on such targets, vaarg with a struct argument would fail, because the default lowering to vaarg was naive: it didn't take into account the ABI attribute computed by classifyArgumentType. In particular, for the DefaultABIInfo, structs are supposed to be passed indirectly and so llvm's vaarg instruction should be emitted with a pointer argument. Now, vaarg instruction emission is able to use computed ABIArgInfo for the provided argument type, which allows the default ABI support to work for structs too. I haven't touched the EmitVAArg implementation for PPC32_SVR4 or XCore, although I believe both are now redundant, and could be switched over to use the default implementation as well. Differential Revision: http://reviews.llvm.org/D16154 llvm-svn: 261717
* Reapply r261657.Adrian Prantl2016-02-231-11/+9
| | | | | | | | | | | | | | | | | | | | | | Remove an unnecessary workaround introduced in r259975. (NFC) Now that LLVM r259973 allows replacing a temporary type with another temporary we can rely on the original implementation. It is possible for enums to be created as part of their own declcontext. In this case a FwdDecl will be created twice. This doesn't cause a problem because both FwdDecls are entered into the ReplaceMap: finalize() will replace the first FwdDecl with the second and then replace the second with complete type. Thanks to echristo for pointing this out. # Conflicts: # lib/CodeGen/CGDebugInfo.cpp llvm-svn: 261673
* Revert r261634 "Supporting all entities declared in lexical scope in LLVM ↵Hans Wennborg2016-02-233-67/+24
| | | | | | | | debug info." and r261657 r261634 and r261633 seems to have caused PR26715. r261657 depends on the former two. llvm-svn: 261670
* Remove an unnecessary workaround introduced in r259975. (NFC)Adrian Prantl2016-02-231-12/+9
| | | | | | | | | | | | | | | | Now that LLVM r259973 allows replacing a temporary type with another temporary we can rely on the original implementation. It is possible for enums to be created as part of their own declcontext. In this case a FwdDecl will be created twice. This doesn't cause a problem because both FwdDecls are entered into the ReplaceMap: finalize() will replace the first FwdDecl with the second and then replace the second with complete type. Thanks to echristo for pointing this out. llvm-svn: 261657
* Supporting all entities declared in lexical scope in LLVM debug info.Amjad Aboud2016-02-233-14/+60
| | | | | | Differential Revision: http://reviews.llvm.org/D15977 llvm-svn: 261634
* [WebAssembly] Lower va_arg in clang.Dan Gohman2016-02-221-0/+11
| | | | | | | This uses the general emitVoidPtrVAArg lowering logic for everything, since this supports all types, and we don't have any special requirements. llvm-svn: 261557
* [MS ABI] Correctly handle dllimport'd explicit instantiation declaration w/ ↵David Majnemer2016-02-221-0/+3
| | | | | | | | | | | | | | vbases We gave a VBTable dllimport storage class and external linkage while also providing an initializer. An initializer is only valid if the VBTable has available_externally linkage. Fix this by setting the linkage to available_externally in situ while generating the initializer. This fixes PR26686. llvm-svn: 261535
* Add support for Android Vector calling convention for AArch64Nirav Dave2016-02-222-5/+9
| | | | | | | | | | | | | | | | | | | | | | | This modification applies the following Android commit when we have an Android environment. This is the sole non-renderscript in the Android repo commit 9212d4fb30a3ca2f4ee966dd2748c35573d9682c Author: Tim Murray <timmurray@google.com> Date: Fri Aug 15 16:00:15 2014 -0700 Update vector calling convention for AArch64. bug 16846318 Change-Id: I3cfd167758b4bd634d8480ee6ba6bb55d61f82a7 Reviewers: srhines, jyknight Subscribers: mcrosier, aemerson, rengolin, tberghammer, danalbert, srhines Differential Revision: http://reviews.llvm.org/D17448 llvm-svn: 261533
* Class Property: Fix a crash with old ABI when generating metadata in classes.Manman Ren2016-02-211-2/+4
| | | | | | rdar://23891898 llvm-svn: 261466
* Fix handling of vaargs on PPC32 when going from regsave to overflow.Roman Divacky2016-02-201-1/+4
| | | | | | | | | | | | It can happen that when we only have 1 more register left in the regsave area we need to store a value bigger than 1 register and therefore we go to the overflow area. In this case we have to leave the last slot in the regsave area unused and keep using overflow area. Do this by storing a limit value to the used register counter in the overflow block. Issue diagnosed by and solution tested by Mark Millard! llvm-svn: 261422
* [OpenCL] Generate metadata for opencl_unroll_hint attributeAnastasia Stulova2016-02-191-8/+29
| | | | | | | | | | | | | | | Add support for opencl_unroll_hint attribute from OpenCL v2.0 s6.11.5. Reusing most of metadata generation from CGLoopInfo helper class. The code is based on Khronos OpenCL compiler: https://github.com/KhronosGroup/SPIR/tree/spirv-1.0 Patch by Liu Yaxun (Sam)! Differential Revision: http://reviews.llvm.org/D16686 llvm-svn: 261350
* [OPENMP] Improved layout of CGOpenMPRuntime class, NFC.Alexey Bataev2016-02-192-258/+252
| | | | llvm-svn: 261315
* Remove use of builtin comma operator.Richard Trieu2016-02-182-11/+27
| | | | | | Cleanup for upcoming Clang warning -Wcomma. No functionality change intended. llvm-svn: 261271
* Avoid double deletion in Clang driver.Serge Pavlov2016-02-181-21/+8
| | | | | | | | | | | | | | | | Llvm module object is shared between CodeGenerator and BackendConsumer, in both classes it is stored as std::unique_ptr, which is not a good design solution and can cause double deletion error. Usually it does not occur because in BackendConsumer::HandleTranslationUnit the ownership of CodeGenerator over the module is taken away. If however this method is not called, the module is deleted twice and compiler crashes. As the module owned by BackendConsumer is always the same as CodeGenerator has, pointer to llvm module can be removed from BackendGenerator. Differential Revision: http://reviews.llvm.org/D15450 llvm-svn: 261222
* [OPENMP] Fix codegen for lastprivate loop counters.Alexey Bataev2016-02-181-60/+33
| | | | | | | Patch fixes bug with codegen for lastprivate loop counters. Also it may improve performance for lastprivates calculations in some cases. llvm-svn: 261209
OpenPOWER on IntegriCloud