summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprScalar.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rename the ARC cast kinds to start with "ARC".John McCall2011-09-101-4/+4
| | | | llvm-svn: 139466
* When converting a block pointer to an Objective-C pointer type, extendJohn McCall2011-09-101-1/+5
| | | | | | | | | | | the lifetime of the block by copying it to the heap, or else we'll get a dangling reference because the code working with the non-block-typed object will not know it needs to copy. There is some danger here, e.g. with assigning a block literal to an unsafe variable, but, well, it's an unsafe variable. llvm-svn: 139451
* Give conversions of block pointers to ObjC pointers a different cast kindJohn McCall2011-09-091-1/+2
| | | | | | | | than conversions of C pointers to ObjC pointers. In order to ensure that we've caught every case, add asserts to CastExpr that strictly determine which cast kind is used for which kind of bit cast. llvm-svn: 139352
* Fix r137086 to actually work properly in general. PR10650.Eli Friedman2011-08-141-2/+1
| | | | llvm-svn: 137574
* Hand materialization of temporary expressions when emitting a scalarDouglas Gregor2011-08-091-0/+5
| | | | | | expression. Fxies PR10592. llvm-svn: 137086
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-7/+7
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* as eli points out, we're not doing memory stuff here. While ConvertType Chris Lattner2011-07-201-2/+1
| | | | | | | and ConvertTypeForMem are the same for pointers, it is best to just use ConvertType. Thanks Eli! llvm-svn: 135567
* fix PR10395 - array decay can produce an interesting type whenChris Lattner2011-07-201-1/+4
| | | | | | | decaying an array of incomplete type (which has type [0 x i8]*) to a normal pointer (which has incompletetype*). llvm-svn: 135565
* de-constify llvm::Type, patch by David Blaikie!Chris Lattner2011-07-181-28/+28
| | | | llvm-svn: 135370
* Fix the definition of AsTypeExpr. I'm still not sure thisJohn McCall2011-07-151-1/+1
| | | | | | | | | | is right --- shouldn't there be a TypeLoc in here somewhere? --- but at least it doesn't have a redundant QualType and a broken children() method. Noticed this while doing things in serialization. llvm-svn: 135257
* Create a new expression node, SubstNonTypeTemplateParmExpr,John McCall2011-07-151-0/+3
| | | | | | | | 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
* Change intrinsic getter to take an ArrayRef, now that the underlying ↵Benjamin Kramer2011-07-141-1/+1
| | | | | | function in LLVM does. llvm-svn: 135155
* clang side to match the LLVM IR type system rewrite patch.Chris Lattner2011-07-091-3/+3
| | | | llvm-svn: 134831
* Layout the code for trapping arithmetic so that the overflow case comes afterBill Wendling2011-07-071-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the normal case. Before, for this: $ cat t.c int test(int x) { return x * 2; } We would get this: addl %edi, %edi jno LBB0_2 ## BB#1: ## %overflow ud2 LBB0_2: ## %nooverflow movl %edi, %eax popq %rbp ret Now we get this: addl %edi, %edi jo LBB0_2 ## BB#1: ## %nooverflow movl %edi, %eax popq %rbp ret LBB0_2: ## %overflow ud2 <rdar://problem/8283919> llvm-svn: 134642
* In ARC, reclaim all return values of retainable type, not just thoseJohn McCall2011-07-071-0/+5
| | | | | | | | | | | | 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
* Cleanup cast IRGen a bit; no intended functionality change.Eli Friedman2011-06-251-8/+3
| | | | llvm-svn: 133864
* LValue carries a type now, so simplify the main EmitLoad/Store APIsJohn McCall2011-06-251-25/+21
| | | | | | by removing the redundant type parameter. llvm-svn: 133860
* Mark the multiply which occurs as part of performing pointerJohn McCall2011-06-251-163/+155
| | | | | | | | 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
* Change the IR-generation of VLAs so that we capture bounds,John McCall2011-06-241-16/+22
| | | | | | | 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
* Automatic Reference Counting.John McCall2011-06-151-15/+42
| | | | | | | | | | 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
* Add support for builtin astype:Tanya Lattner2011-06-041-0/+51
| | | | | | | __builtin_astype(): Used to reinterpreted as another data type of the same size using for both scalar and vector data types. Added test case. llvm-svn: 132612
* Eliminate temporary argument vectors.Benjamin Kramer2011-05-281-3/+1
| | | | llvm-svn: 132260
* Introduce Type::isSignedIntegerOrEnumerationType() andDouglas Gregor2011-05-201-12/+12
| | | | | | | | | | | | | 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
* Make __builtin_shufflevector and -ftrapv work correctly together. PR9945.Eli Friedman2011-05-191-11/+5
| | | | llvm-svn: 131611
* Don't emit nsw flags for vector operations; there's basically no benefit, ↵Eli Friedman2011-05-061-7/+4
| | | | | | and a lot of downside (like PR9850, which is about clang's xmmintrin.h making an unexpected transformation on an expression involving _mm_add_epi32). llvm-svn: 131000
* Implementation of Embarcadero array type traitsJohn Wiegley2011-04-281-0/+4
| | | | | | | | | | Patch authored by John Wiegley. These are array type traits used for parsing code that employs certain features of the Embarcadero C++ compiler: __array_rank(T) and __array_extent(T, Dim). llvm-svn: 130351
* t/clang/expr-traitsJohn Wiegley2011-04-251-0/+4
| | | | | | | | | Patch authored by David Abrahams. These two expression traits (__is_lvalue_expr, __is_rvalue_expr) are used for parsing code that employs certain features of the Embarcadero C++ compiler. llvm-svn: 130122
* some cleanups to use IRBuilder methods instead of llvm:: foo methods.Chris Lattner2011-04-191-42/+34
| | | | llvm-svn: 129829
* fix rdar://9289603 - clang should fold trivial ?: for enums as well as ↵Chris Lattner2011-04-161-3/+2
| | | | | | | | integer constants into select at -O0 by making the isCheapEnoughToEvaluateUnconditionally predicate handle anything that folds to a constant. In particular, we now fold enums. llvm-svn: 129649
* C1X: implement generic selectionsPeter Collingbourne2011-04-151-2/+4
| | | | | | | 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-16/+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/+13
| | | | 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
* PR9580: Handle vectors correctly in ScalarExprEmitter::EmitRem.Eli Friedman2011-04-101-1/+1
| | | | | | | While I'm here, FileCheck-ize the ext-vector test, so we actually check what it is generating. llvm-svn: 129241
* Basic, untested implementation for an "unknown any" type requested by LLDB.John McCall2011-04-071-0/+3
| | | | | | | | | | | | 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
* Remove PHINode::reserveOperandSpace(). Instead, add a parameter toJay Foad2011-03-301-8/+4
| | | | | | PHINode::Create() giving the (known or expected) number of operands. llvm-svn: 128538
* Fix in r128471 is very broad. Some of the unconditional branches need line ↵Devang Patel2011-03-301-0/+3
| | | | | | | | number information for better user experience. Restrict the fix. This fixes break.exp failures from gdb testsuite. llvm-svn: 128513
* refactoringAnton Yartsev2011-03-281-3/+1
| | | | llvm-svn: 128427
* AltiVec vector comparison logic now affect only vectors of fundamental ↵Anton Yartsev2011-03-271-1/+3
| | | | | | AltiVec vector types. It fixes bug 9347. llvm-svn: 128381
* Don't emit read barriers for reading __weak __block variablesJohn McCall2011-03-161-4/+2
| | | | | | in non-GC mode. llvm-svn: 127725
* Add support for the OpenCL vec_step operator, by generalising andPeter Collingbourne2011-03-111-4/+5
| | | | | | | extending the existing support for sizeof and alignof. Original patch by Guy Benyei. llvm-svn: 127475
* DebugInfo can be enabled or disabled at function level (e.g. using an ↵Devang Patel2011-03-071-2/+2
| | | | | | 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/+6
| | | | | | | | | | | | | 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
* IRGen. Fix IR when message returns reference type.Fariborz Jahanian2011-03-021-0/+3
| | | | | | // rdar://8604515. llvm-svn: 126869
* PR9350: increment/decrement of char (and anything else narrower than int)Eli Friedman2011-03-021-3/+5
| | | | | | can't overflow due to promotion rules; emit a wrapping add for those cases. llvm-svn: 126816
* -fwrapv should turn off the inbounds markers from geps used for pointerChris Lattner2011-03-011-33/+48
| | | | | | | 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-6/+9
| | | | | | a bool + success into one tri-state integer, simplifying things. llvm-svn: 126592
* 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-54/+31
| | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud