summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* MS ABI: Return sret parameters when using inallocaReid Kleckner2014-02-252-2/+22
| | | | | | | | Previously the X86 backend would look for the sret attribute and handle this for us. inalloca takes that all away, so we have to do the return ourselves now. llvm-svn: 202097
* Objective-C. Remove an assertion which assertsFariborz Jahanian2014-02-241-6/+0
| | | | | | | on correctly handled block layout IRGen. // rdar://16111839 llvm-svn: 202063
* Implement getDwarfEHStackPointer() and initDwarfEHRegSizeTable() for sparcv9.Roman Divacky2014-02-241-0/+41
| | | | llvm-svn: 202059
* Do not put instrumentation counters before phis in ObjC for-in loops.Bob Wilson2014-02-241-3/+3
| | | | | | | We still don't use the PGO to set branch weights for these loops, but at least this keeps the compiler from crashing. <rdar://problem/16137778> llvm-svn: 202002
* Exposing the noduplicate attribute within Clang, which marks functions so ↵Aaron Ballman2014-02-222-0/+4
| | | | | | | | that the optimizer does not duplicate code. Patch thanks to Marcello Maggioni! llvm-svn: 201941
* IRGen: Fix build breakageDavid Majnemer2014-02-221-1/+1
| | | | | | | MSVC allows extra-qualification on member functions, it lets you repeat the class name on the method. llvm-svn: 201918
* Fix two warnings introduced r201907Warren Hunt2014-02-221-5/+4
| | | | | | | Unused variable is removed. Construction order is changed to match declaration order. llvm-svn: 201914
* Complete Rewrite of CGRecordLayoutBuilderWarren Hunt2014-02-211-946/+545
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CGRecordLayoutBuilder was aging, complex, multi-pass, and shows signs of existing before ASTRecordLayoutBuilder. It redundantly performed many layout operations that are now performed by ASTRecordLayoutBuilder and asserted that the results were the same. With the addition of support for the MS-ABI, such as placement of vbptrs, vtordisps, different bitfield layout and a variety of other features, CGRecordLayoutBuilder was growing unwieldy in its redundancy. This patch re-architects CGRecordLayoutBuilder to not perform any redundant layout but rather, as directly as possible, lower an ASTRecordLayout to an llvm::type. The new architecture is significantly smaller and simpler than the CGRecordLayoutBuilder and contains fewer ABI-specific code paths. It's also one pass. The architecture of the new system is described in the comments. For the most part, the new system simply takes all of the fields and bases from an ASTRecordLayout, sorts them, inserts padding and dumps a record. Bitfields, unions and primary virtual bases make this process a bit more complicated. See the inline comments. In addition, this patch updates a few lit tests due to the fact that the new system computes more accurate llvm types than CGRecordLayoutBuilder. Each change is commented individually in the review. Differential Revision: http://llvm-reviews.chandlerc.com/D2795 llvm-svn: 201907
* Reapply 201734 but with appropriate gcc compatibilityWarren Hunt2014-02-211-0/+44
| | | | | | | | | | Because GCC incorrectly defines _mm_prefetch to take anything that casts to void*, people have started using that behavior. The previous patch that made _mm_prefetch actually take a const char * broke compatibility with existing code. This update to the patch leaves the macro that defines _mm_prefetch with the (void*) cast when _MSC_VER is not defined. llvm-svn: 201901
* Remove commas at the end of lists (C++11 again)Tim Northover2014-02-211-2/+2
| | | | llvm-svn: 201849
* ARM & AArch64: use table for EmitCommonNeonBuiltinExprTim Northover2014-02-212-951/+929
| | | | | | | | | | This extends the intrinsic lookup table format slightly, and adds entries for use the shared ARM/AArch64 definitions. The benefit is currently smaller than for the SISD intrinsics (there's more custom code implementing this set), but a few lines are saved and there's scope for future expansion. llvm-svn: 201848
* AArch64: refactor table-driven NEON lookup.Tim Northover2014-02-212-204/+185
| | | | | | | | | | This extracts the table-driven intrinsic lookup phase into a separate function, to be used by EmitCommonNeonBuiltinExpr soon. It also simplifies the logic used in that lookup, since VectorCastArgN and ScalarArgN were actually identical. llvm-svn: 201847
* [CMake] Get rid of explicit dependencies to include/clang/*.inc and ↵NAKAMURA Takumi2014-02-211-11/+0
| | | | | | | | | | | | | | | | | | | introduce CLANG_TABLEGEN_TARGETS. This does; - clang_tablegen() adds each tblgen'd target to global property CLANG_TABLEGEN_TARGETS as list. - List of targets is added to LLVM_COMMON_DEPENDS. - all clang libraries and targets depend on generated headers. You might wonder this would be regression, but in fact, this is little loss. - Almost all of clang libraries depend on tblgen'd files and clang-tblgen. - clang-tblgen may cause short stall-out but doesn't cause unconditional rebuild. - Each library's dependencies to tblgen'd files might vary along headers' structure. It made hard to track and update *really optimal* dependencies. Each dependency to intrinsics_gen and ClangSACheckers is left as DEPENDS. llvm-svn: 201842
* Accept -no-integrated-as in -cc1 and forward it to llvm.Rafael Espindola2014-02-211-0/+3
| | | | llvm-svn: 201837
* MS ABI: Include the vfptr offset in memptrs to virtual methodsReid Kleckner2014-02-211-13/+22
| | | | | | | | | | | | | | | Virtual methods expect 'this' to point to the vfptr containing the virtual method, and this extends to virtual member pointer thunks. The relevant vfptr is always at offset zero on entry to the thunk, and no this adjustment is needed. Previously we would not include the vfptr adjustment in the member pointer, and we'd look at the vfptr offset when loading from the vftable in the thunk. Fixes PR18917. llvm-svn: 201835
* Sema: Do not assert when dereferencing member pointer using virtual ↵David Majnemer2014-02-206-58/+53
| | | | | | | | | | | | | | inheritance with an incomplete class type The MS ABI requires that we determine the vbptr offset if have a virtual inheritance model. Instead, raise an error pointing to the diagnostic when this happens. This fixes PR18583. Differential Revision: http://llvm-reviews.chandlerc.com/D2842 llvm-svn: 201824
* Remove really old "APPLE LOCAL" markers.Rafael Espindola2014-02-201-1/+1
| | | | llvm-svn: 201791
* Revert r201734 and r201742.Daniel Jasper2014-02-201-44/+0
| | | | | | | | | | | | | | | | | | | | | This breaks backwards compatibility with existing code. Previously, this was defined as #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel))) Which basically accepts any pointer. Changing this to char* simply breaks a lot of existing code. I have tried changing char* to "const void*", which seems to be the right thing as per Intel specification this should work on basically any pointer. However, apparently this breaks windows compatibility (because of a conflicting declaration in windows.h). So, we probably need to #ifdef this based on whether clang is compiling for windows. According to Chandler, this might be done by introducing an additional symbol to a fake type in BuiltinsX86.def and then condition the type expansion on the platform. llvm-svn: 201775
* Use llvm::DeleteContainerSeconds when possibleReid Kleckner2014-02-191-4/+1
| | | | llvm-svn: 201739
* Add _mm_prefetch and some others as MS builtinsWarren Hunt2014-02-191-0/+44
| | | | | | | | | | | | | This patch adds several built-ins that are required for ms compatibility. _mm_prefetch must be a built-in because it takes a compile-time constant argument and our prior approach of using a #define to the current built-in doesn't work in the presence of re-declaration of _mm_prefetch. The others can be obtained by including the windows system headers. If a user includes the windows system headers but not intrin.h they still need to work and therefore must be built-in because we don't get a chance to implement them in intrin.h in this case. llvm-svn: 201734
* AArch64: look up EmitAArch64Scalar support before calling.Tim Northover2014-02-191-655/+434
| | | | | | | | | | | | This fixes one immediate bug where an expression with side-effects could be emitted twice during a NEON call. It also prepares the way for folding CodeGen for many of the SISD intrinsics into a table, reducing code size and hopefully increasing performance eventually ("binary search + few switch cases" should be better than "lots of switch cases"). llvm-svn: 201667
* ARM NEON: add vcvtX (with rounding mode) intrinsics to v8 ARM.Tim Northover2014-02-191-124/+82
| | | | | | | | | | These instructions (well, the f32 ones) are supported on 32-bit ARMv8, not just AArch64. Now that the arm_neon.td refactoring is complete, adding them is surprisingly simple. rdar://problem/16035743 llvm-svn: 201661
* Remove dead code.Rafael Espindola2014-02-191-2/+0
| | | | | | Clang never produces a linker private object, so this code is dead. llvm-svn: 201627
* MS ABI: Remove nv adjustment from direct vdtor calls and prologuesReid Kleckner2014-02-181-0/+15
| | | | | | | | | | | | | | | | | | | | Summary: Generally the vector deleting dtor, which we model as a vtable thunk, takes care of non-virtual adjustment and delegates to the other destructor variants. The other non-complete destructor variants assume that 'this' on entry points to the virtual base subobject that first declared the virtual destructor. We need to change the adjustment in both the prologue and the vdtor call setup. Reviewers: timurrrr CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2821 llvm-svn: 201612
* DebugInfo: Avoid unnecessarily looking up the context when the declaration ↵David Blaikie2014-02-181-3/+2
| | | | | | | | is already built. No functional change intended. llvm-svn: 201602
* Change PGO instrumentation to compute counts in a separate AST traversal.Bob Wilson2014-02-1710-204/+500
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we made one traversal of the AST prior to codegen to assign counters to the ASTs and then propagated the count values during codegen. This patch now adds a separate AST traversal prior to codegen for the -fprofile-instr-use option to propagate the count values. The counts are then saved in a map from which they can be retrieved during codegen. This new approach has several advantages: 1. It gets rid of a lot of extra PGO-related code that had previously been added to codegen. 2. It fixes a serious bug. My original implementation (which was mailed to the list but never committed) used 3 counters for every loop. Justin improved it to move 2 of those counters into the less-frequently executed breaks and continues, but that turned out to produce wrong count values in some cases. The solution requires visiting a loop body before the condition so that the count for the condition properly includes the break and continue counts. Changing codegen to visit a loop body first would be a fairly invasive change, but with a separate AST traversal, it is easy to control the order of traversal. I've added a testcase (provided by Justin) to make sure this works correctly. 3. It improves the instrumentation overhead, reducing the number of counters for a loop from 3 to 1. We no longer need dedicated counters for breaks and continues, since we can just use the propagated count values when visiting breaks and continues. To make this work, I needed to make a change to the way we count case statements, going back to my original approach of not including the fall-through in the counter values. This was necessary because there isn't always an AST node that can be used to record the fall-through count. Now case statements are handled the same as default statements, with the fall-through paths branching over the counter increments. While I was at it, I also went back to using this approach for do-loops -- omitting the fall-through count into the loop body simplifies some of the calculations and make them behave the same as other loops. Whenever we start using this instrumentation for coverage, we'll need to add the fall-through counts into the counter values. llvm-svn: 201528
* Some nitpicky comment fixes for "i.e." and "e.g." abbreviations.Bob Wilson2014-02-172-6/+6
| | | | llvm-svn: 201527
* Fix some minor whitespace issues.Bob Wilson2014-02-173-4/+3
| | | | llvm-svn: 201526
* DebugInfo: imported_decl/using declarations at namespace scopeDavid Blaikie2014-02-151-1/+4
| | | | llvm-svn: 201470
* PGO: fix a bug in parsing pgo data.Manman Ren2014-02-151-1/+1
| | | | | | | | When a function has a single counter, we will offset the pointer by 1 when parsing the next function. If a function has multiple counters, we are okay after skipping rest of the counters. llvm-svn: 201456
* [IRGen]. Fixes a crash in using Objective-C array Fariborz Jahanian2014-02-141-2/+2
| | | | | | | | | properties by fixing shouldBindAsLValue to accept arrays (like record types) because we always manipulate them in memory. Patch suggested by John MaCall. // rdar://15610943 llvm-svn: 201428
* ARM & AArch64 NEON: share the vabs implementation.Tim Northover2014-02-131-11/+6
| | | | | | | | This changes ARM to use @llvm.fabs for floating-point vabs. Patterns already existed in the backend, and it might help mid-end phases since it's more likely to be understood than @llvm.arm.neon.vabs. llvm-svn: 201313
* AArch64: share slgihtly more NEON implementation with ARM.Tim Northover2014-02-111-14/+10
| | | | | | | | The s64/u64 vcvt conversion operations are actually pretty much identical to the s32/u32 ones in implementation, and can be shared with just one extra variable. llvm-svn: 201145
* XCore target: add section information.Robert Lytton2014-02-111-0/+6
| | | | | | | | Xcore target ABI requires const data that is externally visible to be handled differently if it has C-language linkage rather than C++ language linkage. llvm-svn: 201142
* AAPCS: Do not split structs after CPRC allocated on stackOliver Stannard2014-02-111-43/+130
| | | | | | | | | | According to the AAPCS, we can split structs between GPRs and the stack, except for when an argument has already been allocated on the stack. This can occur when a large number of floating-point arguments fill up the VFP registers, and are alllocated on the stack before the general-purpose argument registers are full. llvm-svn: 201137
* [stackprotector] Add command line option -fstack-protector-strongJosh Magee2014-02-111-0/+2
| | | | | | | | | | This option has the following effects: * It adds the sspstrong IR attribute to each function within the CU. * It defines the macro __SSP_STRONG__ with the value of 2. Differential Revision: http://llvm-reviews.chandlerc.com/D2717 llvm-svn: 201120
* ARM: move vshll NEON implementation to common codeTim Northover2014-02-101-13/+10
| | | | | | | Now that both ARM backends use the same implementation for vshll operations, the code can be shared. This is also a necessary LLVM/Clang interface update. llvm-svn: 201094
* ARM: implement vshrn NEON intrinsic in terms of shr/truncTim Northover2014-02-101-13/+10
| | | | | | | Now the backend supports the natural LLVM IR, we can shamelessly steal the AArch64 front-end code to implement the vshrn intrinsic on 32-bit ARM. llvm-svn: 201086
* type_info objects are not unnamed_addr: the ABI requires us toJohn McCall2014-02-081-8/+15
| | | | | | | | | | unique them and permits the implementation of dynamic_cast (and anything else which knows it's working with a complete class type) to compare their addresses directly. rdar://16005328 llvm-svn: 201020
* Remove the -fhidden-weak-vtables -cc1 option. It was dead,John McCall2014-02-087-153/+19
| | | | | | gross, and increasingly replaced through other mechanisms. llvm-svn: 201011
* Fix AAPCS compliance for HFAs containing doubles and long doublesOliver Stannard2014-02-071-4/+23
| | | | | | | | | An HFA is defined as a struct containing floating point values of the same machine type. In the 32-bit ABI, double and long double have the same machine type, so a struct with a mixture of these types must be an HFA (assuming it meets the other criteria). llvm-svn: 200971
* Wired-up the new LLVM diagnostic system into clang diagnostic system.Quentin Colombet2014-02-061-1/+113
| | | | | | | | | The approach is similar to the existing inline-asm reporting, just more general. <rdar://problem/15886278> llvm-svn: 200931
* Simplify code by combining ifs.Manman Ren2014-02-061-9/+7
| | | | llvm-svn: 200893
* Fix Werror introduced at r200874.Manman Ren2014-02-061-1/+1
| | | | llvm-svn: 200891
* PGO: instrumentation based profiling sets function attributes.Manman Ren2014-02-053-1/+60
| | | | | | | | | | | | | | | We collect a maximal function count among all functions in the pgo data file. For functions that are hot, we set its InlineHint attribute. For functions that are cold, we set its Cold attribute. We currently treat functions with >= 30% of the maximal function count as hot and functions with <= 1% of the maximal function count are treated as cold. These two numbers are from preliminary tuning on SPEC. This commit should not affect non-PGO builds and should boost performance on instrumentation based PGO. llvm-svn: 200874
* Remove unused variable to fix -Werror buildReid Kleckner2014-02-051-3/+0
| | | | llvm-svn: 200861
* MS ABI: Mangle member pointer template argumentsReid Kleckner2014-02-053-88/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Member pointers are mangled as they would be represented at runtime. They can be a single integer literal, single decl, or a tuple with some more numbers tossed in. With Clang today, most of those numbers will be zero because we reject pointers to members of virtual bases. This change required moving VTableContextBase ownership from CodeGenVTables to ASTContext, because mangling now depends on vtable layout. I also hoisted the inheritance model helpers up to be inline static methods of MSInheritanceAttr. This makes the AST code that deals with member pointers much more readable. MSVC doesn't appear to have stable manglings of null member pointers: - Null data memptrs in function templates have a mangling collision with the first field of a non-polymorphic single inheritance class. - The mangling of null data memptrs changes if you add casts. - Large null function memptrs in class templates crash MSVC. Clang uses the class template mangling for null data memptrs and the function template mangling for null function memptrs to deal with this. Reviewers: majnemer Differential Revision: http://llvm-reviews.chandlerc.com/D2695 llvm-svn: 200857
* Debug info: fix a crasher when when emitting debug info forAdrian Prantl2014-02-041-3/+4
| | | | | | | | not-yet-completed templated types. getTypeSize() needs a complete type. rdar://problem/15931354 llvm-svn: 200797
* ARM & AArch64: combine implementation of vcaXYZ intrinsicsTim Northover2014-02-041-80/+24
| | | | | | | | Now that the back-end intrinsics are more regular, there's no need for the special handling these got in the front-end, so they can be moved to EmitCommonNeonBuiltinExpr. llvm-svn: 200769
* [ms-cxxabi] Fix cast when structor replacement is an aliasReid Kleckner2014-02-031-4/+8
| | | | llvm-svn: 200711
OpenPOWER on IntegriCloud