summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprAgg.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Rename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" andAlexis Hunt2011-05-091-1/+1
| | | | | | | modify the semantics slightly to accomodate default constructors (I hope). llvm-svn: 131087
* removes a meaningless comment.Fariborz Jahanian2011-04-291-3/+1
| | | | llvm-svn: 130550
* block variables on lhs need be ir-gen'ed after theFariborz Jahanian2011-04-291-1/+18
| | | | | | | | rhs when its 'forwarding' pointer may be modified in rhs evaluation as result of call to Block_copy. // rdar://9309454 llvm-svn: 130545
* Cut down unnecessary zero'ing when value-initializing arrays of C++ objects.Argyrios Kyrtzidis2011-04-281-1/+10
| | | | | | | -C++ objects with user-declared constructor don't need zero'ing. -We can zero-initialize arrays of C++ objects in "bulk" now, in which case don't zero-initialize each object again. llvm-svn: 130453
* Get the base element type even in multidimensional arrays.Argyrios Kyrtzidis2011-04-281-1/+2
| | | | llvm-svn: 130427
* When value-initializing the elements of an array not not included in the ↵Argyrios Kyrtzidis2011-04-281-1/+9
| | | | | | | | | | initializer make sure that a non-trivial C++ constructor gets called. Fixes rdar://9347552 & http://llvm.org/PR9801 llvm-svn: 130421
* Convert size and alignment variables to CharUnits in EmitAggregateCopy(). NoKen Dyck2011-04-241-7/+10
| | | | | | change in functionality intended. llvm-svn: 130113
* Convert type size and alignment to CharUnits in CheckAggExprForMemSetUse().Ken Dyck2011-04-241-8/+9
| | | | | | No change in functionality intended. llvm-svn: 130112
* Convert the return type of GetNumNonZeroBytesInInit() to CharUnits. NoKen Dyck2011-04-241-7/+8
| | | | | | change in functionality intended. llvm-svn: 130111
* Eliminate some literal 8s by converting size variables in EmitGCMove() andKen Dyck2011-04-241-4/+4
| | | | | | EmitFinalDestCopy() to CharUnits. No change in functionality intended. llvm-svn: 130110
* Replace calls to ASTContext::getTypeInfo() with calls toKen Dyck2011-04-241-6/+2
| | | | | | | ASTContext::getTypeSize() when only the size part is used. No change in functionality intended. llvm-svn: 130109
* ForArgyrios Kyrtzidis2011-04-211-0/+2
| | | | | | | | | | | | | | double data[20000000] = {0}; we would blow out the memory by creating 20M Exprs to fill out the initializer. To fix this, if the initializer list initializes an array with more elements than there are initializers in the list, have InitListExpr store a single 'ArrayFiller' expression that specifies an expression to be used for value initialization of the rest of the elements. Fixes rdar://9275920. llvm-svn: 129896
* C1X: implement generic selectionsPeter Collingbourne2011-04-151-5/+6
| | | | | | | As an extension, generic selection support has been added for all supported languages. The syntax is the same as for C1X. llvm-svn: 129554
* We can't emit an aggregate cast as its sub-expression in general justJohn McCall2011-04-121-5/+2
| | | | | | | | | because the result is ignored. The particular example here is with property l-values, but there could be all sorts of lovely casts that this isn't safe for. Sink the check into the one case that seems to actually be capable of honoring this. llvm-svn: 129397
* After some discussion with Doug, we decided that it made a lot more senseJohn McCall2011-04-121-5/+0
| | | | | | | | | 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-0/+1
| | | | llvm-svn: 129269
* Remove CK_DynamicToNull.Anders Carlsson2011-04-111-4/+1
| | | | llvm-svn: 129265
* As a first step towards fixing PR9641, add a CK_DynamicToNull cast kind whichAnders Carlsson2011-04-101-1/+4
| | | | | | | | | | | | | | | | | | represents a dynamic cast where we know that the result is always null. For example: struct A { virtual ~A(); }; struct B final : A { }; struct C { }; bool f(B* b) { return dynamic_cast<C*>(b); } llvm-svn: 129256
* Basic, untested implementation for an "unknown any" type requested by LLDB.John McCall2011-04-071-0/+4
| | | | | | | | | | | | The idea is that you can create a VarDecl with an unknown type, or a FunctionDecl with an unknown return type, and it will still be valid to access that object as long as you explicitly cast it at every use. I'm still going back and forth about how I want to test this effectively, but I wanted to go ahead and provide a skeletal implementation for the LLDB folks' benefit and because it also improves some diagnostic goodness for placeholder expressions. llvm-svn: 129065
* Fix IRGen issues related to using property-dot syntaxFariborz Jahanian2011-03-301-3/+11
| | | | | | for prperty reference types. // rdar://9208606. llvm-svn: 128551
* Change the representation of GNU ?: expressions to use a different expressionJohn McCall2011-02-171-10/+9
| | | | | | | | | | | | | | | | | | | | | | class and to bind the shared value using OpaqueValueExpr. This fixes an unnoticed problem with deserialization of these expressions where the deserialized form would lose the vital pointer-equality trait; or rather, it fixes it because this patch also does the right thing for deserializing OVEs. Change OVEs to not be a "temporary object" in the sense that copy elision is permitted. This new representation is not totally unawkward to work with, but I think that's really part and parcel with the semantics we're modelling here. In particular, it's much easier to fix things like the copy elision bug and to make the CFG look right. I've tried to update the analyzer to deal with this in at least some obvious cases, and I think we get a much better CFG out, but the printing of OpaqueValueExprs probably needs some work. llvm-svn: 125744
* Save a copy expression for non-trivial copy constructions of catch variables.John McCall2011-02-161-0/+6
| | | | llvm-svn: 125661
* Reorganize CodeGen{Function,Module} to eliminate the unfortunateJohn McCall2011-02-081-2/+2
| | | | | | | | Block{Function,Module} base class. Minor other refactorings. Fixed a few address-space bugs while I was there. llvm-svn: 125085
* Better framework for conditional cleanups; untested as yet.John McCall2011-01-261-10/+10
| | | | | | | | I'm separately committing this because it incidentally changes some block orderings and minor IR issues, like using a phi instead of an unnecessary alloca. llvm-svn: 124277
* Ensure an insertion point at the end of a statement-expression.John McCall2011-01-131-0/+1
| | | | | | Fixes PR8967. llvm-svn: 123360
* Simplify mem{cpy, move, set} creation with IRBuilder.Benjamin Kramer2010-12-301-12/+5
| | | | llvm-svn: 122634
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-3/+3
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* __block variables require us to evaluate the RHS of an assignment beforeJohn McCall2010-12-061-0/+2
| | | | | | | | | | the LHS, or else the pointer might be invalid. This is kindof dumb, but go ahead and make sure we're doing that for l-value scalar assignment, which fixes a miscompile of obj-c++.dg/block-seq.mm. Leave a FIXME for how to solve this problem for agg __blocks. llvm-svn: 120992
* Fix a bug in the emission of __real/__imag l-values on scalar operands.John McCall2010-12-051-2/+2
| | | | | | | | | Fix a bug in the emission of complex compound assignment l-values. Introduce a method to emit an expression whose value isn't relevant. Make that method evaluate its operand as an l-value if it is one. Fixes our volatile compliance in C++. llvm-svn: 120931
* Although we currently have explicit lvalue-to-rvalue conversions, they'reJohn McCall2010-12-041-4/+11
| | | | | | | | | | | | | | | | | | | not actually frequently used, because ImpCastExprToType only creates a node if the types differ. So explicitly create an ICE in the lvalue-to-rvalue conversion code in DefaultFunctionArrayLvalueConversion() as well as several other new places, and consistently deal with the consequences throughout the compiler. In addition, introduce a new cast kind for loading an ObjCProperty l-value, and make sure we emit those nodes whenever an ObjCProperty l-value appears that's not on the LHS of an assignment operator. This breaks a couple of rewriter tests, which I've x-failed until future development occurs on the rewriter. Ted Kremenek kindly contributed the analyzer workarounds in this patch. llvm-svn: 120890
* Kill the KVC l-value kind and calculate the base expression when emittingJohn McCall2010-12-041-6/+3
| | | | | | the l-value. llvm-svn: 120884
* Reflow to a style doug prefers, increasing indentation :-)Chris Lattner2010-12-021-24/+24
| | | | llvm-svn: 120746
* fix PR8726 by teaching the aggregate init optimization code to handle Chris Lattner2010-12-021-0/+33
| | | | | | structs with references in them correctly. llvm-svn: 120722
* Improve codegen for initializer lists to use memset more aggressivelyChris Lattner2010-12-021-12/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when an initializer is variable (I handled the constant case in a previous patch). This has three pieces: 1. Enhance AggValueSlot to have a 'isZeroed' bit to tell CGExprAgg that the memory being stored into has previously been memset to zero. 2. Teach CGExprAgg to not emit stores of zero to isZeroed memory. 3. Teach CodeGenFunction::EmitAggExpr to scan initializers to determine whether they are profitable to emit a memset + inividual stores vs stores for everything. The heuristic used is that a global has to be more than 16 bytes and has to be 3/4 zero to be candidate for this xform. The two testcases are illustrative of the scenarios this catches. We now codegen test9 into: call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 400, i32 4, i1 false) %.array = getelementptr inbounds [100 x i32]* %Arr, i32 0, i32 0 %tmp = load i32* %X.addr, align 4 store i32 %tmp, i32* %.array and test10 into: call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 392, i32 8, i1 false) %tmp = getelementptr inbounds %struct.b* %S, i32 0, i32 0 %tmp1 = getelementptr inbounds %struct.a* %tmp, i32 0, i32 0 %tmp2 = load i32* %X.addr, align 4 store i32 %tmp2, i32* %tmp1, align 4 %tmp5 = getelementptr inbounds %struct.b* %S, i32 0, i32 3 %tmp10 = getelementptr inbounds %struct.a* %tmp5, i32 0, i32 4 %tmp11 = load i32* %X.addr, align 4 store i32 %tmp11, i32* %tmp10, align 4 Previously we produced 99 stores of zero for test9 and also tons for test10. This xforms should substantially speed up -O0 builds when it kicks in as well as reducing code size and optimizer heartburn on insane cases. This resolves PR279. llvm-svn: 120692
* Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ↵John McCall2010-12-021-7/+0
| | | | | | | | ObjCPropertyRefExpr into the latter. llvm-svn: 120643
* Restore the lvalue-to-rvalue conversion patch with a minimal fix.John McCall2010-12-011-4/+38
| | | | llvm-svn: 120555
* L-value to r-value conversion is not ready for prime-time.John McCall2010-11-301-38/+4
| | | | llvm-svn: 120433
* Introduce an r-value to l-value cast kind. I'm not promising anythingJohn McCall2010-11-301-4/+38
| | | | | | about the reliability of this yet. llvm-svn: 120422
* Reset the lifetime-managed flag between emission of the agg conditionalJohn McCall2010-11-171-2/+8
| | | | | | branches. Fixes PR8623. llvm-svn: 119408
* Kill CK_Unknown and flesh out the documentation for the existing CastKinds.John McCall2010-11-161-2/+0
| | | | llvm-svn: 119331
* After discussion with Doug and John, I am revertingFariborz Jahanian2010-10-221-18/+1
| | | | | | the patch. llvm-svn: 117159
* Patch fixes miscompile with non-trivial copy constructors and Fariborz Jahanian2010-10-221-1/+18
| | | | | | statement expressions, //rdar: //8540501 llvm-svn: 117146
* Revert the hack Chris Lattner added in r97981 to work aroundDouglas Gregor2010-10-081-10/+0
| | | | | | | brokenness in the designated-initializer ASTs. The ASTs were fixed by Alp Toker's patch (r116098) for PR6955. Fixes PR6537. llvm-svn: 116101
* Initialize AggValueSlot's flags along all paths, plus minor beautification.John McCall2010-09-161-3/+3
| | | | | | Prospective fix for broken commit in r114045. llvm-svn: 114060
* Patch to move RequiresGCollection bit toFariborz Jahanian2010-09-161-13/+12
| | | | | | AggValueSlot slot. llvm-svn: 114045
* one piece of code is responsible for the lifetime of every aggregateJohn McCall2010-09-151-87/+70
| | | | | | | | | | | | | slot. The easiest way to do that was to bundle up the information we care about for aggregate slots into a new structure which demands that its creators at least consider the question. I could probably be convinced that the ObjC 'needs GC' bit should be rolled into this structure. Implement generalized copy elision. The main obstacle here is that IR-generation must be much more careful about making sure that exactly llvm-svn: 113962
* move the hackaround for PR6537 to catch unions as well,Chris Lattner2010-09-061-12/+12
| | | | | | fixing the ICE in PR7151 llvm-svn: 113130
* clean up some formatting.Chris Lattner2010-09-061-2/+1
| | | | llvm-svn: 113129
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-13/+12
| | | | | | to the new constants. llvm-svn: 112047
* Expression statements undergo lvalue-to-rvalue conversion in C,John McCall2010-08-251-2/+10
| | | | | | | | but not in C++, so don't emit aggregate loads of volatile references in null context in C++. Happens to have been caught by an assertion. We do not get the scalar case right. Volatiles are really broken. llvm-svn: 112019
OpenPOWER on IntegriCloud