summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Refuse to compile global std::initializer_lists instead of doing completely ↵Sebastian Redl2012-02-191-0/+5
| | | | | | the wrong thing. llvm-svn: 150928
* Get recursive initializer lists to work and add a test. Codegen of ↵Sebastian Redl2012-02-192-13/+43
| | | | | | std::initializer_list is now complete. Onward to array new. llvm-svn: 150926
* Remove dead code.Ahmed Charles2012-02-191-6/+2
| | | | llvm-svn: 150919
* Fix wrong-code bug: __imag on a scalar lvalue should produce a zero rvalue,Richard Smith2012-02-182-4/+8
| | | | | | rather than an lvalue referring to the scalar. llvm-svn: 150889
* Fix comment.Chad Rosier2012-02-181-1/+1
| | | | llvm-svn: 150859
* Add in a caching mechanism so that forward declarations are replacedEric Christopher2012-02-182-9/+38
| | | | | | | | with full types if they exist. rdar://10809898 and rdar://10209967 and rdar://10400981 llvm-svn: 150858
* Formatting.Eric Christopher2012-02-181-2/+1
| | | | llvm-svn: 150857
* Remove UpdateCompletedType from the debug info emission. We nowEric Christopher2012-02-183-20/+0
| | | | | | | emit less than complete types on purpose on occasion and so our caches aren't useful for this kind of lazy emitting. llvm-svn: 150856
* Remove redundant check.Chad Rosier2012-02-181-3/+2
| | | | llvm-svn: 150855
* Don't emit optimization-specific intrinsic at -O0.Richard Smith2012-02-171-0/+4
| | | | llvm-svn: 150838
* Basic code generation support for std::initializer_list.Sebastian Redl2012-02-173-132/+266
| | | | | | | | | | | | | | | | | | | | | | | We now generate temporary arrays to back std::initializer_list objects initialized with braces. The initializer_list is then made to point at the array. We support both ptr+size and start+end forms, although the latter is untested. Array lifetime is correct for temporary std::initializer_lists (e.g. call arguments) and local variables. It is untested for new expressions and member initializers. Things left to do: Massively increase the amount of testing. I need to write tests for start+end init lists, temporary objects created as a side effect of initializing init list objects, new expressions, member initialization, creation of temporary objects (e.g. std::vector) for initializer lists, and probably more. Get lifetime "right" for member initializers and new expressions. Not that either are very useful. Implement list-initialization of array new expressions. llvm-svn: 150803
* The clang half of r150794: after the construction of a global or static constRichard Smith2012-02-171-1/+17
| | | | | | | | variable ends, if the variable has a trivial destructor and no mutable subobjects then emit an llvm.invariant.start call for it. globalopt knows to make the variable const when evaluating this. llvm-svn: 150798
* Index "12" holds the vtable, not "9".Eric Christopher2012-02-171-1/+1
| | | | | | Fixes lots of gdb testsuite failures. llvm-svn: 150797
* Bug fix: do not emit static const local variables with mutable membersRichard Smith2012-02-173-30/+30
| | | | | | | | | as constants. Refactor and simplify all the separate checks for whether a type can be emitted as a constant. llvm-svn: 150793
* When performing IRGen on a global, emit it as a constant if:Richard Smith2012-02-171-1/+0
| | | | | | | | | | | 1) It has a const-qualified type, and 2) It has no mutable members, and 3) It has no dynamic initialization, and 4) It has trivial destruction. Remove the unnecessary requirement that the type be POD. This allows us to mark all constexpr objects with no mutable members as 'constant'. llvm-svn: 150792
* Whether an argument is required (in contrast with being anJohn McCall2012-02-1722-417/+671
| | | | | | | | | | | | | | | | | | | | | 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
* Rework the Sema/AST/IRgen dance for the lambda closure type'sDouglas Gregor2012-02-173-62/+20
| | | | | | | | | | | | | | | | | | | | conversion to function pointer. Rather than having IRgen synthesize the body of this function, we instead introduce a static member function "__invoke" with the same signature as the lambda's operator() in the AST. Sema then generates a body for the conversion to function pointer which simply returns the address of __invoke. This approach makes it easier to evaluate a call to the conversion function as a constant, makes the linkage of the __invoke function follow the normal rules for member functions, and may make life easier down the road if we ever want to constexpr'ify some of lambdas. Note that IR generation is responsible for filling in the body of __invoke (Sema just adds a dummy body), because the body can't generally be expressed in C++. Eli, please review! llvm-svn: 150783
* Reapply r150631:Eric Christopher2012-02-162-103/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Add a completed/incomplete type difference. This allows us to have partial types for contexts and forward decls while allowing us to complete types later on for debug purposes. This piggy-backs on the metadata replacement and rauw changes for temporary nodes and takes advantage of the incremental support I added in earlier. This allows us to, if we decide, to limit adding methods and variables to structures in order to limit the amount of debug information output into a .o file. The caching is a bit complicated though so any thoughts on untangling that are welcome." with a fix: - Remove all RAUW during type construction by adding stub versions of types that we later complete. and some TODOs: - Add an RAUW cache for forward declared types so that we can replace them at the end of compilation. - Remove the code that updates on completed types because we no longer need to have that happen. We emit incomplete types on purpose and only want to know when we want to complete them. llvm-svn: 150752
* Elide copy construction in new expressions. PR11757.Eli Friedman2012-02-161-14/+0
| | | | llvm-svn: 150738
* Revert "Revert "Make CXXNewExpr contain only a single initialier, and not ↵Sebastian Redl2012-02-161-29/+22
| | | | | | | | hold the used constructor itself."" This reintroduces commit r150682 with a fix for the Bullet benchmark crash. llvm-svn: 150685
* Revert "Make CXXNewExpr contain only a single initialier, and not hold the ↵Sebastian Redl2012-02-161-22/+29
| | | | | | | | | | used constructor itself." It leads to a compiler crash in the Bullet benchmark. This reverts commit r12014. llvm-svn: 150684
* Make CXXNewExpr contain only a single initialier, and not hold the used ↵Sebastian Redl2012-02-161-29/+22
| | | | | | | | | | constructor itself. Holding the constructor directly makes no sense when list-initialized arrays come into play. The constructor is now held in a CXXConstructExpr, if construction is what is done. The new design can also distinguish properly between list-initialization and direct-initialization, as well as implicit default-initialization constructors and explicit value-initialization constructors. Finally, doing it this way removes redundance from the AST because CXXNewExpr doesn't try to handle both the allocation and the initialization responsibilities. This breaks the static analysis of new expressions. I've filed PR12014 to track this. llvm-svn: 150682
* Initial implementation of IRGen for the lambda ↵Eli Friedman2012-02-162-1/+97
| | | | | | conversion-to-function-pointer operator. llvm-svn: 150660
* Start of IRGen for lambda conversion operators.Eli Friedman2012-02-163-0/+20
| | | | llvm-svn: 150649
* Use the new method for specifying garbage collection metadata in the module.Bill Wendling2012-02-161-25/+40
| | | | | | | | | | The garbage collection metadata needs to be merged "intelligently", when two or more modules are linked together, and not merely appended. (Appending creates a section which is too large.) The module flags metadata method is the way to do this. <rdar://problem/8198537> llvm-svn: 150648
* Teach clang to add metadata tags to calls and invokes in ObjC withDan Gohman2012-02-164-7/+42
| | | | | | | | | -fno-objc-arc-exceptions. This will allow the optimizer to perform optimizations which are only safe under that flag. This is a part of rdar://10803830. llvm-svn: 150644
* objc-arc: For arc's ivar layout, treat __unsafe_unretained ivarsFariborz Jahanian2012-02-161-0/+4
| | | | | | as unscanned. // rdar://10832643 llvm-svn: 150639
* Revert "Add a completed/incomplete type difference. This allows us to have"Eric Christopher2012-02-152-188/+66
| | | | | | This reverts commit 9a68d4584afcd0853b930bd80235b58736e785b4. llvm-svn: 150637
* Add a completed/incomplete type difference. This allows us to haveEric Christopher2012-02-152-66/+188
| | | | | | | | | | | | | | | | partial types for contexts and forward decls while allowing us to complete types later on for debug purposes. This piggy-backs on the metadata replacement and rauw changes for temporary nodes and takes advantage of the incremental support I added in earlier. This allows us to, if we decide, to limit adding methods and variables to structures in order to limit the amount of debug information output into a .o file. The caching is a bit complicated though so any thoughts on untangling that are welcome. llvm-svn: 150631
* Split reinterpret_casts of member pointers out from CK_BitCast; thisJohn McCall2012-02-158-43/+136
| | | | | | | | | | | | | | | | | | | | | 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
* Use a simpler (and more efficient) pattern to pad vectors.Benjamin Kramer2012-02-143-19/+11
| | | | llvm-svn: 150475
* Remove useless if statement.Eli Friedman2012-02-141-19/+14
| | | | llvm-svn: 150459
* Implement IRGen of lambda expressions which capture arrays.Eli Friedman2012-02-143-63/+29
| | | | llvm-svn: 150452
* Refactor out new function EmitInitializerForField from ↵Eli Friedman2012-02-141-50/+69
| | | | | | EmitMemberInitializer. The new function will be used to initialize the fields of lambda expressions. llvm-svn: 150451
* 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-139-27/+75
| | | | | | | | | | | 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
* Add back in the code to create forward decls using temporary mdnodes.Eric Christopher2012-02-131-13/+14
| | | | llvm-svn: 150390
* Temporarily walk back a few of my recent debug info limiting changesEric Christopher2012-02-132-106/+24
| | | | | | | | while reworking how we handle wanting to emit only parts of structures. Fixes PR11970. llvm-svn: 150388
* Represent C++ direct initializers as ParenListExprs before semantic analysisSebastian Redl2012-02-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instead of having a special-purpose function. - ActOnCXXDirectInitializer, which was mostly duplication of AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days ago), is dropped completely. - MultiInitializer, which was an ugly hack I added, is dropped again. - We now have the infrastructure in place to distinguish between int x = {1}; int x({1}); int x{1}; -- VarDecl now has getInitStyle(), which indicates which of the above was used. -- CXXConstructExpr now has a flag to indicate that it represents list- initialization, although this is not yet used. - InstantiateInitializer was renamed to SubstInitializer and simplified. - ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which always produces a ParenListExpr. Placed that so far failed to convert that back to a ParenExpr containing comma operators have been fixed. I'm pretty sure I could have made a crashing test case before this. The end result is a (I hope) considerably cleaner design of initializers. More importantly, the fact that I can now distinguish between the various initialization kinds means that I can get the tricky generalized initializer test cases Johannes Schaub supplied to work. (This is not yet done.) This commit passed self-host, with the resulting compiler passing the tests. I hope it doesn't break more complicated code. It's a pretty big change, but one that I feel is necessary. llvm-svn: 150318
* Basic support for referring to captured variables from lambdas. Some simple ↵Eli Friedman2012-02-116-11/+42
| | | | | | examples seem to work. Tests coming up soon. llvm-svn: 150293
* Fix function prolog codegen whe coerce-to type is a struct.Evgeniy Stepanov2012-02-101-9/+30
| | | | | | | | | | This changes function prolog in such a way as to avoid out-of-bounds stack store in the case when coerce-to type has a larger storage size than the real argument type. Fixes PR11905. llvm-svn: 150238
* Remove evil const_cast that's not needed anymore.Bill Wendling2012-02-091-3/+1
| | | | llvm-svn: 150210
* Use SmallVector when we can instead of std::vector.Bill Wendling2012-02-091-23/+23
| | | | | | | This looks like it had a small, but measurable performance improvement on -O0 compile time for our ObjC tests. llvm-svn: 150208
* Class objects passed by value follow the same rules as structure objects.Akira Hatanaka2012-02-091-3/+6
| | | | | | | Double fields of by-value class objects should be passed in floating point registers. llvm-svn: 150200
* Fix bugs in function MipsABIInfo::returnAggregateInRegs. Functions returningAkira Hatanaka2012-02-091-14/+27
| | | | | | class objects follow the same rules as those returning struct objects. llvm-svn: 150196
* Don't cache the artificial type for the this pointer, there's noEric Christopher2012-02-091-5/+7
| | | | | | | | | | | difference in the qual type. This is a workaround for the fact that the type isn't artificial but the this decl is, however, we don't have any way of representing it in the current metadata. For now, however, just don't cache the full type. Fixes rdar://10831526 and probably a couple of others. llvm-svn: 150159
* Use RAII object for cleanups.Eli Friedman2012-02-091-2/+2
| | | | llvm-svn: 150147
* Refactor lambda IRGen so AggExprEmitter::VisitLambdaExpr does the right thing.Eli Friedman2012-02-094-47/+57
| | | | llvm-svn: 150146
* CWG issue 1405: mutable members are allowed in literal types, but can't undergoRichard Smith2012-02-091-5/+9
| | | | | | lvalue-to-rvalue conversions in constant expressions. llvm-svn: 150145
* Basic IRGen for LambdaExprs with captures.Eli Friedman2012-02-091-3/+46
| | | | llvm-svn: 150141
OpenPOWER on IntegriCloud