summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExpr.cpp
AgeCommit message (Collapse)Author
2011-08-25Track whether an AggValueSlot is potentially aliased, and do notJohn McCall
emit call results into potentially aliased slots. This allows us to properly mark indirect return slots as noalias, at the cost of requiring an extra memcpy when assigning an aggregate call result into a l-value. It also brings us into compliance with the x86-64 ABI. llvm-svn: 138599
2011-08-25Use stronger typing for the flags on AggValueSlot and requireJohn McCall
creators to tell us whether something needs GC barriers. No functionality change. llvm-svn: 138581
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner
LLVM.h imports them into the clang namespace. llvm-svn: 135852
2011-07-22Convert IRBuilder::CreateGEP and IRBuilder::CreateInBoundsGEP to useJay Foad
ArrayRef. llvm-svn: 135761
2011-07-20as eli points out, we're not doing memory stuff here. While ConvertType Chris Lattner
and ConvertTypeForMem are the same for pointers, it is best to just use ConvertType. Thanks Eli! llvm-svn: 135567
2011-07-18de-constify llvm::Type, patch by David Blaikie!Chris Lattner
llvm-svn: 135370
2011-07-15Create a new expression node, SubstNonTypeTemplateParmExpr,John McCall
to represent a fully-substituted non-type template parameter. This should improve source fidelity, as well as being generically useful for diagnostics and such. llvm-svn: 135243
2011-07-14Change intrinsic getter to take an ArrayRef, now that the underlying ↵Benjamin Kramer
function in LLVM does. llvm-svn: 135155
2011-07-12Add more compiler workarounds. Should fix the build with old GCCs and MSVC.Benjamin Kramer
llvm-svn: 134995
2011-07-12Switch field destruction over to use the new destroyer-based APIJohn McCall
and kill a lot of redundant code. llvm-svn: 134988
2011-07-12Work around a problem with a static helper's formulation in releaseChandler Carruth
builds introduced in r134972: lib/CodeGen/CGExpr.cpp:1294:7: error: no matching function for call to 'EmitBitCastOfLValueToProperType' lib/CodeGen/CGExpr.cpp:1278:1: note: candidate function not viable: no known conversion from 'CGBuilderTy' (aka 'IRBuilder<false>') to 'llvm::IRBuilder<> &' for 1st argument This fixes the issue by passing CodeGenFunction on down, and using its builder directly rather than passing just the builder down. This may not be the best / cleanest fix, Chris please review. It at least fixes builds. llvm-svn: 134977
2011-07-12Fix a problem Eli ran into where we now reject incomplete arrays of Chris Lattner
uncompleted struct types. We now do what llvm-gcc does and compile them into [i8 x 0]. If the type is later completed, we make sure that it is appropriately cast. We compile the terrible example to something like this now: %struct.A = type { i32, i32, i32 } @g = external global [0 x i8] define void @_Z1fv() nounwind { entry: call void @_Z3fooP1A(%struct.A* bitcast ([0 x i8]* @g to %struct.A*)) ret void } declare void @_Z3fooP1A(%struct.A*) define %struct.A* @_Z2f2v() nounwind { entry: ret %struct.A* getelementptr inbounds ([0 x %struct.A]* bitcast ([0 x i8]* @g to [0 x %struct.A]*), i32 0, i64 1) } llvm-svn: 134972
2011-07-10enhance EmitLValueForFieldInitialization to do the proper pointer ↵Chris Lattner
adjustment, allowing us to revert the other half of r134860. Now things are back to a relatively tidy state. llvm-svn: 134865
2011-07-10revert part of r134860, which is empirically unnecessary after the proper fixChris Lattner
llvm-svn: 134864
2011-07-10change EmitLValueForField to cast the returned lvalue to the rightChris Lattner
type, even when in the struct case. This was one root issue that was causing type mismatches throughout the compiler. llvm-svn: 134862
2011-07-10when emitting pointer load from an lvalue or storing to an lvalue,Chris Lattner
do an explicit bitcast to whatever ConvertType produces. This will go with the next patch. llvm-svn: 134860
2011-07-09clang side to match the LLVM IR type system rewrite patch.Chris Lattner
llvm-svn: 134831
2011-07-07In ARC, reclaim all return values of retainable type, not just thoseJohn McCall
where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
2011-07-07Sort #includes.Nick Lewycky
llvm-svn: 134589
2011-06-27Fix PR10204 in a better way.John McCall
llvm-svn: 133943
2011-06-27Revert parts of r133860 to fix a crash. Add a test.Nico Weber
llvm-svn: 133931
2011-06-25LValue carries a type now, so simplify the main EmitLoad/Store APIsJohn McCall
by removing the redundant type parameter. llvm-svn: 133860
2011-06-25Mark the multiply which occurs as part of performing pointerJohn McCall
arithmetic on a VLA as 'nsw', per discussion with djg, and implement pointer arithmetic (other than array accesses) and pointer subtraction for VLA types. llvm-svn: 133855
2011-06-24Change the IR-generation of VLAs so that we capture bounds,John McCall
not sizes; so that we use well-typed allocas; and so that we properly recurse through the full set of variably-modified types. llvm-svn: 133827
2011-06-22When binding a reference to an Automatic Reference Counting temporary,Douglas Gregor
retain/release the temporary object appropriately. Previously, we would only perform the retain/release operations when the reference would extend the lifetime of the temporary, but this does the wrong thing across calls. llvm-svn: 133620
2011-06-21A few tweaks to MaterializeTemporaryExpr suggested by John.Douglas Gregor
llvm-svn: 133528
2011-06-21Introduce a new AST node describing reference binding to temporaries.Douglas Gregor
MaterializeTemporaryExpr captures a reference binding to a temporary value, making explicit that the temporary value (a prvalue) needs to be materialized into memory so that its address can be used. The intended AST invariant here is that a reference will always bind to a glvalue, and MaterializeTemporaryExpr will be used to convert prvalues into glvalues for that binding to happen. For example, given const int& r = 1.0; The initializer of "r" will be a MaterializeTemporaryExpr whose subexpression is an implicit conversion from the double literal "1.0" to an integer value. IR generation benefits most from this new node, since it was previously guessing (badly) when to materialize temporaries for the purposes of reference binding. There are likely more refactoring and cleanups we could perform there, but the introduction of MaterializeTemporaryExpr fixes PR9565, a case where IR generation would effectively bind a const reference directly to a bitfield in a struct. Addresses <rdar://problem/9552231>. llvm-svn: 133521
2011-06-18Remove dead variables.Benjamin Kramer
llvm-svn: 133346
2011-06-1880 cols.Benjamin Kramer
llvm-svn: 133345
2011-06-16Restore correct use of GC barriers.John McCall
llvm-svn: 133144
2011-06-15Automatic Reference Counting.John McCall
Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
2011-06-15Use isAnyComplexType here so we don't pass complex numbers into the ↵Eli Friedman
aggregate handling code; found by inspection. llvm-svn: 133070
2011-05-22fix 80 col violationChris Lattner
llvm-svn: 131870
2011-05-20Introduce Type::isSignedIntegerOrEnumerationType() andDouglas Gregor
Type::isUnsignedIntegerOrEnumerationType(), which are like Type::isSignedIntegerType() and Type::isUnsignedIntegerType() but also consider the underlying type of a C++0x scoped enumeration type. Audited all callers to the existing functions, switching those that need to also handle scoped enumeration types (e.g., those that deal with constant values) over to the new functions. Fixes PR9923 / <rdar://problem/9447851>. llvm-svn: 131735
2011-05-02Remove dead variable, flagged by gcc's -Wunused-but-set-variable.Nick Lewycky
llvm-svn: 130674
2011-04-24Convert AccessInfo::AccessAlignment to CharUnits. No change in functionalityKen Dyck
intended. llvm-svn: 130087
2011-04-24Convert CGBitFieldInfo::FieldByteOffset to CharUnits. No change inKen Dyck
functionality intended. llvm-svn: 130085
2011-04-15C1X: implement generic selectionsPeter Collingbourne
As an extension, generic selection support has been added for all supported languages. The syntax is the same as for C1X. llvm-svn: 129554
2011-04-12After some discussion with Doug, we decided that it made a lot more senseJohn McCall
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
2011-04-11More __unknown_anytype work.John McCall
llvm-svn: 129269
2011-04-11Remove CK_DynamicToNull.Anders Carlsson
llvm-svn: 129265
2011-04-10As a first step towards fixing PR9641, add a CK_DynamicToNull cast kind whichAnders Carlsson
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
2011-04-07Basic, untested implementation for an "unknown any" type requested by LLDB.John McCall
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
2011-04-01IRgen: Reapply r128691 with a fix to ensure we don't increase alignment pastDaniel Dunbar
that of the array element type. llvm-svn: 128698
2011-04-01Revert r128691, "IRgen: Improve GCC compatibility when dealing with packedDaniel Dunbar
arrays by propagating", it's breaking test in ways I don't understand yet. llvm-svn: 128693
2011-03-31IRgen: Improve GCC compatibility when dealing with packed arrays by propagatingDaniel Dunbar
the array alignment to the array access. - This is more or less the best we can do without having alignment present in the type system, but is a long way from truly matching how GCC handles this. llvm-svn: 128691
2011-03-30Fix IRGen issues related to using property-dot syntaxFariborz Jahanian
for prperty reference types. // rdar://9208606. llvm-svn: 128551
2011-03-30Remove PHINode::reserveOperandSpace(). Instead, add a parameter toJay Foad
PHINode::Create() giving the (known or expected) number of operands. llvm-svn: 128538
2011-03-18Add support for language-specific address spaces. On top of that,Peter Collingbourne
add support for the OpenCL __private, __local, __constant and __global address spaces, as well as the __read_only, _read_write and __write_only image access specifiers. Patch originally by ARM; language-specific address space support by myself. llvm-svn: 127915
2011-03-16PR9494: Get rid of bitcast which was both unnecessary and written incorrectly.Eli Friedman
llvm-svn: 127768