summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExpr.cpp
AgeCommit message (Collapse)Author
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
2011-03-07DebugInfo can be enabled or disabled at function level (e.g. using an ↵Devang Patel
attribute). However, at module level it is determined by command line option and the state of command line option does not change during compilation. Make this layering explicit and fix accidental cases where the code generator was checking whether module has debug info enabled instead of checking whether debug info is enabled for this function or not. llvm-svn: 127165
2011-03-07Do not emit stop point for CXXDefaultArgExpr. It results in suboptimial user ↵Devang Patel
experience. 21 int main() { 22 A a; For example, here user would expect to stop at line 22, even if A's constructor leads to a call through CXXDefaultArgExpr. This fixes ostream-defined.exp regression from gdb testsuite. llvm-svn: 127164
2011-03-04Emit a stop point before a call expression so that debugger has some chance ↵Devang Patel
of getting some footing when user wants to stop at 2nd bar() in following expression when all function calls are inlined. = bar() + ... + bar() + ... clang keeps track of column numbers, so we could put location entries for all subexpressions but that will significantly bloat debug info in general, but a location for call expression is helpful here. llvm-svn: 127018
2011-03-02Revert "Add CC_Win64ThisCall and set it in the necessary places."Tilmann Scheller
This reverts commit 126863. llvm-svn: 126886
2011-03-02Add CC_Win64ThisCall and set it in the necessary places.Tilmann Scheller
llvm-svn: 126863
2011-03-01-fwrapv should turn off the inbounds markers from geps used for pointerChris Lattner
arithmetic. This is part of PR9256, it would be great if someone else wired up -fno-strict-overflow in the driver to -fwrapv. llvm-svn: 126718
2011-02-27Change the interface to ConstantFoldsToSimpleInteger to not encode Chris Lattner
a bool + success into one tri-state integer, simplifying things. llvm-svn: 126592
2011-02-26Pretty up the emission of field l-values and use volatile and TBAA whenJohn McCall
loading references as part of that. Use 'char' TBAA when accessing (immediate!) fields of a may_alias struct; fixes PR9307. llvm-svn: 126540
2011-02-21Bind references to opaque r-values correctly. Add a few test casesJohn McCall
for ?: on record types. llvm-svn: 126113
2011-02-17Remove the "conditional save" hashtables from IR generation.John McCall
llvm-svn: 125761
2011-02-17Change the representation of GNU ?: expressions to use a different expressionJohn McCall
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
2011-02-16Save a copy expression for non-trivial copy constructions of catch variables.John McCall
llvm-svn: 125661
2011-02-15Assorted cleanup:John McCall
- Have CGM precompute a number of commonly-used types - Have CGF copy that during initialization instead of recomputing them - Use TBAA info when initializing a parameter variable - Refactor the scalar ++/-- code llvm-svn: 125562
2011-02-15update for ConstantVector API change.Chris Lattner
llvm-svn: 125538
2011-02-14revert my ConstantVector patch, it seems to have made the llvm-gccChris Lattner
builders unhappy. llvm-svn: 125505
2011-02-14update for ConstantVector::get API change.Chris Lattner
llvm-svn: 125488
2011-02-11For consistency, use llvm::raw_ostream in the rest of the mangle api.Rafael Espindola
llvm-svn: 125360
2011-02-08Reorganize CodeGen{Function,Module} to eliminate the unfortunateJohn McCall
Block{Function,Module} base class. Minor other refactorings. Fixed a few address-space bugs while I was there. llvm-svn: 125085
2011-02-07A few more tweaks to the blocks AST representation: John McCall
- BlockDeclRefExprs always store VarDecls - BDREs no longer store copy expressions - BlockDecls now store a list of captured variables, information about how they're captured, and a copy expression if necessary With that in hand, change IR generation to use the captures data in blocks instead of walking the block independently. Additionally, optimize block layout by emitting fields in descending alignment order, with a heuristic for filling in words when alignment of the end of the block header is insufficient for the most aligned field. llvm-svn: 125005
2011-02-03More capturing of 'this': implicit member expressions. Getting thatJohn McCall
right for anonymous struct/union members led to me discovering some seemingly broken code in that area of Sema, which I fixed, partly by changing the representation of member pointer constants so that IndirectFieldDecls aren't expanded. This led to assorted cleanups with member pointers in CodeGen, and while I was doing that I saw some random other things to clean up. llvm-svn: 124785
2011-01-27When producing IR for a lvalue-to-rvalue cast *as an lvalue*, onlyDouglas Gregor
non-class prvalues actually require the realization of a temporary. For everything else, we already have an lvalue (or class prvalue) in the subexpression. Note: we're missing some move elision in this case. I'll tackle that next. llvm-svn: 124453
2011-01-26Fixes an IRgen bug where __block variable isFariborz Jahanian
referenced in the block-literal initializer of that variable. // rdar://8893785 llvm-svn: 124332