summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement the __builtin_call_with_static_chain GNU extension.Peter Collingbourne2014-12-129-69/+119
| | | | | | | | | | | | | | | | The extension has the following syntax: __builtin_call_with_static_chain(Call, Chain) where Call must be a function call expression and Chain must be of pointer type This extension performs a function call Call with a static chain pointer Chain passed to the callee in a designated register. This is useful for calling foreign language functions whose ABI uses static chain pointers (e.g. to implement closures). Differential Revision: http://reviews.llvm.org/D6332 llvm-svn: 224167
* CodeGen: Loads/stores to allocas for atomic ops shouldn't be volatileDavid Majnemer2014-12-121-7/+10
| | | | | | | | | Don't inherit the volatile-ness of the input pointer to the volatile operation for memory allocated on the side. This fixes PR17306. llvm-svn: 224110
* Instead of having -Os/-Oz add OptimizeForSize/MinSize first, and laterPaul Robinson2014-12-112-6/+16
| | | | | | | | | | having OptimizeNone remove them again, just don't add them in the first place if the function already has OptimizeNone. Note that MinSize can still appear due to attributes on different declarations; a future patch will address that. llvm-svn: 224047
* DebugInfo: Location information for scalar new expressionsDavid Blaikie2014-12-101-5/+7
| | | | llvm-svn: 223937
* OpenCL C: Add support for a set of floating point Pekka Jaaskelainen2014-12-101-0/+6
| | | | | | | | | | | | | | arithmetic relaxation flags: -cl-no-signed-zeros -cl-unsafe-math-optimizations -cl-finite-math-only -cl-fast-relaxed-math Propagate the info to FP instruction flags as well as function attributes where they are available. llvm-svn: 223928
* DebugInfo: Correct location information for array accesses to elements of ↵David Blaikie2014-12-101-0/+3
| | | | | | variable array type. llvm-svn: 223902
* DebugInfo: Fix another case of array access line informationDavid Blaikie2014-12-101-0/+3
| | | | llvm-svn: 223897
* DebugInfo: Correct the location of array accessesDavid Blaikie2014-12-101-0/+2
| | | | | | | Especially relevant to ASan when dealing with complex expressions containing multiple array accesses. See PR21737. llvm-svn: 223872
* DebugInfo: Correct location of aggregate assignmentDavid Blaikie2014-12-091-0/+2
| | | | llvm-svn: 223854
* DebugInfo: Correct location of initialization of auto __complexDavid Blaikie2014-12-091-1/+1
| | | | llvm-svn: 223842
* DebugInfo: Correct the location of initializations of auto.David Blaikie2014-12-093-4/+6
| | | | llvm-svn: 223839
* DebugInfo: Correct location for compound complex assignmentDavid Blaikie2014-12-091-2/+1
| | | | llvm-svn: 223835
* DebugInfo: Accurate location information for complex assignmentDavid Blaikie2014-12-091-4/+4
| | | | llvm-svn: 223828
* DebugInfo: Emit the correct location for initialization of a complex variableDavid Blaikie2014-12-093-11/+19
| | | | | | Especially useful for sanitizer reports. llvm-svn: 223825
* Fix a GCC error from r223803Duncan P. N. Exon Smith2014-12-091-3/+5
| | | | llvm-svn: 223814
* IR: Update clang for Metadata/Value split in r223802Duncan P. N. Exon Smith2014-12-0914-274/+266
| | | | | | Match LLVM API changes from r223802. llvm-svn: 223803
* DebugInfo: Correctly identify the location of C++ member initializer list ↵David Blaikie2014-12-094-23/+31
| | | | | | | | | | | | | elements This particularly helps the fidelity of ASan reports (which can occur even in these examples - if, for example, one uses placement new over a buffer of insufficient size - now ASan will correctly identify which member's initialization went over the end of the buffer). This doesn't cover all types of members - more coming. llvm-svn: 223726
* DebugInfo: Ensure the store for an assignment is attributed to the beginning ↵David Blaikie2014-12-081-0/+2
| | | | | | of the assignment expression llvm-svn: 223699
* InstrProf: Use LLVM's -instrprof pass for profilingJustin Bogner2014-12-088-274/+54
| | | | | | | | The logic for lowering profiling counters has been moved to an LLVM pass. Emit the intrinsics rather than duplicating the whole pass in clang. llvm-svn: 223683
* No memcpy for copy ctor with -fsanitize-address-field-padding=1Kostya Serebryany2014-12-061-2/+3
| | | | | | | | | | | | | | | | | | | Summary: When -fsanitize-address-field-padding=1 is present don't emit memcpy for copy constructor. Thanks Nico for the extra test case. Test Plan: regression tests Reviewers: thakis, rsmith Reviewed By: rsmith Subscribers: rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D6515 llvm-svn: 223563
* [OPENMP] Codegen for 'omp barrier' directive.Alexey Bataev2014-12-053-42/+48
| | | | | | | | | Adds generation of call to "i32 kmpc_cancel_barrier(ident_t *, i32)" libcall for explicitly specified barriers (OMP_IDENT_BARRIER_EXPL flag is added to "flags" field of "ident_t" structure). Also this patch replaces all calls to "kmpc_barrier" function by calls of "__kmpc_cancel_barrier" function which provides additional functionality for OpenMP 4.0. Also, library specific enum OpenMPLocationFlags moved to private section of CGOpenMPRuntime class to make it more independent from library implementation. Differential Revision: http://reviews.llvm.org/D6447 llvm-svn: 223444
* Add attributes for AMDGPU register limits.Matt Arsenault2014-12-041-0/+42
| | | | | | | This is a performance hint that can be applied to kernels to attempt to limit the number of used registers. llvm-svn: 223384
* [OPENMP] Codegen for 'omp master' directiveAlexey Bataev2014-12-043-3/+86
| | | | | | | | | | | | | | Patch adds 2 library functions to OpenMPRuntime class - int32 kmpc_master(ident_t *, int32 gtid) and void kmpc_end_master(ident_t *, int32 gtid); For 'omp master' directive the next code is generated: if (__kmpc_master(loc, gtid)) { <Associated structured block>; __kmpc_end_master(log, gtid); } Differential Revision: http://reviews.llvm.org/D6473 llvm-svn: 223342
* Always emit kernel arg info for SPIR.Sameer Sahasrabuddhe2014-12-041-4/+4
| | | | | | | | | | | | | | | http://llvm.org/bugs/show_bug.cgi?id=21555 Currently, kernel argument metadata is omitted unless the "-cl-kernel-arg-info" option is specified. But the SPIR 1.2 spec requires that all metadata except kernel_arg_name should always be emitted, and kernel_arg_name is only emitted when "-cl-kernel-arg-info" is specified. Patch ported by Ryan Burn from the Khronos SPIR generator. https://github.com/KhronosGroup/SPIR llvm-svn: 223340
* CodeGen: refactor ARM builtin handlingSaleem Abdulrasool2014-12-042-20/+22
| | | | | | | | Create a helper function to construct a value for the ARM hint intrinsic rather than inling the construction. In order to avoid the use of the sentinel value, inline the use of intrinsic instruction retrieval. NFC. llvm-svn: 223338
* Cast vtable address points to i32 (...)** to enable more globaloptReid Kleckner2014-12-031-4/+8
| | | | | | | | | | | | We currently use i32 (...)** as the type of the vptr field in the LLVM struct type. LLVM's GlobalOpt prefers any bitcasts to be on the side of the data being stored rather than on the pointer being stored to. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D5916 llvm-svn: 223267
* [OPENMP] Code formatting and improvement, no functional changes.Alexey Bataev2014-12-032-22/+18
| | | | llvm-svn: 223225
* UBSan now uses prologue data instead of prefix dataPeter Collingbourne2014-12-031-6/+6
| | | | | | | | | | | | As the semantics of prefix data has changed. See D6454. Patch by Ben Gamari! Test Plan: Testsuite Differential Revision: http://reviews.llvm.org/D6489 llvm-svn: 223190
* Fix incorrect codegen for devirtualized calls to virtual overloaded operators.Nico Weber2014-12-033-59/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider this program: struct A { virtual void operator-() { printf("base\n"); } }; struct B final : public A { virtual void operator-() override { printf("derived\n"); } }; int main() { B* b = new B; -static_cast<A&>(*b); } Before this patch, clang saw the virtual call to A::operator-(), figured out that it can be devirtualized, and then just called A::operator-() directly, without going through the vtable. Instead, it should've looked up which operator-() the call devirtualizes to and should've called that. For regular virtual member calls, clang gets all this right already. So instead of giving EmitCXXOperatorMemberCallee() all the logic that EmitCXXMemberCallExpr() already has, cut the latter function into two pieces, call the second piece EmitCXXMemberOrOperatorMemberCallExpr(), and use it also to generate code for calls to virtual member operators. This way, virtual overloaded operators automatically don't get devirtualized if they have covariant returns (like it was done for regular calls in r218602), etc. This also happens to fix (or at least improve) codegen for explicit constructor calls (`A a; a.A::A()`) in MS mode with -fsanitize-address-field-padding=1. (This adjustment for virtual operator calls seems still wrong with the MS ABI.) llvm-svn: 223185
* InstrProf: Use the same names for variables as we use in the profileJustin Bogner2014-12-022-18/+14
| | | | | | | | There's no need to use different names for the local variables than we use in the profile itself, and it's a bit simpler and easier to debug if we're consistent. llvm-svn: 223173
* InstrProf: Remove some pointless indirection (NFC)Justin Bogner2014-12-022-15/+15
| | | | | | | | It doesn't make much sense to have std::unique_ptrs of std::string and std::vector. Avoid some useless indirection by using these types directly. llvm-svn: 223166
* Wrap to 80 columns. No behavior change.Nico Weber2014-12-021-3/+4
| | | | llvm-svn: 223149
* Fix invalid calling convention used for libcalls on ARM.Anton Korobeynikov2014-12-025-9/+52
| | | | | | | | | | | | | | | | ARM ABI specifies that all the libcalls use soft FP ABI (even hard FP binaries). These days clang emits _mulsc3 / _muldc3 calls with default (C) calling convention which would be translated into AAPCS_VFP LLVM calling and thus the result of complex multiplication will be bogus. Introduce a way for a target to specify explicitly calling convention for libcalls. Right now this is temporary correctness fix. Ultimately, we'll end with intrinsic for complex multiplication and all calling convention decisions for libcalls will be put into backend. llvm-svn: 223123
* Use nullptr to silence -Wsentinel when self-hosting on WindowsReid Kleckner2014-12-019-45/+45
| | | | | | | | | | | Richard rejected my Sema change to interpret an integer literal zero in a varargs context as a null pointer, so -Wsentinel sees an integer literal zero and fires off a warning. Only CodeGen currently knows that it promotes integer literal zeroes in this context to pointer size on Windows. I didn't want to teach -Wsentinel about that compatibility hack. Therefore, I'm migrating to C++11 nullptr. llvm-svn: 223079
* Add missing 'break's, found by inspection. No functionality change; theRichard Smith2014-12-011-0/+2
| | | | | | fallthrough happened to do the right thing in both cases. llvm-svn: 223064
* [OPENMP] Formating and code improvement for codegen of 'omp critical' directive.Alexey Bataev2014-12-013-47/+28
| | | | | | No functional changes, only code improvements. llvm-svn: 223010
* Revert "Remove threshold for lifetime marker insertion of named temporaries"Arnaud A. de Grandmaison2014-12-012-29/+26
| | | | | | Revert r222993 while I investigate some MemorySanitizer failures. llvm-svn: 222995
* Remove threshold for lifetime marker insertion of named temporariesArnaud A. de Grandmaison2014-12-012-26/+29
| | | | | | | | | Now that TailRecursionElimination has been fixed with r222354, the threshold on size for lifetime marker insertion can be removed. This only affects named temporary though, as the patch for unnamed temporaries is still in progress. llvm-svn: 222993
* AArch64: simplify PCS mapping.Tim Northover2014-11-271-122/+30
| | | | | | | | | | | | Now that LLVM can count the registers needed to implement AAPCS rules, we don't need to duplicate that logic here. This means we can drop the explicit padding and also use more natural types in many cases (e.g. "struct { float arr[3]; }" used to end up as "[2 x double]" to avoid holes on the stack. The one wrinkle is that AAPCS va_arg was also using the register counting machinery. But the local replacement isn't too bad. llvm-svn: 222904
* [OpenCL] Implemented restrictions for pointer conversions specified in ↵Anastasia Stulova2014-11-261-2/+2
| | | | | | | | | | | | OpenCL v2.0. OpenCL v2.0 s6.5.5 restricts conversion of pointers to different address spaces: - the named address spaces (__global, __local, and __private) => __generic - implicitly converted; - __generic => named - with an explicit cast; - named <=> named - disallowed; - __constant <=> any other - disallowed. llvm-svn: 222834
* CodeGen: Fix emission of __atomic_compare_exchangeDavid Majnemer2014-11-251-22/+22
| | | | | | We (wrongly) discarded the return value of the call. llvm-svn: 222798
* Add a missing override, caught by clang's inconsistent override warning.Chandler Carruth2014-11-251-1/+1
| | | | llvm-svn: 222742
* MS ABI: Add CodeGen support for rethrowing MS C++ exceptionsDavid Majnemer2014-11-254-16/+51
| | | | | | | | | | Rethrowing exceptions in the MS model is very simple: just call _CxxThrowException with nullptr for both arguments. N.B. They chose stdcall as the calling convention for x86 but cdecl for all other platforms. llvm-svn: 222733
* CodeGen: further simplify assertionSaleem Abdulrasool2014-11-251-4/+2
| | | | | | Use more of algorithm to simplify the assertion. Pointed out by David Blakie! llvm-svn: 222721
* Remove unnecessary environment switchReid Kleckner2014-11-241-11/+1
| | | | | | | | All supported environments on x86 Windows return structs in EAX:EDX. This removes code added in r204978 that had to get updated in r222680. We should now have the same behavior we had before r204978. llvm-svn: 222697
* Correctly remove OptimizeForSize from functions marked OptimizeNone.Paul Robinson2014-11-241-10/+15
| | | | | | | This allows using __attribute__((optnone)) and the -Os/-Oz options. Fixes PR21604. llvm-svn: 222683
* CodeGen: make i686-windows-itanium more similar to msvcSaleem Abdulrasool2014-11-241-0/+1
| | | | | | | The itanium environment follows the system calling convention for structures. Pass small aggregates via registers. llvm-svn: 222680
* CodeGen: use a range-based for loopSaleem Abdulrasool2014-11-241-3/+2
| | | | | | Convert a debug assertion into a range-based loop form. NFC. llvm-svn: 222679
* CodeGen: tweak struct ABI handlingSaleem Abdulrasool2014-11-231-1/+1
| | | | | | | | Cygwin and MinGW fail to conform to the underlying system's structure passing ABI. Make the check more precise to ensure that we correctly generate code for the itanium environment. llvm-svn: 222626
* CodeGen: Make atomic operations play nice with address spacesDavid Majnemer2014-11-221-6/+8
| | | | | | | | We were being a little sloppy with our pointer/address space casts. This fixes PR21643. llvm-svn: 222615
OpenPOWER on IntegriCloud