summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r245257 "Generating assumption loads of vptr after ctor call"Hans Wennborg2015-08-181-28/+13
| | | | | | It caused PR24479 llvm-svn: 245260
* Generating assumption loads of vptr after ctor callPiotr Padlewski2015-08-171-13/+28
| | | | | | | | | | | | Generating call assume(icmp %vtable, %global_vtable) after constructor call for devirtualization purposes. For more info go to: http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html http://reviews.llvm.org/D11859 llvm-svn: 245257
* Propagate SourceLocations through to get a Loc on float_cast_overflowFilipe Cabecinhas2015-08-111-3/+3
| | | | | | | | | | | | | | | Summary: float_cast_overflow is the only UBSan check without a source location attached. This patch propagates SourceLocations where necessary to get them to the EmitCheck() call. Reviewers: rsmith, ABataev, rjmccall Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11757 llvm-svn: 244568
* Don't repeat function names in comments. NFC.Filipe Cabecinhas2015-08-051-5/+4
| | | | llvm-svn: 244018
* [MS ABI] Hook clang up to the new EH instructionsDavid Majnemer2015-07-311-0/+1
| | | | | | | | | | The new EH instructions make it possible for LLVM to generate .xdata tables that the MSVC personality routines will be happy about. Because this is experimental, hide it behind a -cc1 flag (-fnew-ms-eh). Differential Revision: http://reviews.llvm.org/D11405 llvm-svn: 243767
* Use CGLoopInfo to emit metadata for loop hint pragmas.Tyler Nowicki2015-07-271-2/+0
| | | | | | | | When ‘#pragma clang loop vectorize(assume_safety)’ was specified on a loop other loop hints were lost. The problem is that CGLoopInfo attaches metadata differently than EmitCondBrHints in CGStmt. For do-loops CGLoopInfo attaches metadata to the br in the body block and for while and for loops, the inc block. EmitCondBrHints on the other hand always attaches data to the br in the cond block. When specifying assume_safety CGLoopInfo emits an empty llvm.loop metadata shadowing the metadata in the cond block. Loop transformations like rotate and unswitch would then eliminate the cond block and its non-empty metadata. This patch unifies both approaches for adding metadata and modifies the existing safety tests to include non-assume_safety loop hints. llvm-svn: 243315
* Fix GCC build due to shadowingDavid Blaikie2015-07-211-2/+2
| | | | llvm-svn: 242826
* Pass an iterator range to EmitCallArgsDavid Blaikie2015-07-211-12/+10
| | | | llvm-svn: 242824
* Commit for http://reviews.llvm.org/D10765Michael Wong2015-07-211-0/+1
| | | | | | | for OpenMP 4 target data directive parsing and sema. This commit is on behalf of Kelvin Li. llvm-svn: 242785
* [AST] Cleanup ExprIterator.Benjamin Kramer2015-07-181-1/+1
| | | | | | | | - Make it a proper random access iterator with a little help from iterator_adaptor_base - Clean up users of magic dereferencing. The iterator should behave like an Expr **. - Make it an implementation detail of Stmt. This allows inlining of the assertions. llvm-svn: 242608
* Set the linkage before setting the visibility.Rafael Espindola2015-07-131-2/+2
| | | | | | | | | Otherwise the visibility setting code would not know that a given function was available_externally. Fixes PR24097. llvm-svn: 242012
* Update clang for intrinsic rename of framerecover to localrecoverReid Kleckner2015-07-071-3/+3
| | | | llvm-svn: 241634
* Silence -Wparentheses warnings (and ran it through clang-format); NFC.Aaron Ballman2015-07-071-9/+10
| | | | llvm-svn: 241582
* Substitute type arguments into uses of Objective-C interface members.Douglas Gregor2015-07-071-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When messaging a method that was defined in an Objective-C class (or category or extension thereof) that has type parameters, substitute the type arguments for those type parameters. Similarly, substitute into property accesses, instance variables, and other references. This includes general infrastructure for substituting the type arguments associated with an ObjCObject(Pointer)Type into a type referenced within a particular context, handling all of the substitutions required to deal with (e.g.) inheritance involving parameterized classes. In cases where no type arguments are available (e.g., because we're messaging via some unspecialized type, id, etc.), we substitute in the type bounds for the type parameters instead. Example: @interface NSSet<T : id<NSCopying>> : NSObject <NSCopying> - (T)firstObject; @end void f(NSSet<NSString *> *stringSet, NSSet *anySet) { [stringSet firstObject]; // produces NSString* [anySet firstObject]; // produces id<NSCopying> (the bound) } When substituting for the type parameters given an unspecialized context (i.e., no specific type arguments were given), substituting the type bounds unconditionally produces type signatures that are too strong compared to the pre-generics signatures. Instead, use the following rule: - In covariant positions, such as method return types, replace type parameters with “id” or “Class” (the latter only when the type parameter bound is “Class” or qualified class, e.g, “Class<NSCopying>”) - In other positions (e.g., parameter types), replace type parameters with their type bounds. - When a specialized Objective-C object or object pointer type contains a type parameter in its type arguments (e.g., NSArray<T>*, but not NSArray<NSString *> *), replace the entire object/object pointer type with its unspecialized version (e.g., NSArray *). llvm-svn: 241543
* Revert "Revert 241171, 241187, 241199 (32-bit SEH)."Reid Kleckner2015-07-071-8/+20
| | | | | | | | | | | This reverts commit r241244, but restricts SEH support to Win64. This way, Chromium builds will still fall back on TUs with SEH, and Clang developers can work on this incrementally upstream while patching this small predicate locally. It'll also make it easier to review small fixes. llvm-svn: 241533
* [OPENMP 4.0] Fixed codegen for 'cancellation point' construct.Alexey Bataev2015-07-031-0/+2
| | | | | | | | | | Generate the next code for 'cancellation point': if (__kmpc_cancellationpoint()) { __kmpc_cancel_barrier(); <exit construct>; } llvm-svn: 241336
* Attach attribute "trap-func-name" to call sites of llvm.trap and llvm.debugtrap.Akira Hatanaka2015-07-021-0/+4
| | | | | | | | | | | This is needed to use clang's command line option "-ftrap-function" for LTO and enable changing the trap function name on a per-call-site basis. rdar://problem/21225723 Differential Revision: http://reviews.llvm.org/D10831 llvm-svn: 241306
* [OPENMP 4.0] Initial support for 'omp cancel' construct.Alexey Bataev2015-07-021-0/+1
| | | | | | Implemented parsing/sema analysis + (de)serialization. llvm-svn: 241253
* Revert 241171, 241187, 241199 (32-bit SEH).Nico Weber2015-07-021-20/+8
| | | | | | | It still doesn't produce quite the right code, test binaries built with this enabled fail some tests. llvm-svn: 241244
* [OPENMP 4.0] Codegen for 'cancellation point' directive.Alexey Bataev2015-07-021-1/+3
| | | | | | | | | | 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
* [SEH] Delete the 32-bit IR lowering for __finally blocks and use x64Reid Kleckner2015-07-011-8/+0
| | | | | | | | | | | | | | | | 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
* [SEH] Add 32-bit lowering for SEH __tryReid Kleckner2015-07-011-8/+28
| | | | | | | | | | | | | | | | | | | 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
* [OPENMP 4.0] Initial support for 'omp cancellation point' construct.Alexey Bataev2015-07-011-0/+2
| | | | | | Add parsing and sema analysis for 'omp cancellation point' directive. llvm-svn: 241145
* 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 use-after-free.Peter Collingbourne2015-06-301-2/+3
| | | | llvm-svn: 241121
* [CUDA] Implemented __nvvm_atom_*_gen_* builtins.Artem Belevich2015-06-251-0/+1
| | | | | | | | | | | 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
* Proper changing/restoring for CapturedStmtInfo, NFC.Alexey Bataev2015-06-241-0/+14
| | | | | | Added special RAII class for proper values changing/restoring in CodeGenFunction::CapturedStmtInfo. llvm-svn: 240517
* AMDGPU: Fix places missed in renameMatt Arsenault2015-06-191-1/+1
| | | | llvm-svn: 240148
* Implement diagnostic mode for -fsanitize=cfi*, -fsanitize=cfi-diag.Peter Collingbourne2015-06-191-3/+13
| | | | | | | | | | | | | | | | | This causes programs compiled with this flag to print a diagnostic when a control flow integrity check fails instead of aborting. Diagnostics are printed using UBSan's runtime library. The main motivation of this feature over -fsanitize=vptr is fidelity with the -fsanitize=cfi implementation: the diagnostics are printed under exactly the same conditions as those which would cause -fsanitize=cfi to abort the program. This means that the same restrictions apply regarding compiling all translation units with -fsanitize=cfi, cross-DSO virtual calls are forbidden, etc. Differential Revision: http://reviews.llvm.org/D10268 llvm-svn: 240109
* [OPENMP] Support for '#pragma omp taskgroup' directive.Alexey Bataev2015-06-181-0/+1
| | | | | | | | | | | | | Added parsing, sema analysis and codegen for '#pragma omp taskgroup' directive (OpenMP 4.0). The code for directive is generated the following way: #pragma omp taskgroup <body> void __kmpc_taskgroup(<loc>, thread_id); <body> void __kmpc_end_taskgroup(<loc>, thread_id); llvm-svn: 240011
* [OPENMP] Add support for 'omp parallel for' directive.Alexey Bataev2015-06-181-0/+5
| | | | | | Codegen for this directive is a combined codegen for 'omp parallel' region with 'omp for simd' region inside. Clauses are supported. llvm-svn: 240006
* [OPENMP] Add support for 'omp for simd' directive.Alexey Bataev2015-06-181-1/+3
| | | | | | Added codegen for combined 'omp for simd' directives, that is a combination of 'omp for' directive followed by 'omp simd' directive. Includes support for all clauses. llvm-svn: 239990
* [OPENMP] Code reformatting for omp simd codegen, NFC.Alexey Bataev2015-06-171-1/+0
| | | | llvm-svn: 239889
* [OPENMP] Support lastprivate clause in omp simd directive.Alexey Bataev2015-06-161-2/+2
| | | | | | Added codegen for lastprivate clauses within simd loop-based directives. llvm-svn: 239813
* [OPENMP] Remove last iteration separation for loop-based constructs.Alexey Bataev2015-06-161-2/+1
| | | | | | Previously the last iteration for simd loop-based OpenMP constructs were generated as a separate code. This feature is not required and codegen is simplified. llvm-svn: 239810
* Revert "Re-land r236052, "[SEH] Add 32-bit lowering code for __try""Reid Kleckner2015-06-091-17/+3
| | | | | | | This reverts commit r239415. This was committed accidentally, LLVM isn't ready for this. llvm-svn: 239417
* Re-land r236052, "[SEH] Add 32-bit lowering code for __try"Reid Kleckner2015-06-091-3/+17
| | | | | | | | This reverts r236167. LLVM should be ready for this now. llvm-svn: 239415
* ubsan: Check for null pointers given to certain builtins, suchNuno Lopes2015-05-301-0/+5
| | | | | | | | | | as memcpy, memset, memmove, and bzero. Reviewed by: Richard Smith Differential Revision: http://reviews.llvm.org/D9673 llvm-svn: 238657
* wip: Remove some unused functionsJustin Bogner2015-05-291-7/+0
| | | | llvm-svn: 238538
* [OPENMP] Fix codegen for ordered loop directives.Alexey Bataev2015-05-201-3/+3
| | | | | | loops with ordered clause must be generated the same way as dynamic loops, but with static scheduleing. llvm-svn: 237788
* [OPENMP] Fixed bug in atomic update/capture/write constructs.Alexey Bataev2015-05-151-1/+1
| | | | | | Fixed a bug with codegen for destination atomic l-value with padding and junk in this padding bytes. llvm-svn: 237422
* Unify sanitizer kind representation between the driver and the rest of the ↵Peter Collingbourne2015-05-111-1/+1
| | | | | | | | | | compiler. No functional change. Differential Revision: http://reviews.llvm.org/D9618 llvm-svn: 237055
* InstrProf: Cede ownership of createProfileWeights to CGFJustin Bogner2015-05-021-0/+6
| | | | | | | | The fact that PGO has a say in how these branch weights are determined isn't interesting to most of CodeGen, so it makes more sense for this API to be accessible via CodeGenFunction rather than CodeGenPGO. llvm-svn: 236380
* Revert most of r236271, leaving only the datalayout change in ↵Reid Kleckner2015-04-301-17/+3
| | | | | | lib/Basic/Targets.cpp llvm-svn: 236274
* Use 4 byte preferred aggregate alignment in datalayout on x86 Win32Reid Kleckner2015-04-301-3/+17
| | | | llvm-svn: 236271
* Revert r236128, LLVM isn't falling back in the right wayReid Kleckner2015-04-291-17/+3
| | | | llvm-svn: 236167
* Re-land r236052, the linker errors were fixed by LLVM r236123Reid Kleckner2015-04-291-3/+17
| | | | | | | Basic __finally blocks don't cause linker errors anymore (although they are miscompiled). llvm-svn: 236128
* Revert r236052, it caused linker errors when building 32-bit applications.Nico Weber2015-04-291-17/+3
| | | | llvm-svn: 236082
* [SEH] Add 32-bit lowering code for __tryReid Kleckner2015-04-281-3/+17
| | | | | | | | | | | | | | | | | | | | This is just the clang-side of 32-bit SEH. LLVM still needs work, and it will determinstically fail to compile until it's feature complete. On x86, all outlined handlers have no parameters, but they do implicitly take the EBP value passed in and use it to address locals of the parent frame. We model this with llvm.frameaddress(1). This works (mostly), but __finally block inlining can break it. For now, we apply the 'noinline' attribute. If we really want to inline __finally blocks on 32-bit x86, we should teach the inliner how to untangle frameescape and framerecover. Promote the error diagnostic from codegen to sema. It now rejects SEH on non-Windows platforms. LLVM doesn't implement SEH on non-x86 Windows platforms, but there's nothing preventing it. llvm-svn: 236052
* InstrProf: Stop using RegionCounter outside of CodeGenPGO (NFC)Justin Bogner2015-04-231-7/+27
| | | | | | | | | The RegionCounter type does a lot of legwork, but most of it is only meaningful within the implementation of CodeGenPGO. The uses elsewhere in CodeGen generally just want to increment or read counters, so do that directly. llvm-svn: 235664
OpenPOWER on IntegriCloud