summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExprScalar.cpp
AgeCommit message (Collapse)Author
2010-07-13Introduce a new cast kind for an "lvalue bitcast", which handlesDouglas Gregor
reinterpret_casts (possibly indirectly via C-style/functional casts) on values, e.g., int i; reinterpret_cast<short&>(i); The IR generated for this is essentially the same as for *reinterpret_cast<short*>(&i). Fixes PR6437, PR7593, and PR7344. llvm-svn: 108294
2010-07-08Reinstate the fix for PR7556. A silly use of isTrivial() wasDouglas Gregor
suppressing copies of objects with trivial copy constructors. llvm-svn: 107857
2010-07-07Revert r107828 and r107827, the fix for PR7556, which seems to beDouglas Gregor
breaking bootstrap on Linux. llvm-svn: 107837
2010-07-07Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect itsDouglas Gregor
newly-narrowed scope. No functionality change. llvm-svn: 107828
2010-06-29IRgen: Assignment to Objective-C properties shouldn't reload the value (whichDaniel Dunbar
would trigger an extra method call). - While in the area, I also changed Clang to not emit an unnecessary load from 'x' in cases like 'y = (x = 1)'. llvm-svn: 107210
2010-06-28Fix UnitTests/2004-02-02-NegativeZero.c, which regressed whenChris Lattner
I broke negate of FP values. llvm-svn: 107019
2010-06-27finally get around to doing a significant cleanup to irgen:Chris Lattner
have CGF create and make accessible standard int32,int64 and intptr types. This fixes a ton of 80 column violations introduced by LLVMContextification and cleans up stuff a lot. llvm-svn: 106977
2010-06-26fix inc/dec to honor -fwrapv and -ftrapv, implementing PR7426.Chris Lattner
llvm-svn: 106962
2010-06-26move scalar inc/dec codegen into ScalarExprEmitter instead Chris Lattner
of being in CGF. No functionality change. llvm-svn: 106961
2010-06-26use more efficient type comparison predicates.Chris Lattner
llvm-svn: 106958
2010-06-26Fix unary minus to trap on overflow with -ftrapv, refactoring binopChris Lattner
code so we can use it from VisitUnaryMinus. llvm-svn: 106957
2010-06-26Implement support for -fwrapv, rdar://7221421Chris Lattner
As part of this, pull together trapv handling into the same enum. This also add support for NSW multiplies. This also makes PCH disagreement on overflow behavior silent, since it really doesn't matter except for warnings and codegen (no macros get defined etc). llvm-svn: 106956
2010-06-26implement rdar://7432000 - signed negate should codegen as NSW.Chris Lattner
While I'm in there, adjust pointer to member adjustments as well. llvm-svn: 106955
2010-06-09Fix a gcc warning.Rafael Espindola
llvm-svn: 105670
2010-06-08Extend __builtin_shufflevector to expose the full power of the llvm ↵Nate Begeman
shufflevector instruction. This means it can now be used for vector truncation and concatenation. This will be used for the ARM NEON implementation. llvm-svn: 105589
2010-05-22Really fix PR7139. There was one boost test that we still failed, and my ↵Anders Carlsson
first fix broke self-host. llvm-svn: 104447
2010-05-21Unbreak self-host.Anders Carlsson
llvm-svn: 104390
2010-05-21Rename CodeGenFunction::EmitMemSetToZero to EmitNullInitialization. Handle ↵Anders Carlsson
setting null data member pointers correctly. Fixes PR7139. llvm-svn: 104387
2010-05-15Substantially alter the design of the Objective C type AST by introducingJohn McCall
ObjCObjectType, which is basically just a pair of one of {primitive-id, primitive-Class, user-defined @class} with a list of protocols. An ObjCObjectPointerType is therefore just a pointer which always points to one of these types (possibly sugared). ObjCInterfaceType is now just a kind of ObjCObjectType which happens to not carry any protocols. Alter a rather large number of use sites to use ObjCObjectType instead of ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather than hashing them in a FoldingSet. Remove some number of methods that are no longer used, at least after this patch. By simplifying ObjCObjectPointerType, we are now able to easily remove and apply pointers to Objective-C types, which is crucial for a certain kind of ObjC++ metaprogramming common in WebKit. llvm-svn: 103870
2010-05-14Make sure that value-initialized pointers to data members are initialized ↵Anders Carlsson
correctly. llvm-svn: 103771
2010-04-28Completely reimplement __builtin_offsetof, based on a patch by RobertoDouglas Gregor
Amadini. This change introduces a new expression node type, OffsetOfExpr, that describes __builtin_offsetof. Previously, __builtin_offsetof was implemented using a unary operator whose subexpression involved various synthesized array-subscript and member-reference expressions, which was ugly and made it very hard to instantiate as a template. OffsetOfExpr represents the AST more faithfully, with proper type source information and a more compact representation. OffsetOfExpr also has support for dependent __builtin_offsetof expressions; it can be value-dependent, but will never be type-dependent (like sizeof or alignof). This commit introduces template instantiation for __builtin_offsetof as well. There are two major caveats to this patch: 1) CodeGen cannot handle the case where __builtin_offsetof is not a constant expression, so it produces an error. So, to avoid regressing in C, we retain the old UnaryOperator-based __builtin_offsetof implementation in C while using the shiny new OffsetOfExpr implementation in C++. The old implementation can go away once we have proper CodeGen support for this case, which we expect won't cause much trouble in C++. 2) __builtin_offsetof doesn't work well with non-POD class types, particularly when the designated field is found within a base class. I will address this in a subsequent patch. Fixes PR5880 and a bunch of assertions when building Boost.Python tests. llvm-svn: 102542
2010-04-24Get rid of the old GetNonVirtualBaseClassOffset and change all call sites to ↵Anders Carlsson
use the new version. llvm-svn: 102274
2010-04-24Change CodeGenFunction::GetAddressOfDerivedClass to take a BasePath.Anders Carlsson
llvm-svn: 102273
2010-04-24Add a new GetAddressOfBaseClass overload that takes a base path and. Use it ↵Anders Carlsson
for derived-to-base casts. llvm-svn: 102270
2010-04-23Handle compound assignment expressions (i += j) as lvalues, which isDouglas Gregor
permitted in C++ but not in C. Fixes PR6900. Clang can now handle all of Boost.Lambda's regression tests. llvm-svn: 102170
2010-04-05IRgen: Move BitField LValues to just hold a reference to the CGBitFieldInfo.Daniel Dunbar
- Unfortunately, this requires some horrible code in CGObjCMac which always allocats a CGBitFieldInfo because we don't currently build a proper layout for Objective-C classes. It needs to be cleaned up, but I don't want the bit-field cleanups to be blocked on that. llvm-svn: 100474
2010-03-30Introduce a new kind of derived-to-base cast which bypasses the need forJohn McCall
null checks, and make sure we elide null checks when accessing base class members. llvm-svn: 99963
2010-03-29emit signed integer subtractions as 'sub nsw', patch byChris Lattner
Anton Yartsev! llvm-svn: 99817
2010-03-03Fix code gen bug generating code forFariborz Jahanian
((id)cat)->isa. Fixes radar 7709015. llvm-svn: 97672
2010-02-15Uniformize the names of type predicates: rather than having isFloatTy andDuncan Sands
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris! llvm-svn: 96224
2010-02-05Fix a code gen bug accessing 'isa' field via a message callFariborz Jahanian
(Fixes radar 7609722). llvm-svn: 95406
2010-02-04Rename StartConditionalBranch/FinishConditionalBranch to ↵Anders Carlsson
BeginConditionalBranch/EndConditionalBranch. llvm-svn: 95308
2010-02-02Move pointer to data member emission to CodeGenModule and use it in ↵Anders Carlsson
CGExprConstant. Fixes PR5674. llvm-svn: 95063
2010-01-31Some class related cleanup.Anders Carlsson
llvm-svn: 94938
2010-01-11Roll out ASTContext::getTypeSizeInChars(), replacing instances ofKen Dyck
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits ones as appropriate. Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType, fromQuantity(), and getQuantity() for clarity. llvm-svn: 93153
2010-01-09refactor pre/postinc logic into CGF and require the caller to pass in theChris Lattner
lvalue to poke, no functionality change. llvm-svn: 93075
2010-01-03Get rid of more dead code.Eli Friedman
llvm-svn: 92439
2009-12-25Remove some dead variables clang-analyzer found.Benjamin Kramer
llvm-svn: 92162
2009-12-19Remove ';' after method definition. Noticed by clang++, which one would thinkDaniel Dunbar
would have a higher respect for its own code. This is getting old, is this warning really adding value? llvm-svn: 91779
2009-12-18It's perfectly fine to see UserDefinedConversion casts when emitting scalar ↵Anders Carlsson
expressions. llvm-svn: 91686
2009-12-16Implement additional undefined checks for additional loads and stores. WIP.Mike Stump
llvm-svn: 91498
2009-12-15Switch codegen for -fcatch-undefined-bahavior over to __builtin_trapMike Stump
instead of abort to improve codesize and codegen. llvm-svn: 91374
2009-12-14Add support for detecting undefined shift behavior. WIP.Mike Stump
llvm-svn: 91341
2009-12-11Patch to allow C-style cast from 'void *' to block pointer type.Fariborz Jahanian
(fixes radar 7465023). llvm-svn: 91171
2009-12-11Move the code for converting a member pointer to a bool so that it is usableEli Friedman
for logical not. llvm-svn: 91112
2009-12-11Fix for PR5718: implement equality comparisons for member function pointers.Eli Friedman
llvm-svn: 91108
2009-12-10Support unary type traits in a scalar context. Not that I've actually seenEli Friedman
this construct, but might as well for completeness. llvm-svn: 91071
2009-12-09Code gen for ObjCIsaExpr AST used as lvalue.Fariborz Jahanian
(fixes radar 7457534). llvm-svn: 90995
2009-12-09Codegen. support for ObjCIsaExpr AST which until nowFariborz Jahanian
was not needed (fixes radar 7453430). llvm-svn: 90981
2009-12-08More detailed analysis of typecast to an objective-c pointerFariborz Jahanian
in objective-c++ mode without being too lenient. llvm-svn: 90895