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
794290ca29
Add an assertion to catch bad calls to EmitCallArgs.
...
llvm-svn: 89190
2009-11-18 03:42:04 +00:00
Eli Friedman
24f55430c8
Missing piece of r89173.
...
llvm-svn: 89174
2009-11-18 00:57:03 +00:00
Anders Carlsson
cfd3012756
More const is always good.
...
llvm-svn: 89033
2009-11-17 03:57:07 +00:00
Mike Stump
65511704f7
Implement most of dynamic_cast. WIP.
...
llvm-svn: 88901
2009-11-16 06:50:58 +00:00
Mike Stump
c9b231c8d1
Implement typeid for class types.
...
llvm-svn: 88843
2009-11-15 08:09:41 +00:00
Fariborz Jahanian
6814eaa2cc
Code gen for arrady delete operator. Fixes pr5472.
...
llvm-svn: 88680
2009-11-13 19:27:47 +00:00
Daniel Dunbar
1b4441915a
Wherein the TargetInfo argument to Preprocessor is made 'const' and propogated.
...
llvm-svn: 87087
2009-11-13 05:51:54 +00:00
Anders Carlsson
e828c36933
Add a special BuildVirtualCall that's going to be used for building calls to destructors. This is needed because when compiling:
...
struct A {
virtual ~A();
};
void f(A* a) {
delete a;
}
A's deleting destructor should be called.
llvm-svn: 87083
2009-11-13 04:45:41 +00:00
Fariborz Jahanian
1254a0978c
This patch implements Code gen. for destruction of
...
global array of objects.
llvm-svn: 86701
2009-11-10 19:24:06 +00:00
Mike Stump
d846d0825b
Add vtable caching to prevent multiple vtables for the same class from
...
being generated.
Add the most derived vtable pointer to the VTT.
llvm-svn: 86671
2009-11-10 07:44:33 +00:00
Mike Stump
9f23a149cb
Be sure to clear out VCall when we clear out VCalls.
...
Start implementing VTTs. WIP.
llvm-svn: 86650
2009-11-10 02:30:51 +00:00
Anders Carlsson
509850ebec
Change EmitPointerToDataMemberLValue to take a FieldDecl. No intended functionality change.
...
llvm-svn: 86407
2009-11-07 22:00:15 +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
Fariborz Jahanian
09cc10f9f8
This patch extends CleanupScope to support destruction
...
of array objects on block exit. Patch is by Anders Calrsson.
llvm-svn: 86032
2009-11-04 17:57:40 +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
Mike Stump
77738205e6
Refine return value adjustments for thunks.
...
llvm-svn: 85905
2009-11-03 16:59:27 +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
edc56ef41c
optimize out some ifdefs.
...
llvm-svn: 85453
2009-10-29 00:22:00 +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
Douglas Gregor
4bd90e53c2
Eliminate QualifiedDeclRefExpr, which captured the notion of a
...
qualified reference to a declaration that is not a non-static data
member or non-static member function, e.g.,
namespace N { int i; }
int j = N::i;
Instead, extend DeclRefExpr to optionally store the qualifier. Most
clients won't see or care about the difference (since
QualifierDeclRefExpr inherited DeclRefExpr). However, this reduces the
number of top-level expression types that clients need to cope with,
brings the implementation of DeclRefExpr into line with MemberExpr,
and simplifies and unifies our handling of declaration references.
Extended DeclRefExpr to (optionally) store explicitly-specified
template arguments. This occurs when naming a declaration via a
template-id (which will be stored in a TemplateIdRefExpr) that,
following template argument deduction and (possibly) overload
resolution, is replaced with a DeclRefExpr that refers to a template
specialization but maintains the template arguments as written.
llvm-svn: 84962
2009-10-23 18:54:35 +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
Fariborz Jahanian
4ebdff5e1c
Code gen for pointer-to-datamember - WIP.
...
llvm-svn: 84771
2009-10-21 18:38:00 +00:00
Mike Stump
7fe9cc1dd5
Prep work to always preallocate BlockDeclRefExprs so that we can
...
generate the debug information for the first parameter to the block
invoke functions. WIP.
llvm-svn: 84737
2009-10-21 03:49:08 +00:00
Fariborz Jahanian
e4d94cee05
Code-gen for CXXZeroInitValueExpr AST passed
...
as argument to a function call. Removes a FIXME.
llvm-svn: 84694
2009-10-20 23:29:04 +00:00
Daniel Dunbar
b5aacc282c
Twinify CodeGenFunction::CreateTempAlloca
...
llvm-svn: 84456
2009-10-19 01:21:05 +00:00
Chris Lattner
2bb5cb490c
reimplement codegen for indirect goto with the following advantages:
...
1. CGF now has fewer bytes of state (one pointer instead of a vector).
2. The generated code is determinstic, instead of getting labels in
'map order' based on pointer addresses.
3. Clang now emits one 'indirect goto switch' for each function, instead
of one for each indirect goto. This fixes an M*N = N^2 IR size issue
when there are lots of address-taken labels and lots of indirect gotos.
4. This also makes the default cause do something useful, reducing the
size of the jump table needed (by one).
llvm-svn: 83952
2009-10-13 06:55:33 +00:00
Anders Carlsson
c6d171ec77
Change GetAddressCXXOfBaseClass to use CXXBasePaths for calculating base class offsets. Fix the code to handle virtual bases as well.
...
llvm-svn: 83426
2009-10-06 22:43:30 +00:00
Anders Carlsson
2ee3c011d9
Implement code generation of member function pointer calls. Fixes PR5121.
...
llvm-svn: 83271
2009-10-03 19:43:08 +00:00
Anders Carlsson
32bfb1ce8f
Move some functions from CodeGenFunctions to CodeGenModule so they can be used by CGExprConstant.
...
llvm-svn: 83263
2009-10-03 14:56:57 +00:00
Anders Carlsson
9150a2a8c0
Handle CK_BaseToDerivedMemberPointer for member function pointers. Fixes PR5091.
...
llvm-svn: 83041
2009-09-29 03:13:20 +00:00
Anders Carlsson
52d78a518a
CodeGen for try statements. (We just emit the body for now).
...
llvm-svn: 82910
2009-09-27 18:58:34 +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
Anders Carlsson
d49844b715
Add a new variant of EmitCXXAggrConstructorCall that takes a Value that holds the number of elements to construct, to be used when implementing new[].
...
llvm-svn: 82602
2009-09-23 02:45:36 +00:00
Anders Carlsson
1450adbbf9
Code generation of Conditional operators that are lvalues (but that aren't bitfields).
...
llvm-svn: 81867
2009-09-15 16:35:24 +00:00
Anders Carlsson
ddf57d3df9
Remove an unnecessary FunctionDecl parameter to the synthesizing functions.
...
llvm-svn: 81759
2009-09-14 05:32:02 +00:00
Anders Carlsson
96bad9a5cd
Implement CodeGenFunction::EmitCXXExprWithTemporariesLValue.
...
llvm-svn: 81738
2009-09-14 01:10:45 +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
0168f4b202
For __block variables, cache the LLVM types as well as which LLVM field where the variable is stored.
...
llvm-svn: 81599
2009-09-12 02:14:24 +00:00
Mike Stump
80f6ac5a4f
Add basic covariant thunk generation support. WIP.
...
llvm-svn: 81585
2009-09-11 23:25:56 +00:00
Anders Carlsson
73fcc95f0f
Pass GlobalDecls to GenerateCode and StartFunction.
...
llvm-svn: 81485
2009-09-11 00:07:24 +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
Anders Carlsson
71d1d92d37
Make BuildByRefType take a ValueDecl instead of a QualType and an alignment.
...
llvm-svn: 81315
2009-09-09 02:51:03 +00:00
Mike Stump
453fe4285d
Install thunks later to fixup overrides. Track space taken by vbase
...
offsets better for thunk refinements. Cleanups. WIP.
llvm-svn: 81067
2009-09-05 07:20:32 +00:00
Mike Stump
5a522353c3
Add overidding for methods for vtable building for the secondary
...
vtables. Add thunk generation. WIP.
llvm-svn: 81014
2009-09-04 18:27:16 +00:00
Fariborz Jahanian
879d726608
Re-implemented generation of objc_memmove_collectable
...
API for copying GC'able aggregates (Next runtime only).
llvm-svn: 80607
2009-08-31 19:33: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
Mike Stump
a5588bf3ac
Implement virtual dispatch. :-) This is self-consistent with clang,
...
but not yet necessarily perfectly consistent with gcc. Also addressed
Doug and John's comments.
llvm-svn: 80137
2009-08-26 20:46:33 +00:00
Anders Carlsson
458055a890
Revert r80064 since it broke the build.
...
llvm-svn: 80066
2009-08-26 03:30:14 +00:00
Mike Stump
fbddfdacdc
Implement virtual dispatch. :-) This is self-consistent with clang, but not yet
...
necessarily perfectly consistent with gcc.
llvm-svn: 80064
2009-08-26 01:54:35 +00:00
Anders Carlsson
4557b2c0c2
Remove dead code
...
llvm-svn: 79921
2009-08-24 16:52:33 +00:00
Fariborz Jahanian
8adc973483
Patch to ir-gen copy assigning array members when synthesizing
...
a copy assignment operator function.
llvm-svn: 79681
2009-08-21 22:34:55 +00:00
Fariborz Jahanian
5626384384
Patch to provide ir-gen support in copying array members
...
when synthesizing a copy constructor. Arrays's base element
may have a trivial or non-trivial copy constructor.
llvm-svn: 79653
2009-08-21 18:30:26 +00:00
Fariborz Jahanian
9c83720d17
ir-gen patch to destruct array members. WIP.
...
llvm-svn: 79565
2009-08-20 20:54:15 +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
431c883287
ir-gen for constructing arrays as non-static data members. WIP.
...
llvm-svn: 79464
2009-08-19 20:55:16 +00:00
Mike Stump
494c42526b
Add some documentation.
...
llvm-svn: 79373
2009-08-18 21:59:28 +00:00
Mike Stump
07347353a0
Cleanups. Move GenerateRtti to CodeGenModule.
...
llvm-svn: 79372
2009-08-18 21:49:00 +00:00
Mike Stump
ee81dca8c7
Move the rest of the vtable building code into the new builder.
...
llvm-svn: 79370
2009-08-18 21:30:21 +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
Fariborz Jahanian
d172e91f2a
Patch to 1) synthesizing non-trivial default destructor when
...
one is not provided by user. 2) More complete
emission of ctor prologue when it has no initializer
list or when it is synthesized.
llvm-svn: 79269
2009-08-17 19:04:50 +00:00
Anders Carlsson
81f0df9601
Improve handling of delete expressions.
...
llvm-svn: 79205
2009-08-16 21:13:42 +00:00
Anders Carlsson
5b106a7545
Add an IsInitializer flag to EmitAnyExpr. This is used to prevent temporaries from being destroyed when they're bound to a reference variable.
...
llvm-svn: 79179
2009-08-16 07:36:22 +00:00
Mike Stump
22ea1f8a30
Cleanups and fixups for calculating the virtual base offsets. WIP.
...
llvm-svn: 79156
2009-08-16 01:46:26 +00:00
Eli Friedman
04fddf0d1f
Fix for PR4721: adjust CodeGen and ASTContext so that we have a
...
consistent model for handling size expressions for VLAs.
The model is essentially as follows: VLA types own their associated
expression. In some cases, we need to create multiple VLA types to
represent a given VLA (for canonical types, or qualifiers on array types,
or type merging). If we need to create multiple types based off of
the same VLA declaration, we use the new refcounting functionality so they can
all own the expression. The VLASizeMap in CodeGenFunction then uses the size
expression to identify the group of VLA types based off of the same original
declaration.
I'm not particularly attached to the VLA types owning the expression,
but we're stuck with at least until someone comes up with a way
to walk the VLA expressions for a declaration.
I did the parallel fix in ASTContext for DependentSizedArrayType, but I
haven't really looked closely at it, so there might still be issues
there.
I'll clean up the code duplication in ASTContext in a followup commit.
llvm-svn: 79071
2009-08-15 02:50:32 +00:00
Mike Stump
c2f591b1e6
Refine vtable layout for virtual bases and keep better track of
...
primaries. WIP.
llvm-svn: 78950
2009-08-13 22:53:07 +00:00
Owen Anderson
41a750271b
Update for LLVM API change.
...
llvm-svn: 78946
2009-08-13 21:57:51 +00:00
Fariborz Jahanian
bbd5e8c2cf
More toward synthesizing copy assignments. SWIP.
...
llvm-svn: 78861
2009-08-12 23:34:46 +00:00
Mike Stump
938f15b033
Refactor. WIP. Eventually, this will all go into a vtable builder class.
...
llvm-svn: 78857
2009-08-12 23:14:12 +00:00
Mike Stump
82165efbc4
Refactor.
...
llvm-svn: 78854
2009-08-12 23:00:59 +00:00
Fariborz Jahanian
de7d4c264a
Patch for synthesizing copy assignment operator.
...
WIP.
llvm-svn: 78841
2009-08-12 21:14:35 +00:00
Mike Stump
cecfe61cd1
Refine vtable building for the secondary vtables to exclude yet more
...
cases where a virtual base was already used as a primary base class.
WIP.
llvm-svn: 78820
2009-08-12 17:42:21 +00:00
Benjamin Kramer
9cd050ab07
LLVMContext is a class now.
...
llvm-svn: 78691
2009-08-11 17:46:57 +00:00
Fariborz Jahanian
9d3405ceab
minor refactoring. No change otherwise.
...
llvm-svn: 78582
2009-08-10 18:46:38 +00:00
Fariborz Jahanian
24f38969d5
ir-gen for initialization, in synthesize copy constructor,
...
of base/field which have trivial copy constructor.
llvm-svn: 78516
2009-08-08 23:32:22 +00:00
Anders Carlsson
b8be93fc92
Add support for global initializers.
...
llvm-svn: 78515
2009-08-08 23:24:23 +00:00
Anders Carlsson
f40886acca
Refactor some code and implement support for global destructors for static variables.
...
llvm-svn: 78507
2009-08-08 21:45:14 +00:00
Fariborz Jahanian
f6bda5d61e
Refactoring of copy ctor ir-gen. No change in functionality.
...
llvm-svn: 78489
2009-08-08 19:31:03 +00:00
Fariborz Jahanian
b68df0bc42
Synthesized copy constructor now generates code for
...
copying non-virtual base classes which have non-trivial
constructor. Work in progress.
llvm-svn: 78436
2009-08-07 23:51:33 +00:00
Fariborz Jahanian
40134e71be
More synthesis of copy constructors. Work in progress.
...
llvm-svn: 78402
2009-08-07 20:22:40 +00:00
Mike Stump
7c32eab164
Add support for vcall generation for vtables for virtual bases. WIP.
...
llvm-svn: 78357
2009-08-06 23:48:32 +00:00
Mike Stump
3e62d00271
Also generate the rtti field for virtual bases for vtables. Turn on
...
rtti so we can properly test it. Refactor code a little. Still a
work in progress.
llvm-svn: 78343
2009-08-06 21:49:36 +00:00
Mike Stump
c255f3581a
More layout for virtual tables for virtual bases. Still in progress.
...
llvm-svn: 78314
2009-08-06 15:50:11 +00:00
Owen Anderson
758428f4e3
Update for LLVM API change.
...
llvm-svn: 78259
2009-08-05 23:18:46 +00:00
Mike Stump
183c3d2f59
Add beginnigs of rtti generation, wire up more of -fno-exceptions.
...
llvm-svn: 77751
2009-07-31 23:15:31 +00:00
Mike Stump
bc78a728ee
Add code to setup the vtable pointer in the constructor. Work in progress.
...
llvm-svn: 77699
2009-07-31 18:25:34 +00:00
Fariborz Jahanian
aa01d2a532
Patch for future ir-gen for destructor calls.
...
llvm-svn: 77608
2009-07-30 17:49:11 +00:00
Fariborz Jahanian
b77659f4ae
Some code cleanup.
...
llvm-svn: 77339
2009-07-28 18:09:28 +00:00
Fariborz Jahanian
5142fbd02e
More work toward data member access ir-gen.
...
llvm-svn: 77332
2009-07-28 17:38:28 +00:00
Fariborz Jahanian
127059c7ec
Early ir-gen for constructor prologue. This is on going.
...
llvm-svn: 76493
2009-07-20 22:35:22 +00:00
Daniel Dunbar
b6adc43f6e
Avoid generation of dead code in a few more situations.
...
- Emit variable declarations as "simple", we want to avoid forcing the creation
of a dummy basic block, but still need to make the variable available for
later use.
- With that, we can now skip IRgen for other unreachable statements (which
don't define a label).
- Anders, I added two fixmes on calls to EmitVLASize, can you check them?
llvm-svn: 76361
2009-07-19 06:58:07 +00:00
Owen Anderson
170229f68d
Update for LLVM API change, and contextify a bunch of related stuff.
...
llvm-svn: 75705
2009-07-14 23:10:40 +00:00
Owen Anderson
ae86c19e68
Update for LLVM API change.
...
llvm-svn: 75446
2009-07-13 04:10:07 +00:00
Fariborz Jahanian
5f21d2f69a
Implemented memmove_collectable API for Next runtime
...
when struct variables with GC'able members are copied into.
Will provide a test case later.
llvm-svn: 74984
2009-07-08 01:18:33 +00:00
Anders Carlsson
44bfcf0f97
Add PushConditionalTempDestruction/PopConditionalTempDestruction.
...
llvm-svn: 72835
2009-06-04 02:22:12 +00:00
Anders Carlsson
4c49bb95f8
More temporary work.
...
llvm-svn: 72796
2009-06-03 19:05:16 +00:00
Anders Carlsson
6d36343ed8
Store more information about live temporaries. No functionality change for now.
...
llvm-svn: 72793
2009-06-03 18:54:26 +00:00
Anders Carlsson
4a7b49b56a
Add a new function for emitting new functions.
...
llvm-svn: 72656
2009-05-31 01:40:14 +00:00