summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [OPENMP 4.0] Codegen for 'cancellation point' directive.Alexey Bataev2015-07-024-36/+108
| | | | | | | | | | The next code is generated for this construct: ``` if (__kmpc_cancellationpoint(ident_t *loc, kmp_int32 global_tid, kmp_int32 cncl_kind) != 0) <exit from outer innermost construct>; ``` llvm-svn: 241239
* [OPENMP] Introduced type trait "__builtin_omp_required_simd_align" for ↵Alexey Bataev2015-07-024-42/+15
| | | | | | | | | default simd alignment. Adds type trait "__builtin_omp_required_simd_align" after discussions here http://reviews.llvm.org/D9894 Differential Revision: http://reviews.llvm.org/D10597 llvm-svn: 241237
* InstrProf: Pack the coverage mapping structs that we write outJustin Bogner2015-07-021-1/+1
| | | | | | | When we read this data we treat it as unaligned and packed, so we should really be explicit about that when we write it. llvm-svn: 241218
* [SEH] Update EmitCapturedLocals to match r241187Reid Kleckner2015-07-011-14/+11
| | | | | | | It was still using frameaddress(1) to get the parent FP, even though it had the value it wanted as a parameter. llvm-svn: 241199
* [SEH] Delete the 32-bit IR lowering for __finally blocks and use x64Reid Kleckner2015-07-012-65/+23
| | | | | | | | | | | | | | | | 32-bit finally funclets are intended to be called both directly from the parent function and indirectly from the EH runtime. Because we aren't contorting LLVM's X86 prologue to match MSVC's, calling the finally block directly passes in a different value of EBP than the one that the runtime provides. We need an adapter thunk to adjust EBP to the expected value. However, WinEHPrepare already has to solve this problem when cleanups are not pre-outlined, so we can go ahead and rely on it rather than duplicating work. Now we only do the llvm.x86.seh.recoverfp dance for 32-bit SEH filter functions. llvm-svn: 241187
* Revert "[DebugInfo] Fix debug info generation for function static variables, ↵David Blaikie2015-07-013-51/+7
| | | | | | | | | | typedefs, and records" Caused PR24008. This reverts commit r241154. llvm-svn: 241177
* [SEH] Add 32-bit lowering for SEH __tryReid Kleckner2015-07-013-158/+294
| | | | | | | | | | | | | | | | | | | This re-lands r236052 and adds support for __exception_code(). In 32-bit SEH, the exception code is not available in eax. It is only available in the filter function, and now we arrange to load it and store it into an escaped variable in the parent frame. As a consequence, we have to disable the "catch i8* null" optimization on 32-bit and always generate a filter function. We can re-enable the optimization if we detect an __except block that doesn't use the exception code, but this probably isn't worth optimizing. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D10852 llvm-svn: 241171
* [DebugInfo] Fix debug info generation for function static variables, ↵Michael Kuperstein2015-07-013-7/+51
| | | | | | | | | | | | | | | typedefs, and records Function static variables, typedefs and records (class, struct or union) declared inside a lexical scope were associated with the function as their parent scope, rather than the lexical scope they are defined or declared in. This fixes PR19238 Patch by: amjad.aboud@intel.com Differential Revision: http://reviews.llvm.org/D9760 llvm-svn: 241154
* [OPENMP 4.0] Initial support for 'omp cancellation point' construct.Alexey Bataev2015-07-013-0/+12
| | | | | | Add parsing and sema analysis for 'omp cancellation point' directive. llvm-svn: 241145
* CodeGen: Do not give local-linkage functions externally available linkage, ↵Peter Collingbourne2015-07-011-1/+1
| | | | | | | | | | | | | | | | even temporarily. When an internal-linkage thunk is code gen'd, CodeGenVTables::emitThunk will first be called with ForVTable=true (which incorrectly set the thunk's linkage to available_externally under the Itanium ABI) and later with ForVTable=false (which reset it to internal). Because we will always see a call with ForVTable=false, this incorrect linkage never ended up in the final IR. However, the temporary presence of this linkage caused us to give such functions a comdat as a result of code introduced in r241102. To avoid this, check that the thunk is externally visible before giving it available_externally linkage. llvm-svn: 241136
* Use a stable sort to guarantee target feature ordering in the IREric Christopher2015-07-011-0/+1
| | | | | | | in order to make testing somewhat more feasible. Has the advantage of making it easier to find target features as well. llvm-svn: 241134
* CodeGen: Resize LifetimeExtendedCleanupHeader to avoid alignment issuesJustin Bogner2015-07-011-4/+6
| | | | | | | | | | | | | The LifetimeExtendedCleanupHeader is carefully fit into 32 bytes, meaning that cleanups on the LifetimeExtendedCleanupStack are *always* allocated at a misaligned address and cause undefined behaviour. There are two ways to solve this - add padding after the header when we allocated our cleanups, or just simplify the header and let it use 64 bits in the first place. I've opted for the latter, and added a static assert to avoid the issue in the future. llvm-svn: 241133
* Fix a TODO dealing with canonicalizing attributes on functions byEric Christopher2015-07-011-9/+21
| | | | | | | | using a string map to canonicalize. Fix up a couple of testcases that needed changing since we are no longer simply appending features to the list, but all of their mask dependencies as well. llvm-svn: 241129
* Fix use-after-free.Peter Collingbourne2015-06-302-5/+9
| | | | llvm-svn: 241121
* [MS ABI] Stick constructor closures in an IR COMDAT groupDavid Majnemer2015-06-301-0/+2
| | | | | | | We no-longer stick linkonce_odr entities in COMDATs in the backend. Instead, we rely on the IR COMDAT mechanism. llvm-svn: 241117
* CodeGen: Assign an appropriate comdat to thunks.Peter Collingbourne2015-06-301-10/+8
| | | | | | | | | | | | Previously we were not assigning a comdat to thunks in the Microsoft ABI, which would have required us to emit these functions outside of a comdat. (Due to an inconsistency in how we were emitting objects, we were getting this right most of the time, but only when compiling with function sections.) This code generator change causes us to create a comdat for each thunk. Differential Revision: http://reviews.llvm.org/D10829 llvm-svn: 241102
* Use an early exit to improve readability. (NFC)Adrian Prantl2015-06-301-34/+32
| | | | llvm-svn: 241088
* Debug Info: Emit debug info for @import declarations.Adrian Prantl2015-06-303-0/+66
| | | | | | | | | This allows a module-aware debugger such as LLDB to import the currently visible modules before dropping into the expression evaluator. rdar://problem/20965932 llvm-svn: 241084
* [CodeGen] Tweak isTriviallyRecursive furtherDavid Majnemer2015-06-301-6/+1
| | | | | | | | | | | | | | | | isTriviallyRecursive is a hack used to bridge a gap between the expectations that source code assumes and the semantics that LLVM IR can provide. Specifically, asm labels on functions are treated as an explicit name for a GlobalObject in Clang but treated like an output-processing step in GCC. Tweak this hack a little further to emit calls to library functions instead of emitting an incorrect definition. The definition in question would have available_externally linkage (this is OK) but result in a call to itself which will either result in an infinite loop or stack overflow. This fixes PR23964. llvm-svn: 241043
* [MS ABI] Workaround corner-case bug in the ABI for operator deleteDavid Majnemer2015-06-301-1/+2
| | | | | | | | | | | | | | | MSVC only genreates array cookies if the class has a destructor. This is problematic when having to call T::operator delete[](void *, size_t) because the second argument's argument is impossible to synthesize correctly if the class has no destructor (because there will be no array cookie). Instead, MSVC passes the size of the class. Do the same, for compatibility, instead of crashing. This fixes PR23990. llvm-svn: 241038
* Pass HeaderSearchOptions and PreprocessorOptions into CodeGenModule.Adrian Prantl2015-06-305-24/+56
| | | | | | | In order to produce debug info for clang modules CGDebugInfo it needs access to macros passed on the command line and the isysroot. llvm-svn: 241035
* Add support for the x86 builtin __builtin_cpu_supports.Eric Christopher2015-06-291-0/+77
| | | | | | | | | | | | | | | | | | | | This matches the implementation of the gcc support for the same feature, including checking the values set up by libgcc at runtime. The structure looks like this: unsigned int __cpu_vendor; unsigned int __cpu_type; unsigned int __cpu_subtype; unsigned int __cpu_features[1]; with a set of enums to match various fields that are field out after parsing the output of the cpuid instruction. This also adds a set of errors checking for valid input (and cpu). compiler-rt support for this and the other builtins in this family (__builtin_cpu_init and __builtin_cpu_is) are forthcoming. llvm-svn: 240994
* [CodeGen] Remove atomic sugar from record types in isSafeToConvertDavid Majnemer2015-06-291-5/+7
| | | | | | | | | | We failed to see that we should have deferred the creation of a type which references a type currently under construction because of atomic sugar. This fixes PR23985. llvm-svn: 240989
* Delete unused variables.Frederic Riss2015-06-291-3/+0
| | | | llvm-svn: 240923
* [MS ABI] Unify constant and non-constant member pointer conversionDavid Majnemer2015-06-291-138/+51
| | | | | | | | | | | We had two separate paths for member pointer conversion: one which takes a constant and another which takes an arbitrary value. In the latter case, we are permitted to construct arbitrary instructions. It turns out that the bulk of the member pointer conversion is sharable if we construct an artificial IRBuilder. llvm-svn: 240921
* Add missing builtins to altivec.h for ABI compliance (vol. 1)Nemanja Ivanovic2015-06-261-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D10637 This is the first round of additions of missing builtins listed in the ABI document. More to come (this builds onto what seurer already addes). This patch adds: vector signed long long vec_abs(vector signed long long) vector double vec_abs(vector double) vector signed long long vec_add(vector signed long long, vector signed long long) vector unsigned long long vec_add(vector unsigned long long, vector unsigned long long) vector double vec_add(vector double, vector double) vector double vec_and(vector bool long long, vector double) vector double vec_and(vector double, vector bool long long) vector double vec_and(vector double, vector double) vector signed long long vec_and(vector signed long long, vector signed long long) vector double vec_andc(vector bool long long, vector double) vector double vec_andc(vector double, vector bool long long) vector double vec_andc(vector double, vector double) vector signed long long vec_andc(vector signed long long, vector signed long long) vector double vec_ceil(vector double) vector bool long long vec_cmpeq(vector double, vector double) vector bool long long vec_cmpge(vector double, vector double) vector bool long long vec_cmpge(vector signed long long, vector signed long long) vector bool long long vec_cmpge(vector unsigned long long, vector unsigned long long) vector bool long long vec_cmpgt(vector double, vector double) vector bool long long vec_cmple(vector double, vector double) vector bool long long vec_cmple(vector signed long long, vector signed long long) vector bool long long vec_cmple(vector unsigned long long, vector unsigned long long) vector bool long long vec_cmplt(vector double, vector double) vector bool long long vec_cmplt(vector signed long long, vector signed long long) vector bool long long vec_cmplt(vector unsigned long long, vector unsigned long long) llvm-svn: 240821
* [ObjC] Add NSValue support for objc_boxed_expressionsAlex Denisov2015-06-261-2/+32
| | | | | | | | | | | | | Patch extends ObjCBoxedExpr to accept records (structs and unions): typedef struct __attribute__((objc_boxable)) _Color { int r, g, b; } Color; Color color; NSValue *boxedColor = @(color); // [NSValue valueWithBytes:&color objCType:@encode(Color)]; llvm-svn: 240761
* [Sema] Commit a better fix for r240242Davide Italiano2015-06-261-4/+5
| | | | | | | | | | | Skip calls to HasTrivialDestructorBody() in the case where the destructor is never invoked. Alternatively, Richard proposed to change Sema to declare a trivial destructor for anonymous union member, which seems too wasteful. Differential Revision: http://reviews.llvm.org/D10508 llvm-svn: 240742
* [CodeGen] Restrict isTriviallyRecursive to predefined lib functions ↵David Majnemer2015-06-251-2/+7
| | | | | | | | | | | forwarding to lib functions isTriviallyRecursive is only supposed to guard functions part of the implementation. This fixes PR23953. llvm-svn: 240735
* Display profile file name when emitting a file not found diagnostic.Diego Novillo2015-06-251-2/+3
| | | | | | | | | When a profile file cannot be opened, we used to display just the error message but not the name of the profile the compiler was trying to open. This will become useful in the next set of patches that introduce GCC-compatible flags to specify profiles. llvm-svn: 240715
* [CUDA] Implemented __nvvm_atom_*_gen_* builtins.Artem Belevich2015-06-252-52/+128
| | | | | | | | | | | Integer variants are implemented as atomicrmw or cmpxchg instructions. Atomic add for floating point (__nvvm_atom_add_gen_f()) is implemented as a call to an overloaded @llvm.nvvm.atomic.load.add.f32.* LVVM intrinsic. Differential Revision: http://reviews.llvm.org/D10666 llvm-svn: 240669
* Omit 'nodebug' methods from the class description.Paul Robinson2015-06-251-1/+2
| | | | llvm-svn: 240664
* update commentDerek Schuff2015-06-241-2/+4
| | | | llvm-svn: 240601
* Relax assertion in x86_64 byval argument handling for 32-bit pointersDerek Schuff2015-06-241-1/+2
| | | | | | | | | | | | | | | | Summary: Byval argument pair formation assumes that if a type is less than 8 bytes it must be an integer and not a pointer, which is not true for x32 and NaCl. Relax the assertion and add a test for a codegen case that triggered it. Reviewers: jvoung Subscribers: jfb, cfe-commits Differential Revision: http://reviews.llvm.org/D10701 llvm-svn: 240600
* [OPENMP] Codegen for 'depend' clause (OpenMP 4.0).Alexey Bataev2015-06-243-37/+196
| | | | | | | | If task directive has associated 'depend' clause then function kmp_int32 __kmpc_omp_task_with_deps ( ident_t *loc_ref, kmp_int32 gtid, kmp_task_t * new_task, kmp_int32 ndeps, kmp_depend_info_t *dep_list,kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list) must be called instead of __kmpc_omp_task(). If this directive has associated 'if' clause then also before a call of kmpc_omp_task_begin_if0() a function void __kmpc_omp_wait_deps ( ident_t *loc_ref, kmp_int32 gtid, kmp_int32 ndeps, kmp_depend_info_t *dep_list, kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list) must be called. Array sections are not supported yet. llvm-svn: 240532
* Move the special-case check from r240462 into ARM-specific code.Bob Wilson2015-06-241-19/+53
| | | | | | | | | | | | | | | | | | | This fixes a serious bug in r240462: checking the BuiltinID for ARM::BI_MoveToCoprocessor* in EmitBuiltinExpr() ignores the fact that each target has an overlapping range of the BuiltinID values. That check can trigger for builtins from other targets, leading to very bad behavior. Part of the reason I did not implement r240462 this way to begin with is the special handling of the last argument for Neon builtins. In this change, I have factored out the check to see which builtins have that extra argument into a new HasExtraNeonArgument() function. There is still some awkwardness in having to check for those builtins in two separate places, i.e., once to see if the extra argument is present and once to generate the appropriate IR, but this seems much cleaner than my previous patch. llvm-svn: 240522
* Proper changing/restoring for CapturedStmtInfo, NFC.Alexey Bataev2015-06-243-9/+20
| | | | | | Added special RAII class for proper values changing/restoring in CodeGenFunction::CapturedStmtInfo. llvm-svn: 240517
* PR22560: Fix argument order for ARM _MoveToCoprocessor builtins.Bob Wilson2015-06-231-0/+8
| | | | | | | | | | | | | | | | The Microsoft-extension _MoveToCoprocessor and _MoveToCoprocessor2 builtins take the register value to be moved as the first argument, but the corresponding mcr and mcr2 LLVM intrinsics expect that value to be the third argument. Handle this as a special case, while still leaving those intrinsics as generic MSBuiltins. I considered the alternative of handling these in EmitARMBuiltinExpr, but that does not work well for the follow-up change that I'm going to make to improve the error handling for PR22560 -- we need the GetBuiltinType() checks for ICEArguments, and the ARM version of that code is only used for Neon intrinsics where the last argument is special and not checked in the normal way. llvm-svn: 240462
* [MS ABI] Account for the virtual inheritance quirk when manglingDavid Majnemer2015-06-231-28/+6
| | | | | | | | | | | | Virtual inheritance member pointers are always relative to the vbindex, even when the member pointer doesn't point into a virtual base. This is corrected by adjusting the non-virtual offset backwards from the vbptr back to the top of the most derived class. While we performed this adjustment when manifesting member pointers as constants or when performing conversions, we didn't perform the adjustment when mangling them. llvm-svn: 240453
* InstrProf: Fix a crash when an implicit def appears in a macroJustin Bogner2015-06-231-1/+2
| | | | llvm-svn: 240452
* [OPENMP] Initial support for 'depend' clause (4.0).Alexey Bataev2015-06-231-0/+1
| | | | | | Parsing and sema analysis (without support for array sections in arguments) for 'depend' clause (used in 'task' directive, OpenMP 4.0). llvm-svn: 240409
* Update for LLVM api change.Rafael Espindola2015-06-231-1/+4
| | | | llvm-svn: 240406
* Silence VC warning C4715: '`anonymous namespace'::getNativeVectorSizeForA ↵Yaron Keren2015-06-231-0/+1
| | | | | | | | VXABI' : not all control paths return a value. llvm-svn: 240389
* [MS ABI] Rework member pointer conversionDavid Majnemer2015-06-233-65/+271
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Member pointers in the MS ABI are made complicated due to the following: - Virtual methods in the most derived class (MDC) might live in a vftable in a virtual base. - There are four different representations of member pointer: single inheritance, multiple inheritance, virtual inheritance and the "most general" representation. - Bases might have a *more* general representation than classes which derived from them, a most surprising result. We believed that we could treat all member pointers as-if they were a degenerate case of the multiple inheritance model. This fell apart once we realized that implementing standard member pointers using this ABI requires referencing members with a non-zero vbindex. On a bright note, all but the virtual inheritance model operate rather similarly. The virtual inheritance member pointer representation awkwardly requires a virtual base adjustment in order to refer to entities in the MDC. However, the first virtual base might be quite far from the start of the virtual base. This means that we must add a negative non-virtual displacement. However, things get even more complicated. The most general representation interprets vbindex zero differently from the virtual inheritance model: it doesn't reference the vbtable at all. It turns out that this complexity can increase for quite some time: consider a derived to base conversion from the most general model to the multiple inheritance model... To manage this complexity we introduce a concept of "normalized" member pointer which allows us to treat all three models as the most general model. Then we try to figure out how to map this generalized member pointer onto the destination member pointer model. I've done my best to furnish the code with comments explaining why each adjustment is performed. This fixes PR23878. llvm-svn: 240384
* [MS ABI] Refactor member pointer generationDavid Majnemer2015-06-231-28/+75
| | | | | | | | | | | | | | | | The MS ABI has very complicated member pointers. Don't attempt to synthesize the final member pointer ab ovo usque ad mala in one go. Instead, start with a member pointer which points to the declaration in question as-if it's decl context was the target class. Then, utilize our conversion logical to convert it to the target type. This allows us to simplify how we think about member pointers because we don't need to consider non-zero nv adjustments before we even generate the member pointer. Furthermore, it gives our adjustment logic more exposure by utilizing it in a common path. llvm-svn: 240383
* [CodeGen] Rename EmitMemberPointer to EmitMemberFunctionPointerDavid Majnemer2015-06-236-11/+12
| | | | llvm-svn: 240382
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-2231-71/+71
| | | | llvm-svn: 240353
* [CodeGen] Teach X86_64ABIInfo about AVX512.Ahmed Bougacha2015-06-221-2/+9
| | | | | | | | | | | | | | | | As specified in the SysV AVX512 ABI drafts. It follows the same scheme as AVX2: Arguments of type __m512 are split into eight eightbyte chunks. The least significant one belongs to class SSE and all the others to class SSEUP. This also means we change the OpenMP SIMD default alignment on AVX512. Based on r240337. Differential Revision: http://reviews.llvm.org/D9894 llvm-svn: 240338
* [CodeGen] Use enum for AVX level in X86*TargetCodeGenInfo. NFCI.Ahmed Bougacha2015-06-221-21/+44
| | | | | | | Follow-up to r237989: expressing the AVX level as an enum makes it simple to extend it with AVX512. llvm-svn: 240337
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-2231-71/+71
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
OpenPOWER on IntegriCloud