summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* PR25910: clang allows two var definitions with the same mangled nameAndrey Bokhanko2016-01-142-32/+95
| | | | | | | | | | | Proper diagnostic and resolution of mangled names' conflicts in variables. When there is a declaration and a definition using the same name but different types, we emit what is in the definition. When there are two conflicting definitions, we issue an error. Differential Revision: http://reviews.llvm.org/D15686 llvm-svn: 257754
* CodeGen: Only emit CFI unrelated cast checks for bit casts.Peter Collingbourne2016-01-141-1/+2
| | | | | | | We were previously emitting them for no-op casts (e.g. implicit casts to const). llvm-svn: 257738
* [Bugfix] Fix ICE on constexpr vector splat.George Burgess IV2016-01-135-14/+15
| | | | | | | | | | | | | In {CG,}ExprConstant.cpp, we weren't treating vector splats properly. This patch makes us treat splats more properly. Additionally, this patch adds a new cast kind which allows a bool->int cast to result in -1 or 0, instead of 1 or 0 (for true and false, respectively), so we can sanely model OpenCL bool->int casts in the AST. Differential Revision: http://reviews.llvm.org/D14877 llvm-svn: 257559
* Don't store CGOpenMPRegionInfo::CodeGen as a reference (PR26078)Hans Wennborg2016-01-121-1/+1
| | | | | | | The referenced llvm::function_ref<void(CodeGenFunction &)> object can go away before CodeGen is used, resulting in a crash. llvm-svn: 257516
* function names start with a lower case letter ; NFCSanjay Patel2016-01-121-1/+1
| | | | llvm-svn: 257497
* Fix -Wmicrosoft-enum-value warningReid Kleckner2016-01-111-1/+1
| | | | llvm-svn: 257383
* [OpenCL] Pipe type supportXiuli Pan2016-01-097-6/+58
| | | | | | | | | | | | | | | 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
* [MS ABI] Complete and base constructor GlobalDecls must have the same nameDavid Majnemer2016-01-081-1/+14
| | | | | | | | | | | | | | | | | Clang got itself into the situation where we mangled the same constructor twice with two different constructor types. After one of the constructors were utilized, the tag used for one of the types changed from class to struct because a class template became complete. This resulted in one of the constructor types varying from the other constructor. Instead, force "base" constructor types to "complete" if the ABI doesn't have constructor variants. This will ensure that GlobalDecls for both variants will get the same mangled name. This fixes PR26029. llvm-svn: 257205
* [ThinLTO] Leverage new in-place renaming supportTeresa Johnson2016-01-082-51/+34
| | | | | | | | | | | | Due to the new in-place renaming support added in r257174, we no longer need to invoke ThinLTO global renaming from clang. It will be invoked on the module in the FunctionImport pass (by an immediately following llvm commit). As a result, we don't need to load the FunctionInfoIndex as early, so that is moved down into EmitAssemblyHelper::EmitAssembly. llvm-svn: 257179
* [PGO] Simplify coverage mapping loweringXinliang David Li2016-01-073-5/+21
| | | | | | | | | | | | | | | | Coverage mapping data may reference names of functions that are skipped by FE (e.g, unused inline functions). Since those functions are skipped, normal instr-prof function lowering pass won't put those names in the right section, so special handling is needed to walk through coverage mapping structure and recollect the references. With this patch, only names that are skipped are processed. This simplifies the lowering code and it no longer needs to make assumptions coverage mapping data layout. It should also be more efficient. llvm-svn: 257092
* Module debugging: Defer emitting tag types until their definitionAdrian Prantl2016-01-061-3/+16
| | | | | | | | | was visited and all decls have been merged. We only get a single chance to emit the types for virtual classes because CGDebugInfo::completeRequiredType() categorically doesn't complete them. llvm-svn: 256962
* Fix -Wdocumentation warning after r256933Nico Weber2016-01-061-1/+1
| | | | llvm-svn: 256960
* [Driver] Add support for -fno-builtin-foo options.Chad Rosier2016-01-065-12/+21
| | | | | | | Addresses PR4941 and rdar://6756912. http://reviews.llvm.org/D15195 llvm-svn: 256937
* [OpenMP] Reapply rL256842: [OpenMP] Offloading descriptor registration and ↵Samuel Antao2016-01-064-41/+986
| | | | | | | | | | | | device codegen. This patch attempts to fix the regressions identified when the patch was committed initially. Thanks to Michael Liao for identifying the fix in the offloading metadata generation related with side effects in evaluation of function arguments. llvm-svn: 256933
* [OpenMP] Revert rL256842: [OpenMP] Offloading descriptor registration and ↵Samuel Antao2016-01-054-987/+41
| | | | | | | | device codegen. It was causing two regression, so I'm reverting until the cause is found. llvm-svn: 256858
* [OpenMP] Offloading descriptor registration and device codegen.Samuel Antao2016-01-054-41/+987
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In order to offloading work properly two things need to be in place: - a descriptor with all the offloading information (device entry functions, and global variable) has to be created by the host and registered in the OpenMP offloading runtime library. - all the device functions need to be emitted for the device and a convention has to be in place so that the runtime library can easily map the host ID of an entry point with the actual function in the device. This patch adds support for these two things. However, only entry functions are being registered given that 'declare target' directive is not yet implemented. About offloading descriptor: The details of the descriptor are explained with more detail in http://goo.gl/L1rnKJ. Basically the descriptor will have fields that specify the number of devices, the pointers to where the device images begin and end (that will be defined by the linker), and also pointers to a the begin and end of table whose entries contain information about a specific entry point. Each entry has the type: ``` struct __tgt_offload_entry{ void *addr; char *name; int64_t size; }; ``` and will be implemented in a pre determined (ELF) section `.omp_offloading.entries` with 1-byte alignment, so that when all the objects are linked, the table is in that section with no padding in between entries (will be like a C array). The code generation ensures that all `__tgt_offload_entry` entries are emitted in the same order for both host and device so that the runtime can have the corresponding entries in both host and device in same index of the table, and efficiently implement the mapping. The resulting descriptor is registered/unregistered with the runtime library using the calls `__tgt_register_lib` and `__tgt_unregister_lib`. The registration is implemented in a high priority global initializer so that the registration happens always before any initializer (that can potentially include target regions) is run. The driver flag -omptargets= was created to specify a comma separated list of devices the user wants to support so that the new functionality can be exercised. Each device is specified with its triple. About target codegen: The target codegen is pretty much straightforward as it reuses completely the logic of the host version for the same target region. The tricky part is to identify the meaningful target regions in the device side. Unlike other programming models, like CUDA, there are no already outlined functions with attributes that mark what should be emitted or not. So, the information on what to emit is passed in the form of metadata in host bc file. This requires a new option to pass the host bc to the device frontend. Then everything is similar to what happens in CUDA: the global declarations emission is intercepted to check to see if it is an "interesting" declaration. The difference is that instead of checking an attribute, the metadata information in checked. Right now, there is only a form of metadata to pass information about the device entry points (target regions). A class `OffloadEntriesInfoManagerTy` was created to manage all the information and queries related with the metadata. The metadata looks like this: ``` !omp_offload.info = !{!0, !1, !2, !3, !4, !5, !6} !0 = !{i32 0, i32 52, i32 77426347, !"_ZN2S12r1Ei", i32 479, i32 13, i32 4} !1 = !{i32 0, i32 52, i32 77426347, !"_ZL7fstatici", i32 461, i32 11, i32 5} !2 = !{i32 0, i32 52, i32 77426347, !"_Z9ftemplateIiET_i", i32 444, i32 11, i32 6} !3 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 99, i32 11, i32 0} !4 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 272, i32 11, i32 3} !5 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 127, i32 11, i32 1} !6 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 159, i32 11, i32 2} ``` The fields in each metadata entry are (in sequence): Entry 1) an ID of the type of metadata - right now only zero is used meaning "OpenMP target region". Entry 2) a unique ID of the device where the input source file that contain the target region lives. Entry 3) a unique ID of the file where the input source file that contain the target region lives. Entry 4) a mangled name of the function that encloses the target region. Entries 5) and 6) line and column number where the target region was found. Entry 7) is the order the entry was emitted. Entry 2) and 3) are required to distinguish files that have the same function name. Entry 4) is required to distinguish different instances of the same declaration (usually templated ones) Entries 5) and 6) are required to distinguish the particular target region in body of the function (it is possible that a given target region is not an entry point - if clause can evaluate always to zero - and therefore we need to identify the "interesting" target regions. ) This patch replaces http://reviews.llvm.org/D12306. Reviewers: ABataev, hfinkel, tra, rjmccall, sfantao Subscribers: FBrygidyn, piotr.rak, Hahnfeld, cfe-commits Differential Revision: http://reviews.llvm.org/D12614 llvm-svn: 256842
* Remove setting of inlinehint and cold attributes based on profile dataEaswaran Raman2016-01-041-10/+0
| | | | | | | | | | | NFC. These hints are only used for inlining and the inliner now uses the same criteria to identify hot and cold callees and set appropriate thresholds without relying on these hints. Hence this removed code is superfluous. Differential Revision: http://reviews.llvm.org/D15726 llvm-svn: 256793
* Use std::is_sorted instead of a manual loop. NFCCraig Topper2016-01-031-5/+1
| | | | llvm-svn: 256717
* [PGO] Cleanup: Use covmap header definition in the template fileXinliang David Li2016-01-031-14/+20
| | | | | | | | | | | | | | This is one last remaining instrumentatation related structure that needs to be migrate to use the centralized template definition. With this change, instrumentation code related to coverage module header will be kept in sync with the coverage mapping reader. The remaining code which makes implicit assumption about covmap control structure layout in the the lowering pass will cleaned up in a different patch. This patch is not intended to have no functional change. llvm-svn: 256714
* [OPENMP 4.5] Codegen for 'schedule' clause with monotonic/nonmonotonic ↵Alexey Bataev2015-12-312-31/+56
| | | | | | | | modifiers. OpenMP 4.5 adds support for monotonic/nonmonotonic modifiers in 'schedule' clause. Add codegen for these modifiers. llvm-svn: 256666
* Fix alignment issue in CodeGenFunction::PopCleanupBlock.James Y Knight2015-12-301-6/+18
| | | | | | | | | | | | It was copying an EHCleanupStack::Cleanup object into a SmallVector<char>, with a comment saying that SmallVector's alignment is always large enough. Unfortunately, that isn't actually true after r162331 in 2012. Expand the code (somewhat distastefully) to get a stack allocation with a correct alignment. llvm-svn: 256619
* [TrailingObjects] Convert OffsetOfExpr.James Y Knight2015-12-291-5/+5
| | | | | | That necessitated moving the OffsetOfNode class out of OffsetOfExpr. llvm-svn: 256590
* [X86] Better support for the MCU psABI (clang part)Michael Kuperstein2015-12-281-30/+65
| | | | | | | | | | | | | | | | This adds support for the MCU psABI in a way different from r251223 and r251224, basically reverting most of these two patches. The problem with the approach taken in r251223/4 is that it only handled libcalls that originated from the backend. However, the mid-end also inserts quite a few libcalls and assumes these use the platform's default calling convention. The previous patch tried to insert inregs when necessary both in the FE and, somewhat hackily, in the CG. Instead, we now define a new default calling convention for the MCU, which doesn't use inreg marking at all, similarly to what x86-64 does. Differential Revision: http://reviews.llvm.org/D15055 llvm-svn: 256495
* use auto for obvious type; NFCSanjay Patel2015-12-241-1/+1
| | | | llvm-svn: 256393
* [OPENMP 4.5] Parsing/sema for 'depend(sink:vec)' clause in 'ordered' directive.Alexey Bataev2015-12-231-0/+1
| | | | | | OpenMP 4.5 adds 'depend(sink:vec)' in 'ordered' directive for doacross loop synchronization. Patch adds parsing and semantic analysis for this clause. llvm-svn: 256330
* [OPENMP] Revert r256238 to fix the problem with tests on Linux.Alexey Bataev2015-12-221-1/+0
| | | | llvm-svn: 256239
* [OPENMP 4.5] Parsing/sema for 'depend(sink:vec)' clause in 'ordered' directive.Alexey Bataev2015-12-221-0/+1
| | | | | | OpenMP 4.5 adds 'depend(sink:vec)' in 'ordered' directive for doacross loop synchronization. Patch adds parsing and semantic analysis for this clause. llvm-svn: 256238
* [clang-cl] Add support for /BreproDavid Majnemer2015-12-211-0/+2
| | | | | | | | | | | | The /Brepro flag controls whether or not the compiler should embed timestamps into the object file. Object files which do not embed timestamps are not suitable for incremental linking but are suitable for hermetic build systems and staged self-hosts of clang. A normal clang spelling of this flag has been added, -mincremental-linker-compatible. llvm-svn: 256204
* Reapply "[CodeGen] Fix assignments of inline layouts into the byref structure"Vedant Kumar2015-12-212-0/+5
| | | | | | | | | | | | | | | | | | | When using blocks, a byref structure is created to represent the closure. The "byref.layout" field of this structure is an i8*. However, some 'inline' layouts are represented as i64's, not i8*'s. Prior to r246985 we cast the i64 'inline' layout to an i8* before assigning it into the byref structure. This patch brings the cast back and adds a regression test. The original version of this patch was too invasive. This version only adds the cast to BuildByrefLayout. Differential Revision: http://reviews.llvm.org/D15674 rdar://23713871 llvm-svn: 256190
* Revert "[CodeGen] Fix assignments of inline layouts into the byref structure"Vedant Kumar2015-12-212-5/+1
| | | | | | This reverts commit r256185. It breaks CodeGenObjC/fragile-arc.m. llvm-svn: 256186
* [CodeGen] Fix assignments of inline layouts into the byref structureVedant Kumar2015-12-212-1/+5
| | | | | | | | | | | | | | When using blocks, a byref structure is created to represent the closure. The "byref.layout" field of this structure is an i8*. However, some 'inline' layouts are represented as i64's, not i8*'s. Prior to r246985 we cast the i64 'inline' layout to an i8* before assigning it into the byref structure. This patch brings the cast back and adds a regression test. rdar://23713871 llvm-svn: 256185
* Recommit CC1 part of debugger tuning; pass through setting from driver to LLVM.Paul Robinson2015-12-191-0/+13
| | | | | | | | | Reapplies r256063, except instead of frugally re-using an LLVM enum, we define a Clang enum, to avoid exposing too much LLVM interface. Differential Revision: http://reviews.llvm.org/D15650 llvm-svn: 256078
* Revert r256063, it's killing clang-tools-extraPaul Robinson2015-12-191-1/+0
| | | | llvm-svn: 256066
* CC1 part of debugger tuning; pass through setting from driver to LLVM.Paul Robinson2015-12-181-0/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D15650 llvm-svn: 256063
* Fix an unused variable warning from r256012.Chad Rosier2015-12-181-1/+1
| | | | llvm-svn: 256023
* Add a defensive check for a nullptr.Adrian Prantl2015-12-181-5/+7
| | | | llvm-svn: 256012
* [OPENMP] Remove explicit call for implicit barrierAlexey Bataev2015-12-181-20/+0
| | | | | | | #pragma omp parallel needs an implicit barrier that is currently done by an explicit call to __kmpc_barrier. However, the runtime already ensures a barrier in __kmpc_fork_call which currently leads to two barriers per region per thread. Differential Revision: http://reviews.llvm.org/D15561 llvm-svn: 255992
* [OPENMP] Fix for http://llvm.org/PR25878: Error compiling an OpenMP programAlexey Bataev2015-12-182-6/+80
| | | | | | OpenMP codegen tried to emit the code for its constructs even if it was detected as a dead-code. Added checks to ensure that the code is emitted if the code is not dead. llvm-svn: 255990
* [OPENMP 4.5] Parsing/sema analysis for 'depend(source)' clause in 'ordered' ↵Alexey Bataev2015-12-181-0/+1
| | | | | | | | directive. OpenMP 4.5 adds 'depend(source)' clause for 'ordered' directive to support cross-iteration dependence. Patch adds parsing and semantic analysis for this construct. llvm-svn: 255986
* Attach maximum function count to Module when using PGO mode.Easwaran Raman2015-12-171-2/+5
| | | | | | | | This sets the maximum entry count among all functions in the program to the module using module flags. This allows the optimizer to use this information. Differential Revision: http://reviews.llvm.org/D15163 llvm-svn: 255918
* [CUDA] Make vtable construction aware of host/device side of CUDA compilation.Artem Belevich2015-12-171-0/+18
| | | | | | | | | | | | | | | | | | | C++ emits vtables for classes that have key function present in the current TU. While we compile CUDA the fact that key function was found in this TU does not mean that we are going to generate code for it. E.g. vtable for a class with host-only methods should not (and can not) be generated on device side, because we'll never generate code for them during device-side compilation. This patch adds an extra CUDA-specific check during key method computation and filters out potential key methods that are not suitable for this side of CUDA compilation. When we codegen vtable, entries for unsuitable methods are set to null. Differential Revision: http://reviews.llvm.org/D15309 llvm-svn: 255911
* [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
* Update for llvm api change.Rafael Espindola2015-12-161-2/+2
| | | | llvm-svn: 255843
* Fix funciton->function typo.Eric Christopher2015-12-161-1/+1
| | | | llvm-svn: 255840
* [CodeGen] Use llvm::CmpInst::Predicate instead of unsigned for parameter ↵Craig Topper2015-12-161-18/+14
| | | | | | types in EmitCompare to eliminate some later explicit casts. NFC. llvm-svn: 255753
* Print qualified display names when emitting CodeViewReid Kleckner2015-12-161-11/+20
| | | | | | This is what debuggers expect. Words towards fixing PR21528. llvm-svn: 255744
* Reland "[SEH] Use llvm.x86.seh.recoverfp for SEH filters on x64 as well as ↵Reid Kleckner2015-12-161-19/+25
| | | | | | | | 32bit" I forgot to initialize RecoverFP. llvm-svn: 255731
* Revert "[SEH] Use llvm.x86.seh.recoverfp for SEH filters on x64 as well as ↵Reid Kleckner2015-12-161-20/+15
| | | | | | | | 32bit" This reverts commit r255710. llvm-svn: 255728
* [SEH] Use llvm.x86.seh.recoverfp for SEH filters on x64 as well as 32bitReid Kleckner2015-12-151-15/+20
| | | | llvm-svn: 255710
* Cross-DSO control flow integrity (Clang part).Evgeniy Stepanov2015-12-157-47/+161
| | | | | | | | | | | | | | Clang-side cross-DSO CFI. * Adds a command line flag -f[no-]sanitize-cfi-cross-dso. * Links a runtime library when enabled. * Emits __cfi_slowpath calls is bitset test fails. * Emits extra hash-based bitsets for external CFI checks. * Sets a module flag to enable __cfi_check generation during LTO. This mode does not yet support diagnostics. llvm-svn: 255694
OpenPOWER on IntegriCloud