summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCXXABI.h
Commit message (Collapse)AuthorAgeFilesLines
...
* [ms-cxxabi] Implement member pointer conversionsReid Kleckner2013-05-091-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This only supports converting along non-virtual inheritance paths by changing the field offset or the non-virtual base adjustment. This implements three kinds of conversions: - codegen for Value conversions - Constant emission for APValue - Constant folding for CastExprs In almost all constant initialization settings EmitMemberPointer(APValue) is called, except when the expression contains a reinterpret cast. reinterpret casts end up being a big corner case because the null value changes between different kinds of member pointers. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D741 llvm-svn: 181543
* Implement CodeGen for C++11 thread_local, following the Itanium ABI ↵Richard Smith2013-04-191-0/+19
| | | | | | specification as discussed on cxx-abi-dev. llvm-svn: 179858
* Set SRet flags properly in '-cxx-abi microsoft'.Timur Iskhodzhanov2013-04-171-0/+21
| | | | | | | | | Also, - abstract out the indirect/in memory/in registers decisions into the CGCXXABI - fix handling of empty struct arguments for '-cxx-abi microsoft' - add/fix tests llvm-svn: 179681
* CodeGen support for function-local static thread_local variables withRichard Smith2013-04-141-2/+2
| | | | | | | | | non-constant constructors or non-trivial destructors. Plus bugfixes for thread_local references bound to temporaries (the temporaries themselves are lifetime-extended to become thread_local), and the corresponding case for std::initializer_list. llvm-svn: 179496
* [ms-cxxabi] Implement member data pointers for non-dynamic classesReid Kleckner2013-03-221-0/+6
| | | | | | | | | | | | | | | | | | | | Summary: For non-dynamic classes (no virtual bases), member data pointers are simple offsets from the base of the record. Dynamic classes use an aggregate for member data pointers and are therefore currently unsupported. Unlike Itanium, the ms ABI uses 0 to represent null for polymorphic classes. Non-polymorphic classes use -1 like Itanium, since 0 is a valid field offset. Reviewers: rjmccall CC: timurrrr, cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D558 llvm-svn: 177753
* Exploit this-return of a callsite in a this-return function.Manman Ren2013-03-201-1/+6
| | | | | | | | | | | | | | For constructors/desctructors that return 'this', if there exists a callsite that returns 'this' and is immediately before the return instruction, make sure we are using the return value from the callsite. We don't need to keep 'this' alive through the callsite. It also enables optimizations in the backend, such as tail call optimization. Updated from r177211. rdar://12818789 llvm-svn: 177541
* revert r177211 due to its potential issuesManman Ren2013-03-161-6/+1
| | | | llvm-svn: 177222
* Exploit this-return of a callsite in a this-return function.Manman Ren2013-03-161-1/+6
| | | | | | | | | | | | | For constructors/desctructors that return 'this', if there exists a callsite that returns 'this' and is immediately before the return instruction, make sure we are using the return value from the callsite. We don't need to keep 'this' alive through the callsite. It also enables optimizations in the backend, such as tail call optimization. rdar://12818789 llvm-svn: 177211
* Better support for constructors with -cxx-abi microsoft, partly fixes PR12784Timur Iskhodzhanov2013-02-271-0/+10
| | | | llvm-svn: 176186
* Abstract out emitting the vdtor calls and do it properly when using -cxx-abi ↵Timur Iskhodzhanov2013-02-151-0/+8
| | | | | | microsoft; also fix vdtor calls for the ARM ABI llvm-svn: 175271
* Emit virtual/deleting destructors properly with -cxx-abi microsoft, PR15058Timur Iskhodzhanov2013-02-131-2/+11
| | | | llvm-svn: 175045
* Move the decision about the kind of CGCXXABI to make insideJohn McCall2013-01-251-2/+5
| | | | | | the family-specific files. llvm-svn: 173530
* The standard ARM C++ ABI dictates that inline functions areJohn McCall2013-01-251-5/+0
| | | | | | | | never key functions. We did not implement that rule for the iOS ABI, which was driven by what was implemented in gcc-4.2. However, implement it now for other ARM-based platforms. llvm-svn: 173515
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-2/+1
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* PR13684: Emit vtable entries for deleted functions as __cxa_deleted_function.David Blaikie2012-10-161-0/+3
| | | | | | | | This is consistent/interoperable with GCC 4.7 (& __cxa_deleted_function isn't present in 4.4 - not sure when it got added, but you'll need something with that function available for this to work). llvm-svn: 166069
* When performing a ::delete of an object with a virtual destructor,John McCall2012-09-251-0/+9
| | | | | | | | | | | | | | be sure to delete the complete object pointer, not the original pointer. This is necessary if the base being deleted is at a non-zero offset in the complete object. This is only required for objects with virtual destructors because deleting an object via a base-class subobject when the base does not have a virtual destructor is undefined behavior. Noticed while reviewing the last four years of cxx-abi-dev activity. llvm-svn: 164597
* [Windows] Abstract pure virtual method calls in the ABI. Fix the Windows ABI ↵Joao Matos2012-07-171-0/+3
| | | | | | to forward to the correct function. llvm-svn: 160373
* IRGen: Factor v-table generation into the CGCXXABI object.Charles Davis2012-06-231-0/+5
| | | | llvm-svn: 159091
* Documentation cleanup: making \param docs match the code.James Dennett2012-06-221-3/+2
| | | | llvm-svn: 158982
* Documentation cleanup: escape "::" to avoid a Doxygen warningJames Dennett2012-06-201-1/+1
| | | | llvm-svn: 158778
* Documentation fixes: Added \brief markup and fixed some formatting.James Dennett2012-06-151-1/+3
| | | | llvm-svn: 158501
* Abstract the emission of global destructors into ABI-specific codeJohn McCall2012-05-011-0/+7
| | | | | | | | | | | | | and only consider using __cxa_atexit in the Itanium logic. The default logic is to use atexit(). Emit "guarded" initializers in Microsoft mode unconditionally. This is definitely not correct, but it's closer to correct than just not emitting the initializer. Based on a patch by Timur Iskhodzhanov! llvm-svn: 155894
* Refactor the C++ ABI code a little bit to take advantage ofJohn McCall2012-05-011-1/+24
| | | | | | | | what I'm going to treat as basically universal properties of array-cookie code. Implement MS array cookies on top of that. Based on a patch by Timur Iskhodzhanov! llvm-svn: 155886
* Revert r153723, and its follow-ups r153728 and r153733.Chandler Carruth2012-03-301-2/+1
| | | | | | | | | | | | | | | | These patches cause us to miscompile and/or reject code with static function-local variables in an extern-C context. Previously, we were papering over this as long as the variables are within the same translation unit, and had not seen any failures in the wild. We still need a proper fix, which involves mangling static locals inside of an extern-C block (as GCC already does), but this patch causes pretty widespread regressions. Firefox, and many other applications no longer build. Lots of test cases have been posted to the list in response to this commit, so there should be no problem reproducing the issues. llvm-svn: 153768
* Do the static-locals thing properly in the face of unions andJohn McCall2012-03-301-1/+2
| | | | | | other things which might mess with the variable's type. llvm-svn: 153733
* Split reinterpret_casts of member pointers out from CK_BitCast; thisJohn McCall2012-02-151-2/+16
| | | | | | | | | | | | | | | | | | | | | is general goodness because representations of member pointers are not always equivalent across member pointer types on all ABIs (even though this isn't really standard-endorsed). Take advantage of the new information to teach IR-generation how to do these reinterprets in constant initializers. Make sure this works when intermingled with hierarchy conversions (although this is not part of our motivating use case). Doing this in the constant-evaluator would probably have been better, but that would require a *lot* of extra structure in the representation of constant member pointers: you'd really have to track an arbitrary chain of hierarchy conversions and reinterpretations in order to get this right. Ultimately, this seems less complex. I also wasn't quite sure how to extend the constant evaluator to handle foldings that we don't actually want to treat as extended constant expressions. llvm-svn: 150551
* Deal with a horrible C++11 special case. If a non-literal type has a constexprRichard Smith2012-02-131-1/+3
| | | | | | | | | | | constructor, and that constructor is used to initialize an object of static storage duration such that all members and bases are initialized by constant expressions, constant initialization is performed. In this case, the object can still have a non-trivial destructor, and if it does, we must emit a dynamic initializer which performs no initialization and instead simply registers that destructor. llvm-svn: 150419
* Basic support for referring to captured variables from lambdas. Some simple ↵Eli Friedman2012-02-111-2/+2
| | | | | | examples seem to work. Tests coming up soon. llvm-svn: 150293
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | llvm-svn: 149798
* Remove constant member pointer support from Expr-based constant emission nowRichard Smith2012-01-171-5/+0
| | | | | | that APValue-based constant emission knows how to emit member pointers. llvm-svn: 148336
* constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,Richard Smith2012-01-141-0/+3
| | | | | | | | | | | | | | | | | | | | APValue::Array and APValue::MemberPointer. All APValue values can now be emitted as constants. Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other entrypoints dealing with constant member pointers are no longer necessary and will be removed in a later change. Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to VarDecl::evaluateValue. This performs caching and deals with the nasty cases in C++11 where a non-const object's initializer can refer indirectly to previously-initialized fields within the same object. Building the intermediate APValue object incurs a measurable performance hit on pathological testcases with huge initializer lists, so we continue to build IR directly from the Expr nodes for array and record types outside of C++11. llvm-svn: 148178
* clean up forward declarations of raw_ostream to use the new LLVM.hChris Lattner2011-07-231-2/+2
| | | | | | patch by Jon Mulder! llvm-svn: 135851
* now that we have a centralized place to do so, add some using declarations forChris Lattner2011-07-201-2/+2
| | | | | | | some common llvm types: stringref and smallvector. This cleans up the codebase quite a bit. llvm-svn: 135576
* clang side to match the LLVM IR type system rewrite patch.Chris Lattner2011-07-091-1/+1
| | | | llvm-svn: 134831
* After some discussion with Doug, we decided that it made a lot more senseJohn McCall2011-04-121-6/+1
| | | | | | | | | for __unknown_anytype resolution to destructively modify the AST. So that's what it does now, which significantly simplifies some of the implementation. Normal member calls work pretty cleanly now, and I added support for propagating unknown-ness through &. llvm-svn: 129331
* More __unknown_anytype work.John McCall2011-04-111-1/+6
| | | | llvm-svn: 129269
* More capturing of 'this': implicit member expressions. Getting thatJohn McCall2011-02-031-1/+2
| | | | | | | | | | | right for anonymous struct/union members led to me discovering some seemingly broken code in that area of Sema, which I fixed, partly by changing the representation of member pointer constants so that IndirectFieldDecls aren't expanded. This led to assorted cleanups with member pointers in CodeGen, and while I was doing that I saw some random other things to clean up. llvm-svn: 124785
* Do a proper recursive lookup when deciding whether a class's usualJohn McCall2011-01-271-1/+3
| | | | | | | | | deallocation function has a two-argument form. Store the result of this check in new[] and delete[] nodes. Fixes rdar://problem/8913519 llvm-svn: 124373
* Move name mangling support from CodeGen to AST. In thePeter Collingbourne2011-01-131-3/+7
| | | | | | | | | | | | | | process, perform a number of refactorings: - Move MiscNameMangler member functions to MangleContext - Remove GlobalDecl dependency from MangleContext - Make MangleContext abstract and move Itanium/Microsoft functionality to their own classes/files - Implement ASTContext::createMangleContext and have CodeGen use it No (intended) functionality change. llvm-svn: 123386
* Make the destructor be the 'vtable anchor' of the CGCXXABI class.Anders Carlsson2010-11-281-3/+1
| | | | llvm-svn: 120251
* Simplify the logic for emitting guard variables for template staticJohn McCall2010-11-061-5/+8
| | | | | | | | | data members by delaying the emission of the initializer until after linkage and visibility have been set on the global. Also, don't emit a guard unless the variable actually ends up with vague linkage, and don't use thread-safe statics in any case. llvm-svn: 118336
* Implement ARM static local initialization guards, which are more compact thanJohn McCall2010-09-081-1/+11
| | | | | | Itanium guards and use a slightly different compiled-in API. llvm-svn: 113330
* Abstract IR generation of array cookies into the C++ ABI class andJohn McCall2010-09-021-0/+47
| | | | | | | | | | | | | | implement ARM array cookies. Also fix a few unfortunate bugs: - throwing dtors in deletes prevented the allocation from being deleted - adding the cookie to the new[] size was not being considered for overflow (and, more seriously, was screwing up the earlier checks) - deleting an array via a pointer to array of class type was not causing any destructors to be run and was passing the unadjusted pointer to the deallocator - lots of address-space problems, in case anyone wants to support free store in a variant address space :) llvm-svn: 112814
* Amusingly, I missed this point of abstraction in all my earlierJohn McCall2010-08-311-0/+6
| | | | | | member-pointer refactoring: dereferencing a member data pointer. llvm-svn: 112640
* Teach IR generation to return 'this' from constructors and destructorsJohn McCall2010-08-311-2/+67
| | | | | | under the ARM ABI. llvm-svn: 112588
* Abstract out everything having to do with member pointers into the ABIJohn McCall2010-08-231-22/+37
| | | | | | | | | | | class; they should just be completely opaque throughout IR gen now, although I haven't really audited that. Fix a bug apparently inherited from gcc-4.2 where we failed to null-check member data pointers when performing derived-to-base or base-to-derived conversions on them. llvm-svn: 111789
* Go back to asking CodeGenTypes whether a type is zero-initializable.John McCall2010-08-221-4/+4
| | | | | | | | | Make CGT defer to the ABI on all member pointer types. This requires giving CGT a handle to the ABI. It's way easier to make that work if we avoid lazily creating the ABI. Make it so. llvm-svn: 111786
* Experiment with using first-class aggregates to represent member functionJohn McCall2010-08-221-15/+10
| | | | | | | | | | pointers. I find the resulting code to be substantially cleaner, and it makes it very easy to use the same APIs for data member pointers (which I have conscientiously avoided here), and it avoids a plethora of potential inefficiencies due to excessive memory copying, but we'll have to see if it actually works. llvm-svn: 111776
* Extract member function pointer comparison and null comparison intoJohn McCall2010-08-221-0/+12
| | | | | | | | | | | | the ABI code. Implement correct semantics for these on ARM. I believe this completes the implementation of member function pointers on ARM. I think I'm going to switch member function pointers over to be non-aggregates while I have all this in mind. llvm-svn: 111774
* Abstract out member-pointer creation. I'm really unhappy about the currentJohn McCall2010-08-221-0/+7
| | | | | | | | duplication between the constant and non-constant paths in all of this. Implement ARM ABI semantics for member pointer constants and conversion. llvm-svn: 111772
OpenPOWER on IntegriCloud