summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix indentationDavid Blaikie2015-05-181-43/+43
| | | | llvm-svn: 237631
* Revert changes to DefaultABIInfo accidentally introduced in r208733Reid Kleckner2015-05-181-1/+9
| | | | | | | | | | | | Also add trivial handling of transparent unions. PPC32, MSP430, and XCore apparently all rely on DefaultABIInfo. This should worry you, because DefaultABIInfo is not implementing the rules of any particular ABI. Fixes PR23097, patch by Andy Gibbs. llvm-svn: 237630
* API update for streamlining of IRBuilder::CreateCall to just use ↵David Blaikie2015-05-1814-108/+109
| | | | | | ArrayRef/initializer_list+braced init llvm-svn: 237625
* [OPENMP] Fix for '#pragma omp task' codegen.Alexey Bataev2015-05-182-71/+109
| | | | | | | | | | | | | | | | | | Internal task structure must be generated like typedef struct kmp_task { void * shareds; kmp_routine_entry_t routine; kmp_int32 part_id; kmp_routine_entry_t destructors; } kmp_task_t; struct kmp_task_t_with_privates { kmp_task_t task_data; .kmp_private. privates; }; to avoid possible additional alignment bytes in first fields (shareds, routine, part_id and destructors). Runtime library is not aware of such kind additional alignment bytes. llvm-svn: 237561
* [modules] Add local submodule visibility support for declarations.Richard Smith2015-05-151-1/+1
| | | | | | | | | | | | With this change, enabling -fmodules-local-submodule-visibility results in name visibility rules being applied to submodules of the current module in addition to imported modules (that is, names no longer "leak" between submodules of the same top-level module). This also makes it much safer to textually include a non-modular library into a module: each submodule that textually includes that library will get its own "copy" of that library, and so the library becomes visible no matter which including submodule you import. llvm-svn: 237473
* Implement no_sanitize attribute.Peter Collingbourne2015-05-152-17/+14
| | | | | | Differential Revision: http://reviews.llvm.org/D9631 llvm-svn: 237463
* CGAtomic.cpp: Fix bogus \brief(s). Did you mean "\param"? [-Wdocumentation]NAKAMURA Takumi2015-05-151-3/+3
| | | | llvm-svn: 237447
* [OPENMP] Fixed bug in atomic update/capture/write constructs.Alexey Bataev2015-05-152-131/+280
| | | | | | Fixed a bug with codegen for destination atomic l-value with padding and junk in this padding bytes. llvm-svn: 237422
* Revert r237385, "[CodeGen] Reuse stack space from unused function results"NAKAMURA Takumi2015-05-151-20/+3
| | | | | | It broke clang stage2, at least tblgen. llvm-svn: 237418
* InstrProf: Only disable coverage in built-in macros, not all system macrosJustin Bogner2015-05-141-4/+9
| | | | | | | | | The issue I was trying to solve in r236547 was about built-in macros, but I disabled coverage in all system macros. This is actually a bit of overkill, and makes the display of coverage around system macros degrade unnecessarily. Instead, limit this to builtins specifically. llvm-svn: 237397
* [CodeGen] Reuse stack space from unused function resultsSergey Dmitrouk2015-05-141-3/+20
| | | | | | | | | | | | | | | | | | | | Summary: Space on stack allocated for unused structures returned by functions was unused even when it's lifetime didn't intersect with lifetime of any other objects that could use the same space. The test added also checks for named and auto objects. It seems to make sense to have this all in one place. Reviewers: aadg, rsmith, rjmccall, rnk Reviewed By: rnk Subscribers: asl, cfe-commits Differential Revision: http://reviews.llvm.org/D9743 llvm-svn: 237385
* [OPENMP] Fixed codegen for firstprivate variables, also marked as lastprivate.Alexey Bataev2015-05-131-11/+13
| | | | | | In some rare cases shared copies of lastprivate/firstprivate variables were not updated after the loop directive. llvm-svn: 237243
* Fixed double-free in case of module loading error.Artem Belevich2015-05-121-2/+2
| | | | | | | | | | | | | GetOutputStream() owns the stream it returns pointer to and the pointer should never be freed by us. When we fail to load and exit early, unique_ptr still holds the pointer and frees it which leads to compiler crash when CompilerInstance attempts to free it again. Added regression test for failed bitcode linking. Differential Revision: http://reviews.llvm.org/D9625 llvm-svn: 237159
* Remove superfluous SmallString cast.Yaron Keren2015-05-121-1/+1
| | | | llvm-svn: 237123
* [OPENMP] Fixed support for 'schedule' clause with non-constant chunk size.Alexey Bataev2015-05-121-11/+39
| | | | | | 'schedule' clause for combined directives requires additional processing. Special helper variable is generated, that is captured in the outlined parallel region for 'parallel for' region. This captured variable is used to store chunk expression from the 'schedule' clause in this 'parallel for' region. llvm-svn: 237100
* Remove the code that pulled soft float attributes out of the featureEric Christopher2015-05-121-1/+0
| | | | | | | strings and remove the setting of TargetOptions::UseSoftFloat to match the code change in llvm r237079. llvm-svn: 237080
* Unify sanitizer kind representation between the driver and the rest of the ↵Peter Collingbourne2015-05-113-10/+12
| | | | | | | | | | compiler. No functional change. Differential Revision: http://reviews.llvm.org/D9618 llvm-svn: 237055
* Give isCompatibleWithMSVC a better interfaceDavid Majnemer2015-05-111-1/+1
| | | | | | | We now use an enum which maps the marketing name (almost always a year) to the major version number. llvm-svn: 236967
* [MS ABI] Form member pointers from virtual funcs overriding vbasesDavid Majnemer2015-05-101-12/+13
| | | | | | | | | | | | | | | We didn't supporting taking the address of virtual member functions which overrode a method in a virtual base. We simply need to encode the virtual base index in the member pointer. This fixes PR23452. N.B. There is no data member pointer side to this change because taking the address of a virtual bases' data member gives you a member pointer whose type is derived from the virtual bases' type, not the most derived type. llvm-svn: 236962
* [MS ABI] Update EH emission for MSVC 2015 compatibilityDavid Majnemer2015-05-101-1/+4
| | | | | | | | | | | | | MSVC 2015 renamed the symbol found by name lookup for 'std::terminate' so we cannot rely on using '?terminate@@YAXXZ'. Furthermore, it seems that 2015 will be the first release of MSVC which permits inlining a function which is noexcept into a function which isn't. This is implemented by creating a cleanup for the invoker which jumps to __std_terminate. Clang's implementation of this aspect of the MSVC scheme is slightly less efficient in this respect because we use a catch handler configured as a catch-all handler instead. llvm-svn: 236961
* Prune trailing LF.NAKAMURA Takumi2015-05-091-1/+0
| | | | llvm-svn: 236938
* Revert r236879, "Do not emit thunks with available_externally linkage in ↵NAKAMURA Takumi2015-05-096-21/+27
| | | | | | | | comdats" It broke pecoff, at least i686-cygwin. llvm-svn: 236937
* Fix BackendConsumer::EmitOptimizationMessage()Diego Novillo2015-05-081-7/+10
| | | | | | | | | | | Patch from Geoff Berry <gberry@codeaurora.org> Fix BackendConsumer::EmitOptimizationMessage() to check if the DiagnosticInfoOptimizationBase object has a valid location before calling getLocation() to avoid dereferencing a null pointer inside getLocation() when no debug info is present. llvm-svn: 236898
* Do not emit thunks with available_externally linkage in comdatsDerek Schuff2015-05-086-27/+21
| | | | | | | | | | | | | | Functions with available_externally linkage will not be emitted to object files (they will just be undefined symbols), so it does not make sense to put them in comdats. Creates a second overload of maybeSetTrivialComdat that uses the GlobalObject instead of the Decl, and uses that in several places that had the faulty logic. Differential Revision: http://reviews.llvm.org/D9580 llvm-svn: 236879
* [OPENMP] Fixed atomic construct with non-integer expressions.Alexey Bataev2015-05-081-4/+5
| | | | | | Do not emit 'atomicrmw' instruction for simple atomic constructs with non-integer expressions. llvm-svn: 236828
* [OPENMP] Code cleanup for capturing of variables in OpenMP regions.Alexey Bataev2015-05-081-1/+21
| | | | llvm-svn: 236821
* [SanitizerCoverage] Implement user-friendly -fsanitize-coverage= flags.Alexey Samsonov2015-05-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Possible coverage levels are: * -fsanitize-coverage=func - function-level coverage * -fsanitize-coverage=bb - basic-block-level coverage * -fsanitize-coverage=edge - edge-level coverage Extra features are: * -fsanitize-coverage=indirect-calls - coverage for indirect calls * -fsanitize-coverage=trace-bb - tracing for basic blocks * -fsanitize-coverage=trace-cmp - tracing for cmp instructions * -fsanitize-coverage=8bit-counters - frequency counters Levels and features can be combined in comma-separated list, and can be disabled by subsequent -fno-sanitize-coverage= flags, e.g.: -fsanitize-coverage=bb,trace-bb,8bit-counters -fno-sanitize-coverage=trace-bb is equivalient to: -fsanitize-coverage=bb,8bit-counters Original semantics of -fsanitize-coverage flag is preserved: * -fsanitize-coverage=0 disables the coverage * -fsanitize-coverage=1 is a synonym for -fsanitize-coverage=func * -fsanitize-coverage=2 is a synonym for -fsanitize-coverage=bb * -fsanitize-coverage=3 is a synonym for -fsanitize-coverage=edge * -fsanitize-coverage=4 is a synonym for -fsanitize-coverage=edge,indirect-calls Driver tries to diagnose invalid flag usage, in particular: * At most one level (func,bb,edge) must be specified. * "trace-bb" and "8bit-counters" features require some level to be specified. See test case for more examples. Test Plan: regression test suite Reviewers: kcc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9577 llvm-svn: 236790
* [MS ABI] Make sure we number thread_local statics seperatelyDavid Majnemer2015-05-071-8/+15
| | | | | | | The thread_local variables need their own numbers, they can't share with the other static local variables. llvm-svn: 236774
* [cuda] Include GPU binary into host object file and generate init/deinit code.Artem Belevich2015-05-074-18/+227
| | | | | | | | | | | | - added -fcuda-include-gpubinary option to incorporate results of device-side compilation into host-side one. - generate code to register GPU binaries and associated kernels with CUDA runtime and clean-up on exit. - added test case for init/deinit code generation. Differential Revision: http://reviews.llvm.org/D9507 llvm-svn: 236765
* [SanitizerCoverage] Give clang-cc1 the power to precisly specify needed ↵Alexey Samsonov2015-05-071-2/+9
| | | | | | | | | | | | | | | | | | sanitizier coverage mode. Summary: The next step is to add user-friendly control over these options to driver via -fsanitize-coverage= option. Test Plan: regression test suite Reviewers: kcc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9545 llvm-svn: 236756
* [opaque pointer type] Correctly pass the pointee type when creating a GEP ↵David Blaikie2015-05-071-1/+2
| | | | | | constant expression llvm-svn: 236751
* Fix for http://llvm.org/PR23392: magick/feature.c from ImageMagick-6.9.1-2 ICEs.Alexey Bataev2015-05-071-0/+2
| | | | | | | Fix for codegen of static variables declared inside of captured statements. Captured statements are actually a transparent DeclContexts, so we have to skip them when trying to get a mangled name for statics. Differential Revision: http://reviews.llvm.org/D9522 llvm-svn: 236701
* [MS ABI] Implement thread-safe initialization using the MSVC 2015 ABIDavid Majnemer2015-05-071-54/+189
| | | | | | | | | The MSVC 2015 ABI utilizes a rather straightforward adaptation of the algorithm found in the appendix of N2382. While we are here, implement support for emitting cleanups if an exception is thrown while we are intitializing a static local variable. llvm-svn: 236697
* [OPENMP] Generate !llvm.mem.loop_parallel_access metadata for loops with ↵Alexey Bataev2015-05-071-0/+5
| | | | | | | | | | dynamic/guided scheduling. Inner bodies of OpenMP worksharing loop-based constructs with dynamic or guided scheduling are allowed to be marked with !llvm.mem.parallel_loop_access metadata for better optimization. Worksharing constructs with static scheduling cannot be marked this way (according to OpenMP standard "A data dependence between the same logical iterations in two such loops is guaranteed"). Constructs with auto and runtime scheduling are also not marked because automatically chosen scheduling may be static also. Differential Revision: http://reviews.llvm.org/D9518 llvm-svn: 236693
* [OPENMP] Fixed codegen for 'reduction' clause.Alexey Bataev2015-05-071-9/+25
| | | | | | | | Fixed codegen for reduction operations min, max, && and ||. Codegen for them is quite similar and I was confused by this similarity. Also added a call to kmpc_end_reduce() in atomic part of reduction codegen (call to kmpc_end_reduce_nowait() is not required). Differential Revision: http://reviews.llvm.org/D9513 llvm-svn: 236689
* CGCXX: Use cast in getAddrOfCXXStructor()Duncan P. N. Exon Smith2015-05-061-2/+1
| | | | | | | | All callers should be passing `CXXConstructorDecl` or `CXXDestructorDecl` here, so use `cast<>` instead of `dyn_cast<>` when setting up the `GlobalDecl`. llvm-svn: 236651
* InstrProf: Don't start or end coverage regions inside of system macrosJustin Bogner2015-05-051-4/+4
| | | | | | | | | | | It doesn't make much sense to try to show coverage inside system macros, and source locations in builtins confuses the coverage mapping. Just avoid doing this. Fixes an assert that fired when a __block storage specifier starts a region. llvm-svn: 236547
* [SystemZ] Add support for z13 low-level vector builtinsUlrich Weigand2015-05-051-0/+205
| | | | | | | | | | | | | | | | | | | | | | | | | This adds low-level builtins to allow access to all of the z13 vector instructions. Note that instructions whose semantics can be described by standard C (including clang extensions) do not get any builtins. For each instructions whose semantics *cannot* (fully) be described, we define a builtin named __builtin_s390_<insn> that directly maps to this instruction. These are intended to be compatible with GCC. For instructions that also set the condition code, the builtin will take an extra argument of type "int *" at the end. The integer pointed to by this argument will be set to the post-instruction CC value. For many instructions, the low-level builtin is mapped to the corresponding LLVM IR intrinsic. However, a number of instructions can be represented in standard LLVM IR without requiring use of a target intrinsic. Some instructions require immediate integer operands within a certain range. Those are verified at the Sema level. Based on a patch by Richard Sandiford. llvm-svn: 236532
* [SystemZ] Add support for z13 and its vector facilityUlrich Weigand2015-05-051-26/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the z13 architecture type. For compatibility with GCC, a pair of options -mvx / -mno-vx can be used to selectively enable/disable use of the vector facility. When the vector facility is present, we default to the new vector ABI. This is characterized by two major differences: - Vector types are passed/returned in vector registers (except for unnamed arguments of a variable-argument list function). - Vector types are at most 8-byte aligned. The reason for the choice of 8-byte vector alignment is that the hardware is able to efficiently load vectors at 8-byte alignment, and the ABI only guarantees 8-byte alignment of the stack pointer, so requiring any higher alignment for vectors would require dynamic stack re-alignment code. However, for compatibility with old code that may use vector types, when *not* using the vector facility, the old alignment rules (vector types are naturally aligned) remain in use. These alignment rules are not only implemented at the C language level, but also at the LLVM IR level. This is done by selecting a different DataLayout string depending on whether the vector ABI is in effect or not. Based on a patch by Richard Sandiford. llvm-svn: 236531
* [OPENMP] Fixed incorrect work with cleanups, NFC.Alexey Bataev2015-05-051-17/+24
| | | | | | | Destructors are never called for cleanups, so we can't use SmallVector as a member. Differential Revision: http://reviews.llvm.org/D9399 llvm-svn: 236491
* Revert revision 236487: [OPENMP] Fixed incorrect work with cleanups, NFC.Alexey Bataev2015-05-051-19/+17
| | | | llvm-svn: 236490
* [OPENMP] Fixed incorrect work with cleanups, NFC.Alexey Bataev2015-05-051-17/+19
| | | | | | | Destructors are never called for cleanups, so we can't use SmallVector as a member. Differential Revision: http://reviews.llvm.org/D9399 llvm-svn: 236487
* Revert revision 236482: [OPENMP] Fixed incorrect work with cleanups, NFC.Alexey Bataev2015-05-051-19/+13
| | | | | | Due to some incompatibilities with Windows. llvm-svn: 236483
* [OPENMP] Fixed incorrect work with cleanups, NFC.Alexey Bataev2015-05-051-13/+19
| | | | | | | Destructors are never called for cleanups, so we can't use SmallVector as a member. Differential Revision: http://reviews.llvm.org/D9399 llvm-svn: 236482
* Revert revision 236480: [OPENMP] Fixed incorrect work with cleanups, NFC.Alexey Bataev2015-05-051-16/+10
| | | | | | Due to some incompatibilities with Windows. llvm-svn: 236481
* [OPENMP] Fixed incorrect work with cleanups, NFC.Alexey Bataev2015-05-051-10/+16
| | | | | | | Destructors are never called for cleanups, so we can't use SmallVector as a member. Differential Revision: http://reviews.llvm.org/D9399 llvm-svn: 236480
* [OPENMP] Codegen for 'firstprivate' clause in 'task' directive.Alexey Bataev2015-05-053-24/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For tasks codegen for private/firstprivate variables are different rather than for other directives. 1. Build an internal structure of privates for each private variable: struct .kmp_privates_t. { Ty1 var1; ... Tyn varn; }; 2. Add a new field to kmp_task_t type with list of privates. struct kmp_task_t { void * shareds; kmp_routine_entry_t routine; kmp_int32 part_id; kmp_routine_entry_t destructors; .kmp_privates_t. privates; }; 3. Create a function with destructors calls for all privates after end of task region. kmp_int32 .omp_task_destructor.(kmp_int32 gtid, kmp_task_t *tt) { ~Destructor(&tt->privates.var1); ... ~Destructor(&tt->privates.varn); return 0; } 4. Perform initialization of all firstprivate fields (by simple copying for POD data, copy constructor calls for classes) + provide address of a destructor function after kmpc_omp_task_alloc() and before kmpc_omp_task() calls. kmp_task_t *new_task = __kmpc_omp_task_alloc(ident_t *, kmp_int32 gtid, kmp_int32 flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds, kmp_routine_entry_t *task_entry); CopyConstructor(new_task->privates.var1, *new_task->shareds.var1_ref); new_task->shareds.var1_ref = &new_task->privates.var1; ... CopyConstructor(new_task->privates.varn, *new_task->shareds.varn_ref); new_task->shareds.varn_ref = &new_task->privates.varn; new_task->destructors = .omp_task_destructor.; kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32 gtid, kmp_task_t *new_task) Differential Revision: http://reviews.llvm.org/D9370 llvm-svn: 236479
* InstrProf: Cede ownership of createProfileWeights to CGFJustin Bogner2015-05-026-26/+28
| | | | | | | | 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
* Fix -fobjc-arc doesn't work with -save-tempsSteven Wu2015-05-021-2/+1
| | | | | | | | | | The underlying problem is that there is currently no way to run ObjCARCContract from llvm bitcode which is required by ObjC ARC. This fix the problem by always enable ObjCARCContract pass if optimization is enabled. The ObjCARC Contract pass has almost no overhead on code that is not using ARC. llvm-svn: 236372
* InstrProf: Use a locally tracked current count in ComputeRegionCountsJustin Bogner2015-05-022-38/+35
| | | | | | | | No functional change. This just makes it more obvious that the logic in ComputeRegionCounts only depends on the counter map and local state. llvm-svn: 236370
OpenPOWER on IntegriCloud