Daniel Dunbar
8ce48d8c10
x86_32 ABI: Don't try and expand structures with bitfields.
...
- This is an ABI incompatiblity, but this is not likely to be a huge
deal in practice. For now we at least generate self consistent code
instead of crashing.
- <rdar://problem/6657601> x86-32 ABI: Bitfields in small structures
are not passed correctly
llvm-svn: 66713
2009-03-11 22:05:26 +00:00
Fariborz Jahanian
99bee42be2
Code refactoring. No change in functionality.
...
llvm-svn: 66710
2009-03-11 21:42:00 +00:00
Fariborz Jahanian
cbaf73cd26
More of objc2's ivar layout bitmap (Next: specific).
...
Work in progress.
llvm-svn: 66707
2009-03-11 20:59:05 +00:00
Duncan Sands
1918413137
Adjust for linkage name change.
...
llvm-svn: 66691
2009-03-11 20:15:27 +00:00
Duncan Sands
bdf086f7c0
Correct for change of this name in LLVM.
...
llvm-svn: 66652
2009-03-11 08:40:02 +00:00
Fariborz Jahanian
3b0f886c3f
More Next objc2's gc ivar layout bitmap work.
...
Work in progress.
llvm-svn: 66615
2009-03-11 00:07:04 +00:00
Chris Lattner
d8c7ba278e
add plumbing to report diagnostics back through sema for malformed asmstrings.
...
llvm-svn: 66598
2009-03-10 23:41:04 +00:00
Chris Lattner
35b5836147
move the asm string analysis code out of codegen into common
...
code where Sema can get to it. No functionality change.
llvm-svn: 66596
2009-03-10 23:21:44 +00:00
Devang Patel
c0f58ea60b
Emit super class debug info.
...
llvm-svn: 66580
2009-03-10 21:30:26 +00:00
Fariborz Jahanian
156506e749
ir-gen support for class getter/setter call
...
using property dot-syntax.
llvm-svn: 66556
2009-03-10 18:03:11 +00:00
Daniel Dunbar
4095d89532
Remove some now-unneeded calls to llvm::errs().flush().
...
llvm-svn: 66555
2009-03-10 18:00:19 +00:00
Anders Carlsson
0275115f66
Address Doug's comments wrt the mangler and fix Eli's test case
...
llvm-svn: 66549
2009-03-10 17:07:44 +00:00
Fariborz Jahanian
524bb20b4b
More objc2's gc meta-data work related to ivar layout bitmap.
...
Work in progress.
llvm-svn: 66546
2009-03-10 16:22:08 +00:00
Chris Lattner
f85a938985
Fix PR3682 by just disabling a broken assertion. This check should be
...
done in sema, and is reflected by the existing PR3258. In the meantime,
fix PR3682 by disabling a bogus assertion (which doesn't account for +
operands).
llvm-svn: 66533
2009-03-10 06:42:37 +00:00
Chris Lattner
6dd0f9263d
reduce duplication of parsing code between %0 and %x0 and
...
add support for modifiers on named references, like %c[foo].
llvm-svn: 66532
2009-03-10 06:38:02 +00:00
Chris Lattner
d7d5fdf090
move matching of named operands into AsmStmt class. At the same
...
time handle + operands in operand counting, fixing asm.c:t7 to
expand into $2 instead of $1.
llvm-svn: 66531
2009-03-10 06:33:24 +00:00
Chris Lattner
80337892f4
reduce nesting, use memchr instead of explicit loop, eliminate a
...
temporary std::string to fix a fixme.
llvm-svn: 66530
2009-03-10 06:11:34 +00:00
Chris Lattner
2d43eaefa2
Expand %= into ${:uid} so that the code generator emits a unique ID for the
...
asm. This allows us to properly handle the case when an optimizer duplicates
the asm, such as here:
void bar() {
int i;
for (i = 0; i < 3; ++i)
asm("foo %=" : : "r"(0));
}
we now produce:
_bar:
xorl %eax, %eax
## InlineAsm Start
foo 0
## InlineAsm End
## InlineAsm Start
foo 1
## InlineAsm End
## InlineAsm Start
foo 2
## InlineAsm End
ret
instead of:
_bar:
xorl %eax, %eax
## InlineAsm Start
foo 1
## InlineAsm End
## InlineAsm Start
foo 1
## InlineAsm End
## InlineAsm Start
foo 1
## InlineAsm End
ret
This also fixes a fixme by eliminating a static.
llvm-svn: 66528
2009-03-10 05:39:21 +00:00
Chris Lattner
72bbf17340
add some helper methods to AsmStmt and add some comments.
...
llvm-svn: 66521
2009-03-10 04:59:06 +00:00
Chris Lattner
57e673772e
slightly simplify some code, pull the 'is simple asm' case up in
...
ConvertAsmString and shrink it a bit. No functionality change.
llvm-svn: 66520
2009-03-10 04:38:46 +00:00
Daniel Dunbar
99d2835099
Backout r66408, we don't want handling of globals to rely on the
...
module symbol table. The root problem inspiring this was fixed in
r66316 (and again in r66506).
llvm-svn: 66512
2009-03-09 23:53:08 +00:00
Daniel Dunbar
ae3338429f
NeXT: Set alignment on a number of ObjC metadata variables (matching llvm-gcc).
...
llvm-svn: 66481
2009-03-09 22:18:41 +00:00
Daniel Dunbar
c2d4b62046
NeXT: Move some routines over to CreateMetadataVar.
...
- No intended functionality change.
llvm-svn: 66473
2009-03-09 21:49:58 +00:00
Daniel Dunbar
463cc8ade5
Tweak CreateMetadataVar, take the exact alignment instead of relying
...
on LLVM TargetData.
llvm-svn: 66455
2009-03-09 20:50:13 +00:00
Fariborz Jahanian
de2f33373b
More fix for bitfield ivar meta-data and code gen accessing it.
...
Now, we can actually execute dejagnu test with bitfield ivars
in non-fragile abi mode.
llvm-svn: 66448
2009-03-09 20:44:22 +00:00
Daniel Dunbar
91b000f771
Fix typo in pref commit.
...
llvm-svn: 66433
2009-03-09 20:16:39 +00:00
Daniel Dunbar
30c653655d
NeXT: Add CreateMetadataVar utility method to encapsulate creation of
...
Obj-C metadata variables (which generally should be handled the same,
although they aren't currently).
- No functionality change.
llvm-svn: 66432
2009-03-09 20:09:19 +00:00
Mike Stump
e3193ff452
Be sure to never create two functions with the same name, instead arrange to
...
reuse the prior one.
llvm-svn: 66408
2009-03-09 06:40:26 +00:00
Fariborz Jahanian
6772621acf
Code refactoring. No functional change.
...
llvm-svn: 66391
2009-03-08 20:18:37 +00:00
Anders Carlsson
4ed74dd6b7
Make mangling work with anonymous tag types. Doug, please review
...
llvm-svn: 66353
2009-03-07 23:57:03 +00:00
Anders Carlsson
16d5d291ec
Mangle Objective-C interfaces correctly (where correctly refers to what gcc does)
...
llvm-svn: 66349
2009-03-07 22:03:21 +00:00
Eli Friedman
4663a3368d
Make constant emission for @encode use the common string emission code.
...
This is a bit cleaner, and also "fixes" bad code that compares the
addresses of the string constants.
llvm-svn: 66346
2009-03-07 20:17:55 +00:00
Fariborz Jahanian
03676f557c
correct bitfield ivar offset in ivar meta-data.
...
(objc abi specific).
llvm-svn: 66345
2009-03-07 19:43:20 +00:00
Sanjiv Gupta
06cc45ec85
Mangle param names with .arg. only.
...
llvm-svn: 66343
2009-03-07 18:09:52 +00:00
Mike Stump
a6ca334389
Fixup our uses of various linkages to match how llvm now works. I think they are all
...
correct, but an extra set of ObjC eyes would be good.
llvm-svn: 66342
2009-03-07 16:33:28 +00:00
Mike Stump
de373a033f
If someone could figure out this is necessary, that would be good.
...
llvm-svn: 66341
2009-03-07 16:32:25 +00:00
Mike Stump
d9728222a4
Fix typo, need parens.
...
llvm-svn: 66337
2009-03-07 14:53:10 +00:00
Sebastian Redl
7dce7723ba
Some struct/class mismatch fixes, to silence MSVC warnings.
...
llvm-svn: 66335
2009-03-07 12:16:37 +00:00
Mike Stump
1ab20cae19
Remove last FIXME for block literal codegen that I know about and turn
...
on all the new code by default. There is still plenty of testing to
do and issues I'm sure need resolving. Let me know if you find
anything.
llvm-svn: 66323
2009-03-07 06:16:52 +00:00
Mike Stump
90d8daf592
Remove some FIXMEs for block literals that should be close to working.
...
llvm-svn: 66322
2009-03-07 06:04:31 +00:00
Eli Friedman
a374b68b5a
Back out the patch in r66302, and re-fix it properly. We assume for
...
performance that the type of the returned llvm::Value for an expression
matches the converted type of the clang::Expr; mismatches will cause all
sorts of errors and silent miscompilations.
llvm-svn: 66321
2009-03-07 03:57:15 +00:00
Mike Stump
6f7d9f8774
codegen support for dispose helpers for block literals.
...
llvm-svn: 66320
2009-03-07 02:53:18 +00:00
Mike Stump
aeb0ffd56c
Codegen support for copy helpers for block literals.
...
llvm-svn: 66319
2009-03-07 02:35:30 +00:00
Fariborz Jahanian
f5d0613ce9
Fixed a bug where generation of read-barriers caused
...
crash in ir-gen.
llvm-svn: 66302
2009-03-06 23:05:56 +00:00
Daniel Dunbar
7aecee998c
(LLVM svn up) Generalize RuntimeFunctions to RuntimeGlobals and add
...
CodeGenModule::CreateRuntimeVariable.
- No real functionality change; although we now assert on silly
things like:
--
int objc_exception_throw;
void f0() { @throw(@"A"); }
--
instead of accepting it.
llvm-svn: 66292
2009-03-06 22:13: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
Daniel Dunbar
94911a91d5
x86_64 ABI: Handle long double in union when upper eightbyte results
...
in a lone X87 class.
- PR3735.
llvm-svn: 66277
2009-03-06 17:50:25 +00:00
Daniel Dunbar
8e79b8491f
IRgen support for weak_import.
...
- <rdar://problem/6652110> clang should support weak_import
llvm-svn: 66270
2009-03-06 16:20:49 +00:00
Mike Stump
f89230d93b
Complete __Block_byref_id_object_copy cogegen for block literals.
...
llvm-svn: 66257
2009-03-06 06:12:24 +00:00
Mike Stump
fbe25dd1e4
Finish off __Block_byref_id_object_dispose codegen for block literals.
...
llvm-svn: 66247
2009-03-06 04:53:30 +00:00
Mike Stump
846bf9a797
Remove extra arg.
...
llvm-svn: 66243
2009-03-06 02:45:21 +00:00
Mike Stump
ee2a5ee5f7
More codegen support for the copy/dispose helpers for block literals.
...
llvm-svn: 66241
2009-03-06 02:29:21 +00:00
Mike Stump
0c74327715
Framework for codegen for copy/dispose helpers.
...
llvm-svn: 66231
2009-03-06 01:33:24 +00:00
Daniel Dunbar
9676015e86
Cleanup EH a bit given changes to ObjCCatchStmt.
...
- No functionality change.
llvm-svn: 66218
2009-03-06 00:01:21 +00:00
Daniel Dunbar
f804897ee9
Don't mangle names of local variables.
...
- For one thing, this adds unneeded overhead; for another, this
routine can be used to emit unnamed decls which we shouldn't try to
mangle.
llvm-svn: 66212
2009-03-05 22:59:19 +00:00
Fariborz Jahanian
c559f3f175
More function stop for objc2's ivar layout bit map.
...
llvm-svn: 66209
2009-03-05 22:39:55 +00:00
Fariborz Jahanian
01dff426c8
Adds a template for a function for objc2's gc's ivar layout
...
bitmap.
llvm-svn: 66175
2009-03-05 19:17:31 +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
Chris Lattner
ff9fbcaa8a
if we die in IR generation of a compound statement, include
...
it in the stack trace, giving us stuff like:
Stack dump:
0. Program arguments: clang t.c -emit-llvm
1. <eof> parser at end of file
2. t.c:1:5: LLVM IR generation of declaration 'a'
3. t.c:1:9: LLVM IR generation of compound statement ('{}')
4. t.c:2:3: LLVM IR generation of compound statement ('{}')
Abort
llvm-svn: 66154
2009-03-05 08:04:57 +00:00
Eli Friedman
cecc21d2f6
Make IRGen compatible with declaring a function with incomplete
...
return/argument types. (The generated IR isn't ideal, but we can't
really do better in general.)
llvm-svn: 66132
2009-03-05 04:18:07 +00:00
Eli Friedman
22fcc24b30
Initial implementation of CodeGen for incomplete function types; fixes
...
PR3688. (The FIXME is a rather big performance issue, but it only
affects code using this feature, which is relatively rare.)
llvm-svn: 66128
2009-03-05 03:16:41 +00:00
Mike Stump
cd1280b405
Avoid dispose calls when only doing gc.
...
llvm-svn: 66126
2009-03-05 02:34:38 +00:00
Devang Patel
eed256da90
Set isMain bit for MainFile.
...
llvm-svn: 66120
2009-03-05 01:55:07 +00:00
Mike Stump
626aecc4be
Add codegen support for __block variables to call _Block_object_dispose as necessary.
...
llvm-svn: 66117
2009-03-05 01:23:13 +00:00
Mike Stump
2d33d6300c
Fixup __block codegen in nested block literals.
...
llvm-svn: 66091
2009-03-04 22:48:06 +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
6c39666a77
Move more of the blocks code up and out.
...
llvm-svn: 66046
2009-03-04 18:47:42 +00:00
Devang Patel
4b6e4bb25d
Refactor code.
...
llvm-svn: 66043
2009-03-04 18:21:39 +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
Daniel Dunbar
5b9e9682f1
Support "asm" renaming of external symbols.
...
- PR3698.
llvm-svn: 66038
2009-03-04 17:31:19 +00:00
Mike Stump
376e3c0347
Start the migration of more of the blocks code out of sight for most
...
people. De-duplicates BLOCK_NEEDS_FREE and friends.
llvm-svn: 66035
2009-03-04 15:35:22 +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
0874160bd5
Add __block codegen testcase. We introduce a temporary flag to enable
...
codegen, until such time as codegen is complete enough to turn on with
-fblocks.
llvm-svn: 66031
2009-03-04 13:17:22 +00:00
Eli Friedman
e0a5b8b11f
Minor cleanup for choose expressions: add a helper that returns the
...
chosen sub-expression, rather than just evaluating the condition.
llvm-svn: 66018
2009-03-04 05:52:32 +00:00
Chris Lattner
4192bce91b
add a special case for codegen that improves the case where we have
...
multiple sequential cases to a) not create tons of fall-through basic blocks
and b) not recurse deeply. This fixes codegen on 100K deep cases, and improves
codegen on moderate cases from this:
switch i32 %tmp, label %sw.epilog [
i32 1000, label %sw.bb
i32 1001, label %sw.bb1
i32 1002, label %sw.bb2
i32 1003, label %sw.bb3
i32 1004, label %sw.bb4
...
sw.bb: ; preds = %entry
br label %sw.bb1
sw.bb1: ; preds = %entry, %sw.bb
br label %sw.bb2
sw.bb2: ; preds = %entry, %sw.bb1
br label %sw.bb3
sw.bb3: ; preds = %entry, %sw.bb2
br label %sw.bb4
to:
switch i32 %tmp, label %sw.epilog [
i32 1000, label %sw.bb
i32 1001, label %sw.bb
i32 1002, label %sw.bb
i32 1003, label %sw.bb
i32 1004, label %sw.bb
sw.bb: ;; many preds
llvm-svn: 66015
2009-03-04 04:46:18 +00:00
Eli Friedman
3efa41a478
Continuation of PR3687: fix more places to use the right type for
...
booleans.
llvm-svn: 66012
2009-03-04 04:25:14 +00:00
Eli Friedman
a1493b3b4d
Comment fix: change a question to an answer.
...
llvm-svn: 66010
2009-03-04 04:22:58 +00:00
Eli Friedman
42d2a3add6
Attempt to fix PR3709: when converting from an integer to a pointer,
...
first extend the integer to the correct width.
llvm-svn: 66009
2009-03-04 04:02:35 +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
Steve Naroff
371b8fb4c3
Fix <rdar://problem/6640991> Exception handling executes wrong clause (Daniel, please verify).
...
Also necessary to fix:
<rdar://problem/6632061> [sema] non object types should not be allowed in @catch statements
<rdar://problem/6252237> [sema] qualified id should be disallowed in @catch statements
llvm-svn: 65964
2009-03-03 19:52:17 +00:00
Fariborz Jahanian
eab5ecd8e0
Fixed an ir-gen bug in syntheszing a getter function
...
with property type which does not match its ivar and
in -fobjc-gc-only mode!
llvm-svn: 65955
2009-03-03 18:49:40 +00:00
Anders Carlsson
24b1447b19
Return 0 if the ConstExprEmitter can't handle an expression.
...
llvm-svn: 65951
2009-03-03 16:43:34 +00:00
Eli Friedman
78350edafb
Fix for PR3687: use the memory representation for booleans when a
...
sub-type describes a memory location, like the pointee type of a pointer
or the element type of an array.
llvm-svn: 65925
2009-03-03 04:48:01 +00:00
Anders Carlsson
b3b675c35e
inline asm calls should be nounwind. Chris, please review.
...
llvm-svn: 65866
2009-03-02 19:58:15 +00:00
Devang Patel
13dbe873bd
Enable Objective-C interface debug info.
...
llvm-svn: 65850
2009-03-02 17:58:28 +00:00
Daniel Dunbar
dd9427133a
Avoid crash when child iterator gives null result.
...
llvm-svn: 65812
2009-03-02 07:00:57 +00:00
Daniel Dunbar
76b7acc49f
First cut at zero-cost EH support.
...
- Still manually generates the EH code; the parts related to cleanup
need to be integrated into the cleanup stack (for proper
interaction with VLAs, etc.).
- Some differences vs gcc in corner cases; I believe our behavior is
correct but need to verify/file bugs vs gcc.
llvm-svn: 65809
2009-03-02 06:08:11 +00:00
Daniel Dunbar
7a38ce4f88
Make sure to invoke (not call) to objc_exception_throw if necessary.
...
llvm-svn: 65808
2009-03-02 05:20:36 +00:00
Daniel Dunbar
a646834214
Fix completely broken thinko in GetClassGlobal.
...
llvm-svn: 65807
2009-03-02 05:18:14 +00:00
Daniel Dunbar
0f3403cb5a
Don't set nounwind on functions when in using the new Obj-C ABI.
...
llvm-svn: 65806
2009-03-02 04:58:03 +00:00
Daniel Dunbar
b960b7b7c7
Cleanup handling of function attributes in calls.
...
- No intended functionality change.
llvm-svn: 65805
2009-03-02 04:32:35 +00:00
Mike Stump
0e425b8200
Push checking down, also, give the user a hit as to which part of the
...
block literal is causing the problem, instead of the vague reference
to the entire block literal.
llvm-svn: 65798
2009-03-02 03:04:42 +00:00
Anders Carlsson
5878c797b3
Add BLOCK_HAS_DESCRIPTOR to global blocks.
...
llvm-svn: 65788
2009-03-01 21:09:29 +00:00
Mike Stump
3a139f3793
Be sure to mark blocks with no imports as being global.
...
llvm-svn: 65784
2009-03-01 20:07:53 +00:00
Chris Lattner
a01c21f616
simplify some code.
...
llvm-svn: 65782
2009-03-01 18:47:06 +00:00
Daniel Dunbar
88367f2768
Obj-C non fragile ABI: Use GetClassGlobal in one more instance I missed.
...
llvm-svn: 65762
2009-03-01 04:51:18 +00:00
Daniel Dunbar
b1559a4499
Obj-C non fragile ABI: Add GetInterfaceEHType for getting the Obj-C
...
exception typeinfo metadata, and a few other EH related types/functions.
- No functionality change.
llvm-svn: 65761
2009-03-01 04:46:24 +00:00
Daniel Dunbar
c6928bbe29
NeXT: Unify code for creating a class global.
...
- No functionality change.
llvm-svn: 65760
2009-03-01 04:40:10 +00:00
Daniel Dunbar
947bca2cc9
ObjCAtCatchStmt's ParamStmt is always a DeclStmt.
...
llvm-svn: 65759
2009-03-01 04:28:32 +00:00
Anders Carlsson
3113eedc8a
Remove debugging code.
...
llvm-svn: 65753
2009-03-01 02:12:54 +00:00
Anders Carlsson
961763e35a
Emit errors about unsupported blocks features.
...
llvm-svn: 65751
2009-03-01 01:45:25 +00:00
Anders Carlsson
655129990a
Initialize NSConcreteStackBlock
...
llvm-svn: 65749
2009-03-01 01:17:11 +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
Fariborz Jahanian
bac73acc24
Obscure code gen bug related to sending
...
message to 'super' in a class method declared in
cateogy (darwin specific).
llvm-svn: 65709
2009-02-28 20:07:56 +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
Chris Lattner
ca05dfef65
brain thinking memcpy, fingers thinking memset :)
...
llvm-svn: 65701
2009-02-28 18:31:01 +00:00
Chris Lattner
3ef668c27a
after going around in circles a few times, finally cave and emit structure
...
copies with memcpy instead of memmove. This matches what GCC does and if it
causes a problem with a particular libc we can always fix it with a target
hook.
llvm-svn: 65699
2009-02-28 18:18:58 +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
89ee6822d8
Eliminate CXXRecordType
...
llvm-svn: 65671
2009-02-28 01:32:25 +00:00
Fariborz Jahanian
cd073cc2e9
Alignment of pointers in __objc_classlist must be on their
...
natural alignment. Otherwise, the excess hole confuses the
objc2 runtime (this is darwin specific).
llvm-svn: 65666
2009-02-28 00:54:00 +00:00
Eli Friedman
015a4742c1
Fix enumeration in switch warnings. No behavior change.
...
llvm-svn: 65659
2009-02-27 23:15:07 +00:00
Mike Stump
537abb0dec
Fix PR3612. We ensure that we add builtins to the GlobalDeclMap and
...
we ensure that things added to the module can be found even when they
are not in GlobalDeclMap. The later is for increased flexibility,
should someone want to do something tricky like extern "Ada" in the
same module.
llvm-svn: 65657
2009-02-27 22:42:30 +00:00
Eli Friedman
988a16b9b8
Change the AST generated for offsetof a bit so that it looks like a
...
normal expression, and change Evaluate and IRGen to evaluate it like a
normal expression. This simplifies the code significantly, and fixes
PR3396.
llvm-svn: 65622
2009-02-27 06:44:11 +00:00
Eli Friedman
8f5f4ea466
Change the way clang generates union types a bit so it plays well
...
with the LLVM C backend.
llvm-svn: 65615
2009-02-27 04:53:40 +00:00
Eli Friedman
97e070ed68
Minor cleanup: use getDeclAlignInBytes helper.
...
llvm-svn: 65611
2009-02-27 04:11:37 +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
Chris Lattner
d42c29f9a2
fix some sema problems with wide strings and hook up basic codegen for them.
...
llvm-svn: 65582
2009-02-26 23:01:51 +00:00
Fariborz Jahanian
ec3385733a
Couple of meta-data segments were wrong. This patch fixes them.
...
llvm-svn: 65578
2009-02-26 22:30:39 +00:00
Devang Patel
f4c205b2fa
Add support to emit debug info for objective-c interfaces.
...
(This is not yet used.)
llvm-svn: 65573
2009-02-26 21:10:26 +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
Daniel Dunbar
d26d5c220b
Remove PointerLikeType.
...
- Having pointers and references share a base was not a useful
notion.
llvm-svn: 65567
2009-02-26 19:54:52 +00:00
Daniel Dunbar
201351933a
Change PointersToResolve to list the pointee type to resolve, not the
...
pointer type.
- Drops use of PointerLikeType.
- No intended functionality change.
llvm-svn: 65566
2009-02-26 19:48:14 +00:00
Daniel Dunbar
e2617d97a5
Drop uses of isPointerLikeType.
...
- No functionality change.
llvm-svn: 65560
2009-02-26 19:03:24 +00:00
Fariborz Jahanian
03b300b734
Fix an inconsistance in objc2's meta-data related to
...
the symbol for the root meta-data.
llvm-svn: 65548
2009-02-26 18:23:47 +00:00
Anders Carlsson
600183db9e
Classify enum types correctly
...
llvm-svn: 65533
2009-02-26 17:31:15 +00:00
Daniel Dunbar
b98d1f7140
x86_64 ABI: Qualified id types are passed as pointers.
...
- <rdar://problem/6622451> Bad x86_64 code gen for message call taking one argument.
llvm-svn: 65510
2009-02-26 07:21:35 +00:00
Mike Stump
b750d928ce
CodeGen support for copied BlockDeclRefExprs.
...
llvm-svn: 65487
2009-02-25 23:33:13 +00:00
Daniel Dunbar
4208835eec
Temporarily disable clearing of insert point (to indicate unreachable
...
code) when calling noreturn functions; general expression emission
isn't ready to do the right thing in all cases.
llvm-svn: 65473
2009-02-25 20:59:29 +00:00
Daniel Dunbar
1cdbc5404b
Allow constant initializers to reference their defining decl.
...
- PR3662.
llvm-svn: 65472
2009-02-25 20:08:33 +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
Devang Patel
410dc00184
Fix comments.
...
llvm-svn: 65423
2009-02-25 01:36:11 +00:00
Devang Patel
9d7d17a8ec
Enable debug info emission for objc methods.
...
llvm-svn: 65422
2009-02-25 01:09:46 +00:00
Fariborz Jahanian
240f2b7851
patch for two things.
...
make sure objc2's nonfragile abi is enacted for Leopard too.
add -fobjc-gc-only flag to the image_info symbol.
llvm-svn: 65413
2009-02-24 23:34:44 +00:00
Devang Patel
ab19ecad22
If Loc is invalid (e.g. "self" in Objective-C) then use MainFileID's compile unit.
...
llvm-svn: 65403
2009-02-24 23:16:03 +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
Fariborz Jahanian
6fe4306195
Set flag for -fobjc-gc in IMAGE_INFO variable.
...
llvm-svn: 65387
2009-02-24 21:08:09 +00:00
Daniel Dunbar
d4ecca135a
Fix IRgen of constant expressions referring to external/static
...
variables.
- PR3657.
llvm-svn: 65381
2009-02-24 18:41:57 +00:00
Daniel Dunbar
0b0dcd987d
Some initial Obj-C zero cost EH support.
...
- Only handles cases with @try with no @catch blocks, and there are a
number of problems with the implementation. Nevertheless, this is
good enough to handled @synchronized correctly, and some other
basic uses.
llvm-svn: 65378
2009-02-24 07:47:38 +00:00
Daniel Dunbar
36ae309434
Add a note about an IRgen optimization opportunity.
...
llvm-svn: 65376
2009-02-24 06:34:04 +00:00
Anders Carlsson
729a8202d0
Prevent accidental copying of CodeGenFunction and CodeGenModule.
...
llvm-svn: 65372
2009-02-24 04:21:31 +00:00
Anders Carlsson
b9c9e1d16f
Pass the CodeGenModule object to GenerateBlockFunction, instead of *this (which will call the copy constructor).
...
Also, since we're creating a new CodeGenFunction object for each block function, we don't need to clear the BreakContinueStack.
llvm-svn: 65371
2009-02-24 04:19:41 +00:00
Mike Stump
18e91257e4
Ensure that we can't break or continue out of a block.
...
llvm-svn: 65370
2009-02-24 02:59:30 +00:00
Daniel Dunbar
94ceb61574
Fix two @synchronized bugs found by inspection: the expression to sychronize on should only be evaluated once, and it is evaluated outside the cleanup scope.
...
Also, lift SyncEnter and SyncExit up in nervous anticipation of x86-64
zero cost EH.
llvm-svn: 65362
2009-02-24 01:43:46 +00:00
Douglas Gregor
e62c0a45dd
Improve merging of function declarations. Specifically:
...
- When we are declaring a function in local scope, we can merge with
a visible declaration from an outer scope if that declaration
refers to an entity with linkage. This behavior now works in C++
and properly ignores entities without linkage.
- Diagnose the use of "static" on a function declaration in local
scope.
- Diagnose the declaration of a static function after a non-static
declaration of the same function.
- Propagate the storage specifier to a function declaration from a
prior declaration (PR3425)
- Don't name-mangle "main"
llvm-svn: 65360
2009-02-24 01:23:02 +00:00
Fariborz Jahanian
392124c78e
We should not generate __weak write barrier on indirect reference
...
of a pointer to object; This patch does this odd behavior according to
gcc.
llvm-svn: 65334
2009-02-23 18:59:50 +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
Anders Carlsson
e14282e274
Make sure to reset the DidCallStackSave variable before emitting a compound statement. Fixes PR3649.
...
llvm-svn: 65291
2009-02-22 18:44:21 +00:00
Fariborz Jahanian
0773533b27
More objc gc work. Match gcc's treatment of ivar access
...
true a local pointer to objective-c object in generating
write barriers.
llvm-svn: 65290
2009-02-22 18:40:18 +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
Daniel Dunbar
bb525c3c7f
x86_64 ABI: Actually, we can always pass things we want to pass in
...
memory using Indirect; this was a holdover from when CGCall wasn't as
robust.
llvm-svn: 65278
2009-02-22 08:17:51 +00:00
Eli Friedman
825fe7565e
Eliminate a bunch of code which should be dead.
...
llvm-svn: 65267
2009-02-22 07:29:04 +00:00
Daniel Dunbar
075d642e24
x86_64 ABI: Make sure to pass vectors that we want to pass in memory
...
as byval. Otherwise LLVM will have its own opinion about where to put
things.
We now pass all gcc dg.compat tests on x86_64.
llvm-svn: 65266
2009-02-22 07:22:25 +00:00
Daniel Dunbar
c64c481d18
x86_64 ABI: Pass 32-bit vectors as Integer to match gcc. We don't care
...
about these much but <2 x i16> shows up in the gcc test suite.
llvm-svn: 65264
2009-02-22 04:48:22 +00:00
Daniel Dunbar
f25afad9e5
x86_64 ABI: Classify <1 x i64> as INTEGER (match gcc not llvm-gcc).
...
Also, make sure to pass <1 x i64> as i64 (not <1 x i64>, which doesn't
quite work yet in the backend).
llvm-svn: 65262
2009-02-22 04:16:10 +00:00
Eli Friedman
34ef305759
Last part of PR3254: use the same alignment computation in Sema and
...
CodeGen. I'm not sure whether this actually makes any visible
difference, but it's better to be consistent anyway.
llvm-svn: 65259
2009-02-22 03:23:43 +00:00
Fariborz Jahanian
a9fecf3f9e
local array of objects are non-gc'able.
...
llvm-svn: 65251
2009-02-21 23:37:19 +00:00
Steve Naroff
8487e3e541
More work to integrate newly added ObjCQualifiedClassType into the type system.
...
This is necessary 'plumbing' to fix <rdar://problem/6497631> Message lookup is sometimes different than gcc's.
llvm-svn: 65248
2009-02-21 21:17:01 +00:00
Mike Stump
2ac40a9ff8
The blocks ABI is wrong, add a FIXME.
...
llvm-svn: 65243
2009-02-21 20:07:44 +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
Fariborz Jahanian
10bec1099c
Handle case of none gc'able objects regardless of their
...
type.
llvm-svn: 65205
2009-02-21 00:30:43 +00:00
Daniel Dunbar
3c81dabd76
Emit extern_weak when needed.
...
- PR3629.
llvm-svn: 65203
2009-02-21 00:24:10 +00:00
Daniel Dunbar
0c4eda5923
We must always mangle attribute overloadable functions; even if in a
...
system header.
- Prevents a codegen crash when anything used anything in tgmath! :)
llvm-svn: 65200
2009-02-20 23:09:27 +00:00
Daniel Dunbar
2f3a3d9f7a
Add some IRgen improvement notes.
...
llvm-svn: 65146
2009-02-20 19:34:45 +00:00
Daniel Dunbar
27032de34b
Shorten; no functionality change.
...
llvm-svn: 65145
2009-02-20 19:34:33 +00:00
Daniel Dunbar
5006f4a5f0
Take advantage of noreturn attribute to add unreachable instruction &
...
clear insertion point. The rest of IRgen should theoretically take
advantage of this to avoid emitting dead code. Theory != Practice.
llvm-svn: 65141
2009-02-20 18:54:31 +00:00
Chris Lattner
a499715c83
remove some more methods from objc decls, using the iterator
...
interfaces more consistently.
llvm-svn: 65138
2009-02-20 18:43:26 +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
Chris Lattner
90669d0500
switch ObjCMethodDecl's parameter list from being explicitly managed to an ObjCList.
...
llvm-svn: 65114
2009-02-20 06:23:21 +00:00
Eli Friedman
719ed1a9ab
Initialize the Init variable to something reasonable when we emit an
...
error, so we don't crash.
llvm-svn: 65099
2009-02-20 01:18:21 +00:00
Fariborz Jahanian
c86fb5ecb4
More objc gc's ir-gen fixes.
...
llvm-svn: 65097
2009-02-20 01:14:43 +00:00
Mike Stump
2a9baebae1
Deox and Capitolize.
...
llvm-svn: 65093
2009-02-20 00:45:51 +00:00
Mike Stump
f5a5c4fa11
Fix spacing.
...
llvm-svn: 65089
2009-02-20 00:19:45 +00:00
Fariborz Jahanian
0f466c746f
More objc's gc ir-gen stuff.
...
llvm-svn: 65077
2009-02-19 23:36:06 +00:00
Mike Stump
a67033294a
Add enough checking to ensure that non-constant block literals don't
...
appear to be constant. I'll probably redo this and throw it all away
later once we have codegen for BlockDeclRefExprs.
llvm-svn: 65070
2009-02-19 22:01:56 +00:00
Daniel Dunbar
18e1444f82
Remove IRgen constant emission assumption that LValue APValue results
...
only occur for pointer types; they are also possible for integer types
now.
- No intended functionality change, IntExprEvaluate doesn't return
LValue results yet.
llvm-svn: 65066
2009-02-19 21:44:24 +00:00
Anders Carlsson
f96954ca30
Add irgen support for the noinline attribute.
...
llvm-svn: 65056
2009-02-19 19:22:11 +00:00
Fariborz Jahanian
3114e94e10
Generate the conservative objc gc's API for now.
...
llvm-svn: 65051
2009-02-19 18:29:24 +00:00
Daniel Dunbar
f0acf7bd4c
Don't emit K&R unprototyped function definitions as varargs.
...
- <rdar://problem/6584606> clang/x86-64 - too many reg saves
llvm-svn: 65032
2009-02-19 07:15:39 +00:00
Daniel Dunbar
b2f4cdb233
Emission of global variable initialializer was broken in rare
...
situation where a tentative decl was emitted *after* the actual
initialization. This occurs in some rare situations with static decls.
- PR3613.
- I'm not particularly happy with this fix, but I don't see a simpler
or more elegant solution yet.
llvm-svn: 65018
2009-02-19 05:36:41 +00:00
Mike Stump
5d2534ada7
More codegen for blocks. The type of block literals should be better.
...
The size calculation is improved.
llvm-svn: 64994
2009-02-19 01:01:04 +00:00
Fariborz Jahanian
83e3eea5fc
Some code simplification. ir gen for gc'able array
...
of objects in objc.
llvm-svn: 64992
2009-02-19 00:48:05 +00:00
Douglas Gregor
5f361c9f1e
Address Chris's comments regarding C++ name mangling.
...
llvm-svn: 64984
2009-02-18 23:53:56 +00:00
Daniel Dunbar
a228a67637
Add anti-FIXME.
...
llvm-svn: 64969
2009-02-18 22:52:09 +00:00
Daniel Dunbar
8cdb9dae45
i386 ABI: Offset computation in va_arg was incorrect for sizeof(Ty)>4.
...
We are down to only failing gcc.dg/compat/vector-[12] (8 tests total).
llvm-svn: 64967
2009-02-18 22:28:45 +00:00
Daniel Dunbar
e60ec0abca
x86_64 ABI: Fix thinko in computation of bound for "passed in SSE regs" test.
...
Two more gcc/x86_64 failures down.
llvm-svn: 64963
2009-02-18 22:19:44 +00:00
Chris Lattner
d7cfc246f6
rip out __builtin_overload
...
llvm-svn: 64961
2009-02-18 22:14:55 +00:00
Daniel Dunbar
e3bba6e3d0
x86_64 ABI: "is passed in regs" computation for va_arg was broken for
...
things passed in mixed registers.
This knocks out 8 x86_64 failures.
llvm-svn: 64958
2009-02-18 22:05:01 +00:00
Fariborz Jahanian
9620769901
Some refactoring and simplificaiotn of objc's gc
...
ir gen.
llvm-svn: 64954
2009-02-18 21:49:28 +00:00
Daniel Dunbar
216f64379f
Simplify.
...
llvm-svn: 64944
2009-02-18 19:45:21 +00:00
Fariborz Jahanian
9959eee95d
Start generating gc'able code using the new
...
objc gc type attributes.
llvm-svn: 64935
2009-02-18 18:52:41 +00:00
Fariborz Jahanian
257eac6d0c
Cleanup objc's gc attributes code no longer needed.
...
This make warn-weak-field.m to fail (subject of
a followup patch).
attr-objc-gc.m no passes.
llvm-svn: 64925
2009-02-18 17:52:36 +00:00
Daniel Dunbar
617e89231d
x86_64 ABI: Two bug fixes.
...
1. Return of _Complex long double used wrong type.
2. va_arg of types passed in two SSE registers didn't account for
extra space in register save area.
Down to 18 failures on gcc/compat/x86_64. Combined 32/64 results are:
--
=== gcc Summary ===
# of expected passes 1292
# of unexpected failures 34
# of unsupported tests 2
--
llvm-svn: 64880
2009-02-18 03:44:19 +00:00
Mike Stump
eecd39f2d7
Avoid getNameAsCString when the decl doesn't have a name.
...
Build of the parm list with the iterator, not end().
llvm-svn: 64851
2009-02-17 23:25:52 +00:00
Argyrios Kyrtzidis
4b4f67ac0a
Remove some redundant Decl -> Decl castings.
...
llvm-svn: 64804
2009-02-17 20:23:54 +00:00
Daniel Dunbar
38ad1e6138
Change EmitConstantExpr to allow failure.
...
IRgen no longer relies on isConstantInitializer, instead we just try
to emit the constant. If that fails then in C we emit an error
unsupported (this occurs when Sema accepted something that it doesn't
know how to fold, and IRgen doesn't know how to emit) and in C++ we
emit a guarded initializer.
This ends up handling a few more cases, because IRgen was actually
able to emit some of the constants Sema accepts but can't Evaluate().
For example, PR3398.
llvm-svn: 64780
2009-02-17 18:43:32 +00:00
Daniel Dunbar
3d926cbf79
80-cols.
...
llvm-svn: 64779
2009-02-17 18:31:04 +00:00
Fariborz Jahanian
ece8582ca2
Renamed ASQualType to ExtQualType to reflect its more
...
general use; as for, objc2's gc type attributes. No
change in functionality.
llvm-svn: 64778
2009-02-17 18:27:45 +00:00