summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* A few tweaks to MaterializeTemporaryExpr suggested by John.Douglas Gregor2011-06-211-3/+1
| | | | llvm-svn: 133528
* Introduce a new AST node describing reference binding to temporaries.Douglas Gregor2011-06-211-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove dead variables.Benjamin Kramer2011-06-181-3/+0
| | | | llvm-svn: 133346
* 80 cols.Benjamin Kramer2011-06-181-5/+5
| | | | llvm-svn: 133345
* Restore correct use of GC barriers.John McCall2011-06-161-13/+25
| | | | llvm-svn: 133144
* Automatic Reference Counting.John McCall2011-06-151-26/+190
| | | | | | | | | | 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
* Use isAnyComplexType here so we don't pass complex numbers into the ↵Eli Friedman2011-06-151-1/+1
| | | | | | aggregate handling code; found by inspection. llvm-svn: 133070
* fix 80 col violationChris Lattner2011-05-221-1/+2
| | | | llvm-svn: 131870
* Introduce Type::isSignedIntegerOrEnumerationType() andDouglas Gregor2011-05-201-1/+1
| | | | | | | | | | | | | 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
* Remove dead variable, flagged by gcc's -Wunused-but-set-variable.Nick Lewycky2011-05-021-2/+0
| | | | llvm-svn: 130674
* Convert AccessInfo::AccessAlignment to CharUnits. No change in functionalityKen Dyck2011-04-241-6/+6
| | | | | | intended. llvm-svn: 130087
* Convert CGBitFieldInfo::FieldByteOffset to CharUnits. No change inKen Dyck2011-04-241-4/+6
| | | | | | functionality intended. llvm-svn: 130085
* C1X: implement generic selectionsPeter Collingbourne2011-04-151-4/+9
| | | | | | | As an extension, generic selection support has been added for all supported languages. The syntax is the same as for C1X. llvm-svn: 129554
* After some discussion with Doug, we decided that it made a lot more senseJohn McCall2011-04-121-36/+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-5/+35
| | | | llvm-svn: 129269
* Remove CK_DynamicToNull.Anders Carlsson2011-04-111-2/+1
| | | | llvm-svn: 129265
* As a first step towards fixing PR9641, add a CK_DynamicToNull cast kind whichAnders Carlsson2011-04-101-1/+2
| | | | | | | | | | | | | | | | | | 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/+6
| | | | | | | | | | | | 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
* IRgen: Reapply r128691 with a fix to ensure we don't increase alignment pastDaniel Dunbar2011-04-011-2/+13
| | | | | | that of the array element type. llvm-svn: 128698
* Revert r128691, "IRgen: Improve GCC compatibility when dealing with packedDaniel Dunbar2011-04-011-7/+2
| | | | | | arrays by propagating", it's breaking test in ways I don't understand yet. llvm-svn: 128693
* IRgen: Improve GCC compatibility when dealing with packed arrays by propagatingDaniel Dunbar2011-03-311-2/+7
| | | | | | | | 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
* Fix IRGen issues related to using property-dot syntaxFariborz Jahanian2011-03-301-0/+9
| | | | | | for prperty reference types. // rdar://9208606. llvm-svn: 128551
* Remove PHINode::reserveOperandSpace(). Instead, add a parameter toJay Foad2011-03-301-2/+1
| | | | | | PHINode::Create() giving the (known or expected) number of operands. llvm-svn: 128538
* Add support for language-specific address spaces. On top of that,Peter Collingbourne2011-03-181-1/+1
| | | | | | | | | 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
* PR9494: Get rid of bitcast which was both unnecessary and written incorrectly.Eli Friedman2011-03-161-3/+2
| | | | llvm-svn: 127768
* DebugInfo can be enabled or disabled at function level (e.g. using an ↵Devang Patel2011-03-071-1/+1
| | | | | | 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
* Do not emit stop point for CXXDefaultArgExpr. It results in suboptimial user ↵Devang Patel2011-03-071-1/+1
| | | | | | | | | | | | | 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
* Emit a stop point before a call expression so that debugger has some chance ↵Devang Patel2011-03-041-0/+7
| | | | | | | | | | 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
* Revert "Add CC_Win64ThisCall and set it in the necessary places."Tilmann Scheller2011-03-021-1/+1
| | | | | | This reverts commit 126863. llvm-svn: 126886
* Add CC_Win64ThisCall and set it in the necessary places.Tilmann Scheller2011-03-021-1/+1
| | | | llvm-svn: 126863
* -fwrapv should turn off the inbounds markers from geps used for pointerChris Lattner2011-03-011-3/+12
| | | | | | | 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
* Change the interface to ConstantFoldsToSimpleInteger to not encode Chris Lattner2011-02-271-3/+3
| | | | | | a bool + success into one tri-state integer, simplifying things. llvm-svn: 126592
* Pretty up the emission of field l-values and use volatile and TBAA whenJohn McCall2011-02-261-26/+54
| | | | | | | loading references as part of that. Use 'char' TBAA when accessing (immediate!) fields of a may_alias struct; fixes PR9307. llvm-svn: 126540
* Bind references to opaque r-values correctly. Add a few test casesJohn McCall2011-02-211-0/+4
| | | | | | for ?: on record types. llvm-svn: 126113
* Remove the "conditional save" hashtables from IR generation.John McCall2011-02-171-5/+0
| | | | llvm-svn: 125761
* Change the representation of GNU ?: expressions to use a different expressionJohn McCall2011-02-171-42/+39
| | | | | | | | | | | | | | | | | | | | | | 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/+8
| | | | llvm-svn: 125661
* Assorted cleanup:John McCall2011-02-151-3/+2
| | | | | | | | | - 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
* update for ConstantVector API change.Chris Lattner2011-02-151-9/+7
| | | | llvm-svn: 125538
* revert my ConstantVector patch, it seems to have made the llvm-gccChris Lattner2011-02-141-7/+9
| | | | | | builders unhappy. llvm-svn: 125505
* update for ConstantVector::get API change.Chris Lattner2011-02-141-9/+7
| | | | llvm-svn: 125488
* For consistency, use llvm::raw_ostream in the rest of the mangle api.Rafael Espindola2011-02-111-2/+4
| | | | llvm-svn: 125360
* Reorganize CodeGen{Function,Module} to eliminate the unfortunateJohn McCall2011-02-081-30/+39
| | | | | | | | Block{Function,Module} base class. Minor other refactorings. Fixed a few address-space bugs while I was there. llvm-svn: 125085
* A few more tweaks to the blocks AST representation: John McCall2011-02-071-1/+3
| | | | | | | | | | | | | | | | | - 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
* More capturing of 'this': implicit member expressions. Getting thatJohn McCall2011-02-031-18/+4
| | | | | | | | | | | 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
* When producing IR for a lvalue-to-rvalue cast *as an lvalue*, onlyDouglas Gregor2011-01-271-2/+3
| | | | | | | | | 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
* Fixes an IRgen bug where __block variable isFariborz Jahanian2011-01-261-6/+3
| | | | | | | referenced in the block-literal initializer of that variable. // rdar://8893785 llvm-svn: 124332
* Un-nest the meat of this function.John McCall2011-01-261-54/+53
| | | | llvm-svn: 124310
* Better framework for conditional cleanups; untested as yet.John McCall2011-01-261-15/+16
| | | | | | | | 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
* Send code generation for xvalues down the same path as lvaluesDouglas Gregor2011-01-221-1/+1
| | | | llvm-svn: 124023
OpenPOWER on IntegriCloud