summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExprScalar.cpp
AgeCommit message (Collapse)Author
2011-12-19Switch a few callers of MakeAddrLValue places over to ↵Eli Friedman
MakeNaturalAlignAddrLValue. llvm-svn: 146920
2011-12-08Fix an edge case in IRGen for conditionals. PR11509.Eli Friedman
llvm-svn: 146189
2011-11-10Enter the cleanups for a block outside the enclosingJohn McCall
full-expression. Naturally they're inactive before we enter the block literal expression. This restores the intended behavior that blocks belong to their enclosing scope. There's a useful -O0 / compile-time optimization that we're missing here with activating cleanups following straight-line code from their inactive beginnings. llvm-svn: 144268
2011-11-07Rip out CK_GetObjCProperty.John McCall
llvm-svn: 143910
2011-11-07Rip the ObjCPropertyRef l-value kind out of IR-generation.John McCall
llvm-svn: 143908
2011-11-06Change the AST representation of operations on Objective-CJohn McCall
property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. llvm-svn: 143867
2011-10-29Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it willRichard Smith
implicitly perform an lvalue-to-rvalue conversion if used on an lvalue expression. Also improve the documentation of Expr::Evaluate* to indicate which of them will accept expressions with side-effects. llvm-svn: 143263
2011-10-27Annotate imprecise FP division with fpaccuracy metadataPeter Collingbourne
The OpenCL single precision division operation is only required to be accurate to 2.5ulp. Annotate the fdiv instruction with metadata which signals to the backend that an imprecise divide instruction may be used. llvm-svn: 143136
2011-10-25Restore r142914 and r142915, now with missing file and apparentJohn McCall
GCC compiler workaround. llvm-svn: 142931
2011-10-25Revert r142914 and r142915, due to possibly missing file.NAKAMURA Takumi
r142914: "Introduce a placeholder type for "pseudo object"" r142915: "Pull the pseudo-object stuff into its own file." llvm-svn: 142921
2011-10-25Introduce a placeholder type for "pseudo object"John McCall
expressions: expressions which refer to a logical rather than a physical l-value, where the logical object is actually accessed via custom getter/setter code. A subsequent patch will generalize the AST for these so that arbitrary "implementing" sub-expressions can be provided. Right now the only client is ObjC properties, but this should be generalizable to similar language features, e.g. Managed C++'s __property methods. llvm-svn: 142914
2011-10-15Handle an edge case involving the conditional operator and throw ↵Eli Friedman
expressions. PR10582. llvm-svn: 142047
2011-10-14Provide half floating point support as a storage only type.Anton Korobeynikov
Lack of half FP was a regression compared to llvm-gcc. llvm-svn: 142016
2011-10-11Initial implementation of __atomic_* (everything except __atomic_is_lock_free).Eli Friedman
llvm-svn: 141632
2011-10-04Mark calls to objc_retainBlock that don't result from castsJohn McCall
to id so that we can still optimize them appropriately. llvm-svn: 141064
2011-09-27de-tmpify clang.Benjamin Kramer
llvm-svn: 140637
2011-09-24Treat list-initialization of scalars as a first-class citizen in C++11.Sebastian Redl
Allow empty initializer lists for scalars, which mean value-initialization. Constant evaluation for single-element and empty initializer lists for scalars. Codegen for empty initializer lists for scalars. Test case comes in next commit. llvm-svn: 140459
2011-09-23Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie
llvm-svn: 140407
2011-09-23Switch assert(0/false) llvm_unreachable.David Blaikie
llvm-svn: 140367
2011-09-10Rename the ARC cast kinds to start with "ARC".John McCall
llvm-svn: 139466
2011-09-10When converting a block pointer to an Objective-C pointer type, extendJohn McCall
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
2011-09-09Give conversions of block pointers to ObjC pointers a different cast kindJohn McCall
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
2011-08-14Fix r137086 to actually work properly in general. PR10650.Eli Friedman
llvm-svn: 137574
2011-08-09Hand materialization of temporary expressions when emitting a scalarDouglas Gregor
expression. Fxies PR10592. llvm-svn: 137086
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-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-20fix PR10395 - array decay can produce an interesting type whenChris Lattner
decaying an array of incomplete type (which has type [0 x i8]*) to a normal pointer (which has incompletetype*). llvm-svn: 135565
2011-07-18de-constify llvm::Type, patch by David Blaikie!Chris Lattner
llvm-svn: 135370
2011-07-15Fix the definition of AsTypeExpr. I'm still not sure thisJohn McCall
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
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-09clang side to match the LLVM IR type system rewrite patch.Chris Lattner
llvm-svn: 134831
2011-07-07Layout the code for trapping arithmetic so that the overflow case comes afterBill Wendling
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
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-06-25Cleanup cast IRGen a bit; no intended functionality change.Eli Friedman
llvm-svn: 133864
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-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-04Add support for builtin astype:Tanya Lattner
__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
2011-05-28Eliminate temporary argument vectors.Benjamin Kramer
llvm-svn: 132260
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-19Make __builtin_shufflevector and -ftrapv work correctly together. PR9945.Eli Friedman
llvm-svn: 131611
2011-05-06Don't emit nsw flags for vector operations; there's basically no benefit, ↵Eli Friedman
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
2011-04-28Implementation of Embarcadero array type traitsJohn Wiegley
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
2011-04-25t/clang/expr-traitsJohn Wiegley
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
2011-04-19some cleanups to use IRBuilder methods instead of llvm:: foo methods.Chris Lattner
llvm-svn: 129829
2011-04-16fix rdar://9289603 - clang should fold trivial ?: for enums as well as ↵Chris Lattner
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
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