summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove another unused function.Anders Carlsson2010-05-022-39/+0
| | | | llvm-svn: 102871
* Remove an unused function.Anders Carlsson2010-05-022-89/+0
| | | | llvm-svn: 102870
* CodeGen: Shrink RValue. 4 words -> 2 words.Benjamin Kramer2010-05-021-30/+25
| | | | llvm-svn: 102863
* As per Chris' request, return the Instruction from EmitCall and add the ↵David Chisnall2010-05-023-9/+12
| | | | | | metadata in the caller. llvm-svn: 102862
* Complete reimplementation of the synthesis for implicitly-defined copyDouglas Gregor2010-05-013-102/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | assignment operators. Previously, Sema provided type-checking and template instantiation for copy assignment operators, then CodeGen would synthesize the actual body of the copy constructor. Unfortunately, the two were not in sync, and CodeGen might pick a copy-assignment operator that is different from what Sema chose, leading to strange failures, e.g., link-time failures when CodeGen called a copy-assignment operator that was not instantiation, run-time failures when copy-assignment operators were overloaded for const/non-const references and the wrong one was picked, and run-time failures when by-value copy-assignment operators did not have their arguments properly copy-initialized. This implementation synthesizes the implicitly-defined copy assignment operator bodies in Sema, so that the resulting ASTs encode exactly what CodeGen needs to do; there is no longer any special code in CodeGen to synthesize copy-assignment operators. The synthesis of the body is relatively simple, and we generate one of three different kinds of copy statements for each base or member: - For a class subobject, call the appropriate copy-assignment operator, after overload resolution has determined what that is. - For an array of scalar types or an array of class types that have trivial copy assignment operators, construct a call to __builtin_memcpy. - For an array of class types with non-trivial copy assignment operators, synthesize a (possibly nested!) for loop whose inner statement calls the copy constructor. - For a scalar type, use built-in assignment. This patch fixes at least a few tests cases in Boost.Spirit that were failing because CodeGen picked the wrong copy-assignment operator (leading to link-time failures), and I suspect a number of undiagnosed problems will also go away with this change. Some of the diagnostics we had previously have gotten worse with this change, since we're going through generic code for our type-checking. I will improve this in a subsequent patch. llvm-svn: 102853
* Simplify EmitCopyCtorCall.Anders Carlsson2010-05-011-12/+5
| | | | llvm-svn: 102849
* Simplify EmitClassAggrMemberwiseCopy.Anders Carlsson2010-05-013-22/+10
| | | | llvm-svn: 102848
* Clean up EmitClassMemberwiseCopy further.Anders Carlsson2010-05-012-22/+10
| | | | llvm-svn: 102846
* Get rid of a parameter from EmitClassMemberwiseCopy.Anders Carlsson2010-05-012-5/+4
| | | | llvm-svn: 102845
* When defining implicit copy constructors, use SetBaseOrMemberInitializers to ↵Anders Carlsson2010-05-011-12/+0
| | | | | | initialize the bases. llvm-svn: 102842
* Attach message send metadata to the lookup as well as to the call (GNU runtime).David Chisnall2010-05-011-7/+10
| | | | llvm-svn: 102839
* Make super message lookups cacheable (GNUstep Runtime)David Chisnall2010-05-011-14/+34
| | | | llvm-svn: 102837
* Tweaked EmitCall() to permit the caller to provide some metadata to attach ↵David Chisnall2010-05-013-11/+28
| | | | | | | | to the call site. Used this in CGObjCGNU to attach metadata about message sends to permit speculative inlining. llvm-svn: 102833
* When synthesizing Objective C records, give the synthetic fields publicJohn McCall2010-04-301-1/+1
| | | | | | | | access. Fixes an assertion. Fixes rdar://problem/7927811. Too lazy to reduce a test case. llvm-svn: 102776
* Remove an unnecessary parameter from EmitClassCopyAssignment.Anders Carlsson2010-04-302-13/+7
| | | | llvm-svn: 102747
* Fixed incorrect type of alloca (GNU runtime).David Chisnall2010-04-301-2/+5
| | | | llvm-svn: 102711
* Account for the VTT argument when making an implicit copy constructor forJohn McCall2010-04-301-1/+13
| | | | | | | | | a class with virtual bases. Just a patch until Sema starts (correctly) doing most of this analysis. Fixes PR 6622. llvm-svn: 102692
* Fix -fno-rtti -fexceptions by forcing the emission of (non-"builtin") RTTIJohn McCall2010-04-303-11/+23
| | | | | | when used by the exceptions routines. Fixes PR 6974. llvm-svn: 102684
* Teach EHCleanupBlock to deal appropriately with the possibility that thereJohn McCall2010-04-301-1/+5
| | | | | | might not have been an insertion block set at start. Fixes PR6975. llvm-svn: 102677
* Get the base class addresses before calling EmitClassCopyAssignment.Anders Carlsson2010-04-301-5/+8
| | | | llvm-svn: 102676
* Remove an unnecessary argument to EmitClassCopyAssignment.Anders Carlsson2010-04-292-11/+8
| | | | llvm-svn: 102674
* Use clang::VarDecl name instead of llvm::GlobalVariable name.Devang Patel2010-04-291-1/+1
| | | | | | llvm::GLobalVariable name may not match user visibile name for function static variables. llvm-svn: 102644
* IRgen/NeXT: Put the synthesized _objc_super, _message_ref_t decls in a valid ↵Daniel Dunbar2010-04-291-2/+4
| | | | | | DeclContext, to satisfy the invariants that should hold on a RecordDecl. llvm-svn: 102624
* Support for construct/destruct of ivar arrayFariborz Jahanian2010-04-281-7/+18
| | | | | | | of c++ objects (NeXt runtime). radar 7900343. llvm-svn: 102546
* Completely reimplement __builtin_offsetof, based on a patch by RobertoDouglas Gregor2010-04-281-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amadini. This change introduces a new expression node type, OffsetOfExpr, that describes __builtin_offsetof. Previously, __builtin_offsetof was implemented using a unary operator whose subexpression involved various synthesized array-subscript and member-reference expressions, which was ugly and made it very hard to instantiate as a template. OffsetOfExpr represents the AST more faithfully, with proper type source information and a more compact representation. OffsetOfExpr also has support for dependent __builtin_offsetof expressions; it can be value-dependent, but will never be type-dependent (like sizeof or alignof). This commit introduces template instantiation for __builtin_offsetof as well. There are two major caveats to this patch: 1) CodeGen cannot handle the case where __builtin_offsetof is not a constant expression, so it produces an error. So, to avoid regressing in C, we retain the old UnaryOperator-based __builtin_offsetof implementation in C while using the shiny new OffsetOfExpr implementation in C++. The old implementation can go away once we have proper CodeGen support for this case, which we expect won't cause much trouble in C++. 2) __builtin_offsetof doesn't work well with non-POD class types, particularly when the designated field is found within a base class. I will address this in a subsequent patch. Fixes PR5880 and a bunch of assertions when building Boost.Python tests. llvm-svn: 102542
* IRGen for initialization/destruction ofFariborz Jahanian2010-04-285-0/+92
| | | | | | | ivar class objects (NeXt runtime). (radar 7900343). llvm-svn: 102533
* Changed signature of GenerateMessageSend() function to pass the ↵David Chisnall2010-04-284-17/+31
| | | | | | | | ObjCInterfaceDecl for class messages and removed the boolean IsClassMessage argument, which wasn't used anywhere. Emitted some metadata on message sends to allow a later pass to do some speculative inlining of class methods (GNU runtime). Speculative inlining of instance methods requires type feedback to be useful (work in progress), but for class methods it works quite nicely. llvm-svn: 102514
* Remove unused function.Benjamin Kramer2010-04-281-4/+0
| | | | llvm-svn: 102499
* Emit the correct symbol name for the class (GNU runtime).David Chisnall2010-04-281-5/+7
| | | | llvm-svn: 102497
* Improve name mangling for dependent template names (e.g., typenameDouglas Gregor2010-04-281-15/+77
| | | | | | | | T::template apply<U>), handling a few cases where we previously failed and performing substitutions on such dependent names. Fixes a crash in Boost.PropertyTree. llvm-svn: 102490
* Properly pass the address of a lazily-generated function declaration withJohn McCall2010-04-281-5/+16
| | | | | | incomplete type. Fixes PR6911. llvm-svn: 102473
* Fixed message send to void (broken by my last commit - GNU runtime).David Chisnall2010-04-271-1/+2
| | | | llvm-svn: 102459
* Ensure return from a message to nil is always 0 (GNU runtime).David Chisnall2010-04-271-1/+67
| | | | | | | | | This works around stack corruption / crashes resulting from PR6944, and also works around people who expect 'what works on my machine' to work everywhere (GCC crashes in a number of cases on SPARC that should now work correctly with clang). llvm-svn: 102430
* Fix comments.Daniel Dunbar2010-04-271-3/+3
| | | | llvm-svn: 102429
* Make the InjectedClassNameType the canonical type of the current instantiationJohn McCall2010-04-272-1/+7
| | | | | | | | | | | | | | | | of a class template or class template partial specialization. That is to say, in template <class T> class A { ... }; or template <class T> class B<const T*> { ... }; make 'A<T>' and 'B<const T*>' sugar for the corresponding InjectedClassNameType when written inside the appropriate context. This allows us to track the current instantiation appropriately even inside AST routines. It also allows us to compute a DeclContext for a type much more efficiently, at some extra cost every time we write a template specialization (which can be optimized, but I've left it simple in this patch). llvm-svn: 102407
* Enable debug info for local variables at -O1+. Devang Patel2010-04-261-12/+1
| | | | llvm-svn: 102398
* emit dtors with the right calling convention in -fno-use-cxa-atexitChris Lattner2010-04-261-3/+8
| | | | | | mode. llvm-svn: 102377
* Make the static type of the exception variable in an Objective-CDouglas Gregor2010-04-262-7/+7
| | | | | | | @catch a VarDecl. The dynamic type is still a ParmVarDecl, but that will change soon. No effective functionality change. llvm-svn: 102341
* IRgen/NeXT: Fix several alignment issues with Objective-C metadata symbols:Daniel Dunbar2010-04-251-14/+15
| | | | | | | | | - Fix some places that had the alignment hard coded. - Use ABI type alignment, not preferred type alignment -- neither of this is exactly right, as we really want the C type alignment as required by the runtime, but the ABI alignment is a more correct choice. This should be equivalent for x86_64, but fixes the alignment for ARM. llvm-svn: 102314
* IRgen/NeXT: Reuse EmitImageInfo for both fragile and non-fragile ABI. This ↵Daniel Dunbar2010-04-251-32/+9
| | | | | | fixes Clang to correctly emit the "CorrectedSynthesize" bit when using the non-fragile ABI. llvm-svn: 102312
* Land another cleanup patch.Anders Carlsson2010-04-251-14/+8
| | | | llvm-svn: 102293
* Revert enough of my patches to fix self-host again :(Anders Carlsson2010-04-252-41/+83
| | | | llvm-svn: 102289
* Cleanup SynthesizeCXXCopyConstructor.Anders Carlsson2010-04-241-16/+9
| | | | llvm-svn: 102286
* Clean up SynthesizeCXXCopyAssignment a little.Anders Carlsson2010-04-241-15/+11
| | | | llvm-svn: 102285
* RenameGetAddressOfBaseOfCompleteClass to ↵Anders Carlsson2010-04-242-27/+28
| | | | | | GetAddressOfDirectBaseInCompleteClass to reflect that it only handles direct bases. llvm-svn: 102284
* More cleanup.Anders Carlsson2010-04-242-27/+18
| | | | llvm-svn: 102282
* Simplify EmitClassMemberwiseCopy now that it's only used for fields.Anders Carlsson2010-04-242-28/+14
| | | | llvm-svn: 102281
* DefineImplicitCopyConstructor now uses SetBaseOrMemberInitializers to create ↵Anders Carlsson2010-04-241-12/+0
| | | | | | implicit base initializers. (Member initializers are still handled by CodeGenFunction::SynthesizeCXXCopyConstructor for now). llvm-svn: 102279
* Rename GetAddressOfBaseClass to OldGetAddressOfBaseClass.Anders Carlsson2010-04-242-53/+15
| | | | llvm-svn: 102275
* Get rid of the old GetNonVirtualBaseClassOffset and change all call sites to ↵Anders Carlsson2010-04-245-34/+5
| | | | | | use the new version. llvm-svn: 102274
OpenPOWER on IntegriCloud