Eli Friedman
e96f1d3b2f
More work on ScalarExprEmitter::EmitCastExpr: for every cast kind, either
...
implement it explicitly or assert that it doesn't make sense for a scalar.
This caught a couple interesting issues: one, CK_BaseToDerivedMemberPointer
casts were getting silently miscompiled, and two, Sema was constructing some
strange implicit casts of type CK_UserDefinedConversion.
The change in SemaExprCXX makes sure the cast kinds are getting set correctly.
llvm-svn: 89987
2009-11-27 04:41:50 +00:00
Eli Friedman
0dfc6804ff
Cleanup for ScalarExprEmitter::EmitCastExpr; no functional changes.
...
llvm-svn: 89986
2009-11-27 02:07:44 +00:00
Eli Friedman
cb422f1dbe
Use the more general Evaluate infrastructure for folding constant DeclRefs
...
instead of checking explicitly for an EnumConstantDecl. This folds references
to constant integer VarDecls, which has two benefits:
1. Slightly smaller emitted code from emitting a constant instead of a load,
and skipping emitting some constant globals.
2. Some code forgets to define static constant member variables; emitting a
load instead of the value in that case leads to a link error. (Such programs
are technically not well-formed, but in practice build with g++.)
llvm-svn: 89934
2009-11-26 03:22:21 +00:00
Anders Carlsson
b9f96a3286
We always need to emit the base expression of a member expression, even when the member decl refers to an enum. Thanks to Eli for pointing this out!
...
llvm-svn: 89775
2009-11-24 16:57:33 +00:00
Anders Carlsson
f2e4f72f03
Don't try to treat an enum constant as an lvalue.
...
llvm-svn: 89705
2009-11-23 21:56:41 +00:00
Anders Carlsson
7fa434c2b8
Handle converting member pointers to bool.
...
llvm-svn: 89692
2009-11-23 20:04:44 +00:00
Anders Carlsson
8c793172c2
Handle base-to-derived casts. Will land test case shortly.
...
llvm-svn: 89678
2009-11-23 17:57:54 +00:00
Anders Carlsson
0a66c26191
Fix lifetime of conditional temporaries. Patch by Victor Zverovich!
...
llvm-svn: 89467
2009-11-20 17:27:56 +00:00
Eli Friedman
acfb1dfa4d
Minor cleanup to member pointer handling.
...
llvm-svn: 89201
2009-11-18 09:41:26 +00:00
Eli Friedman
c08bdea63d
Clean up scalar cast kind handling; make cast kind handling explicitly handle
...
more cases. No intended visible change.
llvm-svn: 88968
2009-11-16 21:33:53 +00:00
Mike Stump
65511704f7
Implement most of dynamic_cast. WIP.
...
llvm-svn: 88901
2009-11-16 06:50:58 +00:00
Chris Lattner
4f24225e8e
indirectbr seems to work! Rip out the old code.
...
llvm-svn: 86256
2009-11-06 17:38:18 +00:00
Mike Stump
53f9ded62b
Refine volatile handling, specifically, we must have the canonical
...
type to look at the volatile specifier. I found these all from just
hand auditing the code.
llvm-svn: 85967
2009-11-03 23:25:48 +00:00
Anders Carlsson
4b08db7a62
Add CGException.cpp, to be used for exception related code generation.
...
llvm-svn: 85560
2009-10-30 01:42:31 +00:00
Chris Lattner
6c4d255bf3
Implement clang support for indirect branch and address of label
...
using the new LLVM support for this. This is temporarily hiding
behind horrible and ugly #ifdefs until the time when the optimizer
is stable (hopefully a week or so). Until then, lets make it "opt in" :)
llvm-svn: 85446
2009-10-28 23:59:40 +00:00
Nate Begeman
b8326be4d9
Fix a bug in calculating shufflevector indices when constructing vectors from other vectors.
...
If I can find it again, I will check in a testcase.
llvm-svn: 85032
2009-10-25 02:26:01 +00:00
Fariborz Jahanian
ffba662dd2
Complete code gen for '.*' binary expression for
...
both scalar and aggregates.
llvm-svn: 84910
2009-10-22 22:57:31 +00:00
John McCall
b692a098c6
Canonicality is a property of qualified types, not unqualified types.
...
llvm-svn: 84891
2009-10-22 20:10:53 +00:00
Fariborz Jahanian
52987dc581
Code gen for '.*' binary expressions - WIP.
...
llvm-svn: 84800
2009-10-21 23:45:42 +00:00
Nate Begeman
19351639fb
Support IRgen of OpenCL vector initializers, ensuring the resulting IR is in a
...
form that LLVM code generators can turn into efficient code. For example,
int4 a, b, c;
a = (int4)(b.yzw, a.x)
llvm-svn: 84434
2009-10-18 20:10:40 +00:00
Anders Carlsson
094c459525
Add some more cast kinds.
...
llvm-svn: 84423
2009-10-18 18:12:03 +00:00
Chris Lattner
671fec8727
Fix PR5211: codegen shouldn't assume that the result of ||/&& is int
...
anymore. In C++ it is bool.
llvm-svn: 84308
2009-10-17 04:24:20 +00:00
Benjamin Kramer
abd5b90e4c
Simplify pointer creation with the new Type::getInt*Ptr methods.
...
llvm-svn: 83964
2009-10-13 10:07:13 +00:00
Fariborz Jahanian
07ca72725a
Generate weak read barriers when reading a weak __block
...
variable inside the block.
llvm-svn: 83729
2009-10-10 20:07:56 +00:00
Benjamin Kramer
dde0fee82e
Use new predicates for some type equality tests.
...
llvm-svn: 83303
2009-10-05 13:47:21 +00:00
John McCall
8ccfcb51ee
Refactor the representation of qualifiers to bring ExtQualType out of the
...
Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right; many more remain.
llvm-svn: 82705
2009-09-24 19:53:00 +00:00
Mike Stump
17abe2a620
Remove now fixed FIXME.
...
llvm-svn: 82584
2009-09-22 22:31:44 +00:00
Anders Carlsson
8c978b4fc2
No need to null check implicit lvalue cast exprs.
...
llvm-svn: 82580
2009-09-22 22:00:46 +00:00
John McCall
9dd450bb78
Change all the Type::getAsFoo() methods to specializations of Type::getAs().
...
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely. Several more 'leaf'
optimizations were introduced.
The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.
llvm-svn: 82501
2009-09-21 23:43:11 +00:00
Anders Carlsson
7cd39e0721
Handle reinterpret_cast between integral types and pointer types.
...
llvm-svn: 81837
2009-09-15 04:48:33 +00:00
Anders Carlsson
04c3bf4fab
Codegen support for nullptr from C++0x.
...
llvm-svn: 81835
2009-09-15 04:39:46 +00:00
Anders Carlsson
360e7d0a8f
When necessary, null check the base value in GetAddressCXXOfBaseClass.
...
llvm-svn: 81611
2009-09-12 06:04:24 +00:00
Anders Carlsson
12f5a25f15
Handle derived-to-base conversion in CGExprScalar::EmitCast, if the cast kind is CK_DerivedToBase.
...
llvm-svn: 81610
2009-09-12 04:57:16 +00:00
Anders Carlsson
864d525533
Rename AddressCXXOfBaseClass to GetAddressCXXOfBaseClass. Add a NullCheckValue argument (currently unused).
...
llvm-svn: 81606
2009-09-12 04:26:35 +00:00
Anders Carlsson
e9766d559b
If a cast expression needs either a conversion function or a constructor to be called, generate implicit child expressions that call them.
...
llvm-svn: 81383
2009-09-09 21:33:21 +00:00
Mike Stump
11289f4280
Remove tabs, and whitespace cleanups.
...
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Mike Stump
4a3999fe90
Reflow comments and some minor whitespace fixups.
...
llvm-svn: 81337
2009-09-09 13:00:44 +00:00
Douglas Gregor
ad8a336b40
Implement AST, semantics, and CodeGen for C++ pseudo-destructor
...
expressions, e.g.,
p->~T()
when p is a pointer to a scalar type.
We don't currently diagnose errors when pseudo-destructor expressions
are used in any way other than by forming a call.
llvm-svn: 81009
2009-09-04 17:36:40 +00:00
Anders Carlsson
f1ae6d45dd
Use the correct cast kinds for bit casts and function to pointer decay. Fixes PR4827.
...
llvm-svn: 80720
2009-09-01 20:52:42 +00:00
Fariborz Jahanian
3df8767869
Patch for code gen. for c-style cast which ends in
...
using class's conversion functions [12.3.2-p2]
llvm-svn: 80433
2009-08-29 19:15:16 +00:00
Fariborz Jahanian
c71f094c08
ir-gen for type convesion of class objects. WIP.
...
llvm-svn: 80178
2009-08-26 23:31:30 +00:00
Anders Carlsson
c327709db8
Handle array to pointer decay in EmitCastExpr and get rid of VisitImplicitCastExpr.
...
llvm-svn: 79930
2009-08-24 18:37:17 +00:00
Anders Carlsson
3df53bcf10
Handle CK_NullToMemberPointer in ScalarExprEmitter::EmitCast
...
llvm-svn: 79929
2009-08-24 18:26:39 +00:00
Anders Carlsson
15583e4493
Pass the cast kind to ScalarExprEmitter::EmitCastExpr.
...
llvm-svn: 79928
2009-08-24 18:12:39 +00:00
Fariborz Jahanian
9a84665921
Using "ObjCImplicitSetterGetterRefExpr" instead of "ObjCImplctSetterGetterRefExpr".
...
A field rename and more comments.
llvm-svn: 79537
2009-08-20 17:02:02 +00:00
Fariborz Jahanian
88cc2340de
Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.
...
Removed an unnecessary loop to get to setters incoming
argument. Added DoxyGen comments. Still more work
to do in this area (WIP).
llvm-svn: 79365
2009-08-18 20:50:23 +00:00
Anders Carlsson
81f0df9601
Improve handling of delete expressions.
...
llvm-svn: 79205
2009-08-16 21:13:42 +00:00
Owen Anderson
41a750271b
Update for LLVM API change.
...
llvm-svn: 78946
2009-08-13 21:57:51 +00:00
Dan Gohman
b321039271
Use the new nsw form of add for signed integer addition.
...
llvm-svn: 78765
2009-08-12 01:16:29 +00:00
Dan Gohman
43b4484f87
Use the inbounds variant of getelementptr for common pointer arithmetic.
...
llvm-svn: 78756
2009-08-12 00:33:55 +00:00