summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* [CMake] Fill up required libs, corresponding to r241653.NAKAMURA Takumi2015-07-081-0/+1
| | | | llvm-svn: 241660
* Revert "Revert r241620 and follow-up commits" and move the initializationAdrian Prantl2015-07-082-0/+193
| | | | | | of the llvm targets from clang/CodeGen into ClangCheck.cpp and CIndex.cpp. llvm-svn: 241653
* [SEH] Switch from frameaddress(0) to localaddressReid Kleckner2015-07-071-3/+2
| | | | | | This should do the right thing for stack realignment prologues. llvm-svn: 241644
* Revert r241620 and follow-up commits while investigating linux buildbot ↵Adrian Prantl2015-07-072-200/+0
| | | | | | failures. llvm-svn: 241642
* Cleanup: Use the C++ API to initialize the backend.Adrian Prantl2015-07-071-4/+5
| | | | llvm-svn: 241635
* Update clang for intrinsic rename of framerecover to localrecoverReid Kleckner2015-07-073-12/+12
| | | | llvm-svn: 241634
* Wrap clang modules and pch files in an object file container.Adrian Prantl2015-07-072-0/+199
| | | | | | | | | | | | | This patch adds ObjectFilePCHContainerOperations uses the LLVM backend to put the contents of a PCH into a __clangast section inside a COFF, ELF, or Mach-O object file container. This is done to facilitate module debugging by makeing it possible to store the debug info for the types defined by a module alongside the AST. rdar://problem/20091852 llvm-svn: 241620
* 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-072-18/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Parsing, semantic analysis, and AST for Objective-C type parameters.Douglas Gregor2015-07-071-0/+1
| | | | | | | | | | | | | | | | | | | | Produce type parameter declarations for Objective-C type parameters, and attach lists of type parameters to Objective-C classes, categories, forward declarations, and extensions as appropriate. Perform semantic analysis of type bounds for type parameters, both in isolation and across classes/categories/extensions to ensure consistency. Also handle (de-)serialization of Objective-C type parameter lists, along with sundry other things one must do to add a new declaration to Clang. Note that Objective-C type parameters are typedef name declarations, like typedefs and C++11 type aliases, in support of type erasure. Part of rdar://problem/6294649. llvm-svn: 241541
* Debug info: Emit distinct __block_literal_generic types for blocks withAdrian Prantl2015-07-072-7/+6
| | | | | | | | | | different function signatures. (Previously clang would emit all block pointer types with the type of the first block pointer in the compile unit.) rdar://problem/21602473 llvm-svn: 241534
* Revert "Revert 241171, 241187, 241199 (32-bit SEH)."Reid Kleckner2015-07-073-153/+244
| | | | | | | | | | | 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
* Update target attribute support for post-commit feedback.Eric Christopher2015-07-061-1/+1
| | | | | | | Use const auto rather than duplicating the type name and fix the error message when the attribute is applied to an incorrect entity. llvm-svn: 241526
* Handle arbitrary whitespace in the target attribute support.Eric Christopher2015-07-061-1/+5
| | | | | | | This allows us to deal a bit more gracefully with inclusions done by macros, token pasting, or just code layout/formatting. llvm-svn: 241525
* Debug info: Don't emit a bogus location for the global block pointer typeAdrian Prantl2015-07-061-4/+4
| | | | | | | | | | | (__block_literal_generic). The arbitrary nature of the location confuses lldb and prevents type uniquing. rdar://problem/21602473 llvm-svn: 241511
* Resubmit "Pass down the -flto option to the -cc1 job" (r239481)Teresa Johnson2015-07-061-0/+1
| | | | | | | | | | | | | | | | | | The patch is the same except for the addition of a new test for the issue that required reverting the dependent llvm commit. --Original Commit Message-- Pass down the -flto option to the -cc1 job, and from there into the CodeGenOptions and onto the PassManagerBuilder. This enables gating the new EliminateAvailableExternally module pass on whether we are preparing for LTO. If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not included as we want to preserve available externally functions for possible link time inlining. llvm-svn: 241467
* [OPENMP 4.0] Codegen for 'omp cancel' directive.Alexey Bataev2015-07-063-17/+77
| | | | | | | | | | Add the next codegen for 'omp cancel' directive: if (__kmpc_cancel()) { __kmpc_cancel_barrier(); <exit construct>; } llvm-svn: 241429
* Add missing builtins to altivec.h for ABI compliance (vol. 2)Nemanja Ivanovic2015-07-051-1/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D10875 The bulk of the second round of additions to altivec.h. The following interfaces were added: vector double vec_floor(vector double) vector double vec_madd(vector double, vector double, vector double) vector float vec_msub(vector float, vector float, vector float) vector double vec_msub(vector double, vector double, vector double) vector float vec_mul(vector float, vector float) vector double vec_mul(vector double, vector double) vector float vec_nmadd(vector float, vector float, vector float) vector double vec_nmadd(vector double, vector double, vector double) vector double vec_nmsub(vector double, vector double, vector double) vector double vec_nor(vector double, vector double) vector double vec_or(vector double, vector double) vector float vec_rint(vector float) vector double vec_rint(vector double) vector float vec_nearbyint(vector float) vector double vec_nearbyint(vector double) vector float vec_sqrt(vector float) vector double vec_sqrt(vector double) vector double vec_rsqrte(vector double) vector double vec_sel(vector double, vector double, vector unsigned long long) vector double vec_sel(vector double, vector double, vector unsigned long long) vector double vec_sub(vector double, vector double) vector double vec_trunc(vector double) vector double vec_xor(vector double, vector double) vector double vec_xor(vector double, vector bool long long) vector double vec_xor(vector bool long long, vector double) New VSX paths for the following interfaces: vector float vec_madd(vector float, vector float, vector float) vector float vec_nmsub(vector float, vector float, vector float) vector float vec_rsqrte(vector float) vector float vec_trunc(vector float) vector float vec_floor(vector float) llvm-svn: 241399
* [OPENMP 4.0] Fixed codegen for 'cancellation point' construct.Alexey Bataev2015-07-034-86/+146
| | | | | | | | | | 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-026-13/+26
| | | | | | | | | | | 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
* Switch users of the 'for (StmtRange range = stmt->children(); range; ↵Benjamin Kramer2015-07-025-19/+18
| | | | | | | | | ++range)‘ pattern to range for loops. The pattern was born out of the lack of range-based for loops in C++98 and is somewhat obscure. No functionality change intended. llvm-svn: 241300
* [CodeGen] Use llvm::join to simplify string joining.Benjamin Kramer2015-07-021-8/+2
| | | | | | | While there replace stable_sort of std::string with just sort, stability is not necessary for "simple" value types. No functional change intended. llvm-svn: 241299
* InstrProf: Add a comment to clarify an argumentJustin Bogner2015-07-021-1/+2
| | | | llvm-svn: 241296
* Remove whitespace from start of line, NFC.Yaron Keren2015-07-021-1/+1
| | | | llvm-svn: 241272
* [OPENMP 4.0] Initial support for 'omp cancel' construct.Alexey Bataev2015-07-023-0/+8
| | | | | | Implemented parsing/sema analysis + (de)serialization. llvm-svn: 241253
* Revert 241171, 241187, 241199 (32-bit SEH).Nico Weber2015-07-023-244/+153
| | | | | | | 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-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
OpenPOWER on IntegriCloud