summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/ItaniumCXXABI.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement CodeGen for C++11 thread_local, following the Itanium ABI ↵Richard Smith2013-04-191-0/+143
| | | | | | specification as discussed on cxx-abi-dev. llvm-svn: 179858
* Set SRet flags properly in '-cxx-abi microsoft'.Timur Iskhodzhanov2013-04-171-0/+14
| | | | | | | | | 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
* Standardize accesses to the TargetInfo in IR-gen.John McCall2013-04-161-1/+1
| | | | | | Patch by Stephen Lin! llvm-svn: 179638
* CodeGen support for function-local static thread_local variables withRichard Smith2013-04-141-11/+18
| | | | | | | | | 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
* [cxxabi] Get ptrdiff_t from the CodeGenModule instead of caching itReid Kleckner2013-03-221-32/+16
| | | | | | As the comment says, it's a little silly to cache it in the ABI code. llvm-svn: 177738
* Exploit this-return of a callsite in a this-return function.Manman Ren2013-03-201-5/+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/+5
| | | | llvm-svn: 177222
* Exploit this-return of a callsite in a this-return function.Manman Ren2013-03-161-5/+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
* Use the actual ABI-determined C calling convention for runtimeJohn McCall2013-02-281-5/+5
| | | | | | | | | | | | | | | | | | | | | | calls and declarations. LLVM has a default CC determined by the target triple. This is not always the actual default CC for the ABI we've been asked to target, and so we sometimes find ourselves annotating all user functions with an explicit calling convention. Since these calling conventions usually agree for the simple set of argument types passed to most runtime functions, using the LLVM-default CC in principle has no effect. However, the LLVM optimizer goes into histrionics if it sees this kind of formal CC mismatch, since it has no concept of CC compatibility. Therefore, if this module happens to define the "runtime" function, or got LTO'ed with such a definition, we can miscompile; so it's quite important to get this right. Defining runtime functions locally is quite common in embedded applications. llvm-svn: 176286
* Better support for constructors with -cxx-abi microsoft, partly fixes PR12784Timur Iskhodzhanov2013-02-271-0/+25
| | | | llvm-svn: 176186
* Abstract out emitting the vdtor calls and do it properly when using -cxx-abi ↵Timur Iskhodzhanov2013-02-151-0/+24
| | | | | | microsoft; also fix vdtor calls for the ARM ABI llvm-svn: 175271
* Add support for AArch64 target.Tim Northover2013-01-311-3/+11
| | | | | | | | | | | | | In cooperation with the LLVM patch, this should implement all scalar front-end parts of the C and C++ ABIs for AArch64. This patch excludes the NEON support also reviewed due to an outbreak of batshit insanity in our legal department. That will be committed soon bringing the changes to precisely what has been approved. Further reviews would be gratefully received. llvm-svn: 174055
* Make sure that the Attribute object represents one attribute only.Bill Wendling2013-01-311-3/+6
| | | | | | | | Several places were still treating the Attribute object as respresenting multiple attributes. Those places now use the AttributeSet to represent multiple attributes. llvm-svn: 174004
* ARM says that the array cookie should always be eight bytes.John McCall2013-01-251-25/+21
| | | | | | | ARM is not thinking about over-aligned structures. Overrule ARM in both our generic-ARM and iOS ABI implementations. llvm-svn: 173531
* Move the decision about the kind of CGCXXABI to make insideJohn McCall2013-01-251-5/+14
| | | | | | the family-specific files. llvm-svn: 173530
* The standard ARM C++ ABI dictates that inline functions areJohn McCall2013-01-251-7/+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
* Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate toChandler Carruth2013-01-021-3/+3
| | | | | | | | reflect the migration in r171366. Re-sort the #include lines to reflect the new paths. llvm-svn: 171369
* Rename llvm::Attributes to llvm::Attribute.Bill Wendling2012-12-201-6/+6
| | | | llvm-svn: 170722
* Revert r170500. It over-zealously converted *ALL* things named Attributes, ↵Bill Wendling2012-12-201-6/+6
| | | | | | which is wrong here. llvm-svn: 170721
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-191-6/+6
| | | | | | single attribute in the future. llvm-svn: 170500
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+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
* Simplify: replace getContext().getLangOpts() with just getLangOpts().Richard Smith2012-11-011-1/+1
| | | | llvm-svn: 167261
* Cleanup some clang code to use new type functions instead of using cast<>.Micah Villmow2012-10-251-5/+5
| | | | llvm-svn: 166684
* PR13684: Emit vtable entries for deleted functions as __cxa_deleted_function.David Blaikie2012-10-161-0/+1
| | | | | | | | 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
* Use the Attributes::get method which takes an AttrVal value directly to ↵Bill Wendling2012-10-161-9/+3
| | | | | | simplify the code a bit. No functionality change. llvm-svn: 166010
* Move the Attributes::Builder outside of the Attributes class and into its ↵Bill Wendling2012-10-151-3/+3
| | | | | | own class named AttrBuilder. No functionality change. llvm-svn: 165961
* Attributes RewriteBill Wendling2012-10-151-3/+6
| | | | | | | | Convert the uses of the Attributes class over to the new format. The Attributes::get method call now takes an LLVM context so that the attributes object can be uniquified and stored. llvm-svn: 165918
* Remove the final bits of Attributes being declared in the AttributeBill Wendling2012-10-101-6/+9
| | | | | | | namespace. Use the attribute's enum value instead. No functionality change intended. llvm-svn: 165611
* Move TargetData to DataLayout.Micah Villmow2012-10-081-1/+1
| | | | llvm-svn: 165395
* When performing a ::delete of an object with a virtual destructor,John McCall2012-09-251-0/+23
| | | | | | | | | | | | | | 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
* Fix includes of llvm and clang files that used angle brackets.Craig Topper2012-09-151-5/+5
| | | | llvm-svn: 163980
* [Windows] Abstract pure virtual method calls in the ABI. Fix the Windows ABI ↵Joao Matos2012-07-171-0/+2
| | | | | | to forward to the correct function. llvm-svn: 160373
* IRGen: Factor v-table generation into the CGCXXABI object.Charles Davis2012-06-231-0/+8
| | | | llvm-svn: 159091
* Abstract the emission of global destructors into ABI-specific codeJohn McCall2012-05-011-0/+54
| | | | | | | | | | | | | 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-148/+45
| | | | | | | | 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
* Make sure we unique static-local decls across multiple emissions ofJohn McCall2012-03-301-34/+42
| | | | | | | | the function body, but do so in a way that doesn't make any assumptions about the static local actually having a proper, unique mangling, since apparently we don't do that correctly at all. llvm-svn: 153776
* Revert r153723, and its follow-ups r153728 and r153733.Chandler Carruth2012-03-301-59/+35
| | | | | | | | | | | | | | | | 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-9/+15
| | | | | | other things which might mess with the variable's type. llvm-svn: 153733
* ItaniumCXXABI.cpp: Don't use nullptr. Clang source tree should be ↵NAKAMURA Takumi2012-03-301-1/+1
| | | | | | pre-c++11-compatible. llvm-svn: 153728
* When emitting a static local variable in C++, handleJohn McCall2012-03-301-31/+49
| | | | | | | | | | | | | | | the case that the variable already exists. Partly this is just protection against people making crazy declarations with custom asm labels or extern "C" names that intentionally collide with the manglings of such variables, but the main reason is that we can actually emit a static local variable twice with the requirement that it match up. There may be other cases with (e.g.) the various nested functions, but the main exemplar is with constructor variants, where we can be forced into double-emitting the function body under certain circumstances like (currently) the presence of virtual bases. llvm-svn: 153723
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-2/+2
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Whether an argument is required (in contrast with being anJohn McCall2012-02-171-4/+3
| | | | | | | | | | | | | | | | | | | | | optional argument passed through the variadic ellipsis) potentially affects how we need to lower it. Propagate this information down to the various getFunctionInfo(...) overloads on CodeGenTypes. Furthermore, rename those overloads to clarify their distinct purposes, and make sure we're calling the right one in the right place. This has a nice side-effect of making it easier to construct a function type, since the 'variadic' bit is no longer separable. This shouldn't really change anything for our existing platforms, with one minor exception --- we should now call variadic ObjC methods with the ... in the "right place" (see the test case), which I guess matters for anyone running GNUStep on MIPS. Mostly it's just a substantial clean-up. llvm-svn: 150788
* Split reinterpret_casts of member pointers out from CK_BitCast; thisJohn McCall2012-02-151-38/+84
| | | | | | | | | | | | | | | | | | | | | 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
* Mark the cxa_guard_{abort,acquire,release} functions nounwind.Nick Lewycky2012-02-131-3/+6
| | | | llvm-svn: 150435
* Deal with a horrible C++11 special case. If a non-literal type has a constexprRichard Smith2012-02-131-3/+4
| | | | | | | | | | | 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-1/+1
| | | | | | examples seem to work. Tests coming up soon. llvm-svn: 150293
* simplify a bunch of code to use the well-known LLVM IR types computed by ↵Chris Lattner2012-02-071-4/+2
| | | | | | CodeGenModule. llvm-svn: 149943
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Remove constant member pointer support from Expr-based constant emission nowRichard Smith2012-01-171-84/+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-3/+46
| | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud