Commit Graph

1142 Commits

Author SHA1 Message Date
Fariborz Jahanian b03d5a6b36 Fix a bug in building function pointer type
corresponding to block pointer.

llvm-svn: 66940
2009-03-13 20:36:41 +00:00
Mike Stump f807ccc58e Remove FIXME, issue has been resolved.
llvm-svn: 66931
2009-03-13 19:38:54 +00:00
Chris Lattner cda4d7e196 introduce a new -fheinous-gnu-extensions flag that enables really
really horrible extensions that are disabled by default but that can
be accepted by -fheinous-gnu-extensions (but which always emit a 
warning when enabled).

As our first instance of this, implement PR3788/PR3794, which allows
non-lvalues in inline asms in contexts where lvalues are required. bleh.

llvm-svn: 66910
2009-03-13 17:38:01 +00:00
Steve Naroff c4b30e596c Fix <rdar://problem/6675489> BlockDecl should not use llvm::smallvector.
Also changed BlockDecl API to be more consistent (wrt FunctionDecl).

llvm-svn: 66904
2009-03-13 16:56:44 +00:00
Fariborz Jahanian 1b074a3eb7 Fixed an ir-gen bug related to strong-cast generation of
source being a non-pointer.

llvm-svn: 66854
2009-03-13 00:42:52 +00:00
Fariborz Jahanian 1bf7288529 More objc2's ivar layout bitmap.
bitmap generation for basic ivars seem to
work now. This is work in progress.

llvm-svn: 66836
2009-03-12 22:50:49 +00:00
Daniel Dunbar a61bb4d198 Fix uninitialized use in GetAddrOfGlobalBlock, reenable assert.
- Mike, please verify.

llvm-svn: 66762
2009-03-12 03:07:24 +00:00
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