summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [OpenMP] Codegen for use_device_ptr clause.Samuel Antao2016-07-284-144/+425
| | | | | | | | | | | | Summary: This patch adds support for the use_device_ptr clause. It includes changes in SEMA that could not be tested without codegen, namely, the use of the first private logic and mappable expressions support. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: https://reviews.llvm.org/D22691 llvm-svn: 276977
* [OpenMP] Add support to map member expressions with references to pointers.Samuel Antao2016-07-271-3/+23
| | | | | | | | | | | | Summary: This patch add support to map pointers through references in class members. Although a reference does not have storage that a user can access, it still has to be mapped in order to get the deep copy right and the dereferencing code work properly. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: https://reviews.llvm.org/D22787 llvm-svn: 276934
* [OpenMP] Add support for mapping array sections through pointer references.Samuel Antao2016-07-272-9/+17
| | | | | | | | | | | | | | | Summary: This patch fixes a bug in the map of array sections whose base is a reference to a pointer. The existing mapping support was not prepared to deal with it, causing the compiler to crash. Mapping a reference to a pointer enjoys the same characteristics of a regular pointer, i.e., it is passed by value. Therefore, the reference has to be materialized in the target region. Reviewers: hfinkel, carlo.bertolli, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: https://reviews.llvm.org/D22690 llvm-svn: 276933
* [CUDA] Align kernel launch args correctly when the LLVM type's alignment is ↵Justin Lebar2016-07-272-25/+22
| | | | | | | | | | | | | | | | | | | | | | | different from the clang type's alignment. Summary: Before this patch, we computed the offsets in memory of args passed to GPU kernel functions by throwing all of the args into an LLVM struct. clang emits packed llvm structs basically whenever it feels like it, and packed structs have alignment 1. So we cannot rely on the llvm type's alignment matching the C++ type's alignment. This patch fixes our codegen so we always respect the clang types' alignments. Reviewers: rnk Subscribers: cfe-commits, tra Differential Revision: https://reviews.llvm.org/D22879 llvm-svn: 276927
* Don't crash when generating code for __attribute__((naked)) member functions.Justin Lebar2016-07-272-0/+8
| | | | | | | | | | | | | | 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
* Add flags to toggle preservation of assembly commentsNirav Dave2016-07-271-0/+1
| | | | | | | | | | | | Summary: Add -fpreserve-as-comments and -fno-preserve-as-comments. Reviewers: echristo, rnk Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D22883 llvm-svn: 276907
* Adjust coercion of aggregates on RenderScriptPirama Arumuga Nainar2016-07-271-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In RenderScript, the size of the argument or return value emitted in the IR is expected to be the same as the size of corresponding qualified type. For ARM and AArch64, the coercion performed by Clang can change the parameter or return value to a type whose size is different (usually larger) than the original aggregate type. Specifically, this can happen in the following cases: - Aggregate parameters of size <= 64 bytes and return values smaller than 4 bytes on ARM - Aggregate parameters and return values smaller than bytes on AArch64 This patch coerces the cases above to an integer array that is the same size and alignment as the original aggregate. A new field is added to TargetInfo to detect a RenderScript target and limit this coercion just to that case. Tests added to test/CodeGen/renderscript.c Reviewers: rsmith Subscribers: aemerson, srhines, llvm-commits Differential Revision: https://reviews.llvm.org/D22822 llvm-svn: 276904
* [Coverage] Do not write out coverage mappings with zero entriesVedant Kumar2016-07-261-0/+11
| | | | | | | | | | | | | After r275121, we stopped mapping regions from system headers. Lambdas declared in regions belonging to system headers started producing empty coverage mappings, since the files corresponding to their spelling locs were being ignored. The coverage reader doesn't know what to do with these empty mappings. This commit makes sure that we don't produce them and adds a test. I'll make the reader stricter in a follow-up commit. llvm-svn: 276716
* [Profile] Use a flag to enable PGO rather than the profraw filenameXinliang David Li2016-07-231-0/+1
| | | | | | | | Patch by Jake VanAdrighem Differential Revision: http://reviews.llvm.org/D22608 llvm-svn: 276517
* P0217R3: Parsing support and framework for AST representation of C++1zRichard Smith2016-07-222-1/+5
| | | | | | | | | | | decomposition declarations. There are a couple of things in the wording that seem strange here: decomposition declarations are permitted at namespace scope (which we partially support here) and they are permitted as the declaration in a template (which we reject). llvm-svn: 276492
* [Profile] Enable profile merging with -fprofile-generat[=<dir>]Xinliang David Li2016-07-221-1/+1
| | | | | | | This patch enables raw profile merging for this option which is the new intended behavior. llvm-svn: 276484
* Clang changes for overloading invariant.start and end intrinsicsAnna Thomas2016-07-221-1/+3
| | | | | | | | | | | | | | | | | | | | This change depends on the corresponding LLVM change at: https://reviews.llvm.org/D22519 The llvm.invariant.start and llvm.invariant.end intrinsics currently support specifying invariant memory objects only in the default address space. With this LLVM change, these intrinsics are overloaded for any adddress space for memory objects and we can use these llvm invariant intrinsics in non-default address spaces. Example: llvm.invariant.start.p1i8(i64 4, i8 addrspace(1)* %ptr) This overloaded intrinsic is needed for representing final or invariant memory in managed languages. llvm-svn: 276448
* test commit. update comment grammatically. NFCAnna Thomas2016-07-221-1/+1
| | | | llvm-svn: 276425
* [X86][AVX] Added support for lowering to VBROADCASTF128/VBROADCASTI128 with ↵Simon Pilgrim2016-07-221-0/+27
| | | | | | | | | | generic IR As discussed on D22460, I've updated the vbroadcastf128 pd256/ps256 builtins to map directly to generic IR - load+splat a 128-bit vector to both lanes of a 256-bit vector. Fix for PR28657. llvm-svn: 276417
* Reverting r275115 which caused PR28634.Wolfgang Pieb2016-07-211-13/+1
| | | | | | | When empty (forwarding) basic blocks that are referenced by user labels are removed, incorrect code may be generated. llvm-svn: 276361
* [CodeGen] Fix a crash when constant folding switch statementErik Pilkington2016-07-211-0/+8
| | | | | | Differential revision: https://reviews.llvm.org/D22542 llvm-svn: 276350
* Reroll "Include unreferenced nested types in member list only for CodeView"Adrian McCarthy2016-07-212-3/+20
| | | | | | Another attempt at r276271, hopefully without breaking ModuleDebugInfo test. llvm-svn: 276317
* Revert "Include unreferenced nested types in member list only for CodeView"Adrian McCarthy2016-07-212-20/+3
| | | | | | | | | | Patch broke ModuleDebugInfo test on the build bots (but not locally). Again. svn revision: r276271 This reverts commit 9da8a1b05362bc96f2855fb32b5588b89407685d. llvm-svn: 276279
* Include unreferenced nested types in member list only for CodeViewAdrian McCarthy2016-07-212-3/+20
| | | | | | Unreferenced nested structs and classes were omitted from the debug info. In DWARF, this was intentional, to avoid bloat. But for CodeView, we want this information to be consistent with what Microsoft tools would produce and expect. llvm-svn: 276271
* [CodeGen] Handle recursion in LLVMIRGeneration Timer.Davide Italiano2016-07-211-8/+23
| | | | | | | | | | | | This can happen when emitting a local decl, which triggers loading a decl imported from an AST file, which we then hand to the AST consumer. Timer is not allowed to recurse so an assertion fire. Keep a reference counter to avoid this problem. LGTM'd by Richard Smith on IRC. Differential Revision: https://reviews.llvm.org/D20748 llvm-svn: 276242
* [OpenMP] Sema and parsing for 'target simd' pragmaKelvin Li2016-07-203-0/+15
| | | | | | | | This patch is to implement sema and parsing for 'target simd' pragma. Differential Revision: https://reviews.llvm.org/D22479 llvm-svn: 276203
* When copying an array into a lambda, destroy temporaries fromJohn McCall2016-07-201-0/+35
| | | | | | | | | the copy-constructor immediately and enter a partial array cleanup for previously-copied elements. Fixes PR28595. llvm-svn: 276180
* [OpenCL] AMDGCN target will generate images in constant address spaceYaxun Liu2016-07-203-1/+15
| | | | | | | | | | | | | Allows AMDGCN target to generate images (such as %opencl.image2d_t) in constant address space. Images will still be generated in global address space by default. Added tests to existing opencl-types.cl in test\CodeGenOpenCL. Patch by Aaron En Ye Shi. Differential Revision: https://reviews.llvm.org/D22523 llvm-svn: 276161
* [modules] Don't emit initializers for VarDecls within a module eagerly wheneverRichard Smith2016-07-201-5/+11
| | | | | | | | | | | | we first touch any part of that module. Instead, defer them until the first time that module is (transitively) imported. The initializer step for a module then recursively initializes modules that its own headers imported. For example, this avoids running the <iostream> global initializer in programs that don't actually use iostreams, but do use other parts of the standard library. llvm-svn: 276159
* [MS] Improve VPtrInfo field names and doc commentsReid Kleckner2016-07-201-16/+16
| | | | | | | | | 'ReusingBase' was a terrible name. It might actually refer to the most derived class, which is not a base. 'BaseWithVPtr' was also bad, since again, it could refer to the most derived class. It was actually the first base to introduce the vptr, so now it is 'IntroducingObject'. llvm-svn: 276120
* [OpenCL] Fixes bug of missing OCL version metadata on the AMDGCN targetYaxun Liu2016-07-191-1/+12
| | | | | | | | | | | | Added the opencl.ocl.version metadata to be emitted with amdgcn. Created a static function emitOCLVerMD which is shared between triple spir and target amdgcn. Also added new testcases to existing test file, spir_version.cl inside test/CodeGenOpenCL. Patch by Aaron En Ye Shi. Differential Revision: https://reviews.llvm.org/D22424 llvm-svn: 276010
* [OPENMP] Improved processing of 'priority' clause, NFC.Alexey Bataev2016-07-191-3/+1
| | | | | | | Removed some old comments + improved handling of 'priority' clause value during codegen after comments from Richard Smith. llvm-svn: 275945
* [Coverage] Remove '..' from filenames *after* getting an absolute pathVedant Kumar2016-07-181-1/+1
| | | | | | | | Failure to do this breaks relative paths which begin with '..'. This issue was caught by the (still nascent) coverage bot. llvm-svn: 275924
* [Coverage] Normalize '..' out of filename stringsVedant Kumar2016-07-181-8/+14
| | | | | | | | This fixes the issue of having duplicate entries for the same file in a coverage report s.t none of the entries actually displayed the correct coverage information. llvm-svn: 275913
* [NFC] Header cleanupMehdi Amini2016-07-1811-23/+5
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* CodeGen: honour dllstorage on ObjC typesSaleem Abdulrasool2016-07-172-37/+171
| | | | | | | | Add support for ObjC types to respect the DLLImport/DLLExport storage annotations. This only effects COFF output. This would allow usage with clang/C2, but not with clang/LLVM due to hard coded section names. llvm-svn: 275737
* CodeGen: whitespace, formatting cleanups, NFCSaleem Abdulrasool2016-07-171-31/+28
| | | | | | | Format some code which was oddly formatted. Use a bit of auto to make the code more legible. NFC. llvm-svn: 275736
* CodeGen: whitespace cleanup, StringRef usage in ObjC EH type constructionSaleem Abdulrasool2016-07-171-37/+28
| | | | | | | Clean up some formatting issues and use a bit more StringRef based operations instead of SmallStrings. NFC. llvm-svn: 275735
* [CodeGen] Some assorted cleanupsDavid Majnemer2016-07-171-69/+58
| | | | | | | | | | No functional change, just some cleanups: - Use auto when it is appropriate. - There were some strange static_casts which were superfluous. - Use range-based for loops when appropriate. - The dyn_cast_or_null construct was used when null was impossible. llvm-svn: 275699
* CodeGen: use StringRefs more in ObjC class generation, NFCSaleem Abdulrasool2016-07-161-27/+22
| | | | | | | | Rather than building up a number of SmallString-s in order to construct a std::string, use more StringRefs and construct the string once before use. This avoids unnecessary string constructions. NFC. llvm-svn: 275697
* CodeGen: simplify using a local variable, NFCSaleem Abdulrasool2016-07-161-36/+36
| | | | | | | | Add a couple of local variables for the class interface and the super class interface. This allows for the repeated access of the information to be cached and makes the code simpler to understand. NFC. llvm-svn: 275696
* AMDGPU: Remove legacy ldexp builtinMatt Arsenault2016-07-151-8/+0
| | | | llvm-svn: 275623
* AMDGPU: Update for rsq intrinsic changesMatt Arsenault2016-07-151-14/+12
| | | | llvm-svn: 275622
* AMDGPU: Add Clang Builtin for v_lerp_u8Wei Ding2016-07-151-0/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D22380 llvm-svn: 275577
* Frontend: Simplify ownership model for clang's output streams.Peter Collingbourne2016-07-153-112/+86
| | | | | | | | | | | | | | This changes the CompilerInstance::createOutputFile function to return a std::unique_ptr<llvm::raw_ostream>, rather than an llvm::raw_ostream implicitly owned by the CompilerInstance. This in most cases required that I move ownership of the output stream to the relevant ASTConsumer. The motivation for this change is to allow BackendConsumer to be a client of interfaces such as D20268 which take ownership of the output stream. Differential Revision: http://reviews.llvm.org/D21537 llvm-svn: 275507
* [OpenMP] Sema and parsing for 'target parallel for simd' pragmaKelvin Li2016-07-143-0/+18
| | | | | | | | This patch is to implement sema and parsing for 'target parallel for simd' pragma. Differential Revision: http://reviews.llvm.org/D22096 llvm-svn: 275365
* P0305R0: Semantic analysis and code generation for C++17 init-statement for ↵Richard Smith2016-07-141-0/+10
| | | | | | | | | | 'if' and 'switch': if (stmt; condition) { ... } Patch by Anton Bikineev! Some minor formatting and comment tweets by me. llvm-svn: 275350
* Add XRay flags to Clang. We implement two flags to control the XRay behaviour:Aaron Ballman2016-07-132-0/+24
| | | | | | | | | | | -fxray-instrument: enables XRay annotation of IR -fxray-instruction-threshold: configures the threshold for function size (looking at IR instructions), and allow LLVM to decide whether to add the nop sleds later on in the process. Also implements the related xray_always_instrument and xray_never_instrument function attributes. Patch by Dean Michael Berris. llvm-svn: 275330
* [OpenMP] Initial implementation of parse+sema for OpenMP clause ↵Carlo Bertolli2016-07-131-0/+1
| | | | | | | | 'is_device_ptr' of target http://reviews.llvm.org/D22070 llvm-svn: 275282
* [OpenMP] Initial implementation of parse+sema for clause use_device_ptr of ↵Carlo Bertolli2016-07-131-0/+1
| | | | | | | | | | | | | | 'target data' http://reviews.llvm.org/D21904 This patch is similar to the implementation of 'private' clause: it adds a list of private pointers to be used within the target data region to store the device pointers returned by the runtime. Please refer to the following document for a full description of what the runtime witll return in this case (page 10 and 11): https://github.com/clang-omp/OffloadingDesign I am happy to answer any question related to the runtime interface to help reviewing this patch. llvm-svn: 275271
* [OpenCL] Fix code generation of kernel pipe parameters.Alexey Bader2016-07-131-3/+5
| | | | | | | | | | | Improved test with user define structure pipe type case. Reviewers: Anastasia, pxli168 Subscribers: yaxunl, cfe-commits Differential revision: http://reviews.llvm.org/D21744 llvm-svn: 275259
* CodeGen: minor cleanup, NFCSaleem Abdulrasool2016-07-131-23/+9
| | | | | | | | Initialise more members in initializer lists. Invert the condition that had grown to be pretty confusing. The `_objc_empty_vtable` is only used on macOS <10.9. This simplifies the code. NFC. llvm-svn: 275241
* [MS ABI] Support throwing/catching __unaligned typesDavid Majnemer2016-07-121-7/+15
| | | | | | | | We need to mark the appropriate bits in ThrowInfo and HandlerType so that the personality routine can correctly handle qualification conversions. llvm-svn: 275154
* [Coverage] Do not map regions from system headersVedant Kumar2016-07-111-0/+8
| | | | | | | | | | | | | | | Do not assign source regions located within system headers file ID's, and do not construct counter mapping regions out of them. This makes coverage reports less cluttered and less mysterious. E.g using the "assert" macro doesn't cause assert.h to appear in reports, and it no longer shows the "assertion failed" branch as an uncovered region. It also makes coverage mapping sections a bit smaller (e.g a 1% reduction in a stage2 build of bin/llvm-as). llvm-svn: 275121
* [Coverage] Move logic to skip decl's into a helper (NFC)Vedant Kumar2016-07-112-9/+12
| | | | llvm-svn: 275120
OpenPOWER on IntegriCloud