summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* Revert r184205 and associated patches while investigating issue with broken ↵Stephen Lin2013-06-1910-135/+208
| | | | | | | | buildbot (possible interaction with LTO) <rdar://problem/14209661> llvm-svn: 184384
* Debug Info: PR14763/r183329 - specify that non-trivial pass-by-value ↵David Blaikie2013-06-191-0/+3
| | | | | | | | | | parameters are stored indirectly This is to fix the location information for such parameters to refer to the object accessible through the pointer rather than to the pointer parameter itself. llvm-svn: 184367
* Corrections to r184205 ('this'-return optimization) due to the wrong version ↵Stephen Lin2013-06-195-89/+75
| | | | | | | | | of the patch being committed originally. 1) Removed useless return value of CGCXXABI::EmitConstructorCall and CGCXXABI::EmitVirtualDestructorCall and implementations 2) Corrected last portion of CodeGenCXX/constructor-destructor-return-this to correctly test for non-'this'-return of virtual destructor calls llvm-svn: 184330
* [CodeGen] Move EHScopeStack into its own headerReid Kleckner2013-06-193-463/+498
| | | | | | | CGCleanup.h isn't meant to be included by all of CodeGen according to John. llvm-svn: 184321
* [ms-cxxabi] Emit and install appropriately mangled vbtablesReid Kleckner2013-06-199-18/+461
| | | | | | | | | | | | | | | | | | | | | | | | | In Itanium, dynamic classes have one vtable with several different address points for dynamic base classes that can't share vtables. In the MS C++ ABI, each vbtable that can't be shared gets its own symbol, similar to how ctor vtables work in Itanium. However, instead of mangling the subobject offset into the symbol, the unique portions of the inheritance path are mangled into the symbol to make it unique. This patch implements the MSVC 2012 scheme for forming unique vbtable symbol names. MSVC 2010 use the same mangling with a different subset of the path. Implementing that mangling and possibly others is TODO. Each vbtable is an array of i32 offsets from the vbptr that points to it to another virtual base subobject. The first entry of a vbtable always points to the base of the current subobject, implying that it is the same no matter which parent class contains it. Reviewers: rjmccall Differential Revision: http://llvm-reviews.chandlerc.com/D636 llvm-svn: 184309
* Fix a warning. [-Wunused-variable]NAKAMURA Takumi2013-06-191-2/+2
| | | | llvm-svn: 184284
* Debug Info: support for gdwarf-2 gdwarf-3 gdwarf-4Manman Ren2013-06-191-0/+5
| | | | | | | | These options will add a module flag with name "Dwarf Version". The behavior flag is currently set to Warning, so when two values disagree, a warning will be emitted. llvm-svn: 184276
* Add some comments to r184252.Adrian Prantl2013-06-181-0/+5
| | | | | | rdar://problem/14101097 llvm-svn: 184259
* Emit forward decls for structs with declarations only when we areAdrian Prantl2013-06-181-1/+1
| | | | | | | | | | limiting debug info. FIXME: There is still work left to do here, the testcase should work even with -flimit-debug-info. rdar://problem/14101097 llvm-svn: 184252
* [multiprecision-builtins] Added missing builtin __builtin_{add,sub}cb for ↵Michael Gottesman2013-06-181-0/+4
| | | | | | | | | | | | | | {add,sub} with carry for bytes. I have had several people ask me about why this builtin was not available in clang (since it seems like a logical conclusion). This patch implements said builtins. Relevant tests are included as well. I also updated the Clang language extension reference. rdar://14192664. llvm-svn: 184227
* CodeGen: Have 'this'-returning constructors and destructors to take ↵Stephen Lin2013-06-189-175/+116
| | | | | | | | | | advantage of the new backend 'returned' attribute. The backend will now use the generic 'returned' attribute to form tail calls where possible, as well as avoid save-restores of 'this' in some cases (specifically the cases that matter for the ARM C++ ABI). This patch also reverts a prior front-end only partial implementation of these optimizations, since it's no longer required. llvm-svn: 184205
* Add support for -fpcc-struct-return. Patch by Arthur O'Dwyer!John McCall2013-06-181-22/+47
| | | | llvm-svn: 184166
* Remove an ugly hack that was meant to eliminate the breakpoint ambiguityAdrian Prantl2013-06-181-4/+1
| | | | | | | | | | | | | | between a block assignment and the entry of the block function. In reality this wouldn't work anyway because blocks are predominantly created on-the-fly inside of an ObjC method invocation. The proper fix for the ambiguity is to use -gcolumn-info to differentiate the breakpoints. This is expected to break some block-related darwin-gdb tests. rdar://problem/14039866 llvm-svn: 184157
* Compute the visibility of static local variables consistently. Fixes PR16208.Eli Friedman2013-06-171-2/+1
| | | | llvm-svn: 184137
* Cleanup linkage computation for static locals.Rafael Espindola2013-06-171-5/+3
| | | | | | | With this patch we assign VisibleNoLinkage to static locals in inline functions. This lets us simplify CodeGen a bit. llvm-svn: 184114
* Emit initializers for static-storage-duration temporaries as constants whereRichard Smith2013-06-142-16/+43
| | | | | | possible. llvm-svn: 183967
* Fix the linkage of static locals inside a CapturedStmt. (Found in theEli Friedman2013-06-133-4/+27
| | | | | | process of trying to fix the related issue for block literals.) llvm-svn: 183951
* Simplify: we don't need any special-case lifetime extension when initializingRichard Smith2013-06-127-62/+36
| | | | | | | declarations of reference type; they're handled by the general case handling of MaterializeTemporaryExpr. llvm-svn: 183875
* PR12086, PR15117Richard Smith2013-06-129-342/+95
| | | | | | | | | | | | | | | | | | | Introduce CXXStdInitializerListExpr node, representing the implicit construction of a std::initializer_list<T> object from its underlying array. The AST representation of such an expression goes from an InitListExpr with a flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr). This more detailed representation has several advantages, the most important of which is that the new MaterializeTemporaryExpr allows us to directly model lifetime extension of the underlying temporary array. Using that, this patch *drastically* simplifies the IR generation of this construct, provides IR generation support for nested global initializer_list objects, fixes several bugs where the destructors for the underlying array would accidentally not get invoked, and provides constant expression evaluation support for std::initializer_list objects. llvm-svn: 183872
* Reapply r183721, reverted in r183776, with a fix for a bug in the former (weRichard Smith2013-06-126-270/+300
| | | | | | | | | | | | | | | | | | | | | | | were lacking ExprWithCleanups nodes in some cases where the new approach to lifetime extension needed them). Original commit message: Rework IR emission for lifetime-extended temporaries. Instead of trying to walk into the expression and dig out a single lifetime-extended entity and manually pull its cleanup outside the expression, instead keep a list of the cleanups which we'll need to emit when we get to the end of the full-expression. Also emit those cleanups early, as EH-only cleanups, to cover the case that the full-expression does not terminate normally. This allows IR generation to properly model temporary lifetime when multiple temporaries are extended by the same declaration. We have a pre-existing bug where an exception thrown from a temporary's destructor does not clean up lifetime-extended temporaries created in the same expression and extended to automatic storage duration; that is not fixed by this patch. llvm-svn: 183859
* Silencing a signed vs unsigned comparison mismatch in MSVC.Aaron Ballman2013-06-121-1/+2
| | | | llvm-svn: 183837
* Add support for complex compound assignments where the LHS is a scalar.Eli Friedman2013-06-123-43/+68
| | | | | | Fixes <rdar://problem/11224126> and PR12790. llvm-svn: 183821
* Make va_arg and argument passing to varargs functions work correctly withEli Friedman2013-06-121-14/+35
| | | | | | | | AVX vectors when AVX is turned on. Fixes <rdar://problem/10513611>. llvm-svn: 183813
* Revert r183721. It caused cleanups to be delayed too long in some cases.Richard Smith2013-06-115-298/+270
| | | | | | Testcase to follow. llvm-svn: 183776
* Silence GCC warning.Benjamin Kramer2013-06-111-0/+1
| | | | llvm-svn: 183742
* Rework IR emission for lifetime-extended temporaries. Instead of trying to walkRichard Smith2013-06-115-270/+297
| | | | | | | | | | | | | | | | | into the expression and dig out a single lifetime-extended entity and manually pull its cleanup outside the expression, instead keep a list of the cleanups which we'll need to emit when we get to the end of the full-expression. Also emit those cleanups early, as EH-only cleanups, to cover the case that the full-expression does not terminate normally. This allows IR generation to properly model temporary lifetime when multiple temporaries are extended by the same declaration. We have a pre-existing bug where an exception thrown from a temporary's destructor does not clean up lifetime-extended temporaries created in the same expression and extended to automatic storage duration; that is not fixed by this patch. llvm-svn: 183721
* Fix a very silly mistake in r183590.Eli Friedman2013-06-111-1/+0
| | | | llvm-svn: 183720
* Fix a FIXME in a testcase about packed structs and calls I left aroundEli Friedman2013-06-111-1/+10
| | | | | | | | | while fixing a related bug. The fix here was simpler than I thought it would be. Fixes <rdar://problem/10530444>. llvm-svn: 183718
* Make sure we don't emit invalid IR for StmtExprs with complex cleanups.Eli Friedman2013-06-104-18/+36
| | | | | | Fixes <rdar://problem/14074868>. llvm-svn: 183699
* [CodeGen] Make CGCleanup.h include what it now usesReid Kleckner2013-06-092-7/+4
| | | | | | | Also move CGCleanup.h to the top of CGCleanup.cpp to verify that CGCleanup.h really includes what it needs. llvm-svn: 183632
* [CodeGen] Move EHScopeStack to CGCleanup.h from CodeGenFunction.hReid Kleckner2013-06-092-454/+458
| | | | | | | | | | No functionality change. CGCleanup.cpp provides the implementation for EHScopeStack, so it seems more consistent to place the class definition in CGCleanup.h. This should also help solve a header ordering problem that I have. llvm-svn: 183631
* Fixed comment typo.Michael Gottesman2013-06-081-1/+1
| | | | llvm-svn: 183598
* Debug info: An if condition now creates a lexical scope of its own.Adrian Prantl2013-06-081-0/+10
| | | | | | | | | Two variables with the same name declared in two if conditions in the same scope are no longer coalesced into one. rdar://problem/14024005 llvm-svn: 183597
* Fix va_arg on x86-64 for a struct containing a single int128_t. PR16248Eli Friedman2013-06-071-4/+17
| | | | llvm-svn: 183590
* 80-column fixup after recent change to getOrCreateType.Eric Christopher2013-06-071-15/+20
| | | | llvm-svn: 183586
* Fix line endings.Eli Friedman2013-06-071-2/+2
| | | | llvm-svn: 183583
* address some comments on r183474:Adrian Prantl2013-06-071-6/+1
| | | | | | | | | | - factor the name construction part out from constructSetterName - rename constructSetterName to the more appropriate constructSetterSelector no functionality change intended. rdar://problem/14035789 llvm-svn: 183582
* documentation: remove confusing reference to properties.Adrian Prantl2013-06-071-3/+3
| | | | llvm-svn: 183475
* ObjC Debug Info: Emit the names of accessors whenever they diverge fromAdrian Prantl2013-06-071-4/+34
| | | | | | | | the default names, not just when the isImplicit flag is set. rdar://problem/14035789 llvm-svn: 183474
* Improve documentation.Adrian Prantl2013-06-071-6/+12
| | | | llvm-svn: 183473
* Diagnose malformed x86 inline asm using 'y' constraint.Tim Northover2013-06-073-5/+27
| | | | | | | | X86's 'y' inline assembly constraint represents an MMX register, this change prevents Clang from hitting an assertion when passed an incompatible type to deal with. llvm-svn: 183467
* PR14763: Debug info for non-trivial record parametersDavid Blaikie2013-06-051-16/+0
| | | | | | | | | | There seems to have been some erroneous code attempting to describe the ABI of parameters (non-trivial record parameters are passed by reference). This would break the type of the function (especially when it caused a mismatch between the type of a declaration & a definition) causing PR14763 and PR14645. llvm-svn: 183329
* [ms-cxxabi] Thread GlobalDecls through to CodeGenModule::getFunctionLinkage.Peter Collingbourne2013-06-054-18/+18
| | | | | | | | This is so that we can give destructor variants different linkage later. Differential Revision: http://llvm-reviews.chandlerc.com/D819 llvm-svn: 183324
* [ms-cxxabi] Fix vbptr offsets in memptrs when the vbptr is in an nvbaseReid Kleckner2013-06-051-6/+2
| | | | | | | | Also addresses a review comment from John from on r180985 by removing the "== -1" check, since it's now reusing the correct code which has the comment. llvm-svn: 183318
* PR16214: Debug Info: -flimit-debug-info doesn't omit definitions for types ↵David Blaikie2013-06-052-38/+26
| | | | | | | | | | | | | | | | | | | | used via typedefs In an effort to make -flimit-debug-info more consistent I over-shot the mark & made types used via typedefs never produce definitions in the debug info (even if the type was used in a way that would require a definition). The fix for this is to do exactly what I was hoping to do at some point - plumb the declaration/definition choice through the various layers of "CreateType" in CGDebugInfo. In this way we can produce declarations whenever they are sufficient & definitions otherwise - including when qualifiers are used, for example (discovered in PR14467). This may not be complete (there may be other types/situations where we need to propagate the "declaration/definition" choice) but it lays the basic foundation which we can enhance in future iterations. llvm-svn: 183296
* Implement SparcV9ABIInfo::EmitVAArg.Jakob Stoklund Olesen2013-06-051-2/+46
| | | | | | | | | | | | This could actually be implemented with the LLVM IR va_arg instruction, but it doesn't seem to offer any advantages over accessing the va_list pointer directly. Using the va_list pointer directly makes it possible to perform type coercion directly from the argument array, and the va_list updates are exposed to the optimizers. llvm-svn: 183292
* Fix CoerceIntOrPtrToIntOrPtr on big-endian targets.Jakob Stoklund Olesen2013-06-051-2/+23
| | | | | | | | | | | | | | | | Type coercion for argument passing is equivalent to storing the source type and loading the destination type from the same pointer. On big-endian targets, this means that the high bits of integers are preserved. This patch fixes the CoerceIntOrPtrToIntOrPtr() function on big-endian targets by inserting the required shift instructions to preserve the high bits instead of the low bits. This is used by SparcABIInfo when passing small structs in the high bits of registers. llvm-svn: 183291
* Heed ABIArgInfo::getInReg() for return values.Jakob Stoklund Olesen2013-06-051-1/+4
| | | | | | | | The 'inreg' attribute can also be applied to function return values in LLVM IR. The SPARC v9 backend is using the flag when returning structs containing 32-bit floats. llvm-svn: 183290
* Model temporary lifetime-extension explicitly in the AST. Use this model toRichard Smith2013-06-053-2/+74
| | | | | | | | | handle temporaries which have been lifetime-extended to static storage duration within constant expressions. This correctly handles nested lifetime extension (through reference members of aggregates in aggregate initializers) but non-constant-expression emission hasn't yet been updated to do the same. llvm-svn: 183283
* [ms-cxxabi] Factor out some loops into helpers for readabilityReid Kleckner2013-06-041-29/+33
| | | | | | | No functionality change, covered by the existing virtual base adjustment tests. llvm-svn: 183251
OpenPOWER on IntegriCloud