summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* CGDebugInfo: Hoist string allocation in a helper function. No functionality ↵Benjamin Kramer2013-09-092-32/+19
| | | | | | change. llvm-svn: 190314
* Fix constructor-related typos.Benjamin Kramer2013-09-093-3/+3
| | | | | | Noticed by Roman Divacky. llvm-svn: 190311
* Implement aarch64 neon instruction set AdvSIMD (3V Diff), covering the ↵Jiangning Liu2013-09-091-0/+16
| | | | | | | | following 26 instructions, SADDL, UADDL, SADDW, UADDW, SSUBL, USUBL, SSUBW, USUBW, ADDHN, RADDHN, SABAL, UABAL, SUBHN, RSUBHN, SABDL, UABDL, SMLAL, UMLAL, SMLSL, UMLSL, SQDMLAL, SQDMLSL, SMULL, UMULL, SQDMULL, PMULL llvm-svn: 190289
* Debug Info: pass in DIScope instead of DIDescriptor in createFieldType.Manman Ren2013-09-082-2/+2
| | | | | | Improve readability. No functionality change. llvm-svn: 190268
* OpenMP: Data-sharing attributes analysis and clause 'shared' (fixed test ↵Alexey Bataev2013-09-061-2/+4
| | | | | | threadprivate_messages.cpp) llvm-svn: 190183
* PR17046, PR17092: Debug Info assert-on-valid due to member loss when context ↵David Blaikie2013-09-061-41/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | creation recreates the item the context is created for By removing the possibility of strange partial definitions with no members that older GCC's produced for the otherwise unreferenced outer types of referenced inner types, we can simplify debug info generation and correct this bug. Newer (4.8.1 and ToT) GCC's don't produce this quirky debug info, and instead produce the full definition for the outer type (except in the case where that type is dynamic and its vtable is not emitted in this TU). During the creation of the context for a type, we may revisit that type (due to the need to visit template parameters, among other things) and used to end up visiting it first there. Then when we would reach the original code attempting to define that type, we would lose debug info by overwriting its members. By avoiding the possibility of latent "defined with no members" types, we can be sure than whenever we already have a type in a cache (either a definition or declaration), we can just return that. In the case of a full definition, our work is done. In the case of a partial definition, we must already be in the process of completing it. And in the case of a declaration, the completed/vtable/etc callbacks can handle converting it to a definition. llvm-svn: 190122
* Reapply r189013 (reverted in r189906) now that the underlying issue is fixed ↵David Blaikie2013-09-042-42/+32
| | | | | | | | | | | | | | and tested (in r189996) Debug info emission was tripping over an IRGen bug (fixed in r189996) that was resulting in duplicate emission of static data members of class templates in namespaces. We could add more test coverage to debug info for this issue specifically, but I think the underlying IRGen test is more targeted and sufficient for the issue. llvm-svn: 190001
* Do not emit duplicate global initializers for template static data members ↵David Blaikie2013-09-041-1/+6
| | | | | | | | | | | | | | | | | inside namespaces A quirk of AST representation leads to class template static data member definitions being visited twice during Clang IRGen resulting in duplicate (benign) initializers. Discovered while investigating a possibly-related debug info bug tickled by the duplicate emission of these members & their associated debug info. With thanks to Richard Smith for help investigating, understanding, and helping with the fix. llvm-svn: 189996
* Inplement aarch64 neon instructions in AdvSIMD(shift). About 24 shift ↵Hao Liu2013-09-041-37/+110
| | | | | | | | | | instructions: sshr,ushr,ssra,usra,srshr,urshr,srsra,ursra,sri,shl,sli,sqshlu,sqshl,uqshl,shrn,sqrshr$ and 4 convert instructions: scvtf,ucvtf,fcvtzs,fcvtzu llvm-svn: 189926
* Revert "DebugInfo: Remove explicit declaration-emissiong handling now that ↵David Blaikie2013-09-042-32/+42
| | | | | | | | | | | we have a more principled approach (the 'requires complete type' callback)" This reverts commit r189013. This is causing a segfault crash in a test case I have. Reverting while I investigate the issue. llvm-svn: 189906
* Order initializers of static data members of explicit specializationsReid Kleckner2013-09-041-5/+6
| | | | | | | | I tried to implement this properly in r189051, but I didn't have enough test coverage. Richard kindly provided more test cases than I could possibly imagine and now we should have the correct condition. llvm-svn: 189898
* Emit uuid globals as linkonce_odrReid Kleckner2013-09-031-1/+1
| | | | | | Patch by Nico Rieck! llvm-svn: 189860
* Don't emit an available_externally vtable pointing to linkonce_odr funcs.Rafael Espindola2013-09-031-20/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes pr13124. From the discussion at http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-June/022606.html we know that we cannot make funcions in a weak_odr vtable also weak_odr. They should remain linkonce_odr. The side effect is that we cannot emit a available_externally vtable unless we also emit a copy of the function. This also has an issue: If codegen is going to output a function, sema has to mark it used. Given llvm.org/pr9114, it looks like sema cannot be more aggressive at marking functions used because of vtables. This leaves us with a few unpleasant options: * Marking functions in vtables used if possible. This sounds a bit sloppy, so we should avoid it. * Producing available_externally vtables only when all the functions in it are already used or weak_odr. This would cover cases like -------------------- struct foo { virtual ~foo(); }; struct bar : public foo { virtual void zed(); }; void f() { foo *x(new bar); delete x; } void g(bar *x) { x->~bar(); // force the destructor to be used } -------------------------- and ---------------------------------- template<typename T> struct bar { virtual ~bar(); }; template<typename T> bar<T>::~bar() { } // make the destructor weak_odr instead of linkonce_odr extern template class bar<int>; void f() { bar<int> *x(new bar<int>); delete x; } ---------------------------- These look like corner cases, so it is unclear if it is worth it. * And finally: Just nuke this optimization. That is what this patch implements. llvm-svn: 189852
* Revert "OpenMP: Data-sharing attributes analysis and clause 'shared'"Rafael Espindola2013-09-031-4/+2
| | | | | | | | This reverts commit r189795. threadprivate_messages.cpp is faling on windows. llvm-svn: 189811
* OpenMP: Data-sharing attributes analysis and clause 'shared'Alexey Bataev2013-09-031-2/+4
| | | | llvm-svn: 189795
* Revert r189649 because it was breaking sanitizer bots.Yunzhong Gao2013-08-305-58/+48
| | | | llvm-svn: 189660
* Fixing a bug where debug info for a local variable gets emitted at file scope.Yunzhong Gao2013-08-305-48/+58
| | | | | | | The patch was discussed in Phabricator. See: http://llvm-reviews.chandlerc.com/D1281 llvm-svn: 189649
* Add ms_abi and sysv_abi attribute handling.Charles Davis2013-08-301-0/+2
| | | | | | Based on a patch by Benno Rice! llvm-svn: 189644
* Debug Info: generate a unique identifier for C++ struct, class, union, and enum.Manman Ren2013-08-291-6/+37
| | | | | | | | | | | | | | | | We use CXX mangler to generate unique identifier for external C++ struct, union, class and enum. Types with unique identifier are added to retained types by DIBuilder. Testing cases are updated to reflect the unique identifier generated for types. The order of MDNodes is changed because of retained types and testing cases are updated accordingly. Testing case debug-info-uuid.cpp now emits error with Itanium mangler, since uuid is not yet handled in Itanium mangler. And it will check for the error message. llvm-svn: 189622
* Debug Info: this reverts commit r189600.Manman Ren2013-08-291-60/+7
| | | | | | | | We had further discussions on how to retain types, whether to do it in front end or in DIBuilder. And we agree to do it in DIBuilder so front ends generating unique identifier do not need to worry about retaining them. llvm-svn: 189609
* Debug Info: generate a unique identifier for C++ struct, class, union, and enum.Manman Ren2013-08-291-7/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | We use CXX mangler to generate unique identifier for external C++ struct, union, class and enum. Types with unique identifier are added to RetainedTypes to make sure they are treated as used even when all uses are replaced with the identifiers. A single type can be added to RetainedTypes multiple times. For example, both createForwardDecl and createLimitedType can add the same type to RetainedTypes. A set is used to avoid duplication when updating AllRetainTypes in DIBuilder. Testing cases are updated to reflect the unique identifier generated for types. The order of MDNodes is changed because of retained types and testing cases are updated accordingly. Testing case debug-info-uuid.cpp now emits error with Itanium mangler, since uuid is not yet handled in Itanium mangler. We choose to update RetainedTypes in clang, then at finalize(), we update AllRetainTypes in DIBuilder. The other choice is to update AllRetainTypes in DIBuilder when creating a DICompositeType with unique identifier. This option requires using ValueHandle for AllRetainTypes in DIBuilder since the created DICompositeType can be modified later on by setContainingType etc. llvm-svn: 189600
* 80-col.Eric Christopher2013-08-281-4/+9
| | | | llvm-svn: 189531
* DebugInfo: Further fix/improvements to r189494 (and LLVM r189495).David Blaikie2013-08-281-0/+10
| | | | | | | Selfhosting was crashing with the same type of problem but involving template specializations. llvm-svn: 189530
* Format. Thanks David for pointing it out.Manman Ren2013-08-281-1/+1
| | | | llvm-svn: 189521
* Debug Info: update interface for CreateEnumType and getOrCreateRecordFwdDecl.Manman Ren2013-08-282-7/+9
| | | | | | | | | | Both functions will take a Type pointer instead of a Decl pointer. This helps with follow-up type uniquing patches, which need the Type pointer to call CXX mangler to generate unique identifiers. No functionality change. llvm-svn: 189519
* More comments for r189494.David Blaikie2013-08-281-1/+4
| | | | llvm-svn: 189516
* Comments for r189494David Blaikie2013-08-281-0/+5
| | | | llvm-svn: 189504
* PR16995: Failing to associate static members with their enclosing classDavid Blaikie2013-08-281-8/+5
| | | | | | | | | | | | | In the transition from declaration (with some members) to definition, we were overwriting the list of members with the empty list when attaching template parameters. The fix is in llvm::DICompositeType::addMember (along with asserts that cause this bug to be covered by existing Clang test cases), including adding some asserts to catch this sort of issue which found issues fixed in this commit. llvm-svn: 189494
* ARM: comment on why vmull intrinsic has to exist for now.Tim Northover2013-08-281-0/+5
| | | | llvm-svn: 189464
* ARM: Emit normal IR for vaddhn/vsubhn NEON intrinsicsTim Northover2013-08-281-6/+36
| | | | | | | | | | | | | These operations "vector add high-half narrow" actually correspond to the sequence: %sum = add <4 x i32> %lhs, %rhs %high = lshr <4 x i32> %sum, <i32 16, i32 16, i32 16, i32 16> %res = trunc <4 x i32> %high to <4 x i16> Now that LLVM can spot this, Clang should emit the corresponding LLVM IR. llvm-svn: 189463
* ARM: use vqdmull and vqadds/vqsubs to implement vqdmlal/vqdmlslTim Northover2013-08-281-6/+22
| | | | | | | | | | | The NEON intrinsics vqdmlal and vqdmlsl are really just combinations of a saturating-doubling-multiply (vqdmull) and a saturating add/sub, so now that LLVM can spot those patterns Clang should emit them instead of specialised intrinsics. Feature already tested by existing ARM NEON intrinsics tests. llvm-svn: 189462
* Revert "PR14569: Omit debug info for thunks"David Blaikie2013-08-277-25/+24
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit r189320. Alexey Samsonov and Dmitry Vyukov presented some arguments for keeping these around - though it still seems like those tasks could be solved by a tool just using the symbol table. In a very small number of cases, thunks may be inlined & debug info might be able to save profilers & similar tools from misclassifying those cases as part of the caller. The extra changes here plumb through the VarDecl for various cases to CodeGenFunction - this provides better fidelity through a few APIs but generally just causes the CGF::StartFunction to fallback to using the name of the IR function as the name in the debug info. The changes to debug-info-global-ctor-dtor.cpp seem like goodness. The two names that go missing (in favor of only emitting those names as linkage names) are names that can be demangled - emitting them only as the linkage name should encourage tools to do just that. Again, thanks to Dinesh Dwivedi for investigation/work on this issue. llvm-svn: 189421
* Delete CC_Default and use the target default CC everywhereReid Kleckner2013-08-272-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Makes functions with implicit calling convention compatible with function types with a matching explicit calling convention. This fixes things like calls to qsort(), which has an explicit __cdecl attribute on the comparator in Windows headers. Clang will now infer the calling convention from the declarator. There are two cases when the CC must be adjusted during redeclaration: 1. When defining a non-inline static method. 2. When redeclaring a function with an implicit or mismatched convention. Fixes PR13457, and allows clang to compile CommandLine.cpp for the Microsoft C++ ABI. Excellent test cases provided by Alexander Zinenko! Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1231 llvm-svn: 189412
* [-cxx-abi microsoft] Change the vdtor implicit should_call_delete argument ↵Timur Iskhodzhanov2013-08-271-6/+6
| | | | | | type to int llvm-svn: 189336
* PR14569: Omit debug info for thunksDavid Blaikie2013-08-271-0/+1
| | | | | | | | | | | | | | | | | | This was added in r166676 based on PR13942 on the basis that tools may need debug information for any executable code/function for some fairly broad/non-specific purposes. It seems to me (as noted in PR14569) that the major/only purpose is in backtraces, which should generally not apply to thunks as they won't appear in the stack themselves. By removing them we fix PR14569 and reduce the size of Clang's debug info. Strangely enough this doesn't seem to have a substantial impact on Clang's self-hosted debug info (at least looking at DWO file size) size at all. Not sure if I failed to test this correctly but I only observed a 0.004% change in DWO file size over Clang+LLVM. With thanks to Dinesh Dwivedi for work on this PR. llvm-svn: 189320
* Simplify/clean up debug info suppression in CodeGenFunctionDavid Blaikie2013-08-267-69/+23
| | | | | | | | | | CodeGenFunction is run on only one function - a new object is made for each new function. I would add an assertion/flag to this effect, but there's an exception: ObjC properties involve emitting helper functions that are all emitted by the same CodeGenFunction object, so such a check is not possible/correct. llvm-svn: 189277
* Handle predefined expression for a captured statementWei Pan2013-08-261-0/+4
| | | | | | | | | | | - __func__ or __FUNCTION__ returns captured statement's parent function name, not the one compiler generated. Differential Revision: http://llvm-reviews.chandlerc.com/D1491 Reviewed by bkramer llvm-svn: 189219
* CodeGen: Unify two implementations of canDevirtualizeMemberFunctionCall.Benjamin Kramer2013-08-253-139/+25
| | | | | | | | | They were mostly copy&paste of each other, move it to CodeGenFunction. Of course the two implementations have diverged over time; the one in CGExprCXX seems to be the more modern one so I picked that one and moved it to CGClass which feels like a better home for it. No intended functionality change. llvm-svn: 189203
* DebugInfo: Emit info for casted decls in template argsDavid Majnemer2013-08-251-1/+2
| | | | | | | | | | | | | | | | | | Summary: Previously the backend wouldn't get to see the underlying GlobalValue that corresponds to the template argument because it would be hidden by a cast at the IR level. Instead strip the pointer casts off of the value until we see the underlying GlobalValue. Reviewers: dblaikie, echristo, majnemer Reviewed By: majnemer CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1508 llvm-svn: 189200
* DebugInfo: Emit info for constant expressions in template argumentsDavid Majnemer2013-08-241-1/+11
| | | | | | | | | | | | | | | | | | | Summary: This allows us to handle the general case where a non-type template argument evaluates to a constant expression which isn't integral or a declaration. This fixes PR16939. Reviewers: dblaikie, rsmith Reviewed By: dblaikie CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1453 llvm-svn: 189165
* Use pop_back_val() instead of both back() and pop_back().Robert Wilhelm2013-08-231-2/+1
| | | | | | No functionality change intended. llvm-svn: 189112
* Only add this attribute when it's set. If it's not there, the assumption is ↵Bill Wendling2013-08-221-15/+2
| | | | | | that it's off. llvm-svn: 189064
* Add a separate llvm.global_ctors entry for linkonce_odr data initializersReid Kleckner2013-08-221-0/+13
| | | | | | | | | | | | | | | Summary: These typically come from static data members of class template specializations. This accomplishes two things: 1. May expose GlobalOpt optimizations for Itanium C++ ABI code. 2. Works toward fixing double initialization in the Microsoft C++ ABI. CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1475 llvm-svn: 189051
* DebugInfo: emit the definition of types when construction vtables are ↵David Blaikie2013-08-221-3/+6
| | | | | | | | | | required as these types may never end up emitting the full class data This might be able to be optimized further by only doing this in the absence of a key function, but it doesn't look like GCC is doing that so I'm not rushing to do it just yet. llvm-svn: 189022
* DebugInfo: Remove explicit declaration-emissiong handling now that we have a ↵David Blaikie2013-08-222-42/+32
| | | | | | | | more principled approach (the 'requires complete type' callback) No functionality change intended. llvm-svn: 189013
* Revert "Implement a rudimentary form of generic lambdas."Manuel Klimek2013-08-221-1/+1
| | | | | | This reverts commit 606f5d7a99b11957e057e4cd1f55f931f66a42c7. llvm-svn: 189004
* Implement a rudimentary form of generic lambdas.Faisal Vali2013-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically, the following features are not included in this commit: - any sort of capturing within generic lambdas - nested lambdas - conversion operator for captureless lambdas - ensuring all visitors are generic lambda aware As an example of what compiles: template <class F1, class F2> struct overload : F1, F2 { using F1::operator(); using F2::operator(); overload(F1 f1, F2 f2) : F1(f1), F2(f2) { } }; auto Recursive = [](auto Self, auto h, auto ... rest) { return 1 + Self(Self, rest...); }; auto Base = [](auto Self, auto h) { return 1; }; overload<decltype(Base), decltype(Recursive)> O(Base, Recursive); int num_params = O(O, 5, 3, "abc", 3.14, 'a'); Please see attached tests for more examples. Some implementation notes: - Add a new Declarator context => LambdaExprParameterContext to clang::Declarator to allow the use of 'auto' in declaring generic lambda parameters - Augment AutoType's constructor (similar to how variadic template-type-parameters ala TemplateTypeParmDecl are implemented) to accept an IsParameterPack to encode a generic lambda parameter pack. - Add various helpers to CXXRecordDecl to facilitate identifying and querying a closure class - LambdaScopeInfo (which maintains the current lambda's Sema state) was augmented to house the current depth of the template being parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth) so that Sema::ActOnLambdaAutoParameter may use it to create the appropriate list of corresponding TemplateTypeParmDecl for each auto parameter identified within the generic lambda (also stored within the current LambdaScopeInfo). Additionally, a TemplateParameterList data-member was added to hold the invented TemplateParameterList AST node which will be much more useful once we teach TreeTransform how to transform generic lambdas. - SemaLambda.h was added to hold some common lambda utility functions (this file is likely to grow ...) - Teach Sema::ActOnStartOfFunctionDef to check whether it is being called to instantiate a generic lambda's call operator, and if so, push an appropriately prepared LambdaScopeInfo object on the stack. - Teach Sema::ActOnStartOfLambdaDefinition to set the return type of a lambda without a trailing return type to 'auto' in C++1y mode, and teach the return type deduction machinery in SemaStmt.cpp to process either C++11 and C++14 lambda's correctly depending on the flag. - various tests were added - but much more will be needed. A greatful thanks to all reviewers including Eli Friedman, James Dennett and the ever illuminating Richard Smith. And yet I am certain that I have allowed unidentified bugs to creep in; bugs, that I will do my best to slay, once identified! Thanks! llvm-svn: 188977
* DebugInfo: Require only the declaration of types only used as parameter and ↵David Blaikie2013-08-211-2/+2
| | | | | | return types llvm-svn: 188962
* Don't use mangleCXXRTTIName in TBAA for C code.Manman Ren2013-08-211-3/+8
| | | | | | | | | | | With r185721, calling mangleCXXRTTIName on C code will cause crashes. This commit fixes crashes on C testing cases when turning on struct-path TBAA. For C code, we simply use the Decl name without the context. This can cause two different structs having the same name, and may cause inaccurate but conservative alias results. llvm-svn: 188930
* [CGF] Get rid of passing redundant VTable pointer around in ↵Timur Iskhodzhanov2013-08-212-11/+4
| | | | | | CodeGenFunction::InitializeVTablePointer[s] llvm-svn: 188909
OpenPOWER on IntegriCloud