summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* [cuda] Allow using integral non-type template parameters as launch_bounds ↵Artem Belevich2015-04-211-11/+15
| | | | | | | | | | | | | | | | attribute arguments. - Changed CUDALaunchBounds arguments from integers to Expr* so they can be saved in AST for instantiation. - Added support for template instantiation of launch_bounds attrubute. - Moved evaluation of launch_bounds arguments to NVPTXTargetCodeGenInfo:: SetTargetAttributes() where it can be done after template instantiation. - Added a warning on negative launch_bounds arguments. - Amended test cases. Differential Revision: http://reviews.llvm.org/D8985 llvm-svn: 235452
* DebugInfo: Prepare for removal of DIArray and DITypeArray typedefsDuncan P. N. Exon Smith2015-04-212-38/+44
| | | | | | | | An upcoming LLVM commit will remove the `DIArray` and `DITypeArray` typedefs that shadow `DebugNodeArray` and `MDTypeRefArray`, respectively. Use those types directly. llvm-svn: 235412
* DebugInfo: Prepare for deletion of DIDescriptor subclassesDuncan P. N. Exon Smith2015-04-212-59/+47
| | | | | | | An upcoming LLVM commit will delete all the remaining subclasses of (the already deleted) `DIDescriptor`. Stop using them. llvm-svn: 235403
* Provide alignment info on LLVM external symbolsUlrich Weigand2015-04-211-0/+2
| | | | | | | | | | | | | | | | | Code in CodeGenModule::GetOrCreateLLVMGlobal that sets up GlobalValue object for LLVM external symbols has this comment: // FIXME: This code is overly simple and should be merged with other global // handling. One part does seems to be "overly simple" currently is that this code never sets any alignment info on the GlobalValue, so that the emitted IR does not have any align attribute on external globals. This can lead to unnecessarily inefficient code generation. This patch adds a GV->setAlignment call to set alignment info. llvm-svn: 235396
* DebugInfo: Prepare for deletion of subclasses of DIScopeDuncan P. N. Exon Smith2015-04-202-128/+128
| | | | | | | | Prepare for the deletion in LLVM of the subclasses of (the already deleted) `DIScope` by using the raw pointers they were wrapping directly. llvm-svn: 235355
* DebugInfo: Prepare for deletion of subclasses of DITypeDuncan P. N. Exon Smith2015-04-202-21/+19
| | | | | | | | | | | Subclasses of (the already deleted) `DIType` will be deleted by an upcoming LLVM commit. Remove references. While `DICompositeType` wraps `MDCompositeTypeBase` and `DIDerivedType` wraps `MDDerivedTypeBase`, most uses of each really meant the more specific `MDCompositeType` and `MDDerivedType`. I updated accordingly. llvm-svn: 235350
* DebugInfo: Prepare for deletion of DITypeDuncan P. N. Exon Smith2015-04-202-242/+229
| | | | | | | `DIType` is going to be deleted by an upcoming LLVM commit, so replace uses with `MDType*`. llvm-svn: 235330
* DebugInfo: Prepare for deletion of DIScopeDuncan P. N. Exon Smith2015-04-202-14/+12
| | | | | | | An upcoming LLVM commit will delete `DIScope`, so update users to `MDScope*`. llvm-svn: 235326
* Make helper function static. NFC.Benjamin Kramer2015-04-181-3/+3
| | | | llvm-svn: 235253
* Remove dead code, NFCDuncan P. N. Exon Smith2015-04-181-3/+0
| | | | llvm-svn: 235246
* DebugInfo: Prepare for deletion of DIDescriptorDuncan P. N. Exon Smith2015-04-182-23/+14
| | | | | | Prepare for upcoming LLVM change to delete `DIDescriptor`. llvm-svn: 235245
* Change AArch64 i128 returns to use [2 x i64] when possible.Pete Cooper2015-04-171-0/+8
| | | | | | | | | | Something like { void*, void * } would be passed to a function as a [2 x i64], but returned as an i128. This patch unifies the 2 behaviours so that we also return it as a [2 x i64]. This is better for the quality of the IR, and the size of the final LLVM binary as we tend to want to insert/extract values from these types and do so with the insert/extract instructions is less IR than shifting, truncating, and or'ing values. Reviewed by Tim Northover. llvm-svn: 235231
* [MS ABI] Use the right types for filter and finally blocksDavid Majnemer2015-04-171-4/+6
| | | | | | | The type for abnormal_termination can't be an i1, it an i8. Filter functions return 'LONG', not 'int'. llvm-svn: 235161
* DebugInfo: Update for LLVM API change in DIBuilder (r235111)Duncan P. N. Exon Smith2015-04-162-113/+96
| | | | | | | | | | | | | | | | | LLVM r235111 changed the `DIBuilder` API to stop using `DIDescriptor` and its subclasses. Rolled into this was some tightening up of types: - Scopes: `DIDescriptor` => `MDScope*`. - Generic debug nodes: `DIDescriptor` => `DebugNode*`. - Subroutine types: `DICompositeType` => `MDSubroutineType*`. - Composite types: `DICompositeType` => `MDCompositeType*`. Note that `DIDescriptor` wraps `MDNode`, and `DICompositeType` wraps `MDCompositeTypeBase`. It's this new type strictness that requires changes here. llvm-svn: 235112
* [OPENMP] Codegen for 'copyin' clause in 'parallel' directive.Alexey Bataev2015-04-162-2/+74
| | | | | | | | | | | | | | | Emits the following code for the clause at the beginning of the outlined function for implicit threads: if (<not a master thread>) { ... <thread local copy of var> = <master thread local copy of var>; ... } <sync point>; Checking for a non-master thread is performed by comparing of the address of the thread local variable with the address of the master's variable. Master thread always uses original variables, so you always know the address of the variable in the master thread. Differential Revision: http://reviews.llvm.org/D9026 llvm-svn: 235075
* [OPENMP] Codegen for 'lastprivate' clause in 'for' directive.Alexey Bataev2015-04-162-5/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | #pragma omp for lastprivate(<var>) for (i = a; i < b; ++b) <BODY>; This construct is translated into something like: <last_iter> = alloca i32 <lastprivate_var> = alloca <type> <last_iter> = 0 ; No initializer for simple variables or a default constructor is called for objects. ; For arrays perform element by element initialization by the call of the default constructor. ... OMP_FOR_START(...,<last_iter>, ..); sets <last_iter> to 1 if this is the last iteration. <BODY> ... OMP_FOR_END if (<last_iter> != 0) { <var> = <lastprivate_var> ; Update original variable with the lastprivate value. } call __kmpc_cancel_barrier() ; an implicit barrier to avoid possible data race. Differential Revision: http://reviews.llvm.org/D8658 llvm-svn: 235074
* DebugInfo: Prepare for DIDescriptor to be gutted in LLVMDuncan P. N. Exon Smith2015-04-161-28/+28
| | | | | | | All the API is about to be dropped from `DIDescriptor` in LLVM, so stop using it. llvm-svn: 235068
* DebugInfo: Prepare for DIScope to be gutted in LLVMDuncan P. N. Exon Smith2015-04-161-2/+2
| | | | | | | An upcoming LLVM commit will gut `DIScope`, so just use `MDScope*` directly. llvm-svn: 235066
* DebugInfo: Prepare for DIType to be guttedDuncan P. N. Exon Smith2015-04-161-17/+14
| | | | | | | `DIType` and its subclasses are about to be gutted in LLVM. Prepare for that by treating these like the raw pointers they wrap. llvm-svn: 235063
* DebugInfo: Prepare for LLVM change removing DIType::isValid()Duncan P. N. Exon Smith2015-04-151-3/+3
| | | | | | This is being replaced with a null check. llvm-svn: 235058
* DebugInfo: Prepare for LLVM gutting DICompileUnit/DIFileDuncan P. N. Exon Smith2015-04-151-9/+10
| | | | | | | An upcoming LLVM commit will gut `DICompileUnit` and `DIFile`, so start treating them more like pointers. llvm-svn: 235054
* Don't crash when a selectany symbol would get common linkageNico Weber2015-04-151-2/+7
| | | | | | | | | | | | | | | | Things can't both be in comdats and have common linkage, so never give things in comdats common linkage. Common linkage is only used in .c files, and the only thing that can trigger a comdat in c is selectany from what I can tell. Fixes PR23243. Also address an over-the-shoulder review comment from rnk by moving the hasAttr<SelectAnyAttr>() in Decl.cpp around a bit. It only makes a minor difference for selectany on global variables, so it goes well with the rest of this patch. http://reviews.llvm.org/D9042 llvm-svn: 235053
* DebugInfo: Pass DebugLocs when creating intrinsicsDuncan P. N. Exon Smith2015-04-151-24/+21
| | | | | | | Update for LLVM API change r235041 that makes `DIBuilder` require a `DebugLoc` to create a debug info intrinsic. llvm-svn: 235042
* Revert "[CodeGen] Fix crash with duplicated mangled name."Renato Golin2015-04-151-9/+8
| | | | | | | | | This reverts commit r234767, as it was breaking all ARM buildbots for two days and the assert is not in the code, making it difficult to spot the error, which would keep the bots red for a few more days. New errors were silently introduced because of this bug, and we don't want this to escalate. llvm-svn: 234983
* [OPENMP] Codegen for 'firstprivate' clause in 'for' directive.Alexey Bataev2015-04-153-60/+83
| | | | | | | | Adds proper codegen for 'firstprivate' clause in for directive. Initially codegen for 'firstprivate' clause was implemented for 'parallel' directive only. Also this patch emits sync point only after initialization of firstprivate variables, not all private variables. This sync point is not required for privates, lastprivates etc., only for initialization of firstprivate variables. Differential Revision: http://reviews.llvm.org/D8660 llvm-svn: 234978
* uselistorder: Remove dead includeDuncan P. N. Exon Smith2015-04-151-1/+0
| | | | | | Forgot to remove the include in r234970 llvm-svn: 234972
* uselistorder: -mllvm -preserve-ll-use-list-order => -emit-llvm-uselistsDuncan P. N. Exon Smith2015-04-151-1/+2
| | | | | | | | | Follow up to r234962, start respecting `-emit-llvm-uselists even for LLVM assembly. Note that the driver never passes this flag; this is just a interface convenience/consistency for those using `-cc1` directly. This required LLVM r234969 (and predecessors). llvm-svn: 234970
* Change range-based for-loops to be -Wrange-loop-analysis clean.Richard Trieu2015-04-152-2/+2
| | | | | | No functionality change. llvm-svn: 234964
* uselistorder: -mllvm -preserve-bc-use-list-order => -emit-llvm-uselistsDuncan P. N. Exon Smith2015-04-151-1/+1
| | | | | | | | | | | | | | | Stop relying on `cl::opt` to pass along the driver's decision to preserve use-lists. Create a new `-cc1` option called `-emit-llvm-uselists` that does the right thing (when -emit-llvm-bc). Note that despite its generic name, it *doesn't* do the right thing when -emit-llvm (LLVM assembly) yet. I'll hook that up soon. This doesn't really change the behaviour of the driver. The default is still to preserve use-lists for `clang -emit-llvm` and `clang -save-temps`, and nothing else. But it stops relying on global state (and also is a nicer interface for hackers using `clang -cc1`). llvm-svn: 234962
* Move the logic to avoid double global emission from Sema to CodeGenReid Kleckner2015-04-152-10/+14
| | | | | | | | | | | Reverts the code changes from r234675 but keeps the test case. We were already maintaining a DenseMap of globals with dynamic initializers anyway. Fixes the test case from PR23234. llvm-svn: 234961
* uselistorder: Update for LLVM API change in r234959Duncan P. N. Exon Smith2015-04-151-1/+3
| | | | | | | | Now that `addBitcodeWriterPass()` requires an explicit bit to preserve use-list order, send it in from `clang`. It looks like I'll be able to push this up to the `-cc1` options. llvm-svn: 234960
* Reland r234613 (and follow-ups 234614, 234616, 234618)Reid Kleckner2015-04-144-135/+168
| | | | | | | The frameescape intrinsic cannot be inlined, so I fixed the inliner in r234937. This should address PR23216. llvm-svn: 234942
* Use raw_pwrite_stream in clang.Rafael Espindola2015-04-142-14/+15
| | | | | | This is a small improvement to -emit-pth and allows llvm to start requiring it. llvm-svn: 234897
* [OPENMP] Fixed codegen for arrays in 'copyprivate' clause.Alexey Bataev2015-04-144-105/+160
| | | | | | | Fixed a bug with codegen of variables with array types specified in 'copyprivate' clause of 'single' directive. Differential Revision: http://reviews.llvm.org/D8914 llvm-svn: 234856
* [OPENMP] Initial codegen for 'parallel sections' directive.Alexey Bataev2015-04-142-26/+37
| | | | | | | | | | | | | | | Emits code for outlined 'parallel' directive with the implicitly inlined 'sections' directive: ... call __kmpc_fork_call(..., outlined_function, ...); ... define internal void outlined_function(...) { <code for implicit sections directive>; } Differential Revision: http://reviews.llvm.org/D8997 llvm-svn: 234849
* DebugInfo: Prepare for DISubprogram/DILexicalBlock* to be guttedDuncan P. N. Exon Smith2015-04-141-9/+8
| | | | | | | An upcoming LLVM commit will remove this API, so stop using it. Just access the raw pointers using `operator->()`. llvm-svn: 234848
* Revert r234613 (and follow-ups 234614, 234616, 234618), it caused PR23216.Nico Weber2015-04-134-168/+135
| | | | llvm-svn: 234789
* Revert r234786, it contained a bunch of stuff I did not mean to commit.Nico Weber2015-04-134-135/+168
| | | | llvm-svn: 234787
* Revert r234613 (and follow-ups 234614, 234616, 234618), it caused PR23216.Nico Weber2015-04-134-168/+135
| | | | llvm-svn: 234786
* [CodeGen] Fix crash with duplicated mangled name.Argyrios Kyrtzidis2015-04-131-8/+9
| | | | | | Patch by Yunzhong Gao! llvm-svn: 234767
* InstrProf: Simplify getStmtCount by using an OptionalJustin Bogner2015-04-132-16/+11
| | | | llvm-svn: 234750
* [OPENMP] Initial codegen for 'parallel for' directive.Alexey Bataev2015-04-131-3/+14
| | | | | | | Allows generation of combined 'parallel for' directive that represents 'parallel' region with internal implicit 'for' worksharing region. Differential Revision: http://reviews.llvm.org/D8631 llvm-svn: 234722
* Revert r234581, it might have caused a few miscompiles in Chromium.Nico Weber2015-04-117-100/+34
| | | | | | | If the revert helps, I'll get a repro this Monday. Else I'll put the change back in. llvm-svn: 234700
* DebugInfo: Switch from replaceAllUsesWith() to replaceTemporary()Duncan P. N. Exon Smith2015-04-111-8/+8
| | | | | | | | Stop using `DIDescriptor`'s wrapper around `MDNode::replaceAllUsesWith()` (which is going away). The new home for this logic is `DIBuilder::replaceTemporary()`, added in LLVM r234695. llvm-svn: 234696
* Remove empty non-virtual destructors or mark them =default when non-publicBenjamin Kramer2015-04-111-3/+0
| | | | | | These add no value but can make a class non-trivially copyable. NFC. llvm-svn: 234689
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-113-19/+17
| | | | | | | | | | | | | | | | | | | | Summary: The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
* [Driver] Properly support -mglobal-merge using explicit options.Ahmed Bougacha2015-04-111-2/+0
| | | | | | | | Follow-up to r234666. With this, the -m[no-]global-merge options have the expected behavior. Previously, -mglobal-merge was ignored, and there was no way of enabling the optimization. llvm-svn: 234668
* [SEH] Re-land r234532, but use internal linkage for all SEH helpersReid Kleckner2015-04-104-135/+168
| | | | | | | | | | Even though these symbols are in a comdat group, the Microsoft linker really wants them to have internal linkage. I'm planning to tweak the mangling in a follow-up change. This is a straight revert with a 1-line fix. llvm-svn: 234613
* Don't rely on implicit CallSite construction.Benjamin Kramer2015-04-101-1/+1
| | | | llvm-svn: 234600
* [OPENMP] Codegen for 'reduction' clause in 'parallel' directive.Alexey Bataev2015-04-104-131/+592
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Emit a code for reduction clause. Next code should be emitted for reductions: static kmp_critical_name lock = { 0 }; void reduce_func(void *lhs[<n>], void *rhs[<n>]) { ... *(Type<i> *)lhs[i] = RedOp<i>(*(Type<i> *)lhs[i], *(Type<i> *)rhs[i]); ... } ... void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n> - 1]}; switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) { case 1: ... <LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]); ... __kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>); break; case 2: ... Atomic(<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i])); ... break; default: ; } Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation. Differential Revision: http://reviews.llvm.org/D8915 llvm-svn: 234583
OpenPOWER on IntegriCloud