Anders Carlsson
a5d077df73
Support code generation of 'this' exprs
...
llvm-svn: 69050
2009-04-14 16:58:56 +00:00
Anders Carlsson
7f96b360f2
Remove asserts that weren't really useful, and that would fire in case the CleanupEntries vector needed to be reallocated.
...
llvm-svn: 68835
2009-04-10 22:49:13 +00:00
Anders Carlsson
60ce3fe140
Add code for emitting call arguments (not used yet).
...
llvm-svn: 68639
2009-04-08 20:47:54 +00:00
Anders Carlsson
468fa6366b
Add some basic support for generating C++ member functions.
...
llvm-svn: 68425
2009-04-04 20:47:02 +00:00
Anders Carlsson
e5fd6f2227
Add support for calling C++ member functions.
...
llvm-svn: 68412
2009-04-03 22:50:24 +00:00
Daniel Dunbar
f77e292a0f
Fix a subtle bug where the cleanup scope entries had a dangling block reference
...
- <rdar://problem/6732143> Crash when generating @synchronize for
zero-cost exception
- Thanks to Anders for helping track down the problem.
llvm-svn: 68186
2009-04-01 04:37:47 +00:00
Chris Lattner
2739d2bbe6
remove some obsolete comments, use an AssertingVH.
...
llvm-svn: 68151
2009-03-31 22:17:44 +00:00
Mike Stump
d2142cffbf
Fixup codegen for block literals that bleed copy/dispose information
...
from previous block literals.
llvm-svn: 67696
2009-03-25 17:58:24 +00:00
Daniel Dunbar
bf1fe8c36c
Support member reference on ?: of struct type.
...
llvm-svn: 67603
2009-03-24 02:38:23 +00:00
Mike Stump
692c6e3729
Fix codegen for support for super inside block literal expressions.
...
llvm-svn: 67406
2009-03-20 21:53:12 +00:00
Fariborz Jahanian
391d4fc7f7
More super dot-syntax property implementation
...
when there is actually a property declaration
used in the dot-syntax.
llvm-svn: 67391
2009-03-20 19:18:21 +00:00
Chris Lattner
28bcf1a429
add codegen support for casting an element to a union.
...
There are some more complex cases (_Complex and structs)
that I'm still working on.
llvm-svn: 67218
2009-03-18 18:28:57 +00:00
Mike Stump
5469f29aa9
Do up codegen for function static data and externs in functions in block
...
literals.
llvm-svn: 66984
2009-03-13 23:34:28 +00:00
Mike Stump
aeb0ffd56c
Codegen support for copy helpers for block literals.
...
llvm-svn: 66319
2009-03-07 02:35:30 +00:00
Mike Stump
d6ef62f0bf
Pass the type of the block literal around to make required temporal ordering of code clearer.
...
llvm-svn: 66284
2009-03-06 18:42:23 +00:00
Mike Stump
4446dcf061
prep work for copy/destroy helpers for block literals.
...
llvm-svn: 66159
2009-03-05 08:32:30 +00:00
Mike Stump
8473a12bfe
Move more blocks CodeGenFunction code up and out.
...
llvm-svn: 66049
2009-03-04 19:03:44 +00:00
Mike Stump
06acea8a69
Move some of the CodeGenFunction blocks code up and out. No
...
functionality change.
llvm-svn: 66048
2009-03-04 18:57:26 +00:00
Mike Stump
95435674f9
Move more of blocks codegen out of CodeGenModule and into the
...
BlockModule. No functionality change. This should help people that
don't want to know anything about blocks not be confused by the
overloaded use of the term block or nor want to see all the blocks
goop.
llvm-svn: 66042
2009-03-04 18:17:45 +00:00
Mike Stump
edb252aeba
Start the migration of more of the blocks code out of sight for most
...
people. De-duplicates BLOCK_NEEDS_FREE and friends.
llvm-svn: 66034
2009-03-04 15:32:52 +00:00
Mike Stump
97d01d50d9
Improved ABI compliance for __block variables. No testcases yet as we
...
still give an unsupported error for them due to the fact this is a
work in progress.
llvm-svn: 66007
2009-03-04 03:23:46 +00:00
Anders Carlsson
ed5e69fe50
Do some blocks cleanup and simplification. Fix a crash, and add a test case.
...
llvm-svn: 65746
2009-03-01 01:09:12 +00:00
Chris Lattner
3385fe12ce
improve compatibility with the VC++'08 C++ compiler. Patch by
...
Niklas Larsson!
llvm-svn: 65706
2009-02-28 19:01:03 +00:00
Mike Stump
1db7d04b71
First cut CodeGen support for __block variables.
...
llvm-svn: 65688
2009-02-28 09:07:16 +00:00
Douglas Gregor
deaad8cc34
Create a new TypeNodes.def file that enumerates all of the types,
...
giving them rough classifications (normal types, never-canonical
types, always-dependent types, abstract type representations) and
making it far easier to make sure that we've hit all of the cases when
decoding types.
Switched some switch() statements on the type class over to using this
mechanism, and filtering out those things we don't care about. For
example, CodeGen should never see always-dependent or non-canonical
types, while debug info generation should never see always-dependent
types. More switch() statements on the type class need to be moved
over to using this approach, so that we'll get warnings when we add a
new type then fail to account for it somewhere in the compiler.
As part of this, some types have been renamed:
TypeOfExpr -> TypeOfExprType
FunctionTypeProto -> FunctionProtoType
FunctionTypeNoProto -> FunctionNoProtoType
There shouldn't be any functionality change...
llvm-svn: 65591
2009-02-26 23:50:07 +00:00
Daniel Dunbar
76ba41ce4f
Add Type::hasPointerRepresentation predicate.
...
- For types whose native representation is a pointer.
- Use to replace ExprConstant.cpp:HasPointerEvalType,
CodeGenFunction::isObjCPointerType.
llvm-svn: 65569
2009-02-26 20:52:22 +00:00
Mike Stump
b750d928ce
CodeGen support for copied BlockDeclRefExprs.
...
llvm-svn: 65487
2009-02-25 23:33:13 +00:00
Daniel Dunbar
a374e60e57
Fold GeneraticStaticBlockVarDecl into callers.
...
- No functionality change.
llvm-svn: 65470
2009-02-25 19:45:19 +00:00
Daniel Dunbar
22a87f94a9
Pull COdeGenFunction::CreateStaticBlockVarDecl (just for creating the
...
global variable) out of GenerateStaticBlockVarDecl.
- No intended functionality change.
- Prep for some mild cleanups and PR3662.
llvm-svn: 65466
2009-02-25 19:24:29 +00:00
Chris Lattner
d7e7b8e411
first wave of fixes for @encode sema support. This is part of PR3648.
...
The big difference here is that (like string literal) @encode has
array type, not pointer type.
llvm-svn: 65391
2009-02-24 22:18:39 +00:00
Anders Carlsson
729a8202d0
Prevent accidental copying of CodeGenFunction and CodeGenModule.
...
llvm-svn: 65372
2009-02-24 04:21:31 +00:00
Daniel Dunbar
1234749853
Add low level support for generating invoke instead of calls.
...
- No functionality change.
llvm-svn: 65325
2009-02-23 17:26:39 +00:00
Mike Stump
e8b2d066ea
Copy some clenaups from Eli to code that I copied. :-)
...
llvm-svn: 65286
2009-02-22 13:55:31 +00:00
Mike Stump
624497c29a
Cleanp code with some recent suggestions.
...
llvm-svn: 65285
2009-02-22 13:27:11 +00:00
Mike Stump
cb2fbcb0c9
Add CodeGen support for the helper for BlockDeclRefExprs. The easier
...
stuff is mostly done. Move BlockHasCopyDispose up.
llvm-svn: 65242
2009-02-21 20:00:35 +00:00
Daniel Dunbar
cdbb5e336d
Set call attribute for direct calls (i.e. noreturn).
...
- Remove an unused variant of EmitCallExpr overload.
llvm-svn: 65130
2009-02-20 18:06:48 +00:00
Mike Stump
2a9baebae1
Deox and Capitolize.
...
llvm-svn: 65093
2009-02-20 00:45:51 +00:00
Mike Stump
c6ea7c1812
Fixup spacing a little.
...
llvm-svn: 64768
2009-02-17 17:00:02 +00:00
Daniel Dunbar
8eb018ab9c
Support IRgen of sqrt -> llvm.sqrt, pow -> llvm.pow.
...
- Define pow[lf]?, sqrt[lf]? as builtins.
- Add -fmath-errno option which binds to LangOptions.MathErrno
- Add new builtin flag Builtin::Context::isConstWithoutErrno for
functions which can be marked as const if errno isn't respected for
math functions. Sema automatically marks these functions as const
when they are defined, if MathErrno=0.
- IRgen uses const attribute on sqrt and pow library functions to
decide if it can use the llvm intrinsic.
llvm-svn: 64689
2009-02-16 22:43:43 +00:00
Mike Stump
0e7d7b68c8
Use getNameAsCString instead of getNameAsString and reflow the type.
...
Thanks Anders.
llvm-svn: 64571
2009-02-14 22:49:33 +00:00
Mike Stump
2d5a2878d4
Generate the helper function for blocks. Now basic codegen is
...
starting to work for blocks.
llvm-svn: 64570
2009-02-14 22:16:35 +00:00
Mike Stump
85284bacab
Condense all the blocks code into CGBlocks.cpp.
...
llvm-svn: 64457
2009-02-13 16:19:19 +00:00
Anders Carlsson
63784f4e5e
Add CodeGen support for the nodebug attribute.
...
llvm-svn: 64445
2009-02-13 08:11:52 +00:00
Anders Carlsson
6a60fa2428
Add a very basic implemenation of global blocks. This needs to be cleaned up.
...
llvm-svn: 64387
2009-02-12 17:55:02 +00:00
Anders Carlsson
2437cbfa3b
Add support for generating block call expressions.
...
llvm-svn: 64346
2009-02-12 00:39:25 +00:00
Daniel Dunbar
8d9dc4a6d5
Support IRgen of va_arg of structure as l-value.
...
llvm-svn: 64325
2009-02-11 20:59:32 +00:00
Anders Carlsson
33c1b6528f
Remove the last remnants of the Obj-C EH stack code.
...
llvm-svn: 64205
2009-02-10 06:07:49 +00:00
Anders Carlsson
33747b6c41
Start removing the old Obj-C EH stack now that the cleanup stack is used instead.
...
llvm-svn: 64203
2009-02-10 05:52:02 +00:00
Daniel Dunbar
1d425460d5
Add util Emit{LoadOf,StoreTo}Scalar methods to encapsulate conversion
...
from LLVM memory type to/from LLVM temporary type.
- No intended functionality change.
llvm-svn: 64191
2009-02-10 00:57:50 +00:00
Anders Carlsson
f4478e94b8
Add DidCallStackSave variable to CodeGenFunction.
...
llvm-svn: 64156
2009-02-09 20:20:56 +00:00
Mike Stump
fc49682f20
Add some more documentation. Also reflowed comments to 80 col.
...
llvm-svn: 64105
2009-02-08 23:14:22 +00:00
Anders Carlsson
dcb149cbef
Add a simplified EmitJumpThroughFinally and use it in CGObjC in preparation of making it use the cleanup stack.
...
llvm-svn: 64098
2009-02-08 22:25:30 +00:00
Mike Stump
284d177c7f
Wire up break and continue processing to the new stack depth adjuster.
...
If people could beat on it and let me know if there are any new
semantics required by newer language standards or DRs or any little
details I goofed on, I'd be happy to fix any issues found.
llvm-svn: 64079
2009-02-08 09:22:19 +00:00
Anders Carlsson
66c384ac2e
More cleanup stack work, PopCleanupBlock now returns a struct with the switch block and end block.
...
llvm-svn: 64072
2009-02-08 07:46:24 +00:00
Anders Carlsson
ae91d9b140
Split some functions up
...
llvm-svn: 64069
2009-02-08 03:55:35 +00:00
Anders Carlsson
a586ad7f85
CleanupScope needs to push the cleanup block in its destructor
...
llvm-svn: 64068
2009-02-08 03:22:36 +00:00
Anders Carlsson
7d70fd27a4
More cleanup stack work.
...
llvm-svn: 64059
2009-02-08 00:50:42 +00:00
Anders Carlsson
fbfb5e6530
When emitting blocks, keep track of which cleanup scope they have. Minor fixes and cleanup.
...
llvm-svn: 64053
2009-02-08 00:16:35 +00:00
Anders Carlsson
be0f76a712
Add support for emitting cleanup blocks. Make EmitCompoundStatement emit cleanup blocks if necessary
...
llvm-svn: 64051
2009-02-07 23:50:39 +00:00
Anders Carlsson
2cf8c44e43
Add a simple RAII object, to be used for pushing a cleanup entry and make the insertion point be the cleanup block.
...
llvm-svn: 64048
2009-02-07 23:30:41 +00:00
Mike Stump
0509d9635b
Ensure we track all the stack depths for all break and continue points
...
correctly. This should lay the ground work to throw the big switch
and start code gening break and continue in the presense of vlas.
llvm-svn: 64046
2009-02-07 23:02:10 +00:00
Anders Carlsson
15cb75a20c
Add plumbing for the cleanup stack.
...
llvm-svn: 64043
2009-02-07 22:53:43 +00:00
Anders Carlsson
bf8a1be33c
Split the exception object out into its own stack.
...
llvm-svn: 64032
2009-02-07 21:37:21 +00:00
Anders Carlsson
da0e4560a1
Simplify the Objective-C exception handling.
...
llvm-svn: 64031
2009-02-07 21:26:04 +00:00
Mike Stump
dc0d6be7b9
Arrange to have the correct StackDepth for while statements.
...
llvm-svn: 64021
2009-02-07 18:08:12 +00:00
Mike Stump
1d91dd98ad
Fixup goto codegen in and around VLAs.
...
llvm-svn: 64014
2009-02-07 12:52:26 +00:00
Daniel Dunbar
c79407fc40
Pull CodeGenFunction::GetUndefRValue() out of EmitUnsupportedRValue.
...
llvm-svn: 63845
2009-02-05 07:09:07 +00:00
Daniel Dunbar
ee3da87ce7
Add CodeGenFunction::ConvertTypeForMem forwarding function.
...
llvm-svn: 63678
2009-02-03 23:03:55 +00:00
Fariborz Jahanian
712bfa6478
ir-gen for nonfragile ivar bitfield access (objc2 nonfragile abi).
...
llvm-svn: 63644
2009-02-03 19:03:09 +00:00
Sanjiv Gupta
c1b58d40e6
Targets that don't have stack use global address space for parameters.
...
Specify external linkage for such globals so that llvm optimizer do
not assume there values initialized as zero.
llvm-svn: 63636
2009-02-03 18:07:49 +00:00
Sanjiv Gupta
3cac613eb8
Fixed the typo in comment.
...
llvm-svn: 63634
2009-02-03 17:23:12 +00:00
Fariborz Jahanian
c88a70d885
objc2's ir-gen for nonfragile ivar access.
...
llvm-svn: 63578
2009-02-03 00:09:52 +00:00
Daniel Dunbar
d931a87f90
More ABI API cleanup.
...
- Lift CGFunctionInfo creation above ReturnTypeUsesSret and
EmitFunction{Epi,Pro}log.
llvm-svn: 63553
2009-02-02 22:03:45 +00:00
Daniel Dunbar
7633cbf005
ABI handling API changes.
...
- Lift CGFunctionInfo creation up to callers of EmitCall.
- Move isVariadic bit out of CGFunctionInfo, take as argument to
GetFunctionType instead.
No functionality change.
llvm-svn: 63550
2009-02-02 21:43:58 +00:00
Daniel Dunbar
fd346a3644
Pull EmitReturnBlock out of FinishFunction and catch unified return
...
case correctly.
llvm-svn: 63068
2009-01-26 23:27:52 +00:00
Eli Friedman
ddea0ade30
Slight cleanup, and fix for va_arg on architectures where va_list is a
...
struct.
llvm-svn: 62585
2009-01-20 17:46:04 +00:00
Anders Carlsson
03aaf11502
Forgot to commit this
...
llvm-svn: 62042
2009-01-11 19:40:10 +00:00
Fariborz Jahanian
0196a1cd2b
This patch fixes the code gen failures which was a fallout from
...
not merging protocol properties into the classes which
use those protocols. With this patch, all my exceutable
test pass again.
llvm-svn: 62030
2009-01-10 21:06:09 +00:00
Daniel Dunbar
bb197e439d
Give "unsupported" error on calls through block pointers instead of
...
crashes.
llvm-svn: 61992
2009-01-09 16:50:52 +00:00
Anders Carlsson
8a01b79274
Change EmitVLASize to take a QualType that must be a variably modified type.
...
Emit the size even if the declared type is a variably modified type. This lets us handle
void f(int n) {
int (*a)[n];
printf("size: %d\n", sizeof(*a));
}
llvm-svn: 61285
2008-12-20 20:46:34 +00:00
Anders Carlsson
e388a5bf44
Split up emitting of VLA sizes and getting the size of a VLA.
...
llvm-svn: 61284
2008-12-20 20:27:15 +00:00
Fariborz Jahanian
b517e90662
Code gen. for ivar references; including bitfield
...
ivars.
llvm-svn: 61043
2008-12-15 20:35:07 +00:00
Anders Carlsson
6b958f9634
Store the size of the EH stack inside each BreakContinue struct so we know when a break/continue won't cross a try block.
...
llvm-svn: 60998
2008-12-13 22:52:24 +00:00
Anders Carlsson
ccbe9200f9
Add map of VLA types and their sizes
...
llvm-svn: 60939
2008-12-12 07:19:02 +00:00
Anders Carlsson
8a472c3151
Work in preparation for VLAs. Make sure to restore the stack if necessary (Saving the stack isn't implemented right now :)
...
llvm-svn: 60925
2008-12-12 05:52:00 +00:00
Fariborz Jahanian
3d8552a75d
Support for implementation of property in the case where
...
the synthesis is in an implementation of s subclass of
a super class where the property has been declared.
llvm-svn: 60792
2008-12-09 20:23:04 +00:00
Fariborz Jahanian
9ac535162b
Implemented ir-gen for 'implicit' properties using the new AST nodes.
...
llvm-svn: 59886
2008-11-22 22:30:21 +00:00
Fariborz Jahanian
8a1810f06b
New AST node to access "implicit" setter/getter using property dor syntax.
...
Issuing diagnostics when assigning to read-only properties.
This is work in progress.
llvm-svn: 59874
2008-11-22 18:39:36 +00:00
Fariborz Jahanian
d4081c697a
Added a test case for __weak field decls. Change SetVarDeclObjCAttribute
...
to static function. Added comments.
llvm-svn: 59738
2008-11-20 18:10:58 +00:00
Fariborz Jahanian
003e83004b
More objc gc stuff. Read/Write barriers for local static/extern,
...
diagnostics on use of __weak attribute on fields,
Early support for read/write barriers for objc fields.
llvm-svn: 59682
2008-11-20 00:15:42 +00:00
Daniel Dunbar
9b1335eca8
Fix redundant load of bit-fields on assignment (to get the updated
...
value).
- Use extra argument to EmitStoreThroughLValue to provide place to
write update bit-field value if caller requires it.
- This fixes several FIXMEs.
llvm-svn: 59615
2008-11-19 09:36:46 +00:00
Chris Lattner
e132e2432a
Start implementing support for @synchonized with the darwin ObjC API.
...
Patch by Fariborz!
llvm-svn: 59377
2008-11-15 21:26:17 +00:00
Daniel Dunbar
fcac22eac1
Add IsFinished arg to EmitBlock.
...
- Indicates that caller is done with the block and it can be dropped
if it has no predecessors. Useful for callers who need to make
landing pads but which may not be reached.
No functionality change.
llvm-svn: 59207
2008-11-13 01:24:05 +00:00
Daniel Dunbar
682712cda0
Comment/indentation fix.
...
llvm-svn: 59127
2008-11-12 10:12:14 +00:00
Daniel Dunbar
5fc2871820
IRgen improvements on unreachable code:
...
- Split out "simple" statements which can easily handle IR generation
when there is no insert point. These are generally statements which
start by emitting a new block or are only containers for other
statements.
- This fixes a regression in emitting dummy blocks, notably for case
statements.
- This also fixes spurious emission of a number of debug stoppoint
intrinsic instructions.
Remove unneeded sw.body block, just clear the insertion point.
Lift out CodeGenFunction::EmitStopPoint which calls into the
CGDebugInfo class when generating debug info.
Normalize definitions of Emit{Break,Continue}Stmt and usage of
ErrorUnsupported.
llvm-svn: 59118
2008-11-12 08:21:33 +00:00
Chris Lattner
cd439299b0
Move EmitBranchOnBoolExpr and ConstantFoldsToSimpleInteger to
...
CodeGenFunction.cpp. Change VisitConditionalOperator to use
constant fold instead of codegen'ing a constant conditional.
Change ForStmt to use EmitBranchOnBoolExpr, this shrinks
expr.c very slightly to 40239 lines.
llvm-svn: 59113
2008-11-12 08:04:58 +00:00
Chris Lattner
b7a9e16486
Make emission of 'if' conditions much more sophisticated when we
...
have a condition that is an &&/||. Before we used to compile things like this:
int test() {
if (x && y) foo(); else bar();
}
into:
%0 = load i32* @x ; <i32> [#uses=1]
%1 = icmp ne i32 %0, 0 ; <i1> [#uses=1]
br i1 %1, label %land_rhs, label %land_cont
land_rhs: ; preds = %entry
%2 = load i32* @y ; <i32> [#uses=1]
%3 = icmp ne i32 %2, 0 ; <i1> [#uses=1]
br label %land_cont
land_cont: ; preds = %land_rhs, %entry
%4 = phi i1 [ false, %entry ], [ %3, %land_rhs ] ; <i1> [#uses=1]
br i1 %4, label %ifthen, label %ifelse
ifthen: ; preds = %land_cont
%call = call i32 (...)* @foo() ; <i32> [#uses=0]
br label %ifend
ifelse: ; preds = %land_cont
%call1 = call i32 (...)* @bar() ; <i32> [#uses=0]
br label %ifend
ifend: ; preds = %ifelse, %ifthen
Now we turn it into the much more svelte code:
%0 = load i32* @x ; <i32> [#uses=1]
%1 = icmp ne i32 %0, 0 ; <i1> [#uses=1]
br i1 %1, label %land_lhs_true, label %ifelse
land_lhs_true: ; preds = %entry
%2 = load i32* @y ; <i32> [#uses=1]
%3 = icmp ne i32 %2, 0 ; <i1> [#uses=1]
br i1 %3, label %ifthen, label %ifelse
ifthen: ; preds = %land_lhs_true
%call = call i32 (...)* @foo() ; <i32> [#uses=0]
br label %ifend
ifelse: ; preds = %land_lhs_true, %entry
%call1 = call i32 (...)* @bar() ; <i32> [#uses=0]
br label %ifend
ifend: ; preds = %ifelse, %ifthen
Note the lack of a phi node.
This shrinks the -O0 .ll file for 176.gcc/expr.c from 43176 to 40267 lines.
llvm-svn: 59111
2008-11-12 07:46:33 +00:00
Daniel Dunbar
851eec11a7
Disable generation of basic block names in NDEBUG mode.
...
Revert to enabling generation of instruction names when not in NDEBUG
mode.
llvm-svn: 59094
2008-11-12 00:01:12 +00:00
Daniel Dunbar
5c7e3935f1
Rework IRgen invariant w.r.t. current insert point.
...
- EmitStmt is no longer required to finish with a current insertion
point defined (i.e. it does not need to make dummy
blocks). Instead, it can clear the insertion point in the builder
which indicates that the current insertion point is unreachable.
- CodeGenFunction provides HaveInsertPoint and EnsureInsertPoint
which respectively test if there is an insert point and ensure an
insertion point exists (by making a dummy block).
- Clearly mark functions in CodeGenFunction which can be called with
no insertion point defined. Currently this is a limited set, and
EmitStmt simply EnsureInsertPoint()s before emitting subsequent IR.
Remove EmitDummyBlock, which is no longer needed. Clients who haven't
already cleared the insertion point (typically via EmitBranch) can do
so by hand.
Remove isDummyBlock, which has effectively been renamed to
HaveInsertPoint.
The main thrust of this change is that we no longer have create dummy
blocks just to destroy them a short time later in EmitBlock in the
common case that there is no unreachable code following something like
a goto.
Additionally, this means that we are not using the hokey condition in
isDummyBlock that a block without a name is a dummy block. Guess how
well that works when we never emit block names!
llvm-svn: 59089
2008-11-11 23:11:34 +00:00
Daniel Dunbar
ab197ebb1a
Change EmitBranch to always clear the insert point to clarify irgen
...
invariants.
llvm-svn: 59085
2008-11-11 22:06:59 +00:00